diff --git a/index.html b/index.html index fd948f1..149d34f 100644 --- a/index.html +++ b/index.html @@ -41,6 +41,10 @@ +
diff --git a/package.json b/package.json index ccc9639..b674fe2 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,13 @@ "peerDependencies": { "foca-busqueda-cliente": "git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git", "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git", + "foca-modal": "git+https://debo.suite.repo/modulos-npm/foca-modal.git", "foca-modal-busqueda-productos": "git+https://debo.suite.repo/modulos-npm/foca-modal-busqueda-productos", + "foca-modal-cotizacion": "git+https://debo.suite.repo/modulos-npm/foca-modal-cotizacion.git", + "foca-modal-domicilio": "git+https://debo.suite.repo/modulos-npm/foca-modal-domicilio.git", + "foca-modal-flete": "git+https://debo.suite.repo/modulos-npm/foca-modal-flete", + "foca-modal-moneda": "git+https://debo.suite.repo/modulos-npm/foca-modal-moneda.git", + "foca-modal-precio-condiciones": "git+https://debo.suite.repo/modulos-npm/foca-modal-precio-condiciones.git", "foca-modal-proveedor": "git+https://debo.suite.repo/modulos-npm/foca-modal-proveedor.git", "foca-modal-vendedores": "git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git", "foca-seguimiento": "git+https://debo.suite.repo/modulos-npm/foca-seguimiento.git" @@ -46,7 +52,7 @@ "foca-seguimiento": "git+https://debo.suite.repo/modulos-npm/foca-seguimiento.git", "font-awesome": "^4.7.0", "gulp": "^3.9.1", - "gulp-angular-templatecache": "^2.2.2", + "gulp-angular-templatecache": "^2.2.3", "gulp-clean": "^0.4.0", "gulp-concat": "^2.6.1", "gulp-connect": "^5.6.1", @@ -60,7 +66,7 @@ "jasmine-core": "^3.3.0", "jquery": "^3.3.1", "jshint": "^2.9.6", - "ladda": "1.0.6", + "ladda": "^1.0.6", "pre-commit": "^1.2.2", "pump": "^3.0.0", "ui-bootstrap4": "^3.0.5" diff --git a/src/js/controller.js b/src/js/controller.js index 95435d2..252efea 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -56,9 +56,8 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', $scope.showCabecera = true; $scope.now = new Date(); - $scope.puntoVenta = Math.round(Math.random() * 10000); - $scope.comprobante = Math.round(Math.random() * 1000000); - + $scope.puntoVenta = '0000'; + $scope.comprobante = '00000000'; $scope.articulosTabla = []; $scope.idLista = undefined; //La pantalla solo se usa para cargar pedidos @@ -69,6 +68,13 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', $scope.precioCondiciones = res.data; } ); + + crearNotaPedidoService.getNumeroNotaPedido().then( + function(res) { + $scope.puntoVenta = rellenar(res.data.sucursal, 4); + $scope.comprobante = rellenar(res.data.numeroNotaPedido, 8); + } + ); //La pantalla solo se usa para cargar pedidos // if (notaPedidoTemp !== undefined) { // notaPedidoTemp.fechaCarga = new Date(notaPedidoTemp.fechaCarga); @@ -166,6 +172,7 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', data.data.id, $scope.notaPedido.cotizacion.COTIZACION); focaSeguimientoService.guardarPosicion('crear nota pedido', ''); var plazos = $scope.plazosPagos; + for(var j = 0; j < plazos.length; j++) { var json = { idPedido: data.data.id, @@ -580,6 +587,15 @@ angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); } } + + function rellenar(relleno, longitud) { + relleno = '' + relleno; + while (relleno.length < longitud) { + relleno = '0' + relleno; + } + + return relleno; + } } ] ) diff --git a/src/js/service.js b/src/js/service.js index 70a0bdd..df3020d 100644 --- a/src/js/service.js +++ b/src/js/service.js @@ -51,6 +51,9 @@ angular.module('focaCrearNotaPedido') }, crearEstadoParaNotaPedido: function(estado) { return $http.post(route + '/estado', {estado: estado}); + }, + getNumeroNotaPedido: function() { + return $http.get(route + '/nota-pedido/numero-siguiente'); } }; }]);