diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 37cd7c5..e277aac 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -6,9 +6,11 @@ use Auth; use App\Cabecera_encuesta; use App\beneficios_cabecera_encuesta; +use App\Traits\ClubsTrait; class HomeController extends Controller { + use ClubsTrait; /** * Create a new controller instance. * @@ -46,7 +48,9 @@ public function index() $dbEncuestas = Cabecera_encuesta::where('empresa_id', $dbEmpresa->id)->orderBy('id', 'DESC')->get(); $dbEncuesta = $dbEncuestas->first(); $dbEncuestaAnt = $dbEncuestas->get(1); + $club = $this->club($dbEmpresa->rubro_id); return view('clientes.home')->with('dbEmpresa', $dbEmpresa) + ->with('club', $club) ->with('dbEncuesta', $dbEncuesta) ->with('dbEncuestaAnt' , $dbEncuestaAnt); diff --git a/app/Http/Controllers/ReporteController.php b/app/Http/Controllers/ReporteController.php index 7e67649..f0b2ba4 100644 --- a/app/Http/Controllers/ReporteController.php +++ b/app/Http/Controllers/ReporteController.php @@ -16,6 +16,7 @@ use App\Cargo_en; use App\Rubro; use App\User; +use App\Traits\ClubsTrait; use Hash; use DB; use Auth; @@ -25,9 +26,9 @@ -class ReporteController extends Controller +class ReporteController extends Controller { - + use ClubsTrait; /** * Display a listing of the resource. * @@ -89,67 +90,7 @@ public function show($id) ->with('locale', $locale); } - private function club($rubro, $getImagen = null){ - if($this->getIdioma() == "en"){ - switch ($rubro) { - case 1: - $imagen = "images/caratula-bancos.PNG"; - $club = "Banking"; - break; - case 2: - $imagen = "images/caratula-agro-en.PNG"; - $club = "Agribusiness"; - break; - case 3: - $imagen = "images/caratula-autos.PNG"; - $club = 'Car and Machine'; - break; - case 4: - $imagen = "images/caratula-naviera-en.PNG"; - $club = "Shipping"; - break; - case 6: - $imagen = "images/caratula-bancos.PNG"; - $club = "Non Governmental Organizations"; - break; - default: - $imagen = "images/caratula-bancos.PNG"; - $club = "de Bancos"; - break; - } - }else{ - switch ($rubro) { - case 1: - $imagen = "images/caratula-bancos.PNG"; - $club = "- Bancos de Paraguay"; - break; - case 2: - $imagen = "images/caratula-agro.PNG"; - $club = "- Empresas de Agronegocios - Paraguay"; - break; - case 3: - $imagen = "images/caratula-autos.PNG"; - $club = '- Empresas del Sector Automotriz, Maquinarias y Utilitarios'; - break; - case 4: - $imagen = "images/caratula-naviera.PNG"; - $club = "- Navieras de Paraguay"; - break; - case 6: - $imagen = "images/caratula-bancos.PNG"; - $club = "- Organizaciones No Gubernamentales"; - break; - default: - $imagen = "images/caratula-bancos.PNG"; - $club = "de Bancos"; - break; - } - } - if($getImagen){ - return $imagen; - } - return $club; - } + public function lista($id){ $dbEmpresa = $id; $empresa = Empresa::find($id); diff --git a/app/Traits/ClubsTrait.php b/app/Traits/ClubsTrait.php new file mode 100644 index 0000000..ee2d4dc --- /dev/null +++ b/app/Traits/ClubsTrait.php @@ -0,0 +1,67 @@ +getLocale() == "en"){ + switch ($rubro) { + case 1: + $imagen = "images/caratula-bancos.PNG"; + $club = "Banking Club"; + break; + case 2: + $imagen = "images/caratula-agro-en.PNG"; + $club = "Agribusiness Club"; + break; + case 3: + $imagen = "images/caratula-autos.PNG"; + $club = 'Car and Machine Club'; + break; + case 4: + $imagen = "images/caratula-naviera-en.PNG"; + $club = "Shipping Club"; + break; + case 6: + $imagen = "images/caratula-bancos.PNG"; + $club = "Club: Survey of Non-Governmental Organizations"; + break; + default: + $imagen = "images/caratula-bancos.PNG"; + $club = "de Bancos"; + break; + } + }else{ + switch ($rubro) { + case 1: + $imagen = "images/caratula-bancos.PNG"; + $club = "Club - Bancos de Paraguay"; + break; + case 2: + $imagen = "images/caratula-agro.PNG"; + $club = "Club - Empresas de Agronegocios - Paraguay"; + break; + case 3: + $imagen = "images/caratula-autos.PNG"; + $club = 'Club - Empresas del Sector Automotriz, Maquinarias y Utilitarios'; + break; + case 4: + $imagen = "images/caratula-naviera.PNG"; + $club = "Club - Navieras de Paraguay"; + break; + case 6: + $imagen = "images/caratula-bancos.PNG"; + $club = "Club - Encuesta de Organizaciones No Gubernamentales"; + break; + default: + $imagen = "images/caratula-bancos.PNG"; + $club = "Club de Bancos"; + break; + } + } + if($getImagen){ + return $imagen; + } + return $club; + } +} \ No newline at end of file diff --git a/resources/views/clientes/home.blade.php b/resources/views/clientes/home.blade.php index ecfe6af..4f478a9 100644 --- a/resources/views/clientes/home.blade.php +++ b/resources/views/clientes/home.blade.php @@ -4,7 +4,7 @@
-

{{ $dbEmpresa->rubro->descripcion}}

+

{{ $club }}

diff --git a/resources/views/report/title.blade.php b/resources/views/report/title.blade.php index 0af0fd4..f255bd5 100644 --- a/resources/views/report/title.blade.php +++ b/resources/views/report/title.blade.php @@ -1,12 +1,6 @@ -@if ($locale == "en") -
-

{!! $club !!} Club

-
-@else -
-

Club {!! $club !!}

-
-@endif +
+

{!! $club !!}

+