Commit 79dbc02f5f851d79e2a736f06d785dc822da0b57

Authored by Eric Fernandez
1 parent 1eb556f543
Exists in master

first version

... ... @@ -0,0 +1,6 @@
  1 +/node_modules
  2 +/dist
  3 +package-lock\.json
  4 +/src/etc/develop.js
  5 +
  6 +tmp/
... ... @@ -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 +}
... ... @@ -0,0 +1,91 @@
  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: 'focaListaHojaRuta',
  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-hoja-ruta.js'),
  42 + replace('src/views/', ''),
  43 + replace("'ngRoute'", ''),
  44 + gulp.dest(paths.tmp),
  45 + rename('foca-hoja-ruta.min.js'),
  46 + uglify(),
  47 + /*replace('"ngRoute","ui.bootstrap","focaModalVendedores","focaBusquedaProductos",'+
  48 + '"focaModalProveedor","focaBusquedaCliente","focaModalPrecioCondicion",'+
  49 + '"focaModalFlete","focaDirectivas","focaModal","focaModalDomicilio",'+
  50 + '"focaModalMoneda","focaModalCotizacion","focaSeguimiento","angular-ladda",'+
  51 + '"cordovaGeolocationModule"', ''),*/
  52 + gulp.dest(paths.dist)
  53 + ]
  54 + );
  55 +});
  56 +
  57 +gulp.task('clean', function() {
  58 + return gulp.src(['tmp', 'dist'], {read: false})
  59 + .pipe(clean());
  60 +});
  61 +
  62 +gulp.task('pre-commit', function() {
  63 + return pump(
  64 + [
  65 + gulp.src(paths.srcJS),
  66 + jshint('.jshintrc'),
  67 + jshint.reporter('default'),
  68 + jshint.reporter('fail')
  69 + ]
  70 + );
  71 +
  72 + gulp.start('uglify');
  73 +});
  74 +
  75 +gulp.task('webserver', function() {
  76 + pump [
  77 + connect.server({port: 3300, host: '0.0.0.0'})
  78 + ]
  79 +});
  80 +
  81 +gulp.task('clean-post-install', function() {
  82 + return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js',
  83 + 'index.html'], {read: false})
  84 + .pipe(clean());
  85 +});
  86 +
  87 +gulp.task('default', ['webserver']);
  88 +
  89 +gulp.task('watch', function() {
  90 + gulp.watch([paths.srcJS, paths.srcViews], ['uglify']);
  91 +});
... ... @@ -0,0 +1,42 @@
  1 +{
  2 + "name": "foca--hoja-ruta",
  3 + "version": "0.0.1",
  4 + "description": "foca-hoja-ruta",
  5 + "main": "index.js",
  6 + "scripts": {
  7 + "test": "echo \"Error: no test specified\" && exit 1"
  8 + },
  9 + "repository": {
  10 + "type": "git",
  11 + "url": "https://debo.suite.repo/modulos-npm/foca-hoja-ruta.git"
  12 + },
  13 + "author": "Foca Software",
  14 + "license": "ISC",
  15 + "devDependencies": {
  16 + "angular": "^1.7.5",
  17 + "angular-ladda": "^0.4.3",
  18 + "angular-route": "^1.7.5",
  19 + "bootstrap": "^4.1.3",
  20 + "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git",
  21 + "foca-modal-remito": "git+https://debo.suite.repo/modulos-npm/foca-modal-remito.git",
  22 + "font-awesome": "^4.7.0",
  23 + "gulp": "^3.9.1",
  24 + "gulp-angular-templatecache": "^2.2.5",
  25 + "gulp-clean": "^0.4.0",
  26 + "gulp-concat": "^2.6.1",
  27 + "gulp-connect": "^5.6.1",
  28 + "gulp-htmlmin": "^5.0.1",
  29 + "gulp-jshint": "^2.1.0",
  30 + "gulp-rename": "^1.4.0",
  31 + "gulp-replace": "^1.0.0",
  32 + "gulp-sequence": "^1.0.0",
  33 + "gulp-uglify": "^3.0.1",
  34 + "jasmine-core": "^3.3.0",
  35 + "jquery": "^3.3.1",
  36 + "jshint": "^2.9.6",
  37 + "ladda": "1.0.6",
  38 + "pre-commit": "^1.2.2",
  39 + "pump": "^3.0.0",
  40 + "ui-bootstrap4": "^3.0.5"
  41 + }
  42 +}
src/etc/develop.js.ejemplo
... ... @@ -0,0 +1,4 @@
  1 +angular.module('focaCrearHojaRuta')
  2 + .constant("API_ENDPOINT", {
  3 + 'URL': '//127.0.0.1:9000'
  4 + });
... ... @@ -0,0 +1,16 @@
  1 +angular.module('focaListaHojaRuta', [
  2 + 'ngRoute'
  3 + /*'focaBusquedaProductos',
  4 + 'focaModalProveedor',
  5 + 'focaBusquedaCliente',
  6 + 'focaModalPrecioCondicion',
  7 + 'focaModalFlete',
  8 + 'focaDirectivas',
  9 + 'focaModal',
  10 + 'focaModalDomicilio',
  11 + 'focaModalMoneda',
  12 + 'focaModalCotizacion',
  13 + 'focaSeguimiento',
  14 + 'angular-ladda',
  15 + 'cordovaGeolocationModule'*/
  16 +]);
src/js/controller.js
... ... @@ -0,0 +1,44 @@
  1 +angular.module('focaListaHojaRuta')
  2 + .controller('listaHojaRutaCtrl',
  3 + [
  4 + '$scope', '$filter', 'hojaRutaService',
  5 + function($scope, $filter, hojaRutaService) {
  6 + hojaRutaService.getHojasRuta().then(function(res) {
  7 + $scope.hojasRuta = res.data;
  8 + });
  9 + $scope.cabecera = [];
  10 + $scope.showCabecera = true;
  11 + addCabecera('Transportista:', 'Andesmar');
  12 + addCabecera('Chofer:', 'Carlos');
  13 + addCabecera('Vehรญculo:', 'SCANIA TODOPODEROSO');
  14 + $scope.now = new Date();
  15 + $scope.puntoVenta = '0000';
  16 + $scope.comprobante = '00000000';
  17 +
  18 + function addCabecera(label, valor) {
  19 + var propiedad = $filter('filter')($scope.cabecera, {label: label}, true);
  20 + if(propiedad.length === 1) {
  21 + propiedad[0].valor = valor;
  22 + } else {
  23 + $scope.cabecera.push({label: label, valor: valor});
  24 + }
  25 + }
  26 +
  27 + function removeCabecera(label) {
  28 + var propiedad = $filter('filter')($scope.cabecera, {label: label}, true);
  29 + if(propiedad.length === 1) {
  30 + $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1);
  31 + }
  32 + }
  33 +
  34 + function rellenar(relleno, longitud) {
  35 + relleno = '' + relleno;
  36 + while (relleno.length < longitud) {
  37 + relleno = '0' + relleno;
  38 + }
  39 +
  40 + return relleno;
  41 + }
  42 + }
  43 + ]);
  44 +
... ... @@ -0,0 +1,7 @@
  1 +angular.module('focaListaHojaRuta')
  2 + .config(['$routeProvider', function($routeProvider) {
  3 + $routeProvider.when('/venta-hoja-ruta/lista', {
  4 + controller: 'listaHojaRutaCtrl',
  5 + templateUrl: 'src/views/lista-hoja-ruta.html'
  6 + });
  7 + }]);
... ... @@ -0,0 +1,9 @@
  1 +angular.module('focaListaHojaRuta')
  2 + .service('hojaRutaService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) {
  3 + var route = API_ENDPOINT.URL;
  4 + return {
  5 + getHojasRuta: function() {
  6 + return $http.get(route + '/hoja-ruta');
  7 + }
  8 + };
  9 + }]);
src/views/lista-hoja-ruta.html
... ... @@ -0,0 +1,101 @@
  1 +<div>
  2 + <div class="col-md-10 offset-md-1 col-lg-8 offset-lg-2">
  3 + <div class="row p-1 panel-informativo">
  4 + <div class="col-12">
  5 + <div class="row">
  6 + <!-- <div class="col-12 col-sm-4 nota-pedido"> -->
  7 + <!-- <h5>Hojas de ruta</h5> -->
  8 + <!-- </div> -->
  9 + <!-- <div class="col-5 col-sm-4 numero-pedido" -->
  10 + <!-- >Nยบ {{puntoVenta}}-{{comprobante}} -->
  11 + <!-- </div> -->
  12 + <!-- <div class="col-7 col-sm-4 text-right"> -->
  13 + <!-- Fecha: -->
  14 + <!-- <span -->
  15 + <!-- ng-show="!datepickerAbierto" -->
  16 + <!-- ng-bind="now | date:'dd/MM/yyyy HH:mm'" -->
  17 + <!-- ng-click="datepickerAbierto = true" -->
  18 + <!-- > -->
  19 + <!-- </span> -->
  20 + <!-- <input -->
  21 + <!-- ng-show="datepickerAbierto" -->
  22 + <!-- type="date" -->
  23 + <!-- ng-model="now" -->
  24 + <!-- ng-change="datepickerAbierto = false" -->
  25 + <!-- ng-blur="datepickerAbierto = false" -->
  26 + <!-- class="form-control form-control-sm col-8 float-right" -->
  27 + <!-- foca-focus="datepickerAbierto" -->
  28 + <!-- hasta-hoy -->
  29 + <!-- /> -->
  30 + <!-- </div> -->
  31 + </div>
  32 + <div class="row">
  33 + <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera">
  34 + <span class="label" ng-bind="cab.label"></span>
  35 + <span class="valor" ng-bind="cab.valor"></span>
  36 + </div>
  37 + <a
  38 + class="btn col-12 btn-secondary d-sm-none"
  39 + ng-show="cabecera.length > 0"
  40 + ng-click="showCabecera = !showCabecera"
  41 + >
  42 + <i
  43 + class="fa fa-chevron-down"
  44 + ng-hide="showCabecera"
  45 + aria-hidden="true"
  46 + >
  47 + </i>
  48 + <i
  49 + class="fa fa-chevron-up"
  50 + ng-show="showCabecera"
  51 + aria-hidden="true">
  52 + </i>
  53 + </a>
  54 + </div>
  55 + </div>
  56 + </div>
  57 + <div class="row p-1 botonera-secundaria">
  58 + <div class="col-12">
  59 + <div class="row">
  60 + <div class="col-6 col-sm-3 px-0 py-0" ng-repeat="boton in botonera">
  61 + <button
  62 + type="button"
  63 + class="btn btn-default btn-block btn-xs text-left py-2"
  64 + ng-click="boton.accion()"
  65 + ng-class="{'d-none d-sm-block': boton.texto == ''}"
  66 + >
  67 + <i
  68 + class="fa fa-arrow-circle-right"
  69 + ng-show="boton.texto != ''"
  70 + ></i>
  71 + &nbsp;
  72 + {{boton.texto}}
  73 + </button>
  74 + </div>
  75 + </div>
  76 + </div>
  77 + </div>
  78 + </div>
  79 + <div class="col-12 col-md-10 col-lg-8 offset-md-1 offset-lg-2">
  80 + <div class="row grilla-articulo d-none d-sm-flex">
  81 + <table class="table tabla-articulo table-striped table-sm table-dark">
  82 + <thead>
  83 + <tr class="d-flex">
  84 + <th>#</th>
  85 + <th>Sucursal</th>
  86 + <th>#HojaRuta</th>
  87 + </tr>
  88 + </thead>
  89 + <tbody class="tabla-articulo-body">
  90 + <tr
  91 + ng-repeat="(key, hojaRuta) in hojasRuta" class="d-flex"
  92 + >
  93 + <td ng-bind="key + 1"></td>
  94 + <td ng-bind="hojaRuta.sucursal"></td>
  95 + <td ng-bind="hojaRuta.numeroHojaRuta"></td>
  96 + </tr>
  97 + </tbody>
  98 + </table>
  99 + </div>
  100 + </div>
  101 +</div>