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