From 722611d4c42a4315c16716962407ead97f247e74 Mon Sep 17 00:00:00 2001 From: Eric Date: Mon, 22 Apr 2019 13:29:49 -0300 Subject: [PATCH] first version --- .gitignore | 6 +++ .jshintrc | 64 ++++++++++++++++++++++++++ README.md | 3 ++ gulpfile.js | 86 +++++++++++++++++++++++++++++++++++ package.json | 50 +++++++++++++++++++++ src/etc/develop.js.ejemplo | 4 ++ src/js/app.js | 1 + src/js/controller.js | 45 +++++++++++++++++++ src/js/route.js | 7 +++ src/js/service.js | 9 ++++ src/views/autorizar-nota-pedido.html | 87 ++++++++++++++++++++++++++++++++++++ 11 files changed, 362 insertions(+) create mode 100644 .gitignore create mode 100644 .jshintrc create mode 100644 README.md 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/route.js create mode 100644 src/js/service.js create mode 100644 src/views/autorizar-nota-pedido.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 new file mode 100644 index 0000000..73608cc --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# foca-hoja-ruta + +Listado de hojas de ruta \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..ee8cc16 --- /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: 'focaAutorizarHojaRuta', + root: '' + }), + gulp.dest(paths.tmp) + ] + ); +}); + +gulp.task('uglify', ['templates'], function() { + return pump( + [ + gulp.src([ + paths.srcJS, + 'tmp/views.js' + ]), + concat('foca-autorizar-nota-pedido.js'), + replace('src/views/', ''), + replace("'ngRoute'", ''), + gulp.dest(paths.tmp), + rename('foca-autorizar-nota-pedido.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..7bf37bd --- /dev/null +++ b/package.json @@ -0,0 +1,50 @@ +{ + "name": "foca-hoja-ruta", + "version": "0.0.1", + "description": "foca-hoja-ruta", + "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-hoja-ruta.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", + "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.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..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..64890d9 --- /dev/null +++ b/src/js/app.js @@ -0,0 +1 @@ +angular.module('focaAutorizarHojaRuta', ['ngRoute']); diff --git a/src/js/controller.js b/src/js/controller.js new file mode 100644 index 0000000..978701f --- /dev/null +++ b/src/js/controller.js @@ -0,0 +1,45 @@ +angular.module('focaAutorizarHojaRuta') + .controller('focaAutorizarHojaRutaCtrl', [ + '$scope', + 'focaAutorizarHojaRutaService', + 'focaBotoneraLateralService', + '$filter', + function($scope, focaAutorizarHojaRutaService, focaBotoneraLateralService, $filter) { + + $scope.now = Date.now(); + $scope.notasPedido = [] + + $scope.fechaDesde = new Date(); + $scope.fechaHasta = new Date(); + + focaBotoneraLateralService.showSalir(true); + + var month = $scope.fechaDesde.getMonth() - 1 < 0 ? 12 : $scope.fechaDesde.getMonth() - 1; + $scope.fechaDesde.setMonth(month); + + focaAutorizarHojaRutaService.getNotasPedido($scope.fechaDesde.toISOString().split('.')[0], + $scope.fechaHasta.toISOString().split('.')[0]).then(function(res) { + $scope.notasPedido = res.data.slice(0, 7); + }); + + $scope.getSeleccionados = function() { + var seleccionados = $filter('filter')($scope.notasPedido, { checked: true }); + + return seleccionados.length; + } + + $scope.seleccionarTodo = function() { + $scope.notasPedido.forEach(function (notaPedido) { + notaPedido.checked = !$scope.checkedAll; + }); + } + + $scope.verNotaPedido = function(notaPedido) { + alert('En desarrollo'); + }; + + $scope.autorizar = function() { + alert('En Desarrollo'); + }; + + }]); diff --git a/src/js/route.js b/src/js/route.js new file mode 100644 index 0000000..cf11ee7 --- /dev/null +++ b/src/js/route.js @@ -0,0 +1,7 @@ +angular.module('focaAutorizarHojaRuta') + .config(['$routeProvider', function($routeProvider) { + $routeProvider.when('/autorizar-nota-pedido', { + controller: 'focaAutorizarHojaRutaCtrl', + templateUrl: 'src/views/autorizar-nota-pedido.html' + }); + }]); diff --git a/src/js/service.js b/src/js/service.js new file mode 100644 index 0000000..0ab2e1e --- /dev/null +++ b/src/js/service.js @@ -0,0 +1,9 @@ +angular.module('focaAutorizarHojaRuta') + .factory('focaAutorizarHojaRutaService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { + return { + getNotasPedido: function(fechaDesde, fechaHasta) { + return $http.get(API_ENDPOINT.URL + '/nota-pedido/listar/' + fechaDesde + '/' + + fechaHasta + '/sin-remito'); + } + }; + }]); diff --git a/src/views/autorizar-nota-pedido.html b/src/views/autorizar-nota-pedido.html new file mode 100644 index 0000000..1e56f96 --- /dev/null +++ b/src/views/autorizar-nota-pedido.html @@ -0,0 +1,87 @@ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + +
Nota de pedidoClienteVendedor
+ + + +
+ + Seleccionar todo + +
+
+ +
\ No newline at end of file -- 1.9.1