Commit 9c5dd6316456b701f6d192eff45e7ff36520328d

Authored by Nicolás Guarnieri
Exists in master

Merge remote-tracking branch 'upstream/master'

... ... @@ -53,7 +53,7 @@ gulp.task('uglify', ['templates'], function() {
53 53 );
54 54 });
55 55  
56   -gulp.task('clean', function(){
  56 +gulp.task('clean', function() {
57 57 return gulp.src(['tmp', 'dist'], {read: false})
58 58 .pipe(clean());
59 59 });
... ... @@ -33,6 +33,7 @@
33 33 <script src="node_modules/foca-modal-moneda/dist/foca-modal-moneda.min.js"></script>
34 34 <script src="node_modules/foca-modal-cotizacion/dist/foca-modal-cotizacion.min.js"></script>
35 35 <script src="node_modules/foca-seguimiento/dist/foca-seguimiento.min.js"></script>
  36 + <script src="node_modules/foca-modal-nota-pedido/dist/foca-modal-nota-pedido.min.js"></script>
36 37  
37 38 <script src="src/js/app.js"></script>
38 39 <script src="src/js/controller.js"></script>
... ... @@ -29,10 +29,12 @@
29 29 },
30 30 "devDependencies": {
31 31 "angular": "^1.7.5",
  32 + "angular-cookies": "^1.7.5",
32 33 "angular-ladda": "^0.4.3",
33 34 "angular-route": "^1.7.5",
34 35 "bootstrap": "^4.1.3",
35 36 "foca-busqueda-cliente": "git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git",
  37 + "foca-configuracion": "git+https://debo.suite.repo/modulos-npm/foca-configuracion.git",
36 38 "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git",
37 39 "foca-modal": "git+https://debo.suite.repo/modulos-npm/foca-modal.git",
38 40 "foca-modal-busqueda-productos": "git+https://debo.suite.repo/modulos-npm/foca-modal-busqueda-productos",
... ... @@ -46,7 +48,7 @@
46 48 "foca-seguimiento": "git+https://debo.suite.repo/modulos-npm/foca-seguimiento.git",
47 49 "font-awesome": "^4.7.0",
48 50 "gulp": "^3.9.1",
49   - "gulp-angular-templatecache": "^2.2.2",
  51 + "gulp-angular-templatecache": "^2.2.5",
50 52 "gulp-clean": "^0.4.0",
51 53 "gulp-concat": "^2.6.1",
52 54 "gulp-connect": "^5.6.1",
... ... @@ -63,8 +65,6 @@
63 65 "ladda": "1.0.6",
64 66 "pre-commit": "^1.2.2",
65 67 "pump": "^3.0.0",
66   - "ui-bootstrap4": "^3.0.5",
67   - "angular-cookies": "^1.7.5",
68   - "foca-configuracion": "git+https://debo.suite.repo/modulos-npm/foca-configuracion.git"
  68 + "ui-bootstrap4": "^3.0.5"
69 69 }
70 70 }
... ... @@ -14,5 +14,6 @@ angular.module(&#39;focaCrearRemito&#39;, [
14 14 'focaModalMoneda',
15 15 'focaModalCotizacion',
16 16 'focaConfiguracion',
17   - 'angular-ladda'
  17 + 'angular-ladda',
  18 + 'focaModalNotaPedido'
18 19 ]);
src/js/controller.js
... ... @@ -87,34 +87,82 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
87 87 ariaLabelledBy: 'Busqueda de Nota de Pedido',
88 88 templateUrl: 'foca-modal-nota-pedido.html',
89 89 controller: 'focaModalNotaPedidoController',
90   - resolve: {
91   - parametroNotaPedido: {
92   - idLista: $scope.idLista,
93   - cotizacion: $scope.remito.cotizacion.COTIZACION,
94   - simbolo: $scope.remito.moneda.simbolo
95   - }
96   - },
97 90 size: 'lg'
98 91 }
99 92 );
100 93 modalInstance.result.then(
101   - function(producto) {
102   - var newArt =
103   - {
104   - id: 0,
105   - codigo: producto.codigo,
106   - sector: producto.sector,
107   - sectorCodigo: producto.sector + '-' + producto.codigo,
108   - descripcion: producto.descripcion,
109   - item: $scope.articulosTabla.length + 1,
110   - nombre: producto.descripcion,
111   - precio: parseFloat(producto.precio.toFixed(4)),
112   - costoUnitario: producto.costo,
113   - editCantidad: false,
114   - editPrecio: false
115   - };
116   - $scope.articuloACargar = newArt;
117   - $scope.cargando = false;
  94 + function(notaPedido) {
  95 + //añado cabeceras
  96 + removeCabecera('Moneda:');
  97 + removeCabecera('Fecha cotizacion:');
  98 + removeCabecera('Cotizacion:');
  99 + var cabeceras = [
  100 + {
  101 + label: 'Moneda',
  102 + valor: notaPedido.cotizacion[0].moneda[0].DETALLE
  103 + },
  104 + {
  105 + label: 'Fecha cotizacion',
  106 + valor: $filter('date')(notaPedido.cotizacion[0].FECHA,
  107 + 'dd/MM/yyyy')
  108 + },
  109 + {
  110 + label: 'Cotizacion',
  111 + valor: notaPedido.cotizacion[0].VENDEDOR
  112 + },
  113 + {
  114 + label: 'Cliente:',
  115 + valor: notaPedido.cliente[0].NOM
  116 + },
  117 + {
  118 + label: 'Vendedor:',
  119 + valor: notaPedido.vendedor[0].NomVen
  120 + },
  121 + {
  122 + label: 'Proveedor:',
  123 + valor: notaPedido.proveedor[0].NOM
  124 + },
  125 + {
  126 + label: 'Flete:',
  127 + valor: notaPedido.flete === 1 ? 'Si' : 'No'
  128 + },
  129 + {
  130 + label: 'FOB:',
  131 + valor: notaPedido.fob === 1 ? 'Si' : 'No'
  132 + },
  133 + {
  134 + label: 'Precio condicion:',
  135 + valor: valorPrecioCondicion()
  136 + }
  137 + ];
  138 + //TO DO CUANDO MOSTRAR PLAZOS
  139 + function valorPrecioCondicion() {
  140 + if(notaPedido.idPrecioCondicion > 0) {
  141 + return notaPedido.precioCondicion[0].nombre;
  142 + } else {
  143 + return 'Ingreso Manual';
  144 + }
  145 +
  146 + }
  147 +
  148 + if(notaPedido.flete === 1) {
  149 + var cabeceraBomba = {
  150 + label: 'Bomba',
  151 + valor: notaPedido.bomba === 1 ? 'Si' : 'No'
  152 + };
  153 + if(notaPedido.kilometros) {
  154 + var cabeceraKilometros = {
  155 + label: 'Kilometros',
  156 + valor: notaPedido.kilometros
  157 + };
  158 + cabeceras.push(cabeceraKilometros);
  159 + }
  160 + cabeceras.push(cabeceraBomba);
  161 + }
  162 + $scope.articulosTabla = notaPedido.articulosNotaPedido;
  163 + $scope.remito = notaPedido;
  164 + addArrayCabecera(cabeceras);
  165 +
118 166 }, function() {
119 167 // funcion ejecutada cuando se cancela el modal
120 168 }
... ... @@ -127,34 +175,12 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
127 175 ariaLabelledBy: 'Busqueda de Remito',
128 176 templateUrl: 'foca-modal-remito.html',
129 177 controller: 'focaModalRemitoController',
130   - resolve: {
131   - parametroRemito: {
132   - idLista: $scope.idLista,
133   - cotizacion: $scope.remito.cotizacion.COTIZACION,
134   - simbolo: $scope.remito.moneda.simbolo
135   - }
136   - },
137 178 size: 'lg'
138 179 }
139 180 );
140 181 modalInstance.result.then(
141   - function(producto) {
142   - var newArt =
143   - {
144   - id: 0,
145   - codigo: producto.codigo,
146   - sector: producto.sector,
147   - sectorCodigo: producto.sector + '-' + producto.codigo,
148   - descripcion: producto.descripcion,
149   - item: $scope.articulosTabla.length + 1,
150   - nombre: producto.descripcion,
151   - precio: parseFloat(producto.precio.toFixed(4)),
152   - costoUnitario: producto.costo,
153   - editCantidad: false,
154   - editPrecio: false
155   - };
156   - $scope.articuloACargar = newArt;
157   - $scope.cargando = false;
  182 + function() {
  183 + // TODO: Implementar carga remito
158 184 }, function() {
159 185 // funcion ejecutada cuando se cancela el modal
160 186 }
... ... @@ -587,7 +613,7 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
587 613 if(key === 13) {
588 614 if($scope.articuloACargar.cantidad === undefined ||
589 615 $scope.articuloACargar.cantidad === 0 ||
590   - $scope.articuloACargar.cantidad === null ){
  616 + $scope.articuloACargar.cantidad === null ) {
591 617 focaModalService.alert('El valor debe ser al menos 1');
592 618 return;
593 619 }
... ... @@ -604,7 +630,7 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
604 630 $scope.editarArticulo = function(key, articulo) {
605 631 if(key === 13) {
606 632 if(articulo.cantidad === null || articulo.cantidad === 0 ||
607   - articulo.cantidad === undefined){
  633 + articulo.cantidad === undefined) {
608 634 focaModalService.alert('El valor debe ser al menos 1');
609 635 return;
610 636 }
... ... @@ -655,6 +681,11 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
655 681 $scope.salir = function() {
656 682 $location.path('/');
657 683 };
  684 + function addArrayCabecera(array) {
  685 + for(var i = 0; i < array.length; i++) {
  686 + addCabecera(array[i].label, array[i].valor);
  687 + }
  688 + }
658 689  
659 690 function addCabecera(label, valor) {
660 691 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true);
... ... @@ -667,7 +698,7 @@ angular.module(&#39;focaCrearRemito&#39;) .controller(&#39;remitoController&#39;,
667 698  
668 699 function removeCabecera(label) {
669 700 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true);
670   - if(propiedad.length === 1){
  701 + if(propiedad.length === 1) {
671 702 $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1);
672 703 }
673 704 }