Commit bc4f536b4fe4d5dd55549bb1308d1508a3ab7161
Exists in
master
and in
1 other branch
Merge branch 'master' into 'master'
numero remito verdadero See merge request modulos-npm/foca-crear-remito!2
Showing
5 changed files
 
Show diff stats
index.html
| ... | ... | @@ -13,6 +13,7 @@ | 
| 13 | 13 | <script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script> | 
| 14 | 14 | <script src="node_modules/angular/angular.min.js"></script> | 
| 15 | 15 | <script src="node_modules/angular-route/angular-route.min.js"></script> | 
| 16 | + <script src="node_modules/angular-cookies/angular-cookies.min.js"></script> | |
| 16 | 17 | <script src="node_modules/ui-bootstrap4/dist/ui-bootstrap-tpls.js"></script> | 
| 17 | 18 | <script src="node_modules/ladda/dist/spin.min.js"></script> | 
| 18 | 19 | <script src="node_modules/ladda/dist/ladda.min.js"></script> | 
| ... | ... | @@ -28,6 +29,7 @@ | 
| 28 | 29 | <script src="node_modules/foca-modal-flete/dist/foca-modal-flete.min.js"></script> | 
| 29 | 30 | <script src="node_modules/foca-modal/dist/foca-modal.min.js"></script> | 
| 30 | 31 | <script src="node_modules/foca-modal-domicilio/dist/foca-modal-domicilios.min.js"></script> | 
| 32 | + <script src="./node_modules/foca-configuracion/dist/foca-configuracion.min.js"></script> | |
| 31 | 33 | <script src="node_modules/foca-modal-moneda/dist/foca-modal-moneda.min.js"></script> | 
| 32 | 34 | <script src="node_modules/foca-modal-cotizacion/dist/foca-modal-cotizacion.min.js"></script> | 
| 33 | 35 | <script src="node_modules/foca-seguimiento/dist/foca-seguimiento.min.js"></script> | 
package.json
| ... | ... | @@ -8,7 +8,7 @@ | 
| 8 | 8 | "compile": "gulp uglify", | 
| 9 | 9 | "gulp-pre-commit": "gulp pre-commit", | 
| 10 | 10 | "postinstall": "npm run compile && gulp clean-post-install", | 
| 11 | - "install-dev": "npm install -D jasmine-core pre-commit angular angular-ladda ladda@1.0.6 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-proveedor.git git+https://debo.suite.repo/modulos-npm/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 git+https://debo.suite.repo/modulos-npm/foca-modal-flete git+https://debo.suite.repo/modulos-npm/foca-modal.git git+https://debo.suite.repo/modulos-npm/foca-modal-domicilio.git git+https://debo.suite.repo/modulos-npm/foca-seguimiento.git git+https://debo.suite.repo/modulos-npm/foca-modal-moneda.git git+https://debo.suite.repo/modulos-npm/foca-modal-cotizacion.git" | |
| 11 | + "install-dev": "npm install -D jasmine-core pre-commit angular angular-ladda ladda@1.0.6 angular-route angular-cookies 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-proveedor.git git+https://debo.suite.repo/modulos-npm/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 git+https://debo.suite.repo/modulos-npm/foca-modal-flete git+https://debo.suite.repo/modulos-npm/foca-modal.git git+https://debo.suite.repo/modulos-npm/foca-modal-domicilio.git git+https://debo.suite.repo/modulos-npm/foca-seguimiento.git git+https://debo.suite.repo/modulos-npm/foca-modal-moneda.git git+https://debo.suite.repo/modulos-npm/foca-modal-cotizacion.git git+https://debo.suite.repo/modulos-npm/foca-configuracion.git" | |
| 12 | 12 | }, | 
| 13 | 13 | "pre-commit": [ | 
| 14 | 14 | "gulp-pre-commit" | 
| ... | ... | @@ -63,6 +63,8 @@ | 
| 63 | 63 | "ladda": "1.0.6", | 
| 64 | 64 | "pre-commit": "^1.2.2", | 
| 65 | 65 | "pump": "^3.0.0", | 
| 66 | - "ui-bootstrap4": "^3.0.5" | |
| 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" | |
| 67 | 69 | } | 
| 68 | 70 | } | 
src/js/app.js
| 1 | 1 | angular.module('focaCrearRemito', [ | 
| 2 | 2 | 'ngRoute', | 
| 3 | + 'ngCookies', | |
| 3 | 4 | 'ui.bootstrap', | 
| 4 | 5 | 'focaModalVendedores', | 
| 5 | 6 | 'focaBusquedaProductos', | 
| ... | ... | @@ -12,7 +13,6 @@ angular.module('focaCrearRemito', [ | 
| 12 | 13 | 'focaModalDomicilio', | 
| 13 | 14 | 'focaModalMoneda', | 
| 14 | 15 | 'focaModalCotizacion', | 
| 15 | - 'focaSeguimiento', | |
| 16 | - 'angular-ladda', | |
| 17 | - 'cordovaGeolocationModule' | |
| 16 | + 'focaConfiguracion', | |
| 17 | + 'angular-ladda' | |
| 18 | 18 | ]); | 
src/js/controller.js
| 1 | 1 | angular.module('focaCrearRemito') .controller('remitoController', | 
| 2 | 2 | [ | 
| 3 | 3 | '$scope', '$uibModal', '$location', '$filter', 'crearRemitoService', | 
| 4 | - 'focaModalService', 'focaSeguimientoService', 'remitoBusinessService', | |
| 4 | + 'focaModalService', 'remitoBusinessService', | |
| 5 | 5 | function( | 
| 6 | 6 | $scope, $uibModal, $location, $filter, crearRemitoService, focaModalService, | 
| 7 | - focaSeguimientoService, remitoBusinessService | |
| 7 | + remitoBusinessService | |
| 8 | 8 | ) { | 
| 9 | 9 | $scope.botonera = [ | 
| 10 | 10 | {texto: 'Nota Pedido', accion: function() {$scope.seleccionarNotaPedido();}}, | 
| ... | ... | @@ -69,6 +69,18 @@ angular.module('focaCrearRemito') .controller('remitoController', | 
| 69 | 69 | $scope.precioCondiciones = res.data; | 
| 70 | 70 | } | 
| 71 | 71 | ); | 
| 72 | + | |
| 73 | + crearRemitoService.getNumeroRemito().then( | |
| 74 | + function(res) { | |
| 75 | + $scope.puntoVenta = rellenar(res.data.sucursal, 4); | |
| 76 | + $scope.comprobante = rellenar(res.data.numeroNotaPedido, 8); | |
| 77 | + }, | |
| 78 | + function(err) { | |
| 79 | + focaModalService.alert('La terminal no esta configurada correctamente'); | |
| 80 | + console.info(err); | |
| 81 | + } | |
| 82 | + ); | |
| 83 | + | |
| 72 | 84 | $scope.seleccionarNotaPedido = function() { | 
| 73 | 85 | var modalInstance = $uibModal.open( | 
| 74 | 86 | { | 
| ... | ... | @@ -107,7 +119,8 @@ angular.module('focaCrearRemito') .controller('remitoController', | 
| 107 | 119 | // funcion ejecutada cuando se cancela el modal | 
| 108 | 120 | } | 
| 109 | 121 | ); | 
| 110 | - } | |
| 122 | + }; | |
| 123 | + | |
| 111 | 124 | $scope.seleccionarRemito = function() { | 
| 112 | 125 | var modalInstance = $uibModal.open( | 
| 113 | 126 | { | 
| ... | ... | @@ -146,7 +159,8 @@ angular.module('focaCrearRemito') .controller('remitoController', | 
| 146 | 159 | // funcion ejecutada cuando se cancela el modal | 
| 147 | 160 | } | 
| 148 | 161 | ); | 
| 149 | - } | |
| 162 | + }; | |
| 163 | + | |
| 150 | 164 | //La pantalla solo se usa para cargar remitos | 
| 151 | 165 | // if (remitoTemp !== undefined) { | 
| 152 | 166 | // remitoTemp.fechaCarga = new Date(remitoTemp.fechaCarga); | 
| ... | ... | @@ -242,7 +256,6 @@ angular.module('focaCrearRemito') .controller('remitoController', | 
| 242 | 256 | function(data) { | 
| 243 | 257 | remitoBusinessService.addArticulos($scope.articulosTabla, | 
| 244 | 258 | data.data.id, $scope.remito.cotizacion.COTIZACION); | 
| 245 | - focaSeguimientoService.guardarPosicion('crear nota remito', ''); | |
| 246 | 259 | var plazos = $scope.plazosPagos; | 
| 247 | 260 | for(var j = 0; j < plazos.length; j++) { | 
| 248 | 261 | var json = { | 
| ... | ... | @@ -658,6 +671,15 @@ angular.module('focaCrearRemito') .controller('remitoController', | 
| 658 | 671 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); | 
| 659 | 672 | } | 
| 660 | 673 | } | 
| 674 | + | |
| 675 | + function rellenar(relleno, longitud) { | |
| 676 | + relleno = '' + relleno; | |
| 677 | + while (relleno.length < longitud) { | |
| 678 | + relleno = '0' + relleno; | |
| 679 | + } | |
| 680 | + | |
| 681 | + return relleno; | |
| 682 | + } | |
| 661 | 683 | } | 
| 662 | 684 | ] | 
| 663 | 685 | ) | 
src/js/service.js
| ... | ... | @@ -52,6 +52,9 @@ angular.module('focaCrearRemito') | 
| 52 | 52 | }, | 
| 53 | 53 | crearEstadoParaRemito: function(estado) { | 
| 54 | 54 | return $http.post(route + '/estado', {estado: estado}); | 
| 55 | + }, | |
| 56 | + getNumeroRemito: function() { | |
| 57 | + return $http.get(route + '/nota-pedido/numero-siguiente'); | |
| 55 | 58 | } | 
| 56 | 59 | }; | 
| 57 | 60 | }]); |