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