diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..44f11df --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +/node_modules +/dist +/tmp +package-lock\.json +src/etc/develop\.js 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 new file mode 100644 index 0000000..5cb3da2 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# foca-modal-detalle-hoja-ruta + +Modal con lista de detalles de hoja de ruta \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..c2aeeef --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,79 @@ +const templateCache = require('gulp-angular-templatecache'); +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'); +const clean = require('gulp-clean'); + +var paths = { + srcJS: 'src/js/*.js', + srcViews: 'src/views/*.html', + tmp: 'tmp', + dist: 'dist/' +}; + +gulp.task('templates', function() { + return pump( + [ + gulp.src(paths.srcViews), + htmlmin(), + templateCache('views.js', { + module: 'focaModalDetalleHojaRuta', + root: '' + }), + gulp.dest(paths.tmp) + ] + ); +}); + +gulp.task('uglify', ['templates'], function() { + return pump( + [ + gulp.src([ + paths.srcJS, + 'tmp/views.js' + ]), + concat('foca-modal-detalle-hoja-ruta.js'), + replace('src/views/', ''), + replace("['ui.bootstrap', 'focaDirectivas']", '[]'), + gulp.dest(paths.tmp), + rename('foca-modal-detalle-hoja-ruta.min.js'), + uglify(), + gulp.dest(paths.dist) + ] + ); +}); + +gulp.task('pre-commit', function() { + return pump( + [ + gulp.src(paths.srcJS), + jshint('.jshintrc'), + jshint.reporter('default'), + jshint.reporter('fail') + ] + ); +}); + +gulp.task('webserver', function() { + pump [ + connect.server({port: 3000}) + ] +}); + +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/index.html b/index.html new file mode 100644 index 0000000..ea94c35 --- /dev/null +++ b/index.html @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/package.json b/package.json new file mode 100644 index 0000000..6fcaf3a --- /dev/null +++ b/package.json @@ -0,0 +1,42 @@ +{ + "name": "foca-modal-detalle-hoja-ruta", + "version": "0.0.1", + "description": "Modal de búsqueda de detalles de hoja de ruta", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "gulp-pre-commit": "gulp pre-commit", + "compile": "gulp uglify", + "postinstall": "npm run compile && gulp clean-post-install", + "install-dev": "npm install -D angular font-awesome pump jquery bootstrap ui-bootstrap4 jshint gulp gulp-uglify gulp-concat gulp-htmlmin gulp-rename gulp-uglify gulp-jshint gulp-replace gulp-connect gulp-clean gulp-angular-templatecache git+https://debo.suite.repo/modulos-npm/foca-directivas.git" + }, + "pre-commit": [ + "gulp-pre-commit" + ], + "repository": { + "type": "git", + "url": "https://debo.suite.repo/modulos-npm/foca-modal-detalle-hoja-ruta.git" + }, + "author": "Foca Software", + "license": "ISC", + "devDependencies": { + "angular": "1.7.5", + "bootstrap": "4.1.3", + "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git", + "font-awesome": "4.7.0", + "gulp": "^3.9.1", + "gulp-angular-templatecache": "^2.2.2", + "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-uglify": "^3.0.1", + "jquery": "3.3.1", + "jshint": "^2.9.6", + "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..d276d1d --- /dev/null +++ b/src/etc/develop.js.ejemplo @@ -0,0 +1,4 @@ +angular.module('focaModalDetalleHojaRuta') + .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..2b4e0ff --- /dev/null +++ b/src/js/app.js @@ -0,0 +1 @@ +angular.module('focaModalDetalleHojaRuta', ['ui.bootstrap', 'focaDirectivas']); diff --git a/src/js/controller.js b/src/js/controller.js new file mode 100644 index 0000000..cf7bf91 --- /dev/null +++ b/src/js/controller.js @@ -0,0 +1,41 @@ +angular.module('focaModalDetalleHojaRuta') + .controller('focaModalDetalleHojaRutaController', + [ + '$filter', + '$scope', + '$uibModalInstance', + 'parametrosDetalleHojaRuta', + function($filter, $scope, $uibModalInstance, parametrosDetalleHojaRuta) { + $scope.paso = 0; + $scope.parametrosDetalleHojaRuta = parametrosDetalleHojaRuta; + $scope.aceptar = function() { + var parametrosDetalleHojaRuta = { + remito: $scope.parametrosDetalleHojaRuta.remito, + cliente: $scope.parametrosDetalleHojaRuta.cliente, + domicilio: $scope.parametrosDetalleHojaRuta.domicilio, + producto: $scope.parametrosDetalleHojaRuta.producto, + litros: $scope.parametrosDetalleHojaRuta.litros, + litrosDescargados: $scope.parametrosDetalleHojaRuta.litrosDescargados, + numeroRecibo: $scope.parametrosDetalleHojaRuta.numeroRecibo + }; + $uibModalInstance.close(parametrosDetalleHojaRuta); + }; + + $scope.cancel = function() { + $uibModalInstance.dismiss('cancel'); + }; + + $scope.validar = function() { + return $scope.formDetalleHojaRuta.$pristine || + !$scope.parametrosDetalleHojaRuta.litrosDescargados || + $scope.parametrosDetalleHojaRuta.litrosDescargados < 1 || + !$scope.parametrosDetalleHojaRuta.numeroRecibo || + $scope.parametrosDetalleHojaRuta.numeroRecibo < 1; + }; + + $scope.irPaso = function(paso) { + $scope.paso = paso; + }; + } + ] + ); diff --git a/src/js/service.js b/src/js/service.js new file mode 100644 index 0000000..f373ef0 --- /dev/null +++ b/src/js/service.js @@ -0,0 +1,12 @@ +angular.module('focaModalDetalleHojaRuta') + .service('focaModalDetalleHojaRutaService', [ + '$http', + 'API_ENDPOINT', + function($http, API_ENDPOINT) { + return { + getDetallesHojaRuta: function() { + return $http.get(API_ENDPOINT.URL + '/transportista'); + } + }; + } + ]); diff --git a/src/views/modal-detalle-hoja-ruta.html b/src/views/modal-detalle-hoja-ruta.html new file mode 100644 index 0000000..b331747 --- /dev/null +++ b/src/views/modal-detalle-hoja-ruta.html @@ -0,0 +1,103 @@ + + +