Commit 9c5dd6316456b701f6d192eff45e7ff36520328d
Exists in
master
Merge remote-tracking branch 'upstream/master'
Showing
5 changed files
Show diff stats
gulpfile.js
1 | const templateCache = require('gulp-angular-templatecache'); | 1 | const templateCache = require('gulp-angular-templatecache'); |
2 | const clean = require('gulp-clean'); | 2 | const clean = require('gulp-clean'); |
3 | const concat = require('gulp-concat'); | 3 | const concat = require('gulp-concat'); |
4 | const htmlmin = require('gulp-htmlmin'); | 4 | const htmlmin = require('gulp-htmlmin'); |
5 | const rename = require('gulp-rename'); | 5 | const rename = require('gulp-rename'); |
6 | const uglify = require('gulp-uglify'); | 6 | const uglify = require('gulp-uglify'); |
7 | const gulp = require('gulp'); | 7 | const gulp = require('gulp'); |
8 | const pump = require('pump'); | 8 | const pump = require('pump'); |
9 | const jshint = require('gulp-jshint'); | 9 | const jshint = require('gulp-jshint'); |
10 | const replace = require('gulp-replace'); | 10 | const replace = require('gulp-replace'); |
11 | const connect = require('gulp-connect'); | 11 | const connect = require('gulp-connect'); |
12 | 12 | ||
13 | var paths = { | 13 | var paths = { |
14 | srcJS: 'src/js/*.js', | 14 | srcJS: 'src/js/*.js', |
15 | srcViews: 'src/views/*.html', | 15 | srcViews: 'src/views/*.html', |
16 | tmp: 'tmp', | 16 | tmp: 'tmp', |
17 | dist: 'dist/' | 17 | dist: 'dist/' |
18 | }; | 18 | }; |
19 | 19 | ||
20 | gulp.task('templates', ['clean'], function() { | 20 | gulp.task('templates', ['clean'], function() { |
21 | return pump( | 21 | return pump( |
22 | [ | 22 | [ |
23 | gulp.src(paths.srcViews), | 23 | gulp.src(paths.srcViews), |
24 | htmlmin(), | 24 | htmlmin(), |
25 | templateCache('views.js', { | 25 | templateCache('views.js', { |
26 | module: 'focaCrearRemito', | 26 | module: 'focaCrearRemito', |
27 | root: '' | 27 | root: '' |
28 | }), | 28 | }), |
29 | gulp.dest(paths.tmp) | 29 | gulp.dest(paths.tmp) |
30 | ] | 30 | ] |
31 | ); | 31 | ); |
32 | }); | 32 | }); |
33 | 33 | ||
34 | gulp.task('uglify', ['templates'], function() { | 34 | gulp.task('uglify', ['templates'], function() { |
35 | return pump( | 35 | return pump( |
36 | [ | 36 | [ |
37 | gulp.src([ | 37 | gulp.src([ |
38 | paths.srcJS, | 38 | paths.srcJS, |
39 | 'tmp/views.js' | 39 | 'tmp/views.js' |
40 | ]), | 40 | ]), |
41 | concat('foca-crear-remito.js'), | 41 | concat('foca-crear-remito.js'), |
42 | replace('src/views/', ''), | 42 | replace('src/views/', ''), |
43 | gulp.dest(paths.tmp), | 43 | gulp.dest(paths.tmp), |
44 | rename('foca-crear-remito.min.js'), | 44 | rename('foca-crear-remito.min.js'), |
45 | uglify(), | 45 | uglify(), |
46 | replace('"ngRoute","ui.bootstrap","focaModalVendedores","focaBusquedaProductos",'+ | 46 | replace('"ngRoute","ui.bootstrap","focaModalVendedores","focaBusquedaProductos",'+ |
47 | '"focaModalProveedor","focaBusquedaCliente","focaModalPrecioCondicion",'+ | 47 | '"focaModalProveedor","focaBusquedaCliente","focaModalPrecioCondicion",'+ |
48 | '"focaModalFlete","focaDirectivas","focaModal","focaModalDomicilio",'+ | 48 | '"focaModalFlete","focaDirectivas","focaModal","focaModalDomicilio",'+ |
49 | '"focaModalMoneda","focaModalCotizacion","focaSeguimiento","angular-ladda",'+ | 49 | '"focaModalMoneda","focaModalCotizacion","focaSeguimiento","angular-ladda",'+ |
50 | '"cordovaGeolocationModule"', ''), | 50 | '"cordovaGeolocationModule"', ''), |
51 | gulp.dest(paths.dist) | 51 | gulp.dest(paths.dist) |
52 | ] | 52 | ] |
53 | ); | 53 | ); |
54 | }); | 54 | }); |
55 | 55 | ||
56 | gulp.task('clean', function(){ | 56 | gulp.task('clean', function() { |
57 | return gulp.src(['tmp', 'dist'], {read: false}) | 57 | return gulp.src(['tmp', 'dist'], {read: false}) |
58 | .pipe(clean()); | 58 | .pipe(clean()); |
59 | }); | 59 | }); |
60 | 60 | ||
61 | gulp.task('pre-commit', function() { | 61 | gulp.task('pre-commit', function() { |
62 | return pump( | 62 | return pump( |
63 | [ | 63 | [ |
64 | gulp.src(paths.srcJS), | 64 | gulp.src(paths.srcJS), |
65 | jshint('.jshintrc'), | 65 | jshint('.jshintrc'), |
66 | jshint.reporter('default'), | 66 | jshint.reporter('default'), |
67 | jshint.reporter('fail') | 67 | jshint.reporter('fail') |
68 | ] | 68 | ] |
69 | ); | 69 | ); |
70 | 70 | ||
71 | gulp.start('uglify'); | 71 | gulp.start('uglify'); |
72 | }); | 72 | }); |
73 | 73 | ||
74 | gulp.task('webserver', function() { | 74 | gulp.task('webserver', function() { |
75 | pump [ | 75 | pump [ |
76 | connect.server({port: 3300, host: '0.0.0.0'}) | 76 | connect.server({port: 3300, host: '0.0.0.0'}) |
77 | ] | 77 | ] |
78 | }); | 78 | }); |
79 | 79 | ||
80 | gulp.task('clean-post-install', function() { | 80 | gulp.task('clean-post-install', function() { |
81 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', | 81 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', |
82 | 'index.html'], {read: false}) | 82 | 'index.html'], {read: false}) |
83 | .pipe(clean()); | 83 | .pipe(clean()); |
84 | }); | 84 | }); |
85 | 85 | ||
86 | gulp.task('default', ['webserver']); | 86 | gulp.task('default', ['webserver']); |
87 | 87 | ||
88 | gulp.task('watch', function() { | 88 | gulp.task('watch', function() { |
89 | gulp.watch([paths.srcJS, paths.srcViews], ['uglify']); | 89 | gulp.watch([paths.srcJS, paths.srcViews], ['uglify']); |
90 | }); | 90 | }); |
91 | 91 | ||
92 | gulp.task('copy', ['uglify'], function() { | 92 | gulp.task('copy', ['uglify'], function() { |
93 | return gulp.src('dist/*.js') | 93 | return gulp.src('dist/*.js') |
94 | .pipe(gulp.dest('../../wrapper-demo/node_modules/foca-crear-remito/dist/')); | 94 | .pipe(gulp.dest('../../wrapper-demo/node_modules/foca-crear-remito/dist/')); |
95 | }); | 95 | }); |
96 | 96 | ||
97 | gulp.task('watchAndCopy', function() { | 97 | gulp.task('watchAndCopy', function() { |
98 | return gulp.watch([paths.srcJS, paths.srcViews], ['copy']); | 98 | return gulp.watch([paths.srcJS, paths.srcViews], ['copy']); |
99 | }); | 99 | }); |
100 | 100 |
index.html
1 | <html ng-app="focaCrearRemito"> | 1 | <html ng-app="focaCrearRemito"> |
2 | <head> | 2 | <head> |
3 | <meta charset="UTF-8"/> | 3 | <meta charset="UTF-8"/> |
4 | <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | 4 | <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> |
5 | 5 | ||
6 | <!--CSS--> | 6 | <!--CSS--> |
7 | <link href="node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"/> | 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"/> | 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"> | 9 | <link href="node_modules/ladda/dist/ladda-themeless.min.css" rel="stylesheet"> |
10 | 10 | ||
11 | <!--VENDOR JS--> | 11 | <!--VENDOR JS--> |
12 | <script src="node_modules/jquery/dist/jquery.min.js"></script> | 12 | <script src="node_modules/jquery/dist/jquery.min.js"></script> |
13 | <script src="node_modules/bootstrap/dist/js/bootstrap.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> | 14 | <script src="node_modules/angular/angular.min.js"></script> |
15 | <script src="node_modules/angular-route/angular-route.min.js"></script> | 15 | <script src="node_modules/angular-route/angular-route.min.js"></script> |
16 | <script src="node_modules/angular-cookies/angular-cookies.min.js"></script> | 16 | <script src="node_modules/angular-cookies/angular-cookies.min.js"></script> |
17 | <script src="node_modules/ui-bootstrap4/dist/ui-bootstrap-tpls.js"></script> | 17 | <script src="node_modules/ui-bootstrap4/dist/ui-bootstrap-tpls.js"></script> |
18 | <script src="node_modules/ladda/dist/spin.min.js"></script> | 18 | <script src="node_modules/ladda/dist/spin.min.js"></script> |
19 | <script src="node_modules/ladda/dist/ladda.min.js"></script> | 19 | <script src="node_modules/ladda/dist/ladda.min.js"></script> |
20 | <script src="node_modules/angular-ladda/dist/angular-ladda.min.js"></script> | 20 | <script src="node_modules/angular-ladda/dist/angular-ladda.min.js"></script> |
21 | <script src="vendor/cordovaGeolocationModule.min.js"></script> | 21 | <script src="vendor/cordovaGeolocationModule.min.js"></script> |
22 | 22 | ||
23 | <script src="node_modules/foca-directivas/dist/foca-directivas.min.js"></script> | 23 | <script src="node_modules/foca-directivas/dist/foca-directivas.min.js"></script> |
24 | <script src="node_modules/foca-modal-vendedores/dist/foca-modal-vendedores.min.js"></script> | 24 | <script src="node_modules/foca-modal-vendedores/dist/foca-modal-vendedores.min.js"></script> |
25 | <script src="node_modules/foca-modal-busqueda-productos/dist/foca-busqueda-productos.min.js"></script> | 25 | <script src="node_modules/foca-modal-busqueda-productos/dist/foca-busqueda-productos.min.js"></script> |
26 | <script src="node_modules/foca-modal-proveedor/dist/foca-modal-proveedor.min.js"></script> | 26 | <script src="node_modules/foca-modal-proveedor/dist/foca-modal-proveedor.min.js"></script> |
27 | <script src="node_modules/foca-busqueda-cliente/dist/foca-busqueda-cliente.min.js"></script> | 27 | <script src="node_modules/foca-busqueda-cliente/dist/foca-busqueda-cliente.min.js"></script> |
28 | <script src="node_modules/foca-modal-precio-condiciones/dist/foca-modal-precio-condiciones.min.js"></script> | 28 | <script src="node_modules/foca-modal-precio-condiciones/dist/foca-modal-precio-condiciones.min.js"></script> |
29 | <script src="node_modules/foca-modal-flete/dist/foca-modal-flete.min.js"></script> | 29 | <script src="node_modules/foca-modal-flete/dist/foca-modal-flete.min.js"></script> |
30 | <script src="node_modules/foca-modal/dist/foca-modal.min.js"></script> | 30 | <script src="node_modules/foca-modal/dist/foca-modal.min.js"></script> |
31 | <script src="node_modules/foca-modal-domicilio/dist/foca-modal-domicilios.min.js"></script> | 31 | <script src="node_modules/foca-modal-domicilio/dist/foca-modal-domicilios.min.js"></script> |
32 | <script src="./node_modules/foca-configuracion/dist/foca-configuracion.min.js"></script> | 32 | <script src="./node_modules/foca-configuracion/dist/foca-configuracion.min.js"></script> |
33 | <script src="node_modules/foca-modal-moneda/dist/foca-modal-moneda.min.js"></script> | 33 | <script src="node_modules/foca-modal-moneda/dist/foca-modal-moneda.min.js"></script> |
34 | <script src="node_modules/foca-modal-cotizacion/dist/foca-modal-cotizacion.min.js"></script> | 34 | <script src="node_modules/foca-modal-cotizacion/dist/foca-modal-cotizacion.min.js"></script> |
35 | <script src="node_modules/foca-seguimiento/dist/foca-seguimiento.min.js"></script> | 35 | <script src="node_modules/foca-seguimiento/dist/foca-seguimiento.min.js"></script> |
36 | <script src="node_modules/foca-modal-nota-pedido/dist/foca-modal-nota-pedido.min.js"></script> | ||
36 | 37 | ||
37 | <script src="src/js/app.js"></script> | 38 | <script src="src/js/app.js"></script> |
38 | <script src="src/js/controller.js"></script> | 39 | <script src="src/js/controller.js"></script> |
39 | <script src="src/js/service.js"></script> | 40 | <script src="src/js/service.js"></script> |
40 | <script src="src/js/businessService.js"></script> | 41 | <script src="src/js/businessService.js"></script> |
41 | <script src="src/js/route.js"></script> | 42 | <script src="src/js/route.js"></script> |
42 | 43 | ||
43 | <script src="src/etc/develop.js"></script> | 44 | <script src="src/etc/develop.js"></script> |
44 | </head> | 45 | </head> |
45 | <body> | 46 | <body> |
46 | <div ng-view class="container-fluid"></div> | 47 | <div ng-view class="container-fluid"></div> |
47 | </body> | 48 | </body> |
48 | </html> | 49 | </html> |
49 | 50 |
package.json
1 | { | 1 | { |
2 | "name": "foca-crear-remito", | 2 | "name": "foca-crear-remito", |
3 | "version": "0.0.1", | 3 | "version": "0.0.1", |
4 | "description": "Listado y ABM nota de remitos", | 4 | "description": "Listado y ABM nota de remitos", |
5 | "main": "index.js", | 5 | "main": "index.js", |
6 | "scripts": { | 6 | "scripts": { |
7 | "test": "echo \"Error: no test specified\" && exit 1", | 7 | "test": "echo \"Error: no test specified\" && exit 1", |
8 | "compile": "gulp uglify", | 8 | "compile": "gulp uglify", |
9 | "gulp-pre-commit": "gulp pre-commit", | 9 | "gulp-pre-commit": "gulp pre-commit", |
10 | "postinstall": "npm run compile && gulp clean-post-install", | 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 angular-cookies 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+https://debo.suite.repo/modulos-npm/foca-directivas.git git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git git+https://debo.suite.repo/modulos-npm/foca-modal-proveedor.git git+https://debo.suite.repo/modulos-npm/foca-modal-busqueda-productos git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git git+https://debo.suite.repo/modulos-npm/foca-modal-precio-condiciones.git git+https://debo.suite.repo/modulos-npm/foca-modal-flete git+https://debo.suite.repo/modulos-npm/foca-modal.git git+https://debo.suite.repo/modulos-npm/foca-modal-domicilio.git git+https://debo.suite.repo/modulos-npm/foca-seguimiento.git git+https://debo.suite.repo/modulos-npm/foca-modal-moneda.git git+https://debo.suite.repo/modulos-npm/foca-modal-cotizacion.git git+https://debo.suite.repo/modulos-npm/foca-configuracion.git" | 11 | "install-dev": "npm install -D jasmine-core pre-commit angular angular-ladda ladda@1.0.6 angular-route angular-cookies 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+https://debo.suite.repo/modulos-npm/foca-directivas.git git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git git+https://debo.suite.repo/modulos-npm/foca-modal-proveedor.git git+https://debo.suite.repo/modulos-npm/foca-modal-busqueda-productos git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git git+https://debo.suite.repo/modulos-npm/foca-modal-precio-condiciones.git git+https://debo.suite.repo/modulos-npm/foca-modal-flete git+https://debo.suite.repo/modulos-npm/foca-modal.git git+https://debo.suite.repo/modulos-npm/foca-modal-domicilio.git git+https://debo.suite.repo/modulos-npm/foca-seguimiento.git git+https://debo.suite.repo/modulos-npm/foca-modal-moneda.git git+https://debo.suite.repo/modulos-npm/foca-modal-cotizacion.git git+https://debo.suite.repo/modulos-npm/foca-configuracion.git" |
12 | }, | 12 | }, |
13 | "pre-commit": [ | 13 | "pre-commit": [ |
14 | "gulp-pre-commit" | 14 | "gulp-pre-commit" |
15 | ], | 15 | ], |
16 | "repository": { | 16 | "repository": { |
17 | "type": "git", | 17 | "type": "git", |
18 | "url": "https://debo.suite.repo/modulos-npm/foca-crear-remito.git" | 18 | "url": "https://debo.suite.repo/modulos-npm/foca-crear-remito.git" |
19 | }, | 19 | }, |
20 | "author": "Foca Software", | 20 | "author": "Foca Software", |
21 | "license": "ISC", | 21 | "license": "ISC", |
22 | "peerDependencies": { | 22 | "peerDependencies": { |
23 | "foca-busqueda-cliente": "git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git", | 23 | "foca-busqueda-cliente": "git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git", |
24 | "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git", | 24 | "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git", |
25 | "foca-modal-busqueda-productos": "git+https://debo.suite.repo/modulos-npm/foca-modal-busqueda-productos", | 25 | "foca-modal-busqueda-productos": "git+https://debo.suite.repo/modulos-npm/foca-modal-busqueda-productos", |
26 | "foca-modal-proveedor": "git+https://debo.suite.repo/modulos-npm/foca-modal-proveedor.git", | 26 | "foca-modal-proveedor": "git+https://debo.suite.repo/modulos-npm/foca-modal-proveedor.git", |
27 | "foca-modal-vendedores": "git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git", | 27 | "foca-modal-vendedores": "git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git", |
28 | "foca-seguimiento": "git+https://debo.suite.repo/modulos-npm/foca-seguimiento.git" | 28 | "foca-seguimiento": "git+https://debo.suite.repo/modulos-npm/foca-seguimiento.git" |
29 | }, | 29 | }, |
30 | "devDependencies": { | 30 | "devDependencies": { |
31 | "angular": "^1.7.5", | 31 | "angular": "^1.7.5", |
32 | "angular-cookies": "^1.7.5", | ||
32 | "angular-ladda": "^0.4.3", | 33 | "angular-ladda": "^0.4.3", |
33 | "angular-route": "^1.7.5", | 34 | "angular-route": "^1.7.5", |
34 | "bootstrap": "^4.1.3", | 35 | "bootstrap": "^4.1.3", |
35 | "foca-busqueda-cliente": "git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git", | 36 | "foca-busqueda-cliente": "git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git", |
37 | "foca-configuracion": "git+https://debo.suite.repo/modulos-npm/foca-configuracion.git", | ||
36 | "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git", | 38 | "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git", |
37 | "foca-modal": "git+https://debo.suite.repo/modulos-npm/foca-modal.git", | 39 | "foca-modal": "git+https://debo.suite.repo/modulos-npm/foca-modal.git", |
38 | "foca-modal-busqueda-productos": "git+https://debo.suite.repo/modulos-npm/foca-modal-busqueda-productos", | 40 | "foca-modal-busqueda-productos": "git+https://debo.suite.repo/modulos-npm/foca-modal-busqueda-productos", |
39 | "foca-modal-cotizacion": "git+https://debo.suite.repo/modulos-npm/foca-modal-cotizacion.git", | 41 | "foca-modal-cotizacion": "git+https://debo.suite.repo/modulos-npm/foca-modal-cotizacion.git", |
40 | "foca-modal-domicilio": "git+https://debo.suite.repo/modulos-npm/foca-modal-domicilio.git", | 42 | "foca-modal-domicilio": "git+https://debo.suite.repo/modulos-npm/foca-modal-domicilio.git", |
41 | "foca-modal-flete": "git+https://debo.suite.repo/modulos-npm/foca-modal-flete", | 43 | "foca-modal-flete": "git+https://debo.suite.repo/modulos-npm/foca-modal-flete", |
42 | "foca-modal-moneda": "git+https://debo.suite.repo/modulos-npm/foca-modal-moneda.git", | 44 | "foca-modal-moneda": "git+https://debo.suite.repo/modulos-npm/foca-modal-moneda.git", |
43 | "foca-modal-precio-condiciones": "git+https://debo.suite.repo/modulos-npm/foca-modal-precio-condiciones.git", | 45 | "foca-modal-precio-condiciones": "git+https://debo.suite.repo/modulos-npm/foca-modal-precio-condiciones.git", |
44 | "foca-modal-proveedor": "git+https://debo.suite.repo/modulos-npm/foca-modal-proveedor.git", | 46 | "foca-modal-proveedor": "git+https://debo.suite.repo/modulos-npm/foca-modal-proveedor.git", |
45 | "foca-modal-vendedores": "git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git", | 47 | "foca-modal-vendedores": "git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git", |
46 | "foca-seguimiento": "git+https://debo.suite.repo/modulos-npm/foca-seguimiento.git", | 48 | "foca-seguimiento": "git+https://debo.suite.repo/modulos-npm/foca-seguimiento.git", |
47 | "font-awesome": "^4.7.0", | 49 | "font-awesome": "^4.7.0", |
48 | "gulp": "^3.9.1", | 50 | "gulp": "^3.9.1", |
49 | "gulp-angular-templatecache": "^2.2.2", | 51 | "gulp-angular-templatecache": "^2.2.5", |
50 | "gulp-clean": "^0.4.0", | 52 | "gulp-clean": "^0.4.0", |
51 | "gulp-concat": "^2.6.1", | 53 | "gulp-concat": "^2.6.1", |
52 | "gulp-connect": "^5.6.1", | 54 | "gulp-connect": "^5.6.1", |
53 | "gulp-htmlmin": "^5.0.1", | 55 | "gulp-htmlmin": "^5.0.1", |
54 | "gulp-jshint": "^2.1.0", | 56 | "gulp-jshint": "^2.1.0", |
55 | "gulp-rename": "^1.4.0", | 57 | "gulp-rename": "^1.4.0", |
56 | "gulp-replace": "^1.0.0", | 58 | "gulp-replace": "^1.0.0", |
57 | "gulp-sequence": "^1.0.0", | 59 | "gulp-sequence": "^1.0.0", |
58 | "gulp-uglify": "^3.0.1", | 60 | "gulp-uglify": "^3.0.1", |
59 | "gulp-uglify-es": "^1.0.4", | 61 | "gulp-uglify-es": "^1.0.4", |
60 | "jasmine-core": "^3.3.0", | 62 | "jasmine-core": "^3.3.0", |
61 | "jquery": "^3.3.1", | 63 | "jquery": "^3.3.1", |
62 | "jshint": "^2.9.6", | 64 | "jshint": "^2.9.6", |
63 | "ladda": "1.0.6", | 65 | "ladda": "1.0.6", |
64 | "pre-commit": "^1.2.2", | 66 | "pre-commit": "^1.2.2", |
65 | "pump": "^3.0.0", | 67 | "pump": "^3.0.0", |
66 | "ui-bootstrap4": "^3.0.5", | 68 | "ui-bootstrap4": "^3.0.5" |
67 | "angular-cookies": "^1.7.5", | ||
68 | "foca-configuracion": "git+https://debo.suite.repo/modulos-npm/foca-configuracion.git" | ||
69 | } | 69 | } |
src/js/app.js
1 | angular.module('focaCrearRemito', [ | 1 | angular.module('focaCrearRemito', [ |
2 | 'ngRoute', | 2 | 'ngRoute', |
3 | 'ngCookies', | 3 | 'ngCookies', |
4 | 'ui.bootstrap', | 4 | 'ui.bootstrap', |
5 | 'focaModalVendedores', | 5 | 'focaModalVendedores', |
6 | 'focaBusquedaProductos', | 6 | 'focaBusquedaProductos', |
7 | 'focaModalProveedor', | 7 | 'focaModalProveedor', |
8 | 'focaBusquedaCliente', | 8 | 'focaBusquedaCliente', |
9 | 'focaModalPrecioCondicion', | 9 | 'focaModalPrecioCondicion', |
10 | 'focaModalFlete', | 10 | 'focaModalFlete', |
11 | 'focaDirectivas', | 11 | 'focaDirectivas', |
12 | 'focaModal', | 12 | 'focaModal', |
13 | 'focaModalDomicilio', | 13 | 'focaModalDomicilio', |
14 | 'focaModalMoneda', | 14 | 'focaModalMoneda', |
15 | 'focaModalCotizacion', | 15 | 'focaModalCotizacion', |
16 | 'focaConfiguracion', | 16 | 'focaConfiguracion', |
17 | 'angular-ladda' | 17 | 'angular-ladda', |
18 | 'focaModalNotaPedido' | ||
18 | ]); | 19 | ]); |
19 | 20 |
src/js/controller.js
1 | angular.module('focaCrearRemito') .controller('remitoController', | 1 | angular.module('focaCrearRemito') .controller('remitoController', |
2 | [ | 2 | [ |
3 | '$scope', '$uibModal', '$location', '$filter', 'crearRemitoService', | 3 | '$scope', '$uibModal', '$location', '$filter', 'crearRemitoService', |
4 | 'focaModalService', 'remitoBusinessService', | 4 | 'focaModalService', 'remitoBusinessService', |
5 | function( | 5 | function( |
6 | $scope, $uibModal, $location, $filter, crearRemitoService, focaModalService, | 6 | $scope, $uibModal, $location, $filter, crearRemitoService, focaModalService, |
7 | remitoBusinessService | 7 | remitoBusinessService |
8 | ) { | 8 | ) { |
9 | $scope.botonera = [ | 9 | $scope.botonera = [ |
10 | {texto: 'Nota Pedido', accion: function() {$scope.seleccionarNotaPedido();}}, | 10 | {texto: 'Nota Pedido', accion: function() {$scope.seleccionarNotaPedido();}}, |
11 | {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}}, | 11 | {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}}, |
12 | {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}}, | 12 | {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}}, |
13 | {texto: 'Proveedor', accion: function() {$scope.seleccionarProveedor();}}, | 13 | {texto: 'Proveedor', accion: function() {$scope.seleccionarProveedor();}}, |
14 | {texto: 'Moneda', accion: function() {$scope.abrirModalMoneda();}}, | 14 | {texto: 'Moneda', accion: function() {$scope.abrirModalMoneda();}}, |
15 | { | 15 | { |
16 | texto: 'Precios y condiciones', | 16 | texto: 'Precios y condiciones', |
17 | accion: function() {$scope.abrirModalListaPrecio();}}, | 17 | accion: function() {$scope.abrirModalListaPrecio();}}, |
18 | {texto: 'Flete', accion: function() {$scope.abrirModalFlete();}}, | 18 | {texto: 'Flete', accion: function() {$scope.abrirModalFlete();}}, |
19 | {texto: '', accion: function() {}} | 19 | {texto: '', accion: function() {}} |
20 | ]; | 20 | ]; |
21 | $scope.datepickerAbierto = false; | 21 | $scope.datepickerAbierto = false; |
22 | 22 | ||
23 | $scope.show = false; | 23 | $scope.show = false; |
24 | $scope.cargando = true; | 24 | $scope.cargando = true; |
25 | $scope.dateOptions = { | 25 | $scope.dateOptions = { |
26 | maxDate: new Date(), | 26 | maxDate: new Date(), |
27 | minDate: new Date(2010, 0, 1) | 27 | minDate: new Date(2010, 0, 1) |
28 | }; | 28 | }; |
29 | 29 | ||
30 | $scope.remito = { | 30 | $scope.remito = { |
31 | vendedor: {}, | 31 | vendedor: {}, |
32 | cliente: {}, | 32 | cliente: {}, |
33 | proveedor: {}, | 33 | proveedor: {}, |
34 | domicilio: {dom: ''}, | 34 | domicilio: {dom: ''}, |
35 | moneda: {}, | 35 | moneda: {}, |
36 | cotizacion: {} | 36 | cotizacion: {} |
37 | }; | 37 | }; |
38 | var monedaPorDefecto; | 38 | var monedaPorDefecto; |
39 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' | 39 | //Trabajo con la cotización más reciente, por eso uso siempre la primera '[0]' |
40 | crearRemitoService.getCotizacionByIdMoneda(1).then(function(res) { | 40 | crearRemitoService.getCotizacionByIdMoneda(1).then(function(res) { |
41 | monedaPorDefecto = { | 41 | monedaPorDefecto = { |
42 | id: res.data[0].ID, | 42 | id: res.data[0].ID, |
43 | detalle: res.data[0].DETALLE, | 43 | detalle: res.data[0].DETALLE, |
44 | simbolo: res.data[0].SIMBOLO, | 44 | simbolo: res.data[0].SIMBOLO, |
45 | cotizaciones: res.data[0].cotizaciones | 45 | cotizaciones: res.data[0].cotizaciones |
46 | }; | 46 | }; |
47 | addCabecera('Moneda:', monedaPorDefecto.detalle); | 47 | addCabecera('Moneda:', monedaPorDefecto.detalle); |
48 | addCabecera('Fecha cotizacion:', | 48 | addCabecera('Fecha cotizacion:', |
49 | new Date(monedaPorDefecto.cotizaciones[0].FECHA).toLocaleDateString()); | 49 | new Date(monedaPorDefecto.cotizaciones[0].FECHA).toLocaleDateString()); |
50 | addCabecera('Cotizacion:', monedaPorDefecto.cotizaciones[0].COTIZACION); | 50 | addCabecera('Cotizacion:', monedaPorDefecto.cotizaciones[0].COTIZACION); |
51 | $scope.remito.moneda = monedaPorDefecto; | 51 | $scope.remito.moneda = monedaPorDefecto; |
52 | $scope.remito.cotizacion = monedaPorDefecto.cotizaciones[0]; | 52 | $scope.remito.cotizacion = monedaPorDefecto.cotizaciones[0]; |
53 | }); | 53 | }); |
54 | 54 | ||
55 | $scope.cabecera = []; | 55 | $scope.cabecera = []; |
56 | $scope.showCabecera = true; | 56 | $scope.showCabecera = true; |
57 | 57 | ||
58 | $scope.now = new Date(); | 58 | $scope.now = new Date(); |
59 | $scope.puntoVenta = Math.round(Math.random() * 10000); | 59 | $scope.puntoVenta = Math.round(Math.random() * 10000); |
60 | $scope.comprobante = Math.round(Math.random() * 1000000); | 60 | $scope.comprobante = Math.round(Math.random() * 1000000); |
61 | 61 | ||
62 | $scope.articulosTabla = []; | 62 | $scope.articulosTabla = []; |
63 | $scope.idLista = undefined; | 63 | $scope.idLista = undefined; |
64 | //La pantalla solo se usa para cargar remitos | 64 | //La pantalla solo se usa para cargar remitos |
65 | //var remitoTemp = crearRemitoService.getRemito(); | 65 | //var remitoTemp = crearRemitoService.getRemito(); |
66 | 66 | ||
67 | crearRemitoService.getPrecioCondicion().then( | 67 | crearRemitoService.getPrecioCondicion().then( |
68 | function(res) { | 68 | function(res) { |
69 | $scope.precioCondiciones = res.data; | 69 | $scope.precioCondiciones = res.data; |
70 | } | 70 | } |
71 | ); | 71 | ); |
72 | 72 | ||
73 | crearRemitoService.getNumeroRemito().then( | 73 | crearRemitoService.getNumeroRemito().then( |
74 | function(res) { | 74 | function(res) { |
75 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); | 75 | $scope.puntoVenta = rellenar(res.data.sucursal, 4); |
76 | $scope.comprobante = rellenar(res.data.numeroNotaPedido, 8); | 76 | $scope.comprobante = rellenar(res.data.numeroNotaPedido, 8); |
77 | }, | 77 | }, |
78 | function(err) { | 78 | function(err) { |
79 | focaModalService.alert('La terminal no esta configurada correctamente'); | 79 | focaModalService.alert('La terminal no esta configurada correctamente'); |
80 | console.info(err); | 80 | console.info(err); |
81 | } | 81 | } |
82 | ); | 82 | ); |
83 | 83 | ||
84 | $scope.seleccionarNotaPedido = function() { | 84 | $scope.seleccionarNotaPedido = function() { |
85 | var modalInstance = $uibModal.open( | 85 | var modalInstance = $uibModal.open( |
86 | { | 86 | { |
87 | ariaLabelledBy: 'Busqueda de Nota de Pedido', | 87 | ariaLabelledBy: 'Busqueda de Nota de Pedido', |
88 | templateUrl: 'foca-modal-nota-pedido.html', | 88 | templateUrl: 'foca-modal-nota-pedido.html', |
89 | controller: 'focaModalNotaPedidoController', | 89 | controller: 'focaModalNotaPedidoController', |
90 | resolve: { | ||
91 | parametroNotaPedido: { | ||
92 | idLista: $scope.idLista, | ||
93 | cotizacion: $scope.remito.cotizacion.COTIZACION, | ||
94 | simbolo: $scope.remito.moneda.simbolo | ||
95 | } | ||
96 | }, | ||
97 | size: 'lg' | 90 | size: 'lg' |
98 | } | 91 | } |
99 | ); | 92 | ); |
100 | modalInstance.result.then( | 93 | modalInstance.result.then( |
101 | function(producto) { | 94 | function(notaPedido) { |
102 | var newArt = | 95 | //añado cabeceras |
103 | { | 96 | removeCabecera('Moneda:'); |
104 | id: 0, | 97 | removeCabecera('Fecha cotizacion:'); |
105 | codigo: producto.codigo, | 98 | removeCabecera('Cotizacion:'); |
106 | sector: producto.sector, | 99 | var cabeceras = [ |
107 | sectorCodigo: producto.sector + '-' + producto.codigo, | 100 | { |
108 | descripcion: producto.descripcion, | 101 | label: 'Moneda', |
109 | item: $scope.articulosTabla.length + 1, | 102 | valor: notaPedido.cotizacion[0].moneda[0].DETALLE |
110 | nombre: producto.descripcion, | 103 | }, |
111 | precio: parseFloat(producto.precio.toFixed(4)), | 104 | { |
112 | costoUnitario: producto.costo, | 105 | label: 'Fecha cotizacion', |
113 | editCantidad: false, | 106 | valor: $filter('date')(notaPedido.cotizacion[0].FECHA, |
114 | editPrecio: false | 107 | 'dd/MM/yyyy') |
115 | }; | 108 | }, |
116 | $scope.articuloACargar = newArt; | 109 | { |
117 | $scope.cargando = false; | 110 | label: 'Cotizacion', |
111 | valor: notaPedido.cotizacion[0].VENDEDOR | ||
112 | }, | ||
113 | { | ||
114 | label: 'Cliente:', | ||
115 | valor: notaPedido.cliente[0].NOM | ||
116 | }, | ||
117 | { | ||
118 | label: 'Vendedor:', | ||
119 | valor: notaPedido.vendedor[0].NomVen | ||
120 | }, | ||
121 | { | ||
122 | label: 'Proveedor:', | ||
123 | valor: notaPedido.proveedor[0].NOM | ||
124 | }, | ||
125 | { | ||
126 | label: 'Flete:', | ||
127 | valor: notaPedido.flete === 1 ? 'Si' : 'No' | ||
128 | }, | ||
129 | { | ||
130 | label: 'FOB:', | ||
131 | valor: notaPedido.fob === 1 ? 'Si' : 'No' | ||
132 | }, | ||
133 | { | ||
134 | label: 'Precio condicion:', | ||
135 | valor: valorPrecioCondicion() | ||
136 | } | ||
137 | ]; | ||
138 | //TO DO CUANDO MOSTRAR PLAZOS | ||
139 | function valorPrecioCondicion() { | ||
140 | if(notaPedido.idPrecioCondicion > 0) { | ||
141 | return notaPedido.precioCondicion[0].nombre; | ||
142 | } else { | ||
143 | return 'Ingreso Manual'; | ||
144 | } | ||
145 | |||
146 | } | ||
147 | |||
148 | if(notaPedido.flete === 1) { | ||
149 | var cabeceraBomba = { | ||
150 | label: 'Bomba', | ||
151 | valor: notaPedido.bomba === 1 ? 'Si' : 'No' | ||
152 | }; | ||
153 | if(notaPedido.kilometros) { | ||
154 | var cabeceraKilometros = { | ||
155 | label: 'Kilometros', | ||
156 | valor: notaPedido.kilometros | ||
157 | }; | ||
158 | cabeceras.push(cabeceraKilometros); | ||
159 | } | ||
160 | cabeceras.push(cabeceraBomba); | ||
161 | } | ||
162 | $scope.articulosTabla = notaPedido.articulosNotaPedido; | ||
163 | $scope.remito = notaPedido; | ||
164 | addArrayCabecera(cabeceras); | ||
165 | |||
118 | }, function() { | 166 | }, function() { |
119 | // funcion ejecutada cuando se cancela el modal | 167 | // funcion ejecutada cuando se cancela el modal |
120 | } | 168 | } |
121 | ); | 169 | ); |
122 | }; | 170 | }; |
123 | 171 | ||
124 | $scope.seleccionarRemito = function() { | 172 | $scope.seleccionarRemito = function() { |
125 | var modalInstance = $uibModal.open( | 173 | var modalInstance = $uibModal.open( |
126 | { | 174 | { |
127 | ariaLabelledBy: 'Busqueda de Remito', | 175 | ariaLabelledBy: 'Busqueda de Remito', |
128 | templateUrl: 'foca-modal-remito.html', | 176 | templateUrl: 'foca-modal-remito.html', |
129 | controller: 'focaModalRemitoController', | 177 | controller: 'focaModalRemitoController', |
130 | resolve: { | ||
131 | parametroRemito: { | ||
132 | idLista: $scope.idLista, | ||
133 | cotizacion: $scope.remito.cotizacion.COTIZACION, | ||
134 | simbolo: $scope.remito.moneda.simbolo | ||
135 | } | ||
136 | }, | ||
137 | size: 'lg' | 178 | size: 'lg' |
138 | } | 179 | } |
139 | ); | 180 | ); |
140 | modalInstance.result.then( | 181 | modalInstance.result.then( |
141 | function(producto) { | 182 | function() { |
142 | var newArt = | 183 | // TODO: Implementar carga remito |
143 | { | ||
144 | id: 0, | ||
145 | codigo: producto.codigo, | ||
146 | sector: producto.sector, | ||
147 | sectorCodigo: producto.sector + '-' + producto.codigo, | ||
148 | descripcion: producto.descripcion, | ||
149 | item: $scope.articulosTabla.length + 1, | ||
150 | nombre: producto.descripcion, | ||
151 | precio: parseFloat(producto.precio.toFixed(4)), | ||
152 | costoUnitario: producto.costo, | ||
153 | editCantidad: false, | ||
154 | editPrecio: false | ||
155 | }; | ||
156 | $scope.articuloACargar = newArt; | ||
157 | $scope.cargando = false; | ||
158 | }, function() { | 184 | }, function() { |
159 | // funcion ejecutada cuando se cancela el modal | 185 | // funcion ejecutada cuando se cancela el modal |
160 | } | 186 | } |
161 | ); | 187 | ); |
162 | }; | 188 | }; |
163 | 189 | ||
164 | //La pantalla solo se usa para cargar remitos | 190 | //La pantalla solo se usa para cargar remitos |
165 | // if (remitoTemp !== undefined) { | 191 | // if (remitoTemp !== undefined) { |
166 | // remitoTemp.fechaCarga = new Date(remitoTemp.fechaCarga); | 192 | // remitoTemp.fechaCarga = new Date(remitoTemp.fechaCarga); |
167 | // $scope.remito = remitoTemp; | 193 | // $scope.remito = remitoTemp; |
168 | // $scope.remito.flete = ($scope.remito.flete).toString(); | 194 | // $scope.remito.flete = ($scope.remito.flete).toString(); |
169 | // $scope.remito.bomba = ($scope.remito.bomba).toString(); | 195 | // $scope.remito.bomba = ($scope.remito.bomba).toString(); |
170 | // $scope.idLista = $scope.remito.precioCondicion; | 196 | // $scope.idLista = $scope.remito.precioCondicion; |
171 | // crearRemitoService | 197 | // crearRemitoService |
172 | // .getArticulosByIdRemito($scope.remito.id).then( | 198 | // .getArticulosByIdRemito($scope.remito.id).then( |
173 | // function(res) { | 199 | // function(res) { |
174 | // $scope.articulosTabla = res.data; | 200 | // $scope.articulosTabla = res.data; |
175 | // } | 201 | // } |
176 | // ); | 202 | // ); |
177 | //TODO DOMICILIOS QUE SE CARGAN AL EDITAR REMITO | 203 | //TODO DOMICILIOS QUE SE CARGAN AL EDITAR REMITO |
178 | //(NO REQUERIDO EN ESTA VERSION) | 204 | //(NO REQUERIDO EN ESTA VERSION) |
179 | // crearRemitoService.getDomiciliosByIdRemito($scope.remito.id).then( | 205 | // crearRemitoService.getDomiciliosByIdRemito($scope.remito.id).then( |
180 | // function(res) { | 206 | // function(res) { |
181 | // $scope.remito.domicilio = res.data; | 207 | // $scope.remito.domicilio = res.data; |
182 | // } | 208 | // } |
183 | // ); | 209 | // ); |
184 | // } else { | 210 | // } else { |
185 | // $scope.remito.fechaCarga = new Date(); | 211 | // $scope.remito.fechaCarga = new Date(); |
186 | // $scope.remito.bomba = '0'; | 212 | // $scope.remito.bomba = '0'; |
187 | // $scope.remito.flete = '0'; | 213 | // $scope.remito.flete = '0'; |
188 | // $scope.idLista = undefined; | 214 | // $scope.idLista = undefined; |
189 | // } | 215 | // } |
190 | //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO | 216 | //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO |
191 | // $scope.addNewDom = function() { | 217 | // $scope.addNewDom = function() { |
192 | // $scope.remito.domicilio.push({ 'id': 0 }); | 218 | // $scope.remito.domicilio.push({ 'id': 0 }); |
193 | // }; | 219 | // }; |
194 | // $scope.removeNewChoice = function(choice) { | 220 | // $scope.removeNewChoice = function(choice) { |
195 | // if ($scope.remito.domicilio.length > 1) { | 221 | // if ($scope.remito.domicilio.length > 1) { |
196 | // $scope.remito.domicilio.splice($scope.remito.domicilio.findIndex( | 222 | // $scope.remito.domicilio.splice($scope.remito.domicilio.findIndex( |
197 | // function(c) { | 223 | // function(c) { |
198 | // return c.$$hashKey === choice.$$hashKey; | 224 | // return c.$$hashKey === choice.$$hashKey; |
199 | // } | 225 | // } |
200 | // ), 1); | 226 | // ), 1); |
201 | // } | 227 | // } |
202 | // }; | 228 | // }; |
203 | 229 | ||
204 | $scope.crearRemito = function() { | 230 | $scope.crearRemito = function() { |
205 | if(!$scope.remito.vendedor.codigo) { | 231 | if(!$scope.remito.vendedor.codigo) { |
206 | focaModalService.alert('Ingrese Vendedor'); | 232 | focaModalService.alert('Ingrese Vendedor'); |
207 | return; | 233 | return; |
208 | } else if(!$scope.remito.cliente.cod) { | 234 | } else if(!$scope.remito.cliente.cod) { |
209 | focaModalService.alert('Ingrese Cliente'); | 235 | focaModalService.alert('Ingrese Cliente'); |
210 | return; | 236 | return; |
211 | } else if(!$scope.remito.proveedor.codigo) { | 237 | } else if(!$scope.remito.proveedor.codigo) { |
212 | focaModalService.alert('Ingrese Proveedor'); | 238 | focaModalService.alert('Ingrese Proveedor'); |
213 | return; | 239 | return; |
214 | } else if(!$scope.remito.moneda.id) { | 240 | } else if(!$scope.remito.moneda.id) { |
215 | focaModalService.alert('Ingrese Moneda'); | 241 | focaModalService.alert('Ingrese Moneda'); |
216 | return; | 242 | return; |
217 | } else if(!$scope.remito.cotizacion.ID) { | 243 | } else if(!$scope.remito.cotizacion.ID) { |
218 | focaModalService.alert('Ingrese Cotización'); | 244 | focaModalService.alert('Ingrese Cotización'); |
219 | return; | 245 | return; |
220 | } else if(!$scope.plazosPagos) { | 246 | } else if(!$scope.plazosPagos) { |
221 | focaModalService.alert('Ingrese Precios y Condiciones'); | 247 | focaModalService.alert('Ingrese Precios y Condiciones'); |
222 | return; | 248 | return; |
223 | } else if( | 249 | } else if( |
224 | $scope.remito.flete === undefined || $scope.remito.flete === null) | 250 | $scope.remito.flete === undefined || $scope.remito.flete === null) |
225 | { | 251 | { |
226 | focaModalService.alert('Ingrese Flete'); | 252 | focaModalService.alert('Ingrese Flete'); |
227 | return; | 253 | return; |
228 | } else if(!$scope.remito.domicilio.id) { | 254 | } else if(!$scope.remito.domicilio.id) { |
229 | focaModalService.alert('Ingrese Domicilio'); | 255 | focaModalService.alert('Ingrese Domicilio'); |
230 | return; | 256 | return; |
231 | } else if($scope.articulosTabla.length === 0) { | 257 | } else if($scope.articulosTabla.length === 0) { |
232 | focaModalService.alert('Debe cargar al menos un articulo'); | 258 | focaModalService.alert('Debe cargar al menos un articulo'); |
233 | return; | 259 | return; |
234 | } | 260 | } |
235 | var date = new Date(); | 261 | var date = new Date(); |
236 | var remito = { | 262 | var remito = { |
237 | id: 0, | 263 | id: 0, |
238 | fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) | 264 | fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) |
239 | .toISOString().slice(0, 19).replace('T', ' '), | 265 | .toISOString().slice(0, 19).replace('T', ' '), |
240 | idVendedor: $scope.remito.vendedor.codigo, | 266 | idVendedor: $scope.remito.vendedor.codigo, |
241 | idCliente: $scope.remito.cliente.cod, | 267 | idCliente: $scope.remito.cliente.cod, |
242 | nombreCliente: $scope.remito.cliente.nom, | 268 | nombreCliente: $scope.remito.cliente.nom, |
243 | cuitCliente: $scope.remito.cliente.cuit, | 269 | cuitCliente: $scope.remito.cliente.cuit, |
244 | idProveedor: $scope.remito.proveedor.codigo, | 270 | idProveedor: $scope.remito.proveedor.codigo, |
245 | idDomicilio: $scope.remito.domicilio.id, | 271 | idDomicilio: $scope.remito.domicilio.id, |
246 | idCotizacion: $scope.remito.cotizacion.ID, | 272 | idCotizacion: $scope.remito.cotizacion.ID, |
247 | cotizacion: $scope.remito.cotizacion.COTIZACION, | 273 | cotizacion: $scope.remito.cotizacion.COTIZACION, |
248 | flete: $scope.remito.flete, | 274 | flete: $scope.remito.flete, |
249 | fob: $scope.remito.fob, | 275 | fob: $scope.remito.fob, |
250 | bomba: $scope.remito.bomba, | 276 | bomba: $scope.remito.bomba, |
251 | kilometros: $scope.remito.kilometros, | 277 | kilometros: $scope.remito.kilometros, |
252 | estado: 0, | 278 | estado: 0, |
253 | total: $scope.getTotal() | 279 | total: $scope.getTotal() |
254 | }; | 280 | }; |
255 | crearRemitoService.crearRemito(remito).then( | 281 | crearRemitoService.crearRemito(remito).then( |
256 | function(data) { | 282 | function(data) { |
257 | remitoBusinessService.addArticulos($scope.articulosTabla, | 283 | remitoBusinessService.addArticulos($scope.articulosTabla, |
258 | data.data.id, $scope.remito.cotizacion.COTIZACION); | 284 | data.data.id, $scope.remito.cotizacion.COTIZACION); |
259 | var plazos = $scope.plazosPagos; | 285 | var plazos = $scope.plazosPagos; |
260 | for(var j = 0; j < plazos.length; j++) { | 286 | for(var j = 0; j < plazos.length; j++) { |
261 | var json = { | 287 | var json = { |
262 | idRemito: data.data.id, | 288 | idRemito: data.data.id, |
263 | dias: plazos[j].dias | 289 | dias: plazos[j].dias |
264 | }; | 290 | }; |
265 | crearRemitoService.crearPlazosParaRemito(json); | 291 | crearRemitoService.crearPlazosParaRemito(json); |
266 | } | 292 | } |
267 | remitoBusinessService.addEstado(data.data.id, | 293 | remitoBusinessService.addEstado(data.data.id, |
268 | $scope.remito.vendedor.codigo); | 294 | $scope.remito.vendedor.codigo); |
269 | 295 | ||
270 | focaModalService.alert('Nota remito creada'); | 296 | focaModalService.alert('Nota remito creada'); |
271 | $scope.cabecera = []; | 297 | $scope.cabecera = []; |
272 | addCabecera('Moneda:', $scope.remito.moneda.detalle); | 298 | addCabecera('Moneda:', $scope.remito.moneda.detalle); |
273 | addCabecera( | 299 | addCabecera( |
274 | 'Fecha cotizacion:', | 300 | 'Fecha cotizacion:', |
275 | $filter('date')($scope.remito.cotizacion.FECHA, 'dd/MM/yyyy') | 301 | $filter('date')($scope.remito.cotizacion.FECHA, 'dd/MM/yyyy') |
276 | ); | 302 | ); |
277 | addCabecera('Cotizacion:', $scope.remito.cotizacion.COTIZACION); | 303 | addCabecera('Cotizacion:', $scope.remito.cotizacion.COTIZACION); |
278 | $scope.remito.vendedor = {}; | 304 | $scope.remito.vendedor = {}; |
279 | $scope.remito.cliente = {}; | 305 | $scope.remito.cliente = {}; |
280 | $scope.remito.proveedor = {}; | 306 | $scope.remito.proveedor = {}; |
281 | $scope.remito.domicilio = {}; | 307 | $scope.remito.domicilio = {}; |
282 | $scope.remito.flete = null; | 308 | $scope.remito.flete = null; |
283 | $scope.remito.fob = null; | 309 | $scope.remito.fob = null; |
284 | $scope.remito.bomba = null; | 310 | $scope.remito.bomba = null; |
285 | $scope.remito.kilometros = null; | 311 | $scope.remito.kilometros = null; |
286 | $scope.articulosTabla = []; | 312 | $scope.articulosTabla = []; |
287 | } | 313 | } |
288 | ); | 314 | ); |
289 | }; | 315 | }; |
290 | 316 | ||
291 | $scope.seleccionarArticulo = function() { | 317 | $scope.seleccionarArticulo = function() { |
292 | if ($scope.idLista === undefined) { | 318 | if ($scope.idLista === undefined) { |
293 | focaModalService.alert( | 319 | focaModalService.alert( |
294 | 'Primero seleccione una lista de precio y condicion'); | 320 | 'Primero seleccione una lista de precio y condicion'); |
295 | return; | 321 | return; |
296 | } | 322 | } |
297 | var modalInstance = $uibModal.open( | 323 | var modalInstance = $uibModal.open( |
298 | { | 324 | { |
299 | ariaLabelledBy: 'Busqueda de Productos', | 325 | ariaLabelledBy: 'Busqueda de Productos', |
300 | templateUrl: 'modal-busqueda-productos.html', | 326 | templateUrl: 'modal-busqueda-productos.html', |
301 | controller: 'modalBusquedaProductosCtrl', | 327 | controller: 'modalBusquedaProductosCtrl', |
302 | resolve: { | 328 | resolve: { |
303 | parametroProducto: { | 329 | parametroProducto: { |
304 | idLista: $scope.idLista, | 330 | idLista: $scope.idLista, |
305 | cotizacion: $scope.remito.cotizacion.COTIZACION, | 331 | cotizacion: $scope.remito.cotizacion.COTIZACION, |
306 | simbolo: $scope.remito.moneda.simbolo | 332 | simbolo: $scope.remito.moneda.simbolo |
307 | } | 333 | } |
308 | }, | 334 | }, |
309 | size: 'lg' | 335 | size: 'lg' |
310 | } | 336 | } |
311 | ); | 337 | ); |
312 | modalInstance.result.then( | 338 | modalInstance.result.then( |
313 | function(producto) { | 339 | function(producto) { |
314 | var newArt = | 340 | var newArt = |
315 | { | 341 | { |
316 | id: 0, | 342 | id: 0, |
317 | codigo: producto.codigo, | 343 | codigo: producto.codigo, |
318 | sector: producto.sector, | 344 | sector: producto.sector, |
319 | sectorCodigo: producto.sector + '-' + producto.codigo, | 345 | sectorCodigo: producto.sector + '-' + producto.codigo, |
320 | descripcion: producto.descripcion, | 346 | descripcion: producto.descripcion, |
321 | item: $scope.articulosTabla.length + 1, | 347 | item: $scope.articulosTabla.length + 1, |
322 | nombre: producto.descripcion, | 348 | nombre: producto.descripcion, |
323 | precio: parseFloat(producto.precio.toFixed(4)), | 349 | precio: parseFloat(producto.precio.toFixed(4)), |
324 | costoUnitario: producto.costo, | 350 | costoUnitario: producto.costo, |
325 | editCantidad: false, | 351 | editCantidad: false, |
326 | editPrecio: false | 352 | editPrecio: false |
327 | }; | 353 | }; |
328 | $scope.articuloACargar = newArt; | 354 | $scope.articuloACargar = newArt; |
329 | $scope.cargando = false; | 355 | $scope.cargando = false; |
330 | }, function() { | 356 | }, function() { |
331 | // funcion ejecutada cuando se cancela el modal | 357 | // funcion ejecutada cuando se cancela el modal |
332 | } | 358 | } |
333 | ); | 359 | ); |
334 | }; | 360 | }; |
335 | 361 | ||
336 | $scope.seleccionarVendedor = function() { | 362 | $scope.seleccionarVendedor = function() { |
337 | var modalInstance = $uibModal.open( | 363 | var modalInstance = $uibModal.open( |
338 | { | 364 | { |
339 | ariaLabelledBy: 'Busqueda de Vendedores', | 365 | ariaLabelledBy: 'Busqueda de Vendedores', |
340 | templateUrl: 'modal-vendedores.html', | 366 | templateUrl: 'modal-vendedores.html', |
341 | controller: 'modalVendedoresCtrl', | 367 | controller: 'modalVendedoresCtrl', |
342 | size: 'lg' | 368 | size: 'lg' |
343 | } | 369 | } |
344 | ); | 370 | ); |
345 | modalInstance.result.then( | 371 | modalInstance.result.then( |
346 | function(vendedor) { | 372 | function(vendedor) { |
347 | addCabecera('Vendedor:', vendedor.NomVen); | 373 | addCabecera('Vendedor:', vendedor.NomVen); |
348 | $scope.remito.vendedor.codigo = vendedor.CodVen; | 374 | $scope.remito.vendedor.codigo = vendedor.CodVen; |
349 | }, function() { | 375 | }, function() { |
350 | 376 | ||
351 | } | 377 | } |
352 | ); | 378 | ); |
353 | }; | 379 | }; |
354 | 380 | ||
355 | $scope.seleccionarProveedor = function() { | 381 | $scope.seleccionarProveedor = function() { |
356 | var modalInstance = $uibModal.open( | 382 | var modalInstance = $uibModal.open( |
357 | { | 383 | { |
358 | ariaLabelledBy: 'Busqueda de Proveedor', | 384 | ariaLabelledBy: 'Busqueda de Proveedor', |
359 | templateUrl: 'modal-proveedor.html', | 385 | templateUrl: 'modal-proveedor.html', |
360 | controller: 'focaModalProveedorCtrl', | 386 | controller: 'focaModalProveedorCtrl', |
361 | size: 'lg', | 387 | size: 'lg', |
362 | resolve: { | 388 | resolve: { |
363 | transportista: function() { | 389 | transportista: function() { |
364 | return false; | 390 | return false; |
365 | } | 391 | } |
366 | } | 392 | } |
367 | } | 393 | } |
368 | ); | 394 | ); |
369 | modalInstance.result.then( | 395 | modalInstance.result.then( |
370 | function(proveedor) { | 396 | function(proveedor) { |
371 | $scope.remito.proveedor.codigo = proveedor.COD; | 397 | $scope.remito.proveedor.codigo = proveedor.COD; |
372 | addCabecera('Proveedor:', proveedor.NOM); | 398 | addCabecera('Proveedor:', proveedor.NOM); |
373 | }, function() { | 399 | }, function() { |
374 | 400 | ||
375 | } | 401 | } |
376 | ); | 402 | ); |
377 | }; | 403 | }; |
378 | 404 | ||
379 | $scope.seleccionarCliente = function() { | 405 | $scope.seleccionarCliente = function() { |
380 | 406 | ||
381 | var modalInstance = $uibModal.open( | 407 | var modalInstance = $uibModal.open( |
382 | { | 408 | { |
383 | ariaLabelledBy: 'Busqueda de Cliente', | 409 | ariaLabelledBy: 'Busqueda de Cliente', |
384 | templateUrl: 'foca-busqueda-cliente-modal.html', | 410 | templateUrl: 'foca-busqueda-cliente-modal.html', |
385 | controller: 'focaBusquedaClienteModalController', | 411 | controller: 'focaBusquedaClienteModalController', |
386 | size: 'lg' | 412 | size: 'lg' |
387 | } | 413 | } |
388 | ); | 414 | ); |
389 | modalInstance.result.then( | 415 | modalInstance.result.then( |
390 | function(cliente) { | 416 | function(cliente) { |
391 | $scope.abrirModalDomicilios(cliente); | 417 | $scope.abrirModalDomicilios(cliente); |
392 | }, function() { | 418 | }, function() { |
393 | 419 | ||
394 | } | 420 | } |
395 | ); | 421 | ); |
396 | }; | 422 | }; |
397 | 423 | ||
398 | $scope.abrirModalDomicilios = function(cliente) { | 424 | $scope.abrirModalDomicilios = function(cliente) { |
399 | var modalInstanceDomicilio = $uibModal.open( | 425 | var modalInstanceDomicilio = $uibModal.open( |
400 | { | 426 | { |
401 | ariaLabelledBy: 'Busqueda de Domicilios', | 427 | ariaLabelledBy: 'Busqueda de Domicilios', |
402 | templateUrl: 'modal-domicilio.html', | 428 | templateUrl: 'modal-domicilio.html', |
403 | controller: 'focaModalDomicilioController', | 429 | controller: 'focaModalDomicilioController', |
404 | resolve: { idCliente: function() { return cliente.cod; }}, | 430 | resolve: { idCliente: function() { return cliente.cod; }}, |
405 | size: 'lg', | 431 | size: 'lg', |
406 | } | 432 | } |
407 | ); | 433 | ); |
408 | modalInstanceDomicilio.result.then( | 434 | modalInstanceDomicilio.result.then( |
409 | function(domicilio) { | 435 | function(domicilio) { |
410 | $scope.remito.domicilio.id = domicilio.nivel2; | 436 | $scope.remito.domicilio.id = domicilio.nivel2; |
411 | $scope.remito.cliente = cliente; | 437 | $scope.remito.cliente = cliente; |
412 | 438 | ||
413 | addCabecera('Cliente:', cliente.nom); | 439 | addCabecera('Cliente:', cliente.nom); |
414 | addCabecera('Domicilio:', domicilio.dom); | 440 | addCabecera('Domicilio:', domicilio.dom); |
415 | }, function() { | 441 | }, function() { |
416 | $scope.seleccionarCliente(); | 442 | $scope.seleccionarCliente(); |
417 | return; | 443 | return; |
418 | } | 444 | } |
419 | ); | 445 | ); |
420 | }; | 446 | }; |
421 | 447 | ||
422 | $scope.mostrarFichaCliente = function() { | 448 | $scope.mostrarFichaCliente = function() { |
423 | $uibModal.open( | 449 | $uibModal.open( |
424 | { | 450 | { |
425 | ariaLabelledBy: 'Datos del Cliente', | 451 | ariaLabelledBy: 'Datos del Cliente', |
426 | templateUrl: 'foca-crear-remito-ficha-cliente.html', | 452 | templateUrl: 'foca-crear-remito-ficha-cliente.html', |
427 | controller: 'focaCrearRemitoFichaClienteController', | 453 | controller: 'focaCrearRemitoFichaClienteController', |
428 | size: 'lg' | 454 | size: 'lg' |
429 | } | 455 | } |
430 | ); | 456 | ); |
431 | }; | 457 | }; |
432 | 458 | ||
433 | $scope.getTotal = function() { | 459 | $scope.getTotal = function() { |
434 | var total = 0; | 460 | var total = 0; |
435 | var arrayTempArticulos = $scope.articulosTabla; | 461 | var arrayTempArticulos = $scope.articulosTabla; |
436 | for (var i = 0; i < arrayTempArticulos.length; i++) { | 462 | for (var i = 0; i < arrayTempArticulos.length; i++) { |
437 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; | 463 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; |
438 | } | 464 | } |
439 | return parseFloat(total.toFixed(2)); | 465 | return parseFloat(total.toFixed(2)); |
440 | }; | 466 | }; |
441 | 467 | ||
442 | $scope.getSubTotal = function() { | 468 | $scope.getSubTotal = function() { |
443 | if($scope.articuloACargar) { | 469 | if($scope.articuloACargar) { |
444 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; | 470 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; |
445 | } | 471 | } |
446 | }; | 472 | }; |
447 | 473 | ||
448 | $scope.abrirModalListaPrecio = function() { | 474 | $scope.abrirModalListaPrecio = function() { |
449 | var modalInstance = $uibModal.open( | 475 | var modalInstance = $uibModal.open( |
450 | { | 476 | { |
451 | ariaLabelledBy: 'Busqueda de Precio Condición', | 477 | ariaLabelledBy: 'Busqueda de Precio Condición', |
452 | templateUrl: 'modal-precio-condicion.html', | 478 | templateUrl: 'modal-precio-condicion.html', |
453 | controller: 'focaModalPrecioCondicionController', | 479 | controller: 'focaModalPrecioCondicionController', |
454 | size: 'lg' | 480 | size: 'lg' |
455 | } | 481 | } |
456 | ); | 482 | ); |
457 | modalInstance.result.then( | 483 | modalInstance.result.then( |
458 | function(precioCondicion) { | 484 | function(precioCondicion) { |
459 | var cabecera = ''; | 485 | var cabecera = ''; |
460 | var plazosConcat = ''; | 486 | var plazosConcat = ''; |
461 | if(!Array.isArray(precioCondicion)) { | 487 | if(!Array.isArray(precioCondicion)) { |
462 | $scope.plazosPagos = precioCondicion.plazoPago; | 488 | $scope.plazosPagos = precioCondicion.plazoPago; |
463 | $scope.idLista = precioCondicion.idListaPrecio; | 489 | $scope.idLista = precioCondicion.idListaPrecio; |
464 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { | 490 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { |
465 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; | 491 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; |
466 | } | 492 | } |
467 | cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); | 493 | cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); |
468 | } else { //Cuando se ingresan los plazos manualmente | 494 | } else { //Cuando se ingresan los plazos manualmente |
469 | $scope.idLista = -1; //-1, el modal productos busca todos los productos | 495 | $scope.idLista = -1; //-1, el modal productos busca todos los productos |
470 | $scope.plazosPagos = precioCondicion; | 496 | $scope.plazosPagos = precioCondicion; |
471 | for(var j = 0; j < precioCondicion.length; j++) { | 497 | for(var j = 0; j < precioCondicion.length; j++) { |
472 | plazosConcat += precioCondicion[j].dias + ' '; | 498 | plazosConcat += precioCondicion[j].dias + ' '; |
473 | } | 499 | } |
474 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); | 500 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); |
475 | } | 501 | } |
476 | $scope.articulosTabla = []; | 502 | $scope.articulosTabla = []; |
477 | addCabecera('Precios y condiciones:', cabecera); | 503 | addCabecera('Precios y condiciones:', cabecera); |
478 | }, function() { | 504 | }, function() { |
479 | 505 | ||
480 | } | 506 | } |
481 | ); | 507 | ); |
482 | }; | 508 | }; |
483 | 509 | ||
484 | $scope.abrirModalFlete = function() { | 510 | $scope.abrirModalFlete = function() { |
485 | var modalInstance = $uibModal.open( | 511 | var modalInstance = $uibModal.open( |
486 | { | 512 | { |
487 | ariaLabelledBy: 'Busqueda de Flete', | 513 | ariaLabelledBy: 'Busqueda de Flete', |
488 | templateUrl: 'modal-flete.html', | 514 | templateUrl: 'modal-flete.html', |
489 | controller: 'focaModalFleteController', | 515 | controller: 'focaModalFleteController', |
490 | size: 'lg', | 516 | size: 'lg', |
491 | resolve: { | 517 | resolve: { |
492 | parametrosFlete: | 518 | parametrosFlete: |
493 | function() { | 519 | function() { |
494 | return { | 520 | return { |
495 | flete: $scope.remito.flete ? '1' : | 521 | flete: $scope.remito.flete ? '1' : |
496 | ($scope.remito.fob ? 'FOB' : | 522 | ($scope.remito.fob ? 'FOB' : |
497 | ($scope.remito.flete === undefined ? null : '0')), | 523 | ($scope.remito.flete === undefined ? null : '0')), |
498 | bomba: $scope.remito.bomba ? '1' : | 524 | bomba: $scope.remito.bomba ? '1' : |
499 | ($scope.remito.bomba === undefined ? null : '0'), | 525 | ($scope.remito.bomba === undefined ? null : '0'), |
500 | kilometros: $scope.remito.kilometros | 526 | kilometros: $scope.remito.kilometros |
501 | }; | 527 | }; |
502 | } | 528 | } |
503 | } | 529 | } |
504 | } | 530 | } |
505 | ); | 531 | ); |
506 | modalInstance.result.then( | 532 | modalInstance.result.then( |
507 | function(datos) { | 533 | function(datos) { |
508 | $scope.remito.flete = datos.flete; | 534 | $scope.remito.flete = datos.flete; |
509 | $scope.remito.fob = datos.FOB; | 535 | $scope.remito.fob = datos.FOB; |
510 | $scope.remito.bomba = datos.bomba; | 536 | $scope.remito.bomba = datos.bomba; |
511 | $scope.remito.kilometros = datos.kilometros; | 537 | $scope.remito.kilometros = datos.kilometros; |
512 | 538 | ||
513 | addCabecera('Flete:', datos.flete ? 'Si' : | 539 | addCabecera('Flete:', datos.flete ? 'Si' : |
514 | ($scope.remito.fob ? 'FOB' : 'No')); | 540 | ($scope.remito.fob ? 'FOB' : 'No')); |
515 | if(datos.flete) { | 541 | if(datos.flete) { |
516 | addCabecera('Bomba:', datos.bomba ? 'Si' : 'No'); | 542 | addCabecera('Bomba:', datos.bomba ? 'Si' : 'No'); |
517 | addCabecera('Kilometros:', datos.kilometros); | 543 | addCabecera('Kilometros:', datos.kilometros); |
518 | } else { | 544 | } else { |
519 | removeCabecera('Bomba:'); | 545 | removeCabecera('Bomba:'); |
520 | removeCabecera('Kilometros:'); | 546 | removeCabecera('Kilometros:'); |
521 | $scope.remito.fob = false; | 547 | $scope.remito.fob = false; |
522 | $scope.remito.bomba = false; | 548 | $scope.remito.bomba = false; |
523 | $scope.remito.kilometros = null; | 549 | $scope.remito.kilometros = null; |
524 | } | 550 | } |
525 | }, function() { | 551 | }, function() { |
526 | 552 | ||
527 | } | 553 | } |
528 | ); | 554 | ); |
529 | }; | 555 | }; |
530 | 556 | ||
531 | $scope.abrirModalMoneda = function() { | 557 | $scope.abrirModalMoneda = function() { |
532 | var modalInstance = $uibModal.open( | 558 | var modalInstance = $uibModal.open( |
533 | { | 559 | { |
534 | ariaLabelledBy: 'Busqueda de Moneda', | 560 | ariaLabelledBy: 'Busqueda de Moneda', |
535 | templateUrl: 'modal-moneda.html', | 561 | templateUrl: 'modal-moneda.html', |
536 | controller: 'focaModalMonedaController', | 562 | controller: 'focaModalMonedaController', |
537 | size: 'lg' | 563 | size: 'lg' |
538 | } | 564 | } |
539 | ); | 565 | ); |
540 | modalInstance.result.then( | 566 | modalInstance.result.then( |
541 | function(moneda) { | 567 | function(moneda) { |
542 | $scope.abrirModalCotizacion(moneda); | 568 | $scope.abrirModalCotizacion(moneda); |
543 | }, function() { | 569 | }, function() { |
544 | 570 | ||
545 | } | 571 | } |
546 | ); | 572 | ); |
547 | }; | 573 | }; |
548 | 574 | ||
549 | $scope.abrirModalCotizacion = function(moneda) { | 575 | $scope.abrirModalCotizacion = function(moneda) { |
550 | var modalInstance = $uibModal.open( | 576 | var modalInstance = $uibModal.open( |
551 | { | 577 | { |
552 | ariaLabelledBy: 'Busqueda de Cotización', | 578 | ariaLabelledBy: 'Busqueda de Cotización', |
553 | templateUrl: 'modal-cotizacion.html', | 579 | templateUrl: 'modal-cotizacion.html', |
554 | controller: 'focaModalCotizacionController', | 580 | controller: 'focaModalCotizacionController', |
555 | size: 'lg', | 581 | size: 'lg', |
556 | resolve: {idMoneda: function() {return moneda.ID;}} | 582 | resolve: {idMoneda: function() {return moneda.ID;}} |
557 | } | 583 | } |
558 | ); | 584 | ); |
559 | modalInstance.result.then( | 585 | modalInstance.result.then( |
560 | function(cotizacion) { | 586 | function(cotizacion) { |
561 | var articulosTablaTemp = $scope.articulosTabla; | 587 | var articulosTablaTemp = $scope.articulosTabla; |
562 | for(var i = 0; i < articulosTablaTemp.length; i++) { | 588 | for(var i = 0; i < articulosTablaTemp.length; i++) { |
563 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * | 589 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio * |
564 | $scope.remito.cotizacion.COTIZACION; | 590 | $scope.remito.cotizacion.COTIZACION; |
565 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / | 591 | articulosTablaTemp[i].precio = articulosTablaTemp[i].precio / |
566 | cotizacion.COTIZACION; | 592 | cotizacion.COTIZACION; |
567 | } | 593 | } |
568 | $scope.articulosTabla = articulosTablaTemp; | 594 | $scope.articulosTabla = articulosTablaTemp; |
569 | $scope.remito.moneda = { | 595 | $scope.remito.moneda = { |
570 | id: moneda.ID, | 596 | id: moneda.ID, |
571 | detalle: moneda.DETALLE, | 597 | detalle: moneda.DETALLE, |
572 | simbolo: moneda.SIMBOLO | 598 | simbolo: moneda.SIMBOLO |
573 | }; | 599 | }; |
574 | $scope.remito.cotizacion = { | 600 | $scope.remito.cotizacion = { |
575 | ID: cotizacion.ID, | 601 | ID: cotizacion.ID, |
576 | COTIZACION: cotizacion.COTIZACION, | 602 | COTIZACION: cotizacion.COTIZACION, |
577 | FECHA: cotizacion.FECHA | 603 | FECHA: cotizacion.FECHA |
578 | }; | 604 | }; |
579 | addCabecera('Moneda:', moneda.DETALLE); | 605 | addCabecera('Moneda:', moneda.DETALLE); |
580 | addCabecera( | 606 | addCabecera( |
581 | 'Fecha cotizacion:', | 607 | 'Fecha cotizacion:', |
582 | $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') | 608 | $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy') |
583 | ); | 609 | ); |
584 | addCabecera('Cotizacion:', cotizacion.COTIZACION); | 610 | addCabecera('Cotizacion:', cotizacion.COTIZACION); |
585 | }, function() { | 611 | }, function() { |
586 | 612 | ||
587 | } | 613 | } |
588 | ); | 614 | ); |
589 | }; | 615 | }; |
590 | 616 | ||
591 | $scope.agregarATabla = function(key) { | 617 | $scope.agregarATabla = function(key) { |
592 | if(key === 13) { | 618 | if(key === 13) { |
593 | if($scope.articuloACargar.cantidad === undefined || | 619 | if($scope.articuloACargar.cantidad === undefined || |
594 | $scope.articuloACargar.cantidad === 0 || | 620 | $scope.articuloACargar.cantidad === 0 || |
595 | $scope.articuloACargar.cantidad === null ){ | 621 | $scope.articuloACargar.cantidad === null ) { |
596 | focaModalService.alert('El valor debe ser al menos 1'); | 622 | focaModalService.alert('El valor debe ser al menos 1'); |
597 | return; | 623 | return; |
598 | } | 624 | } |
599 | delete $scope.articuloACargar.sectorCodigo; | 625 | delete $scope.articuloACargar.sectorCodigo; |
600 | $scope.articulosTabla.push($scope.articuloACargar); | 626 | $scope.articulosTabla.push($scope.articuloACargar); |
601 | $scope.cargando = true; | 627 | $scope.cargando = true; |
602 | } | 628 | } |
603 | }; | 629 | }; |
604 | 630 | ||
605 | $scope.quitarArticulo = function(key) { | 631 | $scope.quitarArticulo = function(key) { |
606 | $scope.articulosTabla.splice(key, 1); | 632 | $scope.articulosTabla.splice(key, 1); |
607 | }; | 633 | }; |
608 | 634 | ||
609 | $scope.editarArticulo = function(key, articulo) { | 635 | $scope.editarArticulo = function(key, articulo) { |
610 | if(key === 13) { | 636 | if(key === 13) { |
611 | if(articulo.cantidad === null || articulo.cantidad === 0 || | 637 | if(articulo.cantidad === null || articulo.cantidad === 0 || |
612 | articulo.cantidad === undefined){ | 638 | articulo.cantidad === undefined) { |
613 | focaModalService.alert('El valor debe ser al menos 1'); | 639 | focaModalService.alert('El valor debe ser al menos 1'); |
614 | return; | 640 | return; |
615 | } | 641 | } |
616 | articulo.editCantidad = false; | 642 | articulo.editCantidad = false; |
617 | articulo.editPrecio = false; | 643 | articulo.editPrecio = false; |
618 | } | 644 | } |
619 | }; | 645 | }; |
620 | 646 | ||
621 | $scope.cambioEdit = function(articulo, propiedad) { | 647 | $scope.cambioEdit = function(articulo, propiedad) { |
622 | if(propiedad === 'cantidad') { | 648 | if(propiedad === 'cantidad') { |
623 | articulo.editCantidad = true; | 649 | articulo.editCantidad = true; |
624 | } else if(propiedad === 'precio') { | 650 | } else if(propiedad === 'precio') { |
625 | articulo.editPrecio = true; | 651 | articulo.editPrecio = true; |
626 | } | 652 | } |
627 | }; | 653 | }; |
628 | 654 | ||
629 | $scope.limpiarFlete = function() { | 655 | $scope.limpiarFlete = function() { |
630 | $scope.remito.fleteNombre = ''; | 656 | $scope.remito.fleteNombre = ''; |
631 | $scope.remito.chofer = ''; | 657 | $scope.remito.chofer = ''; |
632 | $scope.remito.vehiculo = ''; | 658 | $scope.remito.vehiculo = ''; |
633 | $scope.remito.kilometros = ''; | 659 | $scope.remito.kilometros = ''; |
634 | $scope.remito.costoUnitarioKmFlete = ''; | 660 | $scope.remito.costoUnitarioKmFlete = ''; |
635 | $scope.choferes = ''; | 661 | $scope.choferes = ''; |
636 | $scope.vehiculos = ''; | 662 | $scope.vehiculos = ''; |
637 | }; | 663 | }; |
638 | 664 | ||
639 | $scope.limpiarPantalla = function() { | 665 | $scope.limpiarPantalla = function() { |
640 | $scope.limpiarFlete(); | 666 | $scope.limpiarFlete(); |
641 | $scope.remito.flete = '0'; | 667 | $scope.remito.flete = '0'; |
642 | $scope.remito.bomba = '0'; | 668 | $scope.remito.bomba = '0'; |
643 | $scope.remito.precioCondicion = ''; | 669 | $scope.remito.precioCondicion = ''; |
644 | $scope.articulosTabla = []; | 670 | $scope.articulosTabla = []; |
645 | $scope.remito.vendedor.nombre = ''; | 671 | $scope.remito.vendedor.nombre = ''; |
646 | $scope.remito.cliente = {nombre: ''}; | 672 | $scope.remito.cliente = {nombre: ''}; |
647 | $scope.remito.domicilio = {dom: ''}; | 673 | $scope.remito.domicilio = {dom: ''}; |
648 | $scope.domiciliosCliente = []; | 674 | $scope.domiciliosCliente = []; |
649 | }; | 675 | }; |
650 | 676 | ||
651 | $scope.resetFilter = function() { | 677 | $scope.resetFilter = function() { |
652 | $scope.articuloACargar = {}; | 678 | $scope.articuloACargar = {}; |
653 | $scope.cargando = true; | 679 | $scope.cargando = true; |
654 | }; | 680 | }; |
655 | 681 | ||
656 | $scope.selectFocus = function($event) { | 682 | $scope.selectFocus = function($event) { |
657 | $event.target.select(); | 683 | $event.target.select(); |
684 | }; | ||
685 | |||
686 | $scope.salir = function() { | ||
687 | $location.path('/'); | ||
688 | }; | ||
658 | }; | 689 | function addArrayCabecera(array) { |
659 | 690 | for(var i = 0; i < array.length; i++) { | |
660 | $scope.salir = function() { | 691 | addCabecera(array[i].label, array[i].valor); |
661 | $location.path('/'); | 692 | } |
662 | }; | 693 | } |
663 | 694 | ||
664 | function addCabecera(label, valor) { | 695 | function addCabecera(label, valor) { |
665 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); | 696 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); |
666 | if(propiedad.length === 1) { | 697 | if(propiedad.length === 1) { |
667 | propiedad[0].valor = valor; | 698 | propiedad[0].valor = valor; |
668 | } else { | 699 | } else { |
669 | $scope.cabecera.push({label: label, valor: valor}); | 700 | $scope.cabecera.push({label: label, valor: valor}); |
670 | } | 701 | } |
671 | } | 702 | } |
672 | 703 | ||
673 | function removeCabecera(label) { | 704 | function removeCabecera(label) { |
674 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); | 705 | var propiedad = $filter('filter')($scope.cabecera, {label: label}, true); |
675 | if(propiedad.length === 1){ | 706 | if(propiedad.length === 1) { |
676 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); | 707 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); |
677 | } | 708 | } |
678 | } | 709 | } |
679 | 710 | ||
680 | function rellenar(relleno, longitud) { | 711 | function rellenar(relleno, longitud) { |
681 | relleno = '' + relleno; | 712 | relleno = '' + relleno; |
682 | while (relleno.length < longitud) { | 713 | while (relleno.length < longitud) { |
683 | relleno = '0' + relleno; | 714 | relleno = '0' + relleno; |
684 | } | 715 | } |
685 | 716 | ||
686 | return relleno; | 717 | return relleno; |
687 | } | 718 | } |
688 | } | 719 | } |
689 | ] | 720 | ] |
690 | ) | 721 | ) |
691 | .controller('remitoListaCtrl', [ | 722 | .controller('remitoListaCtrl', [ |
692 | '$scope', | 723 | '$scope', |
693 | 'crearRemitoService', | 724 | 'crearRemitoService', |
694 | '$location', | 725 | '$location', |
695 | function($scope, crearRemitoService, $location) { | 726 | function($scope, crearRemitoService, $location) { |
696 | crearRemitoService.obtenerRemito().then(function(datos) { | 727 | crearRemitoService.obtenerRemito().then(function(datos) { |
697 | $scope.remitos = datos.data; | 728 | $scope.remitos = datos.data; |
698 | }); | 729 | }); |