Skip to content

Commit

Permalink
Fix: Traducción de beneficios al inglés
Browse files Browse the repository at this point in the history
  • Loading branch information
elyambay committed Oct 21, 2019
1 parent 0b6d9e4 commit 058ded8
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 23 deletions.
34 changes: 31 additions & 3 deletions app/Http/Controllers/BeneficiosController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@
use App\Color;
use App\Empresa;
use Carbon\Carbon;
use App\Traits\ClubsTrait;
use App;
use Hash;
use Auth;
use flash;

class BeneficiosController extends Controller
{
use ClubsTrait;
/**
* Display a listing of the resource.
*
Expand Down Expand Up @@ -414,13 +416,15 @@ public function getChartData(Request $request){
// Recuperamos las opciones respondidas
$opcionesResp = beneficios_respuesta::where('beneficios_pregunta_id', $pregunta->id)
->whereIn('beneficios_cabecera_encuesta_id', $aplicables)
->whereNotNull('beneficios_opcion_id')
->orderBy('beneficios_opcion_id')
->get();
}else{
// Recuperamos las opciones respondidas
$opcionesResp = beneficios_respuesta::
where('beneficios_pregunta_id', $pregunta->id)
->whereIn('beneficios_cabecera_encuesta_id', $encuestas)
->whereNotNull('beneficios_opcion_id')
->orderBy('beneficios_opcion_id')
->get();
}
Expand All @@ -437,6 +441,15 @@ public function getChartData(Request $request){
$labels = Autos_modelo::whereIn('id', $opcionesRespId)
->orderBy('id')
->pluck('descripcion');
}else if($pregunta->id == 74){
$labels = Autos_marca::whereIn('id', $opcionesRespId)
->orderBy('id')
->pluck('descripcion');
}else if($pregunta->id == 80){
$labels = Aseguradora::whereIn('id', $opcionesRespId)
->orderBy('id')
->pluck('descripcion');

}else{
if($english){
$labels = $pregunta->beneficiosOpcion
Expand All @@ -456,11 +469,13 @@ public function getChartData(Request $request){
$respuestas = collect();
$encuestasResp = beneficios_respuesta::where('beneficios_pregunta_id', $id)
->whereIn('beneficios_cabecera_encuesta_id', $encuestas)
->get();
->whereNotNull('beneficios_opcion_id')
->toSql();

foreach($opcionesResp->groupBy('beneficios_opcion_id') as $element){
$respuestas->push($element->count());
};

// sumamos el total de respuestas
$total = $respuestas->sum();

Expand All @@ -485,8 +500,21 @@ public function getChartData(Request $request){
->where("rubro_id", $rubro)
->where("periodo", $encuesta->periodo )
->first();
if($respuesta){
if($english){
$conclusion = $respuesta->conclusion;
}else{
$conclusion = $respuesta->conclusion;
}
}else{
if($english){
$conclusion = 'Sorry, a conclusion for this question has not been found';
}else{
$conclusion = 'Lo sentimos, no hemos encontrado una conclusión para la pregunta';
}
}
$data = array( "cerrada"=>"N",
"respuesta"=> $respuesta->conclusion,
"respuesta"=> $conclusion,
"titulo"=>$titulo);
}

Expand Down
5 changes: 4 additions & 1 deletion app/Http/Controllers/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,12 @@ public function index()
}else{
$dbEncuesta = collect();
}

$club = $this->club($dbEmpresa->rubro_id);

return view('beneficios.home')->with('dbEncuesta', $dbEncuesta)
->with('dbEmpresa', $dbEmpresa);
->with('dbEmpresa', $dbEmpresa)
->with('club', $club);

}else{
$dbEmpresa = $user->empresa;
Expand Down
Binary file added public/images/benefit-cover_en.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion resources/lang/en/beneficiosReportCharts.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"breadcrumb_report" => "Report",
"breadcrumb_home" => "Home",
"breadcrumb_results"=> "Results",
"title_practices" => "Práctices",
"title_practices" => "Practices",
];
10 changes: 6 additions & 4 deletions resources/lang/en/beneficiosReportIndex.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php
return [
"breadcrumb_report" => "Report",
"breadcrumb_home" => "Home",
"title_list" => "List of Indicators",
"button_sample" => "Universe Composition",
"breadcrumb_report" => "Report",
"breadcrumb_home" => "Home",
"title_list" => "List of Indicators",
"button_sample" => "Universe Composition",
"breadcrumb_complete" => "Survey",
"title_date" => "Date:"
];
10 changes: 6 additions & 4 deletions resources/lang/es/beneficiosReportIndex.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?php
return [
"breadcrumb_report" => "Reporte",
"breadcrumb_home" => "Inicio",
"title_list" => "Lista de Indicadores",
"button_sample" => "Composición de la Muestra",
"breadcrumb_report" => "Reporte",
"breadcrumb_home" => "Inicio",
"title_list" => "Lista de Indicadores",
"button_sample" => "Composición de la Muestra",
"breadcrumb_complete" => "Completar Encuesta",
"title_date" => "Fecha de Corte:"
];
6 changes: 3 additions & 3 deletions resources/views/beneficios/complete.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
<div class="nav-wrapper teal lighten-3">
<div class="col s12">
<a href="{{route('home')}}" class="breadcrumb">
<i class="material-icons left">home</i>Inicio
<i class="material-icons left">home</i>@lang('beneficiosReportIndex.breadcrumb_home')
</a>
<a class="breadcrumb">
Completar Encuesta
@lang('beneficiosReportIndex.breadcrumb_complete')
</a>
</div>
</div>
</nav>
@endsection
@section('content')
<h5><strong>Fecha de Corte:</strong> {{$dbData->periodo}}</h5>
<h5><strong>@lang('beneficiosReportIndex.title_date')</strong> {{$dbData->periodo}}</h5>
<div class="content">
<form name="cuestionario" id="cuestionario" action="{{route('beneficios.update', $dbData->id)}}" method="POST" >
<div class="row">
Expand Down
10 changes: 7 additions & 3 deletions resources/views/beneficios/home.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<nav>
<div class="nav-wrapper teal lighten-3">
<div class="col s12">
<a href="{{route('home')}}" class="breadcrumb"><i class="material-icons left">home</i>Inicio</a>
<a href="{{route('home')}}" class="breadcrumb"><i class="material-icons left">home</i>@lang('beneficiosReportIndex.breadcrumb_home')</a>
</div>
</div>
</nav>
Expand All @@ -13,12 +13,16 @@
<div class="row">
<div class="browser-window" data-intro="" data-step="2">
<div class="top-bar">
<h4>{{ $dbEmpresa->rubro->descripcion}}</h4>
<h4>{{ $club}}</h4>
</div>
<div class="content">
<div class="hoverable bordered">
<div class="row center">
<img src="{{asset('/images/benefit-cover.png')}}">
@if (App::isLocale('en'))
<img src="{{asset('/images/benefit-cover_en.png')}}">
@else
<img src="{{asset('/images/benefit-cover.png')}}">
@endif
</div>

</div>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/beneficios_report/charts.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
@endphp
<div class="hoverable bordered" >
<div class="col s11 offset-s1 center" style="text-transform:uppercase;">
@if (!$english)
@if ($english)
<h4 id="titulo">{{$item->titulo_en}}</h4>
@else
<h4 id="titulo">{{$item->titulo}}</h4>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
<div class="nav-wrapper teal lighten-3">
<div class="col s12">
<a href="{{route('home')}}" class="breadcrumb">
<i class="material-icons left">home</i>Inicio
<i class="material-icons left">home</i>@lang('beneficiosReportIndex.breadcrumb_home')
</a>
<a href="{{ route('beneficios.show', $dbEmpresa->id) }}" class="breadcrumb">
Reporte
@lang('beneficiosReportIndex.breadcrumb_report')
</a>
<a class="breadcrumb">
Composición de la Muestra
@lang('beneficiosReportIndex.button_sample')
</a>
</div>
</div>
Expand Down

0 comments on commit 058ded8

Please sign in to comment.