Commit 8f5df4b190d9607f82819fe25997d703dc6335c5
Exists in
master
Merge branch 'master' into 'develop'
Master(efernandez) See merge request !4
Showing
4 changed files
Show diff stats
src/js/controller.js
1 | angular.module('focaCrearFactura').controller('facturaController', [ | 1 | angular.module('focaCrearFactura').controller('facturaController', [ |
2 | '$scope', '$uibModal', '$location', '$filter', 'crearFacturaService', '$timeout', | 2 | '$scope', '$uibModal', '$location', '$filter', 'crearFacturaService', '$timeout', |
3 | 'focaModalService', 'crearRemitoService', '$rootScope', 'focaBotoneraLateralService', | 3 | 'focaModalService', 'crearRemitoService', '$rootScope', 'focaBotoneraLateralService', |
4 | '$localStorage', | 4 | '$localStorage', |
5 | function ( | 5 | function ( |
6 | $scope, $uibModal, $location, $filter, crearFacturaService, $timeout, focaModalService, | 6 | $scope, $uibModal, $location, $filter, crearFacturaService, $timeout, focaModalService, |
7 | crearRemitoService, $rootScope, focaBotoneraLateralService, $localStorage) { | 7 | crearRemitoService, $rootScope, focaBotoneraLateralService, $localStorage) { |
8 | 8 | ||
9 | config(); | 9 | config(); |
10 | 10 | ||
11 | function config() { | 11 | function config() { |
12 | $scope.tmpCantidad = Number; | 12 | $scope.tmpCantidad = Number; |
13 | $scope.tmpPrecio = Number; | 13 | $scope.tmpPrecio = Number; |
14 | $scope.botonera = crearFacturaService.getBotonera(); | 14 | $scope.botonera = crearFacturaService.getBotonera(); |
15 | $scope.isNumber = angular.isNumber; | 15 | $scope.isNumber = angular.isNumber; |
16 | $scope.datepickerAbierto = false; | 16 | $scope.datepickerAbierto = false; |
17 | $scope.show = false; | 17 | $scope.show = false; |
18 | $scope.cargando = true; | 18 | $scope.cargando = true; |
19 | $scope.now = new Date(); | 19 | $scope.now = new Date(); |
20 | $scope.puntoVenta = rellenar(0, 4); | 20 | $scope.puntoVenta = rellenar(0, 4); |
21 | $scope.comprobante = rellenar(0, 8); | 21 | $scope.comprobante = rellenar(0, 8); |
22 | $scope.dateOptions = { | 22 | $scope.dateOptions = { |
23 | maxDate: new Date(), | 23 | maxDate: new Date(), |
24 | minDate: new Date(2010, 0, 1) | 24 | minDate: new Date(2010, 0, 1) |
25 | }; | 25 | }; |
26 | $scope.cabeceras = []; | 26 | $scope.cabeceras = []; |
27 | crearFacturaService.getParametros().then(function (res) { | 27 | crearFacturaService.getParametros().then(function (res) { |
28 | 28 | ||
29 | var parametros = JSON.parse(res.data[0].jsonText); | 29 | var parametros = JSON.parse(res.data[0].jsonText); |
30 | 30 | ||
31 | if ($localStorage.factura) { | 31 | if ($localStorage.factura) { |
32 | 32 | ||
33 | $timeout(function () { getLSFactura(); }); | 33 | $timeout(function () { getLSFactura(); }); |
34 | } else { | 34 | } else { |
35 | 35 | ||
36 | for (var property in parametros) { | 36 | for (var property in parametros) { |
37 | $scope.factura[property] = parametros[property]; | 37 | $scope.factura[property] = parametros[property]; |
38 | $scope.inicial[property] = parametros[property]; | 38 | $scope.inicial[property] = parametros[property]; |
39 | } | 39 | } |
40 | 40 | ||
41 | setearFactura($scope.factura); | 41 | setearFactura($scope.factura); |
42 | } | 42 | } |
43 | 43 | ||
44 | }); | 44 | }); |
45 | 45 | ||
46 | //SETEO BOTONERA LATERAL | 46 | //SETEO BOTONERA LATERAL |
47 | $timeout(function () { | 47 | $timeout(function () { |
48 | focaBotoneraLateralService.showSalir(false); | 48 | focaBotoneraLateralService.showSalir(false); |
49 | focaBotoneraLateralService.showPausar(true); | 49 | focaBotoneraLateralService.showPausar(true); |
50 | focaBotoneraLateralService.showGuardar(true, $scope.seleccionarFormaDePago); | 50 | focaBotoneraLateralService.showGuardar(true, $scope.seleccionarFormaDePago); |
51 | focaBotoneraLateralService.addCustomButton('Salir', salir); | 51 | focaBotoneraLateralService.addCustomButton('Salir', salir); |
52 | }); | 52 | }); |
53 | 53 | ||
54 | init(); | 54 | init(); |
55 | 55 | ||
56 | } | 56 | } |
57 | 57 | ||
58 | function init() { | 58 | function init() { |
59 | 59 | ||
60 | $scope.$broadcast('cleanCabecera'); | 60 | $scope.$broadcast('cleanCabecera'); |
61 | 61 | ||
62 | $scope.factura = { | 62 | $scope.factura = { |
63 | id: 0, | 63 | id: 0, |
64 | estado: 0, | 64 | estado: 0, |
65 | vendedor: {}, | 65 | vendedor: {}, |
66 | cliente: {}, | 66 | cliente: {}, |
67 | proveedor: {}, | 67 | proveedor: {}, |
68 | domicilio: { dom: '' }, | 68 | domicilio: { dom: '' }, |
69 | moneda: {}, | 69 | moneda: {}, |
70 | cotizacion: $scope.cotizacionPorDefecto || {}, | 70 | cotizacion: $scope.cotizacionPorDefecto || {}, |
71 | articulosFactura: [] | 71 | articulosFactura: [], |
72 | despachos: [] | ||
72 | }; | 73 | }; |
73 | 74 | ||
74 | $scope.factura.articulosFactura = []; | 75 | $scope.factura.articulosFactura = []; |
75 | $scope.idLista = undefined; | 76 | $scope.idLista = undefined; |
76 | 77 | ||
77 | crearRemitoService.getNumeroRemito().then( | 78 | crearRemitoService.getNumeroRemito().then( |
78 | function (res) { | 79 | function (res) { |
79 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); | 80 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); |
80 | $scope.comprobante = rellenar(res.data.numeroRemito, 8); | 81 | $scope.comprobante = rellenar(res.data.numeroRemito, 8); |
81 | }, | 82 | }, |
82 | function (err) { | 83 | function (err) { |
83 | focaModalService.alert('La terminal no esta configurada correctamente'); | 84 | focaModalService.alert('La terminal no esta configurada correctamente'); |
84 | console.info(err); | 85 | console.info(err); |
85 | } | 86 | } |
86 | ); | 87 | ); |
87 | 88 | ||
88 | $scope.inicial = angular.copy($scope.factura); | 89 | $scope.inicial = angular.copy($scope.factura); |
89 | } | 90 | } |
90 | 91 | ||
91 | $scope.$watch('factura', function (newValue) { | 92 | $scope.$watch('factura', function (newValue) { |
92 | focaBotoneraLateralService.setPausarData({ | 93 | focaBotoneraLateralService.setPausarData({ |
93 | label: 'factura', | 94 | label: 'factura', |
94 | val: newValue | 95 | val: newValue |
95 | }); | 96 | }); |
96 | }, true); | 97 | }, true); |
97 | 98 | ||
98 | $scope.seleccionarFormaDePago = function () { | 99 | $scope.seleccionarFormaDePago = function () { |
99 | if (!validarGuardar()) return; | 100 | if (!validarGuardar()) return; |
100 | var modalInstance = $uibModal.open( | 101 | var modalInstance = $uibModal.open( |
101 | { | 102 | { |
102 | templateUrl: 'modal-forma-pago.html', | 103 | templateUrl: 'modal-forma-pago.html', |
103 | controller: 'focaModalFormaPagoController', | 104 | controller: 'focaModalFormaPagoController', |
104 | resolve: { | 105 | resolve: { |
105 | filters: function () { return null; }, | 106 | filters: function () { return null; }, |
106 | }, | 107 | }, |
107 | size: 'lg', | 108 | size: 'lg', |
108 | } | 109 | } |
109 | ); | 110 | ); |
110 | modalInstance.result | 111 | modalInstance.result |
111 | .then(function (data) { | 112 | .then(function (data) { |
112 | console.log(data); | 113 | console.log(data); |
113 | $scope.crearFactura(); | 114 | $scope.crearFactura(); |
114 | }) | 115 | }) |
115 | .catch(function (e) { console.error(e); }); | 116 | .catch(function (e) { console.error(e); }); |
116 | }; | 117 | }; |
117 | 118 | ||
118 | $scope.crearFactura = function () { | 119 | $scope.crearFactura = function () { |
119 | 120 | ||
120 | var save = { | 121 | var save = { |
121 | factura: { | 122 | factura: { |
122 | 123 | ||
123 | BONIF: 0, | 124 | BONIF: 0, |
124 | CLI: $scope.factura.cliente.cod, | 125 | CLI: $scope.factura.cliente.cod, |
125 | CUI: $scope.factura.cliente.cuit, | 126 | CUI: $scope.factura.cliente.cuit, |
126 | CTA: $scope.factura.cliente.cod, | 127 | CTA: $scope.factura.cliente.cod, |
127 | DC1: '', | 128 | DC1: '', |
128 | DC2: '', | 129 | DC2: '', |
129 | DE1: '', | 130 | DE1: '', |
130 | DOM: $scope.factura.cliente.DOM, | 131 | DOM: $scope.factura.cliente.DOM, |
131 | FACAUT: 0, | 132 | FACAUT: 0, |
132 | DTO: 0, | 133 | DTO: 0, |
133 | FEC: $filter('date')($scope.now, 'yyyy-MM-dd HH:mm:ss'), | 134 | FEC: $filter('date')($scope.now, 'yyyy-MM-dd HH:mm:ss'), |
134 | FEC_ANT: '19000101', | 135 | FEC_ANT: '19000101', |
135 | FPA: 2, | 136 | FPA: 0, // 0 <- Múltiple formas de pago, 2 cta corriente |
136 | IDEXCEPCION: 0, | 137 | IDEXCEPCION: 0, |
137 | IDLP: $scope.factura.cliente.mod.trim() || 0, | 138 | IDLP: $scope.factura.cliente.mod.trim() || 0, |
138 | IDPERSONERIA: 0, | 139 | IDPERSONERIA: 0, |
139 | IMI: 0, // TODO | 140 | IMI: 0, // TODO |
140 | IMI2: 0, // TODO | 141 | IMI2: 0, // TODO |
141 | IMI3: 0, // TODO | 142 | IMI3: 0, // TODO |
142 | IMP_LEY: 0, | 143 | IMP_LEY: 0, |
143 | IRI: 0, // TODO | 144 | IRI: 0, // TODO |
144 | IRS: 0, | 145 | IRS: 0, |
145 | LEG: '', | 146 | LEG: '', |
146 | LUG: $scope.factura.vendedor.LugVen, | 147 | LUG: $scope.factura.vendedor.LugVen, |
147 | MK_M: 0, | 148 | MK_M: 0, |
148 | NEE: 0, // TODO | 149 | NEE: 0, // TODO |
149 | NET: 0, // TODO | 150 | NET: 0, // TODO |
150 | NFI: '', | 151 | NFI: '', |
151 | NNP: 0, | 152 | NNP: 0, |
152 | NOM: $scope.factura.cliente.nom, | 153 | NOM: $scope.factura.cliente.nom, |
153 | OPE: $scope.factura.vendedor.CodVen, | 154 | OPE: $scope.factura.vendedor.CodVen, |
154 | PAG: $scope.getTotal(), | 155 | PAG: $scope.getTotal(), |
155 | PER: 0, | 156 | PER: 0, |
156 | PER_IVA: 0, | 157 | PER_IVA: 0, |
157 | PLA: $scope.factura.vendedor.NplVen, | 158 | PLA: $scope.factura.vendedor.NplVen, |
158 | PRO: '', | 159 | PRO: '', |
159 | REC_ANT: 0, | 160 | REC_ANT: 0, |
160 | SUC: parseInt($scope.puntoVenta), | 161 | SUC: parseInt($scope.puntoVenta), |
161 | TCA: 1, | 162 | TCA: 1, |
162 | TCO: 'FT', | 163 | TCO: 'FT', |
163 | TFI: '', | 164 | TFI: '', |
164 | TIP: $scope.factura.cliente.tipoFactura, | 165 | TIP: $scope.factura.cliente.tipoFactura, |
165 | TIV: 0, // TODO | 166 | TIV: 0, // TODO |
166 | TOT: $scope.getTotal(), | 167 | TOT: $scope.getTotal(), |
167 | TUR: 0, // TODO | 168 | TUR: 0, // TODO |
168 | VEN: $scope.factura.vendedor.CodVen, | 169 | VEN: $scope.factura.vendedor.CodVen, |
169 | VTO_CLI: '', | 170 | VTO_CLI: '', |
170 | ZON: 1, // TODO | 171 | ZON: 1, // TODO |
171 | OBSERVACIONES: $scope.factura.observaciones | 172 | OBSERVACIONES: $scope.factura.observaciones |
172 | }, | 173 | }, |
173 | cuerpo: $scope.articulosFiltro() | 174 | cuerpo: $scope.articulosFiltro(), |
175 | despachos: $scope.factura.despachos | ||
174 | }; | 176 | }; |
175 | 177 | ||
176 | crearFacturaService.guardarFactura(save).then(function(res) { | 178 | crearFacturaService.guardarFactura(save).then(function(res) { |
177 | 179 | ||
178 | focaBotoneraLateralService.endGuardar(true); | 180 | focaBotoneraLateralService.endGuardar(true); |
179 | 181 | ||
180 | focaModalService.alert('Comprobante guardado con éxito'); | 182 | focaModalService.alert('Comprobante guardado con éxito'); |
181 | 183 | ||
182 | config(); | 184 | config(); |
183 | 185 | ||
184 | }).catch(function(err) { | 186 | }).catch(function(err) { |
185 | focaModalService.alert('Hubo un error al guardar la factura'); | 187 | focaModalService.alert('Hubo un error al guardar la factura'); |
186 | console.log(err); | 188 | console.log(err); |
187 | }); | 189 | }); |
188 | 190 | ||
189 | }; | 191 | }; |
190 | 192 | ||
191 | $scope.seleccionarCliente = function () { | 193 | $scope.seleccionarCliente = function () { |
192 | 194 | ||
193 | var modalInstance = $uibModal.open( | 195 | var modalInstance = $uibModal.open( |
194 | { | 196 | { |
195 | ariaLabelledBy: 'Busqueda de Cliente', | 197 | ariaLabelledBy: 'Busqueda de Cliente', |
196 | templateUrl: 'foca-busqueda-cliente-modal.html', | 198 | templateUrl: 'foca-busqueda-cliente-modal.html', |
197 | controller: 'focaBusquedaClienteModalController', | 199 | controller: 'focaBusquedaClienteModalController', |
198 | resolve: { | 200 | resolve: { |
199 | vendedor: function () { return null; }, | 201 | vendedor: function () { return null; }, |
200 | cobrador: function () { return null; } | 202 | cobrador: function () { return null; } |
201 | }, | 203 | }, |
202 | size: 'lg' | 204 | size: 'lg' |
203 | } | 205 | } |
204 | ); | 206 | ); |
205 | modalInstance.result.then( | 207 | modalInstance.result.then( |
206 | function (cliente) { | 208 | function (cliente) { |
207 | $scope.factura.cliente = cliente; | 209 | $scope.factura.cliente = cliente; |
208 | 210 | ||
209 | $scope.$broadcast('addCabecera', { | 211 | $scope.$broadcast('addCabecera', { |
210 | label: 'Cliente:', | 212 | label: 'Cliente:', |
211 | valor: $filter('rellenarDigitos')(cliente.cod, 3) + ' - ' + cliente.nom | 213 | valor: $filter('rellenarDigitos')(cliente.cod, 3) + ' - ' + cliente.nom |
212 | }); | 214 | }); |
213 | 215 | ||
214 | $filter('filter')($scope.botonera, { label: 'Cliente' })[0].checked = true; | 216 | $filter('filter')($scope.botonera, { label: 'Cliente' })[0].checked = true; |
215 | 217 | ||
216 | }, function () { | 218 | }, function () { |
217 | } | 219 | } |
218 | ); | 220 | ); |
219 | 221 | ||
220 | }; | 222 | }; |
221 | 223 | ||
222 | $scope.seleccionarVendedor = function() { | 224 | $scope.seleccionarVendedor = function() { |
223 | var parametrosModal = { | 225 | var parametrosModal = { |
224 | titulo: 'Búsqueda vendedores', | 226 | titulo: 'Búsqueda vendedores', |
225 | query: '/vendedor-playa', | 227 | query: '/vendedor-playa', |
226 | columnas: [ | 228 | columnas: [ |
227 | { | 229 | { |
228 | propiedad: 'CodVen', | 230 | propiedad: 'CodVen', |
229 | nombre: 'Código', | 231 | nombre: 'Código', |
230 | filtro: { | 232 | filtro: { |
231 | nombre: 'rellenarDigitos', | 233 | nombre: 'rellenarDigitos', |
232 | parametro: 3 | 234 | parametro: 3 |
233 | } | 235 | } |
234 | }, | 236 | }, |
235 | { | 237 | { |
236 | propiedad: 'NomVen', | 238 | propiedad: 'NomVen', |
237 | nombre: 'Nombre' | 239 | nombre: 'Nombre' |
238 | } | 240 | } |
239 | ], | 241 | ], |
240 | size: 'md' | 242 | size: 'md' |
241 | }; | 243 | }; |
242 | focaModalService.modal(parametrosModal).then( | 244 | focaModalService.modal(parametrosModal).then( |
243 | function (vendedor) { | 245 | function (vendedor) { |
244 | 246 | ||
245 | indicarPassword(vendedor) | 247 | indicarPassword(vendedor) |
246 | .then(function() { | 248 | .then(function() { |
247 | validarPlanillaVendedor(vendedor) | 249 | validarPlanillaVendedor(vendedor) |
248 | .then(function() { | 250 | .then(function() { |
249 | 251 | ||
250 | $filter('filter')($scope.botonera, { | 252 | $filter('filter')($scope.botonera, { |
251 | label: 'Vendedor' | 253 | label: 'Vendedor' |
252 | })[0].checked = true; | 254 | })[0].checked = true; |
253 | 255 | ||
254 | $scope.$broadcast('addCabecera', { | 256 | $scope.$broadcast('addCabecera', { |
255 | label: 'Vendedor:', | 257 | label: 'Vendedor:', |
256 | valor: $filter('rellenarDigitos')(vendedor.CodVen, 3) + | 258 | valor: $filter('rellenarDigitos')(vendedor.CodVen, 3) + |
257 | ' - ' + | 259 | ' - ' + |
258 | vendedor.NomVen | 260 | vendedor.NomVen |
259 | }); | 261 | }); |
260 | 262 | ||
261 | $scope.factura.vendedor = vendedor; | 263 | $scope.factura.vendedor = vendedor; |
262 | 264 | ||
263 | getProductosByPlanilla(vendedor.NplVen); | 265 | getProductosByPlanilla(vendedor.NplVen); |
264 | }) | 266 | }) |
265 | .catch($scope.seleccionarVendedor); | 267 | .catch($scope.seleccionarVendedor); |
266 | }) | 268 | }) |
267 | .catch(function(err) { | 269 | .catch(function(err) { |
268 | console.log(err) | 270 | console.log(err) |
269 | }); | 271 | }); |
270 | 272 | ||
271 | }, function () { } | 273 | }, function () { } |
272 | ); | 274 | ); |
273 | }; | 275 | }; |
274 | 276 | ||
275 | $scope.seleccionarMoneda = function () { | 277 | $scope.seleccionarMoneda = function () { |
276 | 278 | ||
277 | var parametrosModal = { | 279 | var parametrosModal = { |
278 | titulo: 'Búsqueda de monedas', | 280 | titulo: 'Búsqueda de monedas', |
279 | query: '/moneda', | 281 | query: '/moneda', |
280 | columnas: [ | 282 | columnas: [ |
281 | { | 283 | { |
282 | propiedad: 'DETALLE', | 284 | propiedad: 'DETALLE', |
283 | nombre: 'Nombre' | 285 | nombre: 'Nombre' |
284 | }, | 286 | }, |
285 | { | 287 | { |
286 | propiedad: 'SIMBOLO', | 288 | propiedad: 'SIMBOLO', |
287 | nombre: 'Símbolo' | 289 | nombre: 'Símbolo' |
288 | } | 290 | } |
289 | ], | 291 | ], |
290 | size: 'md' | 292 | size: 'md' |
291 | }; | 293 | }; |
292 | focaModalService.modal(parametrosModal).then( | 294 | focaModalService.modal(parametrosModal).then( |
293 | function (moneda) { | 295 | function (moneda) { |
294 | 296 | ||
295 | if (moneda.ID !== 1) { | 297 | if (moneda.ID !== 1) { |
296 | $scope.abrirModalCotizacion(moneda); | 298 | $scope.abrirModalCotizacion(moneda); |
297 | return; | 299 | return; |
298 | } | 300 | } |
299 | 301 | ||
300 | crearRemitoService.getCotizacionByIdMoneda(1) | 302 | crearRemitoService.getCotizacionByIdMoneda(1) |
301 | .then(function (res) { | 303 | .then(function (res) { |
302 | 304 | ||
303 | cotizacionPArgentino = res.data[0].cotizaciones[0]; | 305 | cotizacionPArgentino = res.data[0].cotizaciones[0]; |
304 | cotizacionPArgentino.moneda = moneda; | 306 | cotizacionPArgentino.moneda = moneda; |
305 | 307 | ||
306 | actualizarCabeceraMoneda(cotizacionPArgentino); | 308 | actualizarCabeceraMoneda(cotizacionPArgentino); |
307 | 309 | ||
308 | $scope.remito.cotizacion = cotizacionPArgentino; | 310 | $scope.remito.cotizacion = cotizacionPArgentino; |
309 | }); | 311 | }); |
310 | }, function () { | 312 | }, function () { |
311 | 313 | ||
312 | } | 314 | } |
313 | ); | 315 | ); |
314 | }; | 316 | }; |
315 | 317 | ||
316 | $scope.abrirModalCotizacion = function (moneda) { | 318 | $scope.abrirModalCotizacion = function (moneda) { |
317 | var modalInstance = $uibModal.open( | 319 | var modalInstance = $uibModal.open( |
318 | { | 320 | { |
319 | ariaLabelledBy: 'Busqueda de Cotización', | 321 | ariaLabelledBy: 'Busqueda de Cotización', |
320 | templateUrl: 'modal-cotizacion.html', | 322 | templateUrl: 'modal-cotizacion.html', |
321 | controller: 'focaModalCotizacionController', | 323 | controller: 'focaModalCotizacionController', |
322 | size: 'lg', | 324 | size: 'lg', |
323 | resolve: { idMoneda: function () { return moneda.ID; } } | 325 | resolve: { idMoneda: function () { return moneda.ID; } } |
324 | } | 326 | } |
325 | ); | 327 | ); |
326 | modalInstance.result.then( | 328 | modalInstance.result.then( |
327 | function (cotizacion) { | 329 | function (cotizacion) { |
328 | 330 | ||
329 | cotizacion.moneda = moneda; | 331 | cotizacion.moneda = moneda; |
330 | actualizarCabeceraMoneda(cotizacion); | 332 | actualizarCabeceraMoneda(cotizacion); |
331 | $scope.factura.cotizacion = cotizacion; | 333 | $scope.factura.cotizacion = cotizacion; |
332 | 334 | ||
333 | }, function () { | 335 | }, function () { |
334 | 336 | ||
335 | } | 337 | } |
336 | ); | 338 | ); |
337 | }; | 339 | }; |
338 | 340 | ||
339 | $scope.seleccionarObservaciones = function () { | 341 | $scope.seleccionarObservaciones = function () { |
340 | var observacion = { | 342 | var observacion = { |
341 | titulo: 'Ingrese Observaciones', | 343 | titulo: 'Ingrese Observaciones', |
342 | value: $scope.factura.observaciones, | 344 | value: $scope.factura.observaciones, |
343 | maxlength: 155, | 345 | maxlength: 155, |
344 | textarea: true | 346 | textarea: true |
345 | }; | 347 | }; |
346 | 348 | ||
347 | focaModalService | 349 | focaModalService |
348 | .prompt(observacion) | 350 | .prompt(observacion) |
349 | .then(function (observaciones) { | 351 | .then(function (observaciones) { |
350 | $scope.factura.observaciones = observaciones; | 352 | $scope.factura.observaciones = observaciones; |
351 | }); | 353 | }); |
352 | }; | 354 | }; |
353 | 355 | ||
354 | |||
355 | $scope.articulosFiltro = function () { | 356 | $scope.articulosFiltro = function () { |
356 | return $scope.factura.articulosFactura; | 357 | return $scope.factura.articulosFactura; |
357 | }; | 358 | }; |
358 | 359 | ||
359 | $scope.getTotal = function () { | 360 | $scope.getTotal = function () { |
360 | 361 | ||
361 | var total = 0; | 362 | var total = 0; |
362 | 363 | ||
363 | $scope.articulosFiltro().forEach(function (articulo) { | 364 | $scope.articulosFiltro().forEach(function (articulo) { |
364 | total += articulo.PUN * articulo.CAN; | 365 | total += articulo.PUN * articulo.CAN; |
365 | }); | 366 | }); |
366 | 367 | ||
367 | return parseFloat(total.toFixed(2)); | 368 | return parseFloat(total.toFixed(2)); |
368 | }; | 369 | }; |
369 | 370 | ||
370 | function getProductosByPlanilla(numeroPlanilla) { | 371 | function getProductosByPlanilla(numeroPlanilla) { |
371 | 372 | ||
372 | crearFacturaService.getProductosByPlanilla(numeroPlanilla).then(function(res) { | 373 | crearFacturaService.getProductosByPlanilla(numeroPlanilla).then(function(res) { |
373 | 374 | ||
374 | res.data.forEach(function (producto) { | 375 | res.data.forEach(function (producto) { |
375 | 376 | ||
376 | $scope.botonera.push({ | 377 | $scope.botonera.push({ |
377 | label: producto.DetArt, | 378 | label: producto.DetArt, |
378 | image: 'productos.png' | 379 | image: 'productos.png' |
379 | }); | 380 | }); |
380 | 381 | ||
381 | 382 | ||
382 | crearFuncionesProductos(producto); | 383 | crearFuncionesProductos(producto); |
383 | 384 | ||
384 | }); | 385 | }); |
385 | }); | 386 | }); |
386 | } | 387 | } |
387 | 388 | ||
388 | function crearFuncionesProductos(producto) { | 389 | function crearFuncionesProductos(producto) { |
389 | 390 | ||
390 | $scope[nombreFuncion(producto.DetArt)] = function() { | 391 | $scope[nombreFuncion(producto.DetArt)] = function() { |
391 | 392 | ||
392 | if (angular.equals($scope.factura.cliente, {})) { | 393 | if (angular.equals($scope.factura.cliente, {})) { |
393 | focaModalService.alert('Seleccione cliente'); | 394 | focaModalService.alert('Seleccione cliente'); |
394 | return; | 395 | return; |
395 | } | 396 | } |
396 | 397 | ||
397 | var parametrosModal = { | 398 | var modalInstance = $uibModal.open( |
398 | titulo: 'Despachos ' + producto.DetArt, | 399 | { |
399 | data: producto.despachos, | 400 | templateUrl: 'modal-combustibles.html', |
400 | columnas: [ | 401 | controller: 'focaModalCombustiblesController', |
401 | { | 402 | resolve: { |
402 | propiedad: 'FEC', | 403 | parametros: function() { |
403 | nombre: 'Fecha', | 404 | return { |
404 | filtro: { | 405 | despachos: producto.despachos, |
405 | nombre: 'date', | 406 | nombreProducto: producto.DetArt |
406 | parametro: 'dd/MM/yyyy HH:mm' | 407 | } |
407 | } | 408 | } |
408 | }, | 409 | }, |
409 | { | 410 | size: 'lg' |
410 | propiedad: 'IMP', | 411 | } |
411 | nombre: 'Importe' | 412 | ); |
412 | }, | ||
413 | { | ||
414 | propiedad: 'LTS', | ||
415 | nombre: 'Litros' | ||
416 | } | ||
417 | ], | ||
418 | size: 'md' | ||
419 | }; | ||
420 | 413 | ||
421 | focaModalService.modal(parametrosModal).then(function(despacho) { | 414 | modalInstance.result.then(function(despacho) { |
422 | 415 | ||
423 | var articulo = { | 416 | var articulo = { |
424 | TIP: $scope.factura.cliente.tipoFactura, | 417 | TIP: $scope.factura.cliente.tipoFactura, |
425 | TCO: 'FT', | 418 | TCO: 'FT', |
426 | SUC: parseInt($scope.puntoVenta), | 419 | SUC: parseInt($scope.puntoVenta), |
427 | ORD: $scope.articulosFiltro().length + 1, | 420 | ORD: $scope.articulosFiltro().length + 1, |
428 | SEC: despacho.SEC, | 421 | SEC: despacho.SEC, |
429 | ART: despacho.PRO, | 422 | ART: despacho.PRO, |
430 | RUB: producto.CodRub, | 423 | RUB: producto.CodRub, |
431 | DES: producto.DetArt, | 424 | DES: producto.DetArt, |
432 | CAN: despacho.LTS, | 425 | CAN: despacho.LTS, |
433 | PUN: producto.PreVen, // TODO | 426 | PUN: producto.PreVen, // TODO |
434 | IVA: producto.IMPIVA, // TODO | 427 | IVA: producto.IMPIVA, // TODO |
435 | NET: 0, // TODO | 428 | NET: 0, // TODO |
436 | NEX: 0, // TODO | 429 | NEX: 0, // TODO |
437 | IMI: producto.ImpInt, // TODO | 430 | IMI: producto.ImpInt, // TODO |
438 | IMI2: producto.ImpInt2, // TODO | 431 | IMI2: producto.ImpInt2, // TODO |
439 | IMI3: producto.ImpInt3, // TODO | 432 | IMI3: producto.ImpInt3, // TODO |
440 | PUT: producto.PreNet, // TODO | 433 | PUT: producto.PreNet, // TODO |
441 | SUR: despacho.SUR, | 434 | SUR: despacho.SUR, |
442 | PLA: despacho.PLA, | 435 | PLA: despacho.PLA, |
443 | LUG: despacho.LUG, | 436 | LUG: despacho.LUG, |
444 | LEG: $scope.factura.vendedor.CodVen, | 437 | LEG: $scope.factura.vendedor.CodVen, |
445 | TUR: $scope.factura.vendedor.TurVen, | 438 | TUR: $scope.factura.vendedor.TurVen, |
446 | ORDEN_PRECOMPRA: '', | 439 | ORDEN_PRECOMPRA: '', |
447 | ESC: producto.tipoFactura == 'L' ? 1 : 0, | 440 | ESC: producto.tipoFactura == 'L' ? 1 : 0, |
448 | CMF: 0, | 441 | CMF: 0, |
449 | PTA: 0, | 442 | PTA: 0, |
450 | IVS: 0, | 443 | IVS: 0, |
451 | TIVA: 0, | 444 | TIVA: 0, |
452 | CON: 0, | 445 | CON: 0, |
453 | SINO: '', | 446 | SINO: '', |
454 | ORD_TRA: 0, | 447 | ORD_TRA: 0, |
455 | IMP_DESP: 0, | 448 | IMP_DESP: 0, |
456 | PCD: 0, | 449 | PCD: 0, |
457 | RTO: '' | 450 | RTO: '' |
458 | }; | 451 | }; |
459 | 452 | ||
460 | $scope.factura.articulosFactura.push(articulo); | 453 | crearFacturaService.setearDespachoOcupado({ |
454 | surtidor: despacho.SUR, | ||
455 | producto: despacho.PRO, | ||
456 | carga: despacho.CAR | ||
457 | }) | ||
458 | .then(function () { | ||
459 | $scope.factura.articulosFactura.push(articulo); | ||
460 | $scope.factura.despachos.push(despacho); | ||
461 | }) | ||
462 | .catch(function (err) { | ||
463 | |||
464 | focaModalService.alert('El despacho esta en uso'); | ||
465 | }); | ||
466 | |||
461 | }) | 467 | }) |
462 | .catch(function (err) { | 468 | .catch(function (err) { |
463 | console.log(err) | 469 | console.log(err); |
464 | }); | 470 | }); |
465 | 471 | ||
466 | }; | 472 | }; |
467 | } | 473 | } |
468 | 474 | ||
469 | function nombreFuncion(string) { | 475 | function nombreFuncion(string) { |
470 | var texto = 'seleccionar'; | 476 | var texto = 'seleccionar'; |
471 | var arr = string.split(' '); | 477 | var arr = string.split(' '); |
472 | arr.forEach(function(palabra) { | 478 | arr.forEach(function(palabra) { |
473 | palabra = palabra.charAt(0).toUpperCase() + palabra.slice(1); | 479 | palabra = palabra.charAt(0).toUpperCase() + palabra.slice(1); |
474 | texto += palabra; | 480 | texto += palabra; |
475 | }); | 481 | }); |
476 | return texto; | 482 | return texto; |
477 | } | 483 | } |
478 | 484 | ||
479 | function indicarPassword(vendedor) { | 485 | function indicarPassword(vendedor) { |
480 | 486 | ||
481 | return new Promise(function(resolve, reject) { | 487 | return new Promise(function(resolve, reject) { |
482 | 488 | ||
483 | focaModalService | 489 | focaModalService |
484 | .prompt({ | 490 | .prompt({ |
485 | titulo: 'Indique Contraseña', | 491 | titulo: 'Indique Contraseña', |
486 | value: '' | 492 | value: '' |
487 | }) | 493 | }) |
488 | .then(function (contraseña) { | 494 | .then(function (contraseña) { |
489 | 495 | ||
490 | if (contraseña != vendedor.ClaVen.trim()) { | 496 | if (contraseña != vendedor.ClaVen.trim()) { |
491 | 497 | ||
492 | focaModalService.alert('Clave incorrecta').then(function() { | 498 | focaModalService.alert('Clave incorrecta').then(function() { |
493 | indicarPassword(vendedor); | 499 | indicarPassword(vendedor); |
494 | }); | 500 | }); |
495 | } else { | 501 | } else { |
496 | resolve(); | 502 | resolve(); |
497 | } | 503 | } |
498 | }) | 504 | }) |
499 | .catch(reject); | 505 | .catch(reject); |
500 | }); | 506 | }); |
501 | } | 507 | } |
502 | 508 | ||
503 | function validarPlanillaVendedor(vendedor) { | 509 | function validarPlanillaVendedor(vendedor) { |
504 | 510 | ||
505 | return new Promise(function(resolve, reject) { | 511 | return new Promise(function(resolve, reject) { |
506 | 512 | ||
507 | crearFacturaService | 513 | crearFacturaService |
508 | .validarPlanillaVendedor(vendedor.CodVen.trim()) | 514 | .validarPlanillaVendedor(vendedor.CodVen.trim()) |
509 | .then(function (res) { | 515 | .then(function (res) { |
510 | 516 | ||
511 | if (!res.data.length) { | 517 | if (!res.data.length) { |
512 | 518 | ||
513 | focaModalService | 519 | focaModalService |
514 | .alert('No se encontró planilla abierta para el vendedor') | 520 | .alert('No se encontró planilla abierta para el vendedor') |
515 | .then(reject); | 521 | .then(reject); |
516 | 522 | ||
517 | } else { | 523 | } else { |
518 | resolve(); | 524 | resolve(); |
519 | } | 525 | } |
520 | 526 | ||
521 | }) | 527 | }) |
522 | .catch(reject); | 528 | .catch(reject); |
523 | }); | 529 | }); |
524 | } | 530 | } |
525 | 531 | ||
526 | function rellenar(relleno, longitud) { | 532 | function rellenar(relleno, longitud) { |
527 | relleno = '' + relleno; | 533 | relleno = '' + relleno; |
528 | while (relleno.length < longitud) { | 534 | while (relleno.length < longitud) { |
529 | relleno = '0' + relleno; | 535 | relleno = '0' + relleno; |
530 | } | 536 | } |
531 | return relleno; | 537 | return relleno; |
532 | } | 538 | } |
533 | 539 | ||
534 | function salir() { | 540 | function salir() { |
535 | var confirmacion = false; | 541 | var confirmacion = false; |
536 | 542 | ||
537 | if (!angular.equals($scope.factura, $scope.inicial)) { | 543 | if (!angular.equals($scope.factura, $scope.inicial)) { |
538 | confirmacion = true; | 544 | confirmacion = true; |
539 | } | 545 | } |
540 | 546 | ||
541 | if (confirmacion) { | 547 | if (confirmacion) { |
542 | focaModalService.confirm( | 548 | focaModalService.confirm( |
543 | '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' | 549 | '¿Está seguro de que desea salir? Se perderán todos los datos cargados.' |
544 | ).then(function (data) { | 550 | ).then(function (data) { |
545 | if (data) { | 551 | if (data) { |
546 | $location.path('/'); | 552 | $location.path('/'); |
547 | } | 553 | } |
548 | }); | 554 | }); |
549 | } else { | 555 | } else { |
550 | $location.path('/'); | 556 | $location.path('/'); |
551 | } | 557 | } |
552 | } | 558 | } |
553 | 559 | ||
554 | function setearFactura(factura) { | 560 | function setearFactura(factura) { |
555 | 561 | ||
556 | $scope.$broadcast('cleanCabecera'); | 562 | $scope.$broadcast('cleanCabecera'); |
557 | 563 | ||
558 | $scope.cabeceras = []; | 564 | $scope.cabeceras = []; |
559 | 565 | ||
560 | if (factura.cotizacion && factura.cotizacion.moneda.CODIGO_AFIP !== 'PES') { | 566 | if (factura.cotizacion && factura.cotizacion.moneda.CODIGO_AFIP !== 'PES') { |
561 | $scope.cabeceras.push({ | 567 | $scope.cabeceras.push({ |
562 | label: 'Moneda:', | 568 | label: 'Moneda:', |
563 | valor: factura.cotizacion.moneda.DETALLE | 569 | valor: factura.cotizacion.moneda.DETALLE |
564 | }); | 570 | }); |
565 | $scope.cabeceras.push({ | 571 | $scope.cabeceras.push({ |
566 | label: 'Fecha cotizacion:', | 572 | label: 'Fecha cotizacion:', |
567 | valor: $filter('date')(factura.cotizacion.FECHA, | 573 | valor: $filter('date')(factura.cotizacion.FECHA, |
568 | 'dd/MM/yyyy') | 574 | 'dd/MM/yyyy') |
569 | }); | 575 | }); |
570 | $scope.cabeceras.push({ | 576 | $scope.cabeceras.push({ |
571 | label: 'Cotizacion:', | 577 | label: 'Cotizacion:', |
572 | valor: $filter('number')(factura.cotizacion.VENDEDOR, | 578 | valor: $filter('number')(factura.cotizacion.VENDEDOR, |
573 | '2') | 579 | '2') |
574 | }); | 580 | }); |
575 | } | 581 | } |
576 | 582 | ||
577 | if (factura.cotizacion && factura.cotizacion.moneda) { | 583 | if (factura.cotizacion && factura.cotizacion.moneda) { |
578 | $filter('filter')($scope.botonera, { label: 'Moneda' })[0].checked = true; | 584 | $filter('filter')($scope.botonera, { label: 'Moneda' })[0].checked = true; |
579 | } | 585 | } |
580 | 586 | ||
581 | if (factura.cliente && factura.cliente.cod) { | 587 | if (factura.cliente && factura.cliente.cod) { |
582 | $scope.cabeceras.push({ | 588 | $scope.cabeceras.push({ |
583 | label: 'Cliente:', | 589 | label: 'Cliente:', |
584 | valor: $filter('rellenarDigitos')(factura.cliente.cod, 3) + ' - ' + | 590 | valor: $filter('rellenarDigitos')(factura.cliente.cod, 3) + ' - ' + |
585 | factura.cliente.nom | 591 | factura.cliente.nom |
586 | }); | 592 | }); |
587 | 593 | ||
588 | $filter('filter')($scope.botonera, { label: 'Cliente' })[0].checked = true; | 594 | $filter('filter')($scope.botonera, { label: 'Cliente' })[0].checked = true; |
589 | } | 595 | } |
590 | 596 | ||
591 | $scope.puntoVenta = rellenar(factura.sucursal, 4); | 597 | $scope.puntoVenta = rellenar(factura.sucursal, 4); |
592 | $scope.comprobante = rellenar(factura.numerofactura, 8); | 598 | $scope.comprobante = rellenar(factura.numerofactura, 8); |
593 | $scope.factura = factura; | 599 | $scope.factura = factura; |
594 | 600 | ||
595 | addArrayCabecera($scope.cabeceras); | 601 | addArrayCabecera($scope.cabeceras); |
596 | } | 602 | } |
597 | 603 | ||
598 | function getLSFactura() { | 604 | function getLSFactura() { |
599 | var factura = JSON.parse($localStorage.factura || null); | 605 | var factura = JSON.parse($localStorage.factura || null); |
600 | if (factura) { | 606 | if (factura) { |
601 | setearFactura(factura); | 607 | setearFactura(factura); |
602 | delete $localStorage.factura; | 608 | delete $localStorage.factura; |
603 | } | 609 | } |
604 | } | 610 | } |
605 | 611 | ||
606 | function addArrayCabecera(array) { | 612 | function addArrayCabecera(array) { |
607 | for (var i = 0; i < array.length; i++) { | 613 | for (var i = 0; i < array.length; i++) { |
608 | $scope.$broadcast('addCabecera', { | 614 | $scope.$broadcast('addCabecera', { |
609 | label: array[i].label, | 615 | label: array[i].label, |
610 | valor: array[i].valor | 616 | valor: array[i].valor |
611 | }); | 617 | }); |
612 | } | 618 | } |
613 | } | 619 | } |
614 | 620 | ||
615 | function actualizarCabeceraMoneda(cotizacion) { | 621 | function actualizarCabeceraMoneda(cotizacion) { |
616 | 622 | ||
617 | $scope.factura.articulosFactura.forEach(function (art) { | 623 | $scope.factura.articulosFactura.forEach(function (art) { |
618 | art.PUN = (art.PUN * $scope.factura.cotizacion.VENDEDOR).toFixed(4); | 624 | art.PUN = (art.PUN * $scope.factura.cotizacion.VENDEDOR).toFixed(4); |
619 | art.PUN = (art.PUN / cotizacion.VENDEDOR).toFixed(4); | 625 | art.PUN = (art.PUN / cotizacion.VENDEDOR).toFixed(4); |
620 | }); | 626 | }); |
621 | 627 | ||
622 | if (cotizacion.moneda.DETALLE === 'PESOS ARGENTINOS') { | 628 | if (cotizacion.moneda.DETALLE === 'PESOS ARGENTINOS') { |
623 | $scope.$broadcast('removeCabecera', 'Moneda:'); | 629 | $scope.$broadcast('removeCabecera', 'Moneda:'); |
624 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); | 630 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); |
625 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); | 631 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); |
626 | } else { | 632 | } else { |
627 | $scope.$broadcast('addCabecera', { | 633 | $scope.$broadcast('addCabecera', { |
628 | label: 'Moneda:', | 634 | label: 'Moneda:', |
629 | valor: cotizacion.moneda.DETALLE | 635 | valor: cotizacion.moneda.DETALLE |
630 | }); | 636 | }); |
631 | $scope.$broadcast('addCabecera', { | 637 | $scope.$broadcast('addCabecera', { |
632 | label: 'Fecha cotizacion:', | 638 | label: 'Fecha cotizacion:', |
633 | valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') | 639 | valor: $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') |
634 | }); | 640 | }); |
635 | $scope.$broadcast('addCabecera', { | 641 | $scope.$broadcast('addCabecera', { |
636 | label: 'Cotizacion:', | 642 | label: 'Cotizacion:', |
637 | valor: $filter('number')(cotizacion.VENDEDOR, '2') | 643 | valor: $filter('number')(cotizacion.VENDEDOR, '2') |
638 | }); | 644 | }); |
639 | } | 645 | } |
640 | } | 646 | } |
641 | 647 | ||
642 | function validarGuardar() { | 648 | function validarGuardar() { |
643 | 649 | ||
644 | if (angular.equals({}, $scope.factura.vendedor)) { | 650 | if (angular.equals({}, $scope.factura.vendedor)) { |
645 | 651 | ||
646 | focaModalService.alert('Seleccione Vendedor'); | 652 | focaModalService.alert('Seleccione Vendedor'); |
647 | return false; | 653 | return false; |
648 | } else if (angular.equals({}, $scope.factura.cliente)) { | 654 | } else if (angular.equals({}, $scope.factura.cliente)) { |
649 | 655 | ||
650 | focaModalService.alert('Seleccione Cliente') | 656 | focaModalService.alert('Seleccione Cliente') |
651 | return false; | 657 | return false; |
652 | } else if (!$scope.articulosFiltro().length) { | 658 | } else if (!$scope.articulosFiltro().length) { |
653 | 659 |
src/js/controllerCombustibles.js
File was created | 1 | angular.module('focaCrearFactura') | |
2 | .controller('focaModalCombustiblesController', [ | ||
3 | '$filter', | ||
4 | '$scope', | ||
5 | '$uibModalInstance', | ||
6 | 'parametros', | ||
7 | function($filter, $scope, $uibModalInstance, parametros) { | ||
8 | |||
9 | $scope.mangueras = []; | ||
10 | |||
11 | var productosByMangera = []; | ||
12 | |||
13 | parametros.despachos.forEach(function (despacho) { | ||
14 | |||
15 | var findCsu = productosByMangera.filter(function (csu) { | ||
16 | return csu.csu == despacho.CSU.trim(); | ||
17 | })[0]; | ||
18 | |||
19 | if (!findCsu) { | ||
20 | |||
21 | var mangera = { | ||
22 | csu: despacho.CSU.trim(), | ||
23 | despachos: [despacho] | ||
24 | }; | ||
25 | |||
26 | productosByMangera.unshift(mangera); | ||
27 | } else { | ||
28 | findCsu.despachos.push(despacho); | ||
29 | } | ||
30 | }); | ||
31 | |||
32 | $scope.mangueras = productosByMangera; | ||
33 | |||
34 | $scope.aceptar = function (despacho) { | ||
35 | $uibModalInstance.close(despacho); | ||
36 | }; | ||
37 | |||
38 | $scope.cancel = function () { | ||
39 | $uibModalInstance.dismiss('cancel'); | ||
40 | }; | ||
41 | } | ||
42 | ]); | ||
43 |
src/js/service.js
1 | angular.module('focaCrearFactura') | 1 | angular.module('focaCrearFactura') |
2 | .service('crearFacturaService', ['$http', 'API_ENDPOINT', | 2 | .service('crearFacturaService', ['$http', 'API_ENDPOINT', |
3 | function($http, API_ENDPOINT) { | 3 | function($http, API_ENDPOINT) { |
4 | var route = API_ENDPOINT.URL; | 4 | var route = API_ENDPOINT.URL; |
5 | return { | 5 | return { |
6 | guardarFactura: function (factura) { | 6 | guardarFactura: function (factura) { |
7 | return $http.post(route + '/factura/guardar', factura) | 7 | return $http.post(route + '/factura/guardar', factura) |
8 | }, | 8 | }, |
9 | getParametros: function() { | 9 | getParametros: function() { |
10 | return $http.get(API_ENDPOINT.URL + '/parametros/factura'); | 10 | return $http.get(API_ENDPOINT.URL + '/parametros/factura'); |
11 | }, | 11 | }, |
12 | validarPlanillaVendedor: function(idVendedor) { | 12 | validarPlanillaVendedor: function(idVendedor) { |
13 | return $http.get(route + '/turnos/validar-planilla/' + idVendedor); | 13 | return $http.get(route + '/turnos/validar-planilla/' + idVendedor); |
14 | }, | 14 | }, |
15 | getProductosByPlanilla: function (numeroPlanilla) { | 15 | getProductosByPlanilla: function (numeroPlanilla) { |
16 | return $http.get(route + '/turnos/productos/' + numeroPlanilla); | 16 | return $http.get(route + '/turnos/productos/' + numeroPlanilla); |
17 | }, | 17 | }, |
18 | setearDespachoOcupado: function (parametros) { | ||
19 | return $http.post(route + '/turnos/despacho-en-uso', parametros); | ||
20 | }, | ||
18 | getBotonera: function() { | 21 | getBotonera: function() { |
19 | return [ | 22 | return [ |
20 | { | 23 | { |
21 | label: 'Vendedor', | 24 | label: 'Vendedor', |
22 | image: 'vendedor.png' | 25 | image: 'vendedor.png' |
23 | }, | 26 | }, |
24 | { | 27 | { |
25 | label: 'Cliente', | 28 | label: 'Cliente', |
26 | image: 'cliente.png' | 29 | image: 'cliente.png' |
27 | }, | 30 | }, |
28 | { | 31 | { |
29 | label: 'Moneda', | 32 | label: 'Moneda', |
30 | image: 'moneda.png' | 33 | image: 'moneda.png' |
31 | }, | 34 | }, |
32 | { | 35 | { |
33 | label: 'Observaciones', | 36 | label: 'Observaciones', |
34 | image: 'botonObservaciones.png' | 37 | image: 'botonObservaciones.png' |
35 | } | 38 | } |
36 | ]; | 39 | ]; |
37 | } | 40 | } |
38 | }; | 41 | }; |
39 | }]); | 42 | }]); |
40 | 43 |
src/views/modal-combustibles.html
File was created | 1 | <div class="modal-header py-1"> | |
2 | <div class="row w-100"> | ||
3 | <div class="col-lg-6"> | ||
4 | <h5 class="modal-title my-1">Despachos Disponibles</h5> | ||
5 | </div> | ||
6 | </div> | ||
7 | </div> | ||
8 | <div class="modal-body" id="modal-body"> | ||
9 | <div ng-repeat="(key, manguera) in mangueras"> | ||
10 | <strong> | ||
11 | Manguera {{manguera.csu}} | ||
12 | </strong> | ||
13 | <button type="button" class="btn" ng-click="manguera.show = !manguera.show"> | ||
14 | <i ng-show="manguera.show" class="fa fa-minus"></i> | ||
15 | <i ng-show="!manguera.show" class="fa fa-plus"></i> | ||
16 | </button> | ||
17 | <table class="table table-sm" ng-show="manguera.show"> | ||
18 | <tbody> | ||
19 | <tr ng-repeat="(key, despacho) in manguera.despachos"> | ||
20 | <td ng-bind="despacho.FEC | date:'dd/MM/yyyy hh:MM:ss'"></td> | ||
21 | <td ng-bind="despacho.LTS"></td> | ||
22 | <td ng-bind="despacho.IMP | currency: '$'"></td> | ||
23 | <td> | ||
24 | <button | ||
25 | type="button" | ||
26 | class="btn btn-xs p-1 float-right" | ||
27 | title="Seleccionar" | ||
28 | ng-click="aceptar(despacho)" | ||
29 | ><i class="fa fa-circle-thin" aria-hidden="true"></i> | ||
30 | </button> | ||
31 | </td> | ||
32 | </tr> | ||
33 | </tbody> | ||
34 | </table> | ||
35 | </div> | ||
36 | |||
37 | </div> | ||
38 | <div class="modal-footer py-1"> | ||
39 | <nav ng-show="currentPageProveedores.length > 0 && primerBusqueda" class="mr-auto"> | ||
40 | <ul class="pagination pagination-sm mb-0"> | ||
41 | <li class="page-item" ng-class="{'disabled': currentPage == 1}"> | ||
42 | <a class="page-link" href="javascript:void();" ng-click="selectPage(currentPage - 1)"> | ||
43 | <span aria-hidden="true">«</span> | ||
44 | <span class="sr-only">Anterior</span> | ||
45 | </a> | ||
46 | </li> | ||
47 | <li | ||
48 | class="page-item" | ||
49 | ng-repeat="pagina in paginas" | ||
50 | ng-class="{'active': pagina == currentPage}" | ||
51 | > | ||
52 | <a | ||
53 | class="page-link" | ||
54 | href="javascript:void();" | ||
55 | ng-click="selectPage(pagina)" | ||
56 | ng-bind="pagina" | ||
57 | ></a> | ||
58 | </li> | ||
59 | <li class="page-item" ng-class="{'disabled': currentPage == lastPage}"> | ||
60 | <a class="page-link" href="javascript:void();" ng-click="selectPage(currentPage + 1)"> | ||
61 | <span aria-hidden="true">»</span> | ||
62 | <span class="sr-only">Siguiente</span> | ||
63 | </a> | ||
64 | </li> | ||
65 | </ul> | ||
66 | </nav> | ||
67 | <button class="btn btn-sm btn-secondary" type="button" ng-click="cancel()">Cancelar</button> | ||
68 | </div> | ||
69 |