Commit 793054655b75e5ebf1c8119e4a8aeec57abb9c17
Exists in
master
and in
1 other branch
Merge branch 'develop' into 'master'
Develop See merge request !137
Showing
4 changed files
Show diff stats
src/js/businessService.js
1 | 1 | angular.module('focaCrearRemito') |
2 | - .factory('remitoBusinessService', [ | |
3 | - 'crearRemitoService', | |
4 | - function(crearRemitoService) { | |
2 | + .factory('remitoBusinessService', ['crearRemitoService', 'focaModalService', | |
3 | + function(crearRemitoService, focaModalService) { | |
5 | 4 | return { |
6 | - addArticulos: function(articulosRemito, idRemito, cotizacion) { | |
5 | + quitarCotizacion: function(articulosRemito, cotizacion) { | |
6 | + | |
7 | 7 | for(var i = 0; i < articulosRemito.length; i++) { |
8 | + | |
8 | 9 | delete articulosRemito[i].editCantidad; |
9 | 10 | delete articulosRemito[i].editPrecio; |
10 | - articulosRemito[i].idRemito = articulosRemito[i].idRemito !== -1 ? | |
11 | - idRemito : articulosRemito[i].idRemito; | |
12 | - articulosRemito[i].precio = articulosRemito[i].precio * cotizacion; | |
13 | 11 | delete articulosRemito[i].idNotaPedido; |
14 | - crearRemitoService.crearArticulosParaRemito(articulosRemito[i]); | |
12 | + | |
13 | + articulosRemito[i].precio = articulosRemito[i].precio * cotizacion; | |
15 | 14 | } |
15 | + | |
16 | + return articulosRemito; | |
17 | + | |
16 | 18 | }, |
17 | - addEstado: function(idRemito, idVendedor) { | |
19 | + addEstado: function(idRemito) { | |
18 | 20 | var date = new Date(); |
19 | 21 | var estado = { |
20 | 22 | idRemito: idRemito, |
21 | 23 | fecha: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) |
22 | - .toISOString().slice(0, 19).replace('T', ' '), | |
24 | + .toISOString().slice(0, 19).replace('T', ' '), | |
23 | 25 | estado: 0, |
24 | - idVendedor: idVendedor | |
26 | + // idVendedor: idVendedor | |
25 | 27 | }; |
26 | 28 | crearRemitoService.crearEstadoParaRemito(estado); |
27 | 29 | }, |
... | ... | @@ -37,18 +39,45 @@ angular.module('focaCrearRemito') |
37 | 39 | } |
38 | 40 | return result.trim(); |
39 | 41 | }, |
40 | - addPuntosDescarga: function(idRemito, puntosDescarga) { | |
42 | + addPuntosDescarga: function(puntosDescarga) { | |
41 | 43 | |
42 | 44 | var puntos = []; |
43 | 45 | |
44 | 46 | puntosDescarga.forEach(function(punto) { |
45 | 47 | puntos.push({ |
46 | 48 | idPuntoDescarga: punto.puntoDescarga.id, |
47 | - idRemito: idRemito, | |
48 | 49 | }); |
49 | 50 | }); |
50 | 51 | |
51 | - return crearRemitoService.crearPuntosDescarga(puntos); | |
52 | + return puntos; | |
53 | + }, | |
54 | + validarRemito: function (remito, articulos) { | |
55 | + | |
56 | + // if (!remito.vendedor.NUM) { | |
57 | + // focaModalService.alert('Ingrese Vendedor'); | |
58 | + // return false; | |
59 | + if (!remito.cliente.COD) { | |
60 | + focaModalService.alert('Ingrese Cliente'); | |
61 | + return false; | |
62 | + } else if (!remito.proveedor.COD) { | |
63 | + focaModalService.alert('Ingrese Proveedor'); | |
64 | + return false; | |
65 | + } else if (!remito.cotizacion.moneda.id && | |
66 | + !remito.cotizacion.moneda.ID) { | |
67 | + focaModalService.alert('Ingrese Moneda'); | |
68 | + return false; | |
69 | + } else if (!remito.cotizacion.ID) { | |
70 | + focaModalService.alert('Ingrese Cotizaciรณn'); | |
71 | + return false; | |
72 | + } else if (remito.flete === undefined || remito.flete === null) { | |
73 | + focaModalService.alert('Ingrese Flete'); | |
74 | + return false; | |
75 | + } else if (articulos.length === 0) { | |
76 | + focaModalService.alert('Debe cargar al menos un articulo'); | |
77 | + return false; | |
78 | + } | |
79 | + | |
80 | + return true; | |
52 | 81 | } |
53 | 82 | }; |
54 | 83 | }]); |
src/js/controller.js
... | ... | @@ -48,7 +48,6 @@ angular.module('focaCrearRemito').controller('remitoController', |
48 | 48 | }); |
49 | 49 | |
50 | 50 | init(); |
51 | - | |
52 | 51 | } |
53 | 52 | |
54 | 53 | function init() { |
... | ... | @@ -56,7 +55,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
56 | 55 | $scope.remito = { |
57 | 56 | id: 0, |
58 | 57 | estado: 0, |
59 | - vendedor: {}, | |
58 | + // vendedor: {}, | |
60 | 59 | cliente: {}, |
61 | 60 | proveedor: {}, |
62 | 61 | domicilio: { dom: '' }, |
... | ... | @@ -91,6 +90,10 @@ angular.module('focaCrearRemito').controller('remitoController', |
91 | 90 | label: 'remito', |
92 | 91 | val: newValue |
93 | 92 | }); |
93 | + focaBotoneraLateralService.setRutasPausadas({ | |
94 | + label: 'rutas', | |
95 | + val: 'venta-remito/crear' | |
96 | + }); | |
94 | 97 | }, true); |
95 | 98 | |
96 | 99 | $scope.seleccionarNotaPedido = function () { |
... | ... | @@ -141,12 +144,12 @@ angular.module('focaCrearRemito').controller('remitoController', |
141 | 144 | label: 'Domicilio:', |
142 | 145 | valor: notaPedido.domicilioStamp |
143 | 146 | }, |
144 | - { | |
145 | - label: 'Vendedor:', | |
146 | - valor: $filter('rellenarDigitos')( | |
147 | - notaPedido.vendedor.NUM, 3 | |
148 | - ) + ' - ' + notaPedido.vendedor.NOM | |
149 | - }, | |
147 | + // { | |
148 | + // label: 'Vendedor:', | |
149 | + // valor: $filter('rellenarDigitos')( | |
150 | + // notaPedido.vendedor.NUM, 3 | |
151 | + // ) + ' - ' + notaPedido.vendedor.NOM | |
152 | + // }, | |
150 | 153 | |
151 | 154 | { |
152 | 155 | label: 'Proveedor:', |
... | ... | @@ -285,32 +288,17 @@ angular.module('focaCrearRemito').controller('remitoController', |
285 | 288 | }; |
286 | 289 | //validacion por domicilio y por plazo pago |
287 | 290 | $scope.crearRemito = function () { |
288 | - if (!$scope.remito.vendedor.NUM) { | |
289 | - focaModalService.alert('Ingrese Vendedor'); | |
290 | - return; | |
291 | - } else if (!$scope.remito.cliente.COD) { | |
292 | - focaModalService.alert('Ingrese Cliente'); | |
293 | - return; | |
294 | - } else if (!$scope.remito.proveedor.COD) { | |
295 | - focaModalService.alert('Ingrese Proveedor'); | |
296 | - return; | |
297 | - } else if (!$scope.remito.cotizacion.moneda.id && | |
298 | - !$scope.remito.cotizacion.moneda.ID) { | |
299 | - focaModalService.alert('Ingrese Moneda'); | |
300 | - return; | |
301 | - } else if (!$scope.remito.cotizacion.ID) { | |
302 | - focaModalService.alert('Ingrese Cotizaciรณn'); | |
303 | - return; | |
304 | - } else if ($scope.remito.flete === undefined || $scope.remito.flete === null) { | |
305 | - focaModalService.alert('Ingrese Flete'); | |
306 | - return; | |
307 | - } else if ($scope.articulosFiltro().length === 0) { | |
308 | - focaModalService.alert('Debe cargar al menos un articulo'); | |
291 | + | |
292 | + if (!remitoBusinessService.validarRemito($scope.remito, $scope.articulosFiltro())) { | |
309 | 293 | return; |
310 | 294 | } |
311 | 295 | |
312 | 296 | focaBotoneraLateralService.startGuardar(); |
313 | 297 | $scope.saveLoading = true; |
298 | + var rutaJson = JSON.parse($localStorage.rutas); | |
299 | + removeItemFromArr(rutaJson, 'venta-remito/crear'); | |
300 | + $localStorage.rutas = JSON.stringify(rutaJson); | |
301 | + | |
314 | 302 | var save = { |
315 | 303 | remito: { |
316 | 304 | id: $scope.remito.id, |
... | ... | @@ -358,7 +346,12 @@ angular.module('focaCrearRemito').controller('remitoController', |
358 | 346 | destinoVenta: 0,//TODO |
359 | 347 | operacionTipo: 0, //TODO |
360 | 348 | }, |
361 | - notaPedido: $scope.notaPedido | |
349 | + notaPedido: $scope.notaPedido, | |
350 | + articulos: remitoBusinessService.quitarCotizacion($scope.articulosFiltro(), | |
351 | + $scope.remito.cotizacion.VENDEDOR), | |
352 | + puntosDescarga: remitoBusinessService.addPuntosDescarga( | |
353 | + $scope.remito.remitoPuntoDescarga), | |
354 | + plazos: $scope.remito.remitoPlazo | |
362 | 355 | }; |
363 | 356 | crearRemitoService.crearRemito(save).then( |
364 | 357 | function (data) { |
... | ... | @@ -366,39 +359,16 @@ angular.module('focaCrearRemito').controller('remitoController', |
366 | 359 | focaBotoneraLateralService.endGuardar(true); |
367 | 360 | $scope.saveLoading = false; |
368 | 361 | |
369 | - $scope.remito.numeroRemito = data.data.numero; | |
370 | - | |
371 | - if ($scope.remito.remitoPuntoDescarga.length > 0) { | |
372 | - remitoBusinessService.addPuntosDescarga(data.data.id, | |
373 | - $scope.remito.remitoPuntoDescarga); | |
374 | - } | |
375 | - | |
376 | 362 | if (data.status === 500) { |
377 | 363 | focaModalService.alert(data.data); |
378 | 364 | return; |
379 | 365 | } |
380 | 366 | |
381 | - // TODO: updatear plazos | |
382 | - if ($scope.remito.id === 0) { | |
383 | - | |
384 | - remitoBusinessService.addArticulos($scope.remito.articulosRemito, | |
385 | - data.data.id, $scope.remito.cotizacion.VENDEDOR); | |
386 | - | |
387 | - var plazos = $scope.remito.remitoPlazo; | |
388 | - | |
389 | - for (var j = 0; j < plazos.length; j++) { | |
390 | - var json = { | |
391 | - idRemito: data.data.id, | |
392 | - dias: plazos[j].dias | |
393 | - }; | |
394 | - crearRemitoService.crearPlazosParaRemito(json); | |
395 | - } | |
396 | - } | |
397 | 367 | abrirModalMail(data.data.id, |
398 | 368 | $scope.remito.cliente, |
399 | 369 | $filter('comprobante')([ |
400 | 370 | $scope.puntoVenta, |
401 | - $scope.remito.numeroRemito | |
371 | + data.data.numero | |
402 | 372 | ]) |
403 | 373 | ); |
404 | 374 | |
... | ... | @@ -531,14 +501,43 @@ angular.module('focaCrearRemito').controller('remitoController', |
531 | 501 | templateUrl: 'foca-busqueda-cliente-modal.html', |
532 | 502 | controller: 'focaBusquedaClienteModalController', |
533 | 503 | resolve: { |
534 | - vendedor: function () { return null; }, | |
535 | - cobrador: function () { return null; } | |
504 | + parametros: function () { | |
505 | + return { | |
506 | + // vendedor: $scope.idVendedor, | |
507 | + cobrador: null, | |
508 | + searchText: $scope.cliente ? $scope.cliente.nom : '' | |
509 | + }; | |
510 | + }, | |
536 | 511 | }, |
537 | 512 | size: 'lg' |
538 | 513 | } |
539 | 514 | ); |
540 | 515 | modalInstance.result.then( |
541 | 516 | function (cliente) { |
517 | + | |
518 | + if ($scope.remito.precioCondicion !== undefined) { | |
519 | + focaModalService | |
520 | + .alert('Debe agregar lista de precio de cliente actual') | |
521 | + .then(function () { | |
522 | + $scope.remito.precioCondicion = undefined; | |
523 | + $scope.$broadcast('removeCabecera', 'Precios y Condiciones:'); | |
524 | + $filter('filter')($scope.botonera, | |
525 | + { label: 'Precios y Condiciones' })[0].checked = false; | |
526 | + }) | |
527 | + .catch(function () { | |
528 | + }) | |
529 | + } | |
530 | + | |
531 | + // if (angular.equals({}, cliente.vendedor)) { | |
532 | + | |
533 | + // focaModalService | |
534 | + // .alert('El cliente seleccionado no tiene tiene ' + | |
535 | + // 'vendedor asignado.') | |
536 | + // .then($scope.seleccionarCliente); | |
537 | + | |
538 | + // return; | |
539 | + // } | |
540 | + | |
542 | 541 | $scope.cliente = cliente; |
543 | 542 | $scope.abrirModalDomicilios(cliente); |
544 | 543 | }, function () { |
... | ... | @@ -551,7 +550,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
551 | 550 | if (data) { |
552 | 551 | $scope.remito.anulado = true; |
553 | 552 | delete $scope.remito.remitoPlazo; |
554 | - delete $scope.remito.vendedor; | |
553 | + // delete $scope.remito.vendedor; | |
555 | 554 | delete $scope.remito.proveedor; |
556 | 555 | delete $scope.remito.cliente; |
557 | 556 | delete $scope.remito.cotizacion; |
... | ... | @@ -620,7 +619,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
620 | 619 | resolve: { |
621 | 620 | idCliente: function () { |
622 | 621 | return $scope.remito.cliente.COD ? $scope.remito.cliente.COD : |
623 | - cliente.cod; | |
622 | + cliente.COD; | |
624 | 623 | }, |
625 | 624 | esNuevo: function () { |
626 | 625 | return ($scope.remito.cliente.COD ? false : cliente.esNuevo); |
... | ... | @@ -631,62 +630,41 @@ angular.module('focaCrearRemito').controller('remitoController', |
631 | 630 | modalInstanceDomicilio.result |
632 | 631 | .then(function (domicilio) { |
633 | 632 | $scope.remito.domicilio = domicilio; |
634 | - if (!$scope.remito.cliente.COD) { | |
635 | - $scope.remito.cliente = { | |
636 | - COD: cliente.cod, | |
637 | - CUIT: cliente.cuit, | |
638 | - NOM: cliente.nom, | |
639 | - MAIL: cliente.mail, | |
640 | - MOD: cliente.mod, | |
641 | - IVA: cliente.iva, | |
642 | - VEN: cliente.ven | |
643 | - }; | |
633 | + $scope.remito.cliente = cliente; | |
634 | + // $scope.remito.vendedor = cliente.vendedor; | |
635 | + | |
636 | + var domicilioStamp = | |
637 | + domicilio.Calle + ' ' + domicilio.Numero + ', ' + | |
638 | + domicilio.Localidad + ', ' + domicilio.Provincia; | |
639 | + | |
640 | + $scope.remito.domicilioStamp = domicilioStamp; | |
641 | + | |
642 | + // $scope.$broadcast('addCabecera', { | |
643 | + // label: 'Vendedor:', | |
644 | + // valor: $filter('rellenarDigitos')($scope.remito.vendedor | |
645 | + // .NUM, 3) + ' - ' + $scope.remito.vendedor.NOM | |
646 | + // }); | |
647 | + $scope.$broadcast('addCabecera', { | |
648 | + label: 'Cliente:', | |
649 | + valor: $filter('rellenarDigitos') | |
650 | + ($scope.remito.cliente.COD, 3) + | |
651 | + ' - ' + $scope.remito.cliente.NOM | |
652 | + }); | |
653 | + $scope.$broadcast('addCabecera', { | |
654 | + label: 'Domicilio:', | |
655 | + valor: domicilioStamp | |
656 | + }); | |
657 | + | |
658 | + if (domicilio.verPuntos) { | |
659 | + delete $scope.remito.domicilio.verPuntos; | |
660 | + $scope.seleccionarPuntosDeDescarga(); | |
644 | 661 | } |
645 | - crearRemitoService.getVendedorById($scope.remito.cliente.VEN) | |
646 | - .then(function (res) { | |
647 | - if (res.data !== '') { | |
648 | - $scope.remito.vendedor = res.data; | |
649 | - $scope.$broadcast('addCabecera', { | |
650 | - label: 'Vendedor:', | |
651 | - valor: $filter('rellenarDigitos')($scope.remito.vendedor | |
652 | - .NUM, 3) + ' - ' + $scope.remito.vendedor.NOM | |
653 | - }); | |
654 | - } | |
655 | - var domicilioStamp = | |
656 | - domicilio.Calle + ' ' + domicilio.Numero + ', ' + | |
657 | - domicilio.Localidad + ', ' + domicilio.Provincia; | |
658 | - $scope.remito.domicilioStamp = domicilioStamp; | |
659 | - $scope.$broadcast('addCabecera', { | |
660 | - label: 'Cliente:', | |
661 | - valor: $filter('rellenarDigitos') | |
662 | - ($scope.remito.cliente.COD, 3) + | |
663 | - ' - ' + $scope.remito.cliente.NOM | |
664 | - }); | |
665 | - $scope.$broadcast('addCabecera', { | |
666 | - label: 'Domicilio:', | |
667 | - valor: domicilioStamp | |
668 | - }); | |
669 | 662 | |
670 | - if (domicilio.verPuntos) { | |
671 | - delete $scope.remito.domicilio.verPuntos; | |
672 | - $scope.seleccionarPuntosDeDescarga(); | |
673 | - } else { | |
674 | - crearRemitoService | |
675 | - .getPuntosDescargaByClienDom(domicilio.id, | |
676 | - $scope.remito.cliente.COD) | |
677 | - .then(function (res) { | |
678 | - if (res.data.length) { | |
679 | - $scope.seleccionarPuntosDeDescarga(); | |
680 | - } | |
681 | - }); | |
682 | - } | |
663 | + $filter('filter')($scope.botonera, | |
664 | + { label: 'Cliente' })[0].checked = true; | |
665 | + $filter('filter')($scope.botonera, | |
666 | + { label: 'Domicilio de Entrega' })[0].checked = true; | |
683 | 667 | |
684 | - $filter('filter')($scope.botonera, | |
685 | - { label: 'Cliente' })[0].checked = true; | |
686 | - $filter('filter')($scope.botonera, | |
687 | - { label: 'Domicilio de Entrega' })[0].checked = true; | |
688 | - }) | |
689 | - .catch(function (e) { console.info(e); }); | |
690 | 668 | }) |
691 | 669 | .catch(function (e) { |
692 | 670 | console.info(e); |
... | ... | @@ -777,7 +755,9 @@ angular.module('focaCrearRemito').controller('remitoController', |
777 | 755 | remitoBusinessService |
778 | 756 | .plazoToString(precioCondicion.plazoPago) |
779 | 757 | }); |
780 | - $scope.remito.idListaPrecio = parseInt(precioCondicion.listaPrecio.ID); | |
758 | + | |
759 | + $scope.remito.idListaPrecio = parseInt( | |
760 | + precioCondicion.listaPrecio.ID); | |
781 | 761 | } |
782 | 762 | $filter('filter')($scope.cabeceras, |
783 | 763 | { label: 'Precios y Condiciones' })[0].valor = cabecera; |
... | ... | @@ -896,7 +876,8 @@ angular.module('focaCrearRemito').controller('remitoController', |
896 | 876 | cotizacionPArgentino.moneda = moneda; |
897 | 877 | |
898 | 878 | actualizarCabeceraMoneda(cotizacionPArgentino); |
899 | - | |
879 | + $filter('filter')($scope.botonera, | |
880 | + { label: 'Moneda' })[0].checked = true; | |
900 | 881 | $scope.remito.cotizacion = cotizacionPArgentino; |
901 | 882 | }); |
902 | 883 | }, function () { |
... | ... | @@ -911,7 +892,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
911 | 892 | titulo: 'Observaciones', |
912 | 893 | value: $scope.remito.observaciones, |
913 | 894 | textarea: true, |
914 | - readonly: true | |
895 | + readonly: false | |
915 | 896 | }) |
916 | 897 | .then(function (observaciones) { |
917 | 898 | $scope.remito.observaciones = observaciones; |
... | ... | @@ -933,6 +914,8 @@ angular.module('focaCrearRemito').controller('remitoController', |
933 | 914 | cotizacion.moneda = moneda; |
934 | 915 | $scope.remitoIsDirty = true; |
935 | 916 | actualizarCabeceraMoneda(cotizacion); |
917 | + $filter('filter')($scope.botonera, | |
918 | + { label: 'Moneda' })[0].checked = true; | |
936 | 919 | $scope.remito.cotizacion = cotizacion; |
937 | 920 | }, function () { |
938 | 921 | |
... | ... | @@ -1087,6 +1070,14 @@ angular.module('focaCrearRemito').controller('remitoController', |
1087 | 1070 | } |
1088 | 1071 | } |
1089 | 1072 | |
1073 | + function removeItemFromArr(arr, item) { | |
1074 | + var i = arr.indexOf(item); | |
1075 | + | |
1076 | + if (i !== -1) { | |
1077 | + arr.splice(i, 1); | |
1078 | + } | |
1079 | + } | |
1080 | + | |
1090 | 1081 | function salir() { |
1091 | 1082 | var confirmacion = false; |
1092 | 1083 | |
... | ... | @@ -1100,6 +1091,9 @@ angular.module('focaCrearRemito').controller('remitoController', |
1100 | 1091 | ).then(function (data) { |
1101 | 1092 | if (data) { |
1102 | 1093 | $location.path('/'); |
1094 | + var rutaJson = JSON.parse($localStorage.rutas); | |
1095 | + removeItemFromArr(rutaJson, 'venta-remito/crear'); | |
1096 | + $localStorage.rutas = JSON.stringify(rutaJson); | |
1103 | 1097 | } |
1104 | 1098 | }); |
1105 | 1099 | } else { |
... | ... | @@ -1116,7 +1110,6 @@ angular.module('focaCrearRemito').controller('remitoController', |
1116 | 1110 | |
1117 | 1111 | function setearRemito(remito) { |
1118 | 1112 | //aรฑado cabeceras |
1119 | - console.log(remito); | |
1120 | 1113 | var esAbierto = remito.hojaRuta ? |
1121 | 1114 | (remito.hojaRuta.abierta === '1') : false; |
1122 | 1115 | if (remito.estado !== 5 && remito.id && !esAbierto) { |
... | ... | @@ -1131,7 +1124,7 @@ angular.module('focaCrearRemito').controller('remitoController', |
1131 | 1124 | $scope.$broadcast('removeCabecera', 'Moneda:'); |
1132 | 1125 | $scope.$broadcast('removeCabecera', 'Fecha cotizacion:'); |
1133 | 1126 | $scope.$broadcast('removeCabecera', 'Cotizacion:'); |
1134 | - $scope.$broadcast('removeCabecera', 'Vendedor:'); | |
1127 | + // $scope.$broadcast('removeCabecera', 'Vendedor:'); | |
1135 | 1128 | |
1136 | 1129 | $scope.cabeceras = []; |
1137 | 1130 | |
... | ... | @@ -1171,13 +1164,13 @@ angular.module('focaCrearRemito').controller('remitoController', |
1171 | 1164 | { label: 'Domicilio de Entrega' })[0].checked = true; |
1172 | 1165 | $filter('filter')($scope.botonera, { label: 'Cliente' })[0].checked = true; |
1173 | 1166 | } |
1174 | - if (remito.vendedor && remito.vendedor.NUM) { | |
1175 | - $scope.cabeceras.push({ | |
1176 | - label: 'Vendedor:', | |
1177 | - valor: $filter('rellenarDigitos')(remito.vendedor.NUM, 3) + | |
1178 | - ' - ' + remito.vendedor.NOM | |
1179 | - }); | |
1180 | - } | |
1167 | + // if (remito.vendedor && remito.vendedor.NUM) { | |
1168 | + // $scope.cabeceras.push({ | |
1169 | + // label: 'Vendedor:', | |
1170 | + // valor: $filter('rellenarDigitos')(remito.vendedor.NUM, 3) + | |
1171 | + // ' - ' + remito.vendedor.NOM | |
1172 | + // }); | |
1173 | + // } | |
1181 | 1174 | if (remito.proveedor && remito.proveedor.COD) { |
1182 | 1175 | $scope.cabeceras.push({ |
1183 | 1176 | label: 'Proveedor:', |
... | ... | @@ -1286,10 +1279,18 @@ angular.module('focaCrearRemito').controller('remitoController', |
1286 | 1279 | nombre: numeroRemito + '.pdf', |
1287 | 1280 | url: '/remito/comprobante', |
1288 | 1281 | }, |
1282 | + descargaSinValorizar: { | |
1283 | + nombre: numeroRemito + '.pdf', | |
1284 | + url: '/remito/comprobante-sin-valorizar', | |
1285 | + }, | |
1289 | 1286 | envio: { |
1290 | 1287 | mailCliente: cliente.MAIL, |
1291 | 1288 | url: '/remito/mail', |
1292 | 1289 | }, |
1290 | + envioSinValorizar:{ | |
1291 | + mailCliente: cliente.MAIL, | |
1292 | + url: '/remito/mail-sin-valorizar' | |
1293 | + }, | |
1293 | 1294 | options: { |
1294 | 1295 | idRemito: id |
1295 | 1296 | } |
src/js/service.js
... | ... | @@ -3,9 +3,9 @@ angular.module('focaCrearRemito') |
3 | 3 | function($http, API_ENDPOINT) { |
4 | 4 | var route = API_ENDPOINT.URL; |
5 | 5 | return { |
6 | - getVendedorById: function (idVendedor) { | |
7 | - return $http.get(route + '/vendedor-cobrador/' + idVendedor); | |
8 | - }, | |
6 | + // getVendedorById: function (idVendedor) { | |
7 | + // return $http.get(route + '/vendedor-cobrador/' + idVendedor); | |
8 | + // }, | |
9 | 9 | crearRemito: function(remito) { |
10 | 10 | // TODO: Cambiar para usar el servicio /remito |
11 | 11 | return $http.post(route + '/remito/guardar', remito); |
... | ... | @@ -66,8 +66,11 @@ angular.module('focaCrearRemito') |
66 | 66 | crearEstadoParaRemito: function(estado) { |
67 | 67 | return $http.post(route + '/estado', {estado: estado}); |
68 | 68 | }, |
69 | - getNumeroRemito: function() { | |
70 | - return $http.get(route + '/remito/numero-siguiente'); | |
69 | + getNumeroRemito: function(tipoComprobante) { | |
70 | + | |
71 | + var tipo = tipoComprobante ? '/' + tipoComprobante : ''; | |
72 | + | |
73 | + return $http.get(route + '/remito/numero-siguiente' + tipo); | |
71 | 74 | }, |
72 | 75 | imprimirRemitoByIdRemito: function(idRemito) { |
73 | 76 | return $http.get(route + '/remito/comprobante/' + idRemito , { |
... | ... | @@ -99,6 +102,10 @@ angular.module('focaCrearRemito') |
99 | 102 | image: 'cliente.png' |
100 | 103 | }, |
101 | 104 | { |
105 | + label: 'Domicilio de Entrega', | |
106 | + image: 'domicilioDeEntrega.png' | |
107 | + }, | |
108 | + { | |
102 | 109 | label: 'Proveedor', |
103 | 110 | image: 'proveedor.png' |
104 | 111 | }, |
... | ... | @@ -115,10 +122,6 @@ angular.module('focaCrearRemito') |
115 | 122 | image: 'productos.png' |
116 | 123 | }, |
117 | 124 | { |
118 | - label: 'Domicilio de Entrega', | |
119 | - image: 'domicilioDeEntrega.png' | |
120 | - }, | |
121 | - { | |
122 | 125 | label: 'Observaciones', |
123 | 126 | image: 'botonObservaciones.png', |
124 | 127 | disable: true |
src/views/remito.html
... | ... | @@ -122,10 +122,10 @@ |
122 | 122 | <i class="fa fa-trash"></i> |
123 | 123 | </button> |
124 | 124 | <button |
125 | - ng-show="remito.estado !== 5 && remito.hojaRuta.abierta !== '1'" | |
125 | + ng-show="(articulo.editCantidad || articulo.editPrecio) && | |
126 | + (remito.estado !== 5 && remito.hojaRuta.abierta !== '1')" | |
126 | 127 | class="btn btn-outline-light" |
127 | 128 | ng-click="editarArticulo(13, articulo, tmpCantidad, tmpPrecio);" |
128 | - ng-show="articulo.editCantidad || articulo.editPrecio" | |
129 | 129 | > |
130 | 130 | <i class="fa fa-save"></i> |
131 | 131 | </button> |