From c86c4954e2cabc93850186c4b19fab112078b561 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s?= Date: Tue, 15 Jan 2019 15:36:12 -0300 Subject: [PATCH] primer commit --- gulpfile.js | 4 +- package.json | 2 +- src/etc/develop.js.ejemplo | 4 ++ src/js/app.js | 1 + src/js/controller.js | 108 +++++++++++++++++++++++++++++++++++++++ src/js/route.js | 10 ++++ src/js/service.js | 11 ++++ src/views/activar-hoja-ruta.html | 52 +++++++++++++++++++ 8 files changed, 189 insertions(+), 3 deletions(-) create mode 100644 src/etc/develop.js.ejemplo create mode 100644 src/js/app.js create mode 100644 src/js/controller.js create mode 100644 src/js/route.js create mode 100644 src/js/service.js create mode 100644 src/views/activar-hoja-ruta.html diff --git a/gulpfile.js b/gulpfile.js index 694a4a3..eee2242 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -2,7 +2,7 @@ const templateCache = require('gulp-angular-templatecache'); const concat = require('gulp-concat'); const htmlmin = require('gulp-htmlmin'); const rename = require('gulp-rename'); -const uglify = require('gulp-uglify-es').default; +const uglify = require('gulp-uglify'); const gulp = require('gulp'); const pump = require('pump'); const jshint = require('gulp-jshint'); @@ -40,7 +40,7 @@ gulp.task('uglify', ['templates'], function() { 'tmp/views.js' ]), concat('foca-activar-hoja-ruta.js'), - replace("['ngRoute', 'focaModal', 'ui.bootstrap']", '[]'), + replace("['ngRoute', 'focaModal', 'ui.bootstrap', 'focaBotoneraLateral']", '[]'), replace("src/views/", ''), gulp.dest(paths.tmp), rename('foca-activar-hoja-ruta.min.js'), diff --git a/package.json b/package.json index 860148a..a4369e7 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "author": "", "license": "ISC", "devDependencies": { - "gulp": "^4.0.0", + "gulp": "^3.9.1", "gulp-angular-templatecache": "^2.2.6", "gulp-clean": "^0.4.0", "gulp-connect": "^5.7.0", diff --git a/src/etc/develop.js.ejemplo b/src/etc/develop.js.ejemplo new file mode 100644 index 0000000..252c6eb --- /dev/null +++ b/src/etc/develop.js.ejemplo @@ -0,0 +1,4 @@ +angular.module('focaAbmVehiculo') + .constant("API_ENDPOINT", { + 'URL': '//127.0.0.1:9000' + }); diff --git a/src/js/app.js b/src/js/app.js new file mode 100644 index 0000000..c3e7d80 --- /dev/null +++ b/src/js/app.js @@ -0,0 +1 @@ +angular.module('focaActivarHojaRuta', ['ngRoute', 'focaModal', 'ui.bootstrap', 'focaBotoneraLateral']); diff --git a/src/js/controller.js b/src/js/controller.js new file mode 100644 index 0000000..a6baf02 --- /dev/null +++ b/src/js/controller.js @@ -0,0 +1,108 @@ +angular.module('focaActivarHojaRuta') + .controller('focaActivarHojaRutaController', [ + '$scope', 'focaActivarHojaRutaService', '$location', 'focaModalService', + '$uibModal', 'focaBotoneraLateralService', '$timeout', + function($scope, focaActivarHojaRutaService, $location, focaModalService, + $uibModal, focaBotoneraLateralService, $timeout) { + config(); + + //METODOS + function config() { + $scope.botonera = [{ + label: 'Chofer', + image: 'cliente.png' + }]; + //SETEO BOTONERA LATERAL + focaBotoneraLateralService.showSalir(true); + focaBotoneraLateralService.showPausar(false); + focaBotoneraLateralService.showCancelar(false); + focaBotoneraLateralService.showGuardar(false); + + init(); + } + + function init() { + $scope.now = new Date(); + $scope.hojasRuta = []; + $scope.$broadcast('removeCabecera', 'Chofer:'); + } + + $scope.seleccionarChofer = function() { + var modalInstance = $uibModal.open( + { + ariaLabelledBy: 'Busqueda de Chofer', + templateUrl: 'modal-chofer.html', + controller: 'focaModalChoferController', + size: 'lg' + } + ); + modalInstance.result.then( + function(chofer) { + $scope.chofer = chofer.id; + focaActivarHojaRutaService.getHojasRutas($scope.chofer) + .then(function(hojasRutas) { + $scope.$broadcast('addCabecera', { + label: 'Chofer:', + valor: $scope.chofer + ' - ' + chofer.nombre + }); + + $scope.hojasRuta = hojasRutas.data; + }) + }, function() { + + } + ); + }; + + $scope.activarHojaRuta = function(hoja_ruta_id) { + focaActivarHojaRutaService.activarHojaRuta(hoja_ruta_id, $scope.chofer) + .then(function(hojaRuta) { + init(); + focaModalService.alert('Hoja de ruta activada'); + }) + } + + + /* + + if(focaActivarHojaRutaService.transportistaSeleccionado.COD) { + elegirTransportista(focaActivarHojaRutaService.transportistaSeleccionado); + } + focaActivarHojaRutaService.cleanCisternasLocal(); + $scope.editar = function(id) { + $location.path('/vehiculo/' + id + '/' + $scope.idTransportista); + }; + $scope.solicitarConfirmacion = function(vehiculo) { + focaModalService.confirm('¿Está seguro que desea borrar el vehiculo ' + + vehiculo.id + ' ' + vehiculo.tractor + ' ?').then( + function(data) { + if(data) { + focaActivarHojaRutaService.deleteVehiculo(vehiculo.id); + $scope.vehiculos.splice($scope.vehiculos.indexOf(vehiculo), 1); + } + } + ); + }; + + function elegirTransportista(transportista) { + var codigo = ('00000' + transportista.COD).slice(-5); + $scope.idTransportista = transportista.COD; + $scope.filtros = transportista.NOM.trim(); + $timeout(function() { + $scope.$broadcast('addCabecera', { + label: 'Transportista:', + valor: codigo + ' - ' + transportista.NOM + }); + }); + buscar(transportista.COD); + } + + function buscar(idTransportista) { + focaActivarHojaRutaService + .getVehiculosPorTransportista(idTransportista) + .then(function(datos) { + $scope.vehiculos = datos.data; + }); + }*/ + } + ]); diff --git a/src/js/route.js b/src/js/route.js new file mode 100644 index 0000000..765a34f --- /dev/null +++ b/src/js/route.js @@ -0,0 +1,10 @@ +angular.module('focaActivarHojaRuta') + .config([ + '$routeProvider', + function($routeProvider) { + $routeProvider.when('/hoja-ruta/activar', { + controller: 'focaActivarHojaRutaController', + templateUrl: 'src/views/activar-hoja-ruta.html' + }); + } + ]); diff --git a/src/js/service.js b/src/js/service.js new file mode 100644 index 0000000..5bedb33 --- /dev/null +++ b/src/js/service.js @@ -0,0 +1,11 @@ +angular.module('focaActivarHojaRuta') + .factory('focaActivarHojaRutaService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { + return { + getHojasRutas: function(chofer) { + return $http.get(API_ENDPOINT.URL + '/hoja-ruta/disponible/' + chofer); + }, + activarHojaRuta: function(hoja_ruta, chofer) { + return $http.get(API_ENDPOINT.URL + '/hoja-ruta/activar/' + hoja_ruta + '/' + chofer); + } + }; + }]); diff --git a/src/views/activar-hoja-ruta.html b/src/views/activar-hoja-ruta.html new file mode 100644 index 0000000..ca6b678 --- /dev/null +++ b/src/views/activar-hoja-ruta.html @@ -0,0 +1,52 @@ +
+ +
+
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + +
NúmeroFechaRemitos +
+ +
+
+
-- 1.9.1