Commit 90a86b098e670c81ee2b1769fe834a1ba1bd33d6
Exists in
master
Merge branch 'master' into 'master'
Master See merge request !1
Showing
8 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'); |
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: 'focaActivarHojaRuta', | 27 | module: 'focaActivarHojaRuta', |
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-activar-hoja-ruta.js'), | 42 | concat('foca-activar-hoja-ruta.js'), |
43 | replace("['ngRoute', 'focaModal', 'ui.bootstrap']", '[]'), | 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-activar-hoja-ruta.min.js'), | 46 | rename('foca-activar-hoja-ruta.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 |
package.json
1 | { | 1 | { |
2 | "name": "foca-activar-hoja-ruta", | 2 | "name": "foca-activar-hoja-ruta", |
3 | "version": "0.0.1", | 3 | "version": "0.0.1", |
4 | "description": "", | 4 | "description": "", |
5 | "main": "index.js", | 5 | "main": "index.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-ladda ladda@1.0.6 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-uglify jquery jshint pump git+ssh://git@debonline.dyndns.org:npm/foca-directivas.git git+ssh://git@debonline.dyndns.org:npm/foca-modal-remito.git" | 11 | "install-dev": "npm install -D jasmine-core pre-commit angular angular-ladda ladda@1.0.6 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-uglify jquery jshint pump git+ssh://git@debonline.dyndns.org:npm/foca-directivas.git git+ssh://git@debonline.dyndns.org:npm/foca-modal-remito.git" |
12 | }, | 12 | }, |
13 | "pre-commit": [ | 13 | "pre-commit": [ |
14 | "gulp-pre-commit" | 14 | "gulp-pre-commit" |
15 | ], | 15 | ], |
16 | "author": "", | 16 | "author": "", |
17 | "license": "ISC", | 17 | "license": "ISC", |
18 | "devDependencies": { | 18 | "devDependencies": { |
19 | "gulp": "^4.0.0", | 19 | "gulp": "^3.9.1", |
20 | "gulp-angular-templatecache": "^2.2.6", | 20 | "gulp-angular-templatecache": "^2.2.6", |
21 | "gulp-clean": "^0.4.0", | 21 | "gulp-clean": "^0.4.0", |
22 | "gulp-connect": "^5.7.0", | 22 | "gulp-connect": "^5.7.0", |
23 | "gulp-htmlmin": "^5.0.1", | 23 | "gulp-htmlmin": "^5.0.1", |
24 | "gulp-jshint": "^2.1.0", | 24 | "gulp-jshint": "^2.1.0", |
25 | "gulp-rename": "^1.4.0", | 25 | "gulp-rename": "^1.4.0", |
26 | "gulp-replace": "^1.0.0", | 26 | "gulp-replace": "^1.0.0", |
27 | "gulp-uglify": "^3.0.1", | 27 | "gulp-uglify": "^3.0.1", |
28 | "jshint": "^2.9.7", | 28 | "jshint": "^2.9.7", |
29 | "pre-commit": "^1.2.2", | 29 | "pre-commit": "^1.2.2", |
30 | "pump": "^3.0.0" | 30 | "pump": "^3.0.0" |
31 | } | 31 | } |
32 | } | 32 | } |
33 | 33 |
src/etc/develop.js.ejemplo
File was created | 1 | angular.module('focaActivarHojaRuta') | |
2 | .constant("API_ENDPOINT", { | ||
3 | 'URL': '//127.0.0.1:9000' | ||
4 | }); | ||
5 |
src/js/app.js
File was created | 1 | angular.module('focaActivarHojaRuta', ['ngRoute', 'focaModal', 'ui.bootstrap', 'focaBotoneraLateral']); | |
2 |
src/js/controller.js
File was created | 1 | angular.module('focaActivarHojaRuta') | |
2 | .controller('focaActivarHojaRutaController', [ | ||
3 | '$scope', 'focaActivarHojaRutaService', '$location', 'focaModalService', | ||
4 | '$uibModal', 'focaBotoneraLateralService', '$timeout', | ||
5 | function($scope, focaActivarHojaRutaService, $location, focaModalService, | ||
6 | $uibModal, focaBotoneraLateralService, $timeout) { | ||
7 | config(); | ||
8 | |||
9 | //METODOS | ||
10 | function config() { | ||
11 | $scope.botonera = [{ | ||
12 | label: 'Chofer', | ||
13 | image: 'cliente.png' | ||
14 | }]; | ||
15 | //SETEO BOTONERA LATERAL | ||
16 | focaBotoneraLateralService.showSalir(true); | ||
17 | focaBotoneraLateralService.showPausar(false); | ||
18 | focaBotoneraLateralService.showCancelar(false); | ||
19 | focaBotoneraLateralService.showGuardar(false); | ||
20 | |||
21 | init(); | ||
22 | } | ||
23 | |||
24 | function init() { | ||
25 | $scope.now = new Date(); | ||
26 | $scope.hojasRuta = []; | ||
27 | $scope.$broadcast('removeCabecera', 'Chofer:'); | ||
28 | } | ||
29 | |||
30 | $scope.seleccionarChofer = function() { | ||
31 | var modalInstance = $uibModal.open( | ||
32 | { | ||
33 | ariaLabelledBy: 'Busqueda de Chofer', | ||
34 | templateUrl: 'modal-chofer.html', | ||
35 | controller: 'focaModalChoferController', | ||
36 | size: 'lg' | ||
37 | } | ||
38 | ); | ||
39 | modalInstance.result.then( | ||
40 | function(chofer) { | ||
41 | $scope.chofer = chofer.id; | ||
42 | focaActivarHojaRutaService.getHojasRutas($scope.chofer) | ||
43 | .then(function(hojasRutas) { | ||
44 | $scope.$broadcast('addCabecera', { | ||
45 | label: 'Chofer:', | ||
46 | valor: $scope.chofer + ' - ' + chofer.nombre | ||
47 | }); | ||
48 | |||
49 | $scope.hojasRuta = hojasRutas.data; | ||
50 | }) | ||
51 | }, function() { | ||
52 | |||
53 | } | ||
54 | ); | ||
55 | }; | ||
56 | |||
57 | $scope.activarHojaRuta = function(hoja_ruta_id) { | ||
58 | focaActivarHojaRutaService.activarHojaRuta(hoja_ruta_id, $scope.chofer) | ||
59 | .then(function(hojaRuta) { | ||
60 | init(); | ||
61 | focaModalService.alert('Hoja de ruta activada'); | ||
62 | }) | ||
63 | } | ||
64 | |||
65 | |||
66 | /* | ||
67 | |||
68 | if(focaActivarHojaRutaService.transportistaSeleccionado.COD) { | ||
69 | elegirTransportista(focaActivarHojaRutaService.transportistaSeleccionado); | ||
70 | } | ||
71 | focaActivarHojaRutaService.cleanCisternasLocal(); | ||
72 | $scope.editar = function(id) { | ||
73 | $location.path('/vehiculo/' + id + '/' + $scope.idTransportista); | ||
74 | }; | ||
75 | $scope.solicitarConfirmacion = function(vehiculo) { | ||
76 | focaModalService.confirm('¿Está seguro que desea borrar el vehiculo ' + | ||
77 | vehiculo.id + ' ' + vehiculo.tractor + ' ?').then( | ||
78 | function(data) { | ||
79 | if(data) { | ||
80 | focaActivarHojaRutaService.deleteVehiculo(vehiculo.id); | ||
81 | $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1); | ||
82 | } | ||
83 | } | ||
84 | ); | ||
85 | }; | ||
86 | |||
87 | function elegirTransportista(transportista) { | ||
88 | var codigo = ('00000' + transportista.COD).slice(-5); | ||
89 | $scope.idTransportista = transportista.COD; | ||
90 | $scope.filtros = transportista.NOM.trim(); | ||
91 | $timeout(function() { | ||
92 | $scope.$broadcast('addCabecera', { | ||
93 | label: 'Transportista:', | ||
94 | valor: codigo + ' - ' + transportista.NOM | ||
95 | }); | ||
96 | }); | ||
97 | buscar(transportista.COD); | ||
98 | } | ||
99 | |||
100 | function buscar(idTransportista) { | ||
101 | focaActivarHojaRutaService | ||
102 | .getVehiculosPorTransportista(idTransportista) | ||
103 | .then(function(datos) { | ||
104 | $scope.vehiculos = datos.data; | ||
105 | }); | ||
106 | }*/ | ||
107 | } | ||
108 | ]); | ||
109 |
src/js/route.js
File was created | 1 | angular.module('focaActivarHojaRuta') | |
2 | .config([ | ||
3 | '$routeProvider', | ||
4 | function($routeProvider) { | ||
5 | $routeProvider.when('/hoja-ruta/activar', { | ||
6 | controller: 'focaActivarHojaRutaController', | ||
7 | templateUrl: 'src/views/activar-hoja-ruta.html' | ||
8 | }); | ||
9 | } | ||
10 | ]); | ||
11 |
src/js/service.js
File was created | 1 | angular.module('focaActivarHojaRuta') | |
2 | .factory('focaActivarHojaRutaService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { | ||
3 | return { | ||
4 | getHojasRutas: function(chofer) { | ||
5 | return $http.get(API_ENDPOINT.URL + '/hoja-ruta/disponible/' + chofer); | ||
6 | }, | ||
7 | activarHojaRuta: function(hoja_ruta, chofer) { | ||
8 | return $http.get(API_ENDPOINT.URL + '/hoja-ruta/activar/' + hoja_ruta + '/' + chofer); | ||
9 | } | ||
10 | }; | ||
11 | }]); | ||
12 |
src/views/activar-hoja-ruta.html
File was created | 1 | <div class="row"> | |
2 | <foca-cabecera-facturador | ||
3 | titulo="'Activar Hoja de Ruta'" | ||
4 | fecha="now" | ||
5 | class="mb-0 col-lg-12" | ||
6 | ></foca-cabecera-facturador> | ||
7 | </div> | ||
8 | <div class="row"> | ||
9 | <div class="col-12 col-md-10 p-0 mt-4 border border-white rounded"> | ||
10 | <div class="row px-5 py-2 botonera-secundaria"> | ||
11 | <div class="col-12"> | ||
12 | <foca-botonera-facturador botones="botonera" extra="5" class="row"></foca-botonera-facturador> | ||
13 | </div> | ||
14 | </div> | ||
15 | <!-- <div class="col-6 form-group"> | ||
16 | <input seleccionarTransportista() | ||
17 | type="text" | ||
18 | teclado-virtual | ||
19 | class="form-control form-control-sm" | ||
20 | placeholder="Búsqueda" | ||
21 | ng-model="filtros" | ||
22 | /> | ||
23 | </div> --> | ||
24 | <table class="table table-default table-hover table-sm table-abm table-striped mb-0"> | ||
25 | <thead> | ||
26 | <tr> | ||
27 | <th>Número</th> | ||
28 | <th>Fecha</th> | ||
29 | <th>Remitos</th> | ||
30 | <th class="text-center"> | ||
31 | </th> | ||
32 | </tr> | ||
33 | </thead> | ||
34 | <tbody> | ||
35 | <tr ng-repeat="hojaRuta in hojasRuta | filter:filtros"> | ||
36 | <td ng-bind="[hojaRuta.sucursal, hojaRuta.numeroHojaRuta] | comprobante"></td> | ||
37 | <td ng-bind="hojaRuta.fechaReparto | date:'yyyy-MM-dd'"></td> | ||
38 | <td ng-bind="hojaRuta.remitos.length"></td> | ||
39 | <td class="text-center"> | ||
40 | <button | ||
41 | class="btn btn-outline-dark boton-accion" | ||
42 | title="Editar" | ||
43 | ng-click="activarHojaRuta(hojaRuta.id)" | ||
44 | > | ||
45 | <i class="fa fa-check"></i> | ||
46 | </button> | ||
47 | </td> | ||
48 | </tr> | ||
49 | </body> | ||
50 | </table> | ||
51 | </div> | ||
52 | </div> | ||
53 |