Commit 2ee7e088211b797156b35d9847bd42d7d163d3ed

Authored by Eric Fernandez
Exists in master

Merge branch 'master' into 'master'

Master(efernandez)

See merge request modulos-npm/foca-abm-plazo-pago!2
1 const clean = require('gulp-clean'); 1 const clean = require('gulp-clean');
2 const concat = require('gulp-concat'); 2 const concat = require('gulp-concat');
3 const connect = require('gulp-connect'); 3 const connect = require('gulp-connect');
4 const gulp = require('gulp'); 4 const gulp = require('gulp');
5 const htmlmin = require('gulp-htmlmin'); 5 const htmlmin = require('gulp-htmlmin');
6 const jshint = require('gulp-jshint'); 6 const jshint = require('gulp-jshint');
7 const pump = require('pump'); 7 const pump = require('pump');
8 const rename = require('gulp-rename'); 8 const rename = require('gulp-rename');
9 const replace = require('gulp-replace'); 9 const replace = require('gulp-replace');
10 const templateCache = require('gulp-angular-templatecache'); 10 const templateCache = require('gulp-angular-templatecache');
11 const uglify = require('gulp-uglify-es').default; 11 const uglify = require('gulp-uglify-es').default;
12 12
13 var paths = { 13 var paths = {
14 dist: 'dist/', 14 dist: 'dist/',
15 srcJS: 'src/js/*.js', 15 srcJS: 'src/js/*.js',
16 srcViews: 'src/views/*.html', 16 srcViews: 'src/views/*.html',
17 tmp: 'tmp' 17 tmp: 'tmp'
18 }; 18 };
19 19
20 gulp.task('templates', ['clean'], function() { 20 gulp.task('templates', ['clean'], 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: 'focaAbmPlazoPago', 26 module: 'focaAbmPlazoPago',
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-plazo-pago.js'), 41 concat('foca-abm-plazo-pago.js'),
42 replace("['ngRoute', 'ui.bootstrap', 'focaModal']", '[]'),
42 replace('src/views/', ''), 43 replace('src/views/', ''),
43 replace("['ngRoute', 'ui.bootstrap']", '[]'), 44 replace("['ngRoute', 'ui.bootstrap']", '[]'),
44 gulp.dest(paths.tmp), 45 gulp.dest(paths.tmp),
45 rename('foca-abm-plazo-pago.min.js'), 46 rename('foca-abm-plazo-pago.min.js'),
46 uglify(), 47 uglify(),
47 gulp.dest(paths.dist) 48 gulp.dest(paths.dist)
48 ] 49 ]
49 ); 50 );
50 }); 51 });
51 52
52 gulp.task('clean', function(){ 53 gulp.task('clean', function(){
53 return gulp.src(['tmp', 'dist'], {read: false}) 54 return gulp.src(['tmp', 'dist'], {read: false})
54 .pipe(clean()); 55 .pipe(clean());
55 }); 56 });
56 57
57 gulp.task('pre-commit', function() { 58 gulp.task('pre-commit', function() {
58 pump( 59 pump(
59 [ 60 [
60 gulp.src(paths.srcJS), 61 gulp.src(paths.srcJS),
61 jshint('.jshintrc'), 62 jshint('.jshintrc'),
62 jshint.reporter('default'), 63 jshint.reporter('default'),
63 jshint.reporter('fail') 64 jshint.reporter('fail')
64 ] 65 ]
65 ); 66 );
66 }); 67 });
67 68
68 gulp.task('clean-post-install', function() { 69 gulp.task('clean-post-install', function() {
69 return gulp.src([ 70 return gulp.src([
70 'src', 'tmp', '.jshintrc', 'readme.md', '.gitignore', 'gulpfile.js', 'index.html' 71 'src', 'tmp', '.jshintrc', 'readme.md', '.gitignore', 'gulpfile.js', 'index.html'
71 ], {read: false}) 72 ], {read: false})
72 .pipe(clean()); 73 .pipe(clean());
73 }); 74 });
74 75
75 gulp.task('webserver', function() { 76 gulp.task('webserver', function() {
76 pump [ 77 pump [
77 connect.server({port: 3000}) 78 connect.server({port: 3000})
78 ] 79 ]
79 }); 80 });
80 81
81 gulp.task('default', ['webserver']); 82 gulp.task('default', ['webserver']);
82 83
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 17
17 <!-- BUILD --> 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>
22 <script src="src/etc/develop.js"></script> 23 <script src="src/etc/develop.js"></script>
23 <!-- /BUILD --> 24 <!-- /BUILD -->
24 </head> 25 </head>
25 <body> 26 <body>
26 <div ng-view></div> 27 <div ng-view></div>
27 </body> 28 </body>
28 </html> 29 </html>
29 30
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 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 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.5", 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 "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.2", 43 "gulp-angular-templatecache": "^2.2.2",
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
1 angular.module('focaAbmPlazoPago', ['ngRoute', 'ui.bootstrap']); 1 angular.module('focaAbmPlazoPago', ['ngRoute', 'ui.bootstrap', 'focaModal']);
2 2
src/js/controller.js
1 angular.module('focaAbmPlazoPago') 1 angular.module('focaAbmPlazoPago')
2 .controller('focaAbmPlazosPagoController', [ 2 .controller('focaAbmPlazosPagoController', [
3 '$scope', 'focaAbmPlazoPagoService', '$location', '$uibModal', 3 '$scope', 'focaAbmPlazoPagoService', '$location', 'focaModalService',
4 function($scope, focaAbmPlazoPagoService, $location, $uibModal) { 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(idPreciosCondiciones, id) { 8 $scope.editar = function(idPreciosCondiciones, id) {
9 $location.path('/precio-condicion/' + idPreciosCondiciones + '/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 $uibModal.open({ 12 focaModalService.confirm('¿Está seguro que desea borrar el plazo de pago '+
13 templateUrl: 'foca-abm-plazos-pago-modal-confirmar.html', 13 plazoPago.item+' '+plazoPago.dias+' ?').then(
14 controller: 'focaAbmPlazosPagoModalConfirmarController', 14 function(confirm) {
15 animation: false, 15 if(confirm){
16 backdrop: false, 16 focaAbmPlazoPagoService.borrarPlazoPago(plazoPago.id);
17 resolve: {plazoPago: function(){return plazoPago;}} 17 $scope.plazosPago.splice(
18 }) 18 $scope.plazosPago.indexOf(plazoPago), 1
19 .result.then(function(plazoPago){ 19 );
20 focaAbmPlazoPagoService.borrarPlazoPago(plazoPago.id); 20 }
21 $scope.plazosPago.splice( 21 }
22 $scope.plazosPago.indexOf(plazoPago), 1 22 );
23 );
24 });
25 }; 23 };
26 } 24 }
27 ]) 25 ])
28 .controller('focaAbmPlazoPagoController', [ 26 .controller('focaAbmPlazoPagoController', [
29 '$scope', 'focaAbmPlazoPagoService', 27 '$scope', 'focaAbmPlazoPagoService',
30 '$routeParams', '$location', 28 '$routeParams', '$location',
31 function( 29 function(
32 $scope, focaAbmPlazoPagoService, 30 $scope, focaAbmPlazoPagoService,
33 $routeParams, $location 31 $routeParams, $location
34 ) { 32 ) {
35 focaAbmPlazoPagoService.obtenerPlazoPago($routeParams.id) 33 focaAbmPlazoPagoService.obtenerPlazoPago($routeParams.id)
36 .then(function(datos) { 34 .then(function(datos) {
37 $scope.plazoPago = { 35 $scope.plazoPago = {
38 id: 0, 36 id: 0,
39 idPreciosCondiciones: $routeParams.idPreciosCondiciones, 37 idPreciosCondiciones: $routeParams.idPreciosCondiciones,
40 item: '', 38 item: '',
41 dias: '' 39 dias: ''
42 }; 40 };
43 if(datos.data.id) { 41 if(datos.data.id) {
44 $scope.plazoPago = datos.data; 42 $scope.plazoPago = datos.data;
45 } 43 }
46 }); 44 });
47 $scope.cancelar = function() { 45 $scope.cancelar = function() {
48 $location.path('/precio-condicion/' + $routeParams.idPreciosCondiciones); 46 $location.path('/precio-condicion/' + $routeParams.idPreciosCondiciones);
49 }; 47 };
50 $scope.guardar = function(plazoPago) { 48 $scope.guardar = function(plazoPago) {
51 focaAbmPlazoPagoService.guardarPlazoPago(plazoPago) 49 focaAbmPlazoPagoService.guardarPlazoPago(plazoPago)
52 .then(function() { 50 .then(function() {
53 $location.path('/precio-condicion/' + $routeParams.idPreciosCondiciones); 51 $location.path('/precio-condicion/' + $routeParams.idPreciosCondiciones);
54 }); 52 });
55 }; 53 };
56 } 54 }
57 ])
58 .controller('focaAbmPlazosPagoModalConfirmarController', [
59 '$uibModalInstance', '$scope', 'plazoPago',
60 function($uibModalInstance, $scope, plazoPago) {
61 $scope.plazoPago = plazoPago;
62 $scope.cancelar = function() {
63 $uibModalInstance.dismiss();
64 };
65 $scope.borrar = function() {
66 $uibModalInstance.close(plazoPago);
67 };
68 }
69 ]); 55 ]);
70 56
src/views/foca-abm-plazos-pago-modal-confirmar.html
1 <div class="modal-header"> File was deleted
2 <h4>Confirmar</h4>
3 </div>
4 <div class="modal-body">
5 <p>
6 ¿Está seguro que desea borrar el plazo de pago
7 {{plazoPago.item}} {{plazoPago.dias}}?
8 </p>
9 </div>
10 <div class="modal-footer">
11 <button class="btn btn-danger" ng-click="borrar()">Borrar</button>
12 <button class="btn btn-default" ng-click="cancelar()">Cancelar</button>
13 </div>
14 1 <div class="modal-header">