Commit 5817eeeef25cc7c5c3fd83082512bd9f4468393b
1 parent
885805d20d
Exists in
master
and in
2 other branches
Codigo identado.
Showing
1 changed file
with
56 additions
and
57 deletions
Show diff stats
src/js/controller.js
| 1 | 1 | angular.module('focaActivarHojaRuta') |
| 2 | 2 | .controller('focaActivarHojaRutaController', [ |
| 3 | - '$scope', 'focaActivarHojaRutaService', 'focaModalService', 'focaBotoneraLateralService', | |
| 4 | - '$filter','$uibModal', | |
| 5 | - function($scope, focaActivarHojaRutaService, focaModalService, focaBotoneraLateralService, | |
| 6 | - $filter, $uibModal) { | |
| 3 | + '$scope', 'focaActivarHojaRutaService', 'focaModalService', | |
| 4 | + 'focaBotoneraLateralService', '$filter', '$uibModal', | |
| 5 | + function ($scope, focaActivarHojaRutaService, focaModalService, | |
| 6 | + focaBotoneraLateralService, $filter, $uibModal) { | |
| 7 | 7 | config(); |
| 8 | 8 | |
| 9 | 9 | //METODOS |
| ... | ... | @@ -17,17 +17,17 @@ angular.module('focaActivarHojaRuta') |
| 17 | 17 | focaBotoneraLateralService.showPausar(false); |
| 18 | 18 | focaBotoneraLateralService.showCancelar(false); |
| 19 | 19 | focaBotoneraLateralService.showGuardar(false); |
| 20 | - | |
| 20 | + | |
| 21 | 21 | init(); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | function init() { |
| 25 | 25 | $scope.now = new Date(); |
| 26 | 26 | $scope.hojasRuta = []; |
| 27 | - $scope.$broadcast('removeCabecera', 'Chofer:'); | |
| 27 | + $scope.$broadcast('removeCabecera', 'Chofer:'); | |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - $scope.seleccionarChofer = function() { | |
| 30 | + $scope.seleccionarChofer = function () { | |
| 31 | 31 | var parametrosModal = { |
| 32 | 32 | titulo: 'Búsqueda de Chofer', |
| 33 | 33 | query: '/chofer', |
| ... | ... | @@ -55,10 +55,10 @@ angular.module('focaActivarHojaRuta') |
| 55 | 55 | ] |
| 56 | 56 | }; |
| 57 | 57 | focaModalService.modal(parametrosModal).then( |
| 58 | - function(chofer) { | |
| 58 | + function (chofer) { | |
| 59 | 59 | $scope.chofer = chofer.id; |
| 60 | 60 | focaActivarHojaRutaService.getHojasRutas($scope.chofer) |
| 61 | - .then(function(hojasRutas) { | |
| 61 | + .then(function (hojasRutas) { | |
| 62 | 62 | $scope.$broadcast('addCabecera', { |
| 63 | 63 | label: 'Chofer:', |
| 64 | 64 | valor: $scope.chofer + ' - ' + chofer.nombre |
| ... | ... | @@ -66,7 +66,7 @@ angular.module('focaActivarHojaRuta') |
| 66 | 66 | |
| 67 | 67 | $scope.hojasRuta = hojasRutas.data; |
| 68 | 68 | }); |
| 69 | - }, function() {} | |
| 69 | + }, function () { } | |
| 70 | 70 | ); |
| 71 | 71 | }; |
| 72 | 72 | |
| ... | ... | @@ -102,17 +102,17 @@ angular.module('focaActivarHojaRuta') |
| 102 | 102 | return texto; |
| 103 | 103 | }; |
| 104 | 104 | |
| 105 | - $scope.activarHojaRuta = function(hojaRuta) { | |
| 106 | - validarChoferDisponible().then(function(hojaRutaAsignada) { | |
| 105 | + $scope.activarHojaRuta = function (hojaRuta) { | |
| 106 | + validarChoferDisponible().then(function (hojaRutaAsignada) { | |
| 107 | 107 | if (hojaRutaAsignada) { |
| 108 | 108 | var texto = 'El chofer tiene asignada la Hoja de Ruta Nº ' + |
| 109 | 109 | $filter('comprobante')([hojaRutaAsignada.sucursal, |
| 110 | - hojaRutaAsignada.numeroHojaRuta]) + | |
| 110 | + hojaRutaAsignada.numeroHojaRuta]) + | |
| 111 | 111 | ', ¿desea reemplazarla por esta?'; |
| 112 | 112 | |
| 113 | 113 | focaModalService |
| 114 | 114 | .confirm(texto) |
| 115 | - .then(function(res) { | |
| 115 | + .then(function (res) { | |
| 116 | 116 | if (res) activar(); |
| 117 | 117 | }); |
| 118 | 118 | } else { |
| ... | ... | @@ -122,7 +122,7 @@ angular.module('focaActivarHojaRuta') |
| 122 | 122 | function activar() { |
| 123 | 123 | focaActivarHojaRutaService |
| 124 | 124 | .activarHojaRuta(hojaRuta.id, $scope.chofer) |
| 125 | - .then(function() { | |
| 125 | + .then(function () { | |
| 126 | 126 | hojaRuta.estado = 1; |
| 127 | 127 | init(); |
| 128 | 128 | focaModalService.alert('Hoja de ruta activada'); |
| ... | ... | @@ -132,57 +132,56 @@ angular.module('focaActivarHojaRuta') |
| 132 | 132 | }; |
| 133 | 133 | |
| 134 | 134 | function validarChoferDisponible() { |
| 135 | - return new Promise(function(resolve, reject) { | |
| 135 | + return new Promise(function (resolve, reject) { | |
| 136 | 136 | focaActivarHojaRutaService |
| 137 | 137 | .getHojaRutaByIdChofer($scope.chofer) |
| 138 | - .then(function(res) { | |
| 138 | + .then(function (res) { | |
| 139 | 139 | resolve(res.data); |
| 140 | 140 | }) |
| 141 | 141 | .catch(reject); |
| 142 | 142 | }); |
| 143 | 143 | } |
| 144 | - | |
| 145 | 144 | |
| 146 | - /* | |
| 145 | + //#region Codigo Comentado | |
| 146 | + // if(focaActivarHojaRutaService.transportistaSeleccionado.COD) { | |
| 147 | + // elegirTransportista(focaActivarHojaRutaService.transportistaSeleccionado); | |
| 148 | + // } | |
| 149 | + // focaActivarHojaRutaService.cleanCisternasLocal(); | |
| 150 | + // $scope.editar = function(id) { | |
| 151 | + // $location.path('/vehiculo/' + id + '/' + $scope.idTransportista); | |
| 152 | + // }; | |
| 153 | + // $scope.solicitarConfirmacion = function(vehiculo) { | |
| 154 | + // focaModalService.confirm('¿Está seguro que desea borrar el vehiculo ' + | |
| 155 | + // vehiculo.id + ' ' + vehiculo.tractor + ' ?').then( | |
| 156 | + // function(data) { | |
| 157 | + // if(data) { | |
| 158 | + // focaActivarHojaRutaService.deleteVehiculo(vehiculo.id); | |
| 159 | + // $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1); | |
| 160 | + // } | |
| 161 | + // } | |
| 162 | + // ); | |
| 163 | + // }; | |
| 147 | 164 | |
| 148 | - if(focaActivarHojaRutaService.transportistaSeleccionado.COD) { | |
| 149 | - elegirTransportista(focaActivarHojaRutaService.transportistaSeleccionado); | |
| 150 | - } | |
| 151 | - focaActivarHojaRutaService.cleanCisternasLocal(); | |
| 152 | - $scope.editar = function(id) { | |
| 153 | - $location.path('/vehiculo/' + id + '/' + $scope.idTransportista); | |
| 154 | - }; | |
| 155 | - $scope.solicitarConfirmacion = function(vehiculo) { | |
| 156 | - focaModalService.confirm('¿Está seguro que desea borrar el vehiculo ' + | |
| 157 | - vehiculo.id + ' ' + vehiculo.tractor + ' ?').then( | |
| 158 | - function(data) { | |
| 159 | - if(data) { | |
| 160 | - focaActivarHojaRutaService.deleteVehiculo(vehiculo.id); | |
| 161 | - $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1); | |
| 162 | - } | |
| 163 | - } | |
| 164 | - ); | |
| 165 | - }; | |
| 165 | + // function elegirTransportista(transportista) { | |
| 166 | + // var codigo = ('00000' + transportista.COD).slice(-5); | |
| 167 | + // $scope.idTransportista = transportista.COD; | |
| 168 | + // $scope.filtros = transportista.NOM.trim(); | |
| 169 | + // $timeout(function() { | |
| 170 | + // $scope.$broadcast('addCabecera', { | |
| 171 | + // label: 'Transportista:', | |
| 172 | + // valor: codigo + ' - ' + transportista.NOM | |
| 173 | + // }); | |
| 174 | + // }); | |
| 175 | + // buscar(transportista.COD); | |
| 176 | + // } | |
| 166 | 177 | |
| 167 | - function elegirTransportista(transportista) { | |
| 168 | - var codigo = ('00000' + transportista.COD).slice(-5); | |
| 169 | - $scope.idTransportista = transportista.COD; | |
| 170 | - $scope.filtros = transportista.NOM.trim(); | |
| 171 | - $timeout(function() { | |
| 172 | - $scope.$broadcast('addCabecera', { | |
| 173 | - label: 'Transportista:', | |
| 174 | - valor: codigo + ' - ' + transportista.NOM | |
| 175 | - }); | |
| 176 | - }); | |
| 177 | - buscar(transportista.COD); | |
| 178 | - } | |
| 179 | - | |
| 180 | - function buscar(idTransportista) { | |
| 181 | - focaActivarHojaRutaService | |
| 182 | - .getVehiculosPorTransportista(idTransportista) | |
| 183 | - .then(function(datos) { | |
| 184 | - $scope.vehiculos = datos.data; | |
| 185 | - }); | |
| 186 | - }*/ | |
| 178 | + // function buscar(idTransportista) { | |
| 179 | + // focaActivarHojaRutaService | |
| 180 | + // .getVehiculosPorTransportista(idTransportista) | |
| 181 | + // .then(function(datos) { | |
| 182 | + // $scope.vehiculos = datos.data; | |
| 183 | + // }); | |
| 184 | + // } | |
| 185 | + //#endregion | |
| 187 | 186 | } |
| 188 | 187 | ]); |