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