Commit c24b866c3a271d620b4db9a013348cb1fa77bf78
Exists in
master
Merge branch 'master' into 'master'
Master(efernandez) See merge request modulos-npm/foca-abm-precios-condiciones!2
Showing
5 changed files
Show diff stats
gulpfile.js
| ... | ... | @@ -40,7 +40,7 @@ gulp.task('uglify', ['templates'], function() { |
| 40 | 40 | ]), |
| 41 | 41 | concat('foca-abm-precios-condiciones.js'), |
| 42 | 42 | replace('src/views/', ''), |
| 43 | - replace("['ngRoute', 'ui.bootstrap']", '[]'), | |
| 43 | + replace("['ngRoute', 'ui.bootstrap', 'focaModal']", '[]'), | |
| 44 | 44 | gulp.dest(paths.tmp), |
| 45 | 45 | rename('foca-abm-precios-condiciones.min.js'), |
| 46 | 46 | uglify(), |
index.html
| 1 | 1 | <html ng-app="focaAbmPreciosCondiciones"> |
| 2 | - <head> | |
| 3 | - <meta charset="UTF-8" /> | |
| 4 | - <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
| 5 | 2 | |
| 6 | - <!--CSS--> | |
| 7 | - <link href="node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet" /> | |
| 8 | - <link href="node_modules/font-awesome/css/font-awesome.min.css" rel="stylesheet" /> | |
| 3 | +<head> | |
| 4 | + <meta charset="UTF-8" /> | |
| 5 | + <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
| 9 | 6 | |
| 10 | - <!--VENDOR JS--> | |
| 11 | - <script src="node_modules/jquery/dist/jquery.min.js"></script> | |
| 12 | - <script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script> | |
| 13 | - <script src="node_modules/angular/angular.min.js"></script> | |
| 14 | - <script src="node_modules/angular-route/angular-route.min.js"></script> | |
| 15 | - <script src="node_modules/ui-bootstrap4/dist/ui-bootstrap-tpls.js"></script> | |
| 7 | + <!--CSS--> | |
| 8 | + <link href="node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet" /> | |
| 9 | + <link href="node_modules/font-awesome/css/font-awesome.min.css" rel="stylesheet" /> | |
| 10 | + | |
| 11 | + <!--VENDOR JS--> | |
| 12 | + <script src="node_modules/jquery/dist/jquery.min.js"></script> | |
| 13 | + <script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script> | |
| 14 | + <script src="node_modules/angular/angular.min.js"></script> | |
| 15 | + <script src="node_modules/angular-route/angular-route.min.js"></script> | |
| 16 | + <script src="node_modules/ui-bootstrap4/dist/ui-bootstrap-tpls.js"></script> | |
| 17 | + <script src="node_modules/foca-modal/dist/foca-modal.min.js"></script> | |
| 18 | + | |
| 19 | + <!-- BUILD --> | |
| 20 | + <script src="src/js/app.js"></script> | |
| 21 | + <script src="src/js/route.js"></script> | |
| 22 | + <script src="src/js/controller.js"></script> | |
| 23 | + <script src="src/js/service.js"></script> | |
| 24 | + <script src="src/etc/develop.js"></script> | |
| 25 | + <!-- /BUILD --> | |
| 26 | + | |
| 27 | +<body> | |
| 28 | + <div ng-view> | |
| 29 | + </div> | |
| 30 | +</body> | |
| 16 | 31 | |
| 17 | - <!-- BUILD --> | |
| 18 | - <script src="src/js/app.js"></script> | |
| 19 | - <script src="src/js/route.js"></script> | |
| 20 | - <script src="src/js/controller.js"></script> | |
| 21 | - <script src="src/js/service.js"></script> | |
| 22 | - <script src="src/etc/develop.js"></script> | |
| 23 | - <!-- /BUILD --> | |
| 24 | - </head> | |
| 25 | - <body> | |
| 26 | - <div ng-view></div> | |
| 27 | - </body> | |
| 28 | 32 | </html> |
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-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" | |
| 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 gulp-replace jquery jshint pump git+https://192.168.0.11/modulos-npm/foca-modal.git" | |
| 12 | 12 | }, |
| 13 | 13 | "pre-commit": [ |
| 14 | 14 | "gulp-pre-commit" |
| ... | ... | @@ -37,6 +37,7 @@ |
| 37 | 37 | "angular": "^1.7.4", |
| 38 | 38 | "angular-route": "^1.7.5", |
| 39 | 39 | "bootstrap": "^4.1.3", |
| 40 | + "foca-modal": "git+https://192.168.0.11/modulos-npm/foca-modal.git", | |
| 40 | 41 | "font-awesome": "^4.7.0", |
| 41 | 42 | "gulp": "^3.9.1", |
| 42 | 43 | "gulp-angular-templatecache": "^2.2.1", |
| ... | ... | @@ -47,6 +48,7 @@ |
| 47 | 48 | "gulp-rename": "^1.4.0", |
| 48 | 49 | "gulp-replace": "^1.0.0", |
| 49 | 50 | "gulp-sequence": "^1.0.0", |
| 51 | + "gulp-uglify": "^3.0.1", | |
| 50 | 52 | "gulp-uglify-es": "^1.0.4", |
| 51 | 53 | "jasmine-core": "^3.2.1", |
| 52 | 54 | "jquery": "^3.3.1", |
src/js/app.js
src/js/controller.js
| 1 | 1 | angular.module('focaAbmPreciosCondiciones') |
| 2 | 2 | .controller('focaAbmPreciosCondicionesController', [ |
| 3 | - '$scope', 'focaAbmPreciosCondicionesService', '$location', '$uibModal', | |
| 4 | - function($scope, focaAbmPreciosCondicionesService, $location, $uibModal) { | |
| 3 | + '$scope', 'focaAbmPreciosCondicionesService', '$location', 'focaModalService', | |
| 4 | + function($scope, focaAbmPreciosCondicionesService, $location, focaModalService) { | |
| 5 | 5 | focaAbmPreciosCondicionesService.obtenerPreciosCondiciones().then(function(datos) { |
| 6 | 6 | $scope.preciosCondiciones = datos.data; |
| 7 | 7 | }); |
| ... | ... | @@ -9,28 +9,27 @@ angular.module('focaAbmPreciosCondiciones') |
| 9 | 9 | $location.path('/precio-condicion/' + id); |
| 10 | 10 | }; |
| 11 | 11 | $scope.solicitarConfirmacion = function(precioCondicion) { |
| 12 | - $uibModal.open({ | |
| 13 | - templateUrl: 'foca-abm-precios-condiciones-modal-confirmar.html', | |
| 14 | - controller: 'focaAbmPreciosCondicionesModalConfirmarController', | |
| 15 | - animation: false, | |
| 16 | - backdrop: false, | |
| 17 | - resolve: {precioCondicion: function(){return precioCondicion;}} | |
| 18 | - }) | |
| 19 | - .result.then(function(precioCondicion){ | |
| 20 | - focaAbmPreciosCondicionesService.borrarPrecioCondicion(precioCondicion.id); | |
| 21 | - $scope.preciosCondiciones.splice( | |
| 22 | - $scope.preciosCondiciones.indexOf(precioCondicion), 1 | |
| 12 | + focaModalService.confirm('¿Está seguro que desea borrar el precio condición' + | |
| 13 | + precioCondicion.codigo + ' ' + precioCondicion.nombre + ' ?').then( | |
| 14 | + function(data) { | |
| 15 | + if (data) { | |
| 16 | + focaAbmPreciosCondicionesService | |
| 17 | + .borrarPrecioCondicion(precioCondicion.id); | |
| 18 | + $scope.preciosCondiciones.splice( | |
| 19 | + $scope.preciosCondiciones.indexOf(precioCondicion), 1 | |
| 20 | + ); | |
| 21 | + } | |
| 22 | + } | |
| 23 | 23 | ); |
| 24 | - }); | |
| 25 | 24 | }; |
| 26 | 25 | } |
| 27 | 26 | ]) |
| 28 | 27 | .controller('focaAbmPrecioCondicionController', [ |
| 29 | 28 | '$scope', 'focaAbmPreciosCondicionesService', |
| 30 | - '$routeParams', '$location', '$uibModal', | |
| 29 | + '$routeParams', '$location', 'focaModalService', | |
| 31 | 30 | function( |
| 32 | 31 | $scope, focaAbmPreciosCondicionesService, |
| 33 | - $routeParams, $location, $uibModal | |
| 32 | + $routeParams, $location, focaModalService | |
| 34 | 33 | ) { |
| 35 | 34 | $scope.mostrarPlazos = $routeParams.id > 0; |
| 36 | 35 | focaAbmPreciosCondicionesService.obtenerPrecioCondicion($routeParams.id) |
| ... | ... | @@ -43,10 +42,10 @@ angular.module('focaAbmPreciosCondiciones') |
| 43 | 42 | idListaPrecio: 0, |
| 44 | 43 | vigencia: new Date() |
| 45 | 44 | }; |
| 46 | - if(datos.data.id) { | |
| 45 | + if (datos.data.id) { | |
| 47 | 46 | $scope.precioCondicion = datos.data; |
| 48 | 47 | focaAbmPreciosCondicionesService.obtenerPlazoPago(datos.data.id) |
| 49 | - .then(function(datos){ | |
| 48 | + .then(function(datos) { | |
| 50 | 49 | $scope.precioCondicion.plazos = datos.data; |
| 51 | 50 | }); |
| 52 | 51 | } |
| ... | ... | @@ -67,43 +66,17 @@ angular.module('focaAbmPreciosCondiciones') |
| 67 | 66 | ); |
| 68 | 67 | }; |
| 69 | 68 | $scope.solicitarConfirmacionPlazoPago = function(plazoPago) { |
| 70 | - $uibModal.open({ | |
| 71 | - templateUrl: 'foca-abm-plazos-pago-modal-confirmar.html', | |
| 72 | - controller: 'focaAbmPlazosPagosModalConfirmarController', | |
| 73 | - animation: false, | |
| 74 | - backdrop: false, | |
| 75 | - resolve: {plazoPago: function(){return plazoPago;}} | |
| 76 | - }) | |
| 77 | - .result.then(function(plazoPago){ | |
| 78 | - focaAbmPreciosCondicionesService.borrarPlazoPago(plazoPago.id); | |
| 79 | - $scope.precioCondicion.plazos.splice( | |
| 80 | - $scope.precioCondicion.plazos.indexOf(plazoPago), 1 | |
| 69 | + focaModalService.confirm('¿Está seguro que desea borrar el plazo de pago ' + | |
| 70 | + plazoPago.item + ' ' + plazoPago.dias + ' ?').then( | |
| 71 | + function(confirm) { | |
| 72 | + if (confirm) { | |
| 73 | + focaAbmPreciosCondicionesService.borrarPlazoPago(plazoPago.id); | |
| 74 | + $scope.precioCondicion.plazos.splice( | |
| 75 | + $scope.precioCondicion.plazos.indexOf(plazoPago), 1 | |
| 76 | + ); | |
| 77 | + } | |
| 78 | + } | |
| 81 | 79 | ); |
| 82 | - }); | |
| 83 | - }; | |
| 84 | - } | |
| 85 | - ]) | |
| 86 | - .controller('focaAbmPreciosCondicionesModalConfirmarController', [ | |
| 87 | - '$uibModalInstance', '$scope', 'precioCondicion', | |
| 88 | - function($uibModalInstance, $scope, precioCondicion) { | |
| 89 | - $scope.precioCondicion = precioCondicion; | |
| 90 | - $scope.cancelar = function() { | |
| 91 | - $uibModalInstance.dismiss(); | |
| 92 | - }; | |
| 93 | - $scope.borrar = function() { | |
| 94 | - $uibModalInstance.close(precioCondicion); | |
| 95 | - }; | |
| 96 | - } | |
| 97 | - ]) | |
| 98 | - .controller('focaAbmPlazosPagosModalConfirmarController', [ | |
| 99 | - '$uibModalInstance', '$scope', 'plazoPago', | |
| 100 | - function($uibModalInstance, $scope, plazoPago) { | |
| 101 | - $scope.plazoPago = plazoPago; | |
| 102 | - $scope.cancelar = function() { | |
| 103 | - $uibModalInstance.dismiss(); | |
| 104 | - }; | |
| 105 | - $scope.borrar = function() { | |
| 106 | - $uibModalInstance.close(plazoPago); | |
| 107 | 80 | }; |
| 108 | 81 | } |
| 109 | 82 | ]); |