Commit 04e83285642f19e6ba60779c40a2e7f1ddae604e
Exists in
master
and in
2 other branches
Merge branch 'master' into 'develop'
Master See merge request !15
Showing
2 changed files
 
Show diff stats
src/js/controller.js
| 1 | angular.module('focaModalDetalleHojaRuta') | 1 | angular.module('focaModalDetalleHojaRuta') | 
| 2 | .controller('focaModalDetalleHojaRutaController', | 2 | .controller('focaModalDetalleHojaRutaController', | 
| 3 | [ | 3 | [ | 
| 4 | '$filter', | 4 | '$filter', | 
| 5 | '$scope', | 5 | '$scope', | 
| 6 | '$uibModalInstance', | 6 | '$uibModalInstance', | 
| 7 | 'parametros', | 7 | 'parametros', | 
| 8 | 'focaModalDetalleHojaRutaService', | 8 | 'focaModalDetalleHojaRutaService', | 
| 9 | 'focaModalService', | 9 | 'focaModalService', | 
| 10 | 'focaSeguimientoService', | 10 | 'focaSeguimientoService', | 
| 11 | '$uibModal', | 11 | '$uibModal', | 
| 12 | function($filter, $scope, $uibModalInstance, parametros, focaModalDetalleHojaRutaService, | 12 | function($filter, $scope, $uibModalInstance, parametros, focaModalDetalleHojaRutaService, | 
| 13 | focaModalService, focaSeguimientoService, $uibModal) | 13 | focaModalService, focaSeguimientoService, $uibModal) | 
| 14 | { | 14 | { | 
| 15 | //Seteo variables | 15 | //Seteo variables | 
| 16 | $scope.remito = parametros.remito; | 16 | $scope.remito = parametros.remito; | 
| 17 | $scope.cisternas = parametros.remito.cisternas; | 17 | $scope.cisternas = parametros.remito.cisternas; | 
| 18 | $scope.articuloSeleccionado = {}; | 18 | $scope.articuloSeleccionado = {}; | 
| 19 | $scope.aDescargar = []; | 19 | $scope.aDescargar = []; | 
| 20 | $scope.cargando = false; | 20 | $scope.cargando = false; | 
| 21 | 21 | ||
| 22 | //Datos | 22 | //Datos | 
| 23 | // var promesaRemito = focaModalDetalleHojaRutaService | 23 | // var promesaRemito = focaModalDetalleHojaRutaService | 
| 24 | // .getRemitoById(idRemito); | 24 | // .getRemitoById(idRemito); | 
| 25 | // var promesaCisternas = focaModalDetalleHojaRutaService | 25 | // var promesaCisternas = focaModalDetalleHojaRutaService | 
| 26 | // .getCisternasByIdRemito(idRemito); | 26 | // .getCisternasByIdRemito(idRemito); | 
| 27 | 27 | ||
| 28 | // Promise.all([promesaRemito, promesaCisternas]).then(function(res) { | 28 | // Promise.all([promesaRemito, promesaCisternas]).then(function(res) { | 
| 29 | // $scope.cargando = false; | 29 | // $scope.cargando = false; | 
| 30 | // $scope.remito = res[0].data; | 30 | // $scope.remito = res[0].data; | 
| 31 | // $scope.cisternas = res[1].data; | 31 | // $scope.cisternas = res[1].data; | 
| 32 | // var articuloAChequear = $scope.remito.articulosRemito.filter( | 32 | // var articuloAChequear = $scope.remito.articulosRemito.filter( | 
| 33 | // function(articulo) { | 33 | // function(articulo) { | 
| 34 | // return !articulo.descargado; | 34 | // return !articulo.descargado; | 
| 35 | // }); | 35 | // }); | 
| 36 | // if(!articuloAChequear.length || $scope.remito.rechazado) { | 36 | // if(!articuloAChequear.length || $scope.remito.rechazado) { | 
| 37 | // $scope.readonly = true; | 37 | // $scope.readonly = true; | 
| 38 | // $scope.cambio($scope.remito.articulosRemito[0]); | 38 | // $scope.cambio($scope.remito.articulosRemito[0]); | 
| 39 | // }else { | 39 | // }else { | 
| 40 | // $scope.cambio(articuloAChequear[0]); | 40 | // $scope.cambio(articuloAChequear[0]); | 
| 41 | // } | 41 | // } | 
| 42 | // $scope.$digest(); | 42 | // $scope.$digest(); | 
| 43 | // }, function() { | 43 | // }, function() { | 
| 44 | // focaModalService.alert('El servicio no responde intente más tarde'); | 44 | // focaModalService.alert('El servicio no responde intente más tarde'); | 
| 45 | // $uibModalInstance.dismiss(); | 45 | // $uibModalInstance.dismiss(); | 
| 46 | // }); | 46 | // }); | 
| 47 | $scope.cambio = function(articulo) { | 47 | $scope.cambio = function(articulo) { | 
| 48 | if(!$scope.articuloSeleccionado.descargado) { | 48 | if(!$scope.articuloSeleccionado.descargado) { | 
| 49 | $scope.articuloSeleccionado.cantidadDescargada = 0; | 49 | $scope.articuloSeleccionado.cantidadDescargada = 0; | 
| 50 | } | 50 | } | 
| 51 | $scope.aDescargar = []; | 51 | $scope.aDescargar = []; | 
| 52 | $scope.articuloSeleccionado = articulo; | 52 | $scope.articuloSeleccionado = articulo; | 
| 53 | }; | 53 | }; | 
| 54 | $scope.descargar = function(key) { | 54 | $scope.descargar = function(key) { | 
| 55 | if(key === 13) { | 55 | if(key === 13) { | 
| 56 | $scope.cargando = true; | 56 | $scope.cargando = true; | 
| 57 | var hojaRutaMovimientos = []; | 57 | var hojaRutaMovimientos = []; | 
| 58 | var cisternaMovimientos = []; | 58 | var cisternaMovimientos = []; | 
| 59 | var cisternaCargas = []; | 59 | var cisternaCargas = []; | 
| 60 | var totalADescargar = 0; | 60 | var totalADescargar = 0; | 
| 61 | for(var i = 0; i < $scope.aDescargar.length; i++) { | 61 | for(var i = 0; i < $scope.aDescargar.length; i++) { | 
| 62 | totalADescargar += $scope.aDescargar[i] || 0; | 62 | totalADescargar += $scope.aDescargar[i] || 0; | 
| 63 | } | 63 | } | 
| 64 | focaModalService | 64 | focaModalService | 
| 65 | .confirm('¿Desea descargar ' + totalADescargar + ' litros de ' + | 65 | .confirm('¿Desea descargar ' + totalADescargar + ' litros de ' + | 
| 66 | $scope.articuloSeleccionado.descripcion + '?') | 66 | $scope.articuloSeleccionado.descripcion + '?') | 
| 67 | .then(descargar, function() { | 67 | .then(descargar, function() { | 
| 68 | $scope.cargando = false; | 68 | $scope.cargando = false; | 
| 69 | }); | 69 | }); | 
| 70 | } | 70 | } | 
| 71 | function descargar() { | 71 | function descargar() { | 
| 72 | for(var i = 0; i < $scope.cisternas.length; i++) { | 72 | for(var i = 0; i < $scope.cisternas.length; i++) { | 
| 73 | var descarga = $scope.aDescargar[i]; | 73 | var descarga = $scope.aDescargar[i]; | 
| 74 | var cisternaCarga = $scope.cisternas[i].cisternaCarga; | 74 | var cisternaCarga = $scope.cisternas[i].cisternaCarga; | 
| 75 | if(!descarga) continue; | 75 | if(!descarga) continue; | 
| 76 | if(descarga > cisternaCarga.cantidad) { | 76 | if(descarga > cisternaCarga.cantidad) { | 
| 77 | focaModalService.alert('La cantidad a descargar no debe ser ' + | 77 | focaModalService.alert('La cantidad a descargar no debe ser ' + | 
| 78 | 'mayor a la cantidad de la cisterna'); | 78 | 'mayor a la cantidad de la cisterna'); | 
| 79 | $scope.cargando = false; | 79 | $scope.cargando = false; | 
| 80 | return; | 80 | return; | 
| 81 | } | 81 | } | 
| 82 | cisternaCarga.cantidad -= descarga; | 82 | cisternaCarga.cantidad -= descarga; | 
| 83 | 83 | ||
| 84 | //Guardar | 84 | //Guardar | 
| 85 | var now = new Date(); | 85 | var now = new Date(); | 
| 86 | var cisternaMovimiento = { | 86 | var cisternaMovimiento = { | 
| 87 | fecha: now.toISOString().slice(0, 19).replace('T', ' '), | 87 | fecha: now.toISOString().slice(0, 19).replace('T', ' '), | 
| 88 | cantidad: descarga, | 88 | cantidad: descarga, | 
| 89 | metodo: 'descarga', | 89 | metodo: 'descarga', | 
| 90 | idCisternaCarga: cisternaCarga.id, | 90 | idCisternaCarga: cisternaCarga.id, | 
| 91 | idRemito: $scope.remito.id | 91 | idRemito: $scope.remito.id | 
| 92 | }; | 92 | }; | 
| 93 | var hojaRutaMovimiento = { | 93 | var hojaRutaMovimiento = { | 
| 94 | reciboDescarga: $scope.numeroRecibo, | 94 | reciboDescarga: $scope.numeroRecibo, | 
| 95 | idRemito: $scope.remito.id | 95 | idRemito: $scope.remito.id | 
| 96 | }; | 96 | }; | 
| 97 | delete cisternaCarga.articulo; | 97 | delete cisternaCarga.articulo; | 
| 98 | cisternaCargas.push(cisternaCarga); | 98 | cisternaCargas.push(cisternaCarga); | 
| 99 | cisternaMovimientos.push(cisternaMovimiento); | 99 | cisternaMovimientos.push(cisternaMovimiento); | 
| 100 | hojaRutaMovimientos.push(hojaRutaMovimiento); | 100 | hojaRutaMovimientos.push(hojaRutaMovimiento); | 
| 101 | } | 101 | } | 
| 102 | var save = { | 102 | var save = { | 
| 103 | cisternaCargas: cisternaCargas, | 103 | cisternaCargas: cisternaCargas, | 
| 104 | cisternaMovimientos: cisternaMovimientos, | 104 | cisternaMovimientos: cisternaMovimientos, | 
| 105 | hojaRutaMovimientos: hojaRutaMovimientos, | 105 | hojaRutaMovimientos: hojaRutaMovimientos, | 
| 106 | articulo: $scope.articuloSeleccionado | 106 | articulo: $scope.articuloSeleccionado | 
| 107 | }; | 107 | }; | 
| 108 | 108 | ||
| 109 | focaSeguimientoService.obtenerPosicion(getPosition) | 109 | focaSeguimientoService.obtenerPosicion(getPosition) | 
| 110 | 110 | ||
| 111 | var posicion; | 111 | var posicion; | 
| 112 | 112 | ||
| 113 | function getPosition(posicion) { | 113 | function getPosition(position) { | 
| 114 | 114 | ||
| 115 | posicion = { | 115 | posicion = { | 
| 116 | latitud: posicion.coords.latitude, | 116 | latitud: position.coords.latitude, | 
| 117 | longitud: posicion.coords.longitude, | 117 | longitud: position.coords.longitude, | 
| 118 | actividad: 'Entrega de producto', | 118 | actividad: 'Entrega de producto', | 
| 119 | observaciones: $scope.remito.observaciones | 119 | observaciones: $scope.remito.observaciones | 
| 120 | } | 120 | } | 
| 121 | } | 121 | } | 
| 122 | 122 | ||
| 123 | $scope.aDescargar = []; | ||
| 124 | $scope.remito.observaciones = ''; | ||
| 125 | $scope.articuloSeleccionado.descargado = true; | ||
| 126 | |||
| 127 | var siguienteArticulo = $scope.remito.articulosRemito.filter( | ||
| 128 | function(articulo) { | ||
| 129 | return articulo.id != $scope.articuloSeleccionado.id; | ||
| 130 | } | ||
| 131 | ); | ||
| 132 | |||
| 133 | if (siguienteArticulo.length) { | ||
| 134 | $scope.cambio(siguienteArticulo[0]); | ||
| 135 | } | ||
| 136 | |||
| 137 | $scope.actualizarPuntoDescarga(); | ||
| 138 | |||
| 123 | focaModalDetalleHojaRutaService | 139 | focaModalDetalleHojaRutaService | 
| 124 | .postMovimientoHojaRuta(save) | 140 | .postMovimientoHojaRuta(save) | 
| 125 | .then(guardarSeguimiento) | 141 | .then(guardarSeguimiento); | 
| 126 | .catch(error); | 142 | |
| 143 | |||
| 127 | function guardarSeguimiento(res) { | 144 | function guardarSeguimiento(res) { | 
| 128 | 145 | ||
| 129 | posicion.idComprobante = res.data[0].id; | 146 | posicion.idComprobante = res.data[0].id; | 
| 130 | focaModalDetalleHojaRutaService.guardarPosicion(posicion) | 147 | focaModalDetalleHojaRutaService.guardarPosicion({ posicion: posicion }); | 
| 131 | |||
| 132 | $scope.aDescargar = []; | ||
| 133 | $scope.remito.observaciones = ''; | ||
| 134 | $scope.articuloSeleccionado.descargado = true; | ||
| 135 | var siguienteArticulo = $scope.remito.articulosRemito.filter( | ||
| 136 | function(articulo) { | ||
| 137 | return articulo.id != $scope.articuloSeleccionado.id; | ||
| 138 | } | ||
| 139 | ); | ||
| 140 | if(siguienteArticulo.length) { | ||
| 141 | $scope.cambio(siguienteArticulo[0]); | ||
| 142 | } | ||
| 143 | $scope.actualizarPuntoDescarga(); | ||
| 144 | } | 148 | } | 
| 145 | } | 149 | } | 
| 146 | }; | 150 | }; | 
| 147 | 151 | ||
| 148 | $scope.cancel = function() { | 152 | $scope.cancel = function() { | 
| 149 | $uibModalInstance.dismiss('cancel'); | 153 | $uibModalInstance.dismiss('cancel'); | 
| 150 | }; | 154 | }; | 
| 151 | 155 | ||
| 152 | $scope.distribucionDisponible = function() { | 156 | $scope.distribucionDisponible = function() { | 
| 153 | return $scope.articuloSeleccionado.cantidadDescargada && | 157 | return $scope.articuloSeleccionado.cantidadDescargada && | 
| 154 | $scope.articuloSeleccionado.cantidadDescargada <= | 158 | $scope.articuloSeleccionado.cantidadDescargada <= | 
| 155 | $scope.articuloSeleccionado.cantidad; | 159 | $scope.articuloSeleccionado.cantidad; | 
| 156 | }; | 160 | }; | 
| 157 | 161 | ||
| 158 | $scope.actualizarArticulo = function() { | 162 | $scope.actualizarArticulo = function() { | 
| 159 | $scope.articuloSeleccionado.cantidadDescargada = 0; | 163 | $scope.articuloSeleccionado.cantidadDescargada = 0; | 
| 160 | for(var i = 0; i < $scope.aDescargar.length; i++) { | 164 | for(var i = 0; i < $scope.aDescargar.length; i++) { | 
| 161 | $scope.articuloSeleccionado.cantidadDescargada += | 165 | $scope.articuloSeleccionado.cantidadDescargada += | 
| 162 | parseFloat($scope.aDescargar[i]) || 0; | 166 | parseFloat($scope.aDescargar[i]) || 0; | 
| 163 | } | 167 | } | 
| 164 | }; | 168 | }; | 
| 165 | 169 | ||
| 166 | $scope.actualizarPuntoDescarga = function() { | 170 | $scope.actualizarPuntoDescarga = function() { | 
| 167 | var modalInstance = $uibModal.open( | 171 | var modalInstance = $uibModal.open( | 
| 168 | { | 172 | { | 
| 169 | ariaLabelledBy: 'Actualizar punto de descarga', | 173 | ariaLabelledBy: 'Actualizar punto de descarga', | 
| 170 | templateUrl: 'modal-actualizar-punto-descarga.html', | 174 | templateUrl: 'modal-actualizar-punto-descarga.html', | 
| 171 | controller: 'focaModalActualizarPuntoDescargaController', | 175 | controller: 'focaModalActualizarPuntoDescargaController', | 
| 172 | resolve: { | 176 | resolve: { | 
| 173 | notaPedido: function() { | 177 | notaPedido: function() { | 
| 174 | return $scope.remito.notaPedido; | 178 | return $scope.remito.notaPedido; | 
| 175 | } | 179 | } | 
| 176 | }, | 180 | }, | 
| 177 | size: 'lg' | 181 | size: 'lg' | 
| 178 | } | 182 | } | 
| 179 | ); | 183 | ); | 
| 180 | modalInstance.result.then(function() { | 184 | modalInstance.result.then(function() { | 
| 181 | success(); | 185 | success(); | 
| 182 | }, function() { | 186 | }, function() { | 
| 183 | success(); | 187 | success(); | 
| 184 | }); | 188 | }); | 
| 185 | }; | 189 | }; | 
| 186 | 190 | ||
| 187 | $scope.rechazar = function() { | 191 | $scope.rechazar = function() { | 
| 188 | focaModalService | 192 | focaModalService | 
| 189 | .prompt({ | 193 | .prompt({ | 
| 190 | titulo: 'Aclare el motivo de rechazo' | 194 | titulo: 'Aclare el motivo de rechazo' | 
| 191 | }) | 195 | }) | 
| 192 | .then(function(motivo) { | 196 | .then(function(motivo) { | 
| 193 | $scope.cargando = true; | 197 | $scope.cargando = true; | 
| 194 | var remitoRechazado = $.extend(true, {}, $scope.remito); | 198 | var remitoRechazado = $.extend(true, {}, $scope.remito); | 
| 195 | delete remitoRechazado.articulosRemito; | 199 | delete remitoRechazado.articulosRemito; | 
| 196 | delete remitoRechazado.notaPedido; | 200 | delete remitoRechazado.notaPedido; | 
| 197 | remitoRechazado.rechazado = true; | 201 | remitoRechazado.rechazado = true; | 
| 198 | remitoRechazado.motivoRechazo = motivo; | 202 | remitoRechazado.motivoRechazo = motivo; | 
| 199 | remitoRechazado.fechaRemito = | 203 | remitoRechazado.fechaRemito = | 
| 200 | remitoRechazado.fechaRemito.slice(0, 19).replace('T', ' '); | 204 | remitoRechazado.fechaRemito.slice(0, 19).replace('T', ' '); | 
| 201 | focaModalDetalleHojaRutaService.rechazarRemito(remitoRechazado) | 205 | focaModalDetalleHojaRutaService.rechazarRemito(remitoRechazado) | 
| 202 | .then(function(res) { | 206 | .then(function(res) { | 
| 203 | focaSeguimientoService.guardarPosicion( | 207 | focaSeguimientoService.guardarPosicion( | 
| 204 | 'Entrega de producto', | 208 | 'Entrega de producto', | 
| 205 | res.data[1].id, | 209 | res.data[1].id, | 
| 206 | motivo); | 210 | motivo); | 
| 207 | success(); | 211 | success(); | 
| 208 | }) | 212 | }) | 
| 209 | .catch(error); | 213 | .catch(error); | 
| 210 | $scope.readonly = true; | 214 | $scope.readonly = true; | 
| 211 | }); | 215 | }); | 
| 212 | }; | 216 | }; | 
| 213 | 217 | ||
| 214 | //funciones | 218 | //funciones | 
| 215 | function error(error) { | 219 | function error(error) { | 
| 216 | focaModalService.alert('Hubo un error ' + error); | 220 | focaModalService.alert('Hubo un error ' + error); | 
| 217 | } | 221 | } | 
| 218 | function success() { | 222 | function success() { | 
| 219 | focaModalService.alert('Operación realizada con éxito'); | 223 | focaModalService.alert('Operación realizada con éxito'); | 
| 220 | $scope.cargando = false; | 224 | $scope.cargando = false; | 
| 221 | } | 225 | } | 
| 222 | 226 | ||
| 223 | var articuloAChequear = $scope.remito.articulosRemito.filter( | 227 | var articuloAChequear = $scope.remito.articulosRemito.filter( | 
| 224 | function(articulo) { | 228 | function(articulo) { | 
| 225 | return !articulo.descargado; | 229 | return !articulo.descargado; | 
| 226 | }); | 230 | }); | 
| 227 | if (!articuloAChequear.length || $scope.remito.rechazado) { | 231 | if (!articuloAChequear.length || $scope.remito.rechazado) { | 
| 228 | $scope.readonly = true; | 232 | $scope.readonly = true; | 
| 229 | $scope.cambio($scope.remito.articulosRemito[0]); | 233 | $scope.cambio($scope.remito.articulosRemito[0]); | 
| 230 | } else { | 234 | } else { | 
| 231 | $scope.cambio(articuloAChequear[0]); | 235 | $scope.cambio(articuloAChequear[0]); | 
| 232 | } | 236 | } | 
| 233 | } | 237 | } | 
| 234 | ] | 238 | ] | 
| 235 | ) | 239 | ) | 
| 236 | .controller('focaModalActualizarPuntoDescargaController', | 240 | .controller('focaModalActualizarPuntoDescargaController', | 
| 237 | [ | 241 | [ | 
| 238 | '$scope', | 242 | '$scope', | 
| 239 | '$uibModalInstance', | 243 | '$uibModalInstance', | 
| 240 | 'focaSeguimientoService', | 244 | 'focaSeguimientoService', | 
| 241 | 'focaModalService', | 245 | 'focaModalService', | 
| 242 | 'notaPedido', | 246 | 'notaPedido', | 
| 243 | 'focaModalDetalleHojaRutaService', | 247 | 'focaModalDetalleHojaRutaService', | 
| 244 | function($scope, $uibModalInstance, focaSeguimientoService, | 248 | function($scope, $uibModalInstance, focaSeguimientoService, | 
| 245 | focaModalService, notaPedido, focaModalDetalleHojaRutaService) | 249 | focaModalService, notaPedido, focaModalDetalleHojaRutaService) | 
| 246 | { | 250 | { | 
| 247 | $scope.notaPedido = notaPedido; | 251 | $scope.notaPedido = notaPedido; | 
| 248 | $scope.descripcion = ''; | 252 | $scope.descripcion = ''; | 
| 249 | focaSeguimientoService.obtenerPosicion(function(res) { | 253 | focaSeguimientoService.obtenerPosicion(function(res) { | 
| 250 | $scope.posicion = res.coords; | 254 | $scope.posicion = res.coords; | 
| 251 | }); | 255 | }); | 
| 252 | 256 | ||
| 253 | $scope.cancel = function() { | 257 | $scope.cancel = function() { | 
| 254 | if ($scope.ingreso) { | 258 | if ($scope.ingreso) { | 
| 255 | $scope.ingreso = false; | 259 | $scope.ingreso = false; | 
| 256 | } else { | 260 | } else { | 
| 257 | $uibModalInstance.dismiss(); | 261 | $uibModalInstance.dismiss(); | 
| 258 | } | 262 | } | 
| 259 | }; | 263 | }; | 
| 260 | 264 | ||
| 261 | $scope.select = function(puntoDescarga) { | 265 | $scope.select = function(puntoDescarga) { | 
| 262 | if (!$scope.posicion) { | 266 | if (!$scope.posicion) { | 
| 263 | focaModalService.alert('No se pudo obtener la ubicación'); | 267 | focaModalService.alert('No se pudo obtener la ubicación'); | 
| 264 | return; | 268 | return; | 
| 265 | } | 269 | } | 
| 266 | puntoDescarga.latitud = $scope.posicion.latitude; | 270 | puntoDescarga.latitud = $scope.posicion.latitude; | 
| 267 | puntoDescarga.longitud = $scope.posicion.longitude; | 271 | puntoDescarga.longitud = $scope.posicion.longitude; | 
| 268 | focaModalDetalleHojaRutaService | 272 | focaModalDetalleHojaRutaService.guardarPuntoDescarga(puntoDescarga); | 
| 269 | .guardarPuntoDescarga(puntoDescarga) | 273 | $uibModalInstance.close(); | 
| 270 | .then(function(res) { | ||
| 271 | $uibModalInstance.close(res.data); | ||
| 272 | }); | ||
| 273 | }; | 274 | }; | 
| 274 | 275 | ||
| 275 | $scope.guardar = function() { | 276 | $scope.guardar = function() { | 
| 276 | if (!$scope.posicion) { | 277 | if (!$scope.posicion) { | 
| 277 | focaModalService.alert('No se pudo obtener la ubicación'); | 278 | focaModalService.alert('No se pudo obtener la ubicación'); | 
| 278 | return; | 279 | return; | 
| 279 | } | 280 | } | 
| 280 | focaModalDetalleHojaRutaService | 281 | focaModalDetalleHojaRutaService | 
| 281 | .guardarPuntoDescarga({ | 282 | .guardarPuntoDescarga({ | 
| 282 | id: 0, | 283 | id: 0, | 
src/views/modal-detalle-hoja-ruta.html
| 1 | <div class="modal-header py-1"> | 1 | <div class="modal-header py-1"> | 
| 2 | <h5 class="modal-title">Detalle de descarga</h5> | 2 | <h5 class="modal-title">Detalle de descarga</h5> | 
| 3 | </div> | 3 | </div> | 
| 4 | <div class="modal-body" id="modal-body" ladda="cargando" data-spinner-color="#FF0000" data-spinner-size="5"> | 4 | <div class="modal-body" id="modal-body" ladda="cargando" data-spinner-color="#FF0000" data-spinner-size="5"> | 
| 5 | <form name="formDetalleHojaRuta"> | 5 | <form name="formDetalleHojaRuta"> | 
| 6 | <div class="form-group row" ng-show="!cargando"> | 6 | <div class="form-group row" ng-show="!cargando"> | 
| 7 | <div class="col-12 px-0"> | 7 | <div class="col-12 px-0"> | 
| 8 | <strong>Información Remito</strong> | 8 | <strong>Información Remito</strong> | 
| 9 | <button | 9 | <button | 
| 10 | class="btn btn-sm btn-light selectable" | 10 | class="btn btn-sm btn-light selectable" | 
| 11 | ng-click="verInformacion = !verInformacion" | 11 | ng-click="verInformacion = !verInformacion" | 
| 12 | ><i | 12 | ><i | 
| 13 | class="fa fa-chevron-up" | 13 | class="fa fa-chevron-up" | 
| 14 | ng-show="verInformacion"></i> | 14 | ng-show="verInformacion"></i> | 
| 15 | <i | 15 | <i | 
| 16 | class="fa fa-chevron-down" | 16 | class="fa fa-chevron-down" | 
| 17 | ng-hide="verInformacion"> | 17 | ng-hide="verInformacion"> | 
| 18 | </i> | 18 | </i> | 
| 19 | </button> | 19 | </button> | 
| 20 | </div> | 20 | </div> | 
| 21 | <div class="row" ng-show="verInformacion"> | 21 | <div class="row" ng-show="verInformacion"> | 
| 22 | <div class="col-12"> | 22 | <div class="col-12"> | 
| 23 | <label class="form-control-sm"> | 23 | <label class="form-control-sm"> | 
| 24 | <b>Remito Nº</b> | 24 | <b>Remito Nº</b> | 
| 25 | <span ng-bind="[remito.numeroRemito, remito.sucursal] | comprobante"/> | 25 | <span ng-bind="[remito.numeroRemito, remito.sucursal] | comprobante"/> | 
| 26 | </label> | 26 | </label> | 
| 27 | </div> | 27 | </div> | 
| 28 | <div class="col-12"> | 28 | <div class="col-12"> | 
| 29 | <label class="form-control-sm"> | 29 | <label class="form-control-sm"> | 
| 30 | <b>Cliente</b> | 30 | <b>Cliente</b> | 
| 31 | </label> | 31 | </label> | 
| 32 | <span ng-bind="remito.nombreCliente"/> | 32 | <span ng-bind="remito.nombreCliente"/> | 
| 33 | </div> | 33 | </div> | 
| 34 | <div class="col-12"> | 34 | <div class="col-12"> | 
| 35 | <label class="form-control-sm"> | 35 | <label class="form-control-sm"> | 
| 36 | <b>Domicilio</b> | 36 | <b>Domicilio</b> | 
| 37 | <span ng-bind="remito.domicilioStamp"/> | 37 | <span ng-bind="remito.domicilioStamp"/> | 
| 38 | </label> | 38 | </label> | 
| 39 | </div> | 39 | </div> | 
| 40 | <div ng-show="remito.notaPedido.notaPedidoPuntoDescarga.length" class="px-3"> | 40 | <div ng-show="remito.notaPedido.notaPedidoPuntoDescarga.length" class="px-3"> | 
| 41 | <label class="form-control-sm"> | 41 | <label class="form-control-sm"> | 
| 42 | <b>Puntos de descarga</b> | 42 | <b>Puntos de descarga</b> | 
| 43 | </label> | 43 | </label> | 
| 44 | <table class="table table-sm"> | 44 | <table class="table table-sm"> | 
| 45 | <thead> | 45 | <thead> | 
| 46 | <tr> | 46 | <tr> | 
| 47 | <th>Nombre</th> | 47 | <th>Nombre</th> | 
| 48 | <th>Articulo</th> | ||
| 49 | <th>Cantidad</th> | ||
| 50 | </tr> | 48 | </tr> | 
| 51 | </thead> | 49 | </thead> | 
| 52 | <tbody> | 50 | <tbody> | 
| 53 | <tr ng-repeat="(key, puntoDescarga) in remito.notaPedido.notaPedidoPuntoDescarga"> | 51 | <tr ng-repeat="(key, puntoDescarga) in remito.notaPedido.notaPedidoPuntoDescarga"> | 
| 54 | <td ng-bind="puntoDescarga.puntoDescarga.descripcion"></td> | 52 | <td ng-bind="puntoDescarga.puntoDescarga.descripcion"></td> | 
| 55 | <td ng-bind="puntoDescarga.producto.DetArt"></td> | ||
| 56 | <td ng-bind="puntoDescarga.cantidad"></td> | ||
| 57 | </tbody> | 53 | </tbody> | 
| 58 | </table> | 54 | </table> | 
| 59 | </div> | 55 | </div> | 
| 60 | </div> | 56 | </div> | 
| 61 | <strong>Articulo a descargar</strong> | 57 | <strong>Articulo a descargar</strong> | 
| 62 | <table class="table table-sm"> | 58 | <table class="table table-sm"> | 
| 63 | <thead> | 59 | <thead> | 
| 64 | <tr> | 60 | <tr> | 
| 65 | <th></th> | 61 | <th></th> | 
| 66 | <th>Articulo</th> | 62 | <th>Articulo</th> | 
| 67 | <th>Total</th> | 63 | <th>Total</th> | 
| 68 | <th>Descargado</th> | 64 | <th>Descargado</th> | 
| 69 | </tr> | 65 | </tr> | 
| 70 | </thead> | 66 | </thead> | 
| 71 | <tbody> | 67 | <tbody> | 
| 72 | <tr ng-repeat="(key, articulo) in remito.articulosRemito"> | 68 | <tr ng-repeat="(key, articulo) in remito.articulosRemito"> | 
| 73 | <td class="pt-2"> | 69 | <td class="pt-2"> | 
| 74 | <input | 70 | <input | 
| 75 | type="radio" | 71 | type="radio" | 
| 76 | name="articuloRadio" | 72 | name="articuloRadio" | 
| 77 | id="{{'articulo' + articulo.id}}" | 73 | id="{{'articulo' + articulo.id}}" | 
| 78 | ng-click="cambio(articulo)" | 74 | ng-click="cambio(articulo)" | 
| 79 | ng-disabled="articulo.descargado || readonly" | 75 | ng-disabled="articulo.descargado || readonly" | 
| 80 | ng-checked="articuloSeleccionado.id === articulo.id" | 76 | ng-checked="articuloSeleccionado.id === articulo.id" | 
| 81 | ></td> | 77 | ></td> | 
| 82 | <td ng-bind="articulo.descripcion"></td> | 78 | <td ng-bind="articulo.descripcion"></td> | 
| 83 | <td ng-bind="articulo.cantidad"></td> | 79 | <td ng-bind="articulo.cantidad"></td> | 
| 84 | <td ng-bind="articulo.cantidadDescargada || 0"></td> | 80 | <td ng-bind="articulo.cantidadDescargada || 0"></td> | 
| 85 | </tbody> | 81 | </tbody> | 
| 86 | </table> | 82 | </table> | 
| 87 | <strong>Cisterna</strong> | 83 | <strong>Cisterna</strong> | 
| 88 | <table class="table table-sm"> | 84 | <table class="table table-sm"> | 
| 89 | <thead> | 85 | <thead> | 
| 90 | <tr> | 86 | <tr> | 
| 91 | <th>Código</th> | 87 | <th>Código</th> | 
| 92 | <th>Articulo</th> | 88 | <th>Articulo</th> | 
| 93 | <th>Total</th> | 89 | <th>Total</th> | 
| 94 | <th>A descargar</th> | 90 | <th>A descargar</th> | 
| 95 | </tr> | 91 | </tr> | 
| 96 | </thead> | 92 | </thead> | 
| 97 | <tbody> | 93 | <tbody> | 
| 98 | <tr ng-repeat="(key, cisterna) in cisternas"> | 94 | <tr ng-repeat="(key, cisterna) in cisternas"> | 
| 99 | <td ng-bind="cisterna.codigo"></td> | 95 | <td ng-bind="cisterna.codigo"></td> | 
| 100 | <td ng-bind="cisterna.cisternaCarga.articulo.DetArt"></td> | 96 | <td ng-bind="cisterna.cisternaCarga.articulo.DetArt"></td> | 
| 101 | <td ng-bind="cisterna.cisternaCarga.cantidad"></td> | 97 | <td ng-bind="cisterna.cisternaCarga.cantidad"></td> | 
| 102 | <td><input | 98 | <td><input | 
| 103 | class="form-control form-control-sm" | 99 | class="form-control form-control-sm" | 
| 104 | type="number" | 100 | type="number" | 
| 105 | ng-model="aDescargar[key]" | 101 | ng-model="aDescargar[key]" | 
| 106 | ng-change="actualizarArticulo()" | 102 | ng-change="actualizarArticulo()" | 
| 107 | foca-focus="articuloSeleccionado.idArticulo == cisterna.cisternaCarga.idProducto" | 103 | foca-focus="articuloSeleccionado.idArticulo == cisterna.cisternaCarga.idProducto" | 
| 108 | ng-disabled="articuloSeleccionado.idArticulo != cisterna.cisternaCarga.idProducto | 104 | ng-disabled="articuloSeleccionado.idArticulo != cisterna.cisternaCarga.idProducto | 
| 109 | || readonly"/></td> | 105 | || readonly"/></td> | 
| 110 | </tr> | 106 | </tr> | 
| 111 | </tbody> | 107 | </tbody> | 
| 112 | </table> | 108 | </table> | 
| 113 | <div class="col-12 px-0"> | 109 | <div class="col-12 px-0"> | 
| 114 | <label class="form-control-sm px-0"> | 110 | <label class="form-control-sm px-0"> | 
| 115 | <b>Observaciones</b> | 111 | <b>Observaciones</b> | 
| 116 | </label> | 112 | </label> | 
| 117 | </div> | 113 | </div> | 
| 118 | <div class="col-12"> | 114 | <div class="col-12"> | 
| 119 | <textarea | 115 | <textarea | 
| 120 | ng-model="remito.observaciones" | 116 | ng-model="remito.observaciones" | 
| 121 | ng-disabled="readonly" | 117 | ng-disabled="readonly" | 
| 122 | class="form-control form-control-sm" | 118 | class="form-control form-control-sm" | 
| 123 | rows="1" | 119 | rows="1" | 
| 124 | ></textarea> | 120 | ></textarea> | 
| 125 | </div> | 121 | </div> | 
| 126 | <div class="col-12 row mt-2"> | 122 | <div class="col-12 row mt-2"> | 
| 127 | <label class="form-control-sm px-0 col-3"><b>Nº Recibo</b></label> | 123 | <label class="form-control-sm px-0 col-3"><b>Nº Recibo</b></label> | 
| 128 | <input | 124 | <input | 
| 129 | class="form-control form-control-sm col-4" | 125 | class="form-control form-control-sm col-4" | 
| 130 | type="number" | 126 | type="number" | 
| 131 | ng-disabled="readonly" | 127 | ng-disabled="readonly" | 
| 132 | ng-model="numeroRecibo" | 128 | ng-model="numeroRecibo" | 
| 133 | ng-keypress="descargar($event.keyCode)" | 129 | ng-keypress="descargar($event.keyCode)" | 
| 134 | foca-focus="articuloSeleccionado.cantidadDescargada === articuloSeleccionado.cantidad"> | 130 | foca-focus="articuloSeleccionado.cantidadDescargada === articuloSeleccionado.cantidad"> | 
| 135 | <button | 131 | <button | 
| 136 | class="ml-4 form-control-sm btn btn-success col-4" | 132 | class="ml-4 form-control-sm btn btn-success col-4" | 
| 137 | ladda="cargando" | 133 | ladda="cargando" | 
| 138 | data-spinner-color="#FF0000" | 134 | data-spinner-color="#FF0000" | 
| 139 | type="button" | 135 | type="button" | 
| 140 | ng-disabled="!distribucionDisponible() || !numeroRecibo" | 136 | ng-disabled="!distribucionDisponible() || !numeroRecibo" | 
| 141 | ng-click="descargar(13)"> | 137 | ng-click="descargar(13)"> | 
| 142 | Descargar | 138 | Descargar | 
| 143 | </button> | 139 | </button> | 
| 144 | </div> | 140 | </div> | 
| 145 | </form> | 141 | </form> | 
| 146 | </div> | 142 | </div> | 
| 147 | <div class="modal-footer py-2"> | 143 | <div class="modal-footer py-2"> | 
| 148 | <button | 144 | <button | 
| 149 | class="btn btn-danger btn-sm" | 145 | class="btn btn-danger btn-sm" | 
| 150 | type="button" | 146 | type="button" | 
| 151 | ng-click="rechazar()" | 147 | ng-click="rechazar()" | 
| 152 | ng-disabled="readonly" | 148 | ng-disabled="readonly" | 
| 153 | >Rechazar</button> | 149 | >Rechazar</button> | 
| 154 | <button | 150 | <button | 
| 155 | class="btn btn-secondary btn-sm" | 151 | class="btn btn-secondary btn-sm" | 
| 156 | type="button" | 152 | type="button" | 
| 157 | ng-click="cancel()" | 153 | ng-click="cancel()" | 
| 158 | >Salir</button> | 154 | >Salir</button> | 
| 159 | </div> | 155 | </div> | 
| 160 | 156 |