Commit 7baa01a7d98333b6b26f6b255e51837f249a4709
1 parent
b69ed9b896
Exists in
master
Primera version
Showing
13 changed files
with
838 additions
and
1 deletions
Show diff stats
.gitignore
| File was created | 1 | /node_modules | |
| 2 | /dist | ||
| 3 | /tmp | ||
| 4 | package-lock\.json | ||
| 5 | src/etc/develop.js | ||
| 6 |
.jshintrc
| 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 |
README.md
| 1 | foca-abm-vendedor-cobrador | 1 | ABM Vendedores-Cobradores |
| 2 | ============ | ||
| 2 | 3 |
gulpfile.js
| 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: 'focaAbmVendedorCobrador', | ||
| 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-abm-vendedor-cobrador.js'), | ||
| 43 | replace("['ngRoute', 'focaModal', 'ui.bootstrap']", '[]'), | ||
| 44 | replace("src/views/", ''), | ||
| 45 | gulp.dest(paths.tmp), | ||
| 46 | rename('foca-abm-vendedor-cobrador.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 |
index.html
| File was created | 1 | <html ng-app="focaAbmVehiculo"> | |
| 2 | <head> | ||
| 3 | <meta charset="UTF-8"/> | ||
| 4 | <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
| 5 | |||
| 6 | <!--CSS--> | ||
| 7 | <link href="node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"/> | ||
| 8 | <link href="node_modules/font-awesome/css/font-awesome.min.css" rel="stylesheet"/> | ||
| 9 | |||
| 10 | <!--VENDOR JS--> | ||
| 11 | <script src="node_modules/jquery/dist/jquery.min.js"></script> | ||
| 12 | <script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script> | ||
| 13 | <script src="node_modules/angular/angular.min.js"></script> | ||
| 14 | <script src="node_modules/angular-route/angular-route.min.js"></script> | ||
| 15 | <script src="node_modules/ui-bootstrap4/dist/ui-bootstrap-tpls.js"></script> | ||
| 16 | <script src="node_modules/foca-modal/dist/foca-modal.min.js"></script> | ||
| 17 | |||
| 18 | <!-- BUILD --> | ||
| 19 | <script src="src/js/app.js"></script> | ||
| 20 | <script src="src/js/route.js"></script> | ||
| 21 | <script src="src/js/controller.js"></script> | ||
| 22 | <script src="src/js/service.js"></script> | ||
| 23 | <!-- /BUILD --> | ||
| 24 | |||
| 25 | <!-- CONFIG PARA DEVELOP --> | ||
| 26 | <script src="src/etc/develop.js"></script> | ||
| 27 | </head> | ||
| 28 | <body style="background: #afafaf;padding: 25px"> | ||
| 29 | <div class="container-fluid pt-3 pb-3" ng-view style="background: #fff"></div> | ||
| 30 | </body> | ||
| 31 | </html> | ||
| 32 |
package.json
| File was created | 1 | { | |
| 2 | "name": "foca-abm-vendedor-cobrador", | ||
| 3 | "version": "0.0.1", | ||
| 4 | "description": "Abm de Vendedores/Compradores", | ||
| 5 | "main": "index.html", | ||
| 6 | "scripts": { | ||
| 7 | "test": "echo \"Error: no test specified\" && exit 1", | ||
| 8 | "compile": "gulp uglify", | ||
| 9 | "gulp-pre-commit": "gulp pre-commit", | ||
| 10 | "postinstall": "npm run compile && gulp clean-post-install", | ||
| 11 | "install-dev": "npm i --ignore-scripts" | ||
| 12 | }, | ||
| 13 | "pre-commit": [ | ||
| 14 | "gulp-pre-commit" | ||
| 15 | ], | ||
| 16 | "repository": { | ||
| 17 | "type": "git", | ||
| 18 | "url": "http://git.focasoftware.com/npm/foca-abm-vendedor-cobrador.git" | ||
| 19 | }, | ||
| 20 | "author": "Foca Software", | ||
| 21 | "license": "ISC", | ||
| 22 | "peerDependencies": { | ||
| 23 | "angular": "^1.7.x", | ||
| 24 | "angular-route": "^1.7.x", | ||
| 25 | "bootstrap": "^4.1.x", | ||
| 26 | "jquery": "^3.3.x", | ||
| 27 | "font-awesome": "^4.7.x", | ||
| 28 | "gulp": "^3.9.x", | ||
| 29 | "gulp-concat": "2.6.x", | ||
| 30 | "gulp-jshint": "^2.1.x", | ||
| 31 | "gulp-rename": "^1.4.x", | ||
| 32 | "gulp-replace": "^1.0.x", | ||
| 33 | "gulp-uglify-es": "^1.0.x", | ||
| 34 | "jshint": "^2.9.x", | ||
| 35 | "pump": "^3.0.x" | ||
| 36 | }, | ||
| 37 | "devDependencies": { | ||
| 38 | "angular": "^1.7.5", | ||
| 39 | "angular-route": "^1.7.5", | ||
| 40 | "bootstrap": "^4.1.3", | ||
| 41 | "foca-modal": "git+http://git.focasoftware.com/npm/foca-modal.git", | ||
| 42 | "font-awesome": "^4.7.0", | ||
| 43 | "gulp": "^3.9.1", | ||
| 44 | "gulp-angular-templatecache": "^2.2.5", | ||
| 45 | "gulp-clean": "^0.4.0", | ||
| 46 | "gulp-connect": "^5.6.1", | ||
| 47 | "gulp-htmlmin": "^5.0.1", | ||
| 48 | "gulp-jshint": "^2.1.0", | ||
| 49 | "gulp-rename": "^1.4.0", | ||
| 50 | "gulp-replace": "^1.0.0", | ||
| 51 | "gulp-uglify": "^3.0.1", | ||
| 52 | "gulp-uglify-es": "^1.0.4", | ||
| 53 | "jasmine-core": "^3.3.0", | ||
| 54 | "jquery": "^3.3.1", | ||
| 55 | "jshint": "^2.9.6", | ||
| 56 | "pre-commit": "^1.2.2", | ||
| 57 | "pump": "^3.0.0", | ||
| 58 | "ui-bootstrap4": "^3.0.5" | ||
| 59 | } | ||
| 60 | } | ||
| 61 |
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 |
src/js/app.js
| File was created | 1 | angular.module('focaAbmVendedorCobrador', [ | |
| 2 | 'ngRoute', | ||
| 3 | 'focaModal', | ||
| 4 | 'ui.bootstrap', | ||
| 5 | 'focaBotoneraLateral' | ||
| 6 | ]); | ||
| 7 |
src/js/controller.js
| File was created | 1 | angular.module('focaAbmVendedorCobrador') | |
| 2 | .controller('focaAbmVendedoresCobradoresController', [ | ||
| 3 | '$scope', 'focaAbmVendedorCobradorService', '$location', '$filter', | ||
| 4 | '$uibModal', 'focaBotoneraLateralService', | ||
| 5 | function($scope, focaAbmVendedorCobradorService, $location, $filter, | ||
| 6 | $uibModal, focaBotoneraLateralService) { | ||
| 7 | |||
| 8 | $scope.now = new Date(); | ||
| 9 | $scope.vendedoresCobradores = []; | ||
| 10 | $scope.filters = ''; | ||
| 11 | $scope.numPerPage = 10; | ||
| 12 | $scope.currentPageVendedoresCobradores = []; | ||
| 13 | $scope.filteredVendedoresCobradores = []; | ||
| 14 | |||
| 15 | //SETEO BOTONERA LATERAL | ||
| 16 | focaBotoneraLateralService.showSalir(true); | ||
| 17 | focaBotoneraLateralService.showPausar(false); | ||
| 18 | focaBotoneraLateralService.showCancelar(false); | ||
| 19 | focaBotoneraLateralService.showGuardar(false); | ||
| 20 | |||
| 21 | focaAbmVendedorCobradorService.getVendedoresCobradores().then(function(res) { | ||
| 22 | $scope.vendedoresCobradores = res.data; | ||
| 23 | |||
| 24 | $scope.search(); | ||
| 25 | }); | ||
| 26 | |||
| 27 | $scope.editar = function(id) { | ||
| 28 | $location.path('/vendedor-cobrador/' + id); | ||
| 29 | }; | ||
| 30 | |||
| 31 | $scope.selectPage = function(page) { | ||
| 32 | var start = (page - 1) * $scope.numPerPage; | ||
| 33 | var end = start + $scope.numPerPage; | ||
| 34 | $scope.paginas = []; | ||
| 35 | $scope.paginas = calcularPages(page); | ||
| 36 | $scope.currentPageVendedoresCobradores = | ||
| 37 | $scope.filteredVendedoresCobradores.slice(start, end); | ||
| 38 | $scope.currentPage = page; | ||
| 39 | }; | ||
| 40 | |||
| 41 | $scope.resetPage = function() { | ||
| 42 | $scope.currentPage = 1; | ||
| 43 | $scope.selectPage(1); | ||
| 44 | }; | ||
| 45 | |||
| 46 | $scope.search = function() { | ||
| 47 | $scope.filteredVendedoresCobradores = $filter('filter')( | ||
| 48 | $scope.vendedoresCobradores, {$: $scope.filters} | ||
| 49 | ); | ||
| 50 | |||
| 51 | $scope.lastPage = Math.ceil( | ||
| 52 | $scope.filteredVendedoresCobradores.length / $scope.numPerPage | ||
| 53 | ); | ||
| 54 | |||
| 55 | $scope.resetPage(); | ||
| 56 | }; | ||
| 57 | |||
| 58 | function calcularPages(paginaActual) { | ||
| 59 | var paginas = []; | ||
| 60 | paginas.push(paginaActual); | ||
| 61 | |||
| 62 | if(paginaActual - 1 > 1) { | ||
| 63 | |||
| 64 | paginas.unshift(paginaActual - 1); | ||
| 65 | if(paginaActual - 2 > 1) { | ||
| 66 | paginas.unshift(paginaActual - 2); | ||
| 67 | } | ||
| 68 | } | ||
| 69 | |||
| 70 | if(paginaActual + 1 < $scope.lastPage) { | ||
| 71 | paginas.push(paginaActual + 1); | ||
| 72 | if(paginaActual + 2 < $scope.lastPage) { | ||
| 73 | paginas.push(paginaActual + 2); | ||
| 74 | } | ||
| 75 | } | ||
| 76 | |||
| 77 | if(paginaActual !== 1) { | ||
| 78 | paginas.unshift(1); | ||
| 79 | } | ||
| 80 | |||
| 81 | if(paginaActual !== $scope.lastPage) { | ||
| 82 | paginas.push($scope.lastPage); | ||
| 83 | } | ||
| 84 | |||
| 85 | return paginas; | ||
| 86 | } | ||
| 87 | |||
| 88 | function primera() { | ||
| 89 | $scope.selectedClientes = 0; | ||
| 90 | } | ||
| 91 | |||
| 92 | function anterior() { | ||
| 93 | if ($scope.selectedClientes === 0 && $scope.currentPage > 1) { | ||
| 94 | retrocederPagina(); | ||
| 95 | } else { | ||
| 96 | $scope.selectedClientes--; | ||
| 97 | } | ||
| 98 | } | ||
| 99 | |||
| 100 | function siguiente() { | ||
| 101 | if ($scope.selectedClientes < $scope.currentPageVendedoresCobradores.length - 1 ) { | ||
| 102 | $scope.selectedClientes++; | ||
| 103 | } else { | ||
| 104 | avanzarPagina(); | ||
| 105 | } | ||
| 106 | } | ||
| 107 | |||
| 108 | function retrocederPagina() { | ||
| 109 | if ($scope.currentPage > 1) { | ||
| 110 | $scope.selectPage($scope.currentPage - 1); | ||
| 111 | $scope.selectedClientes = $scope.numPerPage - 1; | ||
| 112 | } | ||
| 113 | } | ||
| 114 | |||
| 115 | function avanzarPagina() { | ||
| 116 | if ($scope.currentPage < $scope.lastPage) { | ||
| 117 | $scope.selectPage($scope.currentPage + 1); | ||
| 118 | $scope.selectedClientes = 0; | ||
| 119 | } | ||
| 120 | } | ||
| 121 | } | ||
| 122 | ]) | ||
| 123 | .controller('focaAbmVendedorCobradorController', [ | ||
| 124 | '$scope', 'focaAbmVendedorCobradorService', '$routeParams', 'focaBotoneraLateralService', | ||
| 125 | '$timeout', '$uibModal', '$location', 'focaModalService', | ||
| 126 | function($scope, focaAbmVendedorCobradorService, $routeParams, focaBotoneraLateralService, | ||
| 127 | $timeout, $uibModal, $location, focaModalService) { | ||
| 128 | |||
| 129 | $scope.now = new Date(); | ||
| 130 | $scope.vendedorCobrador = { | ||
| 131 | CodVen: 0, | ||
| 132 | ES_COBRADOR: false, | ||
| 133 | DNI: ' ', | ||
| 134 | ClaVen: '', | ||
| 135 | ComVen: '0.00', | ||
| 136 | provincia: { | ||
| 137 | NOMBRE: '' | ||
| 138 | }, | ||
| 139 | localidad: { | ||
| 140 | NOMBRE: '' | ||
| 141 | } | ||
| 142 | }; | ||
| 143 | //SETEO BOTONERA LATERAL | ||
| 144 | $timeout(function() { | ||
| 145 | focaBotoneraLateralService.showSalir(false); | ||
| 146 | focaBotoneraLateralService.showPausar(true); | ||
| 147 | focaBotoneraLateralService.showCancelar(true); | ||
| 148 | focaBotoneraLateralService.showGuardar(true, $scope.guardar); | ||
| 149 | }); | ||
| 150 | |||
| 151 | focaAbmVendedorCobradorService | ||
| 152 | .getVendedorCobradorById($routeParams.id) | ||
| 153 | .then(function(res) { | ||
| 154 | if(res.data){ | ||
| 155 | $scope.vendedorCobrador = res.data; | ||
| 156 | delete $scope.vendedorCobrador.FCVEN; | ||
| 157 | delete $scope.vendedorCobrador.FEC; | ||
| 158 | } | ||
| 159 | }); | ||
| 160 | |||
| 161 | $scope.guardar = function() { | ||
| 162 | if($scope.vendedorCobrador.ClaVen !== $scope.vendedorCobrador.ClaVen2) { | ||
| 163 | focaModalService.alert('Las contraseñas deben coincidir'); | ||
| 164 | return; | ||
| 165 | } | ||
| 166 | $scope.vendedorCobrador.PciVen = $scope.vendedorCobrador.provincia.ID; | ||
| 167 | $scope.vendedorCobrador.LocVen = $scope.vendedorCobrador.localidad.ID; | ||
| 168 | |||
| 169 | delete $scope.vendedorCobrador.provincia; | ||
| 170 | delete $scope.vendedorCobrador.localidad; | ||
| 171 | delete $scope.vendedorCobrador.ClaVen2; | ||
| 172 | |||
| 173 | focaAbmVendedorCobradorService | ||
| 174 | .guardarVendedorCobrador($scope.vendedorCobrador) | ||
| 175 | .then(function() { | ||
| 176 | $location.path('/vendedor-cobrador'); | ||
| 177 | }); | ||
| 178 | }; | ||
| 179 | |||
| 180 | $scope.seleccionarProvincia = function(key) { | ||
| 181 | if(key === 13) { | ||
| 182 | var modalInstance = $uibModal.open( | ||
| 183 | { | ||
| 184 | ariaLabelledBy: 'Búsqueda de provincias', | ||
| 185 | templateUrl: 'modal-provincias.html', | ||
| 186 | controller: 'focaModalProvinciaController', | ||
| 187 | size: 'md', | ||
| 188 | resolve: { | ||
| 189 | filters: function() { | ||
| 190 | return $scope.vendedorCobrador.provincia.NOMBRE; | ||
| 191 | } | ||
| 192 | } | ||
| 193 | } | ||
| 194 | ); | ||
| 195 | modalInstance.result.then(function(provincia) { | ||
| 196 | $scope.vendedorCobrador.provincia = provincia; | ||
| 197 | $timeout(function() { | ||
| 198 | $scope.focused = 5; | ||
| 199 | }); | ||
| 200 | }, function() { | ||
| 201 | //TODO: función llamada cuando cancela el modal | ||
| 202 | }); | ||
| 203 | } | ||
| 204 | }; | ||
| 205 | $scope.seleccionarLocalidad = function(key) { | ||
| 206 | if(!$scope.vendedorCobrador.provincia.ID) { | ||
| 207 | //TODO: Poner modal alert de foca | ||
| 208 | alert('Seleccione una provincia'); | ||
| 209 | return; | ||
| 210 | } | ||
| 211 | if(key === 13) { | ||
| 212 | var modalInstance = $uibModal.open( | ||
| 213 | { | ||
| 214 | ariaLabelledBy: 'Búsqueda de localidades', | ||
| 215 | templateUrl: 'modal-localidades.html', | ||
| 216 | controller: 'focaModalLocalidadController', | ||
| 217 | size: 'md', | ||
| 218 | resolve: { | ||
| 219 | filters: { | ||
| 220 | idProvincia: $scope.vendedorCobrador.provincia.ID, | ||
| 221 | busqueda: $scope.vendedorCobrador.localidad.NOMBRE | ||
| 222 | } | ||
| 223 | } | ||
| 224 | } | ||
| 225 | ); | ||
| 226 | modalInstance.result.then(function(localidad) { | ||
| 227 | $scope.vendedorCobrador.localidad = localidad; | ||
| 228 | }, function() { | ||
| 229 | //TODO: función llamada cuando cancela el modal | ||
| 230 | }); | ||
| 231 | } | ||
| 232 | }; | ||
| 233 | } | ||
| 234 | ]); | ||
| 235 |
src/js/route.js
| File was created | 1 | angular.module('focaAbmVendedorCobrador') | |
| 2 | .config([ | ||
| 3 | '$routeProvider', | ||
| 4 | function($routeProvider) { | ||
| 5 | $routeProvider.when('/vendedor-cobrador', { | ||
| 6 | controller: 'focaAbmVendedoresCobradoresController', | ||
| 7 | templateUrl: 'src/views/foca-abm-vendedor-cobrador-listado.html' | ||
| 8 | }); | ||
| 9 | } | ||
| 10 | ]) | ||
| 11 | .config([ | ||
| 12 | '$routeProvider', | ||
| 13 | function($routeProvider) { | ||
| 14 | $routeProvider.when('/vendedor-cobrador/:id', { | ||
| 15 | controller: 'focaAbmVendedorCobradorController', | ||
| 16 | templateUrl: 'src/views/foca-abm-vendedor-cobrador-item.html' | ||
| 17 | }); | ||
| 18 | } | ||
| 19 | ]); | ||
| 20 |
src/js/service.js
| File was created | 1 | angular.module('focaAbmVendedorCobrador') | |
| 2 | .factory('focaAbmVendedorCobradorService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { | ||
| 3 | return { | ||
| 4 | getVendedoresCobradores: function() { | ||
| 5 | return $http.get(API_ENDPOINT.URL + '/vendedor-cobrador'); | ||
| 6 | }, | ||
| 7 | getVendedorCobradorById: function(id) { | ||
| 8 | return $http.get(API_ENDPOINT.URL + '/vendedor-cobrador/' + id); | ||
| 9 | }, | ||
| 10 | guardarVendedorCobrador: function(vendedorCobrador) { | ||
| 11 | return $http.post(API_ENDPOINT.URL + '/vendedor-cobrador', | ||
| 12 | {vendedorCobrador: vendedorCobrador}); | ||
| 13 | } | ||
| 14 | }; | ||
| 15 | }]); | ||
| 16 |
src/views/foca-abm-vendedor-cobrador-item.html
| File was created | 1 | <div class="row"> | |
| 2 | <foca-cabecera-facturador | ||
| 3 | titulo="'Vendedores / Cobradores'" | ||
| 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 | <form name="formVendedorCobrador" class="px-3" autocomplete="off"> | ||
| 11 | <div class="row mt-3"> | ||
| 12 | <div class="form-group d-flex mb-2 col-md-6"> | ||
| 13 | <label class="col-form-label col-md-4">Código</label> | ||
| 14 | <div class="input-group col-md-8 pl-0"> | ||
| 15 | <input | ||
| 16 | class="form-control form-control-sm" | ||
| 17 | type="text" | ||
| 18 | ng-value="vendedorCobrador.CodVen | rellenarDigitos: 4: 0" | ||
| 19 | readonly | ||
| 20 | /> | ||
| 21 | </div> | ||
| 22 | </div> | ||
| 23 | <div class="form-group d-flex mb-2 col-md-6"> | ||
| 24 | <label class="col-form-label col-md-4">Nombre</label> | ||
| 25 | <div class="input-group col-md-8 pl-0"> | ||
| 26 | <input | ||
| 27 | class="form-control form-control-sm" | ||
| 28 | type="text" | ||
| 29 | teclado-virtual | ||
| 30 | ng-model="vendedorCobrador.NomVen" | ||
| 31 | ng-focus="focused = 3" | ||
| 32 | ng-keypress="next($event.keyCode)" | ||
| 33 | autocomplete="off" | ||
| 34 | /> | ||
| 35 | </div> | ||
| 36 | </div> | ||
| 37 | <div class="form-group d-flex mb-2 col-md-6"> | ||
| 38 | <label class="col-form-label col-md-4">Domicilio</label> | ||
| 39 | <div class="input-group col-md-8 pl-0"> | ||
| 40 | <input | ||
| 41 | class="form-control form-control-sm" | ||
| 42 | type="text" | ||
| 43 | teclado-virtual | ||
| 44 | ng-model="vendedorCobrador.DomVen" | ||
| 45 | ng-required="true" | ||
| 46 | ng-focus="focused = 1" | ||
| 47 | ng-keypress="next($event.keyCode)" | ||
| 48 | autocomplete="off" | ||
| 49 | /> | ||
| 50 | </div> | ||
| 51 | </div> | ||
| 52 | <div class="form-group d-flex mb-2 col-md-6"> | ||
| 53 | <label class="col-form-label col-md-4">Código postal</label> | ||
| 54 | <div class="input-group col-md-8 pl-0"> | ||
| 55 | <input | ||
| 56 | class="form-control form-control-sm" | ||
| 57 | type="text" | ||
| 58 | teclado-virtual | ||
| 59 | ng-model="vendedorCobrador.CPoVen" | ||
| 60 | ng-required="true" | ||
| 61 | ng-focus="focused = 1" | ||
| 62 | ng-keypress="next($event.keyCode)" | ||
| 63 | autocomplete="off" | ||
| 64 | /> | ||
| 65 | </div> | ||
| 66 | </div> | ||
| 67 | <div class="form-group d-flex mb-2 col-md-6"> | ||
| 68 | <label class="col-form-label col-md-4">Provincia</label> | ||
| 69 | <div class="input-group col-md-8 pl-0"> | ||
| 70 | <input | ||
| 71 | type="text" | ||
| 72 | class="form-control form-control-sm" | ||
| 73 | ng-model="vendedorCobrador.provincia.NOMBRE" | ||
| 74 | ng-keypress="seleccionarProvincia($event.keyCode)" | ||
| 75 | ng-required="true" | ||
| 76 | ng-focus="focus(8)" | ||
| 77 | foca-focus="focused == 8" | ||
| 78 | teclado-virtual | ||
| 79 | /> | ||
| 80 | <div class="input-group-append"> | ||
| 81 | <button | ||
| 82 | ladda="searchLoading" | ||
| 83 | class="btn btn-outline-secondary form-control-sm" | ||
| 84 | type="button" | ||
| 85 | ng-click="seleccionarProvincia(13)" | ||
| 86 | > | ||
| 87 | <i class="fa fa-search" aria-hidden="true"></i> | ||
| 88 | </button> | ||
| 89 | </div> | ||
| 90 | </div> | ||
| 91 | </div> | ||
| 92 | <div class="form-group d-flex mb-2 col-md-6"> | ||
| 93 | <label class="col-form-label col-md-4">Localidad</label> | ||
| 94 | <div class="input-group col-md-8 pl-0"> | ||
| 95 | <input | ||
| 96 | type="text" | ||
| 97 | class="form-control form-control-sm" | ||
| 98 | ng-model="vendedorCobrador.localidad.NOMBRE" | ||
| 99 | ng-keypress="seleccionarLocalidad($event.keyCode)" | ||
| 100 | ng-required="true" | ||
| 101 | ng-focus="focus(8)" | ||
| 102 | foca-focus="focused == 8" | ||
| 103 | teclado-virtual | ||
| 104 | autocomplete="off" | ||
| 105 | /> | ||
| 106 | <div class="input-group-append"> | ||
| 107 | <button | ||
| 108 | ladda="searchLoading" | ||
| 109 | class="btn btn-outline-secondary form-control-sm" | ||
| 110 | type="button" | ||
| 111 | ng-click="seleccionarLocalidad(13)" | ||
| 112 | > | ||
| 113 | <i class="fa fa-search" aria-hidden="true"></i> | ||
| 114 | </button> | ||
| 115 | </div> | ||
| 116 | </div> | ||
| 117 | </div> | ||
| 118 | <div class="form-group d-flex mb-2 col-md-6"> | ||
| 119 | <label class="col-form-label col-md-4">Teléfono</label> | ||
| 120 | <div class="input-group col-md-8 pl-0"> | ||
| 121 | <input | ||
| 122 | class="form-control form-control-sm" | ||
| 123 | type="text" | ||
| 124 | teclado-virtual | ||
| 125 | ng-model="vendedorCobrador.TelVen" | ||
| 126 | ng-required="true" | ||
| 127 | ng-focus="focused = 1" | ||
| 128 | ng-keypress="next($event.keyCode)" | ||
| 129 | autocomplete="off" | ||
| 130 | /> | ||
| 131 | </div> | ||
| 132 | </div> | ||
| 133 | <div class="form-group d-flex mb-2 col-md-6"> | ||
| 134 | <label class="col-form-label col-md-4">DNI</label> | ||
| 135 | <div class="input-group col-md-8 pl-0"> | ||
| 136 | <input | ||
| 137 | class="form-control form-control-sm" | ||
| 138 | type="text" | ||
| 139 | teclado-virtual | ||
| 140 | ng-model="vendedorCobrador.DNI" | ||
| 141 | ng-required="true" | ||
| 142 | ng-focus="focused = 1" | ||
| 143 | ng-keypress="next($event.keyCode)" | ||
| 144 | autocomplete="off" | ||
| 145 | /> | ||
| 146 | </div> | ||
| 147 | </div> | ||
| 148 | <div class="form-group d-flex mb-2 col-md-6"> | ||
| 149 | <label class="col-form-label col-md-4">Nueva contraseña</label> | ||
| 150 | <div class="input-group col-md-8 pl-0"> | ||
| 151 | <input | ||
| 152 | class="form-control form-control-sm" | ||
| 153 | type="password" | ||
| 154 | teclado-virtual | ||
| 155 | ng-model="vendedorCobrador.ClaVen" | ||
| 156 | ng-required="true" | ||
| 157 | ng-focus="focused = 4" | ||
| 158 | ng-keypress="next($event.keyCode)" | ||
| 159 | autocomplete="off" | ||
| 160 | /> | ||
| 161 | </div> | ||
| 162 | </div> | ||
| 163 | <div class="form-group d-flex mb-2 col-md-6"> | ||
| 164 | <label class="col-form-label col-md-4">Repita contraseña</label> | ||
| 165 | <div class="input-group col-md-8 pl-0"> | ||
| 166 | <input | ||
| 167 | class="form-control form-control-sm" | ||
| 168 | type="password" | ||
| 169 | teclado-virtual | ||
| 170 | ng-model="vendedorCobrador.ClaVen2" | ||
| 171 | ng-required="true" | ||
| 172 | ng-focus="focused = 2" | ||
| 173 | ng-keypress="next($event.keyCode)" | ||
| 174 | autocomplete="off" | ||
| 175 | /> | ||
| 176 | </div> | ||
| 177 | </div> | ||
| 178 | <div class="form-group d-flex mb-2 col-md-6"> | ||
| 179 | <label class="col-form-label col-md-4">Porcentaje de comisión</label> | ||
| 180 | <div class="input-group col-md-8 pl-0"> | ||
| 181 | <input | ||
| 182 | class="form-control form-control-sm" | ||
| 183 | type="text" | ||
| 184 | teclado-virtual | ||
| 185 | ng-model="vendedorCobrador.ComVen" | ||
| 186 | ng-required="true" | ||
| 187 | ng-focus="focused = 2" | ||
| 188 | ng-keypress="next($event.keyCode)" | ||
| 189 | autocomplete="off" | ||
| 190 | /> | ||
| 191 | </div> | ||
| 192 | </div> | ||
| 193 | <div class="form-group d-flex mb-2 col-md-6"> | ||
| 194 | <div class="custom-control custom-checkbox ml-auto"> | ||
| 195 | <input | ||
| 196 | type="checkbox" | ||
| 197 | class="custom-control-input" | ||
| 198 | id="checkCobrador" | ||
| 199 | ng-model="vendedorCobrador.ES_COBRADOR"> | ||
| 200 | <label | ||
| 201 | class="custom-control-label" | ||
| 202 | for="checkCobrador">¿Es cobrador?</label> | ||
| 203 | </div> | ||
| 204 | </div> | ||
| 205 | </div> | ||
| 206 | </form> | ||
| 207 | </div> | ||
| 208 | </div> | ||
| 209 |
src/views/foca-abm-vendedor-cobrador-listado.html
| File was created | 1 | <div class="row"> | |
| 2 | <foca-cabecera-facturador | ||
| 3 | titulo="'Vendedores / Cobradores'" | ||
| 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="form-group input-group mt-3 px-5"> | ||
| 11 | <input | ||
| 12 | type="text" | ||
| 13 | class="form-control form-control-sm" | ||
| 14 | id="search" | ||
| 15 | placeholder="Búsqueda" | ||
| 16 | teclado-virtual | ||
| 17 | ng-change="search()" | ||
| 18 | ng-model="filters" | ||
| 19 | /> | ||
| 20 | <div class="input-group-append"> | ||
| 21 | <button | ||
| 22 | ladda="searchLoading" | ||
| 23 | class="btn btn-outline-secondary" | ||
| 24 | type="button" | ||
| 25 | ng-click="busquedaPress(13)" | ||
| 26 | > | ||
| 27 | <i class="fa fa-search" aria-hidden="true"></i> | ||
| 28 | </button> | ||
| 29 | </div> | ||
| 30 | </div> | ||
| 31 | <table class="table table-default table-hover table-sm table-abm table-striped mb-0"> | ||
| 32 | <thead> | ||
| 33 | <tr> | ||
| 34 | <th class="text-center">Código</th> | ||
| 35 | <th>Nombre</th> | ||
| 36 | <th>Tipo</th> | ||
| 37 | <th class="text-center"> | ||
| 38 | <button | ||
| 39 | class="btn btn-outline-debo boton-accion" | ||
| 40 | title="Agregar" | ||
| 41 | ng-click="editar(0)" | ||
| 42 | ><i class="fa fa-plus"></i> | ||
| 43 | </button> | ||
| 44 | </th> | ||
| 45 | </tr> | ||
| 46 | </thead> | ||
| 47 | <tbody> | ||
| 48 | <tr ng-repeat="vendedorCobrador in currentPageVendedoresCobradores"> | ||
| 49 | <td ng-bind="vendedorCobrador.CodVen" class="text-center"></td> | ||
| 50 | <td ng-bind="vendedorCobrador.NomVen"></td> | ||
| 51 | <td ng-bind="vendedorCobrador.ES_COBRADOR ? 'Cobrador' : 'Vendedor'"></td> | ||
| 52 | <td class="text-center"> | ||
| 53 | <button | ||
| 54 | class="btn btn-outline-dark boton-accion" | ||
| 55 | title="Editar" | ||
| 56 | ng-click="editar(vendedorCobrador.CodVen)" | ||
| 57 | > | ||
| 58 | <i class="fa fa-pencil"></i> | ||
| 59 | </button> | ||
| 60 | <button | ||
| 61 | class="btn btn-outline-dark boton-accion" | ||
| 62 | title="Eliminar" | ||
| 63 | > | ||
| 64 | <i class="fa fa-trash"></i> | ||
| 65 | </button> | ||
| 66 | </td> | ||
| 67 | </tr> | ||
| 68 | </body> | ||
| 69 | </table> | ||
| 70 | </div> | ||
| 71 | </div> | ||
| 72 | <div class="row"> | ||
| 73 | <nav ng-show="currentPageVendedoresCobradores.length > 0" class="mr-auto"> | ||
| 74 | <ul class="pagination pagination-sm mb-0"> | ||
| 75 | <li class="page-item" ng-class="{'disabled': currentPage == 1}"> | ||
| 76 | <a class="page-link" href="javascript:void()" ng-click="selectPage(currentPage - 1)"> | ||
| 77 | <span aria-hidden="true">«</span> | ||
| 78 | <span class="sr-only">Anterior</span> | ||
| 79 | </a> | ||
| 80 | </li> | ||
| 81 | <li | ||
| 82 | class="page-item" | ||
| 83 | ng-repeat="pagina in paginas" | ||
| 84 | ng-class="{'active': pagina == currentPage}" | ||
| 85 | > | ||
| 86 | <a | ||
| 87 | class="page-link" | ||
| 88 | href="javascript:void()" | ||
| 89 | ng-click="selectPage(pagina)" | ||
| 90 | ng-bind="pagina" | ||
| 91 | ></a> | ||
| 92 | </li> | ||
| 93 | <li class="page-item" ng-class="{'disabled': currentPage == lastPage}"> | ||
| 94 | <a class="page-link" href="javascript:void()" ng-click="selectPage(currentPage + 1)"> | ||
| 95 | <span aria-hidden="true">»</span> | ||
| 96 | <span class="sr-only">Siguiente</span> | ||
| 97 | </a> | ||
| 98 | </li> | ||
| 99 | </ul> | ||
| 100 | </nav> | ||
| 101 | </div> | ||
| 102 |