Commit 8c88aaa3ddab5c182b16761bc9e85f158327c49e
Exists in
master
Merge branch 'master' of https://debo.suite.repo/modulos-npm/foca-crear-nota-pedido
# Conflicts: # package.json # src/js/controller.js
Showing
7 changed files
Show diff stats
gulpfile.js
... | ... | @@ -43,6 +43,8 @@ gulp.task('uglify', ['templates'], function() { |
43 | 43 | gulp.dest(paths.tmp), |
44 | 44 | rename('foca-crear-nota-pedido.min.js'), |
45 | 45 | uglify(), |
46 | + replace('"ngRoute","ui.bootstrap","focaModalVendedores","focaBusquedaProductos",'+ | |
47 | + '"focaModalPetroleras","focaBusquedaCliente","focaModalPrecioCondicion"', ''), | |
46 | 48 | gulp.dest(paths.dist) |
47 | 49 | ] |
48 | 50 | ); |
... | ... | @@ -72,4 +74,10 @@ gulp.task('webserver', function() { |
72 | 74 | ] |
73 | 75 | }); |
74 | 76 | |
77 | +gulp.task('clean-post-install', function() { | |
78 | + return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', | |
79 | + 'index.html'], {read: false}) | |
80 | + .pipe(clean()); | |
81 | +}); | |
82 | + | |
75 | 83 | gulp.task('default', ['webserver']); |
index.html
... | ... | @@ -19,6 +19,7 @@ |
19 | 19 | <script src="node_modules/foca-modal-busqueda-productos/dist/foca-busqueda-productos.min.js"></script> |
20 | 20 | <script src="node_modules/foca-modal-petroleras/dist/foca-modal-petroleras.min.js"></script> |
21 | 21 | <script src="node_modules/foca-busqueda-cliente/dist/foca-busqueda-cliente.min.js"></script> |
22 | + <script src="node_modules/foca-modal-precio-condiciones/dist/foca-modal-precio-condiciones.min.js"></script> | |
22 | 23 | |
23 | 24 | <script src="src/js/app.js"></script> |
24 | 25 | <script src="src/js/controller.js"></script> |
package.json
... | ... | @@ -6,27 +6,36 @@ |
6 | 6 | "scripts": { |
7 | 7 | "test": "echo \"Error: no test specified\" && exit 1", |
8 | 8 | "compile": "gulp uglify", |
9 | - "postinstall": "npm run compile && rm -R src && rm index.html && rm .jshintrc && rm gulpfile.js", | |
10 | - "install-dev": "npm install -D jasmine-core pre-commit angular angular-route bootstrap ui-bootstrap4 font-awesome gulp gulp-angular-templatecache gulp-connect gulp-clean gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-sequence gulp-uglify-es jquery jshint pump" | |
9 | + "gulp-pre-commit": "gulp pre-commit", | |
10 | + "postinstall": "npm run compile && gulp clean-post-install", | |
11 | + "install-dev": "npm install -D jasmine-core pre-commit angular angular-route bootstrap ui-bootstrap4 font-awesome gulp gulp-angular-templatecache gulp-connect gulp-clean gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-sequence gulp-uglify-es gulp-uglify jquery jshint pump git+https://debo.suite.repo/modulos-npm/foca-directivas.git git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git git+https://debo.suite.repo/modulos-npm/foca-modal-petroleras.git git+https://debo.suite.repo/nguarnieri/foca-modal-busqueda-productos git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git git+https://debo.suite.repo/modulos-npm/foca-modal-precio-condiciones.git" | |
11 | 12 | }, |
13 | + "pre-commit": [ | |
14 | + "gulp-pre-commit" | |
15 | + ], | |
12 | 16 | "repository": { |
13 | 17 | "type": "git", |
14 | - "url": "https://192.168.0.11/modulos-npm/foca-crear-nota-pedido.git" | |
18 | + "url": "https://debo.suite.repo/modulos-npm/foca-crear-nota-pedido.git" | |
15 | 19 | }, |
16 | 20 | "author": "Foca Software", |
17 | 21 | "license": "ISC", |
18 | - "dependencies": { | |
19 | - "foca-directivas": "git+https://192.168.0.11/modulos-npm/foca-directivas.git", | |
20 | - "foca-modal-busqueda-productos": "git+https://192.168.0.11/nguarnieri/foca-modal-busqueda-productos", | |
21 | - "foca-modal-petroleras": "git+https://192.168.0.11/modulos-npm/foca-modal-petroleras.git", | |
22 | - "foca-modal-vendedores": "git+https://192.168.0.11/modulos-npm/foca-modal-vendedores.git", | |
23 | - "jquery": "^3.3.x" | |
22 | + "peerDependencies": { | |
23 | + "foca-busqueda-cliente": "git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git", | |
24 | + "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git", | |
25 | + "foca-modal-busqueda-productos": "git+https://debo.suite.repo/nguarnieri/foca-modal-busqueda-productos", | |
26 | + "foca-modal-petroleras": "git+https://debo.suite.repo/modulos-npm/foca-modal-petroleras.git", | |
27 | + "foca-modal-vendedores": "git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git" | |
24 | 28 | }, |
25 | 29 | "devDependencies": { |
26 | 30 | "angular": "^1.7.5", |
27 | 31 | "angular-route": "^1.7.5", |
28 | 32 | "bootstrap": "^4.1.3", |
29 | - "foca-busqueda-cliente": "git+https://192.168.0.11/modulos-npm/foca-busqueda-cliente", | |
33 | + "foca-busqueda-cliente": "git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git", | |
34 | + "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git", | |
35 | + "foca-modal-busqueda-productos": "git+https://debo.suite.repo/nguarnieri/foca-modal-busqueda-productos", | |
36 | + "foca-modal-petroleras": "git+https://debo.suite.repo/modulos-npm/foca-modal-petroleras.git", | |
37 | + "foca-modal-precio-condiciones": "git+https://debo.suite.repo/modulos-npm/foca-modal-precio-condiciones.git", | |
38 | + "foca-modal-vendedores": "git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git", | |
30 | 39 | "font-awesome": "^4.7.0", |
31 | 40 | "gulp": "^3.9.1", |
32 | 41 | "gulp-angular-templatecache": "^2.2.2", |
... | ... | @@ -37,9 +46,11 @@ |
37 | 46 | "gulp-jshint": "^2.1.0", |
38 | 47 | "gulp-rename": "^1.4.0", |
39 | 48 | "gulp-replace": "^1.0.0", |
49 | + "gulp-sequence": "^1.0.0", | |
40 | 50 | "gulp-uglify": "^3.0.1", |
41 | 51 | "gulp-uglify-es": "^1.0.4", |
42 | 52 | "jasmine-core": "^3.2.1", |
53 | + "jquery": "^3.3.1", | |
43 | 54 | "jshint": "^2.9.6", |
44 | 55 | "pre-commit": "^1.2.2", |
45 | 56 | "pump": "^3.0.0", |
src/js/app.js
src/js/controller.js
... | ... | @@ -19,7 +19,7 @@ angular.module('focaCrearNotaPedido') |
19 | 19 | $scope.precioCondiciones = res.data; |
20 | 20 | } |
21 | 21 | ); |
22 | - if (notaPedidoTemp != undefined) { | |
22 | + if (notaPedidoTemp !== undefined) { | |
23 | 23 | notaPedidoTemp.fechaCarga = new Date(notaPedidoTemp.fechaCarga); |
24 | 24 | $scope.notaPedido = notaPedidoTemp; |
25 | 25 | $scope.notaPedido.flete = ($scope.notaPedido.flete).toString(); |
... | ... | @@ -35,26 +35,26 @@ angular.module('focaCrearNotaPedido') |
35 | 35 | function(res) { |
36 | 36 | $scope.notaPedido.domicilio = res.data; |
37 | 37 | } |
38 | - ) | |
38 | + ); | |
39 | 39 | } else { |
40 | 40 | $scope.notaPedido.fechaCarga = new Date(); |
41 | - $scope.notaPedido.domicilio = [{ id: 0 }] | |
41 | + $scope.notaPedido.domicilio = [{ id: 0 }]; | |
42 | 42 | $scope.notaPedido.bomba = '1'; |
43 | 43 | $scope.notaPedido.flete = '1'; |
44 | 44 | idLista = undefined; |
45 | 45 | } |
46 | 46 | $scope.addNewDom = function() { |
47 | 47 | $scope.notaPedido.domicilio.push({ 'id': 0 }); |
48 | - } | |
48 | + }; | |
49 | 49 | $scope.removeNewChoice = function(choice) { |
50 | 50 | if ($scope.notaPedido.domicilio.length > 1) { |
51 | 51 | $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex( |
52 | 52 | function(c) { |
53 | - return c.$$hashKey == choice.$$hashKey; | |
53 | + return c.$$hashKey === choice.$$hashKey; | |
54 | 54 | } |
55 | - ), 1) | |
55 | + ), 1); | |
56 | 56 | } |
57 | - } | |
57 | + }; | |
58 | 58 | $scope.crearNotaPedido = function() { |
59 | 59 | var notaPedido = { |
60 | 60 | id: 0, |
... | ... | @@ -71,29 +71,30 @@ angular.module('focaCrearNotaPedido') |
71 | 71 | costoFinanciacion: $scope.notaPedido.costoFinanciacion, |
72 | 72 | flete: $scope.notaPedido.flete, |
73 | 73 | costoUnitarioKmFlete: $scope.notaPedido.costoUnitarioKmFlete, |
74 | - total : $scope.articulosTabla[0].subTotal | |
75 | - } | |
74 | + total: $scope.articulosTabla[0].subTotal | |
75 | + }; | |
76 | 76 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( |
77 | - function(res) { | |
77 | + function() { | |
78 | 78 | alert('Nota pedido creada'); |
79 | 79 | $location.path('/venta-nota-pedido'); |
80 | 80 | } |
81 | - ) | |
81 | + ); | |
82 | 82 | var articulosNotaPedido = $scope.articulosTabla; |
83 | 83 | for(var i = 0; i< articulosNotaPedido.length;i++) { |
84 | - crearNotaPedidoService.crearArticulosParaNotaPedido(articulosNotaPedido[i]).then( | |
85 | - function(res) { | |
86 | - return; | |
87 | - } | |
88 | - ) | |
84 | + crearNotaPedidoService | |
85 | + .crearArticulosParaNotaPedido(articulosNotaPedido[i]).then( | |
86 | + function() { | |
87 | + return; | |
88 | + } | |
89 | + ); | |
89 | 90 | } |
90 | 91 | |
91 | - } | |
92 | + }; | |
92 | 93 | $scope.siguienteTab = function() { |
93 | 94 | $scope.active = 1; |
94 | - } | |
95 | + }; | |
95 | 96 | $scope.seleccionarArticulo = function() { |
96 | - if (idLista == undefined) { | |
97 | + if (idLista === undefined) { | |
97 | 98 | alert('primero seleccione una lista de precio y condicion'); |
98 | 99 | return; |
99 | 100 | } |
... | ... | @@ -102,10 +103,10 @@ angular.module('focaCrearNotaPedido') |
102 | 103 | ariaLabelledBy: 'Busqueda de Productos', |
103 | 104 | templateUrl: 'modal-busqueda-productos.html', |
104 | 105 | controller: 'modalBusquedaProductosCtrl', |
105 | - resolve: { idLista: function() { return idLista } }, | |
106 | + resolve: { idLista: function() { return idLista; } }, | |
106 | 107 | size: 'lg' |
107 | 108 | } |
108 | - ) | |
109 | + ); | |
109 | 110 | modalInstance.result.then( |
110 | 111 | function(producto) { |
111 | 112 | var newArt = |
... | ... | @@ -117,13 +118,13 @@ angular.module('focaCrearNotaPedido') |
117 | 118 | precio: producto.precio, |
118 | 119 | costoUnitario: producto.costo, |
119 | 120 | cantidad: 1 |
120 | - } | |
121 | + }; | |
121 | 122 | $scope.articulosTabla.unshift(newArt); |
122 | 123 | }, function() { |
123 | 124 | // funcion ejecutada cuando se cancela el modal |
124 | 125 | } |
125 | 126 | ); |
126 | - } | |
127 | + }; | |
127 | 128 | $scope.seleccionarVendedor = function() { |
128 | 129 | var modalInstance = $uibModal.open( |
129 | 130 | { |
... | ... | @@ -132,7 +133,7 @@ angular.module('focaCrearNotaPedido') |
132 | 133 | controller: 'modalVendedoresCtrl', |
133 | 134 | size: 'lg' |
134 | 135 | } |
135 | - ) | |
136 | + ); | |
136 | 137 | modalInstance.result.then( |
137 | 138 | function(vendedor) { |
138 | 139 | $scope.notaPedido.vendedor = vendedor.NomVen; |
... | ... | @@ -140,7 +141,7 @@ angular.module('focaCrearNotaPedido') |
140 | 141 | |
141 | 142 | } |
142 | 143 | ); |
143 | - } | |
144 | + }; | |
144 | 145 | $scope.seleccionarPetrolera = function() { |
145 | 146 | var modalInstance = $uibModal.open( |
146 | 147 | { |
... | ... | @@ -149,7 +150,7 @@ angular.module('focaCrearNotaPedido') |
149 | 150 | controller: 'modalPetrolerasCtrl', |
150 | 151 | size: 'lg' |
151 | 152 | } |
152 | - ) | |
153 | + ); | |
153 | 154 | modalInstance.result.then( |
154 | 155 | function(petrolera) { |
155 | 156 | $scope.notaPedido.petrolera = petrolera.NOM; |
... | ... | @@ -157,7 +158,7 @@ angular.module('focaCrearNotaPedido') |
157 | 158 | |
158 | 159 | } |
159 | 160 | ); |
160 | - } | |
161 | + }; | |
161 | 162 | $scope.seleccionarCliente = function() { |
162 | 163 | var modalInstance = $uibModal.open( |
163 | 164 | { |
... | ... | @@ -166,7 +167,7 @@ angular.module('focaCrearNotaPedido') |
166 | 167 | controller: 'focaBusquedaClienteModalController', |
167 | 168 | size: 'lg' |
168 | 169 | } |
169 | - ) | |
170 | + ); | |
170 | 171 | modalInstance.result.then( |
171 | 172 | function(cliente) { |
172 | 173 | $scope.notaPedido.cliente = cliente.nom; |
... | ... | @@ -174,14 +175,14 @@ angular.module('focaCrearNotaPedido') |
174 | 175 | |
175 | 176 | } |
176 | 177 | ); |
177 | - } | |
178 | + }; | |
178 | 179 | $scope.obtenerDomicilios = function(id) { |
179 | 180 | crearNotaPedidoService.getDomicilios(id).then( |
180 | 181 | function(res) { |
181 | 182 | $scope.notaPedido.domicilio = res.data; |
182 | 183 | } |
183 | - ) | |
184 | - } | |
184 | + ); | |
185 | + }; | |
185 | 186 | $scope.getSubTotal = function(item) { |
186 | 187 | var subTotal = 0; |
187 | 188 | var array = $scope.articulosTabla.filter( |
... | ... | @@ -190,14 +191,31 @@ angular.module('focaCrearNotaPedido') |
190 | 191 | } |
191 | 192 | ); |
192 | 193 | for (var i = 0; i < array.length; i++) { |
193 | - subTotal += array[i].precio * array[i].cantidad | |
194 | + subTotal += array[i].precio * array[i].cantidad; | |
194 | 195 | } |
195 | 196 | return subTotal.toFixed(2); |
196 | - } | |
197 | + }; | |
197 | 198 | $scope.cargarArticulos = function() { |
198 | 199 | idLista = $scope.notaPedido.precioCondicion; |
199 | 200 | $scope.articulosTabla = []; |
200 | - } | |
201 | + }; | |
202 | + $scope.abrirModalListaPrecio = function() { | |
203 | + var modalInstance = $uibModal.open( | |
204 | + { | |
205 | + ariaLabelledBy: 'Busqueda de Precio Condiciรณn', | |
206 | + templateUrl: 'modal-precio-condicion.html', | |
207 | + controller: 'focaModalPrecioCondicionController', | |
208 | + size: 'lg' | |
209 | + } | |
210 | + ); | |
211 | + modalInstance.result.then( | |
212 | + function(precioCondicion) { | |
213 | + $scope.notaPedido.precioCondicion = precioCondicion.nombre; | |
214 | + }, function() { | |
215 | + | |
216 | + } | |
217 | + ); | |
218 | + }; | |
201 | 219 | } |
202 | 220 | ] |
203 | 221 | ) |
... | ... | @@ -212,10 +230,10 @@ angular.module('focaCrearNotaPedido') |
212 | 230 | $scope.editar = function(notaPedido) { |
213 | 231 | crearNotaPedidoService.setNotaPedido(notaPedido); |
214 | 232 | $location.path('/venta-nota-pedido/abm/'); |
215 | - } | |
233 | + }; | |
216 | 234 | $scope.crearPedido = function() { |
217 | 235 | crearNotaPedidoService.clearNotaPedido(); |
218 | 236 | $location.path('/venta-nota-pedido/abm/'); |
219 | - } | |
237 | + }; | |
220 | 238 | } |
221 | - ]) | |
239 | + ]); |
src/js/service.js
1 | 1 | angular.module('focaCrearNotaPedido') |
2 | 2 | .service('crearNotaPedidoService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { |
3 | 3 | var route = API_ENDPOINT.URL; |
4 | - var notaPedido; | |
5 | 4 | return { |
6 | 5 | crearNotaPedido: function(notaPedido) { |
7 | 6 | return $http.post(route + '/nota-pedido', {notaPedido: notaPedido}); |
... | ... | @@ -22,7 +21,8 @@ angular.module('focaCrearNotaPedido') |
22 | 21 | return $http.get(route+'/articulos/nota-pedido/'+id); |
23 | 22 | }, |
24 | 23 | crearArticulosParaNotaPedido: function(articuloNotaPedido) { |
25 | - return $http.post(route + '/articulos/nota-pedido', {articuloNotaPedido: articuloNotaPedido}); | |
24 | + return $http.post(route + '/articulos/nota-pedido', | |
25 | + {articuloNotaPedido: articuloNotaPedido}); | |
26 | 26 | }, |
27 | 27 | getDomiciliosByIdNotaPedido: function(id) { |
28 | 28 | return $http.get(route +'/nota-pedido/'+id+'/domicilios'); |
... | ... | @@ -30,6 +30,7 @@ angular.module('focaCrearNotaPedido') |
30 | 30 | //EN DESARROLLO |
31 | 31 | getDomicilios: function(id) { |
32 | 32 | // return $http.get(route + '/'+id) |
33 | + id='le asigno un valor para pasar pre commit'; | |
33 | 34 | var domicilio = [ |
34 | 35 | { |
35 | 36 | id: 1, |
... | ... | @@ -43,17 +44,17 @@ angular.module('focaCrearNotaPedido') |
43 | 44 | id: 3, |
44 | 45 | dom: 'SALTA 796' |
45 | 46 | } |
46 | - ] | |
47 | + ]; | |
47 | 48 | return domicilio; |
48 | 49 | }, |
49 | 50 | getPrecioCondicion: function() { |
50 | - return $http.get(route + '/precio-condicion') | |
51 | + return $http.get(route + '/precio-condicion'); | |
51 | 52 | }, |
52 | 53 | getPrecioCondicionById: function(id) { |
53 | - return $http.get(route + '/precio-condicion/' + id) | |
54 | + return $http.get(route + '/precio-condicion/' + id); | |
54 | 55 | }, |
55 | 56 | getPlazoPagoByPrecioCondicion: function(id) { |
56 | - return $http.get(route + '/plazo-pago/precio-condicion/'+ id) | |
57 | + return $http.get(route + '/plazo-pago/precio-condicion/'+ id); | |
57 | 58 | } |
58 | - } | |
59 | - }]) | |
59 | + }; | |
60 | + }]); |
src/views/nota-pedido.html