Commit 5c77da45374ab3de5ac006b22a07720abc323634

Authored by Eric Fernandez
Exists in master

Merge branch 'master' into 'master'

Master(efernandez)

See merge request modulos-npm/foca-abm-precios-condiciones!1
1 /node_modules 1 /node_modules
2 /dist 2 /dist
3 /tmp 3 /tmp
4 package-lock\.json 4 package-lock\.json
5 /src/etc/develop.js
5 6
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 11
11 var paths = { 12 var paths = {
12 srcJS: 'src/js/*.js', 13 srcJS: 'src/js/*.js',
13 srcViews: 'src/views/*.html', 14 srcViews: 'src/views/*.html',
14 tmp: 'tmp', 15 tmp: 'tmp',
15 dist: 'dist/' 16 dist: 'dist/'
16 }; 17 };
17 18
18 gulp.task('templates', function() { 19 gulp.task('templates', function() {
19 return pump( 20 return pump(
20 [ 21 [
21 gulp.src(paths.srcViews), 22 gulp.src(paths.srcViews),
22 htmlmin(), 23 htmlmin(),
23 templateCache('views.js', { 24 templateCache('views.js', {
24 module: 'focaAbmPreciosCondiciones', 25 module: 'focaAbmPreciosCondiciones',
25 root: '' 26 root: ''
26 }), 27 }),
27 gulp.dest(paths.tmp) 28 gulp.dest(paths.tmp)
28 ] 29 ]
29 ); 30 );
30 }); 31 });
31 32
32 gulp.task('uglify', ['templates'], function() { 33 gulp.task('uglify', ['templates'], function() {
33 return pump( 34 return pump(
34 [ 35 [
35 gulp.src([ 36 gulp.src([
36 paths.srcJS, 37 paths.srcJS,
37 'tmp/views.js' 38 'tmp/views.js'
38 ]), 39 ]),
39 concat('foca-abm-precios-condiciones.js'), 40 concat('foca-abm-precios-condiciones.js'),
41 replace('src/views/', ''),
42 replace("['ngRoute', 'ui.bootstrap']", '[]'),
40 gulp.dest(paths.tmp), 43 gulp.dest(paths.tmp),
41 rename('foca-abm-precios-condiciones.min.js'), 44 rename('foca-abm-precios-condiciones.min.js'),
42 uglify(), 45 uglify(),
43 gulp.dest(paths.dist) 46 gulp.dest(paths.dist)
44 ] 47 ]
45 ); 48 );
46 }); 49 });
47 50
48 gulp.task('clean', function(){ 51 gulp.task('clean', function() {
49 return gulp.src(['tmp', 'dist'], {read: false}) 52 return gulp.src(['tmp', 'dist'], {read: false})
50 .pipe(clean()); 53 .pipe(clean());
51 }); 54 });
52 55
53 gulp.task('pre-commit', function() { 56 gulp.task('pre-commit', function() {
54 pump( 57 pump(
55 [ 58 [
56 gulp.src(paths.srcJS), 59 gulp.src(paths.srcJS),
57 jshint('.jshintrc'), 60 jshint('.jshintrc'),
58 jshint.reporter('default'), 61 jshint.reporter('default'),
59 jshint.reporter('fail') 62 jshint.reporter('fail')
60 ] 63 ]
61 ); 64 );
62 }); 65 });
66
67 gulp.task('clean-post-install', function() {
68 return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js',
69 'index.html'], {read: false})
70 .pipe(clean());
71 });
72
73 gulp.task('webserver', function() {
74 pump [
75 connect.server({port: 3000})
76 ]
77 });
78
79 gulp.task('default', ['webserver']);
63 80
1 <html ng-app="focaAbmPreciosCondiciones">
2
3 <head>
4 <meta charset="UTF-8" />
5 <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
6
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
18 <!-- BUILD -->
19 <script src="src/js/app.js"></script>
20 <script src="src/js/route.js"></script>
21 <script src="src/js/controller.js"></script>
22 <script src="src/js/service.js"></script>
23 <script src="src/etc/develop.js"></script>
24 <!-- /BUILD -->
25
26 <body ng-view>
27 </body>
28
29 </html>
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 "pre-commit": [ 9 "gulp-pre-commit": "gulp pre-commit",
10 "gulp-pre-commit" 10 "postinstall": "npm run compile && gulp clean-post-install",
11 ], 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-replace jquery jshint pump"
12 "postinstall": "npm run compile && rm -R src && rm index.html && rm .jshintrc && rm gulpfile.js"
13 }, 12 },
13 "pre-commit": [
14 "gulp-pre-commit"
15 ],
14 "repository": { 16 "repository": {
15 "type": "git", 17 "type": "git",
16 "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"
17 }, 19 },
18 "author": "Foca Software", 20 "author": "Foca Software",
19 "license": "ISC", 21 "license": "ISC",
20 "peerDependencies": { 22 "peerDependencies": {
21 "angular": "^1.7.x", 23 "angular": "^1.7.x",
22 "bootstrap": "^4.1.x", 24 "bootstrap": "^4.1.x",
23 "jquery": "^3.3.x", 25 "jquery": "^3.3.x",
24 "font-awesome": "^4.7.x", 26 "font-awesome": "^4.7.x",
25 "gulp": "^3.9.x", 27 "gulp": "^3.9.x",
26 "gulp-concat": "2.6.x", 28 "gulp-concat": "2.6.x",
27 "gulp-jshint": "^2.1.x", 29 "gulp-jshint": "^2.1.x",
28 "gulp-rename": "^1.4.x", 30 "gulp-rename": "^1.4.x",
29 "gulp-replace": "^1.0.x", 31 "gulp-replace": "^1.0.x",
30 "gulp-uglify-es": "^1.0.x", 32 "gulp-uglify-es": "^1.0.x",
31 "jshint": "^2.9.x", 33 "jshint": "^2.9.x",
32 "pump": "^3.0.x" 34 "pump": "^3.0.x"
33 }, 35 },
34 "devDependencies": { 36 "devDependencies": {
37 "angular": "^1.7.4",
38 "angular-route": "^1.7.5",
39 "bootstrap": "^4.1.3",
40 "font-awesome": "^4.7.0",
41 "gulp": "^3.9.1",
42 "gulp-angular-templatecache": "^2.2.1",
43 "gulp-clean": "^0.4.0",
35 "gulp-connect": "^5.6.1", 44 "gulp-connect": "^5.6.1",
36 "jasmine-core": "3.2.1", 45 "gulp-htmlmin": "^5.0.1",
37 "pre-commit": "^1.2.2" 46 "gulp-jshint": "^2.1.0",
38 }, 47 "gulp-rename": "^1.4.0",
39 "dependencies": { 48 "gulp-replace": "^1.0.0",
40 "angular": "1.7.4", 49 "gulp-sequence": "^1.0.0",
41 "bootstrap": "4.1.3", 50 "gulp-uglify-es": "^1.0.4",
42 "font-awesome": "4.7.0", 51 "jasmine-core": "^3.2.1",
43 "gulp-angular-templatecache": "2.2.1", 52 "jquery": "^3.3.1",
44 "gulp-clean": "0.4.0", 53 "jshint": "^2.9.6",
45 "gulp-htmlmin": "5.0.1", 54 "pre-commit": "^1.2.2",
46 "gulp-jshint": "2.1.0", 55 "pump": "^3.0.0",
47 "gulp-rename": "1.4.0", 56 "ui-bootstrap4": "^3.0.5"
48 "gulp-replace": "1.0.0",
49 "gulp-sequence": "1.0.0",
File was created 1 angular.module('focaAbmPreciosCondiciones')
2 .constant("API_ENDPOINT", {
3 'URL': 'http://192.168.0.23:9900'
4 });
5
1 angular.module('focaAbmPreciosCondiciones', []); 1 angular.module('focaAbmPreciosCondiciones', ['ngRoute', 'ui.bootstrap']);
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', '$uibModal',
4 function($scope, focaAbmPreciosCondicionesService, $location, $uibModal) { 4 function($scope, focaAbmPreciosCondicionesService, $location, $uibModal) {
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 $uibModal.open({
13 templateUrl: 'foca-abm-precios-condiciones-modal-confirmar.html', 13 templateUrl: 'foca-abm-precios-condiciones-modal-confirmar.html',
14 controller: 'focaAbmPreciosCondicionesModalConfirmarController', 14 controller: 'focaAbmPreciosCondicionesModalConfirmarController',
15 animation: false, 15 animation: false,
16 backdrop: false, 16 backdrop: false,
17 resolve: {precioCondicion: function(){return precioCondicion;}} 17 resolve: {precioCondicion: function(){return precioCondicion;}}
18 }) 18 })
19 .result.then(function(precioCondicion){ 19 .result.then(function(precioCondicion){
20 focaAbmPreciosCondicionesService.borrarPrecioCondicion(precioCondicion.id); 20 focaAbmPreciosCondicionesService.borrarPrecioCondicion(precioCondicion.id);
21 $scope.preciosCondiciones.splice( 21 $scope.preciosCondiciones.splice(
22 $scope.preciosCondiciones.indexOf(precioCondicion), 1 22 $scope.preciosCondiciones.indexOf(precioCondicion), 1
23 ); 23 );
24 }); 24 });
25 }; 25 };
26 } 26 }
27 ]) 27 ])
28 .controller('focaAbmPrecioCondicionController', [ 28 .controller('focaAbmPrecioCondicionController', [
29 '$scope', 'focaAbmPreciosCondicionesService', 29 '$scope', 'focaAbmPreciosCondicionesService',
30 '$routeParams', '$location', '$uibModal', 30 '$routeParams', '$location', '$uibModal',
31 function( 31 function(
32 $scope, focaAbmPreciosCondicionesService, 32 $scope, focaAbmPreciosCondicionesService,
33 $routeParams, $location, $uibModal 33 $routeParams, $location, $uibModal
34 ) { 34 ) {
35 focaAbmPreciosCondicionesService.obtenerPrecioCondicion($routeParams.id) 35 focaAbmPreciosCondicionesService.obtenerPrecioCondicion($routeParams.id)
36 .then(function(datos) { 36 .then(function(datos) {
37 $scope.precioCondicion = { 37 $scope.precioCondicion = {
38 id: 0, 38 id: 0,
39 codigo: '', 39 codigo: '',
40 nombre: '', 40 nombre: '',
41 descripcion: '', 41 descripcion: '',
42 idListaPrecio: 0, 42 idListaPrecio: 0,
43 vigencia: new Date() 43 vigencia: new Date()
44 }; 44 };
45 if(datos.data.id) { 45 if(datos.data.id) {
46 $scope.precioCondicion = datos.data; 46 $scope.precioCondicion = datos.data;
47 focaAbmPreciosCondicionesService.obtenerPlazoPago(datos.data.id) 47 focaAbmPreciosCondicionesService.obtenerPlazoPago(datos.data.id)
48 .then(function(datos){ 48 .then(function(datos){
49 $scope.precioCondicion.plazos = datos.data; 49 $scope.precioCondicion.plazos = datos.data;
50 }); 50 });
51 } 51 }
52 }); 52 });
53 $scope.cancelar = function() { 53 $scope.cancelar = function() {
54 $location.path('/precio-condicion'); 54 $location.path('/precio-condicion');
55 }; 55 };
56 $scope.guardar = function(precioCondicion) { 56 $scope.guardar = function(precioCondicion) {
57 focaAbmPreciosCondicionesService.guardarPrecioCondicion(precioCondicion) 57 focaAbmPreciosCondicionesService.guardarPrecioCondicion(precioCondicion)
58 .then(function() { 58 .then(function() {
59 $location.path('/precio-condicion'); 59 $location.path('/precio-condicion');
60 }); 60 });
61 }; 61 };
62 $scope.editarPlazoPago = function(id) { 62 $scope.editarPlazoPago = function(id) {
63 $location.path( 63 $location.path(
64 '/precio-condicion/' + $scope.precioCondicion.id + 64 '/precio-condicion/' + $scope.precioCondicion.id +
65 '/plazo-pago/' + id 65 '/plazo-pago/' + id
66 ); 66 );
67 }; 67 };
68 $scope.solicitarConfirmacionPlazoPago = function(plazoPago) { 68 $scope.solicitarConfirmacionPlazoPago = function(plazoPago) {
69 $uibModal.open({ 69 $uibModal.open({
70 templateUrl: 'foca-abm-plazos-pago-modal-confirmar.html', 70 templateUrl: 'foca-abm-plazos-pago-modal-confirmar.html',
71 controller: 'focaAbmPlazosPagosModalConfirmarController', 71 controller: 'focaAbmPlazosPagosModalConfirmarController',
72 animation: false, 72 animation: false,
73 backdrop: false, 73 backdrop: false,
74 resolve: {plazoPago: function(){return plazoPago;}} 74 resolve: {plazoPago: function(){return plazoPago;}}
75 }) 75 })
76 .result.then(function(plazoPago){ 76 .result.then(function(plazoPago){
77 focaAbmPreciosCondicionesService.borrarPlazoPago(plazoPago.id); 77 focaAbmPreciosCondicionesService.borrarPlazoPago(plazoPago.id);
78 $scope.precioCondicion.plazos.splice( 78 $scope.precioCondicion.plazos.splice(
79 $scope.precioCondicion.plazos.indexOf(plazoPago), 1 79 $scope.precioCondicion.plazos.indexOf(plazoPago), 1
80 ); 80 );
81 }); 81 });
82 } 82 };
83 } 83 }
84 ]) 84 ])
85 .controller('focaAbmPreciosCondicionesModalConfirmarController', [ 85 .controller('focaAbmPreciosCondicionesModalConfirmarController', [
86 '$uibModalInstance', '$scope', 'precioCondicion', 86 '$uibModalInstance', '$scope', 'precioCondicion',
87 function($uibModalInstance, $scope, precioCondicion) { 87 function($uibModalInstance, $scope, precioCondicion) {
88 $scope.precioCondicion = precioCondicion; 88 $scope.precioCondicion = precioCondicion;
89 $scope.cancelar = function() { 89 $scope.cancelar = function() {
90 $uibModalInstance.dismiss(); 90 $uibModalInstance.dismiss();
91 }; 91 };
92 $scope.borrar = function() { 92 $scope.borrar = function() {
93 $uibModalInstance.close(precioCondicion); 93 $uibModalInstance.close(precioCondicion);
94 }; 94 };
95 } 95 }
96 ]) 96 ])
97 .controller('focaAbmPlazosPagosModalConfirmarController', [ 97 .controller('focaAbmPlazosPagosModalConfirmarController', [
98 '$uibModalInstance', '$scope', 'plazoPago', 98 '$uibModalInstance', '$scope', 'plazoPago',
99 function($uibModalInstance, $scope, plazoPago) { 99 function($uibModalInstance, $scope, plazoPago) {
100 $scope.plazoPago = plazoPago; 100 $scope.plazoPago = plazoPago;
101 $scope.cancelar = function() { 101 $scope.cancelar = function() {
102 $uibModalInstance.dismiss(); 102 $uibModalInstance.dismiss();
103 }; 103 };
104 $scope.borrar = function() { 104 $scope.borrar = function() {
105 $uibModalInstance.close(plazoPago); 105 $uibModalInstance.close(plazoPago);
106 }; 106 };
107 } 107 }
108 ]); 108 ]);
109 109
1 angular.module('focaAbmPreciosCondiciones') 1 angular.module('focaAbmPreciosCondiciones')
2 .config([ 2 .config([
3 '$routeProvider', 3 '$routeProvider',
4 function($routeProvider) { 4 function($routeProvider) {
5 $routeProvider.when('/precio-condicion', { 5 $routeProvider.when('/precio-condicion', {
6 controller: 'focaAbmPreciosCondicionesController', 6 controller: 'focaAbmPreciosCondicionesController',
7 templateUrl: 'foca-abm-precios-condiciones-listado.html' 7 templateUrl: 'src/views/foca-abm-precios-condiciones-listado.html'
8 }); 8 });
9 } 9 }
10 ]) 10 ])
11 .config([ 11 .config([
12 '$routeProvider', 12 '$routeProvider',
13 function($routeProvider) { 13 function($routeProvider) {
14 $routeProvider.when('/precio-condicion/:id', { 14 $routeProvider.when('/precio-condicion/:id', {
15 controller: 'focaAbmPrecioCondicionController', 15 controller: 'focaAbmPrecioCondicionController',
16 templateUrl: 'foca-abm-precios-condiciones-item.html' 16 templateUrl: 'src/views/foca-abm-precios-condiciones-item.html'
17 }); 17 });
18 } 18 }
19 ]); 19 ]);
20 20