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
| 1 | const templateCache = require('gulp-angular-templatecache'); | 1 | const templateCache = require('gulp-angular-templatecache'); |
| 2 | const concat = require('gulp-concat'); | 2 | const concat = require('gulp-concat'); |
| 3 | const clean = require('gulp-clean'); | 3 | const clean = require('gulp-clean'); |
| 4 | const htmlmin = require('gulp-htmlmin'); | 4 | const htmlmin = require('gulp-htmlmin'); |
| 5 | const rename = require('gulp-rename'); | 5 | const rename = require('gulp-rename'); |
| 6 | const uglify = require('gulp-uglify-es').default; | 6 | const uglify = require('gulp-uglify-es').default; |
| 7 | const gulp = require('gulp'); | 7 | const gulp = require('gulp'); |
| 8 | const pump = require('pump'); | 8 | const pump = require('pump'); |
| 9 | const jshint = require('gulp-jshint'); | 9 | const jshint = require('gulp-jshint'); |
| 10 | const replace = require('gulp-replace'); | 10 | const replace = require('gulp-replace'); |
| 11 | const connect = require('gulp-connect'); | 11 | const connect = require('gulp-connect'); |
| 12 | 12 | ||
| 13 | var paths = { | 13 | var paths = { |
| 14 | srcJS: 'src/js/*.js', | 14 | srcJS: 'src/js/*.js', |
| 15 | srcViews: 'src/views/*.html', | 15 | srcViews: 'src/views/*.html', |
| 16 | tmp: 'tmp', | 16 | tmp: 'tmp', |
| 17 | dist: 'dist/' | 17 | dist: 'dist/' |
| 18 | }; | 18 | }; |
| 19 | 19 | ||
| 20 | gulp.task('templates', function() { | 20 | gulp.task('templates', function() { |
| 21 | return pump( | 21 | return pump( |
| 22 | [ | 22 | [ |
| 23 | gulp.src(paths.srcViews), | 23 | gulp.src(paths.srcViews), |
| 24 | htmlmin(), | 24 | htmlmin(), |
| 25 | templateCache('views.js', { | 25 | templateCache('views.js', { |
| 26 | module: 'focaAbmPreciosCondiciones', | 26 | module: 'focaAbmPreciosCondiciones', |
| 27 | root: '' | 27 | root: '' |
| 28 | }), | 28 | }), |
| 29 | gulp.dest(paths.tmp) | 29 | gulp.dest(paths.tmp) |
| 30 | ] | 30 | ] |
| 31 | ); | 31 | ); |
| 32 | }); | 32 | }); |
| 33 | 33 | ||
| 34 | gulp.task('uglify', ['templates'], function() { | 34 | gulp.task('uglify', ['templates'], function() { |
| 35 | return pump( | 35 | return pump( |
| 36 | [ | 36 | [ |
| 37 | gulp.src([ | 37 | gulp.src([ |
| 38 | paths.srcJS, | 38 | paths.srcJS, |
| 39 | 'tmp/views.js' | 39 | 'tmp/views.js' |
| 40 | ]), | 40 | ]), |
| 41 | concat('foca-abm-precios-condiciones.js'), | 41 | concat('foca-abm-precios-condiciones.js'), |
| 42 | replace('src/views/', ''), | 42 | replace('src/views/', ''), |
| 43 | replace("['ngRoute', 'ui.bootstrap']", '[]'), | 43 | replace("['ngRoute', 'ui.bootstrap', 'focaModal']", '[]'), |
| 44 | gulp.dest(paths.tmp), | 44 | gulp.dest(paths.tmp), |
| 45 | rename('foca-abm-precios-condiciones.min.js'), | 45 | rename('foca-abm-precios-condiciones.min.js'), |
| 46 | uglify(), | 46 | uglify(), |
| 47 | gulp.dest(paths.dist) | 47 | gulp.dest(paths.dist) |
| 48 | ] | 48 | ] |
| 49 | ); | 49 | ); |
| 50 | }); | 50 | }); |
| 51 | 51 | ||
| 52 | gulp.task('clean', function() { | 52 | gulp.task('clean', function() { |
| 53 | return gulp.src(['tmp', 'dist'], {read: false}) | 53 | return gulp.src(['tmp', 'dist'], {read: false}) |
| 54 | .pipe(clean()); | 54 | .pipe(clean()); |
| 55 | }); | 55 | }); |
| 56 | 56 | ||
| 57 | gulp.task('pre-commit', function() { | 57 | gulp.task('pre-commit', function() { |
| 58 | pump( | 58 | pump( |
| 59 | [ | 59 | [ |
| 60 | gulp.src(paths.srcJS), | 60 | gulp.src(paths.srcJS), |
| 61 | jshint('.jshintrc'), | 61 | jshint('.jshintrc'), |
| 62 | jshint.reporter('default'), | 62 | jshint.reporter('default'), |
| 63 | jshint.reporter('fail') | 63 | jshint.reporter('fail') |
| 64 | ] | 64 | ] |
| 65 | ); | 65 | ); |
| 66 | }); | 66 | }); |
| 67 | 67 | ||
| 68 | gulp.task('clean-post-install', function() { | 68 | gulp.task('clean-post-install', function() { |
| 69 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', | 69 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', |
| 70 | 'index.html'], {read: false}) | 70 | 'index.html'], {read: false}) |
| 71 | .pipe(clean()); | 71 | .pipe(clean()); |
| 72 | }); | 72 | }); |
| 73 | 73 | ||
| 74 | gulp.task('webserver', function() { | 74 | gulp.task('webserver', function() { |
| 75 | pump [ | 75 | pump [ |
| 76 | connect.server({port: 3000}) | 76 | connect.server({port: 3000}) |
| 77 | ] | 77 | ] |
| 78 | }); | 78 | }); |
| 79 | 79 | ||
| 80 | gulp.task('default', ['webserver']); | 80 | gulp.task('default', ['webserver']); |
| 81 | 81 |
index.html
| 1 | <html ng-app="focaAbmPreciosCondiciones"> | 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--> | 3 | <head> |
| 7 | <link href="node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet" /> | 4 | <meta charset="UTF-8" /> |
| 8 | <link href="node_modules/font-awesome/css/font-awesome.min.css" rel="stylesheet" /> | 5 | <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> |
| 9 | 6 | ||
| 10 | <!--VENDOR JS--> | 7 | <!--CSS--> |
| 11 | <script src="node_modules/jquery/dist/jquery.min.js"></script> | 8 | <link href="node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet" /> |
| 12 | <script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script> | 9 | <link href="node_modules/font-awesome/css/font-awesome.min.css" rel="stylesheet" /> |
| 13 | <script src="node_modules/angular/angular.min.js"></script> | 10 | |
| 14 | <script src="node_modules/angular-route/angular-route.min.js"></script> | 11 | <!--VENDOR JS--> |
| 15 | <script src="node_modules/ui-bootstrap4/dist/ui-bootstrap-tpls.js"></script> | 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> |
package.json
| 1 | { | 1 | { |
| 2 | "name": "foca-abm-precios-condiciones", | 2 | "name": "foca-abm-precios-condiciones", |
| 3 | "version": "1.0.0", | 3 | "version": "1.0.0", |
| 4 | "description": "ABM de precios y condiciones", | 4 | "description": "ABM de precios y condiciones", |
| 5 | "main": "dist/foca-abm-precios-condiciones.js", | 5 | "main": "dist/foca-abm-precios-condiciones.js", |
| 6 | "scripts": { | 6 | "scripts": { |
| 7 | "test": "echo \"Error: no test specified\" && exit 1", | 7 | "test": "echo \"Error: no test specified\" && exit 1", |
| 8 | "compile": "gulp uglify", | 8 | "compile": "gulp uglify", |
| 9 | "gulp-pre-commit": "gulp pre-commit", | 9 | "gulp-pre-commit": "gulp pre-commit", |
| 10 | "postinstall": "npm run compile && gulp clean-post-install", | 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 | "pre-commit": [ | 13 | "pre-commit": [ |
| 14 | "gulp-pre-commit" | 14 | "gulp-pre-commit" |
| 15 | ], | 15 | ], |
| 16 | "repository": { | 16 | "repository": { |
| 17 | "type": "git", | 17 | "type": "git", |
| 18 | "url": "https://192.168.0.11/modulos-npm/foca-abm-precios-condiciones.git" | 18 | "url": "https://192.168.0.11/modulos-npm/foca-abm-precios-condiciones.git" |
| 19 | }, | 19 | }, |
| 20 | "author": "Foca Software", | 20 | "author": "Foca Software", |
| 21 | "license": "ISC", | 21 | "license": "ISC", |
| 22 | "peerDependencies": { | 22 | "peerDependencies": { |
| 23 | "angular": "^1.7.x", | 23 | "angular": "^1.7.x", |
| 24 | "bootstrap": "^4.1.x", | 24 | "bootstrap": "^4.1.x", |
| 25 | "jquery": "^3.3.x", | 25 | "jquery": "^3.3.x", |
| 26 | "font-awesome": "^4.7.x", | 26 | "font-awesome": "^4.7.x", |
| 27 | "gulp": "^3.9.x", | 27 | "gulp": "^3.9.x", |
| 28 | "gulp-concat": "2.6.x", | 28 | "gulp-concat": "2.6.x", |
| 29 | "gulp-jshint": "^2.1.x", | 29 | "gulp-jshint": "^2.1.x", |
| 30 | "gulp-rename": "^1.4.x", | 30 | "gulp-rename": "^1.4.x", |
| 31 | "gulp-replace": "^1.0.x", | 31 | "gulp-replace": "^1.0.x", |
| 32 | "gulp-uglify-es": "^1.0.x", | 32 | "gulp-uglify-es": "^1.0.x", |
| 33 | "jshint": "^2.9.x", | 33 | "jshint": "^2.9.x", |
| 34 | "pump": "^3.0.x" | 34 | "pump": "^3.0.x" |
| 35 | }, | 35 | }, |
| 36 | "devDependencies": { | 36 | "devDependencies": { |
| 37 | "angular": "^1.7.4", | 37 | "angular": "^1.7.4", |
| 38 | "angular-route": "^1.7.5", | 38 | "angular-route": "^1.7.5", |
| 39 | "bootstrap": "^4.1.3", | 39 | "bootstrap": "^4.1.3", |
| 40 | "foca-modal": "git+https://192.168.0.11/modulos-npm/foca-modal.git", | ||
| 40 | "font-awesome": "^4.7.0", | 41 | "font-awesome": "^4.7.0", |
| 41 | "gulp": "^3.9.1", | 42 | "gulp": "^3.9.1", |
| 42 | "gulp-angular-templatecache": "^2.2.1", | 43 | "gulp-angular-templatecache": "^2.2.1", |
| 43 | "gulp-clean": "^0.4.0", | 44 | "gulp-clean": "^0.4.0", |
| 44 | "gulp-connect": "^5.6.1", | 45 | "gulp-connect": "^5.6.1", |
| 45 | "gulp-htmlmin": "^5.0.1", | 46 | "gulp-htmlmin": "^5.0.1", |
| 46 | "gulp-jshint": "^2.1.0", | 47 | "gulp-jshint": "^2.1.0", |
| 47 | "gulp-rename": "^1.4.0", | 48 | "gulp-rename": "^1.4.0", |
| 48 | "gulp-replace": "^1.0.0", | 49 | "gulp-replace": "^1.0.0", |
| 49 | "gulp-sequence": "^1.0.0", | 50 | "gulp-sequence": "^1.0.0", |
| 51 | "gulp-uglify": "^3.0.1", | ||
| 50 | "gulp-uglify-es": "^1.0.4", | 52 | "gulp-uglify-es": "^1.0.4", |
| 51 | "jasmine-core": "^3.2.1", | 53 | "jasmine-core": "^3.2.1", |
| 52 | "jquery": "^3.3.1", | 54 | "jquery": "^3.3.1", |
| 53 | "jshint": "^2.9.6", | 55 | "jshint": "^2.9.6", |
| 54 | "pre-commit": "^1.2.2", | 56 | "pre-commit": "^1.2.2", |
| 55 | "pump": "^3.0.0", | 57 | "pump": "^3.0.0", |
| 56 | "ui-bootstrap4": "^3.0.5" | 58 | "ui-bootstrap4": "^3.0.5" |
| 57 | } | 59 | } |
| 58 | } | 60 | } |
| 59 | 61 |
src/js/app.js
| 1 | angular.module('focaAbmPreciosCondiciones', ['ngRoute', 'ui.bootstrap']); | 1 | angular.module('focaAbmPreciosCondiciones', ['ngRoute', 'ui.bootstrap', 'focaModal']); |
| 2 | 2 |
src/js/controller.js
| 1 | angular.module('focaAbmPreciosCondiciones') | 1 | angular.module('focaAbmPreciosCondiciones') |
| 2 | .controller('focaAbmPreciosCondicionesController', [ | 2 | .controller('focaAbmPreciosCondicionesController', [ |
| 3 | '$scope', 'focaAbmPreciosCondicionesService', '$location', '$uibModal', | 3 | '$scope', 'focaAbmPreciosCondicionesService', '$location', 'focaModalService', |
| 4 | function($scope, focaAbmPreciosCondicionesService, $location, $uibModal) { | 4 | function($scope, focaAbmPreciosCondicionesService, $location, focaModalService) { |
| 5 | focaAbmPreciosCondicionesService.obtenerPreciosCondiciones().then(function(datos) { | 5 | focaAbmPreciosCondicionesService.obtenerPreciosCondiciones().then(function(datos) { |
| 6 | $scope.preciosCondiciones = datos.data; | 6 | $scope.preciosCondiciones = datos.data; |
| 7 | }); | 7 | }); |
| 8 | $scope.editar = function(id) { | 8 | $scope.editar = function(id) { |
| 9 | $location.path('/precio-condicion/' + id); | 9 | $location.path('/precio-condicion/' + id); |
| 10 | }; | 10 | }; |
| 11 | $scope.solicitarConfirmacion = function(precioCondicion) { | 11 | $scope.solicitarConfirmacion = function(precioCondicion) { |
| 12 | $uibModal.open({ | 12 | focaModalService.confirm('¿Está seguro que desea borrar el precio condición' + |
| 13 | templateUrl: 'foca-abm-precios-condiciones-modal-confirmar.html', | 13 | precioCondicion.codigo + ' ' + precioCondicion.nombre + ' ?').then( |
| 14 | controller: 'focaAbmPreciosCondicionesModalConfirmarController', | 14 | function(data) { |
| 15 | animation: false, | 15 | if (data) { |
| 16 | backdrop: false, | 16 | focaAbmPreciosCondicionesService |
| 17 | resolve: {precioCondicion: function(){return precioCondicion;}} | 17 | .borrarPrecioCondicion(precioCondicion.id); |
| 18 | }) | 18 | $scope.preciosCondiciones.splice( |
| 19 | .result.then(function(precioCondicion){ | 19 | $scope.preciosCondiciones.indexOf(precioCondicion), 1 |
| 20 | focaAbmPreciosCondicionesService.borrarPrecioCondicion(precioCondicion.id); | 20 | ); |
| 21 | $scope.preciosCondiciones.splice( | 21 | } |
| 22 | $scope.preciosCondiciones.indexOf(precioCondicion), 1 | 22 | } |
| 23 | ); | 23 | ); |
| 24 | }); | ||
| 25 | }; | 24 | }; |
| 26 | } | 25 | } |
| 27 | ]) | 26 | ]) |
| 28 | .controller('focaAbmPrecioCondicionController', [ | 27 | .controller('focaAbmPrecioCondicionController', [ |
| 29 | '$scope', 'focaAbmPreciosCondicionesService', | 28 | '$scope', 'focaAbmPreciosCondicionesService', |
| 30 | '$routeParams', '$location', '$uibModal', | 29 | '$routeParams', '$location', 'focaModalService', |
| 31 | function( | 30 | function( |
| 32 | $scope, focaAbmPreciosCondicionesService, | 31 | $scope, focaAbmPreciosCondicionesService, |
| 33 | $routeParams, $location, $uibModal | 32 | $routeParams, $location, focaModalService |
| 34 | ) { | 33 | ) { |
| 35 | $scope.mostrarPlazos = $routeParams.id > 0; | 34 | $scope.mostrarPlazos = $routeParams.id > 0; |
| 36 | focaAbmPreciosCondicionesService.obtenerPrecioCondicion($routeParams.id) | 35 | focaAbmPreciosCondicionesService.obtenerPrecioCondicion($routeParams.id) |
| 37 | .then(function(datos) { | 36 | .then(function(datos) { |
| 38 | $scope.precioCondicion = { | 37 | $scope.precioCondicion = { |
| 39 | id: 0, | 38 | id: 0, |
| 40 | codigo: '', | 39 | codigo: '', |
| 41 | nombre: '', | 40 | nombre: '', |
| 42 | descripcion: '', | 41 | descripcion: '', |
| 43 | idListaPrecio: 0, | 42 | idListaPrecio: 0, |
| 44 | vigencia: new Date() | 43 | vigencia: new Date() |
| 45 | }; | 44 | }; |
| 46 | if(datos.data.id) { | 45 | if (datos.data.id) { |
| 47 | $scope.precioCondicion = datos.data; | 46 | $scope.precioCondicion = datos.data; |
| 48 | focaAbmPreciosCondicionesService.obtenerPlazoPago(datos.data.id) | 47 | focaAbmPreciosCondicionesService.obtenerPlazoPago(datos.data.id) |
| 49 | .then(function(datos){ | 48 | .then(function(datos) { |
| 50 | $scope.precioCondicion.plazos = datos.data; | 49 | $scope.precioCondicion.plazos = datos.data; |
| 51 | }); | 50 | }); |
| 52 | } | 51 | } |
| 53 | }); | 52 | }); |
| 54 | $scope.cancelar = function() { | 53 | $scope.cancelar = function() { |
| 55 | $location.path('/precio-condicion'); | 54 | $location.path('/precio-condicion'); |
| 56 | }; | 55 | }; |
| 57 | $scope.guardar = function(precioCondicion) { | 56 | $scope.guardar = function(precioCondicion) { |
| 58 | focaAbmPreciosCondicionesService.guardarPrecioCondicion(precioCondicion) | 57 | focaAbmPreciosCondicionesService.guardarPrecioCondicion(precioCondicion) |
| 59 | .then(function() { | 58 | .then(function() { |
| 60 | $location.path('/precio-condicion'); | 59 | $location.path('/precio-condicion'); |
| 61 | }); | 60 | }); |
| 62 | }; | 61 | }; |
| 63 | $scope.editarPlazoPago = function(id) { | 62 | $scope.editarPlazoPago = function(id) { |
| 64 | $location.path( | 63 | $location.path( |
| 65 | '/precio-condicion/' + $scope.precioCondicion.id + | 64 | '/precio-condicion/' + $scope.precioCondicion.id + |
| 66 | '/plazo-pago/' + id | 65 | '/plazo-pago/' + id |
| 67 | ); | 66 | ); |
| 68 | }; | 67 | }; |
| 69 | $scope.solicitarConfirmacionPlazoPago = function(plazoPago) { | 68 | $scope.solicitarConfirmacionPlazoPago = function(plazoPago) { |
| 70 | $uibModal.open({ | 69 | focaModalService.confirm('¿Está seguro que desea borrar el plazo de pago ' + |
| 71 | templateUrl: 'foca-abm-plazos-pago-modal-confirmar.html', | 70 | plazoPago.item + ' ' + plazoPago.dias + ' ?').then( |
| 72 | controller: 'focaAbmPlazosPagosModalConfirmarController', | 71 | function(confirm) { |
| 73 | animation: false, | 72 | if (confirm) { |
| 74 | backdrop: false, | 73 | focaAbmPreciosCondicionesService.borrarPlazoPago(plazoPago.id); |
| 75 | resolve: {plazoPago: function(){return plazoPago;}} | 74 | $scope.precioCondicion.plazos.splice( |
| 76 | }) | 75 | $scope.precioCondicion.plazos.indexOf(plazoPago), 1 |
| 77 | .result.then(function(plazoPago){ | 76 | ); |
| 78 | focaAbmPreciosCondicionesService.borrarPlazoPago(plazoPago.id); | 77 | } |
| 79 | $scope.precioCondicion.plazos.splice( | 78 | } |
| 80 | $scope.precioCondicion.plazos.indexOf(plazoPago), 1 | ||
| 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 | ]); |
| 110 | 83 |