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/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..532b82c --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,94 @@ +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: 'focaInformes', + root: '' + }), + gulp.dest(paths.tmp) + ] + ); +}); + +gulp.task('uglify', ['templates'], function() { + return pump( + [ + gulp.src([ + paths.srcJS, + 'tmp/views.js' + ]), + concat('foca-informes.js'), + replace('src/views/', ''), + gulp.dest(paths.tmp), + rename('foca-informes.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']); +}); + +gulp.task('copy', ['uglify'], function() { + return gulp.src('dist/*.js') + .pipe(gulp.dest('../../wrapper-demo/node_modules/foca-crear-nota-pedido/dist/')); +}); + +gulp.task('watchAndCopy', function() { + return gulp.watch([paths.srcJS], ['copy']); +}); diff --git a/package.json b/package.json new file mode 100644 index 0000000..4fa9d72 --- /dev/null +++ b/package.json @@ -0,0 +1,48 @@ +{ + "name": "foca-informes", + "version": "0.0.1", + "description": "Botonera para generar distintos informes", + "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-vendedores.git git+http://git.focasoftware.com/npm/foca-modal-proveedor.git git+http://git.focasoftware.com/npm/foca-modal-busqueda-productos.git git+http://git.focasoftware.com/npm/foca-busqueda-cliente.git git+http://git.focasoftware.com/npm/foca-modal-precio-condiciones.git git+http://git.focasoftware.com/npm/foca-modal-flete.git git+http://git.focasoftware.com/npm/foca-modal.git git+http://git.focasoftware.com/npm/foca-modal-domicilio.git git+http://git.focasoftware.com/npm/foca-seguimiento.git git+http://git.focasoftware.com/npm/foca-modal-moneda.git git+http://git.focasoftware.com/npm/foca-modal-cotizacion.git" + }, + "pre-commit": [ + "gulp-pre-commit" + ], + "repository": { + "type": "git", + "url": "https://debo.suite.repo/modulos-npm/foca-informes.git" + }, + "author": "Foca Software", + "license": "ISC", + "devDependencies": { + "angular": "^1.7.5", + "angular-ladda": "^0.4.3", + "angular-route": "^1.7.5", + "bootstrap": "^4.1.3", + "font-awesome": "^4.7.0", + "gulp": "^3.9.1", + "gulp-angular-templatecache": "^2.2.5", + "gulp-clean": "^0.4.0", + "gulp-concat": "^2.6.1", + "gulp-connect": "^5.6.1", + "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.1", + "gulp-uglify-es": "^1.0.4", + "jasmine-core": "^3.3.0", + "jquery": "^3.3.1", + "jshint": "^2.9.6", + "ladda": "1.0.6", + "pre-commit": "^1.2.2", + "pump": "^3.0.0", + "ui-bootstrap4": "^3.0.5" + } +} diff --git a/src/etc/develop.js.ejemplo b/src/etc/develop.js.ejemplo new file mode 100644 index 0000000..5a27085 --- /dev/null +++ b/src/etc/develop.js.ejemplo @@ -0,0 +1,4 @@ +angular.module('focaInformes') + .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..7f624d1 --- /dev/null +++ b/src/js/app.js @@ -0,0 +1 @@ +angular.module('focaInformes', []); diff --git a/src/js/controller.js b/src/js/controller.js new file mode 100644 index 0000000..04ee541 --- /dev/null +++ b/src/js/controller.js @@ -0,0 +1,29 @@ +angular.module('focaInformes') + .controller('focaInformesController', + [ + '$scope', + 'focaInformesService', + 'focaBotoneraLateralService', + '$uibModal', + function($scope, focaInformesService, focaBotoneraLateralService, $uibModal) + { + $scope.now = new Date(); + $scope.botonera = focaInformesService.getBotonera(); + + //SETEO BOTONERA LATERAL + focaBotoneraLateralService.showSalir(true); + focaBotoneraLateralService.showPausar(false); + focaBotoneraLateralService.showGuardar(false); + + $scope.seleccionarHojasDeRuta = function() { + $uibModal.open( + { + ariaLabelledBy: 'Informes de hojas de ruta', + templateUrl: 'modal-informe-hoja-ruta.html', + controller: 'focaModalInformeHojaRutaController', + size: 'lg' + } + ); + }; + } + ]); diff --git a/src/js/route.js b/src/js/route.js new file mode 100644 index 0000000..2d8d227 --- /dev/null +++ b/src/js/route.js @@ -0,0 +1,7 @@ +angular.module('focaInformes') + .config(['$routeProvider', function($routeProvider) { + $routeProvider.when('/informes', { + controller: 'focaInformesController', + templateUrl: 'src/views/informes.html' + }); + }]); diff --git a/src/js/service.js b/src/js/service.js new file mode 100644 index 0000000..3ff86f0 --- /dev/null +++ b/src/js/service.js @@ -0,0 +1,14 @@ +angular.module('focaInformes') + .factory('focaInformesService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { + return { + getBotonera: function() { + var result = [ + { + label: 'Hojas de ruta', + image: 'cliente.png' + } + ]; + return result; + } + }; + }]); diff --git a/src/views/informes.html b/src/views/informes.html new file mode 100644 index 0000000..fa1f6f5 --- /dev/null +++ b/src/views/informes.html @@ -0,0 +1,18 @@ +