Commit d0f2b9d9f6f4b0941c256a16068a9b4938cfc45f
Exists in
master
Merge branch 'master' into 'master'
# Conflicts: # gulpfile.js # index.html # package.json
Showing
6 changed files
Show diff stats
gulpfile.js
1 | const templateCache = require('gulp-angular-templatecache'); | ||
2 | const concat = require('gulp-concat'); | ||
3 | const clean = require('gulp-clean'); | 1 | const clean = require('gulp-clean'); |
4 | const htmlmin = require('gulp-htmlmin'); | 2 | const concat = require('gulp-concat'); |
5 | const rename = require('gulp-rename'); | 3 | const connect = require('gulp-connect'); |
6 | const uglify = require('gulp-uglify-es').default; | ||
7 | const gulp = require('gulp'); | 4 | const gulp = require('gulp'); |
8 | const pump = require('pump'); | 5 | const htmlmin = require('gulp-htmlmin'); |
9 | const jshint = require('gulp-jshint'); | 6 | const jshint = require('gulp-jshint'); |
7 | const pump = require('pump'); | ||
8 | const rename = require('gulp-rename'); | ||
10 | const replace = require('gulp-replace'); | 9 | const replace = require('gulp-replace'); |
10 | const templateCache = require('gulp-angular-templatecache'); | ||
11 | const uglify = require('gulp-uglify-es').default; | ||
11 | 12 | ||
12 | var paths = { | 13 | var paths = { |
14 | dist: 'dist/', | ||
13 | srcJS: 'src/js/*.js', | 15 | srcJS: 'src/js/*.js', |
14 | srcViews: 'src/views/*.html', | 16 | srcViews: 'src/views/*.html', |
15 | tmp: 'tmp', | 17 | tmp: 'tmp' |
16 | dist: 'dist/' | ||
17 | }; | 18 | }; |
18 | 19 | ||
19 | gulp.task('templates', function() { | 20 | gulp.task('templates', ['clean'], function() { |
20 | return pump( | 21 | return pump( |
21 | [ | 22 | [ |
22 | gulp.src(paths.srcViews), | 23 | gulp.src(paths.srcViews), |
23 | htmlmin(), | 24 | htmlmin(), |
24 | templateCache('views.js', { | 25 | templateCache('views.js', { |
25 | module: 'focaAbmPlazoPago', | 26 | module: 'focaAbmPlazoPago', |
26 | root: '' | 27 | root: '' |
27 | }), | 28 | }), |
28 | gulp.dest(paths.tmp) | 29 | gulp.dest(paths.tmp) |
29 | ] | 30 | ] |
30 | ); | 31 | ); |
31 | }); | 32 | }); |
32 | 33 | ||
33 | gulp.task('uglify', ['templates'], function() { | 34 | gulp.task('uglify', ['templates'], function() { |
34 | return pump( | 35 | return pump( |
35 | [ | 36 | [ |
36 | gulp.src([ | 37 | gulp.src([ |
37 | paths.srcJS, | 38 | paths.srcJS, |
38 | 'tmp/views.js' | 39 | 'tmp/views.js' |
39 | ]), | 40 | ]), |
40 | concat('foca-abm-plazo-pago.js'), | 41 | concat('foca-abm-plazo-pago.js'), |
41 | replace("['ngRoute', 'ui.bootstrap', 'focaModal']", '[]'), | ||
42 | replace('src/views/', ''), | 42 | replace("['ngRoute', 'ui.bootstrap', 'focaModal']", '[]'), |
43 | replace('src/views/', ''), | ||
43 | gulp.dest(paths.tmp), | 44 | replace("['ngRoute', 'ui.bootstrap']", '[]'), |
44 | rename('foca-abm-plazo-pago.min.js'), | 45 | gulp.dest(paths.tmp), |
45 | uglify(), | 46 | rename('foca-abm-plazo-pago.min.js'), |
46 | gulp.dest(paths.dist) | 47 | uglify(), |
47 | ] | 48 | gulp.dest(paths.dist) |
48 | ); | 49 | ] |
49 | }); | 50 | ); |
50 | 51 | }); | |
51 | gulp.task('clean', function(){ | 52 | |
52 | return gulp.src(['tmp', 'dist'], {read: false}) | 53 | gulp.task('clean', function(){ |
53 | .pipe(clean()); | 54 | return gulp.src(['tmp', 'dist'], {read: false}) |
54 | }); | 55 | .pipe(clean()); |
55 | 56 | }); | |
56 | gulp.task('pre-commit', function() { | 57 | |
57 | pump( | 58 | gulp.task('pre-commit', function() { |
58 | [ | 59 | pump( |
59 | gulp.src(paths.srcJS), | 60 | [ |
60 | jshint('.jshintrc'), | 61 | gulp.src(paths.srcJS), |
61 | jshint.reporter('default'), | 62 | jshint('.jshintrc'), |
62 | jshint.reporter('fail') | 63 | jshint.reporter('default'), |
63 | ] | 64 | jshint.reporter('fail') |
64 | ); | 65 | ] |
65 | }); | 66 | ); |
66 | 67 | }); | |
67 | gulp.task('clean-post-install', function() { | 68 | |
68 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', | 69 | gulp.task('clean-post-install', function() { |
69 | 'index.html'], {read: false}) | 70 | return gulp.src([ |
71 | 'src', 'tmp', '.jshintrc', 'readme.md', '.gitignore', 'gulpfile.js', 'index.html' | ||
70 | .pipe(clean()); | 72 | ], {read: false}) |
71 | }); | 73 | .pipe(clean()); |
72 | 74 | }); | |
73 | gulp.task('webserver', function() { | 75 | |
74 | pump [ | 76 | gulp.task('webserver', function() { |
75 | connect.server({port: 3000}) | 77 | pump [ |
76 | ] | 78 | connect.server({port: 3000}) |
index.html
1 | <html ng-app="focaAbmPlazoPago"> | 1 | <html ng-app="focaAbmPlazoPago"> |
2 | <head> | 2 | <head> |
3 | <meta charset="UTF-8"/> | 3 | <meta charset="UTF-8" /> |
4 | <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | 4 | <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> |
5 | 5 | ||
6 | <!--CSS--> | 6 | <!--CSS--> |
7 | <link href="node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"/> | 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"/> | 8 | <link href="node_modules/font-awesome/css/font-awesome.min.css" rel="stylesheet" /> |
9 | 9 | ||
10 | <!--VENDOR JS--> | 10 | <!--VENDOR JS--> |
11 | <script src="node_modules/jquery/dist/jquery.min.js"></script> | 11 | <script src="node_modules/jquery/dist/jquery.min.js"></script> |
12 | <script src="node_modules/bootstrap/dist/js/bootstrap.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> | 13 | <script src="node_modules/angular/angular.min.js"></script> |
14 | <script src="node_modules/angular-route/angular-route.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> | 15 | <script src="node_modules/ui-bootstrap4/dist/ui-bootstrap-tpls.js"></script> |
16 | <script src="node_modules/foca-modal/dist/foca-modal.min.js"></script> | 16 | <script src="node_modules/foca-modal/dist/foca-modal.min.js"></script> |
17 | |||
17 | 18 | <!-- BUILD --> | |
18 | <script src="src/js/app.js"></script> | 19 | <script src="src/js/app.js"></script> |
19 | <script src="src/js/route.js"></script> | 20 | <script src="src/js/route.js"></script> |
20 | <script src="src/js/controller.js"></script> | 21 | <script src="src/js/controller.js"></script> |
21 | <script src="src/js/service.js"></script> | 22 | <script src="src/js/service.js"></script> |
23 | <script src="src/etc/develop.js"></script> | ||
22 | <script src="src/etc/develop.js"></script> | 24 | <!-- /BUILD --> |
23 | </head> | 25 | </head> |
24 | <body> | 26 | <body> |
25 | <div ng-view></div> | 27 | <div ng-view></div> |
26 | </body> | 28 | </body> |
27 | </html> | 29 | </html> |
28 | 30 |
package.json
1 | { | 1 | { |
2 | "name": "foca-abm-plazo-pago", | 2 | "name": "foca-abm-plazo-pago", |
3 | "version": "1.0.0", | 3 | "version": "1.0.0", |
4 | "description": "ABM de Plazos de Pago", | 4 | "description": "ABM de Plazos de Pago", |
5 | "main": "dist/foca-abm-plazo-pago.js", | 5 | "main": "dist/foca-abm-plazo-pago.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 gulp gulp-connect jasmine-core pre-commit angular angular-route bootstrap ui-bootstrap4 font-awesome gulp-angular-templatecache gulp-clean gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-sequence gulp-uglify-es gulp-uglify jquery jshint pump git+https://192.168.0.11/modulos-npm/foca-modal.git" | 11 | "install-dev": "npm install -D gulp gulp-connect jasmine-core pre-commit angular angular-route bootstrap ui-bootstrap4 font-awesome gulp-angular-templatecache gulp-clean gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-sequence gulp-uglify-es gulp-uglify 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-plazo-pago.git" | 18 | "url": "https://192.168.0.11/modulos-npm/foca-abm-plazo-pago.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.5", |
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 | "foca-modal": "git+https://192.168.0.11/modulos-npm/foca-modal.git", |
41 | "font-awesome": "^4.7.0", | 41 | "font-awesome": "^4.7.0", |
42 | "gulp": "^3.9.1", | 42 | "gulp": "^3.9.1", |
43 | "gulp-angular-templatecache": "^2.2.1", | 43 | "gulp-angular-templatecache": "^2.2.2", |
44 | "gulp-clean": "^0.4.0", | 44 | "gulp-clean": "^0.4.0", |
45 | "gulp-connect": "^5.6.1", | 45 | "gulp-connect": "^5.6.1", |
46 | "gulp-htmlmin": "^5.0.1", | 46 | "gulp-htmlmin": "^5.0.1", |
47 | "gulp-jshint": "^2.1.0", | 47 | "gulp-jshint": "^2.1.0", |
48 | "gulp-rename": "^1.4.0", | 48 | "gulp-rename": "^1.4.0", |
49 | "gulp-replace": "^1.0.0", | 49 | "gulp-replace": "^1.0.0", |
50 | "gulp-sequence": "^1.0.0", | 50 | "gulp-sequence": "^1.0.0", |
51 | "gulp-uglify": "^3.0.1", | 51 | "gulp-uglify": "^3.0.1", |
52 | "gulp-uglify-es": "^1.0.4", | 52 | "gulp-uglify-es": "^1.0.4", |
53 | "jasmine-core": "^3.2.1", | 53 | "jasmine-core": "^3.2.1", |
54 | "jquery": "^3.3.1", | 54 | "jquery": "^3.3.1", |
55 | "jshint": "^2.9.6", | 55 | "jshint": "^2.9.6", |
56 | "pre-commit": "^1.2.2", | 56 | "pre-commit": "^1.2.2", |
57 | "pump": "^3.0.0", | 57 | "pump": "^3.0.0", |
58 | "ui-bootstrap4": "^3.0.5" | 58 | "ui-bootstrap4": "^3.0.5" |
59 | } | 59 | } |
60 | } | 60 | } |
61 | 61 |
src/etc/develop.ejemplo.js
File was created | 1 | angular.module('focaAbmPlazoPago') | |
2 | .constant("API_ENDPOINT", { | ||
3 | 'URL': '//127.0.0.1:9000' | ||
4 | }); | ||
5 |
src/js/controller.js
1 | angular.module('focaAbmPlazoPago') | 1 | angular.module('focaAbmPlazoPago') |
2 | .controller('focaAbmPlazosPagoController', [ | 2 | .controller('focaAbmPlazosPagoController', [ |
3 | '$scope', 'focaAbmPlazoPagoService', '$location', 'focaModalService', | 3 | '$scope', 'focaAbmPlazoPagoService', '$location', 'focaModalService', |
4 | function($scope, focaAbmPlazoPagoService, $location, focaModalService) { | 4 | function($scope, focaAbmPlazoPagoService, $location, focaModalService) { |
5 | focaAbmPlazoPagoService.obtenerPlazosPago().then(function(datos) { | 5 | focaAbmPlazoPagoService.obtenerPlazosPago().then(function(datos) { |
6 | $scope.plazosPago = datos.data; | 6 | $scope.plazosPago = datos.data; |
7 | }); | 7 | }); |
8 | $scope.editar = function(id) { | 8 | $scope.editar = function(idPreciosCondiciones, id) { |
9 | $location.path('/plazo-pago/' + id); | 9 | $location.path('/precio-condicion/' + idPreciosCondiciones + '/plazo-pago/' + id); |
10 | }; | 10 | }; |
11 | $scope.solicitarConfirmacion = function(plazoPago) { | 11 | $scope.solicitarConfirmacion = function(plazoPago) { |
12 | focaModalService.confirm('¿Está seguro que desea borrar el plazo de pago '+ | 12 | focaModalService.confirm('¿Está seguro que desea borrar el plazo de pago '+ |
13 | plazoPago.item+' '+plazoPago.dias+' ?').then( | 13 | plazoPago.item+' '+plazoPago.dias+' ?').then( |
14 | function(confirm) { | 14 | function(confirm) { |
15 | if(confirm){ | 15 | if(confirm){ |
16 | focaAbmPlazoPagoService.borrarPlazoPago(plazoPago.id); | 16 | focaAbmPlazoPagoService.borrarPlazoPago(plazoPago.id); |
17 | $scope.plazosPago.splice( | 17 | $scope.plazosPago.splice( |
18 | $scope.plazosPago.indexOf(plazoPago), 1 | 18 | $scope.plazosPago.indexOf(plazoPago), 1 |
19 | ); | 19 | ); |
20 | } | 20 | } |
21 | } | 21 | } |
22 | ); | 22 | ); |
23 | }; | 23 | }; |
24 | } | 24 | } |
25 | ]) | 25 | ]) |
26 | .controller('focaAbmPlazoPagoController', [ | 26 | .controller('focaAbmPlazoPagoController', [ |
27 | '$scope', 'focaAbmPlazoPagoService', | 27 | '$scope', 'focaAbmPlazoPagoService', |
28 | '$routeParams', '$location', | 28 | '$routeParams', '$location', |
29 | function( | 29 | function( |
30 | $scope, focaAbmPlazoPagoService, | 30 | $scope, focaAbmPlazoPagoService, |
31 | $routeParams, $location | 31 | $routeParams, $location |
32 | ) { | 32 | ) { |
33 | focaAbmPlazoPagoService.obtenerPlazoPago($routeParams.id) | 33 | focaAbmPlazoPagoService.obtenerPlazoPago($routeParams.id) |
34 | .then(function(datos) { | 34 | .then(function(datos) { |
35 | $scope.plazoPago = { | 35 | $scope.plazoPago = { |
36 | id: 0, | 36 | id: 0, |
37 | idPreciosCondiciones: $routeParams.idPreciosCondiciones, | 37 | idPreciosCondiciones: $routeParams.idPreciosCondiciones, |
38 | item: '', | 38 | item: '', |
39 | dias: '' | 39 | dias: '' |
40 | }; | 40 | }; |
41 | if(datos.data.id) { | 41 | if(datos.data.id) { |
42 | $scope.plazoPago = datos.data; | 42 | $scope.plazoPago = datos.data; |
43 | } | 43 | } |
44 | }); | 44 | }); |
45 | $scope.cancelar = function() { | 45 | $scope.cancelar = function() { |
46 | $location.path('/precio-condicion/' + $routeParams.idPreciosCondiciones); | 46 | $location.path('/precio-condicion/' + $routeParams.idPreciosCondiciones); |
47 | }; | 47 | }; |
48 | $scope.guardar = function(plazoPago) { | 48 | $scope.guardar = function(plazoPago) { |
49 | focaAbmPlazoPagoService.guardarPlazoPago(plazoPago) | 49 | focaAbmPlazoPagoService.guardarPlazoPago(plazoPago) |
50 | .then(function() { | 50 | .then(function() { |
51 | $location.path('/precio-condicion/' + $routeParams.idPreciosCondiciones); | 51 | $location.path('/precio-condicion/' + $routeParams.idPreciosCondiciones); |
52 | }); | 52 | }); |
53 | }; | 53 | }; |
54 | } | 54 | } |
55 | ]); | 55 | ]); |
56 | 56 |
src/views/foca-abm-plazos-pago-listado.html
1 | <table class="table table-sm table-hover table-nonfluid"> | 1 | <table class="table table-sm table-hover table-nonfluid"> |
2 | <tr> | 2 | <tr> |
3 | <th>Item</th> | 3 | <th>Item</th> |
4 | <th>Dias</th> | 4 | <th>Dias</th> |
5 | <th colspan="2" class="text-center"> | 5 | <th colspan="2" class="text-center"> |
6 | <button class="btn btn-default" ng-click="editar(0)"> | 6 | <button class="btn btn-default" ng-click="editar(0, 0)"> |
7 | <i class="fa fa-plus"></i> | 7 | <i class="fa fa-plus"></i> |
8 | </button> | 8 | </button> |
9 | </th> | 9 | </th> |
10 | </tr> | 10 | </tr> |
11 | <tr ng-repeat="plazoPago in plazosPago"> | 11 | <tr ng-repeat="plazoPago in plazosPago"> |
12 | <td ng-bind="plazoPago.item"></td> | 12 | <td ng-bind="plazoPago.item"></td> |
13 | <td ng-bind="plazoPago.dias"></td> | 13 | <td ng-bind="plazoPago.dias"></td> |
14 | <td> | 14 | <td> |
15 | <button class="btn btn-default" ng-click="editar(plazoPago.id)"> | 15 | <button |
16 | class="btn btn-default" | ||
17 | ng-click="editar(plazoPago.idPreciosCondiciones, plazoPago.id)" | ||
18 | > | ||
16 | <i class="fa fa-pencil"></i> | 19 | <i class="fa fa-pencil"></i> |
17 | </button> | 20 | </button> |
18 | <button class="btn btn-default" ng-click="solicitarConfirmacion(plazoPago)"> | 21 | <button class="btn btn-default" ng-click="solicitarConfirmacion(plazoPago)"> |
19 | <i class="fa fa-trash"></i> | 22 | <i class="fa fa-trash"></i> |
20 | </button> | 23 | </button> |
21 | </td> | 24 | </td> |
22 | </tr> | 25 | </tr> |
23 | </table> | 26 | </table> |
24 | 27 |