Commit 715e7ebc852e874ee7f9f7b0baeea2c9eca268cb
1 parent
edc2dc474c
Exists in
master
cargar nota de pedido
Showing
4 changed files
with
84 additions
and
22 deletions
Show diff stats
index.html
... | ... | @@ -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="../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> |
package.json
... | ... | @@ -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 | } |
src/js/app.js
src/js/controller.js
... | ... | @@ -98,23 +98,78 @@ angular.module('focaCrearRemito') .controller('remitoController', |
98 | 98 | } |
99 | 99 | ); |
100 | 100 | 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; | |
101 | + function(notaPedido) { | |
102 | + //aรฑado cabeceras | |
103 | + removeCabecera('Moneda:'); | |
104 | + removeCabecera('Fecha cotizacion:'); | |
105 | + removeCabecera('Cotizacion:'); | |
106 | + var cabeceras = [ | |
107 | + { | |
108 | + label: 'Moneda', | |
109 | + valor: notaPedido.cotizacion[0].moneda[0].DETALLE | |
110 | + }, | |
111 | + { | |
112 | + label: 'Fecha cotizacion', | |
113 | + valor: $filter('date')(notaPedido.cotizacion[0].FECHA, | |
114 | + 'dd/MM/yyyy') | |
115 | + }, | |
116 | + { | |
117 | + label: 'Cotizacion', | |
118 | + valor: notaPedido.cotizacion[0].VENDEDOR | |
119 | + }, | |
120 | + { | |
121 | + label: 'Cliente:', | |
122 | + valor: notaPedido.cliente[0].NOM | |
123 | + }, | |
124 | + { | |
125 | + label: 'Vendedor:', | |
126 | + valor: notaPedido.vendedor[0].NomVen | |
127 | + }, | |
128 | + { | |
129 | + label: 'Proveedor:', | |
130 | + valor: notaPedido.proveedor[0].NOM | |
131 | + }, | |
132 | + { | |
133 | + label: 'Flete:', | |
134 | + valor: notaPedido.flete === 1 ? 'Si' : 'No' | |
135 | + }, | |
136 | + { | |
137 | + label: 'FOB:', | |
138 | + valor: notaPedido.fob === 1 ? 'Si' : 'No' | |
139 | + }, | |
140 | + { | |
141 | + label: 'Precio condicion:', | |
142 | + valor: valorPrecioCondicion() | |
143 | + } | |
144 | + ]; | |
145 | + //TO DO CUANDO MOSTRAR PLAZOS | |
146 | + function valorPrecioCondicion() { | |
147 | + if(notaPedido.idPrecioCondicion > 0) { | |
148 | + return notaPedido.precioCondicion[0].nombre; | |
149 | + } else { | |
150 | + return 'Ingreso Manual'; | |
151 | + } | |
152 | + | |
153 | + } | |
154 | + | |
155 | + if(notaPedido.flete === 1) { | |
156 | + var cabeceraBomba = { | |
157 | + label: 'Bomba', | |
158 | + valor: notaPedido.bomba === 1 ? 'Si' : 'No' | |
159 | + }; | |
160 | + if(notaPedido.kilometros){ | |
161 | + var cabeceraKilometros = { | |
162 | + label: 'Kilometros', | |
163 | + valor: notaPedido.kilometros | |
164 | + }; | |
165 | + cabeceras.push(cabeceraKilometros); | |
166 | + } | |
167 | + cabeceras.push(cabeceraBomba); | |
168 | + } | |
169 | + $scope.articulosTabla = notaPedido.articulosNotaPedido; | |
170 | + $scope.remito = notaPedido; | |
171 | + addArrayCabecera(cabeceras); | |
172 | + | |
118 | 173 | }, function() { |
119 | 174 | // funcion ejecutada cuando se cancela el modal |
120 | 175 | } |
... | ... | @@ -655,6 +710,11 @@ angular.module('focaCrearRemito') .controller('remitoController', |
655 | 710 | $scope.salir = function() { |
656 | 711 | $location.path('/'); |
657 | 712 | }; |
713 | + function addArrayCabecera(array) { | |
714 | + for(var i = 0; i < array.length; i++) { | |
715 | + addCabecera(array[i].label, array[i].valor); | |
716 | + } | |
717 | + } | |
658 | 718 | |
659 | 719 | function addCabecera(label, valor) { |
660 | 720 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); |