Commit 15a95082a5a08c5e8d2d8d6da80be5f00b4dda27
Exists in
master
Merge branch 'master' into 'master'
Master(efernandez) See merge request !11
Showing
3 changed files
Show diff stats
src/js/controller.js
1 | angular.module('focaModalDescarga') | 1 | angular.module('focaModalDescarga') |
2 | .controller('focaModalDescargaCtrl', [ | 2 | .controller('focaModalDescargaCtrl', [ |
3 | '$scope', | 3 | '$scope', |
4 | 'focaModalDescargasService', | 4 | 'focaModalDescargasService', |
5 | '$filter', | 5 | '$filter', |
6 | 'focaModalService', | 6 | 'focaModalService', |
7 | '$timeout', | 7 | '$timeout', |
8 | '$uibModalInstance', | 8 | '$uibModalInstance', |
9 | '$uibModal', | 9 | '$uibModal', |
10 | 'remito', | 10 | 'remito', |
11 | 'focaModalDetalleHojaRutaService', | 11 | 'focaModalDetalleHojaRutaService', |
12 | 'focaSeguimientoService', | 12 | 'focaSeguimientoService', |
13 | 'crearRemitoService', | 13 | 'crearRemitoService', |
14 | function ($scope, focaModalDescargasService, $filter, | 14 | function ($scope, focaModalDescargasService, $filter, |
15 | focaModalService, $timeout, $uibModalInstance, $uibModal, remito, | 15 | focaModalService, $timeout, $uibModalInstance, $uibModal, remito, |
16 | focaModalDetalleHojaRutaService, focaSeguimientoService, crearRemitoService) { | 16 | focaModalDetalleHojaRutaService, focaSeguimientoService, crearRemitoService) { |
17 | 17 | ||
18 | //#region variables | 18 | //#region variables |
19 | $scope.remito = {}; | 19 | $scope.remito = {}; |
20 | $scope.remito = remito; | 20 | $scope.remito = remito; |
21 | $scope.nroRecibo = 0; | 21 | $scope.nroRecibo = 0; |
22 | $scope.cisternas = remito.cisternas; | 22 | $scope.cisternas = remito.cisternas; |
23 | $scope.nroSucursal; | 23 | $scope.nroSucursal; |
24 | $scope.nroRemito; | 24 | $scope.nroRemito; |
25 | $scope.articulos = []; | 25 | $scope.articulos = []; |
26 | $scope.hasErrorSucursalRemito = false; | 26 | $scope.hasErrorSucursalRemito = false; |
27 | //#endregion | 27 | //#endregion |
28 | 28 | ||
29 | function init() { | 29 | function init() { |
30 | crearRemitoService.getNumeroRemito().then( | 30 | crearRemitoService.getNumeroRemito().then( |
31 | function (res) { | 31 | function (res) { |
32 | $scope.nroSucursal = res.data.sucursal; | 32 | $scope.nroSucursal = res.data.sucursal; |
33 | $scope.nroRemito = res.data.numeroRemito; | 33 | $scope.nroRemito = res.data.numeroRemito; |
34 | $scope.validateSucursalRemito($scope.nroSucursal, $scope.nroRemito); | 34 | $scope.validateSucursalRemito($scope.nroSucursal, $scope.nroRemito); |
35 | }, | 35 | }, |
36 | function (err) { | 36 | function (err) { |
37 | focaModalService.alert('La terminal no esta configurada correctamente'); | 37 | focaModalService.alert('La terminal no esta configurada correctamente'); |
38 | console.info(err); | 38 | console.info(err); |
39 | } | 39 | } |
40 | ); | 40 | ); |
41 | }; | 41 | }; |
42 | 42 | ||
43 | init(); | 43 | init(); |
44 | 44 | ||
45 | $scope.crearRemito = function () { | 45 | $scope.crearRemito = function () { |
46 | if (!$scope.remito.cliente) { | 46 | if (!$scope.remito.cliente) { |
47 | focaModalService.alert("No has seleccionado cliente"); | 47 | focaModalService.alert("No has seleccionado cliente"); |
48 | return; | 48 | return; |
49 | } | 49 | } |
50 | if (validarDescarga()) { | 50 | if (validarDescarga()) { |
51 | return; | 51 | return; |
52 | } | 52 | } |
53 | //#region OBJETO REMITO | 53 | //#region OBJETO REMITO |
54 | var remito = { | 54 | var remito = { |
55 | id: 0, | 55 | id: 0, |
56 | fechaRemito: new Date().toISOString().slice(0, 19).replace('T', ' '), | 56 | fechaRemito: new Date().toISOString().slice(0, 19).replace('T', ' '), |
57 | idCliente: $scope.remito.cliente.cod, | 57 | idCliente: $scope.remito.cliente.cod, |
58 | nombreCliente: $scope.remito.cliente.nom, | 58 | nombreCliente: $scope.remito.cliente.nom, |
59 | cuitCliente: $scope.remito.cliente.cuit, | 59 | cuitCliente: $scope.remito.cliente.cuit, |
60 | total: $scope.getTotal() * $scope.remito.cotizacion.VENDEDOR, | 60 | total: $scope.getTotal() * $scope.remito.cotizacion.VENDEDOR, |
61 | numeroNotaPedido: $scope.remito.numeroNotaPedido, | 61 | numeroNotaPedido: $scope.remito.numeroNotaPedido, |
62 | idVendedor: $scope.remito.cliente.ven, | 62 | idVendedor: $scope.remito.cliente.ven, |
63 | idProveedor: $scope.remito.proveedor.COD, | 63 | idProveedor: $scope.remito.proveedor.COD, |
64 | idDomicilio: 0, | 64 | idDomicilio: 0, |
65 | idCotizacion: $scope.remito.cotizacion.ID, | 65 | idCotizacion: $scope.remito.cotizacion.ID, |
66 | idListaPrecio: parseInt($scope.remito.cliente.mod), | 66 | idListaPrecio: parseInt($scope.remito.cliente.mod) || '', |
67 | flete: $scope.remito.flete, | 67 | flete: $scope.remito.flete, |
68 | fob: $scope.remito.fob, | 68 | fob: $scope.remito.fob, |
69 | bomba: $scope.remito.bomba, | 69 | bomba: $scope.remito.bomba, |
70 | kilometros: $scope.remito.kilometros, | 70 | kilometros: $scope.remito.kilometros, |
71 | domicilioStamp: $scope.remito.cliente.DOM, | 71 | domicilioStamp: $scope.remito.cliente.DOM, |
72 | observaciones: $scope.remito.observaciones, | 72 | observaciones: $scope.remito.observaciones, |
73 | numeroRemito: parseInt($scope.nroRemito), | 73 | numeroRemito: parseInt($scope.nroRemito), |
74 | sucursal: parseInt($scope.nroSucursal), | 74 | sucursal: parseInt($scope.nroSucursal), |
75 | responsabilidadIvaCliente: $scope.remito.cliente.iva, | 75 | responsabilidadIvaCliente: $scope.remito.cliente.iva, |
76 | descuento: 0,//TODO, | 76 | descuento: 0,//TODO, |
77 | importeNeto: getImporte('netoUnitario'), | 77 | importeNeto: getImporte('netoUnitario'), |
78 | importeExento: getImporte('exentoUnitario'), | 78 | importeExento: getImporte('exentoUnitario'), |
79 | importeIva: getImporte('ivaUnitario'), | 79 | importeIva: getImporte('ivaUnitario'), |
80 | importeIvaServicios: 0,//TODO | 80 | importeIvaServicios: 0,//TODO |
81 | importeImpuestoInterno: getImporte('impuestoInternoUnitario'), | 81 | importeImpuestoInterno: getImporte('impuestoInternoUnitario'), |
82 | importeImpuestoInterno1: getImporte('impuestoInterno1Unitario'), | 82 | importeImpuestoInterno1: getImporte('impuestoInterno1Unitario'), |
83 | importeImpuestoInterno2: getImporte('impuestoInterno2Unitario'), | 83 | importeImpuestoInterno2: getImporte('impuestoInterno2Unitario'), |
84 | percepcion: 0,//TODO | 84 | percepcion: 0,//TODO |
85 | percepcionIva: 0,//TODO | 85 | percepcionIva: 0,//TODO |
86 | redondeo: 0,//TODO | 86 | redondeo: 0,//TODO |
87 | anulado: false, | 87 | anulado: false, |
88 | planilla: $filter('date')($scope.now, 'ddMMyyyy'), | 88 | planilla: $filter('date')($scope.now, 'ddMMyyyy'), |
89 | lugar: parseInt($scope.puntoVenta), | 89 | lugar: parseInt($scope.puntoVenta), |
90 | cuentaMadre: 0,//TODO | 90 | cuentaMadre: 0,//TODO |
91 | cuentaContable: 0,//TODO | 91 | cuentaContable: 0,//TODO |
92 | asiento: 0,//TODO | 92 | asiento: 0,//TODO |
93 | e_hd: '',//TODO | 93 | e_hd: '',//TODO |
94 | c_hd: '', | 94 | c_hd: '', |
95 | numeroLiquidoProducto: 0,//TODO | 95 | numeroLiquidoProducto: 0,//TODO |
96 | estado: 0, | 96 | estado: 0, |
97 | destinoVenta: 0,//TODO | 97 | destinoVenta: 0,//TODO |
98 | operacionTipo: 0, //TODO | 98 | operacionTipo: 0, //TODO |
99 | idHojaRuta: $scope.remito.idHojaRuta | 99 | idHojaRuta: $scope.remito.idHojaRuta |
100 | } | 100 | } |
101 | //#endregion | 101 | //#endregion |
102 | focaModalDescargasService.crearRemito({ remito: remito, notaPedido: { id: 0 } }) | 102 | focaModalDescargasService.crearRemito({ remito: remito, notaPedido: { id: 0 } }) |
103 | .then(function (res) { | 103 | .then(function (res) { |
104 | remitoId = res.data.id | 104 | remitoId = res.data.id |
105 | descargar(remitoId); | 105 | descargar(remitoId); |
106 | focaModalDescargasService. | 106 | focaModalDescargasService. |
107 | addArticulos($scope.remito.articulosRemito, $scope.articulos, remitoId, 1); | 107 | addArticulos($scope.remito.articulosRemito, $scope.articulos, remitoId, 1); |
108 | focaModalService.alert("Descarga realizada") | 108 | focaModalService.alert("Descarga realizada") |
109 | .then(function () { | 109 | .then(function () { |
110 | $uibModalInstance.dismiss(); | 110 | $uibModalInstance.dismiss(); |
111 | }) | 111 | }) |
112 | }) | 112 | }) |
113 | .catch(function (e) { console.log(e); }) | 113 | .catch(function (e) { console.log(e); }) |
114 | 114 | ||
115 | }; | 115 | }; |
116 | $scope.getTotal = function () { | 116 | $scope.getTotal = function () { |
117 | var total = 0; | 117 | var total = 0; |
118 | $scope.cisternas.forEach(function (cisterna) { | 118 | $scope.cisternas.forEach(function (cisterna) { |
119 | 119 | ||
120 | total += cisterna.cisternaCarga.articulo.PreVen * cisterna.cisternaCarga.descargar; | 120 | total += cisterna.cisternaCarga.articulo.PreVen * cisterna.cisternaCarga.descargar; |
121 | cisterna.cisternaCarga.articulo.cantidad = cisterna.cisternaCarga.descargar; | 121 | cisterna.cisternaCarga.articulo.cantidad = cisterna.cisternaCarga.descargar; |
122 | $scope.articulos.push(cisterna.cisternaCarga.articulo); | 122 | $scope.articulos.push(cisterna.cisternaCarga.articulo); |
123 | }); | 123 | }); |
124 | return parseFloat(total.toFixed(2)); | 124 | return parseFloat(total.toFixed(2)); |
125 | }; | 125 | }; |
126 | function descargar(idRemito) { | 126 | function descargar(idRemito) { |
127 | 127 | ||
128 | for (var i = 0; i < $scope.cisternas.length; i++) { | 128 | for (var i = 0; i < $scope.cisternas.length; i++) { |
129 | var descarga = $scope.cisternas[i].cisternaCarga.descargar; | 129 | var descarga = $scope.cisternas[i].cisternaCarga.descargar; |
130 | var hojaRutaMovimientos = []; | 130 | var hojaRutaMovimientos = []; |
131 | var cisternaMovimientos = []; | 131 | var cisternaMovimientos = []; |
132 | var cisternaCargas = []; | 132 | var cisternaCargas = []; |
133 | var cisternaCarga = $scope.cisternas[i].cisternaCarga; | 133 | var cisternaCarga = $scope.cisternas[i].cisternaCarga; |
134 | if (!descarga) continue; | 134 | if (!descarga) continue; |
135 | cisternaCarga.cantidad -= descarga; | 135 | cisternaCarga.cantidad -= descarga; |
136 | 136 | ||
137 | //Guardar | 137 | //Guardar |
138 | var now = new Date(); | 138 | var now = new Date(); |
139 | var cisternaMovimiento = { | 139 | var cisternaMovimiento = { |
140 | fecha: now.toISOString().slice(0, 19).replace('T', ' '), | 140 | fecha: now.toISOString().slice(0, 19).replace('T', ' '), |
141 | cantidad: descarga, | 141 | cantidad: descarga, |
142 | metodo: 'descarga', | 142 | metodo: 'descarga', |
143 | idCisternaCarga: cisternaCarga.id, | 143 | idCisternaCarga: cisternaCarga.id, |
144 | idRemito: idRemito | 144 | idRemito: idRemito |
145 | }; | 145 | }; |
146 | var hojaRutaMovimiento = { | 146 | var hojaRutaMovimiento = { |
147 | reciboDescarga: $scope.nroRecibo, | 147 | reciboDescarga: $scope.nroRecibo, |
148 | idRemito: idRemito | 148 | idRemito: idRemito |
149 | }; | 149 | }; |
150 | 150 | ||
151 | cisternaCarga = angular.copy($scope.cisternas[i].cisternaCarga); | 151 | cisternaCarga = angular.copy($scope.cisternas[i].cisternaCarga); |
152 | 152 | ||
153 | delete cisternaCarga.articulo; | 153 | delete cisternaCarga.articulo; |
154 | delete cisternaCarga.descargar; | 154 | delete cisternaCarga.descargar; |
155 | cisternaCargas.push(cisternaCarga); | 155 | cisternaCargas.push(cisternaCarga); |
156 | cisternaMovimientos.push(cisternaMovimiento); | 156 | cisternaMovimientos.push(cisternaMovimiento); |
157 | hojaRutaMovimientos.push(hojaRutaMovimiento); | 157 | hojaRutaMovimientos.push(hojaRutaMovimiento); |
158 | } | 158 | } |
159 | var save = { | 159 | var save = { |
160 | cisternaCargas: cisternaCargas, | 160 | cisternaCargas: cisternaCargas, |
161 | cisternaMovimientos: cisternaMovimientos, | 161 | cisternaMovimientos: cisternaMovimientos, |
162 | hojaRutaMovimientos: hojaRutaMovimientos, | 162 | hojaRutaMovimientos: hojaRutaMovimientos, |
163 | articulo: $scope.articuloSeleccionado | 163 | articulo: $scope.articuloSeleccionado |
164 | }; | 164 | }; |
165 | focaModalDetalleHojaRutaService | 165 | focaModalDetalleHojaRutaService |
166 | .postMovimientoHojaRuta(save) | 166 | .postMovimientoHojaRuta(save) |
167 | .then(guardarSeguimiento) | 167 | .then(guardarSeguimiento) |
168 | .catch(function () { }); | 168 | .catch(function () { }); |
169 | function guardarSeguimiento(res) { | 169 | function guardarSeguimiento(res) { |
170 | focaSeguimientoService | 170 | focaSeguimientoService |
171 | .guardarPosicion( | 171 | .guardarPosicion( |
172 | 'Entrega de producto', | 172 | 'Entrega de producto', |
173 | res.data[0].id, | 173 | res.data[0].id, |
174 | ''); | 174 | ''); |
175 | $scope.aDescargar = []; | 175 | $scope.aDescargar = []; |
176 | }; | 176 | }; |
177 | }; | 177 | }; |
178 | function getImporte(propiedad) { | 178 | function getImporte(propiedad) { |
179 | var importe = 0; | 179 | var importe = 0; |
180 | $scope.remito.articulosRemito.forEach(function (articulo) { | 180 | $scope.remito.articulosRemito.forEach(function (articulo) { |
181 | if (articulo[propiedad]) { | 181 | if (articulo[propiedad]) { |
182 | importe += articulo[propiedad] * articulo.cantidad; | 182 | importe += articulo[propiedad] * articulo.cantidad; |
183 | } | 183 | } |
184 | return; | 184 | return; |
185 | }); | 185 | }); |
186 | return importe; | 186 | return importe; |
187 | }; | 187 | }; |
188 | function validarDescarga() { | 188 | function validarDescarga() { |
189 | |||
190 | if ($scope.nroRemito > 99999999) { | ||
191 | focaModalService.alert('Numero remito mayor al permitido máximo 8'); | ||
192 | return true; | ||
193 | } | ||
194 | |||
195 | if ($scope.nroSucursal > 9999) { | ||
196 | focaModalService.alert('Numero sucursal mayor a la permitida máximo 4'); | ||
197 | return true; | ||
198 | } | ||
199 | |||
189 | for (var i = 0; i < $scope.cisternas.length; i++) { | 200 | for (var i = 0; i < $scope.cisternas.length; i++) { |
190 | if (parseInt($scope.cisternas[i].cisternaCarga.descargar) > | 201 | if (parseInt($scope.cisternas[i].cisternaCarga.descargar) > |
191 | $scope.cisternas[i].cisternaCarga.cantidad || | 202 | $scope.cisternas[i].cisternaCarga.cantidad || |
192 | parseInt($scope.cisternas[i].cisternaCarga.descargar) < 0) { | 203 | parseInt($scope.cisternas[i].cisternaCarga.descargar) < 0) { |
193 | focaModalService.alert("Cantidad de descarga ingresada erronea"); | 204 | focaModalService.alert("Cantidad de descarga ingresada erronea"); |
194 | return true; | 205 | return true; |
195 | } | 206 | } |
196 | } | 207 | } |
197 | return false; | 208 | return false; |
198 | }; | 209 | }; |
199 | $scope.seleccionarCliente = function () { | 210 | $scope.seleccionarCliente = function () { |
200 | var modalInstance = $uibModal.open( | 211 | var modalInstance = $uibModal.open( |
201 | { | 212 | { |
202 | ariaLabelledBy: 'Busqueda de Cliente', | 213 | ariaLabelledBy: 'Busqueda de Cliente', |
203 | templateUrl: 'foca-busqueda-cliente-modal.html', | 214 | templateUrl: 'foca-busqueda-cliente-modal.html', |
204 | controller: 'focaBusquedaClienteModalController', | 215 | controller: 'focaBusquedaClienteModalController', |
205 | resolve: { | 216 | resolve: { |
206 | vendedor: function () { return null; }, | 217 | vendedor: function () { return null; }, |
207 | cobrador: function () { return null; } | 218 | cobrador: function () { return null; } |
208 | }, | 219 | }, |
209 | size: 'lg' | 220 | size: 'lg' |
210 | } | 221 | } |
211 | ); | 222 | ); |
212 | modalInstance.result.then(function (cliente) { | 223 | modalInstance.result.then(function (cliente) { |
213 | $scope.remito.cliente = cliente; | 224 | $scope.remito.cliente = cliente; |
214 | }, function () { | 225 | }, function () { |
215 | //funcion ejecutada al cancelar modal | 226 | //funcion ejecutada al cancelar modal |
216 | }); | 227 | }); |
217 | }; | 228 | }; |
218 | $scope.validateSucursalRemito = function (sucursal, remito) { | 229 | $scope.validateSucursalRemito = function (sucursal, remito) { |
219 | if (!sucursal || !remito) { | 230 | if (!sucursal || !remito) { |
220 | $scope.hasErrorSucursalRemito = false; | 231 | $scope.hasErrorSucursalRemito = false; |
221 | return; | 232 | return; |
222 | } | 233 | } |
223 | 234 | ||
224 | focaModalDescargasService.validarSucursalRemito(sucursal, remito) | 235 | focaModalDescargasService.validarSucursalRemito(sucursal, remito) |
225 | .then(function (res) { | 236 | .then(function (res) { |
226 | if (res.data.data === 1) { | 237 | if (res.data.data === 1) { |
227 | $scope.hasErrorSucursalRemito = true; | 238 | $scope.hasErrorSucursalRemito = true; |
228 | } else { | 239 | } else { |
229 | $scope.hasErrorSucursalRemito = false; | 240 | $scope.hasErrorSucursalRemito = false; |
230 | } | 241 | } |
231 | }) | 242 | }) |
232 | .catch(function (e) { console.error(e); }); | 243 | .catch(function (e) { console.error(e); }); |
233 | }; | 244 | }; |
234 | $scope.cancelar = function () { | 245 | $scope.cancelar = function () { |
235 | $uibModalInstance.dismiss(); | 246 | $uibModalInstance.dismiss(); |
236 | }; | 247 | }; |
237 | function rellenar(relleno, longitud) { | 248 | function rellenar(relleno, longitud) { |
238 | relleno = '' + relleno; | 249 | relleno = '' + relleno; |
239 | while (relleno.length < longitud) { | 250 | while (relleno.length < longitud) { |
240 | relleno = '0' + relleno; | 251 | relleno = '0' + relleno; |
241 | } | 252 | } |
242 | return relleno; | 253 | return relleno; |
243 | }; | 254 | }; |
244 | } | 255 | } |
245 | ]); | 256 | ]); |
246 | 257 |
src/js/service.js
1 | angular.module('focaModalDescarga') | 1 | angular.module('focaModalDescarga') |
2 | .factory('focaModalDescargasService', ['$http', 'API_ENDPOINT', 'crearRemitoService', | 2 | .factory('focaModalDescargasService', ['$http', 'API_ENDPOINT', 'crearRemitoService', |
3 | function ($http, API_ENDPOINT, crearRemitoService) { | 3 | function ($http, API_ENDPOINT, crearRemitoService) { |
4 | var route = API_ENDPOINT.URL; | 4 | var route = API_ENDPOINT.URL; |
5 | return { | 5 | return { |
6 | crearRemito: function (remito) { | 6 | crearRemito: function (remito) { |
7 | return $http.post(route + '/remito/mobile', remito); | 7 | return $http.post(route + '/remito/guardar/mobile', remito); |
8 | }, | 8 | }, |
9 | validarSucursalRemito: function (sucursal, remito) { | 9 | validarSucursalRemito: function (sucursal, remito) { |
10 | return $http.get(route + '/remito/validar/' + | 10 | return $http.get(route + '/remito/validar/' + |
11 | sucursal + '/' + remito); | 11 | sucursal + '/' + remito); |
12 | }, | 12 | }, |
13 | addArticulos: function (articulosRemito, articulosBase, idRemito, cotizacion) { | 13 | addArticulos: function (articulosRemito, articulosBase, idRemito, cotizacion) { |
14 | 14 | ||
15 | for (var i = 0; i < articulosRemito.length; i++) { | 15 | for (var i = 0; i < articulosRemito.length; i++) { |
16 | 16 | ||
17 | var articuloReferencia = articulosBase.filter(function (articulo) { | 17 | var articuloReferencia = articulosBase.filter(function (articulo) { |
18 | return articulosRemito[i].idArticulo == articulo.id; | 18 | return articulosRemito[i].idArticulo == articulo.id; |
19 | })[0]; | 19 | })[0]; |
20 | 20 | ||
21 | delete articulosRemito[i].id | 21 | delete articulosRemito[i].id |
22 | delete articulosRemito[i].editCantidad; | 22 | delete articulosRemito[i].editCantidad; |
23 | delete articulosRemito[i].editPrecio; | 23 | delete articulosRemito[i].editPrecio; |
24 | 24 | ||
25 | articulosRemito[i].idRemito = articulosRemito[i].idRemito !== -1 ? | 25 | articulosRemito[i].idRemito = articulosRemito[i].idRemito !== -1 ? |
26 | idRemito : articulosRemito[i].idRemito; | 26 | idRemito : articulosRemito[i].idRemito; |
27 | 27 | ||
28 | articulosRemito[i].precio = articuloReferencia.PreVen * cotizacion; | 28 | articulosRemito[i].precio = articuloReferencia.PreVen * cotizacion; |
29 | articulosRemito[i].cantidad = articuloReferencia.cantidad; | 29 | articulosRemito[i].cantidad = articuloReferencia.cantidad; |
30 | articulosRemito[i].cantidadDescargada = articuloReferencia.cantidad; | 30 | articulosRemito[i].cantidadDescargada = articuloReferencia.cantidad; |
31 | 31 | ||
32 | delete articulosRemito[i].idNotaPedido; | 32 | delete articulosRemito[i].idNotaPedido; |
33 | crearRemitoService.crearArticulosParaRemito(articulosRemito[i]); | 33 | crearRemitoService.crearArticulosParaRemito(articulosRemito[i]); |
34 | } | 34 | } |
35 | } | 35 | } |
36 | }; | 36 | }; |
37 | }]); | 37 | }]); |
38 | 38 |
src/views/foca-modal-descarga.html
1 | <div class="modal-header"> | 1 | <div class="modal-header"> |
2 | <h5>Detalle de descarga</h5> | 2 | <h5>Detalle de descarga</h5> |
3 | </div> | 3 | </div> |
4 | <div class="modal-body"> | 4 | <div class="modal-body"> |
5 | <div class="row px-1"> | 5 | <div class="row px-1"> |
6 | <div class="col-3 align-self-center mt-1 pl-1"> | 6 | <div class="col-3 align-self-center mt-1 pl-1"> |
7 | <strong>Cliente</strong> | 7 | <strong>Cliente</strong> |
8 | </div> | 8 | </div> |
9 | <div class="col-9"> | 9 | <div class="col-9"> |
10 | <div class="input-group"> | 10 | <div class="input-group"> |
11 | <input | 11 | <input |
12 | type="text" | 12 | type="text" |
13 | ladda="searchLoading" | 13 | ladda="searchLoading" |
14 | class="form-control form-control-sm foca-input" | 14 | class="form-control form-control-sm foca-input" |
15 | placeholder="Busqueda cliente" | 15 | placeholder="Busqueda cliente" |
16 | ng-model="remito.cliente.nom" | 16 | ng-model="remito.cliente.nom" |
17 | readonly | 17 | readonly |
18 | > | 18 | > |
19 | <div class="input-group-append"> | 19 | <div class="input-group-append"> |
20 | <button | 20 | <button |
21 | ladda="searchLoading" | 21 | ladda="searchLoading" |
22 | data-spinner-color="#FF0000" | 22 | data-spinner-color="#FF0000" |
23 | class="btn btn-outline-secondary" | 23 | class="btn btn-outline-secondary" |
24 | type="button" | 24 | type="button" |
25 | ng-click="seleccionarCliente()" | 25 | ng-click="seleccionarCliente()" |
26 | > | 26 | > |
27 | <i class="fa fa-search fa-x1" aria-hidden="true"></i> | 27 | <i class="fa fa-search fa-x1" aria-hidden="true"></i> |
28 | </button> | 28 | </button> |
29 | </div> | 29 | </div> |
30 | </div> | 30 | </div> |
31 | </div> | 31 | </div> |
32 | <div class="col-3 align-self-center pl-1 mt-1"> | 32 | <div class="col-3 align-self-center pl-1 mt-1"> |
33 | <strong>Domicilio</strong> | 33 | <strong>Domicilio</strong> |
34 | </div> | 34 | </div> |
35 | <div class="col-9 align-self-center mt-1"> | 35 | <div class="col-9 align-self-center mt-1"> |
36 | <label ng-bind="remito.cliente.DOM"></label> | 36 | <label ng-bind="remito.cliente.DOM"></label> |
37 | </div> | 37 | </div> |
38 | <div class="col-3 align-self-center px-1 mt-1"> | 38 | <div class="col-3 align-self-center px-1 mt-1"> |
39 | <strong>Remito Nº</strong> | 39 | <strong>Remito Nº</strong> |
40 | </div> | 40 | </div> |
41 | <div class="col-3 pr-0 mt-1"> | 41 | <div class="col-3 pr-0 mt-1"> |
42 | <input | 42 | <input |
43 | type="number" class="text-center form-control form-control-sm" | 43 | type="number" class="text-center form-control form-control-sm" |
44 | ng-focus="$event.target.select();" | 44 | ng-focus="$event.target.select();" |
45 | ng-model="nroSucursal" | 45 | ng-model="nroSucursal" |
46 | ng-change="validateSucursalRemito(nroSucursal, nroRemito)" | 46 | ng-change="validateSucursalRemito(nroSucursal, nroRemito)" |
47 | limite-numeros-max="4"> | 47 | > |
48 | </div> | 48 | </div> |
49 | <div class="col-6 mt-1"> | 49 | <div class="col-6 mt-1"> |
50 | <input | 50 | <input |
51 | type="number" class="text-center form-control form-control-sm" | 51 | type="number" class="text-center form-control form-control-sm" |
52 | ng-focus="$event.target.select();" | 52 | ng-focus="$event.target.select();" |
53 | ng-model="nroRemito" | 53 | ng-model="nroRemito" |
54 | ng-change="validateSucursalRemito(nroSucursal, nroRemito)" | 54 | ng-change="validateSucursalRemito(nroSucursal, nroRemito)" |
55 | limite-numeros-max="8"> | 55 | > |
56 | </div> | 56 | </div> |
57 | <div | 57 | <div |
58 | class="col-12 mt-1 alert alert-danger text-center" role="alert" | 58 | class="col-12 mt-1 alert alert-danger text-center" role="alert" |
59 | ng-show="hasErrorSucursalRemito"> | 59 | ng-show="hasErrorSucursalRemito"> |
60 | Error numero de remito existente!<br>Ingrese otro número | 60 | Error numero de remito existente!<br>Ingrese otro número |
61 | </div> | 61 | </div> |
62 | <div class="col-12 mt-3 p-0"> | 62 | <div class="col-12 mt-3 p-0"> |
63 | <table class="table"> | 63 | <table class="table"> |
64 | <thead> | 64 | <thead> |
65 | <tr> | 65 | <tr> |
66 | <th>Cisterna</th> | 66 | <th>Cisterna</th> |
67 | <th>Articulo/Disponibles</th> | 67 | <th>Articulo/Disponibles</th> |
68 | <th>Descargar</th> | 68 | <th>Descargar</th> |
69 | </tr> | 69 | </tr> |
70 | </thead> | 70 | </thead> |
71 | <tbody> | 71 | <tbody> |
72 | <tr ng-repeat="cisterna in cisternas"> | 72 | <tr ng-repeat="cisterna in cisternas"> |
73 | <td class="text-center" ng-bind="cisterna.codigo"></td> | 73 | <td class="text-center" ng-bind="cisterna.codigo"></td> |
74 | <td class="text-center"> | 74 | <td class="text-center"> |
75 | {{cisterna.cisternaCarga.articulo.DetArt}}<br> | 75 | {{cisterna.cisternaCarga.articulo.DetArt}}<br> |
76 | {{cisterna.cisternaCarga.cantidad}} | 76 | {{cisterna.cisternaCarga.cantidad}} |
77 | </td> | 77 | </td> |
78 | <td> | 78 | <td> |
79 | <input | 79 | <input |
80 | ng-init="cisterna.cisternaCarga.descargar = | 80 | ng-init="cisterna.cisternaCarga.descargar = |
81 | cisterna.cisternaCarga.cantidad" | 81 | cisterna.cisternaCarga.cantidad" |
82 | ng-model="cisterna.cisternaCarga.descargar" | 82 | ng-model="cisterna.cisternaCarga.descargar" |
83 | ng-focus="$event.target.select();" | 83 | ng-focus="$event.target.select();" |
84 | class="text-center form-control col-12"> | 84 | class="text-center form-control col-12"> |
85 | </td> | 85 | </td> |
86 | </tr> | 86 | </tr> |
87 | </tbody> | 87 | </tbody> |
88 | </table> | 88 | </table> |
89 | </div> | 89 | </div> |
90 | <div class="col-3 align-self-center px-1"> | 90 | <div class="col-3 align-self-center px-1"> |
91 | <strong>Nº Recibo</strong> | 91 | <strong>Nº Recibo</strong> |
92 | </div> | 92 | </div> |
93 | <div class="col-9"> | 93 | <div class="col-9"> |
94 | <input | 94 | <input |
95 | ng-model="nroRecibo" class="form-control" | 95 | ng-model="nroRecibo" class="form-control" |
96 | ng-focus="$event.target.select();" | 96 | ng-focus="$event.target.select();" |
97 | type="number" placeholder="Nº de recibo"> | 97 | type="number" placeholder="Nº de recibo"> |
98 | </div> | 98 | </div> |
99 | </div> | 99 | </div> |
100 | </div> | 100 | </div> |
101 | <div class="modal-footer"> | 101 | <div class="modal-footer"> |
102 | <button | 102 | <button |
103 | class="btn btn-sm btn-secondary" | 103 | class="btn btn-sm btn-secondary" |
104 | ladda="cargando" | 104 | ladda="cargando" |
105 | type="button" | 105 | type="button" |
106 | ng-click="cancelar()">Cancelar</button> | 106 | ng-click="cancelar()">Cancelar</button> |
107 | <button | 107 | <button |
108 | class="btn btn-sm btn-primary" | 108 | class="btn btn-sm btn-primary" |
109 | ladda="cargando" | 109 | ladda="cargando" |
110 | type="button" | 110 | type="button" |
111 | ng-click="crearRemito()" | 111 | ng-click="crearRemito()" |
112 | ng-disabled="tieneArticulosPendientes() || | 112 | ng-disabled="tieneArticulosPendientes() || |
113 | idRemito === -1 || hasErrorSucursalRemito || !nroSucursal || !nroRemito" | 113 | idRemito === -1 || hasErrorSucursalRemito || !nroSucursal || !nroRemito" |
114 | foca-focus="!tieneArticulosPendientes() && idRemito !== -1">Descargar</button> | 114 | foca-focus="!tieneArticulosPendientes() && idRemito !== -1">Descargar</button> |
115 | </div> | 115 | </div> |
116 | 116 |