From 8f543dcbf2b54cf27dfffc24385c342ac7c3ca48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s?= Date: Sat, 12 Jan 2019 13:39:51 -0300 Subject: [PATCH] subida version 0.1 --- .gitignore | 5 ++ .jshintrc | 64 +++++++++++++++++++++++ gulpfile.js | 89 ++++++++++++++++++++++++++++++++ package.json | 3 +- src/etc/develop.js.ejemplo | 4 ++ src/js/app.js | 4 ++ src/js/controller.js | 111 ++++++++++++++++++++++++++++++++++++++++ src/js/route.js | 10 ++++ src/js/service.js | 14 +++++ src/views/foca-crear-login.html | 45 ++++++++++++++++ 10 files changed, 348 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 .jshintrc create mode 100644 gulpfile.js 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/foca-crear-login.html diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e9fd069 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +/node_modules +/dist +/tmp +package-lock\.json +src/etc/develop.js diff --git a/.jshintrc b/.jshintrc new file mode 100644 index 0000000..d8cbb07 --- /dev/null +++ b/.jshintrc @@ -0,0 +1,64 @@ +{ + /* + * ENVIRONMENTS + * ================= + */ + + // Define globals exposed by modern browsers. + "browser": true, + + // Define globals exposed by jQuery. + "jquery": true, + + // Define globals exposed by Node.js. + "node": true, + + // Allow ES6. + "esversion": 6, + + /* + * ENFORCING OPTIONS + * ================= + */ + + // Force all variable names to use either camelCase style or UPPER_CASE + // with underscores. + "camelcase": true, + + // Prohibit use of == and != in favor of === and !==. + "eqeqeq": true, + + // Enforce tab width of 2 spaces. + "indent": 4, + + // Prohibit use of a variable before it is defined. + "latedef": false, + + // Enforce line length to 100 characters + "maxlen": 100, + + // Require capitalized names for constructor functions. + "newcap": true, + + // Enforce use of single quotation marks for strings. + "quotmark": "single", + + // Enforce placing 'use strict' at the top function scope + "strict": false, + + // Prohibit use of explicitly undeclared variables. + "undef": true, + + // Warn when variables are defined but never used. + "unused": true, + + // Para que funcione en angular + "predef": ["angular", "alert", "spyOn", "expect", "it", "inject", "beforeEach", "describe"], + /* + * RELAXING OPTIONS + * ================= + */ + + // Suppress warnings about == null comparisons. + "eqnull": true +} diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..2adeb04 --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,89 @@ +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 gulp = require('gulp'); +const pump = require('pump'); +const jshint = require('gulp-jshint'); +const replace = require('gulp-replace'); +const connect = require('gulp-connect'); +const clean = require('gulp-clean'); + +var paths = { + srcJS: 'src/js/*.js', + srcViews: 'src/views/*.html', + tmp: 'tmp', + dist: 'dist/' +}; + +gulp.task('templates', function() { + return pump( + [ + gulp.src(paths.srcViews), + replace('views/', ''), + htmlmin(), + templateCache('views.js', { + module: 'focaCrearLogin', + root: '' + }), + gulp.dest(paths.tmp) + ] + ); +}); + +gulp.task('uglify', ['templates'], function() { + return pump( + [ + gulp.src([ + paths.srcJS, + 'tmp/views.js' + ]), + concat('foca-crear-login.js'), + replace("['ngRoute', 'focaBotoneraLateral']", '[]'), + replace("src/views/", ''), + gulp.dest(paths.tmp), + rename('foca-crear-login.min.js'), + uglify(), + gulp.dest(paths.dist) + ] + ); +}); + +gulp.task('clean', function() { + return gulp.src(['tmp', 'dist'], {read: false}) + .pipe(clean()); +}); + +gulp.task('pre-commit', function() { + pump( + [ + gulp.src(paths.srcJS), + jshint('.jshintrc'), + jshint.reporter('default'), + jshint.reporter('fail') + ] + ); + + gulp.start('uglify'); +}); + +gulp.task('clean-post-install', function() { + return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', + 'index.html'], {read: false}) + .pipe(clean()); +}); + +gulp.task('compile', ['templates', 'uglify']); + +gulp.task('watch', function() { + gulp.watch([paths.srcJS, paths.srcViews], ['uglify']); +}); + +gulp.task('webserver', function() { + pump [ + connect.server({port: 3000}) + ] +}); + +gulp.task('default', ['webserver']); diff --git a/package.json b/package.json index 35a624c..77f3360 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,8 @@ "angular": "^1.7.5", "angular-route": "^1.7.5", "bootstrap": "^4.2.1", - "gulp": "^4.0.0", + "foca-modal-chofer": "git+http://git.focasoftware.com/npm/foca-modal-chofer.git", + "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..e2f7c7f --- /dev/null +++ b/src/js/app.js @@ -0,0 +1,4 @@ +angular.module('focaCrearLogin', [ + 'ngRoute', + 'focaBotoneraLateral' +]); diff --git a/src/js/controller.js b/src/js/controller.js new file mode 100644 index 0000000..fdb853f --- /dev/null +++ b/src/js/controller.js @@ -0,0 +1,111 @@ +angular.module('focaCrearLogin') + .controller('focaCrearLoginController', [ + '$scope', '$timeout', '$uibModal', 'focaCrearLoginService','focaBotoneraLateralService', + function($scope, $timeout, $uibModal, focaCrearLoginService, focaBotoneraLateralService) { + config(); + + + + //METODOS + function init() { + $scope.now = new Date(); + $scope.seleccionado = ''; + $scope.cuentas = []; + $scope.$broadcast('removeCabecera', { + label: 'Selección:', + valor: $scope.seleccionado + }); + } + + function config() { + $scope.botonera = [ + { + label: 'Transportista', + image: 'cliente.png' + }, + { + label: 'Cobrador', + image: 'cliente.png' + }, + { + label: 'Vendedor', + image: 'cliente.png' + } + ]; + + $timeout(function() { + focaBotoneraLateralService.showSalir(true); + focaBotoneraLateralService.showPausar(false); + focaBotoneraLateralService.showCancelar(false); + focaBotoneraLateralService.showGuardar(false); + }); + + init(); + } + + $scope.seleccionarTransportista = function() { + $scope.seleccionado = 'Transportistas'; + + focaCrearLoginService.getListaChoferes().then(setearTabla); + }; + + $scope.seleccionarCobrador = function() { + $scope.seleccionado = 'Cobradores'; + + focaCrearLoginService.getListaCobradores().then(setearTabla); + }; + + $scope.seleccionarVendedor = function() { + $scope.seleccionado = 'Vendedores'; + + focaCrearLoginService.getListaVendedores().then(setearTabla); + }; + + $scope.openModalAcceso = function(cuenta) { + var parametros = { + cuenta: cuenta, + tipo: $scope.seleccionado + } + + var modalInstance = $uibModal.open( + { + ariaLabelledBy: 'Configuracion de Logueo', + templateUrl: 'modal-login.html', + controller: 'focaModalLoginController', + size: 'md', + resolve: { + parametros: function() { + return parametros; + } + } + } + ); + + modalInstance.result.then( + function(result) { + init(); + }, function() {} + ); + } + + function setearTabla(datos) { + $scope.cuentas = datos.data; + + if ($scope.seleccionado == 'Cobradores' || + $scope.seleccionado == 'Vendedores' + ) { + for (var i = $scope.cuentas.length - 1; i >= 0; i--) { + $scope.cuentas[i].id = $scope.cuentas[i].CodVen; + $scope.cuentas[i].nombre = $scope.cuentas[i].NomVen; + $scope.cuentas[i].dni = $scope.cuentas[i].DNI; + $scope.cuentas[i].telefono = $scope.cuentas[i].TelVen; + } + } + + $scope.$broadcast('removeCabecera', { + label: 'Selección:', + valor: $scope.seleccionado + }); + } + } + ]); diff --git a/src/js/route.js b/src/js/route.js new file mode 100644 index 0000000..d6d43a0 --- /dev/null +++ b/src/js/route.js @@ -0,0 +1,10 @@ +angular.module('focaCrearLogin') + .config([ + '$routeProvider', + function($routeProvider) { + $routeProvider.when('/login/crear', { + controller: 'focaCrearLoginController', + templateUrl: 'src/views/foca-crear-login.html' + }); + } + ]); diff --git a/src/js/service.js b/src/js/service.js new file mode 100644 index 0000000..e9d5859 --- /dev/null +++ b/src/js/service.js @@ -0,0 +1,14 @@ +angular.module('focaCrearLogin') + .factory('focaCrearLoginService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { + return { + getListaChoferes: function() { + return $http.get(API_ENDPOINT.URL + '/chofer'); + }, + getListaCobradores: function() { + return $http.get(API_ENDPOINT.URL + '/cobrador'); + }, + getListaVendedores: function() { + return $http.get(API_ENDPOINT.URL + '/vendedor'); + } + }; + }]); diff --git a/src/views/foca-crear-login.html b/src/views/foca-crear-login.html new file mode 100644 index 0000000..1c5bc11 --- /dev/null +++ b/src/views/foca-crear-login.html @@ -0,0 +1,45 @@ +
+ +
+
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + +
CódigoNombreDNITeléfono +
+ +
+
+
-- 1.9.1