Commit 8af21bf78b5a30deda4e3d3e4d4b8a68f256c0f5
1 parent
478c9d1cfa
Exists in
master
avances
Showing
10 changed files
with
403 additions
and
1 deletions
Show diff stats
.gitignore
.jshintrc
... | ... | @@ -0,0 +1,64 @@ |
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 | +} |
README.md
gulpfile.js
... | ... | @@ -0,0 +1,86 @@ |
1 | +const templateCache = require('gulp-angular-templatecache'); | |
2 | +const clean = require('gulp-clean'); | |
3 | +const concat = require('gulp-concat'); | |
4 | +const htmlmin = require('gulp-htmlmin'); | |
5 | +const rename = require('gulp-rename'); | |
6 | +const uglify = require('gulp-uglify'); | |
7 | +const gulp = require('gulp'); | |
8 | +const pump = require('pump'); | |
9 | +const jshint = require('gulp-jshint'); | |
10 | +const replace = require('gulp-replace'); | |
11 | +const connect = require('gulp-connect'); | |
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', ['clean'], function() { | |
21 | + return pump( | |
22 | + [ | |
23 | + gulp.src(paths.srcViews), | |
24 | + htmlmin(), | |
25 | + templateCache('views.js', { | |
26 | + module: 'focaModalDescarga', | |
27 | + root: '' | |
28 | + }), | |
29 | + gulp.dest(paths.tmp) | |
30 | + ] | |
31 | + ); | |
32 | +}); | |
33 | + | |
34 | +gulp.task('uglify', ['templates'], function() { | |
35 | + return pump( | |
36 | + [ | |
37 | + gulp.src([ | |
38 | + paths.srcJS, | |
39 | + 'tmp/views.js' | |
40 | + ]), | |
41 | + concat('foca-modal-descarga.js'), | |
42 | + replace('src/views/', ''), | |
43 | + replace("'ngRoute'", ''), | |
44 | + gulp.dest(paths.tmp), | |
45 | + rename('foca-modal-descarga.min.js'), | |
46 | + uglify(), | |
47 | + gulp.dest(paths.dist) | |
48 | + ] | |
49 | + ); | |
50 | +}); | |
51 | + | |
52 | +gulp.task('clean', function() { | |
53 | + return gulp.src(['tmp', 'dist'], {read: false}) | |
54 | + .pipe(clean()); | |
55 | +}); | |
56 | + | |
57 | +gulp.task('pre-commit', function() { | |
58 | + return pump( | |
59 | + [ | |
60 | + gulp.src(paths.srcJS), | |
61 | + jshint('.jshintrc'), | |
62 | + jshint.reporter('default'), | |
63 | + jshint.reporter('fail') | |
64 | + ] | |
65 | + ); | |
66 | + | |
67 | + gulp.start('uglify'); | |
68 | +}); | |
69 | + | |
70 | +gulp.task('webserver', function() { | |
71 | + pump [ | |
72 | + connect.server({port: 3300, host: '0.0.0.0'}) | |
73 | + ] | |
74 | +}); | |
75 | + | |
76 | +gulp.task('clean-post-install', function() { | |
77 | + return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', | |
78 | + 'index.html'], {read: false}) | |
79 | + .pipe(clean()); | |
80 | +}); | |
81 | + | |
82 | +gulp.task('default', ['webserver']); | |
83 | + | |
84 | +gulp.task('watch', function() { | |
85 | + gulp.watch([paths.srcJS, paths.srcViews], ['uglify']); | |
86 | +}); |
package.json
... | ... | @@ -0,0 +1,50 @@ |
1 | +{ | |
2 | + "name": "foca-modal-descarga", | |
3 | + "version": "0.0.1", | |
4 | + "description": "foca-modal-descarga", | |
5 | + "main": "index.js", | |
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 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+http://git.focasoftware.com/npm/foca-directivas.git git+http://git.focasoftware.com/npm/foca-modal-remito.git" | |
12 | + }, | |
13 | + "pre-commit": [ | |
14 | + "gulp-pre-commit" | |
15 | + ], | |
16 | + "repository": { | |
17 | + "type": "git", | |
18 | + "url": "git+http://git.focasoftware.com/npm/foca-modal-descarga.git" | |
19 | + }, | |
20 | + "author": "Foca Software", | |
21 | + "license": "ISC", | |
22 | + "devDependencies": { | |
23 | + "angular": "^1.7.8", | |
24 | + "angular-ladda": "^0.4.3", | |
25 | + "angular-route": "^1.7.8", | |
26 | + "bootstrap": "^4.3.1", | |
27 | + "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git", | |
28 | + "foca-modal-remito": "git+http://git.focasoftware.com/npm/foca-modal-remito.git", | |
29 | + "font-awesome": "^4.7.0", | |
30 | + "gulp": "^3.9.1", | |
31 | + "gulp-angular-templatecache": "^2.2.6", | |
32 | + "gulp-clean": "^0.4.0", | |
33 | + "gulp-concat": "^2.6.1", | |
34 | + "gulp-connect": "^5.7.0", | |
35 | + "gulp-htmlmin": "^5.0.1", | |
36 | + "gulp-jshint": "^2.1.0", | |
37 | + "gulp-rename": "^1.4.0", | |
38 | + "gulp-replace": "^1.0.0", | |
39 | + "gulp-sequence": "^1.0.0", | |
40 | + "gulp-uglify": "^3.0.2", | |
41 | + "gulp-uglify-es": "^1.0.4", | |
42 | + "jasmine-core": "^3.4.0", | |
43 | + "jquery": "^3.4.0", | |
44 | + "jshint": "^2.10.2", | |
45 | + "ladda": "^1.0.6", | |
46 | + "pre-commit": "^1.2.2", | |
47 | + "pump": "^3.0.0", | |
48 | + "ui-bootstrap4": "^3.0.6" | |
49 | + } | |
50 | +} |
src/etc/develop.js.ejemplo
src/js/app.js
... | ... | @@ -0,0 +1 @@ |
1 | +angular.module('focaModalDescarga', []); |
src/js/controller.js
... | ... | @@ -0,0 +1,93 @@ |
1 | +angular.module('focaModalDescarga') | |
2 | + .controller('focaModalDescargaCtrl', [ | |
3 | + '$scope', | |
4 | + 'focaModalDescargasService', | |
5 | + '$filter', | |
6 | + 'focaModalService', | |
7 | + '$timeout', | |
8 | + '$uibModalInstance', | |
9 | + '$uibModal', | |
10 | + function($scope, focaModalDescargasService, $filter, | |
11 | + focaModalService, $timeout, $uibModalInstance, $uibModal) | |
12 | + { | |
13 | + | |
14 | + //#region variables | |
15 | + $scope.remito = {}; | |
16 | + //#endregion | |
17 | + | |
18 | + $scope.crearRemito = function() { | |
19 | + | |
20 | + var remito = { | |
21 | + id: $scope.remito.id, | |
22 | + fechaRemito: $scope.now.toISOString().slice(0, 19).replace('T', ' '), | |
23 | + idCliente: $scope.remito.cliente.COD, | |
24 | + nombreCliente: $scope.remito.cliente.NOM, | |
25 | + cuitCliente: $scope.remito.cliente.CUIT, | |
26 | + total: $scope.getTotal() * $scope.remito.cotizacion.VENDEDOR, | |
27 | + numeroNotaPedido: $scope.remito.numeroNotaPedido, | |
28 | + idVendedor: $scope.remito.vendedor.NUM, | |
29 | + idProveedor: $scope.remito.proveedor.COD, | |
30 | + idDomicilio: $scope.remito.idDomicilio || $scope.remito.domicilio.id, | |
31 | + idCotizacion: $scope.remito.cotizacion.ID, | |
32 | + idListaPrecio: $scope.idLista, | |
33 | + flete: $scope.remito.flete, | |
34 | + fob: $scope.remito.fob, | |
35 | + bomba: $scope.remito.bomba, | |
36 | + kilometros: $scope.remito.kilometros, | |
37 | + domicilioStamp: $scope.remito.domicilioStamp, | |
38 | + observaciones: $scope.remito.observaciones, | |
39 | + numeroRemito: parseInt($scope.comprobante), | |
40 | + sucursal: parseInt($scope.puntoVenta), | |
41 | + responsabilidadIvaCliente: $scope.remito.cliente.IVA, | |
42 | + descuento: 0,//TODO, | |
43 | + importeNeto: getImporte('netoUnitario'), | |
44 | + importeExento: getImporte('exentoUnitario'), | |
45 | + importeIva: getImporte('ivaUnitario'), | |
46 | + importeIvaServicios: 0,//TODO | |
47 | + importeImpuestoInterno: getImporte('impuestoInternoUnitario'), | |
48 | + importeImpuestoInterno1: getImporte('impuestoInterno1Unitario'), | |
49 | + importeImpuestoInterno2: getImporte('impuestoInterno2Unitario'), | |
50 | + percepcion: 0,//TODO | |
51 | + percepcionIva: 0,//TODO | |
52 | + redondeo: 0,//TODO | |
53 | + anulado: false, | |
54 | + planilla: $filter('date')($scope.now, 'ddMMyyyy'), | |
55 | + lugar: parseInt($scope.puntoVenta), | |
56 | + cuentaMadre: 0,//TODO | |
57 | + cuentaContable: 0,//TODO | |
58 | + asiento: 0,//TODO | |
59 | + e_hd: '',//TODO | |
60 | + c_hd: '', | |
61 | + numeroLiquidoProducto: 0,//TODO | |
62 | + estado: 0, | |
63 | + destinoVenta: 0,//TODO | |
64 | + operacionTipo: 0, //TODO | |
65 | + } | |
66 | + } | |
67 | + | |
68 | + $scope.seleccionarCliente = function() { | |
69 | + | |
70 | + var modalInstance = $uibModal.open( | |
71 | + { | |
72 | + ariaLabelledBy: 'Busqueda de Cliente', | |
73 | + templateUrl: 'foca-busqueda-cliente-modal.html', | |
74 | + controller: 'focaBusquedaClienteModalController', | |
75 | + resolve: { | |
76 | + vendedor: function () { return null; }, | |
77 | + cobrador: function () { return null; } | |
78 | + }, | |
79 | + size: 'lg' | |
80 | + } | |
81 | + ); | |
82 | + modalInstance.result.then(function(cliente) { | |
83 | + $scope.remito.cliente = cliente; | |
84 | + }, function() { | |
85 | + //funcion ejecutada al cancelar modal | |
86 | + }); | |
87 | + }; | |
88 | + | |
89 | + $scope.cancelar = function() { | |
90 | + $uibModalInstance.dismiss(); | |
91 | + } | |
92 | + } | |
93 | + ]); |
src/js/service.js
src/views/foca-modal-descarga.html
... | ... | @@ -0,0 +1,92 @@ |
1 | +<div class="modal-header"> | |
2 | + <h5>Detalle de descarga</h5> | |
3 | +</div> | |
4 | +<div class="modal-body"> | |
5 | + <div class="row"> | |
6 | + <div class="col-3 mt-1 pl-1"> | |
7 | + <strong>Cliente</strong> | |
8 | + </div> | |
9 | + <div class="col-9"> | |
10 | + <div class="input-group"> | |
11 | + <input | |
12 | + type="text" | |
13 | + ladda="searchLoading" | |
14 | + class="form-control form-control-sm foca-input" | |
15 | + placeholder="Busqueda cliente" | |
16 | + readonly | |
17 | + > | |
18 | + <div class="input-group-append"> | |
19 | + <button | |
20 | + ladda="searchLoading" | |
21 | + data-spinner-color="#FF0000" | |
22 | + class="btn btn-outline-secondary" | |
23 | + type="button" | |
24 | + ng-click="seleccionarCliente()" | |
25 | + > | |
26 | + <i class="fa fa-search fa-x1" aria-hidden="true"></i> | |
27 | + </button> | |
28 | + </div> | |
29 | + </div> | |
30 | + </div> | |
31 | + <div class="col-3 pl-1"> | |
32 | + <strong>Domicilio</strong> | |
33 | + </div> | |
34 | + <div class="col-9"> | |
35 | + <label ng-bind="remito.cliente.DOM">Lorem ipsum dolor sit, amet consectetur adipisicing elit. Est magni doloribus expedita laudantium veniam ipsum, dicta recusandae natus inventore maiores voluptatum libero, rem obcaecati esse quibusdam quo. Eos, voluptatibus sit.</label> | |
36 | + </div> | |
37 | + <div class="col-3 pl-1"> | |
38 | + <strong>Punto descarga</strong> | |
39 | + </div> | |
40 | + <div class="col-9"> | |
41 | + <label>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Fugiat facilis commodi dolore aperiam dolor quaerat, sit earum vero iste itaque aspernatur qui nisi id repudiandae error architecto inventore vel temporibus.</label> | |
42 | + </div> | |
43 | + <div class="col-3 px-1"> | |
44 | + <strong>Remito Nº</strong> | |
45 | + </div> | |
46 | + <div class="col-9"> | |
47 | + <input type="text" class="form-control" value="0001-55551111" readonly> | |
48 | + </div> | |
49 | + <div class="col-12"> | |
50 | + <table class="table"> | |
51 | + <thead> | |
52 | + <tr> | |
53 | + <th>Cisterna</th> | |
54 | + <th>Articulo</th> | |
55 | + <th>Disponibles</th> | |
56 | + <th>Descargar</th> | |
57 | + </tr> | |
58 | + </thead> | |
59 | + <tbody> | |
60 | + <tr> | |
61 | + <td>b45</td> | |
62 | + <td>Nafta súper</td> | |
63 | + <td>400</td> | |
64 | + <td> | |
65 | + <input type="text" class=" form-control col-12"> | |
66 | + </td> | |
67 | + </tr> | |
68 | + </tbody> | |
69 | + </table> | |
70 | + </div> | |
71 | + <div class="col-3 px-1"> | |
72 | + <strong>Nº Recibo</strong> | |
73 | + </div> | |
74 | + <div class="col-9"> | |
75 | + <input class="form-control" type="text" placeholder="Nº de recibo"> | |
76 | + </div> | |
77 | + </div> | |
78 | +</div> | |
79 | +<div class="modal-footer"> | |
80 | + <button | |
81 | + class="btn btn-sm btn-secondary" | |
82 | + ladda="cargando" | |
83 | + type="button" | |
84 | + ng-click="cancelar()">Cancelar</button> | |
85 | + <button | |
86 | + class="btn btn-sm btn-primary" | |
87 | + ladda="cargando" | |
88 | + type="button" | |
89 | + ng-click="aceptar()" | |
90 | + ng-disabled="tieneArticulosPendientes() || idRemito === -1" | |
91 | + foca-focus="!tieneArticulosPendientes() && idRemito !== -1">Descargar</button> | |
92 | +</div> |