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