Commit 3f82004327b41287385ecd7717597463a73ced13
Exists in
master
Merge branch 'master' into 'master'
Master(efernandez) See merge request !7
Showing
3 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 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: 'focaEstadoCisternas', | 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-cisternas.js'), | 42 | concat('foca-estado-cisternas.js'), |
43 | replace("['ngRoute', 'focaModal', 'ui.bootstrap', 'focaBotoneraLateral']", '[]'), | ||
44 | replace("src/views/", ''), | 43 | replace("src/views/", ''), |
45 | gulp.dest(paths.tmp), | 44 | gulp.dest(paths.tmp), |
46 | rename('foca-estado-cisternas.min.js'), | 45 | rename('foca-estado-cisternas.min.js'), |
47 | uglify(), | 46 | uglify(), |
48 | gulp.dest(paths.dist) | 47 | gulp.dest(paths.dist) |
49 | ] | 48 | ] |
50 | ); | 49 | ); |
51 | }); | 50 | }); |
52 | 51 | ||
53 | gulp.task('clean', function() { | 52 | gulp.task('clean', function() { |
54 | return gulp.src(['tmp', 'dist'], {read: false}) | 53 | return gulp.src(['tmp', 'dist'], {read: false}) |
55 | .pipe(clean()); | 54 | .pipe(clean()); |
56 | }); | 55 | }); |
57 | 56 | ||
58 | gulp.task('pre-commit', function() { | 57 | gulp.task('pre-commit', function() { |
59 | pump( | 58 | pump( |
60 | [ | 59 | [ |
61 | gulp.src(paths.srcJS), | 60 | gulp.src(paths.srcJS), |
62 | jshint('.jshintrc'), | 61 | jshint('.jshintrc'), |
63 | jshint.reporter('default'), | 62 | jshint.reporter('default'), |
64 | jshint.reporter('fail') | 63 | jshint.reporter('fail') |
65 | ] | 64 | ] |
66 | ); | 65 | ); |
67 | 66 | ||
68 | gulp.start('uglify'); | 67 | gulp.start('uglify'); |
69 | }); | 68 | }); |
70 | 69 | ||
71 | gulp.task('clean-post-install', function() { | 70 | gulp.task('clean-post-install', function() { |
72 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', | 71 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', |
73 | 'index.html'], {read: false}) | 72 | 'index.html'], {read: false}) |
74 | .pipe(clean()); | 73 | .pipe(clean()); |
75 | }); | 74 | }); |
76 | 75 | ||
77 | gulp.task('compile', ['templates', 'uglify']); | 76 | gulp.task('compile', ['templates', 'uglify']); |
78 | 77 | ||
79 | gulp.task('watch', function() { | 78 | gulp.task('watch', function() { |
80 | gulp.watch([paths.srcJS, paths.srcViews], ['uglify']); | 79 | gulp.watch([paths.srcJS, paths.srcViews], ['uglify']); |
81 | }); | 80 | }); |
82 | 81 | ||
83 | gulp.task('webserver', function() { | 82 | gulp.task('webserver', function() { |
84 | pump [ | 83 | pump [ |
85 | connect.server({port: 3000}) | 84 | connect.server({port: 3000}) |
86 | ] | 85 | ] |
87 | }); | 86 | }); |
88 | 87 | ||
89 | gulp.task('default', ['webserver']); | 88 | gulp.task('default', ['webserver']); |
90 | 89 |
src/js/app.js
1 | angular.module('focaEstadoCisternas', [ | 1 | angular.module('focaEstadoCisternas', []); |
2 | 'ngRoute', | ||
3 | 'focaModal', | ||
4 | 'ui.bootstrap', | ||
5 | 'focaBotoneraLateral' | ||
6 | ]); | ||
7 | 2 |
src/js/controller.js
1 | angular.module('focaEstadoCisternas') | 1 | angular.module('focaEstadoCisternas') |
2 | .controller('focaEstadoCisternasController', [ | 2 | .controller('focaEstadoCisternasController', [ |
3 | '$scope', 'focaEstadoCisternasService', 'focaModalService', | 3 | '$scope', 'focaEstadoCisternasService', 'focaModalService', |
4 | '$uibModal', 'focaBotoneraLateralService', '$timeout', | 4 | '$uibModal', 'focaBotoneraLateralService', '$timeout', |
5 | function($scope, focaEstadoCisternasService, focaModalService, | 5 | function($scope, focaEstadoCisternasService, 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 = focaEstadoCisternasService.getBotonera(); | 11 | $scope.botonera = focaEstadoCisternasService.getBotonera(); |
12 | 12 | ||
13 | //SETEO BOTONERA LATERAL | 13 | //SETEO BOTONERA LATERAL |
14 | focaBotoneraLateralService.showSalir(true); | 14 | focaBotoneraLateralService.showSalir(true); |
15 | focaBotoneraLateralService.showPausar(false); | 15 | focaBotoneraLateralService.showPausar(false); |
16 | focaBotoneraLateralService.showCancelar(false); | 16 | focaBotoneraLateralService.showCancelar(false); |
17 | focaBotoneraLateralService.showGuardar(false); | 17 | focaBotoneraLateralService.showGuardar(false); |
18 | 18 | ||
19 | $timeout(function() { | 19 | $timeout(function() { |
20 | $scope.$broadcast('addCabecera', { | 20 | $scope.$broadcast('addCabecera', { |
21 | label: 'Fecha:', | 21 | label: 'Fecha:', |
22 | valor: $scope.fecha.toLocaleDateString() | 22 | valor: $scope.fecha.toLocaleDateString() |
23 | }); | 23 | }); |
24 | }); | 24 | }); |
25 | 25 | ||
26 | $scope.seleccionarTransportista = function() { | 26 | $scope.seleccionarTransportista = function() { |
27 | var modalInstance = $uibModal.open( | 27 | var parametrosModal = { |
28 | { | 28 | titulo: 'Búsqueda de Transportista', |
29 | ariaLabelledBy: 'Busqueda de Transportista', | 29 | query: '/transportista', |
30 | templateUrl: 'modal-proveedor.html', | 30 | columnas: [ |
31 | controller: 'focaModalProveedorCtrl', | 31 | { |
32 | size: 'lg', | 32 | nombre: 'Código', |
33 | resolve: { | 33 | propiedad: 'COD' |
34 | transportista: function() { | 34 | }, |
35 | return true; | 35 | { |
36 | } | 36 | nombre: 'Nombre', |
37 | propiedad: 'NOM' | ||
38 | }, | ||
39 | { | ||
40 | nombre: 'CUIT', | ||
41 | propiedad: 'CUIT' | ||
37 | } | 42 | } |
38 | } | 43 | ] |
39 | ); | 44 | }; |
40 | return modalInstance.result; | 45 | return focaModalService.modal(parametrosModal); |
41 | }; | 46 | }; |
42 | 47 | ||
43 | $scope.seleccionarVehiculo = function() { | 48 | $scope.seleccionarVehiculo = function() { |
44 | $scope.seleccionarTransportista().then( | 49 | $scope.seleccionarTransportista().then( |
45 | function(transportista) { | 50 | function(transportista) { |
46 | elegirTransportista(transportista); | 51 | elegirTransportista(transportista); |
47 | 52 | ||
48 | var parametrosModal = { | 53 | var parametrosModal = { |
49 | columnas: [ | 54 | columnas: [ |
50 | { | 55 | { |
51 | propiedad: 'codigo', | 56 | propiedad: 'codigo', |
52 | nombre: 'Código' | 57 | nombre: 'Código' |
53 | }, | 58 | }, |
54 | { | 59 | { |
55 | propiedad: 'tractor', | 60 | propiedad: 'tractor', |
56 | nombre: 'tractor' | 61 | nombre: 'tractor' |
57 | }, | 62 | }, |
58 | { | 63 | { |
59 | propiedad: 'semi', | 64 | propiedad: 'semi', |
60 | nombre: 'Semi' | 65 | nombre: 'Semi' |
61 | }, | 66 | }, |
62 | { | 67 | { |
63 | propiedad: 'capacidadTotalCisternas', | 68 | propiedad: 'capacidadTotalCisternas', |
64 | nombre: 'Capacidad' | 69 | nombre: 'Capacidad' |
65 | } | 70 | } |
66 | ], | 71 | ], |
67 | query: '/vehiculo/transportista/' + transportista.COD, | 72 | query: '/vehiculo/transportista/' + transportista.COD, |
68 | titulo: 'Búsqueda de vehiculos', | 73 | titulo: 'Búsqueda de vehiculos', |
69 | subTitulo: transportista.COD + '-' + transportista.NOM | 74 | subTitulo: transportista.COD + '-' + transportista.NOM |
70 | }; | 75 | }; |
71 | 76 | ||
72 | focaModalService.modal(parametrosModal).then( | 77 | focaModalService.modal(parametrosModal).then( |
73 | function(vehiculo) { | 78 | function(vehiculo) { |
74 | $scope.$broadcast('addCabecera', { | 79 | $scope.$broadcast('addCabecera', { |
75 | label: 'Vehículo:', | 80 | label: 'Vehículo:', |
76 | valor: vehiculo.codigo | 81 | valor: vehiculo.codigo |
77 | }); | 82 | }); |
78 | $scope.cisternas = vehiculo.cisternas; | 83 | $scope.cisternas = vehiculo.cisternas; |
79 | getEstadosCisternas($scope.cisternas); | 84 | getEstadosCisternas($scope.cisternas); |
80 | }, function() { | 85 | }, function() { |
81 | $scope.seleccionarTransportista(); | 86 | $scope.seleccionarTransportista(); |
82 | }); | 87 | }); |
83 | }); | 88 | }); |
84 | }; | 89 | }; |
85 | 90 | ||
86 | $scope.seleccionarFechaEntrega = function() { | 91 | $scope.seleccionarFechaEntrega = function() { |
87 | focaModalService.modalFecha('Fecha').then(function(fecha) { | 92 | focaModalService.modalFecha('Fecha').then(function(fecha) { |
88 | $scope.$broadcast('addCabecera', { | 93 | $scope.$broadcast('addCabecera', { |
89 | label: 'Fecha:', | 94 | label: 'Fecha:', |
90 | valor: fecha.toLocaleDateString() | 95 | valor: fecha.toLocaleDateString() |
91 | }); | 96 | }); |
92 | $scope.fecha = fecha; | 97 | $scope.fecha = fecha; |
93 | if($scope.cisternas) | 98 | if($scope.cisternas) |
94 | getEstadosCisternas($scope.cisternas); | 99 | getEstadosCisternas($scope.cisternas); |
95 | }); | 100 | }); |
96 | }; | 101 | }; |
97 | 102 | ||
98 | $scope.seleccionarGrafico = function() { | 103 | $scope.seleccionarGrafico = function() { |
99 | if(!$scope.cisternas.length){ | 104 | if(!$scope.cisternas.length){ |
100 | focaModalService.alert('Primero seleccione un vehículo con cisternas'); | 105 | focaModalService.alert('Primero seleccione un vehículo con cisternas'); |
101 | return; | 106 | return; |
102 | } | 107 | } |
103 | $uibModal.open( | 108 | $uibModal.open( |
104 | { | 109 | { |
105 | ariaLabelledBy: 'Grafico de cisternas', | 110 | ariaLabelledBy: 'Grafico de cisternas', |
106 | templateUrl: 'modal-grafico-cisternas.html', | 111 | templateUrl: 'modal-grafico-cisternas.html', |
107 | controller: 'focaModalGraficoCisternasController', | 112 | controller: 'focaModalGraficoCisternasController', |
108 | size: 'md', | 113 | size: 'md', |
109 | resolve:{ | 114 | resolve:{ |
110 | filters: { | 115 | filters: { |
111 | cisternas: $scope.cisternas | 116 | cisternas: $scope.cisternas |
112 | } | 117 | } |
113 | } | 118 | } |
114 | } | 119 | } |
115 | ); | 120 | ); |
116 | }; | 121 | }; |
117 | 122 | ||
118 | function elegirTransportista(transportista) { | 123 | function elegirTransportista(transportista) { |
119 | var codigo = ('00000' + transportista.COD).slice(-5); | 124 | var codigo = ('00000' + transportista.COD).slice(-5); |
120 | $scope.idTransportista = transportista.COD; | 125 | $scope.idTransportista = transportista.COD; |
121 | $scope.filtros = transportista.NOM.trim(); | 126 | $scope.filtros = transportista.NOM.trim(); |
122 | $scope.$broadcast('addCabecera', { | 127 | $scope.$broadcast('addCabecera', { |
123 | label: 'Transportista:', | 128 | label: 'Transportista:', |
124 | valor: codigo + ' - ' + transportista.NOM | 129 | valor: codigo + ' - ' + transportista.NOM |
125 | }); | 130 | }); |
126 | } | 131 | } |
127 | 132 | ||
128 | function getEstadosCisternas(cisternas) { | 133 | function getEstadosCisternas(cisternas) { |
129 | cisternas.forEach(function(cisterna) { | 134 | cisternas.forEach(function(cisterna) { |
130 | focaEstadoCisternasService | 135 | focaEstadoCisternasService |
131 | .getEstadoCisterna(cisterna.id, $scope.fecha) | 136 | .getEstadoCisterna(cisterna.id, $scope.fecha) |
132 | .then(function(res) { | 137 | .then(function(res) { |
133 | cisterna.estado = res.data; | 138 | cisterna.estado = res.data; |
134 | }); | 139 | }); |
135 | }); | 140 | }); |
136 | } | 141 | } |
137 | } | 142 | } |
138 | ]); | 143 | ]); |
139 | 144 |