Commit 452c4b9fc40033f686a93f259dfd42e44a36679e
1 parent
ee52eb146f
Exists in
master
and in
2 other branches
agrego boton ver productos en detalles remito
Showing
2 changed files
with
38 additions
and
7 deletions
 
Show diff stats
src/js/controller.js
| 1 | angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', | 1 | angular.module('focaCrearHojaRuta') .controller('hojaRutaCtrl', | 
| 2 | [ | 2 | [ | 
| 3 | '$scope', | 3 | '$scope', | 
| 4 | '$uibModal', | 4 | '$uibModal', | 
| 5 | '$location', | 5 | '$location', | 
| 6 | '$filter', | 6 | '$filter', | 
| 7 | '$timeout', | 7 | '$timeout', | 
| 8 | 'focaCrearHojaRutaService', | 8 | 'focaCrearHojaRutaService', | 
| 9 | 'focaModalService', | 9 | 'focaModalService', | 
| 10 | 'focaBotoneraLateralService', | 10 | 'focaBotoneraLateralService', | 
| 11 | 'focaLoginService', | 11 | 'focaLoginService', | 
| 12 | '$localStorage', | 12 | '$localStorage', | 
| 13 | function($scope, $uibModal, $location, $filter, $timeout, | 13 | function($scope, $uibModal, $location, $filter, $timeout, | 
| 14 | focaCrearHojaRutaService, focaModalService, focaBotoneraLateralService, | 14 | focaCrearHojaRutaService, focaModalService, focaBotoneraLateralService, | 
| 15 | focaLoginSrv, $localStorage) | 15 | focaLoginSrv, $localStorage) | 
| 16 | { | 16 | { | 
| 17 | config(); | 17 | config(); | 
| 18 | 18 | ||
| 19 | function config() { | 19 | function config() { | 
| 20 | $scope.botonera = focaCrearHojaRutaService.getBotonera(); | 20 | $scope.botonera = focaCrearHojaRutaService.getBotonera(); | 
| 21 | $scope.datepickerAbierto = false; | 21 | $scope.datepickerAbierto = false; | 
| 22 | $scope.show = false; | 22 | $scope.show = false; | 
| 23 | $scope.cargando = true; | 23 | $scope.cargando = true; | 
| 24 | $scope.now = new Date(); | 24 | $scope.now = new Date(); | 
| 25 | $scope.puntoVenta = $filter('rellenarDigitos')(0, 4); | 25 | $scope.puntoVenta = $filter('rellenarDigitos')(0, 4); | 
| 26 | $scope.comprobante = $filter('rellenarDigitos')(0, 8); | 26 | $scope.comprobante = $filter('rellenarDigitos')(0, 8); | 
| 27 | 27 | ||
| 28 | //SETEO BOTONERA LATERAL | 28 | //SETEO BOTONERA LATERAL | 
| 29 | $timeout(function() { | 29 | $timeout(function() { | 
| 30 | focaBotoneraLateralService.showSalir(false); | 30 | focaBotoneraLateralService.showSalir(false); | 
| 31 | focaBotoneraLateralService.showPausar(true); | 31 | focaBotoneraLateralService.showPausar(true); | 
| 32 | focaBotoneraLateralService.showGuardar(true, $scope.crearHojaRuta); | 32 | focaBotoneraLateralService.showGuardar(true, $scope.crearHojaRuta); | 
| 33 | focaBotoneraLateralService.addCustomButton('Salir', salir); | 33 | focaBotoneraLateralService.addCustomButton('Salir', salir); | 
| 34 | }); | 34 | }); | 
| 35 | 35 | ||
| 36 | init(); | 36 | init(); | 
| 37 | $timeout(function() {getLSHojaRuta();}); | 37 | $timeout(function() {getLSHojaRuta();}); | 
| 38 | } | 38 | } | 
| 39 | 39 | ||
| 40 | function init() { | 40 | function init() { | 
| 41 | $scope.$broadcast('cleanCabecera'); | 41 | $scope.$broadcast('cleanCabecera'); | 
| 42 | 42 | ||
| 43 | $scope.hojaRuta = { | 43 | $scope.hojaRuta = { | 
| 44 | fecha: new Date(), | 44 | fecha: new Date(), | 
| 45 | litros: 0, | 45 | litros: 0, | 
| 46 | chofer: {}, | 46 | chofer: {}, | 
| 47 | vehiculo: { | 47 | vehiculo: { | 
| 48 | capacidad: 0 | 48 | capacidad: 0 | 
| 49 | }, | 49 | }, | 
| 50 | transportista: {}, | 50 | transportista: {}, | 
| 51 | tarifario: { | 51 | tarifario: { | 
| 52 | costo: null | 52 | costo: null | 
| 53 | }, | 53 | }, | 
| 54 | remitosTabla: [] | 54 | remitosTabla: [] | 
| 55 | }; | 55 | }; | 
| 56 | $scope.idLista = undefined; | 56 | $scope.idLista = undefined; | 
| 57 | 57 | ||
| 58 | focaCrearHojaRutaService.getNumeroHojaRuta().then( | 58 | focaCrearHojaRutaService.getNumeroHojaRuta().then( | 
| 59 | function(res) { | 59 | function(res) { | 
| 60 | $scope.puntoVenta = $filter('rellenarDigitos')(res.data.sucursal, 4); | 60 | $scope.puntoVenta = $filter('rellenarDigitos')(res.data.sucursal, 4); | 
| 61 | $scope.comprobante = $filter('rellenarDigitos')(res.data.numeroHojaRuta, 8); | 61 | $scope.comprobante = $filter('rellenarDigitos')(res.data.numeroHojaRuta, 8); | 
| 62 | }, | 62 | }, | 
| 63 | function(err) { | 63 | function(err) { | 
| 64 | focaModalService.alert('La terminal no esta configurada correctamente'); | 64 | focaModalService.alert('La terminal no esta configurada correctamente'); | 
| 65 | console.info(err); | 65 | console.info(err); | 
| 66 | } | 66 | } | 
| 67 | ); | 67 | ); | 
| 68 | 68 | ||
| 69 | $scope.inicial = angular.copy($scope.hojaRuta); | 69 | $scope.inicial = angular.copy($scope.hojaRuta); | 
| 70 | } | 70 | } | 
| 71 | 71 | ||
| 72 | $scope.$watch('hojaRuta', function(newValue, oldValue) { | 72 | $scope.$watch('hojaRuta', function(newValue, oldValue) { | 
| 73 | focaBotoneraLateralService.setPausarData({ | 73 | focaBotoneraLateralService.setPausarData({ | 
| 74 | label: 'hojaRuta', | 74 | label: 'hojaRuta', | 
| 75 | val: newValue | 75 | val: newValue | 
| 76 | }); | 76 | }); | 
| 77 | }, true); | 77 | }, true); | 
| 78 | 78 | ||
| 79 | $scope.crearHojaRuta = function() { | 79 | $scope.crearHojaRuta = function() { | 
| 80 | if (!$scope.hojaRuta.remitosTabla.length) { | 80 | if (!$scope.hojaRuta.remitosTabla.length) { | 
| 81 | focaModalService.alert('Ingrese Remitos'); | 81 | focaModalService.alert('Ingrese Remitos'); | 
| 82 | return; | 82 | return; | 
| 83 | } | 83 | } | 
| 84 | if (!$scope.hojaRuta.chofer.id) { | 84 | if (!$scope.hojaRuta.chofer.id) { | 
| 85 | focaModalService.alert('Ingrese Chofer'); | 85 | focaModalService.alert('Ingrese Chofer'); | 
| 86 | return; | 86 | return; | 
| 87 | } | 87 | } | 
| 88 | if (!$scope.hojaRuta.vehiculo.id) { | 88 | if (!$scope.hojaRuta.vehiculo.id) { | 
| 89 | focaModalService.alert('Ingrese Vehiculo'); | 89 | focaModalService.alert('Ingrese Vehiculo'); | 
| 90 | return; | 90 | return; | 
| 91 | } | 91 | } | 
| 92 | if (!$scope.hojaRuta.transportista.COD) { | 92 | if (!$scope.hojaRuta.transportista.COD) { | 
| 93 | focaModalService.alert('Ingrese Transportista'); | 93 | focaModalService.alert('Ingrese Transportista'); | 
| 94 | return; | 94 | return; | 
| 95 | } | 95 | } | 
| 96 | if (!$scope.hojaRuta.tarifario.costo) { | 96 | if (!$scope.hojaRuta.tarifario.costo) { | 
| 97 | focaModalService.alert('Ingrese Tarifario'); | 97 | focaModalService.alert('Ingrese Tarifario'); | 
| 98 | return; | 98 | return; | 
| 99 | } | 99 | } | 
| 100 | if (!$scope.hojaRuta.datosExtra) { | 100 | if (!$scope.hojaRuta.datosExtra) { | 
| 101 | focaModalService.alert('Ingrese Datos extra'); | 101 | focaModalService.alert('Ingrese Datos extra'); | 
| 102 | return; | 102 | return; | 
| 103 | } | 103 | } | 
| 104 | var date = new Date(); | 104 | var date = new Date(); | 
| 105 | var save = { | 105 | var save = { | 
| 106 | hojaRuta: { | 106 | hojaRuta: { | 
| 107 | id: 0, | 107 | id: 0, | 
| 108 | fechaCreacion: new Date(date.getTime()).toISOString().slice(0, 19) | 108 | fechaCreacion: new Date(date.getTime()).toISOString().slice(0, 19) | 
| 109 | .replace('T', ' '), | 109 | .replace('T', ' '), | 
| 110 | idTransportista: $scope.hojaRuta.transportista.COD, | 110 | idTransportista: $scope.hojaRuta.transportista.COD, | 
| 111 | idChofer: $scope.hojaRuta.chofer.id, | 111 | idChofer: $scope.hojaRuta.chofer.id, | 
| 112 | idVehiculo: $scope.hojaRuta.vehiculo.id, | 112 | idVehiculo: $scope.hojaRuta.vehiculo.id, | 
| 113 | tarifaFlete: $scope.hojaRuta.tarifario.costo, | 113 | tarifaFlete: $scope.hojaRuta.tarifario.costo, | 
| 114 | fechaReparto: new Date($scope.hojaRuta.fechaReparto).toISOString().substring(0, 10), | 114 | fechaReparto: new Date($scope.hojaRuta.fechaReparto).toISOString().substring(0, 10), | 
| 115 | estado: 0 | 115 | estado: 0 | 
| 116 | }, | 116 | }, | 
| 117 | remitos: $scope.hojaRuta.remitosTabla | 117 | remitos: $scope.hojaRuta.remitosTabla | 
| 118 | }; | 118 | }; | 
| 119 | save.hojaRuta = angular.extend({}, save.hojaRuta, $scope.hojaRuta.datosExtra); | 119 | save.hojaRuta = angular.extend({}, save.hojaRuta, $scope.hojaRuta.datosExtra); | 
| 120 | focaCrearHojaRutaService.crearHojaRuta(save).then( | 120 | focaCrearHojaRutaService.crearHojaRuta(save).then( | 
| 121 | function(data) { | 121 | function(data) { | 
| 122 | focaModalService.alert( | 122 | focaModalService.alert( | 
| 123 | 'Hoja ruta creada Nº: ' + | 123 | 'Hoja ruta creada Nº: ' + | 
| 124 | $filter('rellenarDigitos')(data.data.sucursal, 4) + '-' + | 124 | $filter('rellenarDigitos')(data.data.sucursal, 4) + '-' + | 
| 125 | $filter('rellenarDigitos')(data.data.numeroHojaRuta, 8) | 125 | $filter('rellenarDigitos')(data.data.numeroHojaRuta, 8) | 
| 126 | ); | 126 | ); | 
| 127 | 127 | ||
| 128 | init(); | 128 | init(); | 
| 129 | }, | 129 | }, | 
| 130 | function(error) { | 130 | function(error) { | 
| 131 | focaModalService.alert('Hubo un error al crear la hoja de ruta'); | 131 | focaModalService.alert('Hubo un error al crear la hoja de ruta'); | 
| 132 | console.info(error); | 132 | console.info(error); | 
| 133 | } | 133 | } | 
| 134 | ); | 134 | ); | 
| 135 | }; | 135 | }; | 
| 136 | 136 | ||
| 137 | $scope.seleccionarTransportista = function() { | 137 | $scope.seleccionarTransportista = function() { | 
| 138 | if (eligioPreConfirmado()) return; | 138 | if (eligioPreConfirmado()) return; | 
| 139 | var parametrosModal = { | 139 | var parametrosModal = { | 
| 140 | titulo: 'Búsqueda de transportista', | 140 | titulo: 'Búsqueda de transportista', | 
| 141 | query: '/transportista', | 141 | query: '/transportista', | 
| 142 | columnas: [ | 142 | columnas: [ | 
| 143 | { | 143 | { | 
| 144 | nombre: 'Código', | 144 | nombre: 'Código', | 
| 145 | propiedad: 'COD' | 145 | propiedad: 'COD' | 
| 146 | }, | 146 | }, | 
| 147 | { | 147 | { | 
| 148 | nombre: 'Nombre', | 148 | nombre: 'Nombre', | 
| 149 | propiedad: 'NOM' | 149 | propiedad: 'NOM' | 
| 150 | }, | 150 | }, | 
| 151 | { | 151 | { | 
| 152 | nombre: 'CUIT', | 152 | nombre: 'CUIT', | 
| 153 | propiedad: 'CUIT' | 153 | propiedad: 'CUIT' | 
| 154 | } | 154 | } | 
| 155 | ] | 155 | ] | 
| 156 | }; | 156 | }; | 
| 157 | focaModalService.modal(parametrosModal).then( | 157 | focaModalService.modal(parametrosModal).then( | 
| 158 | function(proveedor) { | 158 | function(proveedor) { | 
| 159 | $scope.hojaRuta.transportista = proveedor; | 159 | $scope.hojaRuta.transportista = proveedor; | 
| 160 | $scope.$broadcast('addCabecera', { | 160 | $scope.$broadcast('addCabecera', { | 
| 161 | label: 'Transportista:', | 161 | label: 'Transportista:', | 
| 162 | valor: $filter('rellenarDigitos')(proveedor.COD, 5) + ' - ' + | 162 | valor: $filter('rellenarDigitos')(proveedor.COD, 5) + ' - ' + | 
| 163 | proveedor.NOM | 163 | proveedor.NOM | 
| 164 | }); | 164 | }); | 
| 165 | }, function() { | 165 | }, function() { | 
| 166 | 166 | ||
| 167 | } | 167 | } | 
| 168 | ); | 168 | ); | 
| 169 | }; | 169 | }; | 
| 170 | 170 | ||
| 171 | $scope.seleccionarChofer = function() { | 171 | $scope.seleccionarChofer = function() { | 
| 172 | var parametrosModal = { | 172 | var parametrosModal = { | 
| 173 | titulo: 'Búsqueda de Chofer', | 173 | titulo: 'Búsqueda de Chofer', | 
| 174 | query: '/chofer', | 174 | query: '/chofer', | 
| 175 | columnas: [ | 175 | columnas: [ | 
| 176 | { | 176 | { | 
| 177 | propiedad: 'id', | 177 | propiedad: 'id', | 
| 178 | nombre: 'Código', | 178 | nombre: 'Código', | 
| 179 | filtro: { | 179 | filtro: { | 
| 180 | nombre: 'rellenarDigitos', | 180 | nombre: 'rellenarDigitos', | 
| 181 | parametro: 3 | 181 | parametro: 3 | 
| 182 | } | 182 | } | 
| 183 | }, | 183 | }, | 
| 184 | { | 184 | { | 
| 185 | propiedad: 'nombre', | 185 | propiedad: 'nombre', | 
| 186 | nombre: 'Nombre' | 186 | nombre: 'Nombre' | 
| 187 | }, | 187 | }, | 
| 188 | { | 188 | { | 
| 189 | propiedad: 'dni', | 189 | propiedad: 'dni', | 
| 190 | nombre: 'DNI' | 190 | nombre: 'DNI' | 
| 191 | }, | 191 | }, | 
| 192 | { | 192 | { | 
| 193 | propiedad: 'telefono', | 193 | propiedad: 'telefono', | 
| 194 | nombre: 'Teléfono' | 194 | nombre: 'Teléfono' | 
| 195 | } | 195 | } | 
| 196 | ] | 196 | ] | 
| 197 | }; | 197 | }; | 
| 198 | focaModalService.modal(parametrosModal).then( | 198 | focaModalService.modal(parametrosModal).then( | 
| 199 | function(chofer) { | 199 | function(chofer) { | 
| 200 | $scope.hojaRuta.chofer = chofer; | 200 | $scope.hojaRuta.chofer = chofer; | 
| 201 | $scope.$broadcast('addCabecera', { | 201 | $scope.$broadcast('addCabecera', { | 
| 202 | label: 'Chofer:', | 202 | label: 'Chofer:', | 
| 203 | valor: $filter('rellenarDigitos')(chofer.id, 3) + ' - ' +chofer.nombre | 203 | valor: $filter('rellenarDigitos')(chofer.id, 3) + ' - ' +chofer.nombre | 
| 204 | }); | 204 | }); | 
| 205 | }, function() { | 205 | }, function() { | 
| 206 | // funcion ejecutada cuando se cancela el modal | 206 | // funcion ejecutada cuando se cancela el modal | 
| 207 | } | 207 | } | 
| 208 | ); | 208 | ); | 
| 209 | }; | 209 | }; | 
| 210 | 210 | ||
| 211 | $scope.seleccionarVehiculo = function() { | 211 | $scope.seleccionarVehiculo = function() { | 
| 212 | if (!eligioFecha() || eligioPreConfirmado()) return; | 212 | if (!eligioFecha() || eligioPreConfirmado()) return; | 
| 213 | modalVehiculos(); | 213 | modalVehiculos(); | 
| 214 | }; | 214 | }; | 
| 215 | 215 | ||
| 216 | $scope.seleccionarTarifario = function() { | 216 | $scope.seleccionarTarifario = function() { | 
| 217 | focaModalService | 217 | focaModalService | 
| 218 | .prompt({ | 218 | .prompt({ | 
| 219 | titulo: 'Tarifa flete', | 219 | titulo: 'Tarifa flete', | 
| 220 | value: $scope.hojaRuta.tarifario.costo | 220 | value: $scope.hojaRuta.tarifario.costo | 
| 221 | }) | 221 | }) | 
| 222 | .then(function(costo) { | 222 | .then(function(costo) { | 
| 223 | if (isNaN(costo)) { | 223 | if (isNaN(costo)) { | 
| 224 | focaModalService | 224 | focaModalService | 
| 225 | .alert('Ingrese un valor válido') | 225 | .alert('Ingrese un valor válido') | 
| 226 | .then(function() { | 226 | .then(function() { | 
| 227 | $scope.seleccionarTarifario(); | 227 | $scope.seleccionarTarifario(); | 
| 228 | }); | 228 | }); | 
| 229 | 229 | ||
| 230 | return; | 230 | return; | 
| 231 | } | 231 | } | 
| 232 | 232 | ||
| 233 | $scope.hojaRuta.tarifario.costo = costo; | 233 | $scope.hojaRuta.tarifario.costo = costo; | 
| 234 | $scope.$broadcast('addCabecera', { | 234 | $scope.$broadcast('addCabecera', { | 
| 235 | label: 'Tarifario:', | 235 | label: 'Tarifario:', | 
| 236 | valor: costo | 236 | valor: costo | 
| 237 | }); | 237 | }); | 
| 238 | }); | 238 | }); | 
| 239 | }; | 239 | }; | 
| 240 | 240 | ||
| 241 | $scope.seleccionarRemitos = function() { | 241 | $scope.seleccionarRemitos = function() { | 
| 242 | if (eligioPreConfirmado() || !eligioFecha() || !eligioVehiculo()) return; | 242 | if (eligioPreConfirmado() || !eligioFecha() || !eligioVehiculo()) return; | 
| 243 | var modalInstance = $uibModal.open( | 243 | var modalInstance = $uibModal.open( | 
| 244 | { | 244 | { | 
| 245 | ariaLabelledBy: 'Busqueda de Remito', | 245 | ariaLabelledBy: 'Busqueda de Remito', | 
| 246 | templateUrl: 'foca-modal-remito.html', | 246 | templateUrl: 'foca-modal-remito.html', | 
| 247 | controller: 'focaModalRemitoController', | 247 | controller: 'focaModalRemitoController', | 
| 248 | size: 'lg', | 248 | size: 'lg', | 
| 249 | resolve: {usadoPor: function() {return 'hojaRuta';}} | 249 | resolve: {usadoPor: function() {return 'hojaRuta';}} | 
| 250 | } | 250 | } | 
| 251 | ); | 251 | ); | 
| 252 | modalInstance.result.then( | 252 | modalInstance.result.then( | 
| 253 | function(remito) { | 253 | function(remito) { | 
| 254 | // TODO: borrar cuando no se use definitivamente | 254 | // TODO: borrar cuando no se use definitivamente | 
| 255 | // for (var i = $scope.hojaRuta.remitosTabla.length - 1; i >= 0; i--) { | 255 | // for (var i = $scope.hojaRuta.remitosTabla.length - 1; i >= 0; i--) { | 
| 256 | // if ($scope.hojaRuta.remitosTabla[i].id === remito.id) { | 256 | // if ($scope.hojaRuta.remitosTabla[i].id === remito.id) { | 
| 257 | // focaModalService.alert('Remito ya incluido'); | 257 | // focaModalService.alert('Remito ya incluido'); | 
| 258 | // return; | 258 | // return; | 
| 259 | // } | 259 | // } | 
| 260 | // } | 260 | // } | 
| 261 | 261 | ||
| 262 | // var litros = 0; | 262 | // var litros = 0; | 
| 263 | // for (var j = remito.articulosRemito.length - 1; j >= 0; j--) { | 263 | // for (var j = remito.articulosRemito.length - 1; j >= 0; j--) { | 
| 264 | // litros = litros + parseFloat(remito.articulosRemito[j].cantidad); | 264 | // litros = litros + parseFloat(remito.articulosRemito[j].cantidad); | 
| 265 | // } | 265 | // } | 
| 266 | 266 | ||
| 267 | // if ($scope.hojaRuta.litros >= $scope.hojaRuta.vehiculo.capacidad) { | 267 | // if ($scope.hojaRuta.litros >= $scope.hojaRuta.vehiculo.capacidad) { | 
| 268 | // focaModalService.alert( | 268 | // focaModalService.alert( | 
| 269 | // 'Debe ingresar toda la información para el transporte' | 269 | // 'Debe ingresar toda la información para el transporte' | 
| 270 | // ); | 270 | // ); | 
| 271 | // return; | 271 | // return; | 
| 272 | // } | 272 | // } | 
| 273 | 273 | ||
| 274 | //if($scope.hojaRuta.litros + litros >= $scope.hojaRuta.vehiculo.capacidad) | 274 | //if($scope.hojaRuta.litros + litros >= $scope.hojaRuta.vehiculo.capacidad) | 
| 275 | // { | 275 | // { | 
| 276 | // var litrostotales = litros; | 276 | // var litrostotales = litros; | 
| 277 | // litros = $scope.hojaRuta.vehiculo.capacidad - $scope.hojaRuta.litros; | 277 | // litros = $scope.hojaRuta.vehiculo.capacidad - $scope.hojaRuta.litros; | 
| 278 | // focaModalService.alert( | 278 | // focaModalService.alert( | 
| 279 | // 'La carga excede la capacidad disponible del vehiculo. ' + | 279 | // 'La carga excede la capacidad disponible del vehiculo. ' + | 
| 280 | // 'Excedente no cargado: ' + (litrostotales - litros) + ' litros' | 280 | // 'Excedente no cargado: ' + (litrostotales - litros) + ' litros' | 
| 281 | // ); | 281 | // ); | 
| 282 | // } | 282 | // } | 
| 283 | 283 | ||
| 284 | // remito.litros = litros; | 284 | // remito.litros = litros; | 
| 285 | // $scope.hojaRuta.litros = $scope.hojaRuta.litros + litros; | 285 | // $scope.hojaRuta.litros = $scope.hojaRuta.litros + litros; | 
| 286 | $scope.cargarCisterna(remito.id).then(function(response) { | 286 | $scope.cargarCisterna(remito.id).then(function(response) { | 
| 287 | $scope.hojaRuta.remitosTabla.push(remito); | 287 | $scope.hojaRuta.remitosTabla.push(remito); | 
| 288 | if (!response) $scope.seleccionarRemitos(); | 288 | if (!response) $scope.seleccionarRemitos(); | 
| 289 | }, function() { | 289 | }, function() { | 
| 290 | $scope.seleccionarRemitos(); | 290 | $scope.seleccionarRemitos(); | 
| 291 | }); | 291 | }); | 
| 292 | }, function() { | 292 | }, function() { | 
| 293 | // funcion ejecutada cuando se cancela el modal | 293 | // funcion ejecutada cuando se cancela el modal | 
| 294 | } | 294 | } | 
| 295 | ); | 295 | ); | 
| 296 | }; | 296 | }; | 
| 297 | 297 | ||
| 298 | $scope.seleccionarVehiculosPrecargados = function() { | 298 | $scope.seleccionarVehiculosPrecargados = function() { | 
| 299 | if (!eligioFecha()) return; | 299 | if (!eligioFecha()) return; | 
| 300 | modalVehiculos(true); | 300 | modalVehiculos(true); | 
| 301 | }; | 301 | }; | 
| 302 | 302 | ||
| 303 | $scope.cargarCisterna = function(idRemito) { | 303 | $scope.cargarCisterna = function(idRemito) { | 
| 304 | if (!eligioFecha() || !$scope.hojaRuta.vehiculo.id) return; | 304 | if (!eligioFecha() || !$scope.hojaRuta.vehiculo.id) return; | 
| 305 | var modalInstance = $uibModal.open( | 305 | var modalInstance = $uibModal.open( | 
| 306 | { | 306 | { | 
| 307 | ariaLabelledBy: 'Busqueda de Vehiculo', | 307 | ariaLabelledBy: 'Busqueda de Vehiculo', | 
| 308 | templateUrl: 'foca-detalle-vehiculo.html', | 308 | templateUrl: 'foca-detalle-vehiculo.html', | 
| 309 | controller: 'focaDetalleVehiculo', | 309 | controller: 'focaDetalleVehiculo', | 
| 310 | size: 'lg', | 310 | size: 'lg', | 
| 311 | resolve: { | 311 | resolve: { | 
| 312 | idVehiculo: function() {return $scope.hojaRuta.vehiculo.id;}, | 312 | idVehiculo: function() {return $scope.hojaRuta.vehiculo.id;}, | 
| 313 | idRemito: function() {return idRemito;}, | 313 | idRemito: function() {return idRemito;}, | 
| 314 | fechaReparto: function() {return $scope.hojaRuta.fechaReparto;} | 314 | fechaReparto: function() {return $scope.hojaRuta.fechaReparto;} | 
| 315 | } | 315 | } | 
| 316 | } | 316 | } | 
| 317 | ); | 317 | ); | 
| 318 | return modalInstance.result; | 318 | return modalInstance.result; | 
| 319 | }; | 319 | }; | 
| 320 | 320 | ||
| 321 | $scope.seleccionarFechaEntrega = function() { | 321 | $scope.seleccionarFechaEntrega = function() { | 
| 322 | if (!$scope.hojaRuta.fechaReparto) { | 322 | if (!$scope.hojaRuta.fechaReparto) { | 
| 323 | elegirFecha(); | 323 | elegirFecha(); | 
| 324 | return; | 324 | return; | 
| 325 | } | 325 | } | 
| 326 | focaModalService | 326 | focaModalService | 
| 327 | .confirm('Si cambia la fecha se perderán los datos actuales') | 327 | .confirm('Si cambia la fecha se perderán los datos actuales') | 
| 328 | .then(function() { | 328 | .then(function() { | 
| 329 | elegirFecha(); | 329 | elegirFecha(); | 
| 330 | }, function() { | 330 | }, function() { | 
| 331 | return ; | 331 | return ; | 
| 332 | }); | 332 | }); | 
| 333 | }; | 333 | }; | 
| 334 | 334 | ||
| 335 | $scope.seleccionarDatosExtra = function() { | 335 | $scope.seleccionarDatosExtra = function() { | 
| 336 | var datosHojaRuta = $scope.hojaRuta.datosExtra; | 336 | var datosHojaRuta = $scope.hojaRuta.datosExtra; | 
| 337 | var modalInstance = $uibModal.open( | 337 | var modalInstance = $uibModal.open( | 
| 338 | { | 338 | { | 
| 339 | templateUrl: 'foca-modal-datos-hoja-ruta.html', | 339 | templateUrl: 'foca-modal-datos-hoja-ruta.html', | 
| 340 | controller: 'focaModalDatosHojaRutaCtrl', | 340 | controller: 'focaModalDatosHojaRutaCtrl', | 
| 341 | size: 'lg', | 341 | size: 'lg', | 
| 342 | resolve: { | 342 | resolve: { | 
| 343 | parametrosDatos: function() { | 343 | parametrosDatos: function() { | 
| 344 | return { | 344 | return { | 
| 345 | datosHojaRuta: datosHojaRuta | 345 | datosHojaRuta: datosHojaRuta | 
| 346 | }; | 346 | }; | 
| 347 | } | 347 | } | 
| 348 | } | 348 | } | 
| 349 | } | 349 | } | 
| 350 | ); | 350 | ); | 
| 351 | return modalInstance.result.then(function(datosExtra) { | 351 | return modalInstance.result.then(function(datosExtra) { | 
| 352 | $scope.hojaRuta.datosExtra = datosExtra; | 352 | $scope.hojaRuta.datosExtra = datosExtra; | 
| 353 | }, function() { | 353 | }, function() { | 
| 354 | //se ejecuta cuando se cancela el modal | 354 | //se ejecuta cuando se cancela el modal | 
| 355 | }); | 355 | }); | 
| 356 | }; | 356 | }; | 
| 357 | 357 | ||
| 358 | $scope.desasociarRemito = function(key, idRemito) { | 358 | $scope.desasociarRemito = function(key, idRemito) { | 
| 359 | var idsRemito = [idRemito]; | 359 | var idsRemito = [idRemito]; | 
| 360 | focaModalService.confirm('¿Está seguro que desea desasociar este remito del' + | 360 | focaModalService.confirm('¿Está seguro que desea desasociar este remito del' + | 
| 361 | ' vehículo?').then(function() { | 361 | ' vehículo?').then(function() { | 
| 362 | focaCrearHojaRutaService.desasociarRemitos(idsRemito, | 362 | focaCrearHojaRutaService.desasociarRemitos(idsRemito, | 
| 363 | $scope.hojaRuta.vehiculo.id, $scope.hojaRuta.remitosTabla.length <= 1).then( | 363 | $scope.hojaRuta.vehiculo.id, $scope.hojaRuta.remitosTabla.length <= 1) | 
| 364 | function() { | 364 | .then(function() { | 
| 365 | $scope.hojaRuta.remitosTabla.splice(key, 1); | 365 | $scope.hojaRuta.remitosTabla.splice(key, 1); | 
| 366 | focaModalService.alert('Remito desasociado con éxito'); | 366 | focaModalService.alert('Remito desasociado con éxito'); | 
| 367 | } | 367 | }); | 
| 368 | ); | ||
| 369 | }); | 368 | }); | 
| 370 | }; | 369 | }; | 
| 370 | |||
| 371 | $scope.verProductosRemito = function(idRemito) { | ||
| 372 | var parametrosModal = { | ||
| 373 | titulo: 'Articulos remito', | ||
| 374 | query: '/articulos/remito/' + idRemito, | ||
| 375 | soloMostrar: true, | ||
| 376 | columnas: [ | ||
| 377 | { | ||
| 378 | nombre: 'Código', | ||
| 379 | propiedad: 'codigo' | ||
| 380 | }, | ||
| 381 | { | ||
| 382 | nombre: 'Descripción', | ||
| 383 | propiedad: 'descripcion' | ||
| 384 | }, | ||
| 385 | { | ||
| 386 | nombre: 'Cantidad', | ||
| 387 | propiedad: 'cantidad' | ||
| 388 | } | ||
| 389 | ] | ||
| 390 | }; | ||
| 391 | focaModalService.modal(parametrosModal).then(); | ||
| 392 | }; | ||
| 371 | 393 | ||
| 372 | function elegirFecha() { | 394 | function elegirFecha() { | 
| 373 | var fechaEntrega = { | 395 | var fechaEntrega = { | 
| 374 | titulo: 'Fecha de entrega', | 396 | titulo: 'Fecha de entrega', | 
| 375 | minDate: new Date() | 397 | minDate: new Date() | 
| 376 | }; | 398 | }; | 
| 377 | focaModalService.modalFecha(fechaEntrega).then(function(fecha) { | 399 | focaModalService.modalFecha(fechaEntrega).then(function(fecha) { | 
| 378 | $scope.$broadcast('addCabecera', { | 400 | $scope.$broadcast('addCabecera', { | 
| 379 | label: 'Fecha de entrega: ', | 401 | label: 'Fecha de entrega: ', | 
| 380 | valor: fecha.toLocaleDateString() | 402 | valor: fecha.toLocaleDateString() | 
| 381 | }); | 403 | }); | 
| 382 | $scope.hojaRuta.fechaReparto = fecha; | 404 | $scope.hojaRuta.fechaReparto = fecha; | 
| 383 | }); | 405 | }); | 
| 384 | } | 406 | } | 
| 385 | 407 | ||
| 386 | function eligioPreConfirmado() { | 408 | function eligioPreConfirmado() { | 
| 387 | if ($scope.eligioPreConfirmado) { | 409 | if ($scope.eligioPreConfirmado) { | 
| 388 | focaModalService.alert('No puede elegir si eligió un vehiculo pre cargado'); | 410 | focaModalService.alert('No puede elegir si eligió un vehiculo pre cargado'); | 
| 389 | return true; | 411 | return true; | 
| 390 | } | 412 | } | 
| 391 | return false; | 413 | return false; | 
| 392 | } | 414 | } | 
| 393 | 415 | ||
| 394 | function eligioFecha() { | 416 | function eligioFecha() { | 
| 395 | if (!$scope.hojaRuta.fechaReparto) { | 417 | if (!$scope.hojaRuta.fechaReparto) { | 
| 396 | focaModalService.alert('Primero seleccione fecha de reparto'); | 418 | focaModalService.alert('Primero seleccione fecha de reparto'); | 
| 397 | return false; | 419 | return false; | 
| 398 | } | 420 | } | 
| 399 | return true; | 421 | return true; | 
| 400 | } | 422 | } | 
| 401 | 423 | ||
| 402 | function eligioVehiculo() { | 424 | function eligioVehiculo() { | 
| 403 | if (!$scope.hojaRuta.vehiculo.id) { | 425 | if (!$scope.hojaRuta.vehiculo.id) { | 
| 404 | focaModalService.alert('Primero seleccione vehiculo'); | 426 | focaModalService.alert('Primero seleccione vehiculo'); | 
| 405 | return false; | 427 | return false; | 
| 406 | } | 428 | } | 
| 407 | return true; | 429 | return true; | 
| 408 | } | 430 | } | 
| 409 | 431 | ||
| 410 | function modalVehiculos(preCargados) { | 432 | function modalVehiculos(preCargados) { | 
| 411 | var parametrosModal = {}; | 433 | var parametrosModal = {}; | 
| 412 | if (preCargados) { | 434 | if (preCargados) { | 
| 413 | parametrosModal.query = '/vehiculo/obtener/pre-confirmados/' + | 435 | parametrosModal.query = '/vehiculo/obtener/pre-confirmados/' + | 
| 414 | new Date($scope.hojaRuta.fechaReparto).toISOString().substring(0, 10); | 436 | new Date($scope.hojaRuta.fechaReparto).toISOString().substring(0, 10); | 
| 415 | parametrosModal.titulo = 'Búsqueda de vehiculos pre confirmados'; | 437 | parametrosModal.titulo = 'Búsqueda de vehiculos pre confirmados'; | 
| 416 | } else { | 438 | } else { | 
| 417 | parametrosModal.query = '/vehiculo'; | 439 | parametrosModal.query = '/vehiculo'; | 
| 418 | parametrosModal.titulo = 'Búsqueda de vehículos'; | 440 | parametrosModal.titulo = 'Búsqueda de vehículos'; | 
| 419 | } | 441 | } | 
| 420 | parametrosModal.columnas = [ | 442 | parametrosModal.columnas = [ | 
| 421 | { | 443 | { | 
| 422 | propiedad: 'codigo', | 444 | propiedad: 'codigo', | 
| 423 | nombre: 'Código' | 445 | nombre: 'Código' | 
| 424 | }, | 446 | }, | 
| 425 | { | 447 | { | 
| 426 | propiedad: 'tractor', | 448 | propiedad: 'tractor', | 
| 427 | nombre: 'tractor' | 449 | nombre: 'tractor' | 
| 428 | }, | 450 | }, | 
| 429 | { | 451 | { | 
| 430 | propiedad: 'semi', | 452 | propiedad: 'semi', | 
| 431 | nombre: 'Semi' | 453 | nombre: 'Semi' | 
| 432 | } | 454 | } | 
| 433 | ]; | 455 | ]; | 
| 434 | focaModalService.modal(parametrosModal).then(function(vehiculo) { | 456 | focaModalService.modal(parametrosModal).then(function(vehiculo) { | 
| 435 | if (!preCargados && vehiculoEnUso(vehiculo)) return; | 457 | if (!preCargados && vehiculoEnUso(vehiculo)) return; | 
| 436 | $scope.hojaRuta.vehiculo = vehiculo; | 458 | $scope.hojaRuta.vehiculo = vehiculo; | 
| 437 | $scope.hojaRuta.transportista = vehiculo.transportista; | 459 | $scope.hojaRuta.transportista = vehiculo.transportista; | 
| 438 | if (preCargados) { | 460 | if (preCargados) { | 
| 439 | $scope.eligioPreConfirmado = true; | 461 | $scope.eligioPreConfirmado = true; | 
| 440 | $scope.hojaRuta.vehiculo = vehiculo; | 462 | $scope.hojaRuta.vehiculo = vehiculo; | 
| 441 | $scope.$broadcast('addCabecera', { | 463 | $scope.$broadcast('addCabecera', { | 
| 442 | label: 'Transportista:', | 464 | label: 'Transportista:', | 
| 443 | valor: $filter('rellenarDigitos')(vehiculo.transportista.COD, 5) + | 465 | valor: $filter('rellenarDigitos')(vehiculo.transportista.COD, 5) + | 
| 444 | ' - ' + vehiculo.transportista.NOM | 466 | ' - ' + vehiculo.transportista.NOM | 
| 445 | }); | 467 | }); | 
| 446 | focaCrearHojaRutaService | 468 | focaCrearHojaRutaService | 
| 447 | .getRemitosByIdVehiculo(vehiculo.id, $scope.hojaRuta.fechaReparto) | 469 | .getRemitosByIdVehiculo(vehiculo.id, $scope.hojaRuta.fechaReparto) | 
| 448 | .then(function(res) { | 470 | .then(function(res) { | 
| 449 | $scope.hojaRuta.remitosTabla = res.data; | 471 | $scope.hojaRuta.remitosTabla = res.data; | 
| 450 | }); | 472 | }); | 
| 451 | } else { | 473 | } else { | 
| 452 | focaCrearHojaRutaService | 474 | focaCrearHojaRutaService | 
| 453 | .getRemitosByIdVehiculo(vehiculo.id, $scope.hojaRuta.fechaReparto, true) | 475 | .getRemitosByIdVehiculo(vehiculo.id, $scope.hojaRuta.fechaReparto, true) | 
| 454 | .then(function(res) { | 476 | .then(function(res) { | 
| 455 | $scope.hojaRuta.remitosTabla = res.data; | 477 | $scope.hojaRuta.remitosTabla = res.data; | 
| 456 | }); | 478 | }); | 
| 457 | } | 479 | } | 
| 458 | $scope.$broadcast('addCabecera', { | 480 | $scope.$broadcast('addCabecera', { | 
| 459 | label: 'Tractor:', | 481 | label: 'Tractor:', | 
| 460 | valor: vehiculo.tractor | 482 | valor: vehiculo.tractor | 
| 461 | }); | 483 | }); | 
| 462 | $scope.$broadcast('addCabecera', { | 484 | $scope.$broadcast('addCabecera', { | 
| 463 | label: 'Semi:', | 485 | label: 'Semi:', | 
| 464 | valor: vehiculo.semi | 486 | valor: vehiculo.semi | 
| 465 | }); | 487 | }); | 
| 466 | $scope.$broadcast('addCabecera', { | 488 | $scope.$broadcast('addCabecera', { | 
| 467 | label: 'Capacidad:', | 489 | label: 'Capacidad:', | 
| 468 | valor: vehiculo.capacidad | 490 | valor: vehiculo.capacidad | 
| 469 | }); | 491 | }); | 
| 470 | }); | 492 | }); | 
| 471 | } | 493 | } | 
| 472 | 494 | ||
| 473 | function vehiculoEnUso(vehiculo) { | 495 | function vehiculoEnUso(vehiculo) { | 
| 474 | var idUsuario = focaLoginSrv.getLoginData().vendedorCobrador; | 496 | var idUsuario = focaLoginSrv.getLoginData().vendedorCobrador; | 
| 475 | for (var i = 0; i < vehiculo.cisternas.length; i++) { | 497 | for (var i = 0; i < vehiculo.cisternas.length; i++) { | 
| 476 | for (var j = 0; j < vehiculo.cisternas[i].cisternasCarga.length; j++) { | 498 | for (var j = 0; j < vehiculo.cisternas[i].cisternasCarga.length; j++) { | 
| 477 | var cisternaCarga = vehiculo.cisternas[i].cisternasCarga[j]; | 499 | var cisternaCarga = vehiculo.cisternas[i].cisternasCarga[j]; | 
| 478 | if (cisternaCarga.fechaReparto.substring(0, 10) === | 500 | if (cisternaCarga.fechaReparto.substring(0, 10) === | 
| 479 | new Date($scope.hojaRuta.fechaReparto).toISOString().substring(0, 10) && | 501 | new Date($scope.hojaRuta.fechaReparto).toISOString().substring(0, 10) && | 
| 480 | cisternaCarga.idUsuarioProceso && | 502 | cisternaCarga.idUsuarioProceso && | 
| 481 | cisternaCarga.idUsuarioProceso !== idUsuario) | 503 | cisternaCarga.idUsuarioProceso !== idUsuario) | 
| 482 | { | 504 | { | 
| 483 | focaModalService.alert('El vehículo está siendo usado por otro' + | 505 | focaModalService.alert('El vehículo está siendo usado por otro' + | 
| 484 | ' usuario'); | 506 | ' usuario'); | 
| 485 | return true; | 507 | return true; | 
| 486 | } | 508 | } | 
| 487 | } | 509 | } | 
| 488 | } | 510 | } | 
| 489 | return false; | 511 | return false; | 
| 490 | } | 512 | } | 
| 491 | 513 | ||
| 492 | function salir() { | 514 | function salir() { | 
| 493 | var confirmacion = false; | 515 | var confirmacion = false; | 
| 494 | 516 | ||
| 495 | if (!angular.equals($scope.hojaRuta, $scope.inicial)) { | 517 | if (!angular.equals($scope.hojaRuta, $scope.inicial)) { | 
| 496 | confirmacion = true; | 518 | confirmacion = true; | 
| 497 | } | 519 | } | 
| 498 | 520 | ||
| 499 | if (confirmacion) { | 521 | if (confirmacion) { | 
| 500 | focaModalService.confirm( | 522 | focaModalService.confirm( | 
| 501 | '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' | 523 | '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' | 
| 502 | ).then(function(data) { | 524 | ).then(function(data) { | 
| 503 | if (data) { | 525 | if (data) { | 
| 504 | $location.path('/'); | 526 | $location.path('/'); | 
| 505 | } | 527 | } | 
| 506 | }); | 528 | }); | 
| 507 | } else { | 529 | } else { | 
| 508 | $location.path('/'); | 530 | $location.path('/'); | 
| 509 | } | 531 | } | 
| 510 | } | 532 | } | 
| 511 | 533 | ||
| 512 | function setearHojaRuta(hojaRuta) { | 534 | function setearHojaRuta(hojaRuta) { | 
| 513 | $scope.$broadcast('cleanCabecera'); | 535 | $scope.$broadcast('cleanCabecera'); | 
| 514 | 536 | ||
| 515 | var cabeceras = []; | 537 | var cabeceras = []; | 
| 516 | if (hojaRuta.fechaReparto) { | 538 | if (hojaRuta.fechaReparto) { | 
| 517 | cabeceras.push({ | 539 | cabeceras.push({ | 
| 518 | label: 'Fecha de entrega:', | 540 | label: 'Fecha de entrega:', | 
| 519 | valor: $filter('date')(hojaRuta.fechaReparto, 'dd/MM/yyyy') | 541 | valor: $filter('date')(hojaRuta.fechaReparto, 'dd/MM/yyyy') | 
| 520 | }); | 542 | }); | 
| 521 | } | 543 | } | 
| 522 | if (hojaRuta.transportista.COD) { | 544 | if (hojaRuta.transportista.COD) { | 
| 523 | cabeceras.push({ | 545 | cabeceras.push({ | 
| 524 | label: 'Transportista:', | 546 | label: 'Transportista:', | 
| 525 | valor: $filter('rellenarDigitos')(hojaRuta.transportista.COD, 5) + ' - ' + | 547 | valor: $filter('rellenarDigitos')(hojaRuta.transportista.COD, 5) + ' - ' + | 
| 526 | hojaRuta.transportista.NOM | 548 | hojaRuta.transportista.NOM | 
| 527 | }); | 549 | }); | 
| 528 | } | 550 | } | 
| 529 | if (hojaRuta.chofer.id) { | 551 | if (hojaRuta.chofer.id) { | 
| 530 | cabeceras.push({ | 552 | cabeceras.push({ | 
| 531 | label: 'Chofer:', | 553 | label: 'Chofer:', | 
| 532 | valor: $filter('rellenarDigitos')(hojaRuta.chofer.id, 3) + | 554 | valor: $filter('rellenarDigitos')(hojaRuta.chofer.id, 3) + | 
| 533 | ' - ' + hojaRuta.chofer.nombre | 555 | ' - ' + hojaRuta.chofer.nombre | 
| 534 | }); | 556 | }); | 
| 535 | } | 557 | } | 
| 536 | if (hojaRuta.vehiculo.id) { | 558 | if (hojaRuta.vehiculo.id) { | 
| 537 | cabeceras.push({ | 559 | cabeceras.push({ | 
| 538 | label: 'Tractor:', | 560 | label: 'Tractor:', | 
| 539 | valor: hojaRuta.vehiculo.tractor | 561 | valor: hojaRuta.vehiculo.tractor | 
| 540 | }); | 562 | }); | 
| 541 | cabeceras.push({ | 563 | cabeceras.push({ | 
| 542 | label: 'Semi:', | 564 | label: 'Semi:', | 
| 543 | valor: hojaRuta.vehiculo.semi | 565 | valor: hojaRuta.vehiculo.semi | 
| 544 | }); | 566 | }); | 
| 545 | cabeceras.push({ | 567 | cabeceras.push({ | 
| 546 | label: 'Capacidad:', | 568 | label: 'Capacidad:', | 
| 547 | valor: hojaRuta.vehiculo.capacidad | 569 | valor: hojaRuta.vehiculo.capacidad | 
| 548 | }); | 570 | }); | 
| 549 | } | 571 | } | 
| 550 | if (hojaRuta.tarifario.costo) { | 572 | if (hojaRuta.tarifario.costo) { | 
| 551 | cabeceras.push({ | 573 | cabeceras.push({ | 
| 552 | label: 'Tarifario:', | 574 | label: 'Tarifario:', | 
| 553 | valor: hojaRuta.tarifario.costo | 575 | valor: hojaRuta.tarifario.costo | 
| 554 | }); | 576 | }); | 
| 555 | } | 577 | } | 
| 556 | 578 | ||
| 557 | addArrayCabecera(cabeceras); | 579 | addArrayCabecera(cabeceras); | 
| 558 | $scope.hojaRuta = hojaRuta; | 580 | $scope.hojaRuta = hojaRuta; | 
| 559 | } | 581 | } | 
| 560 | 582 | ||
| 561 | function getLSHojaRuta() { | 583 | function getLSHojaRuta() { | 
| 562 | var hojaRuta = JSON.parse($localStorage.hojaRuta || null); | 584 | var hojaRuta = JSON.parse($localStorage.hojaRuta || null); | 
| 563 | if (hojaRuta) { | 585 | if (hojaRuta) { | 
| 564 | setearHojaRuta(hojaRuta); | 586 | setearHojaRuta(hojaRuta); | 
| 565 | delete $localStorage.hojaRuta; | 587 | delete $localStorage.hojaRuta; | 
| 566 | } | 588 | } | 
| 567 | } | 589 | } | 
| 568 | function addArrayCabecera(array) { | 590 | function addArrayCabecera(array) { | 
| 569 | for(var i = 0; i < array.length; i++) { | 591 | for(var i = 0; i < array.length; i++) { | 
| 570 | $scope.$broadcast('addCabecera', { | 592 | $scope.$broadcast('addCabecera', { | 
| 571 | label: array[i].label, | 593 | label: array[i].label, | 
| 572 | valor: array[i].valor | 594 | valor: array[i].valor | 
| 573 | }); | 595 | }); | 
| 574 | } | 596 | } | 
| 575 | } | 597 | } | 
| 576 | } | 598 | } | 
| 577 | ]); | 599 | ]); | 
src/views/hoja-ruta.html
| 1 | <div class="crear-hoja-ruta foca-crear row"> | 1 | <div class="crear-hoja-ruta foca-crear row"> | 
| 2 | <foca-cabecera-facturador | 2 | <foca-cabecera-facturador | 
| 3 | titulo="'Hoja de ruta'" | 3 | titulo="'Hoja de ruta'" | 
| 4 | numero="puntoVenta + '-' + comprobante" | 4 | numero="puntoVenta + '-' + comprobante" | 
| 5 | fecha="now" | 5 | fecha="now" | 
| 6 | class="mb-0 col-lg-12" | 6 | class="mb-0 col-lg-12" | 
| 7 | ></foca-cabecera-facturador> | 7 | ></foca-cabecera-facturador> | 
| 8 | <div class="col-lg-12"> | 8 | <div class="col-lg-12"> | 
| 9 | <div class="row mt-4"> | 9 | <div class="row mt-4"> | 
| 10 | <div class="col-12 col-md-10 border border-light rounded"> | 10 | <div class="col-12 col-md-10 border border-light rounded"> | 
| 11 | <div class="row px-5 py-2 botonera-secundaria"> | 11 | <div class="row px-5 py-2 botonera-secundaria"> | 
| 12 | <div class="col-12"> | 12 | <div class="col-12"> | 
| 13 | <foca-botonera-facturador botones="botonera" extra="4" class="row"></foca-botonera-facturador> | 13 | <foca-botonera-facturador botones="botonera" extra="4" class="row"></foca-botonera-facturador> | 
| 14 | </div> | 14 | </div> | 
| 15 | </div> | 15 | </div> | 
| 16 | <!-- PC --> | 16 | <!-- PC --> | 
| 17 | <div class="row grilla-articulo align-items-end d-none d-sm-flex"> | 17 | <div class="row grilla-articulo align-items-end d-none d-sm-flex"> | 
| 18 | <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom"> | 18 | <table class="table tabla-articulo table-striped table-sm mb-0 rounded-bottom"> | 
| 19 | <thead> | 19 | <thead> | 
| 20 | <tr class="d-flex"> | 20 | <tr class="d-flex"> | 
| 21 | <th class="col-auto">#</th> | 21 | <th class="col-auto">#</th> | 
| 22 | <th class="col-2">Remito</th> | 22 | <th class="col-2">Remito</th> | 
| 23 | <th class="col">Cliente</th> | 23 | <th class="col">Cliente</th> | 
| 24 | <th class="col">Dirección</th> | 24 | <th class="col">Dirección</th> | 
| 25 | <th class="col-auto"></th> | ||
| 25 | <th class="col-auto"> | 26 | <th class="col-auto"> | 
| 26 | <button | 27 | <button | 
| 27 | class="btn btn-outline-light selectable" | 28 | class="btn btn-outline-light selectable" | 
| 28 | ng-click="show = !show; masMenos()" | 29 | ng-click="show = !show; masMenos()" | 
| 29 | > | 30 | > | 
| 30 | <i | 31 | <i | 
| 31 | class="fa fa-chevron-down" | 32 | class="fa fa-chevron-down" | 
| 32 | ng-show="show" | 33 | ng-show="show" | 
| 33 | aria-hidden="true" | 34 | aria-hidden="true" | 
| 34 | > | 35 | > | 
| 35 | </i> | 36 | </i> | 
| 36 | <i | 37 | <i | 
| 37 | class="fa fa-chevron-up" | 38 | class="fa fa-chevron-up" | 
| 38 | ng-hide="show" | 39 | ng-hide="show" | 
| 39 | aria-hidden="true"> | 40 | aria-hidden="true"> | 
| 40 | </i> | 41 | </i> | 
| 41 | </button> | 42 | </button> | 
| 42 | </th> | 43 | </th> | 
| 43 | </th> | ||
| 44 | </tr> | 44 | </tr> | 
| 45 | </thead> | 45 | </thead> | 
| 46 | <tbody class="tabla-articulo-body"> | 46 | <tbody class="tabla-articulo-body"> | 
| 47 | <tr | 47 | <tr | 
| 48 | ng-repeat="(key, remito) in hojaRuta.remitosTabla" | 48 | ng-repeat="(key, remito) in hojaRuta.remitosTabla" | 
| 49 | class="d-flex" | 49 | class="d-flex" | 
| 50 | ng-show="show || key == hojaRuta.remitosTabla.length - 1" | 50 | ng-show="show || key == hojaRuta.remitosTabla.length - 1" | 
| 51 | > | 51 | > | 
| 52 | <td ng-bind="key + 1" class="col-auto"></td> | 52 | <td ng-bind="key + 1" class="col-auto"></td> | 
| 53 | <td | 53 | <td | 
| 54 | class="col-2" | 54 | class="col-2" | 
| 55 | ng-bind="rellenar(remito.sucursal, 4) + '-' + rellenar(remito.numeroRemito, 8)" | 55 | >{{remito.sucursal | rellenarDigitos: 4}}-{{remito.numeroRemito | rellenarDigitos: 8}}</td> | 
| 56 | ></td> | ||
| 57 | <th class="col" ng-bind="remito.nombreCliente"></th> | 56 | <th class="col" ng-bind="remito.nombreCliente"></th> | 
| 58 | <th class="col" ng-bind="remito.domicilioStamp"></th> | 57 | <th class="col" ng-bind="remito.domicilioStamp"></th> | 
| 59 | <td class="text-center col-auto"> | 58 | <td class="text-center col-auto"> | 
| 60 | <button | 59 | <button | 
| 61 | class="btn btn-outline-light" | 60 | class="btn btn-outline-light" | 
| 61 | ng-click="verProductosRemito(remito.id)" | ||
| 62 | title="Ver productos" | ||
| 63 | > | ||
| 64 | <i class="fa fa-eye"></i> | ||
| 65 | </button> | ||
| 66 | </td> | ||
| 67 | <td class="text-center col-auto"> | ||
| 68 | <button | ||
| 69 | class="btn btn-outline-light" | ||
| 62 | ng-click="desasociarRemito(key, remito.id)" | 70 | ng-click="desasociarRemito(key, remito.id)" | 
| 71 | title="Eliminar" | ||
| 63 | > | 72 | > | 
| 64 | <i class="fa fa-trash"></i> | 73 | <i class="fa fa-trash"></i> | 
| 65 | </button> | 74 | </button> | 
| 66 | </td> | 75 | </td> | 
| 67 | </tr> | 76 | </tr> | 
| 68 | </tbody> | 77 | </tbody> | 
| 69 | <tfoot> | 78 | <tfoot> | 
| 70 | <tr class="d-flex"> | 79 | <tr class="d-flex"> | 
| 71 | <td class="col-auto px-1"> | 80 | <td class="col-auto px-1"> | 
| 72 | <strong>Remitos:</strong> | 81 | <strong>Remitos:</strong> | 
| 73 | <a ng-bind="hojaRuta.remitosTabla.length"></a> | 82 | <a ng-bind="hojaRuta.remitosTabla.length"></a> | 
| 74 | </td> | 83 | </td> | 
| 75 | <td class="col"></td> | 84 | <td class="col"></td> | 
| 76 | <td class="col-auto px-1"> | 85 | <td class="col-auto px-1"> | 
| 77 | <strong>Cantidad:</strong> | 86 | <strong>Cantidad:</strong> | 
| 78 | <a ng-bind="hojaRuta.litros"></a> | 87 | <a ng-bind="hojaRuta.litros"></a> | 
| 79 | </td> | 88 | </td> | 
| 80 | </tr> | 89 | </tr> | 
| 81 | </tfoot> | 90 | </tfoot> | 
| 82 | </table> | 91 | </table> | 
| 83 | </div> | 92 | </div> | 
| 84 | </div> | 93 | </div> | 
| 85 | </div> | 94 | </div> | 
| 86 | </div> | 95 | </div> |