Commit 1f104c026b8d513031af531c32cbe36ddbf7c739
1 parent
48e24f5177
Exists in
master
ok nombres plural
Showing
5 changed files
with
10 additions
and
10 deletions
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 htmlmin = require('gulp-htmlmin'); | 3 | const htmlmin = require('gulp-htmlmin'); |
| 4 | const rename = require('gulp-rename'); | 4 | const rename = require('gulp-rename'); |
| 5 | const uglify = require('gulp-uglify-es').default; | 5 | const uglify = require('gulp-uglify-es').default; |
| 6 | const gulp = require('gulp'); | 6 | const gulp = require('gulp'); |
| 7 | const pump = require('pump'); | 7 | const pump = require('pump'); |
| 8 | const jshint = require('gulp-jshint'); | 8 | const jshint = require('gulp-jshint'); |
| 9 | const replace = require('gulp-replace'); | 9 | const replace = require('gulp-replace'); |
| 10 | const connect = require('gulp-connect'); | 10 | const connect = require('gulp-connect'); |
| 11 | const clean = require('gulp-clean'); | 11 | const clean = require('gulp-clean'); |
| 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 | replace('views/', ''), | 24 | replace('views/', ''), |
| 25 | htmlmin(), | 25 | htmlmin(), |
| 26 | templateCache('views.js', { | 26 | templateCache('views.js', { |
| 27 | module: 'focaEstadoCisterna', | 27 | module: 'focaEstadoCisternas', |
| 28 | root: '' | 28 | root: '' |
| 29 | }), | 29 | }), |
| 30 | gulp.dest(paths.tmp) | 30 | gulp.dest(paths.tmp) |
| 31 | ] | 31 | ] |
| 32 | ); | 32 | ); |
| 33 | }); | 33 | }); |
| 34 | 34 | ||
| 35 | gulp.task('uglify', ['templates'], function() { | 35 | gulp.task('uglify', ['templates'], function() { |
| 36 | return pump( | 36 | return pump( |
| 37 | [ | 37 | [ |
| 38 | gulp.src([ | 38 | gulp.src([ |
| 39 | paths.srcJS, | 39 | paths.srcJS, |
| 40 | 'tmp/views.js' | 40 | 'tmp/views.js' |
| 41 | ]), | 41 | ]), |
| 42 | concat('foca-estado-cisterna.js'), | 42 | concat('foca-estado-cisternas.js'), |
| 43 | replace("['ngRoute', 'focaModal', 'ui.bootstrap', 'focaBotoneraLateral']", '[]'), | 43 | replace("['ngRoute', 'focaModal', 'ui.bootstrap', 'focaBotoneraLateral']", '[]'), |
| 44 | replace("src/views/", ''), | 44 | replace("src/views/", ''), |
| 45 | gulp.dest(paths.tmp), | 45 | gulp.dest(paths.tmp), |
| 46 | rename('foca-estado-cisterna.min.js'), | 46 | rename('foca-estado-cisternas.min.js'), |
| 47 | uglify(), | 47 | uglify(), |
| 48 | gulp.dest(paths.dist) | 48 | gulp.dest(paths.dist) |
| 49 | ] | 49 | ] |
| 50 | ); | 50 | ); |
| 51 | }); | 51 | }); |
| 52 | 52 | ||
| 53 | gulp.task('clean', function() { | 53 | gulp.task('clean', function() { |
| 54 | return gulp.src(['tmp', 'dist'], {read: false}) | 54 | return gulp.src(['tmp', 'dist'], {read: false}) |
| 55 | .pipe(clean()); | 55 | .pipe(clean()); |
| 56 | }); | 56 | }); |
| 57 | 57 | ||
| 58 | gulp.task('pre-commit', function() { | 58 | gulp.task('pre-commit', function() { |
| 59 | pump( | 59 | pump( |
| 60 | [ | 60 | [ |
| 61 | gulp.src(paths.srcJS), | 61 | gulp.src(paths.srcJS), |
| 62 | jshint('.jshintrc'), | 62 | jshint('.jshintrc'), |
| 63 | jshint.reporter('default'), | 63 | jshint.reporter('default'), |
| 64 | jshint.reporter('fail') | 64 | jshint.reporter('fail') |
| 65 | ] | 65 | ] |
| 66 | ); | 66 | ); |
| 67 | 67 | ||
| 68 | gulp.start('uglify'); | 68 | gulp.start('uglify'); |
| 69 | }); | 69 | }); |
| 70 | 70 | ||
| 71 | gulp.task('clean-post-install', function() { | 71 | gulp.task('clean-post-install', function() { |
| 72 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', | 72 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', |
| 73 | 'index.html'], {read: false}) | 73 | 'index.html'], {read: false}) |
| 74 | .pipe(clean()); | 74 | .pipe(clean()); |
| 75 | }); | 75 | }); |
| 76 | 76 | ||
| 77 | gulp.task('compile', ['templates', 'uglify']); | 77 | gulp.task('compile', ['templates', 'uglify']); |
| 78 | 78 | ||
| 79 | gulp.task('watch', function() { | 79 | gulp.task('watch', function() { |
| 80 | gulp.watch([paths.srcJS, paths.srcViews], ['uglify']); | 80 | gulp.watch([paths.srcJS, paths.srcViews], ['uglify']); |
| 81 | }); | 81 | }); |
| 82 | 82 | ||
| 83 | gulp.task('webserver', function() { | 83 | gulp.task('webserver', function() { |
| 84 | pump [ | 84 | pump [ |
| 85 | connect.server({port: 3000}) | 85 | connect.server({port: 3000}) |
| 86 | ] | 86 | ] |
| 87 | }); | 87 | }); |
| 88 | 88 | ||
| 89 | gulp.task('default', ['webserver']); | 89 | gulp.task('default', ['webserver']); |
| 90 | 90 |
index.html
| 1 | <html ng-app="focaEstadoCisterna"> | 1 | <html ng-app="focaEstadoCisternas"> |
| 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 | <!-- BUILD --> |
| 19 | <script src="src/js/app.js"></script> | 19 | <script src="src/js/app.js"></script> |
| 20 | <script src="src/js/route.js"></script> | 20 | <script src="src/js/route.js"></script> |
| 21 | <script src="src/js/controller.js"></script> | 21 | <script src="src/js/controller.js"></script> |
| 22 | <script src="src/js/service.js"></script> | 22 | <script src="src/js/service.js"></script> |
| 23 | <!-- /BUILD --> | 23 | <!-- /BUILD --> |
| 24 | 24 | ||
| 25 | <!-- CONFIG PARA DEVELOP --> | 25 | <!-- CONFIG PARA DEVELOP --> |
| 26 | <script src="src/etc/develop.js"></script> | 26 | <script src="src/etc/develop.js"></script> |
| 27 | </head> | 27 | </head> |
| 28 | <body style="background: #afafaf;padding: 25px"> | 28 | <body style="background: #afafaf;padding: 25px"> |
| 29 | <div class="container-fluid pt-3 pb-3" ng-view style="background: #fff"></div> | 29 | <div class="container-fluid pt-3 pb-3" ng-view style="background: #fff"></div> |
| 30 | </body> | 30 | </body> |
| 31 | </html> | 31 | </html> |
| 32 | 32 |
src/js/app.js
| 1 | angular.module('focaEstadoCisterna', ['ngRoute', 'focaModal', 'ui.bootstrap', 'focaBotoneraLateral']); | 1 | angular.module('focaEstadoCisternas', ['ngRoute', 'focaModal', 'ui.bootstrap', 'focaBotoneraLateral']); |
| 2 | 2 |
src/js/controller.js
| 1 | angular.module('focaEstadoCisterna') | 1 | angular.module('focaEstadoCisternas') |
| 2 | .controller('focaEstadoCisternaController', [ | 2 | .controller('focaEstadoCisternasController', [ |
| 3 | '$scope', 'focaEstadoCisternaService', '$location', 'focaModalService', | 3 | '$scope', 'focaEstadoCisternasService', '$location', 'focaModalService', |
| 4 | '$uibModal', 'focaBotoneraLateralService', '$timeout', | 4 | '$uibModal', 'focaBotoneraLateralService', '$timeout', |
| 5 | function($scope, focaEstadoCisternaService, $location, focaModalService, | 5 | function($scope, focaEstadoCisternasService, $location, focaModalService, |
| 6 | $uibModal, focaBotoneraLateralService, $timeout) { | 6 | $uibModal, focaBotoneraLateralService, $timeout) { |
| 7 | 7 | ||
| 8 | $scope.now = new Date(); | 8 | $scope.now = new Date(); |
| 9 | $scope.fecha = new Date(); | 9 | $scope.fecha = new Date(); |
| 10 | $scope.cisternas = []; | 10 | $scope.cisternas = []; |
| 11 | $scope.botonera = [{ | 11 | $scope.botonera = [{ |
| 12 | label: 'Transportista', | 12 | label: 'Transportista', |
| 13 | image: 'transportista.png' | 13 | image: 'transportista.png' |
| 14 | }, | 14 | }, |
| 15 | { | 15 | { |
| 16 | label: 'Vehiculo', | 16 | label: 'Vehiculo', |
| 17 | image: 'vehiculos.png' | 17 | image: 'vehiculos.png' |
| 18 | }, | 18 | }, |
| 19 | { | 19 | { |
| 20 | label: 'Fecha', | 20 | label: 'Fecha', |
| 21 | image: 'fechaDeReparto.png' | 21 | image: 'fechaDeReparto.png' |
| 22 | }]; | 22 | }]; |
| 23 | 23 | ||
| 24 | //SETEO BOTONERA LATERAL | 24 | //SETEO BOTONERA LATERAL |
| 25 | focaBotoneraLateralService.showSalir(true); | 25 | focaBotoneraLateralService.showSalir(true); |
| 26 | focaBotoneraLateralService.showPausar(false); | 26 | focaBotoneraLateralService.showPausar(false); |
| 27 | focaBotoneraLateralService.showCancelar(false); | 27 | focaBotoneraLateralService.showCancelar(false); |
| 28 | focaBotoneraLateralService.showGuardar(false); | 28 | focaBotoneraLateralService.showGuardar(false); |
| 29 | 29 | ||
| 30 | $timeout(function() { | 30 | $timeout(function() { |
| 31 | $scope.$broadcast('addCabecera',{ | 31 | $scope.$broadcast('addCabecera',{ |
| 32 | label: 'Fecha:', | 32 | label: 'Fecha:', |
| 33 | valor: $scope.fecha.toLocaleDateString() | 33 | valor: $scope.fecha.toLocaleDateString() |
| 34 | }); | 34 | }); |
| 35 | }); | 35 | }); |
| 36 | 36 | ||
| 37 | $scope.seleccionarTransportista = function() { | 37 | $scope.seleccionarTransportista = function() { |
| 38 | var modalInstance = $uibModal.open( | 38 | var modalInstance = $uibModal.open( |
| 39 | { | 39 | { |
| 40 | ariaLabelledBy: 'Busqueda de Transportista', | 40 | ariaLabelledBy: 'Busqueda de Transportista', |
| 41 | templateUrl: 'modal-proveedor.html', | 41 | templateUrl: 'modal-proveedor.html', |
| 42 | controller: 'focaModalProveedorCtrl', | 42 | controller: 'focaModalProveedorCtrl', |
| 43 | size: 'lg', | 43 | size: 'lg', |
| 44 | resolve: { | 44 | resolve: { |
| 45 | transportista: function() { | 45 | transportista: function() { |
| 46 | return true; | 46 | return true; |
| 47 | } | 47 | } |
| 48 | } | 48 | } |
| 49 | } | 49 | } |
| 50 | ); | 50 | ); |
| 51 | modalInstance.result.then( | 51 | modalInstance.result.then( |
| 52 | function(transportista) { | 52 | function(transportista) { |
| 53 | elegirTransportista(transportista); | 53 | elegirTransportista(transportista); |
| 54 | }, function() { | 54 | }, function() { |
| 55 | 55 | ||
| 56 | } | 56 | } |
| 57 | ); | 57 | ); |
| 58 | }; | 58 | }; |
| 59 | 59 | ||
| 60 | $scope.seleccionarVehiculo = function() { | 60 | $scope.seleccionarVehiculo = function() { |
| 61 | if(!$scope.idTransportista){ | 61 | if(!$scope.idTransportista){ |
| 62 | focaModalService.alert('Primero seleccione un transportista'); | 62 | focaModalService.alert('Primero seleccione un transportista'); |
| 63 | return; | 63 | return; |
| 64 | } | 64 | } |
| 65 | var query = '/vehiculo/transportista/' + $scope.idTransportista; | 65 | var query = '/vehiculo/transportista/' + $scope.idTransportista; |
| 66 | var columnas = { | 66 | var columnas = { |
| 67 | nombre: ['Código', 'tractor', 'Semi', 'Capacidad'], | 67 | nombre: ['Código', 'tractor', 'Semi', 'Capacidad'], |
| 68 | propiedad: ['codigo', 'tractor', 'semi', 'capacidadTotalCisternas'] | 68 | propiedad: ['codigo', 'tractor', 'semi', 'capacidadTotalCisternas'] |
| 69 | }; | 69 | }; |
| 70 | var titulo = 'Búsqueda de vehículos'; | 70 | var titulo = 'Búsqueda de vehículos'; |
| 71 | 71 | ||
| 72 | focaModalService.modal(columnas, query, titulo).then( | 72 | focaModalService.modal(columnas, query, titulo).then( |
| 73 | function(vehiculo) { | 73 | function(vehiculo) { |
| 74 | $scope.$broadcast('addCabecera', { | 74 | $scope.$broadcast('addCabecera', { |
| 75 | label: 'Vehículo:', | 75 | label: 'Vehículo:', |
| 76 | valor: vehiculo.codigo | 76 | valor: vehiculo.codigo |
| 77 | }); | 77 | }); |
| 78 | $scope.cisternas = vehiculo.cisternas; | 78 | $scope.cisternas = vehiculo.cisternas; |
| 79 | getEstadosCisternas($scope.cisternas); | 79 | getEstadosCisternas($scope.cisternas); |
| 80 | }, function() { | 80 | }, function() { |
| 81 | // funcion ejecutada cuando se cancela el modal | 81 | // funcion ejecutada cuando se cancela el modal |
| 82 | }); | 82 | }); |
| 83 | }; | 83 | }; |
| 84 | 84 | ||
| 85 | $scope.seleccionarFecha = function() { | 85 | $scope.seleccionarFecha = function() { |
| 86 | focaModalService.modalFecha('Fecha').then(function(fecha) { | 86 | focaModalService.modalFecha('Fecha').then(function(fecha) { |
| 87 | $scope.$broadcast('addCabecera',{ | 87 | $scope.$broadcast('addCabecera',{ |
| 88 | label: 'Fecha:', | 88 | label: 'Fecha:', |
| 89 | valor: fecha.toLocaleDateString() | 89 | valor: fecha.toLocaleDateString() |
| 90 | }); | 90 | }); |
| 91 | $scope.fecha = fecha; | 91 | $scope.fecha = fecha; |
| 92 | if($scope.cisternas) | 92 | if($scope.cisternas) |
| 93 | getEstadosCisternas($scope.cisternas); | 93 | getEstadosCisternas($scope.cisternas); |
| 94 | }); | 94 | }); |
| 95 | }; | 95 | }; |
| 96 | 96 | ||
| 97 | function elegirTransportista(transportista) { | 97 | function elegirTransportista(transportista) { |
| 98 | var codigo = ('00000' + transportista.COD).slice(-5); | 98 | var codigo = ('00000' + transportista.COD).slice(-5); |
| 99 | $scope.idTransportista = transportista.COD; | 99 | $scope.idTransportista = transportista.COD; |
| 100 | $scope.filtros = transportista.NOM.trim(); | 100 | $scope.filtros = transportista.NOM.trim(); |
| 101 | $scope.$broadcast('addCabecera', { | 101 | $scope.$broadcast('addCabecera', { |
| 102 | label: 'Transportista:', | 102 | label: 'Transportista:', |
| 103 | valor: codigo + ' - ' + transportista.NOM | 103 | valor: codigo + ' - ' + transportista.NOM |
| 104 | }); | 104 | }); |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | function getEstadosCisternas(cisternas) { | 107 | function getEstadosCisternas(cisternas) { |
| 108 | cisternas.forEach(function(cisterna) { | 108 | cisternas.forEach(function(cisterna) { |
| 109 | focaEstadoCisternaService | 109 | focaEstadoCisternaService |
| 110 | .getEstadoCisterna(cisterna.id, $scope.fecha) | 110 | .getEstadoCisterna(cisterna.id, $scope.fecha) |
| 111 | .then(function(res) { | 111 | .then(function(res) { |
| 112 | cisterna.estado = res.data; | 112 | cisterna.estado = res.data; |
| 113 | }); | 113 | }); |
| 114 | }); | 114 | }); |
| 115 | } | 115 | } |
| 116 | } | 116 | } |
| 117 | ]); | 117 | ]); |
| 118 | 118 |
src/js/route.js
| 1 | angular.module('focaEstadoCisterna') | 1 | angular.module('focaEstadoCisternas') |
| 2 | .config([ | 2 | .config([ |
| 3 | '$routeProvider', | 3 | '$routeProvider', |
| 4 | function($routeProvider) { | 4 | function($routeProvider) { |
| 5 | $routeProvider.when('/estado-cisterna', { | 5 | $routeProvider.when('/estado-cisterna', { |
| 6 | controller: 'focaEstadoCisternaController', | 6 | controller: 'focaEstadoCisternaController', |
| 7 | templateUrl: 'src/views/foca-estado-cisterna.html' | 7 | templateUrl: 'src/views/foca-estado-cisterna.html' |
| 8 | }); | 8 | }); |
| 9 | } | 9 | } |
| 10 | ]); | 10 | ]); |
| 11 | 11 |