Commit 8f543dcbf2b54cf27dfffc24385c342ac7c3ca48

Authored by Nicolás Guarnieri
1 parent 17c37a88f4
Exists in master

subida version 0.1

File was created 1 /node_modules
2 /dist
3 /tmp
4 package-lock\.json
5 src/etc/develop.js
6
File was created 1 {
2 /*
3 * ENVIRONMENTS
4 * =================
5 */
6
7 // Define globals exposed by modern browsers.
8 "browser": true,
9
10 // Define globals exposed by jQuery.
11 "jquery": true,
12
13 // Define globals exposed by Node.js.
14 "node": true,
15
16 // Allow ES6.
17 "esversion": 6,
18
19 /*
20 * ENFORCING OPTIONS
21 * =================
22 */
23
24 // Force all variable names to use either camelCase style or UPPER_CASE
25 // with underscores.
26 "camelcase": true,
27
28 // Prohibit use of == and != in favor of === and !==.
29 "eqeqeq": true,
30
31 // Enforce tab width of 2 spaces.
32 "indent": 4,
33
34 // Prohibit use of a variable before it is defined.
35 "latedef": false,
36
37 // Enforce line length to 100 characters
38 "maxlen": 100,
39
40 // Require capitalized names for constructor functions.
41 "newcap": true,
42
43 // Enforce use of single quotation marks for strings.
44 "quotmark": "single",
45
46 // Enforce placing 'use strict' at the top function scope
47 "strict": false,
48
49 // Prohibit use of explicitly undeclared variables.
50 "undef": true,
51
52 // Warn when variables are defined but never used.
53 "unused": true,
54
55 // Para que funcione en angular
56 "predef": ["angular", "alert", "spyOn", "expect", "it", "inject", "beforeEach", "describe"],
57 /*
58 * RELAXING OPTIONS
59 * =================
60 */
61
62 // Suppress warnings about == null comparisons.
63 "eqnull": true
64 }
65
File was created 1 const templateCache = require('gulp-angular-templatecache');
2 const concat = require('gulp-concat');
3 const htmlmin = require('gulp-htmlmin');
4 const rename = require('gulp-rename');
5 const uglify = require('gulp-uglify-es').default;
6 const gulp = require('gulp');
7 const pump = require('pump');
8 const jshint = require('gulp-jshint');
9 const replace = require('gulp-replace');
10 const connect = require('gulp-connect');
11 const clean = require('gulp-clean');
12
13 var paths = {
14 srcJS: 'src/js/*.js',
15 srcViews: 'src/views/*.html',
16 tmp: 'tmp',
17 dist: 'dist/'
18 };
19
20 gulp.task('templates', function() {
21 return pump(
22 [
23 gulp.src(paths.srcViews),
24 replace('views/', ''),
25 htmlmin(),
26 templateCache('views.js', {
27 module: 'focaCrearLogin',
28 root: ''
29 }),
30 gulp.dest(paths.tmp)
31 ]
32 );
33 });
34
35 gulp.task('uglify', ['templates'], function() {
36 return pump(
37 [
38 gulp.src([
39 paths.srcJS,
40 'tmp/views.js'
41 ]),
42 concat('foca-crear-login.js'),
43 replace("['ngRoute', 'focaBotoneraLateral']", '[]'),
44 replace("src/views/", ''),
45 gulp.dest(paths.tmp),
46 rename('foca-crear-login.min.js'),
47 uglify(),
48 gulp.dest(paths.dist)
49 ]
50 );
51 });
52
53 gulp.task('clean', function() {
54 return gulp.src(['tmp', 'dist'], {read: false})
55 .pipe(clean());
56 });
57
58 gulp.task('pre-commit', function() {
59 pump(
60 [
61 gulp.src(paths.srcJS),
62 jshint('.jshintrc'),
63 jshint.reporter('default'),
64 jshint.reporter('fail')
65 ]
66 );
67
68 gulp.start('uglify');
69 });
70
71 gulp.task('clean-post-install', function() {
72 return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js',
73 'index.html'], {read: false})
74 .pipe(clean());
75 });
76
77 gulp.task('compile', ['templates', 'uglify']);
78
79 gulp.task('watch', function() {
80 gulp.watch([paths.srcJS, paths.srcViews], ['uglify']);
81 });
82
83 gulp.task('webserver', function() {
84 pump [
85 connect.server({port: 3000})
86 ]
87 });
88
89 gulp.task('default', ['webserver']);
90
1 { 1 {
2 "name": "foca-crear-login", 2 "name": "foca-crear-login",
3 "version": "0.0.1", 3 "version": "0.0.1",
4 "description": "foca-crear-login", 4 "description": "foca-crear-login",
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 }, 8 },
9 "repository": { 9 "repository": {
10 "type": "git", 10 "type": "git",
11 "url": "git@git.focasoftware.com:npm/foca-crear-login.git" 11 "url": "git@git.focasoftware.com:npm/foca-crear-login.git"
12 }, 12 },
13 "author": "", 13 "author": "",
14 "license": "ISC", 14 "license": "ISC",
15 "devDependencies": { 15 "devDependencies": {
16 "angular": "^1.7.5", 16 "angular": "^1.7.5",
17 "angular-route": "^1.7.5", 17 "angular-route": "^1.7.5",
18 "bootstrap": "^4.2.1", 18 "bootstrap": "^4.2.1",
19 "gulp": "^4.0.0", 19 "foca-modal-chofer": "git+http://git.focasoftware.com/npm/foca-modal-chofer.git",
20 "gulp": "^3.9.1",
20 "gulp-angular-templatecache": "^2.2.6", 21 "gulp-angular-templatecache": "^2.2.6",
21 "gulp-clean": "^0.4.0", 22 "gulp-clean": "^0.4.0",
22 "gulp-connect": "^5.7.0", 23 "gulp-connect": "^5.7.0",
23 "gulp-htmlmin": "^5.0.1", 24 "gulp-htmlmin": "^5.0.1",
24 "gulp-jshint": "^2.1.0", 25 "gulp-jshint": "^2.1.0",
25 "gulp-rename": "^1.4.0", 26 "gulp-rename": "^1.4.0",
26 "gulp-replace": "^1.0.0", 27 "gulp-replace": "^1.0.0",
27 "gulp-uglify": "^3.0.1", 28 "gulp-uglify": "^3.0.1",
28 "gulp-uglify-es": "^1.0.4", 29 "gulp-uglify-es": "^1.0.4",
29 "jasmine-core": "^3.3.0", 30 "jasmine-core": "^3.3.0",
30 "jquery": "^3.3.1", 31 "jquery": "^3.3.1",
31 "jshint": "^2.9.7", 32 "jshint": "^2.9.7",
32 "pre-commit": "^1.2.2", 33 "pre-commit": "^1.2.2",
33 "pump": "^3.0.0" 34 "pump": "^3.0.0"
34 } 35 }
35 } 36 }
36 37
src/etc/develop.js.ejemplo
File was created 1 angular.module('focaAbmVehiculo')
2 .constant("API_ENDPOINT", {
3 'URL': '//127.0.0.1:9000'
4 });
5
File was created 1 angular.module('focaCrearLogin', [
2 'ngRoute',
3 'focaBotoneraLateral'
4 ]);
5
src/js/controller.js
File was created 1 angular.module('focaCrearLogin')
2 .controller('focaCrearLoginController', [
3 '$scope', '$timeout', '$uibModal', 'focaCrearLoginService','focaBotoneraLateralService',
4 function($scope, $timeout, $uibModal, focaCrearLoginService, focaBotoneraLateralService) {
5 config();
6
7
8
9 //METODOS
10 function init() {
11 $scope.now = new Date();
12 $scope.seleccionado = '';
13 $scope.cuentas = [];
14 $scope.$broadcast('removeCabecera', {
15 label: 'Selección:',
16 valor: $scope.seleccionado
17 });
18 }
19
20 function config() {
21 $scope.botonera = [
22 {
23 label: 'Transportista',
24 image: 'cliente.png'
25 },
26 {
27 label: 'Cobrador',
28 image: 'cliente.png'
29 },
30 {
31 label: 'Vendedor',
32 image: 'cliente.png'
33 }
34 ];
35
36 $timeout(function() {
37 focaBotoneraLateralService.showSalir(true);
38 focaBotoneraLateralService.showPausar(false);
39 focaBotoneraLateralService.showCancelar(false);
40 focaBotoneraLateralService.showGuardar(false);
41 });
42
43 init();
44 }
45
46 $scope.seleccionarTransportista = function() {
47 $scope.seleccionado = 'Transportistas';
48
49 focaCrearLoginService.getListaChoferes().then(setearTabla);
50 };
51
52 $scope.seleccionarCobrador = function() {
53 $scope.seleccionado = 'Cobradores';
54
55 focaCrearLoginService.getListaCobradores().then(setearTabla);
56 };
57
58 $scope.seleccionarVendedor = function() {
59 $scope.seleccionado = 'Vendedores';
60
61 focaCrearLoginService.getListaVendedores().then(setearTabla);
62 };
63
64 $scope.openModalAcceso = function(cuenta) {
65 var parametros = {
66 cuenta: cuenta,
67 tipo: $scope.seleccionado
68 }
69
70 var modalInstance = $uibModal.open(
71 {
72 ariaLabelledBy: 'Configuracion de Logueo',
73 templateUrl: 'modal-login.html',
74 controller: 'focaModalLoginController',
75 size: 'md',
76 resolve: {
77 parametros: function() {
78 return parametros;
79 }
80 }
81 }
82 );
83
84 modalInstance.result.then(
85 function(result) {
86 init();
87 }, function() {}
88 );
89 }
90
91 function setearTabla(datos) {
92 $scope.cuentas = datos.data;
93
94 if ($scope.seleccionado == 'Cobradores' ||
95 $scope.seleccionado == 'Vendedores'
96 ) {
97 for (var i = $scope.cuentas.length - 1; i >= 0; i--) {
98 $scope.cuentas[i].id = $scope.cuentas[i].CodVen;
99 $scope.cuentas[i].nombre = $scope.cuentas[i].NomVen;
100 $scope.cuentas[i].dni = $scope.cuentas[i].DNI;
101 $scope.cuentas[i].telefono = $scope.cuentas[i].TelVen;
102 }
103 }
104
105 $scope.$broadcast('removeCabecera', {
106 label: 'Selección:',
107 valor: $scope.seleccionado
108 });
109 }
110 }
111 ]);
112
File was created 1 angular.module('focaCrearLogin')
2 .config([
3 '$routeProvider',
4 function($routeProvider) {
5 $routeProvider.when('/login/crear', {
6 controller: 'focaCrearLoginController',
7 templateUrl: 'src/views/foca-crear-login.html'
8 });
9 }
10 ]);
11
File was created 1 angular.module('focaCrearLogin')
2 .factory('focaCrearLoginService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) {
3 return {
4 getListaChoferes: function() {
5 return $http.get(API_ENDPOINT.URL + '/chofer');
6 },
7 getListaCobradores: function() {
8 return $http.get(API_ENDPOINT.URL + '/cobrador');
9 },
10 getListaVendedores: function() {
11 return $http.get(API_ENDPOINT.URL + '/vendedor');
12 }
13 };
14 }]);
15
src/views/foca-crear-login.html
File was created 1 <div class="row">
2 <foca-cabecera-facturador
3 titulo="'Administración de Ingreso'"
4 fecha="now"
5 class="mb-0 col-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="3" class="row"></foca-botonera-facturador>
13 </div>
14 </div>
15 <table class="table table-default table-hover table-sm table-abm table-striped mb-0">
16 <thead>
17 <tr>
18 <th>Código</th>
19 <th>Nombre</th>
20 <th>DNI</th>
21 <th>Teléfono</th>
22 <th class="text-center">
23 </th>
24 </tr>
25 </thead>
26 <tbody>
27 <tr ng-repeat="cuenta in cuentas | filter:filters">
28 <td ng-bind="cuenta.id"></td>
29 <td ng-bind="cuenta.nombre"></td>
30 <td ng-bind="cuenta.dni"></td>
31 <td ng-bind="cuenta.telefono"></td>
32 <td class="text-center">
33 <button
34 class="btn btn-outline-dark boton-accion"
35 title="Editar acceso"
36 ng-click="openModalAcceso(cuenta)"
37 >
38 <i class="fa fa-lock"></i>
39 </button>
40 </td>
41 </tr>
42 </body>
43 </table>
44 </div>
45 </div>
46