Commit 722611d4c42a4315c16716962407ead97f247e74

Authored by Eric
0 parents
Exists in master and in 1 other branch develop

first version

File was created 1 /node_modules
2 /dist
3 package-lock\.json
4 /src/etc/develop.js
5
6 tmp/
7
File was created 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 }
65
File was created 1 # foca-hoja-ruta
2
3 Listado de hojas de ruta
File was created 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: 'focaAutorizarHojaRuta',
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-autorizar-nota-pedido.js'),
42 replace('src/views/', ''),
43 replace("'ngRoute'", ''),
44 gulp.dest(paths.tmp),
45 rename('foca-autorizar-nota-pedido.min.js'),
46 uglify(),
47 gulp.dest(paths.dist)
48 ]
49 );
50 });
51
52 gulp.task('clean', function() {
53 return gulp.src(['tmp', 'dist'], {read: false})
54 .pipe(clean());
55 });
56
57 gulp.task('pre-commit', function() {
58 return pump(
59 [
60 gulp.src(paths.srcJS),
61 jshint('.jshintrc'),
62 jshint.reporter('default'),
63 jshint.reporter('fail')
64 ]
65 );
66
67 gulp.start('uglify');
68 });
69
70 gulp.task('webserver', function() {
71 pump [
72 connect.server({port: 3300, host: '0.0.0.0'})
73 ]
74 });
75
76 gulp.task('clean-post-install', function() {
77 return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js',
78 'index.html'], {read: false})
79 .pipe(clean());
80 });
81
82 gulp.task('default', ['webserver']);
83
84 gulp.task('watch', function() {
85 gulp.watch([paths.srcJS, paths.srcViews], ['uglify']);
86 });
87
File was created 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 "compile": "gulp uglify",
9 "gulp-pre-commit": "gulp pre-commit",
10 "postinstall": "npm run compile && gulp clean-post-install",
11 "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"
12 },
13 "pre-commit": [
14 "gulp-pre-commit"
15 ],
16 "repository": {
17 "type": "git",
18 "url": "git+http://git.focasoftware.com/npm/foca-hoja-ruta.git"
19 },
20 "author": "Foca Software",
21 "license": "ISC",
22 "devDependencies": {
23 "angular": "^1.7.5",
24 "angular-ladda": "^0.4.3",
25 "angular-route": "^1.7.5",
26 "bootstrap": "^4.1.3",
27 "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git",
28 "foca-modal-remito": "git+http://git.focasoftware.com/npm/foca-modal-remito.git",
29 "font-awesome": "^4.7.0",
30 "gulp": "^3.9.1",
31 "gulp-angular-templatecache": "^2.2.5",
32 "gulp-clean": "^0.4.0",
33 "gulp-concat": "^2.6.1",
34 "gulp-connect": "^5.6.1",
35 "gulp-htmlmin": "^5.0.1",
36 "gulp-jshint": "^2.1.0",
37 "gulp-rename": "^1.4.0",
38 "gulp-replace": "^1.0.0",
39 "gulp-sequence": "^1.0.0",
40 "gulp-uglify": "^3.0.1",
41 "gulp-uglify-es": "^1.0.4",
42 "jasmine-core": "^3.3.0",
43 "jquery": "^3.3.1",
44 "jshint": "^2.9.6",
45 "ladda": "^1.0.6",
46 "pre-commit": "^1.2.2",
47 "pump": "^3.0.0",
48 "ui-bootstrap4": "^3.0.5"
49 }
50 }
51
src/etc/develop.js.ejemplo
File was created 1 angular.module('focaCrearHojaRuta')
2 .constant("API_ENDPOINT", {
3 'URL': '//127.0.0.1:9000'
4 });
5
File was created 1 angular.module('focaAutorizarHojaRuta', ['ngRoute']);
2
src/js/controller.js
File was created 1 angular.module('focaAutorizarHojaRuta')
2 .controller('focaAutorizarHojaRutaCtrl', [
3 '$scope',
4 'focaAutorizarHojaRutaService',
5 'focaBotoneraLateralService',
6 '$filter',
7 function($scope, focaAutorizarHojaRutaService, focaBotoneraLateralService, $filter) {
8
9 $scope.now = Date.now();
10 $scope.notasPedido = []
11
12 $scope.fechaDesde = new Date();
13 $scope.fechaHasta = new Date();
14
15 focaBotoneraLateralService.showSalir(true);
16
17 var month = $scope.fechaDesde.getMonth() - 1 < 0 ? 12 : $scope.fechaDesde.getMonth() - 1;
18 $scope.fechaDesde.setMonth(month);
19
20 focaAutorizarHojaRutaService.getNotasPedido($scope.fechaDesde.toISOString().split('.')[0],
21 $scope.fechaHasta.toISOString().split('.')[0]).then(function(res) {
22 $scope.notasPedido = res.data.slice(0, 7);
23 });
24
25 $scope.getSeleccionados = function() {
26 var seleccionados = $filter('filter')($scope.notasPedido, { checked: true });
27
28 return seleccionados.length;
29 }
30
31 $scope.seleccionarTodo = function() {
32 $scope.notasPedido.forEach(function (notaPedido) {
33 notaPedido.checked = !$scope.checkedAll;
34 });
35 }
36
37 $scope.verNotaPedido = function(notaPedido) {
38 alert('En desarrollo');
39 };
40
41 $scope.autorizar = function() {
42 alert('En Desarrollo');
43 };
44
45 }]);
46
File was created 1 angular.module('focaAutorizarHojaRuta')
2 .config(['$routeProvider', function($routeProvider) {
3 $routeProvider.when('/autorizar-nota-pedido', {
4 controller: 'focaAutorizarHojaRutaCtrl',
5 templateUrl: 'src/views/autorizar-nota-pedido.html'
6 });
7 }]);
8
File was created 1 angular.module('focaAutorizarHojaRuta')
2 .factory('focaAutorizarHojaRutaService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) {
3 return {
4 getNotasPedido: function(fechaDesde, fechaHasta) {
5 return $http.get(API_ENDPOINT.URL + '/nota-pedido/listar/' + fechaDesde + '/' +
6 fechaHasta + '/sin-remito');
7 }
8 };
9 }]);
10
src/views/autorizar-nota-pedido.html
File was created 1 <div class="row">
2 <foca-cabecera-facturador
3 titulo="'Autorizar Nota'"
4 fecha="now"
5 class="mb-0 col-lg-12"
6 ></foca-cabecera-facturador>
7 </div>
8 <table class="table tabla-autorizar-nota-pedido table-striped table-sm col-10">
9 <thead>
10 <tr>
11 <th>Nota de pedido</th>
12 <th>Cliente</th>
13 <th>Vendedor</th>
14 <th></th>
15 </tr>
16 </thead>
17 <tbody>
18 <tr ng-repeat="notaPedido in notasPedido">
19 <td ng-bind="[notaPedido.sucursal, notaPedido.numeroNotaPedido] | comprobante"></td>
20 <td ng-bind="notaPedido.nombreCliente"></td>
21 <td ng-bind="notaPedido.vendedor.NOM"></td>
22 <td>
23 <input
24 class="form-control-sm"
25 type="checkbox"
26 ng-model="notaPedido.checked">
27
28 <button class="btn mb-4" type="button" ng-click="verNotaPedido()">
29 <i class="fa fa-eye"></i>
30 </button>
31 </td>
32 </tr>
33 </tbody>
34 <tfoot>
35 <tr>
36 <th colspan="2">
37 <button
38 class="btn btn-primary" ng-click="autorizar()">Autorizar({{getSeleccionados()}})</button>
39 </th>
40 <th>Seleccionar todo</th>
41 <th>
42 <input
43 class="form-control-sm"
44 type="checkbox"
45 ng-model="checkedAll"
46 ng-click="seleccionarTodo()">
47 </th>
48 </tr>
49 </tfoot>
50 </table>
51 <div>
52 <nav ng-show="notasPedido.length > 0" class="mr-auto paginador-abm">
53 <ul class="pagination pagination-sm mb-0">
54 <li class="page-item" ng-class="{'disabled': currentPage == 1}">
55 <a class="page-link" href="javascript:void()" ng-click="selectPage(currentPage - 1)">
56 <span aria-hidden="true">&laquo;</span>
57 <span class="sr-only">Anterior</span>
58 </a>
59 </li>
60 <!-- TODO QUITAR HARDCODEO -->
61 <li
62 class="page-item active">
63 <a
64 class="page-link"
65 href="javascript:void()">1</a>
66 </li>
67 <li
68 class="page-item"
69 ng-repeat="pagina in paginas"
70 ng-class="{'active': pagina == currentPage}"
71 >
72 <a
73 class="page-link"
74 href="javascript:void()"
75 ng-click="selectPage(pagina)"
76 ng-bind="pagina"
77 ></a>
78 </li>
79 <li class="page-item" ng-class="{'disabled': currentPage == lastPage}">
80 <a class="page-link" href="javascript:void()" ng-click="selectPage(currentPage + 1)">
81 <span aria-hidden="true">&raquo;</span>
82 <span class="sr-only">Siguiente</span>
83 </a>
84 </li>
85 </ul>
86 </nav>
87 </div>