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