From 8af21bf78b5a30deda4e3d3e4d4b8a68f256c0f5 Mon Sep 17 00:00:00 2001 From: Eric Fernandez Date: Tue, 11 Jun 2019 09:33:35 -0300 Subject: [PATCH] avances --- .gitignore | 6 +++ .jshintrc | 64 ++++++++++++++++++++++++++ README.md | 2 +- gulpfile.js | 86 +++++++++++++++++++++++++++++++++++ package.json | 50 ++++++++++++++++++++ src/etc/develop.js.ejemplo | 4 ++ src/js/app.js | 1 + src/js/controller.js | 93 ++++++++++++++++++++++++++++++++++++++ src/js/service.js | 6 +++ src/views/foca-modal-descarga.html | 92 +++++++++++++++++++++++++++++++++++++ 10 files changed, 403 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 .jshintrc create mode 100644 gulpfile.js create mode 100644 package.json 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/service.js create mode 100644 src/views/foca-modal-descarga.html diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..76a3502 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +/node_modules +/dist +package-lock\.json +/src/etc/develop.js + +tmp/ 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/README.md b/README.md index 4f766d7..44081a8 100644 --- a/README.md +++ b/README.md @@ -1 +1 @@ -Modal descarga de productos esclusivo para hoja de ruta abierta. \ No newline at end of file +Modal descarga de productos esclusivo para hoja de ruta abierta. diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..6f3ccc7 --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,86 @@ +const templateCache = require('gulp-angular-templatecache'); +const clean = require('gulp-clean'); +const concat = require('gulp-concat'); +const htmlmin = require('gulp-htmlmin'); +const rename = require('gulp-rename'); +const uglify = require('gulp-uglify'); +const gulp = require('gulp'); +const pump = require('pump'); +const jshint = require('gulp-jshint'); +const replace = require('gulp-replace'); +const connect = require('gulp-connect'); + +var paths = { + srcJS: 'src/js/*.js', + srcViews: 'src/views/*.html', + tmp: 'tmp', + dist: 'dist/' +}; + +gulp.task('templates', ['clean'], function() { + return pump( + [ + gulp.src(paths.srcViews), + htmlmin(), + templateCache('views.js', { + module: 'focaModalDescarga', + root: '' + }), + gulp.dest(paths.tmp) + ] + ); +}); + +gulp.task('uglify', ['templates'], function() { + return pump( + [ + gulp.src([ + paths.srcJS, + 'tmp/views.js' + ]), + concat('foca-modal-descarga.js'), + replace('src/views/', ''), + replace("'ngRoute'", ''), + gulp.dest(paths.tmp), + rename('foca-modal-descarga.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() { + return pump( + [ + gulp.src(paths.srcJS), + jshint('.jshintrc'), + jshint.reporter('default'), + jshint.reporter('fail') + ] + ); + + gulp.start('uglify'); +}); + +gulp.task('webserver', function() { + pump [ + connect.server({port: 3300, host: '0.0.0.0'}) + ] +}); + +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('default', ['webserver']); + +gulp.task('watch', function() { + gulp.watch([paths.srcJS, paths.srcViews], ['uglify']); +}); diff --git a/package.json b/package.json new file mode 100644 index 0000000..1b37340 --- /dev/null +++ b/package.json @@ -0,0 +1,50 @@ +{ + "name": "foca-modal-descarga", + "version": "0.0.1", + "description": "foca-modal-descarga", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "compile": "gulp uglify", + "gulp-pre-commit": "gulp pre-commit", + "postinstall": "npm run compile && gulp clean-post-install", + "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" + }, + "pre-commit": [ + "gulp-pre-commit" + ], + "repository": { + "type": "git", + "url": "git+http://git.focasoftware.com/npm/foca-modal-descarga.git" + }, + "author": "Foca Software", + "license": "ISC", + "devDependencies": { + "angular": "^1.7.8", + "angular-ladda": "^0.4.3", + "angular-route": "^1.7.8", + "bootstrap": "^4.3.1", + "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git", + "foca-modal-remito": "git+http://git.focasoftware.com/npm/foca-modal-remito.git", + "font-awesome": "^4.7.0", + "gulp": "^3.9.1", + "gulp-angular-templatecache": "^2.2.6", + "gulp-clean": "^0.4.0", + "gulp-concat": "^2.6.1", + "gulp-connect": "^5.7.0", + "gulp-htmlmin": "^5.0.1", + "gulp-jshint": "^2.1.0", + "gulp-rename": "^1.4.0", + "gulp-replace": "^1.0.0", + "gulp-sequence": "^1.0.0", + "gulp-uglify": "^3.0.2", + "gulp-uglify-es": "^1.0.4", + "jasmine-core": "^3.4.0", + "jquery": "^3.4.0", + "jshint": "^2.10.2", + "ladda": "^1.0.6", + "pre-commit": "^1.2.2", + "pump": "^3.0.0", + "ui-bootstrap4": "^3.0.6" + } +} diff --git a/src/etc/develop.js.ejemplo b/src/etc/develop.js.ejemplo new file mode 100644 index 0000000..25cd0cd --- /dev/null +++ b/src/etc/develop.js.ejemplo @@ -0,0 +1,4 @@ +angular.module('focaCrearHojaRuta') + .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..5bb17b4 --- /dev/null +++ b/src/js/app.js @@ -0,0 +1 @@ +angular.module('focaModalDescarga', []); diff --git a/src/js/controller.js b/src/js/controller.js new file mode 100644 index 0000000..8aa8270 --- /dev/null +++ b/src/js/controller.js @@ -0,0 +1,93 @@ +angular.module('focaModalDescarga') + .controller('focaModalDescargaCtrl', [ + '$scope', + 'focaModalDescargasService', + '$filter', + 'focaModalService', + '$timeout', + '$uibModalInstance', + '$uibModal', + function($scope, focaModalDescargasService, $filter, + focaModalService, $timeout, $uibModalInstance, $uibModal) + { + + //#region variables + $scope.remito = {}; + //#endregion + + $scope.crearRemito = function() { + + var remito = { + id: $scope.remito.id, + fechaRemito: $scope.now.toISOString().slice(0, 19).replace('T', ' '), + idCliente: $scope.remito.cliente.COD, + nombreCliente: $scope.remito.cliente.NOM, + cuitCliente: $scope.remito.cliente.CUIT, + total: $scope.getTotal() * $scope.remito.cotizacion.VENDEDOR, + numeroNotaPedido: $scope.remito.numeroNotaPedido, + idVendedor: $scope.remito.vendedor.NUM, + idProveedor: $scope.remito.proveedor.COD, + idDomicilio: $scope.remito.idDomicilio || $scope.remito.domicilio.id, + idCotizacion: $scope.remito.cotizacion.ID, + idListaPrecio: $scope.idLista, + flete: $scope.remito.flete, + fob: $scope.remito.fob, + bomba: $scope.remito.bomba, + kilometros: $scope.remito.kilometros, + domicilioStamp: $scope.remito.domicilioStamp, + observaciones: $scope.remito.observaciones, + numeroRemito: parseInt($scope.comprobante), + sucursal: parseInt($scope.puntoVenta), + responsabilidadIvaCliente: $scope.remito.cliente.IVA, + descuento: 0,//TODO, + importeNeto: getImporte('netoUnitario'), + importeExento: getImporte('exentoUnitario'), + importeIva: getImporte('ivaUnitario'), + importeIvaServicios: 0,//TODO + importeImpuestoInterno: getImporte('impuestoInternoUnitario'), + importeImpuestoInterno1: getImporte('impuestoInterno1Unitario'), + importeImpuestoInterno2: getImporte('impuestoInterno2Unitario'), + percepcion: 0,//TODO + percepcionIva: 0,//TODO + redondeo: 0,//TODO + anulado: false, + planilla: $filter('date')($scope.now, 'ddMMyyyy'), + lugar: parseInt($scope.puntoVenta), + cuentaMadre: 0,//TODO + cuentaContable: 0,//TODO + asiento: 0,//TODO + e_hd: '',//TODO + c_hd: '', + numeroLiquidoProducto: 0,//TODO + estado: 0, + destinoVenta: 0,//TODO + operacionTipo: 0, //TODO + } + } + + $scope.seleccionarCliente = function() { + + var modalInstance = $uibModal.open( + { + ariaLabelledBy: 'Busqueda de Cliente', + templateUrl: 'foca-busqueda-cliente-modal.html', + controller: 'focaBusquedaClienteModalController', + resolve: { + vendedor: function () { return null; }, + cobrador: function () { return null; } + }, + size: 'lg' + } + ); + modalInstance.result.then(function(cliente) { + $scope.remito.cliente = cliente; + }, function() { + //funcion ejecutada al cancelar modal + }); + }; + + $scope.cancelar = function() { + $uibModalInstance.dismiss(); + } + } + ]); diff --git a/src/js/service.js b/src/js/service.js new file mode 100644 index 0000000..f51e124 --- /dev/null +++ b/src/js/service.js @@ -0,0 +1,6 @@ +angular.module('focaModalDescarga') + .factory('focaModalDescargasService', ['$http', 'API_ENDPOINT', function ($http, API_ENDPOINT) { + return { + + }; + }]); diff --git a/src/views/foca-modal-descarga.html b/src/views/foca-modal-descarga.html new file mode 100644 index 0000000..51dd059 --- /dev/null +++ b/src/views/foca-modal-descarga.html @@ -0,0 +1,92 @@ + + + -- 1.9.1