Commit 81708862f2ef362b1722a12b92125f86053ba765
Exists in
master
Merge branch 'master' into 'master'
Master(EFERNANDEZ) See merge request modulos-npm/foca-crear-nota-pedido!49
Showing
9 changed files
Show diff stats
gulpfile.js
... | ... | @@ -46,7 +46,8 @@ gulp.task('uglify', ['templates'], function() { |
46 | 46 | replace('"ngRoute","ui.bootstrap","focaModalVendedores","focaBusquedaProductos",'+ |
47 | 47 | '"focaModalProveedor","focaBusquedaCliente","focaModalPrecioCondicion",'+ |
48 | 48 | '"focaModalFlete","focaDirectivas","focaModal","focaModalDomicilio",'+ |
49 | - '"focaModalMoneda","focaModalCotizacion","focaSeguimiento","angular-ladda"', ''), | |
49 | + '"focaModalMoneda","focaModalCotizacion","focaSeguimiento","angular-ladda",'+ | |
50 | + '"cordovaGeolocationModule"', ''), | |
50 | 51 | gulp.dest(paths.dist) |
51 | 52 | ] |
52 | 53 | ); |
index.html
... | ... | @@ -17,6 +17,7 @@ |
17 | 17 | <script src="node_modules/ladda/dist/spin.min.js"></script> |
18 | 18 | <script src="node_modules/ladda/dist/ladda.min.js"></script> |
19 | 19 | <script src="node_modules/angular-ladda/dist/angular-ladda.min.js"></script> |
20 | + <script src="vendor/cordovaGeolocationModule.min.js"></script> | |
20 | 21 | |
21 | 22 | <script src="node_modules/foca-directivas/dist/foca-directivas.min.js"></script> |
22 | 23 | <script src="node_modules/foca-modal-vendedores/dist/foca-modal-vendedores.min.js"></script> |
... | ... | @@ -34,6 +35,7 @@ |
34 | 35 | <script src="src/js/app.js"></script> |
35 | 36 | <script src="src/js/controller.js"></script> |
36 | 37 | <script src="src/js/service.js"></script> |
38 | + <script src="src/js/businessService.js"></script> | |
37 | 39 | <script src="src/js/route.js"></script> |
38 | 40 | |
39 | 41 | <script src="src/etc/develop.js"></script> |
package.json
... | ... | @@ -24,7 +24,7 @@ |
24 | 24 | "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git", |
25 | 25 | "foca-modal-busqueda-productos": "git+https://debo.suite.repo/modulos-npm/foca-modal-busqueda-productos", |
26 | 26 | "foca-modal-proveedor": "git+https://debo.suite.repo/modulos-npm/foca-modal-proveedor.git", |
27 | - "foca-modal-vendedores": "git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git" | |
27 | + "foca-modal-vendedores": "git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git", | |
28 | 28 | "foca-seguimiento": "git+https://debo.suite.repo/modulos-npm/foca-seguimiento.git" |
29 | 29 | }, |
30 | 30 | "devDependencies": { |
src/js/app.js
src/js/businessService.js
... | ... | @@ -0,0 +1,16 @@ |
1 | +angular.module('focaCrearNotaPedido') | |
2 | + .service('notaPedidoBusinessService', [ | |
3 | + 'crearNotaPedidoService', | |
4 | + function(crearNotaPedidoService) { | |
5 | + return { | |
6 | + addArticulos: function(articulosNotaPedido, idNotaPedido, cotizacion) { | |
7 | + for(var i = 0; i < articulosNotaPedido.length; i++) { | |
8 | + delete articulosNotaPedido[i].editCantidad; | |
9 | + delete articulosNotaPedido[i].editPrecio; | |
10 | + articulosNotaPedido[i].idNotaPedido = idNotaPedido; | |
11 | + articulosNotaPedido[i].precio = articulosNotaPedido[i].precio * cotizacion; | |
12 | + crearNotaPedidoService.crearArticulosParaNotaPedido(articulosNotaPedido[i]); | |
13 | + } | |
14 | + } | |
15 | + }; | |
16 | + }]); | |
0 | 17 | \ No newline at end of file |
src/js/controller.js
1 | 1 | angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
2 | 2 | [ |
3 | 3 | '$scope', '$uibModal', '$location', '$filter', 'crearNotaPedidoService', |
4 | - 'focaModalService', 'focaSeguimientoService', | |
4 | + 'focaModalService', 'focaSeguimientoService', 'notaPedidoBusinessService', | |
5 | 5 | function( |
6 | 6 | $scope, $uibModal, $location, $filter, crearNotaPedidoService, focaModalService, |
7 | - focaSeguimientoService | |
7 | + focaSeguimientoService, notaPedidoBusinessService | |
8 | 8 | ) { |
9 | 9 | $scope.botonera = [ |
10 | 10 | {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}}, |
... | ... | @@ -156,15 +156,9 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
156 | 156 | }; |
157 | 157 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( |
158 | 158 | function(data) { |
159 | + notaPedidoBusinessService.addArticulos($scope.articulosTabla, | |
160 | + data.data.id, $scope.notaPedido.cotizacion.COTIZACION); | |
159 | 161 | focaSeguimientoService.guardarPosicion('crear nota pedido', ''); |
160 | - var articulosNotaPedido = $scope.articulosTabla; | |
161 | - for(var i = 0; i < articulosNotaPedido.length; i++) { | |
162 | - delete articulosNotaPedido[i].editCantidad; | |
163 | - delete articulosNotaPedido[i].editPrecio; | |
164 | - articulosNotaPedido[i].idNotaPedido = data.data.id; | |
165 | - crearNotaPedidoService | |
166 | - .crearArticulosParaNotaPedido(articulosNotaPedido[i]); | |
167 | - } | |
168 | 162 | var plazos = $scope.plazosPagos; |
169 | 163 | for(var j = 0; j < plazos.length; j++) { |
170 | 164 | var json = { |
... | ... | @@ -180,7 +174,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
180 | 174 | 'Fecha cotizacion:', |
181 | 175 | $filter('date')($scope.notaPedido.cotizacion.FECHA, 'dd/MM/yyyy') |
182 | 176 | ); |
183 | - addCabecera('Cotizacion:', $scope.notaPedido.cotizacion.cotizacion); | |
177 | + addCabecera('Cotizacion:', $scope.notaPedido.cotizacion.COTIZACION); | |
184 | 178 | $scope.notaPedido.vendedor = {}; |
185 | 179 | $scope.notaPedido.cliente = {}; |
186 | 180 | $scope.notaPedido.proveedor = {}; |
... | ... | @@ -206,8 +200,11 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
206 | 200 | templateUrl: 'modal-busqueda-productos.html', |
207 | 201 | controller: 'modalBusquedaProductosCtrl', |
208 | 202 | resolve: { |
209 | - idLista: function() { return $scope.idLista; }, | |
210 | - cotizacion: $scope.notaPedido.cotizacion.COTIZACION | |
203 | + parametroProducto: { | |
204 | + idLista: $scope.idLista, | |
205 | + cotizacion: $scope.notaPedido.cotizacion.COTIZACION, | |
206 | + simbolo: $scope.notaPedido.moneda.simbolo | |
207 | + } | |
211 | 208 | }, |
212 | 209 | size: 'lg' |
213 | 210 | } |
... | ... | @@ -223,7 +220,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
223 | 220 | descripcion: producto.descripcion, |
224 | 221 | item: $scope.articulosTabla.length + 1, |
225 | 222 | nombre: producto.descripcion, |
226 | - precio: parseFloat(producto.precio.toFixed(2)), | |
223 | + precio: parseFloat(producto.precio.toFixed(4)), | |
227 | 224 | costoUnitario: producto.costo, |
228 | 225 | editCantidad: false, |
229 | 226 | editPrecio: false |
... | ... | @@ -425,7 +422,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
425 | 422 | ($scope.notaPedido.fob ? 'FOB' : 'No')); |
426 | 423 | if(datos.flete) { |
427 | 424 | addCabecera('Bomba:', datos.bomba ? 'Si' : 'No'); |
428 | - addCabecera('Kilometros:', datos.kilometros ? 'Si' : 'No'); | |
425 | + addCabecera('Kilometros:', datos.kilometros); | |
429 | 426 | } else { |
430 | 427 | removeCabecera('Bomba:'); |
431 | 428 | removeCabecera('Kilometros:'); |
... | ... | @@ -485,7 +482,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
485 | 482 | $scope.notaPedido.cotizacion = { |
486 | 483 | ID: cotizacion.ID, |
487 | 484 | COTIZACION: cotizacion.COTIZACION, |
488 | - FECHA: cotizacion.fecha | |
485 | + FECHA: cotizacion.FECHA | |
489 | 486 | }; |
490 | 487 | addCabecera('Moneda:', moneda.DETALLE); |
491 | 488 | addCabecera( |
src/js/service.js
... | ... | @@ -48,6 +48,15 @@ angular.module('focaCrearNotaPedido') |
48 | 48 | }, |
49 | 49 | getCotizacionByIdMoneda: function(id) { |
50 | 50 | return $http.get(route + '/moneda/' + id); |
51 | + }, | |
52 | + addArticulos: function(articulosNotaPedido, idNotaPedido, cotizacion) { | |
53 | + for(var i = 0; i < articulosNotaPedido.length; i++) { | |
54 | + delete articulosNotaPedido[i].editCantidad; | |
55 | + delete articulosNotaPedido[i].editPrecio; | |
56 | + articulosNotaPedido[i].idNotaPedido = idNotaPedido; | |
57 | + articulosNotaPedido[i].precio = articulosNotaPedido[i].precio * cotizacion; | |
58 | + this.crearArticulosParaNotaPedido(articulosNotaPedido[i]); | |
59 | + } | |
51 | 60 | } |
52 | 61 | }; |
53 | 62 | }]); |
src/views/nota-pedido.html
... | ... | @@ -124,7 +124,7 @@ |
124 | 124 | class="col" |
125 | 125 | ng-bind="articulo.sector + '-' + articulo.codigo" |
126 | 126 | ></td> |
127 | - <td | |
127 | + <td | |
128 | 128 | class="col-4" |
129 | 129 | ng-bind="articulo.descripcion" |
130 | 130 | ></td> |
... | ... | @@ -153,7 +153,7 @@ |
153 | 153 | class="form-control" |
154 | 154 | type="number" |
155 | 155 | min="1" |
156 | - step="0.01" | |
156 | + step="0.0001" | |
157 | 157 | foca-focus="articulo.editPrecio" |
158 | 158 | ng-keypress="editarArticulo($event.keyCode, articulo)" |
159 | 159 | ng-focus="selectFocus($event)" |
... | ... | @@ -162,12 +162,12 @@ |
162 | 162 | class="selectable" |
163 | 163 | ng-click="idLista == -1 && cambioEdit(articulo, 'precio')" |
164 | 164 | ng-hide="articulo.editPrecio" |
165 | - ng-bind="articulo.precio | currency: '$'"> | |
165 | + ng-bind="articulo.precio | currency: notaPedido.moneda.simbolo : 4"> | |
166 | 166 | </i> |
167 | 167 | </td> |
168 | 168 | <td |
169 | 169 | class="col text-right" |
170 | - ng-bind="(articulo.precio * articulo.cantidad) | currency: '$'"> | |
170 | + ng-bind="(articulo.precio * articulo.cantidad) | currency: notaPedido.moneda.simbolo"> | |
171 | 171 | </td> |
172 | 172 | <td class="text-center"> |
173 | 173 | <button |
... | ... | @@ -213,14 +213,14 @@ |
213 | 213 | <td class="col text-right"> |
214 | 214 | <input |
215 | 215 | class="form-control" |
216 | - ng-value="articuloACargar.precio | currency: '$'" | |
216 | + ng-value="articuloACargar.precio | currency: notaPedido.moneda.simbolo : 4" | |
217 | 217 | ng-show="idLista != -1" |
218 | 218 | readonly |
219 | 219 | > |
220 | 220 | <input |
221 | 221 | class="form-control" |
222 | 222 | type="number" |
223 | - step="0.01" | |
223 | + step="0.0001" | |
224 | 224 | ng-model="articuloACargar.precio" |
225 | 225 | esc-key="resetFilter()" |
226 | 226 | ng-keypress="agregarATabla($event.keyCode)" |
... | ... | @@ -230,7 +230,7 @@ |
230 | 230 | <td class="col text-right"> |
231 | 231 | <input |
232 | 232 | class="form-control" |
233 | - ng-value="getSubTotal() | currency: '$'" | |
233 | + ng-value="getSubTotal() | currency: notaPedido.moneda.simbolo" | |
234 | 234 | readonly |
235 | 235 | ></td> |
236 | 236 | <td class="text-center align-middle"> |
... | ... | @@ -261,7 +261,7 @@ |
261 | 261 | <h3>Total:</h3> |
262 | 262 | </td> |
263 | 263 | <td class="table-celda-total text-right no-border-top" colspan="1"> |
264 | - <h3>{{getTotal() | currency: '$'}}</h3> | |
264 | + <h3>{{getTotal() | currency: notaPedido.moneda.simbolo}}</h3> | |
265 | 265 | </td> |
266 | 266 | <td class="text-right no-border-top"> |
267 | 267 | <button |
... | ... | @@ -323,11 +323,11 @@ |
323 | 323 | <span ng-bind="'x' + articulo.cantidad"></span> |
324 | 324 | </div> |
325 | 325 | <div class="col-3 px-1 text-right"> |
326 | - <span ng-bind="articulo.precio | currency: '$'"></span> | |
326 | + <span ng-bind="articulo.precio | currency: notaPedido.moneda.simbolo : 4"></span> | |
327 | 327 | </div> |
328 | 328 | <div class="col px-1 text-right"> |
329 | 329 | <span |
330 | - ng-bind="(articulo.precio * articulo.cantidad) | currency: '$'" | |
330 | + ng-bind="(articulo.precio * articulo.cantidad) | currency: notaPedido.moneda.simbolo" | |
331 | 331 | > |
332 | 332 | </span> |
333 | 333 | </div> |
... | ... | @@ -375,11 +375,11 @@ |
375 | 375 | > |
376 | 376 | </div> |
377 | 377 | <div class="col-3 px-1 text-right"> |
378 | - <span ng-bind="articuloACargar.precio | currency: '$'"></span> | |
378 | + <span ng-bind="articuloACargar.precio | currency: notaPedido.moneda.simbolo : 4"></span> | |
379 | 379 | </div> |
380 | 380 | <div class="col px-1 text-right"> |
381 | 381 | <span |
382 | - ng-bind="getSubTotal() | currency: '$'" | |
382 | + ng-bind="getSubTotal() | currency: notaPedido.moneda.simbolo" | |
383 | 383 | > |
384 | 384 | </span> |
385 | 385 | </div> |
... | ... | @@ -437,7 +437,7 @@ |
437 | 437 | <h3>Total:</h3> |
438 | 438 | </td> |
439 | 439 | <td class="table-celda-total text-right no-border-top"> |
440 | - <h3>{{getTotal() | currency: '$'}}</h3> | |
440 | + <h3>{{getTotal() | currency: notaPedido.moneda.simbolo}}</h3> | |
441 | 441 | </td> |
442 | 442 | </tr> |
443 | 443 | </tfoot> |
vendor/cordovaGeolocationModule.min.js
... | ... | @@ -0,0 +1 @@ |
1 | +var cordovaGeolocationModule=angular.module("cordovaGeolocationModule",[]);cordovaGeolocationModule.constant("cordovaGeolocationConstants",{apiVersion:"1.0.0",cordovaVersion:">=3.4.0"});cordovaGeolocationModule.factory("cordovaGeolocationService",["$rootScope","$log","cordovaGeolocationConstants",function(e,t,n){return{apiVersion:function(){t.debug("cordovaGeolocationService.apiVersion.");return n.apiVersion},cordovaVersion:function(){t.debug("cordovaGeolocationService.cordovaVersion.");return n.cordovaVersion},checkGeolocationAvailability:function(){t.debug("cordovaGeolocationService.checkGeolocationAvailability.");if(!navigator.geolocation){t.warn("Geolocation API is not available.");return false}return true},getCurrentPosition:function(n,r,i){t.debug("cordovaGeolocationService.getCurrentPosition.");if(!this.checkGeolocationAvailability()){return}navigator.geolocation.getCurrentPosition(function(t){e.$apply(n(t))},function(t){e.$apply(r(t))},i)},watchPosition:function(n,r,i){t.debug("cordovaGeolocationService.watchPosition.");if(!this.checkGeolocationAvailability()){return}return navigator.geolocation.watchPosition(function(t){e.$apply(n(t))},function(t){e.$apply(r(t))},i)},clearWatch:function(e){t.debug("cordovaGeolocationService.clearWatch.");if(!this.checkGeolocationAvailability()){return}navigator.geolocation.clearWatch(e)}}}]) | |
0 | 2 | \ No newline at end of file |