Commit cc61e728d7feeac02d640528e7f8eca424132b7a
Exists in
master
and in
1 other branch
Merge branch 'master' into 'master'
Primera version See merge request !1
Showing
10 changed files
Show diff stats
.gitignore
File was created | 1 | /node_modules | |
2 | /dist | ||
3 | /tmp | ||
4 | package-lock\.json | ||
5 | src/etc/develop\.js | ||
6 |
.jshintrc
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 |
gulpfile.js
File was created | 1 | const templateCache = require('gulp-angular-templatecache'); | |
2 | const concat = require('gulp-concat'); | ||
3 | const htmlmin = require('gulp-htmlmin'); | ||
4 | const rename = require('gulp-rename'); | ||
5 | const uglify = require('gulp-uglify'); | ||
6 | const gulp = require('gulp'); | ||
7 | const pump = require('pump'); | ||
8 | const jshint = require('gulp-jshint'); | ||
9 | const replace = require('gulp-replace'); | ||
10 | const connect = require('gulp-connect'); | ||
11 | const clean = require('gulp-clean'); | ||
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('clean', function() { | ||
21 | return gulp.src(['tmp', 'dist'], {read: false}) | ||
22 | .pipe(clean()); | ||
23 | }); | ||
24 | |||
25 | gulp.task('templates', ['clean'], function() { | ||
26 | return pump( | ||
27 | [ | ||
28 | gulp.src(paths.srcViews), | ||
29 | htmlmin(), | ||
30 | templateCache('views.js', { | ||
31 | module: 'focaModalFacturaDetalle', | ||
32 | root: '' | ||
33 | }), | ||
34 | gulp.dest(paths.tmp) | ||
35 | ] | ||
36 | ); | ||
37 | }); | ||
38 | |||
39 | gulp.task('uglify', ['templates'], function() { | ||
40 | return pump( | ||
41 | [ | ||
42 | gulp.src([ | ||
43 | paths.srcJS, | ||
44 | 'tmp/views.js' | ||
45 | ]), | ||
46 | concat('foca-modal-factura-detalle.js'), | ||
47 | replace('src/views/', ''), | ||
48 | replace("['ui.bootstrap', 'focaDirectivas', 'angular-ladda']", '[]'), | ||
49 | gulp.dest(paths.tmp), | ||
50 | rename('foca-modal-factura-detalle.min.js'), | ||
51 | uglify(), | ||
52 | gulp.dest(paths.dist) | ||
53 | ] | ||
54 | ); | ||
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: 3000}) | ||
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 | |||
88 | gulp.task('copy', ['uglify'], function() { | ||
89 | gulp.src('dist/*.js') | ||
90 | .pipe(gulp.dest('../../wrapper-demo/node_modules/foca-modal-nota-pedido/dist')); | ||
91 | }); | ||
92 | |||
93 | gulp.task('watchAndCopy', function() { | ||
94 | return gulp.watch([paths.srcJS, paths.srcViews], ['copy']); | ||
95 | }); | ||
96 |
index.html
File was created | 1 | <html ng-app="focaModalFacturaDetalle"> | |
2 | <head> | ||
3 | <meta charset="UTF-8"/> | ||
4 | <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
5 | |||
6 | <!--CSS--> | ||
7 | <link href="node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"/> | ||
8 | <link href="node_modules/font-awesome/css/font-awesome.min.css" rel="stylesheet"/> | ||
9 | <link href="node_modules/ladda/dist/ladda-themeless.min.css" rel="stylesheet"> | ||
10 | |||
11 | <!--VENDOR JS--> | ||
12 | <script src="node_modules/jquery/dist/jquery.min.js"></script> | ||
13 | <script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script> | ||
14 | <script src="node_modules/angular/angular.min.js"></script> | ||
15 | <script src="node_modules/ui-bootstrap4/dist/ui-bootstrap-tpls.js"></script> | ||
16 | <script src="node_modules/foca-directivas/dist/foca-directivas.min.js"></script> | ||
17 | <script src="node_modules/ladda/dist/spin.min.js"></script> | ||
18 | <script src="node_modules/ladda/dist/ladda.min.js"></script> | ||
19 | <script src="node_modules/angular-ladda/dist/angular-ladda.min.js"></script> | ||
20 | |||
21 | <!-- BUILD --> | ||
22 | <script src="src/js/app.js"></script> | ||
23 | <script src="src/js/controller.js"></script> | ||
24 | <script src="src/js/service.js"></script> | ||
25 | |||
26 | <!-- /BUILD --> | ||
27 | |||
28 | <!-- CONFIG PARA DEVELOP --> | ||
29 | <script src="src/etc/develop.js"></script> | ||
30 | |||
31 | </head> | ||
32 | <body ng-controller="focaModalFacturaDetalleController"> | ||
33 | </body> | ||
34 | </html> | ||
35 |
package.json
File was created | 1 | { | |
2 | "name": "foca-modal-factura-detalle", | ||
3 | "version": "0.0.1", | ||
4 | "description": "Modal mostrar facturas en detalle", | ||
5 | "scripts": { | ||
6 | "test": "echo \"Error: no test specified\" && exit 1", | ||
7 | "gulp-pre-commit": "gulp pre-commit", | ||
8 | "compile": "gulp uglify", | ||
9 | "postinstall": "npm run compile && gulp clean-post-install", | ||
10 | "install-dev": "npm i --ignore-scripts" | ||
11 | }, | ||
12 | "pre-commit": [ | ||
13 | "gulp-pre-commit" | ||
14 | ], | ||
15 | "repository": { | ||
16 | "type": "git", | ||
17 | "url": "http://git.focasoftware.com/npm/foca-modal-factura-detalle.git" | ||
18 | }, | ||
19 | "author": "Foca Software", | ||
20 | "license": "ISC", | ||
21 | "peerDependencies": { | ||
22 | "angular": "^1.7.4", | ||
23 | "bootstrap": "^4.1.3", | ||
24 | "font-awesome": "^4.7.0", | ||
25 | "ui-bootstrap4": "^3.0.4", | ||
26 | "gulp": "^3.9.1", | ||
27 | "gulp-angular-templatecache": "^2.2.1", | ||
28 | "gulp-concat": "^2.6.1", | ||
29 | "gulp-connect": "^5.6.1", | ||
30 | "gulp-htmlmin": "^5.0.1", | ||
31 | "gulp-rename": "^1.4.0", | ||
32 | "gulp-replace": "^1.0.0", | ||
33 | "gulp-uglify": "^3.0.1", | ||
34 | "jquery": "^3.3.1", | ||
35 | "pump": "^3.0.0", | ||
36 | "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas" | ||
37 | }, | ||
38 | "devDependencies": { | ||
39 | "angular": "^1.7.5", | ||
40 | "angular-ladda": "^0.4.3", | ||
41 | "bootstrap": "^4.1.3", | ||
42 | "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git", | ||
43 | "font-awesome": "^4.7.0", | ||
44 | "gulp": "^3.9.1", | ||
45 | "gulp-angular-templatecache": "^2.2.5", | ||
46 | "gulp-clean": "^0.4.0", | ||
47 | "gulp-concat": "^2.6.1", | ||
48 | "gulp-connect": "^5.6.1", | ||
49 | "gulp-htmlmin": "^5.0.1", | ||
50 | "gulp-jshint": "^2.1.0", | ||
51 | "gulp-rename": "^1.4.0", | ||
52 | "gulp-replace": "^1.0.0", | ||
53 | "gulp-uglify": "^3.0.1", | ||
54 | "jasmine-core": "^3.3.0", | ||
55 | "jquery": "^3.3.1", | ||
56 | "jshint": "^2.9.6", | ||
57 | "ladda": "^1.0.6", | ||
58 | "pre-commit": "^1.2.2", | ||
59 | "pump": "^3.0.0", | ||
60 | "ui-bootstrap4": "^3.0.5" | ||
61 | } | ||
62 | } | ||
63 |
src/etc/develop.js.ejemplo
File was created | 1 | angular.module('focaModalFacturaDetalle') | |
2 | .constant("API_ENDPOINT", { | ||
3 | 'URL': '//127.0.0.1:9000' | ||
4 | }); | ||
5 |
src/js/app.js
File was created | 1 | angular.module('focaModalFacturaDetalle', ['ui.bootstrap', 'focaDirectivas', 'angular-ladda']); | |
2 |
src/js/controller.js
File was created | 1 | angular.module('focaModalFacturaDetalle') | |
2 | .controller('focaModalFacturaDetalleController', | ||
3 | [ | ||
4 | '$scope', | ||
5 | '$uibModalInstance', | ||
6 | 'focaModalFacturaDetalleService', | ||
7 | 'factura', | ||
8 | 'cliente', | ||
9 | function($scope, $uibModalInstance, | ||
10 | focaModalFacturaDetalleService, factura, cliente | ||
11 | ) { | ||
12 | $scope.factura = factura; | ||
13 | $scope.cliente = cliente; | ||
14 | $scope.detalles = []; | ||
15 | focaModalFacturaDetalleService | ||
16 | .getFacturasDetalleByNCO(factura.NCO) | ||
17 | .then(function(res) { | ||
18 | $scope.detalles = res.data; | ||
19 | }); | ||
20 | |||
21 | $scope.cerrar = function() { | ||
22 | $uibModalInstance.dismiss(); | ||
23 | }; | ||
24 | } | ||
25 | ] | ||
26 | ); | ||
27 |
src/js/service.js
File was created | 1 | angular.module('focaModalFacturaDetalle') | |
2 | .factory('focaModalFacturaDetalleService', [ | ||
3 | '$http', | ||
4 | 'API_ENDPOINT', | ||
5 | function($http, API_ENDPOINT) { | ||
6 | return { | ||
7 | getFacturasDetalleByNCO: function(nco) { | ||
8 | return $http.get( | ||
9 | API_ENDPOINT.URL + '/factura/' + nco + '/detalles'); | ||
10 | } | ||
11 | }; | ||
12 | } | ||
13 | ]); | ||
14 |
src/views/foca-modal-factura-detalle.html
File was created | 1 | <div class="modal-header py-1"> | |
2 | <div class="row"> | ||
3 | <div class="col-md-4"></div> | ||
4 | <div class="col-md-4 text-center"> | ||
5 | <strong>Factura | ||
6 | <br>{{factura.TIP}}</strong> | ||
7 | </div> | ||
8 | <div class="col-md-4 text-center text-md-right"> | ||
9 | {{factura.numeroFactura}} | ||
10 | <br class="d-none d-md-block">{{factura.FECHA_COMPROBANTE | date: 'dd/MM/yyyy'}} | ||
11 | </div> | ||
12 | </div> | ||
13 | </div> | ||
14 | <div class="modal-body" id="modal-body"> | ||
15 | <div class="row"> | ||
16 | <div class="col-12"> | ||
17 | <small><strong>({{cliente.COD | rellenarDigitos: 5: 0}}) {{cliente.NOM}}</strong></small> | ||
18 | <small><br><strong>{{factura.DOMICILIO_CLIENTE}}, {{factura.LOCALIDAD}}, {{factura.PROVINCIA}}</strong></small> | ||
19 | <small><br><strong>PAGO: {{factura.formaPago.NOMBRE}}</strong><strong class="float-right">Items: {{detalles.length}}</strong></small> | ||
20 | </div> | ||
21 | </div> | ||
22 | <div class="row"> | ||
23 | <div class="col-12"> | ||
24 | <table class="table table-sm mt-3"> | ||
25 | <thead> | ||
26 | <tr> | ||
27 | <th>Codigo</th> | ||
28 | <th>Cantidad</th> | ||
29 | <th>Detalle</th> | ||
30 | <th>Precio</th> | ||
31 | <th>Importe</th> | ||
32 | </tr> | ||
33 | </thead> | ||
34 | <tbody> | ||
35 | <tr ng-repeat="detalle in detalles"> | ||
36 | <td class="border-right border-top-0"><small>{{detalle.COD | rellenarDigitos: 2: 0}}-{{detalle.ART | rellenarDigitos: 5: 0}}</small></td> | ||
37 | <td class="border-right border-top-0"><small ng-bind="detalle.CAN | number: 2"></small></td> | ||
38 | <td class="border-right border-top-0"><small ng-bind="detalle.TIO"></small></td> | ||
39 | <td class="border-right border-top-0"><small ng-bind="detalle.PUN | number: 2"></small></td> | ||
40 | <td class="border-top-0"><small ng-bind="detalle.PUN * detalle.CAN | number: 2"></small></td> | ||
41 | </tr> | ||
42 | </tbody> | ||
43 | </table> | ||
44 | <table class="table table-sm table-bordered"> | ||
45 | <tbody> | ||
46 | <tr> | ||
47 | <td><small>Neto</small></td> | ||
48 | <td><small>IVA</small></td> | ||
49 | <td><small>Percepción</small></td> | ||
50 | <td><small>Imp internos</small></td> | ||
51 | <td><small>Perc. IVA</small></td> | ||
52 | </tr> | ||
53 | </tbody> | ||
54 | <tbody> | ||
55 | <tr> | ||
56 | <td ng-bind="factura.NETO | number: 2"></td> | ||
57 | <td ng-bind="factura.IVA | number: 2"></td> | ||
58 | <td ng-bind="factura.PERCEPCION_IIBB"></td> | ||
59 | <td ng-bind="factura.IMPUESTOS_INTERNOS | number: 2"></td> | ||
60 | <td ng-bind="factura.PERCECPION_IVA | number: 2"></td> | ||
61 | </tr> | ||
62 | </tbody> | ||
63 | <tbody> | ||
64 | <tr> | ||
65 | <td></td> | ||
66 | <td></td> | ||
67 | <td><small>Moneda</small></td> | ||
68 | <td><small>Coticacion</small></td> | ||
69 | <td><small><strong>Total</strong></small></td> | ||
70 | </tr> | ||
71 | </tbody> | ||
72 | <tbody> | ||
73 | <tr> | ||
74 | <td></td> | ||
75 | <td></td> | ||
76 | <td ng-bind="factura.moneda.CODIGO_AFIP"></td> | ||
77 | <td ng-bind="factura.COTIZACION | number: 2"></td> | ||
78 | <td ng-bind="factura.TOTAL | number: 2"></td> | ||
79 | </tr> | ||
80 | </tbody> | ||
81 | </table> | ||
82 | </div> | ||
83 | </div> | ||
84 | </div> | ||
85 | <div class="modal-footer py-1"> | ||
86 | <div class="row"> | ||
87 | <div class="col-12"> | ||
88 | <button | ||
89 | class="btn btn-primary" | ||
90 | ng-click="cerrar()" | ||
91 | >Cerrar</button> | ||
92 | </div> | ||
93 | </div> | ||
94 | </div> | ||
95 |