Commit 2813aeb8f7482fec3f23fef656c7044202656017

Authored by Pablo Marco del Pont
Exists in master

Merge branch 'master' into 'master'

Master(efernandez)

See merge request modulos-npm/foca-crear-nota-pedido!39
... ... @@ -45,7 +45,8 @@ gulp.task('uglify', ['templates'], function() {
45 45 uglify(),
46 46 replace('"ngRoute","ui.bootstrap","focaModalVendedores","focaBusquedaProductos",'+
47 47 '"focaModalProveedor","focaBusquedaCliente","focaModalPrecioCondicion",'+
48   - '"focaModalFlete","focaDirectivas","focaModal","focaModalDomicilio"', ''),
  48 + '"focaModalFlete","focaDirectivas","focaModal","focaModalDomicilio",'+
  49 + '"angular-ladda"', ''),
49 50 gulp.dest(paths.dist)
50 51 ]
51 52 );
... ... @@ -6,6 +6,7 @@
6 6 <!--CSS-->
7 7 <link href="node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"/>
8 8 <link href="node_modules/font-awesome/css/font-awesome.min.css" rel="stylesheet"/>
  9 + <link href="node_modules/ladda/dist/ladda-themeless.min.css" rel="stylesheet">
9 10  
10 11 <!--VENDOR JS-->
11 12 <script src="node_modules/jquery/dist/jquery.min.js"></script>
... ... @@ -13,6 +14,9 @@
13 14 <script src="node_modules/angular/angular.min.js"></script>
14 15 <script src="node_modules/angular-route/angular-route.min.js"></script>
15 16 <script src="node_modules/ui-bootstrap4/dist/ui-bootstrap-tpls.js"></script>
  17 + <script src="node_modules/ladda/dist/spin.min.js"></script>
  18 + <script src="node_modules/ladda/dist/ladda.min.js"></script>
  19 + <script src="node_modules/angular-ladda/dist/angular-ladda.min.js"></script>
16 20  
17 21 <script src="node_modules/foca-directivas/dist/foca-directivas.min.js"></script>
18 22 <script src="node_modules/foca-modal-vendedores/dist/foca-modal-vendedores.min.js"></script>
... ... @@ -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-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"
  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"
12 12 },
13 13 "pre-commit": [
14 14 "gulp-pre-commit"
... ... @@ -28,6 +28,7 @@
28 28 },
29 29 "devDependencies": {
30 30 "angular": "^1.7.5",
  31 + "angular-ladda": "^0.4.3",
31 32 "angular-route": "^1.7.5",
32 33 "bootstrap": "^4.1.3",
33 34 "foca-busqueda-cliente": "git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git",
... ... @@ -55,6 +56,7 @@
55 56 "jasmine-core": "^3.3.0",
56 57 "jquery": "^3.3.1",
57 58 "jshint": "^2.9.6",
  59 + "ladda": "1.0.6",
58 60 "pre-commit": "^1.2.2",
59 61 "pump": "^3.0.0",
60 62 "ui-bootstrap4": "^3.0.5"
... ... @@ -9,5 +9,6 @@ angular.module(&#39;focaCrearNotaPedido&#39;, [
9 9 'focaModalFlete',
10 10 'focaDirectivas',
11 11 'focaModal',
12   - 'focaModalDomicilio'
  12 + 'focaModalDomicilio',
  13 + 'angular-ladda'
13 14 ]);
src/js/controller.js
... ... @@ -108,7 +108,6 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
108 108 };
109 109 crearNotaPedidoService.crearNotaPedido(notaPedido).then(
110 110 function(data) {
111   - focaModalService.alert('Nota pedido creada');
112 111 if($scope.notaPedido.flete === 1) {
113 112 var flete = {
114 113 idNotaPedido: data.data.id,
... ... @@ -127,6 +126,15 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
127 126 crearNotaPedidoService
128 127 .crearArticulosParaNotaPedido(articulosNotaPedido[i]);
129 128 }
  129 + var plazos = $scope.plazosPagos;
  130 + for(var j = 0; j < plazos.length; j++) {
  131 + var json = {
  132 + idPedido: data.data.id,
  133 + dias: plazos[j].dias
  134 + };
  135 + crearNotaPedidoService.crearPlazosParaNotaPedido(json);
  136 + }
  137 + focaModalService.alert('Nota pedido creada');
130 138 $scope.limpiarPantalla();
131 139 }
132 140 );
... ... @@ -312,7 +320,7 @@ angular.module(&#39;focaCrearNotaPedido&#39;) .controller(&#39;notaPedidoCtrl&#39;,
312 320 cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim();
313 321 } else { //Cuando se ingresan los plazos manualmente
314 322 idLista = -1; //-1, el modal productos busca todos los productos
315   - $scope.notaPedido.plazoPago = precioCondicion;
  323 + $scope.plazosPagos = precioCondicion;
316 324 for(var j = 0; j < precioCondicion.length; j++) {
317 325 plazosConcat += precioCondicion[j].dias + ' ';
318 326 }
... ... @@ -42,6 +42,9 @@ angular.module(&#39;focaCrearNotaPedido&#39;)
42 42 },
43 43 crearFlete: function(flete) {
44 44 return $http.post(route + '/flete', {flete : flete});
  45 + },
  46 + crearPlazosParaNotaPedido: function(plazos) {
  47 + return $http.post(route + '/plazo-pago/nota-pedido', plazos);
45 48 }
46 49 };
47 50 }]);