diff --git a/app/Http/Controllers/EncuestasCargosController.php b/app/Http/Controllers/EncuestasCargosController.php index 6b5ebb9..e112dc6 100644 --- a/app/Http/Controllers/EncuestasCargosController.php +++ b/app/Http/Controllers/EncuestasCargosController.php @@ -244,7 +244,7 @@ public function getCargos($id){ //$dbCargos->prepend("Elija una opción", "0"); $index = 0; $dbData = $dbData->map(function($item) use($dbCargos, $index){ - $cargos = ''; + $cargos = '<option value="">No homologado aun...</option>'; foreach ($dbCargos as $id => $cargo) { //dd($cargo, $item); if($id == $item->cargo_id ){ diff --git a/app/Http/Controllers/EncuestasController.php b/app/Http/Controllers/EncuestasController.php index c8f5434..6bca993 100644 --- a/app/Http/Controllers/EncuestasController.php +++ b/app/Http/Controllers/EncuestasController.php @@ -473,4 +473,72 @@ public function clonarIndustrial(Request $request){ return redirect()->route('clonar.industrial')->with('toast', $toast); } + + public function cloneBancosNacionales() + { + return view('encuestas.clonar_bancos_nacional')->with('toast', false); + } + + public function clonarBancosNacionales(Request $request){ + ini_set('max_execution_time', 0); + ini_set('memory_limit', '500M'); + $periodo = $request->periodo; + + $encuestas = Cabecera_encuesta::where('periodo', $periodo) + ->where('rubro_id', 1) + ->whereIn('empresa_id', [1, 2, 5, 6, 8, 10, 53]) + ->get(); + foreach($encuestas as $encuesta){ + $cabecera = $encuesta->replicate(); + $cabecera->rubro_id = 12; + + switch ($cabecera->empresa_id) { + case 1: + $cabecera->empresa_id = 179; + break; + case 2: + $cabecera->empresa_id = 185; + break; + case 5: + $cabecera->empresa_id = 184; + break; + + case 6: + $cabecera->empresa_id = 180; + break; + case 8: + $cabecera->empresa_id = 183; + break; + case 10: + $cabecera->empresa_id = 182; + break; + case 53: + $cabecera->empresa_id = 181; + break; + + default: + $cabecera->empresa_id = 186; + break; + } + $cabecera->save(); + $encuestaCargo = $encuesta->encuestasCargo; + foreach($encuestaCargo as $cargo){ + $newCargo = $cargo->replicate(); + $newCargo->cabecera_encuesta_id = $cabecera->id; + $newCargo->save(); + $detalle = $cargo->detalleEncuestas; + if($detalle){ + $newDetalle = $detalle->replicate(); + $newDetalle->cabecera_encuesta_id = $cabecera->id; + $newDetalle->encuestas_cargo_id = $newCargo->id; + $newDetalle->save(); + } + } + + } + + $toast = true; + + return redirect()->route('clonar.bancard')->with('toast', $toast); + } } diff --git a/app/Http/Controllers/ReporteController_bkp.php b/app/Http/Controllers/ReporteController_bkp.php index 2a38f15..5f485c7 100644 --- a/app/Http/Controllers/ReporteController_bkp.php +++ b/app/Http/Controllers/ReporteController_bkp.php @@ -196,7 +196,7 @@ public function ficha($id){ }else{ $cargos = 174; } - }elseif($rubro == 1){ + }elseif($rubro == 1 || $rubro == 15){ $cargos = 400; }elseif($rubro == 2){ $cargos = 172; @@ -1400,7 +1400,7 @@ private function segmenter( &$collection, $segmento, $dbCargo, $muestraComision){ - if($rubro == 1 ){ // Bancos + if($rubro == 1 || $rubro == 15){ // Bancos $salariosBase = $detalle->where('salario_base', '>', '0')->pluck('salario_base'); $salarioMin = $salariosBase->min(); $salarioMax = $salariosBase->max(); diff --git a/app/Traits/ReportTrait.php b/app/Traits/ReportTrait.php index 19dd573..1cad296 100644 --- a/app/Traits/ReportTrait.php +++ b/app/Traits/ReportTrait.php @@ -249,25 +249,25 @@ public function cargaDetalle($item, &$itemArray){ } array_push( $itemArray, - $compMinSal, - $comp25PercSal, - $compPromSal, - $compMedSal, - $comp75PercSal, - $compMaxSal, - $ratioSalBaseTotalEfectivoMin, - $ratioSalBaseTotalEfectivo25, - $ratioSalBaseTotalEfectivoProm, - $ratioSalBaseTotalEfectivoMed, - $ratioSalBaseTotalEfectivo75, - $ratioSalBaseTotalEfectivoMax, - $ratioSalEmpresaTotalEfectivoMin, - $ratioSalEmpresaTotalEfectivo25, - $ratioSalEmpresaTotalEfectivoProm, - $ratioSalEmpresaTotalEfectivoMed, - $ratioSalEmpresaTotalEfectivo75, - $ratioSalEmpresaTotalEfectivoMax, - ); + $compMinSal, + $comp25PercSal, + $compPromSal, + $compMedSal, + $comp75PercSal, + $compMaxSal, + $ratioSalBaseTotalEfectivoMin, + $ratioSalBaseTotalEfectivo25, + $ratioSalBaseTotalEfectivoProm, + $ratioSalBaseTotalEfectivoMed, + $ratioSalBaseTotalEfectivo75, + $ratioSalBaseTotalEfectivoMax, + $ratioSalEmpresaTotalEfectivoMin, + $ratioSalEmpresaTotalEfectivo25, + $ratioSalEmpresaTotalEfectivoProm, + $ratioSalEmpresaTotalEfectivoMed, + $ratioSalEmpresaTotalEfectivo75, + $ratioSalEmpresaTotalEfectivoMax, + ); }else{ if($itemArray[10] > 0){ @@ -377,7 +377,7 @@ public function segmenter( &$collection, $segmento, $dbCargo, $muestraComision){ - if($rubro == 1 ){ // Bancos + if($rubro == 1 || $rubro == 15 ){ // Bancos $salariosBase = $detalle->where('salario_base', '>', '0')->pluck('salario_base'); $salarioMin = $salariosBase->min(); $salarioMax = $salariosBase->max(); diff --git a/resources/views/cargos_clientes/sheet.blade.php b/resources/views/cargos_clientes/sheet.blade.php index 3ad3452..58b2f71 100644 --- a/resources/views/cargos_clientes/sheet.blade.php +++ b/resources/views/cargos_clientes/sheet.blade.php @@ -20,7 +20,6 @@ <div class="row"> <div class="input-field col s12"> - input.validate <select name="area_id" id="area_id"> <option value="" disabled selected>Elija una opción</option> @foreach($dbArea as $id=>$descripcion) @@ -300,13 +299,13 @@ <div class="row"> <div class="input-field col s12"> <select name="zona_id" id="zona_id"> - <option value="" disabled selected>Elija una opción</option> + <option value="" disabled selected>@lang("cargosClientesEdit.select_label_choose")</option> @foreach($dbZona as $id=>$descripcion) <option value="{{$id}}">{{$descripcion}}</option> @endforeach </select> - <label for="zona_id">Región</label><br> + <label for="zona_id" class="active">@lang("cargosClientesEdit.form_label_region")</label><br> </div> </div> <div class="row"> @@ -329,7 +328,7 @@ @push('scripts') <script type="text/javascript"> $(document).ready(function() { - $('select').material_select(); + $('select').select2(); }); $('#area_id').val('{{ $dbDetalle->area_id}}'); @@ -354,7 +353,7 @@ function(json){ .text(data[i].text)); } - selectModelos.material_select(); + selectModelos.select2(); } ); }); diff --git a/resources/views/encuestas/clonar_bancos_nacional.blade.php b/resources/views/encuestas/clonar_bancos_nacional.blade.php new file mode 100644 index 0000000..661dae9 --- /dev/null +++ b/resources/views/encuestas/clonar_bancos_nacional.blade.php @@ -0,0 +1,55 @@ +@extends('layout') +@section('content') + <div class="row"> + <div class="browser-window"> + <div class="top-bar"> + <h4>Clonar Periodo Bancard</h4> + </div> + <div class="content"> + <form class="col s12" id="realForm" action="{{route('clonar.bancos.nacional.action')}}" method="POST"> + <div class="row"> + <div class="input-field col s6"> + <input type="text" class="validate" id="periodo" name="periodo"/> + <label for="periodo">Periodo</label> + </div> + </div> + <input type="hidden" name="_token" value="{{{ csrf_token() }}}" /> + <div class="button-group"> + <button class="btn waves-effect waves-light" type="submit" name="submit">Guardar + <i class="material-icons left">save</i> + </button> + </div> + </form> + </div> + </div> + </div> + @if($toast) + <div id="toast"></div> + @endif +@stop +@push('scripts') + <script> + if($("#toast").length > 0){ + M.toast({html: 'Archivo Procesado'}); + } + + var options = []; + $('#realForm').submit(function(e){ + if($('#fields').val() === ''){ + e.preventDefault(); + } + }); + + $('#realForm').keypress(function(event){ + if (event.keyCode === 10 || event.keyCode === 13){ + event.preventDefault(); + } + }); + + $(document).ready(function() { + $('select').select2(); + + }); + + </script> +@endpush \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index 31a98f9..b9e4d25 100644 --- a/routes/web.php +++ b/routes/web.php @@ -47,6 +47,10 @@ 'as'=> 'encuestas.clone' ]); + Route::get('clone_banca_nacional', 'EncuestasController@cloneBancosNacionales')->name('clonar.BancosNacionales'); + + Route::post('clone_banca_nacional', 'EncuestasController@clonarBancosNacionales')->name('clonar.BancosNacionalesAction'); + Route::get('clone_bancard', 'EncuestasController@cloneBancard')->name('clonar.bancard'); Route::post('clone_bancard', 'EncuestasController@clonarBancard')->name('clonar.bancardAction');