Commit 38b25c9d8e646ed4f947793bd9041bcbc70417b3
Exists in
master
merge from upstream
Showing
6 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: 'focaCrearNotaPedido', | 26 | module: 'focaCrearNotaPedido', |
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-nota-pedido.js'), | 41 | concat('foca-crear-nota-pedido.js'), |
42 | replace('src/views/', ''), | 42 | replace('src/views/', ''), |
43 | gulp.dest(paths.tmp), | 43 | gulp.dest(paths.tmp), |
44 | rename('foca-crear-nota-pedido.min.js'), | 44 | rename('foca-crear-nota-pedido.min.js'), |
45 | uglify(), | 45 | uglify(), |
46 | replace('"ngRoute","ui.bootstrap","focaModalVendedores","focaBusquedaProductos",'+ | 46 | replace('"ngRoute","ui.bootstrap","focaModalVendedores","focaBusquedaProductos",'+ |
47 | '"focaModalPetroleras","focaBusquedaCliente","focaModalPrecioCondicion",'+ | 47 | '"focaModalPetroleras","focaBusquedaCliente","focaModalPrecioCondicion",'+ |
48 | '"focaModalFlete","focaDirectivas","focaModal"', ''), | 48 | '"focaModalFlete","focaDirectivas","focaModal","focaModalDomicilio"', ''), |
49 | gulp.dest(paths.dist) | 49 | gulp.dest(paths.dist) |
50 | ] | 50 | ] |
51 | ); | 51 | ); |
52 | }); | 52 | }); |
53 | 53 | ||
54 | gulp.task('clean', function(){ | 54 | gulp.task('clean', function(){ |
55 | return gulp.src(['tmp', 'dist'], {read: false}) | 55 | return gulp.src(['tmp', 'dist'], {read: false}) |
56 | .pipe(clean()); | 56 | .pipe(clean()); |
57 | }); | 57 | }); |
58 | 58 | ||
59 | gulp.task('pre-commit', function() { | 59 | gulp.task('pre-commit', function() { |
60 | return pump( | 60 | return pump( |
61 | [ | 61 | [ |
62 | gulp.src(paths.srcJS), | 62 | gulp.src(paths.srcJS), |
63 | jshint('.jshintrc'), | 63 | jshint('.jshintrc'), |
64 | jshint.reporter('default'), | 64 | jshint.reporter('default'), |
65 | jshint.reporter('fail') | 65 | jshint.reporter('fail') |
66 | ] | 66 | ] |
67 | ); | 67 | ); |
68 | 68 | ||
69 | gulp.start('uglify'); | 69 | gulp.start('uglify'); |
70 | }); | 70 | }); |
71 | 71 | ||
72 | gulp.task('webserver', function() { | 72 | gulp.task('webserver', function() { |
73 | pump [ | 73 | pump [ |
74 | connect.server({port: 3000}) | 74 | connect.server({port: 3000}) |
75 | ] | 75 | ] |
76 | }); | 76 | }); |
77 | 77 | ||
78 | gulp.task('clean-post-install', function() { | 78 | gulp.task('clean-post-install', function() { |
79 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', | 79 | return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', |
80 | 'index.html'], {read: false}) | 80 | 'index.html'], {read: false}) |
81 | .pipe(clean()); | 81 | .pipe(clean()); |
82 | }); | 82 | }); |
83 | 83 | ||
84 | gulp.task('default', ['webserver']); | 84 | gulp.task('default', ['webserver']); |
85 | |||
86 | gulp.task('watch', function() { | ||
87 | gulp.watch([paths.srcJS, paths.srcViews], ['uglify']); | ||
88 | }); | ||
85 | 89 |
index.html
1 | <html ng-app="focaCrearNotaPedido"> | 1 | <html ng-app="focaCrearNotaPedido"> |
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 | 9 | ||
10 | <!--VENDOR JS--> | 10 | <!--VENDOR JS--> |
11 | <script src="node_modules/jquery/dist/jquery.min.js"></script> | 11 | <script src="node_modules/jquery/dist/jquery.min.js"></script> |
12 | <script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script> | 12 | <script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script> |
13 | <script src="node_modules/angular/angular.min.js"></script> | 13 | <script src="node_modules/angular/angular.min.js"></script> |
14 | <script src="node_modules/angular-route/angular-route.min.js"></script> | 14 | <script src="node_modules/angular-route/angular-route.min.js"></script> |
15 | <script src="node_modules/ui-bootstrap4/dist/ui-bootstrap-tpls.js"></script> | 15 | <script src="node_modules/ui-bootstrap4/dist/ui-bootstrap-tpls.js"></script> |
16 | 16 | ||
17 | <script src="node_modules/foca-directivas/dist/foca-directivas.min.js"></script> | 17 | <script src="node_modules/foca-directivas/dist/foca-directivas.min.js"></script> |
18 | <script src="node_modules/foca-modal-vendedores/dist/foca-modal-vendedores.min.js"></script> | 18 | <script src="node_modules/foca-modal-vendedores/dist/foca-modal-vendedores.min.js"></script> |
19 | <script src="node_modules/foca-modal-busqueda-productos/dist/foca-busqueda-productos.min.js"></script> | 19 | <script src="node_modules/foca-modal-busqueda-productos/dist/foca-busqueda-productos.min.js"></script> |
20 | <script src="node_modules/foca-modal-petroleras/dist/foca-modal-petroleras.min.js"></script> | 20 | <script src="node_modules/foca-modal-petroleras/dist/foca-modal-petroleras.min.js"></script> |
21 | <script src="node_modules/foca-busqueda-cliente/dist/foca-busqueda-cliente.min.js"></script> | 21 | <script src="node_modules/foca-busqueda-cliente/dist/foca-busqueda-cliente.min.js"></script> |
22 | <script src="node_modules/foca-modal-precio-condiciones/dist/foca-modal-precio-condiciones.min.js"></script> | 22 | <script src="node_modules/foca-modal-precio-condiciones/dist/foca-modal-precio-condiciones.min.js"></script> |
23 | <script src="node_modules/foca-modal-flete/dist/foca-modal-flete.min.js"></script> | 23 | <script src="node_modules/foca-modal-flete/dist/foca-modal-flete.min.js"></script> |
24 | <script src="node_modules/foca-modal/dist/foca-modal.min.js"></script> | 24 | <script src="node_modules/foca-modal/dist/foca-modal.min.js"></script> |
25 | <script src="node_modules/foca-modal-domicilio/dist/foca-modal-domicilios.min.js"></script> | ||
25 | 26 | ||
26 | <script src="src/js/app.js"></script> | 27 | <script src="src/js/app.js"></script> |
27 | <script src="src/js/controller.js"></script> | 28 | <script src="src/js/controller.js"></script> |
28 | <script src="src/js/service.js"></script> | 29 | <script src="src/js/service.js"></script> |
29 | <script src="src/js/route.js"></script> | 30 | <script src="src/js/route.js"></script> |
30 | 31 | ||
31 | <script src="src/etc/develop.js"></script> | 32 | <script src="src/etc/develop.js"></script> |
32 | </head> | 33 | </head> |
33 | <body> | 34 | <body> |
34 | <div ng-view class="container-fluid"></div> | 35 | <div ng-view class="container-fluid"></div> |
35 | </body> | 36 | </body> |
36 | </html> | 37 | </html> |
37 | 38 |
package.json
1 | { | 1 | { |
2 | "name": "foca-crear-nota-pedido", | 2 | "name": "foca-crear-nota-pedido", |
3 | "version": "0.0.1", | 3 | "version": "0.0.1", |
4 | "description": "Listado y ABM nota de pedidos", | 4 | "description": "Listado y ABM nota de pedidos", |
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-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+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-petroleras.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" | 11 | "install-dev": "npm install -D jasmine-core pre-commit angular 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+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-petroleras.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" |
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-nota-pedido.git" | 18 | "url": "https://debo.suite.repo/modulos-npm/foca-crear-nota-pedido.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-petroleras": "git+https://debo.suite.repo/modulos-npm/foca-modal-petroleras.git", | 26 | "foca-modal-petroleras": "git+https://debo.suite.repo/modulos-npm/foca-modal-petroleras.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 | }, | 28 | }, |
29 | "devDependencies": { | 29 | "devDependencies": { |
30 | "angular": "^1.7.5", | 30 | "angular": "^1.7.5", |
31 | "angular-route": "^1.7.5", | 31 | "angular-route": "^1.7.5", |
32 | "bootstrap": "^4.1.3", | 32 | "bootstrap": "^4.1.3", |
33 | "foca-busqueda-cliente": "git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git", | 33 | "foca-busqueda-cliente": "git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git", |
34 | "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git", | 34 | "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git", |
35 | "foca-modal": "git+https://debo.suite.repo/modulos-npm/foca-modal.git", | 35 | "foca-modal": "git+https://debo.suite.repo/modulos-npm/foca-modal.git", |
36 | "foca-modal-busqueda-productos": "git+https://debo.suite.repo/modulos-npm/foca-modal-busqueda-productos", | 36 | "foca-modal-busqueda-productos": "git+https://debo.suite.repo/modulos-npm/foca-modal-busqueda-productos", |
37 | "foca-modal-domicilio": "git+https://debo.suite.repo/modulos-npm/foca-modal-domicilio.git", | ||
37 | "foca-modal-flete": "git+https://debo.suite.repo/modulos-npm/foca-modal-flete", | 38 | "foca-modal-flete": "git+https://debo.suite.repo/modulos-npm/foca-modal-flete", |
38 | "foca-modal-petroleras": "git+https://debo.suite.repo/modulos-npm/foca-modal-petroleras.git", | 39 | "foca-modal-petroleras": "git+https://debo.suite.repo/modulos-npm/foca-modal-petroleras.git", |
39 | "foca-modal-precio-condiciones": "git+https://debo.suite.repo/modulos-npm/foca-modal-precio-condiciones.git", | 40 | "foca-modal-precio-condiciones": "git+https://debo.suite.repo/modulos-npm/foca-modal-precio-condiciones.git", |
40 | "foca-modal-vendedores": "git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git", | 41 | "foca-modal-vendedores": "git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git", |
41 | "font-awesome": "^4.7.0", | 42 | "font-awesome": "^4.7.0", |
42 | "gulp": "^3.9.1", | 43 | "gulp": "^3.9.1", |
43 | "gulp-angular-templatecache": "2.2.2", | 44 | "gulp-angular-templatecache": "2.2.2", |
44 | "gulp-clean": "^0.4.0", | 45 | "gulp-clean": "^0.4.0", |
45 | "gulp-concat": "^2.6.1", | 46 | "gulp-concat": "^2.6.1", |
46 | "gulp-connect": "^5.6.1", | 47 | "gulp-connect": "^5.6.1", |
47 | "gulp-htmlmin": "^5.0.1", | 48 | "gulp-htmlmin": "^5.0.1", |
48 | "gulp-jshint": "^2.1.0", | 49 | "gulp-jshint": "^2.1.0", |
49 | "gulp-rename": "^1.4.0", | 50 | "gulp-rename": "^1.4.0", |
50 | "gulp-replace": "^1.0.0", | 51 | "gulp-replace": "^1.0.0", |
51 | "gulp-sequence": "^1.0.0", | 52 | "gulp-sequence": "^1.0.0", |
52 | "gulp-uglify": "^3.0.1", | 53 | "gulp-uglify": "^3.0.1", |
53 | "gulp-uglify-es": "^1.0.4", | 54 | "gulp-uglify-es": "^1.0.4", |
54 | "jasmine-core": "^3.2.1", | 55 | "jasmine-core": "^3.2.1", |
55 | "jquery": "^3.3.1", | 56 | "jquery": "^3.3.1", |
56 | "jshint": "^2.9.6", | 57 | "jshint": "^2.9.6", |
57 | "pre-commit": "^1.2.2", | 58 | "pre-commit": "^1.2.2", |
58 | "pump": "^3.0.0", | 59 | "pump": "^3.0.0", |
59 | "ui-bootstrap4": "^3.0.5" | 60 | "ui-bootstrap4": "^3.0.5" |
60 | } | 61 | } |
61 | } | 62 | } |
62 | 63 |
src/js/app.js
1 | angular.module('focaCrearNotaPedido', [ | 1 | angular.module('focaCrearNotaPedido', [ |
2 | 'ngRoute', | 2 | 'ngRoute', |
3 | 'ui.bootstrap', | 3 | 'ui.bootstrap', |
4 | 'focaModalVendedores', | 4 | 'focaModalVendedores', |
5 | 'focaBusquedaProductos', | 5 | 'focaBusquedaProductos', |
6 | 'focaModalPetroleras', | 6 | 'focaModalPetroleras', |
7 | 'focaBusquedaCliente', | 7 | 'focaBusquedaCliente', |
8 | 'focaModalPrecioCondicion', | 8 | 'focaModalPrecioCondicion', |
9 | 'focaModalFlete', | 9 | 'focaModalFlete', |
10 | 'focaDirectivas', | 10 | 'focaDirectivas', |
11 | 'focaModal' | 11 | 'focaModal', |
12 | 'focaModalDomicilio' | ||
12 | ]); | 13 | ]); |
13 | 14 |
src/js/controller.js
1 | angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', | 1 | angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
2 | [ | 2 | [ |
3 | '$scope', '$uibModal', '$location', 'crearNotaPedidoService', 'focaModalService', | 3 | '$scope', '$uibModal', '$location', '$filter', 'crearNotaPedidoService', |
4 | function($scope, $uibModal, $location, crearNotaPedidoService, focaModalService) { | 4 | 'focaModalService', |
5 | function( | ||
6 | $scope, $uibModal, $location, $filter, crearNotaPedidoService, focaModalService | ||
7 | ) { | ||
5 | $scope.botonera = [ | 8 | $scope.botonera = [ |
6 | {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}}, | 9 | {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}}, |
7 | {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}}, | 10 | {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}}, |
11 | {texto: 'Proveedor', accion: function() {}}, | ||
8 | {texto: 'Moneda', accion: function() {$scope.abrirModalMoneda();}}, | 12 | {texto: 'Moneda', accion: function() {$scope.abrirModalMoneda();}}, |
9 | { | 13 | { |
10 | texto: 'Precios y condiciones', | 14 | texto: 'Precios y condiciones', |
11 | accion: function() {$scope.abrirModalListaPrecio();}}, | 15 | accion: function() {$scope.abrirModalListaPrecio();}}, |
12 | {texto: 'Flete', accion: function() {$scope.abrirModalFlete();}}, | 16 | {texto: 'Flete', accion: function() {$scope.abrirModalFlete();}}, |
13 | {texto: 'Bomba', accion: function() {}}, | 17 | {texto: '', accion: function() {}}, |
14 | {texto: 'Detalle', accion: function() {}}, | 18 | {texto: '', accion: function() {}} |
15 | {texto: 'Totales', accion: function() {}} | ||
16 | ]; | 19 | ]; |
17 | 20 | ||
18 | $scope.show = false; | 21 | $scope.show = false; |
19 | $scope.cargando = true; | 22 | $scope.cargando = true; |
20 | $scope.dateOptions = { | 23 | $scope.dateOptions = { |
21 | maxDate: new Date(), | 24 | maxDate: new Date(), |
22 | minDate: new Date(2010, 0, 1) | 25 | minDate: new Date(2010, 0, 1) |
23 | }; | 26 | }; |
24 | 27 | ||
25 | $scope.notaPedido = { | 28 | $scope.notaPedido = { |
26 | vendedor: {}, | 29 | vendedor: {}, |
27 | cliente: {}, | 30 | cliente: {}, |
28 | domicilio: {dom: ''}, | 31 | domicilio: {dom: ''}, |
29 | moneda: {detalle: ''} | 32 | moneda: {detalle: ''} |
30 | }; | 33 | }; |
31 | 34 | ||
32 | $scope.cabecera = []; | 35 | $scope.cabecera = []; |
33 | 36 | ||
34 | $scope.now = new Date(); | 37 | $scope.now = new Date(); |
35 | $scope.puntoVenta = Math.round(Math.random() * 10000); | 38 | $scope.puntoVenta = Math.round(Math.random() * 10000); |
36 | $scope.comprobante = Math.round(Math.random() * 1000000); | 39 | $scope.comprobante = Math.round(Math.random() * 1000000); |
37 | 40 | ||
38 | $scope.articulosTabla = []; | 41 | $scope.articulosTabla = []; |
39 | var idLista; | 42 | var idLista; |
40 | var notaPedidoTemp = crearNotaPedidoService.getNotaPedido(); | 43 | var notaPedidoTemp = crearNotaPedidoService.getNotaPedido(); |
41 | crearNotaPedidoService.getPrecioCondicion().then( | 44 | crearNotaPedidoService.getPrecioCondicion().then( |
42 | function(res) { | 45 | function(res) { |
43 | $scope.precioCondiciones = res.data; | 46 | $scope.precioCondiciones = res.data; |
44 | } | 47 | } |
45 | ); | 48 | ); |
46 | if (notaPedidoTemp !== undefined) { | 49 | if (notaPedidoTemp !== undefined) { |
47 | notaPedidoTemp.fechaCarga = new Date(notaPedidoTemp.fechaCarga); | 50 | notaPedidoTemp.fechaCarga = new Date(notaPedidoTemp.fechaCarga); |
48 | $scope.notaPedido = notaPedidoTemp; | 51 | $scope.notaPedido = notaPedidoTemp; |
49 | $scope.notaPedido.flete = ($scope.notaPedido.flete).toString(); | 52 | $scope.notaPedido.flete = ($scope.notaPedido.flete).toString(); |
50 | $scope.notaPedido.bomba = ($scope.notaPedido.bomba).toString(); | 53 | $scope.notaPedido.bomba = ($scope.notaPedido.bomba).toString(); |
51 | idLista = $scope.notaPedido.precioCondicion; | 54 | idLista = $scope.notaPedido.precioCondicion; |
52 | crearNotaPedidoService | 55 | crearNotaPedidoService |
53 | .getArticulosByIdNotaPedido($scope.notaPedido.id).then( | 56 | .getArticulosByIdNotaPedido($scope.notaPedido.id).then( |
54 | function(res) { | 57 | function(res) { |
55 | $scope.articulosTabla = res.data; | 58 | $scope.articulosTabla = res.data; |
56 | } | 59 | } |
57 | ); | 60 | ); |
58 | //TODO DOMICILIOS QUE SE CARGAN AL EDITAR NOTA DE PEDIDO | 61 | //TODO DOMICILIOS QUE SE CARGAN AL EDITAR NOTA DE PEDIDO |
59 | //(NO REQUERIDO EN ESTA VERSION) | 62 | //(NO REQUERIDO EN ESTA VERSION) |
60 | // crearNotaPedidoService.getDomiciliosByIdNotaPedido($scope.notaPedido.id).then( | 63 | // crearNotaPedidoService.getDomiciliosByIdNotaPedido($scope.notaPedido.id).then( |
61 | // function(res) { | 64 | // function(res) { |
62 | // $scope.notaPedido.domicilio = res.data; | 65 | // $scope.notaPedido.domicilio = res.data; |
63 | // } | 66 | // } |
64 | // ); | 67 | // ); |
65 | } else { | 68 | } else { |
66 | $scope.notaPedido.fechaCarga = new Date(); | 69 | $scope.notaPedido.fechaCarga = new Date(); |
67 | $scope.notaPedido.bomba = '0'; | 70 | $scope.notaPedido.bomba = '0'; |
68 | $scope.notaPedido.flete = '0'; | 71 | $scope.notaPedido.flete = '0'; |
69 | idLista = undefined; | 72 | idLista = undefined; |
70 | } | 73 | } |
71 | //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO | 74 | //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO |
72 | // $scope.addNewDom = function() { | 75 | // $scope.addNewDom = function() { |
73 | // $scope.notaPedido.domicilio.push({ 'id': 0 }); | 76 | // $scope.notaPedido.domicilio.push({ 'id': 0 }); |
74 | // }; | 77 | // }; |
75 | // $scope.removeNewChoice = function(choice) { | 78 | // $scope.removeNewChoice = function(choice) { |
76 | // if ($scope.notaPedido.domicilio.length > 1) { | 79 | // if ($scope.notaPedido.domicilio.length > 1) { |
77 | // $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex( | 80 | // $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex( |
78 | // function(c) { | 81 | // function(c) { |
79 | // return c.$$hashKey === choice.$$hashKey; | 82 | // return c.$$hashKey === choice.$$hashKey; |
80 | // } | 83 | // } |
81 | // ), 1); | 84 | // ), 1); |
82 | // } | 85 | // } |
83 | // }; | 86 | // }; |
84 | $scope.crearNotaPedido = function() { | 87 | $scope.crearNotaPedido = function() { |
85 | if($scope.articulosTabla.length === 0) { | 88 | if($scope.articulosTabla.length === 0) { |
86 | focaModalService.alert('Debe cargar almenos un articulo'); | 89 | focaModalService.alert('Debe cargar almenos un articulo'); |
87 | return; | 90 | return; |
88 | } | 91 | } |
89 | if($scope.notaPedido.domicilio.id === undefined) { | 92 | if($scope.notaPedido.domicilio.id === undefined) { |
90 | $scope.notaPedido.domicilio.id = 0; | 93 | $scope.notaPedido.domicilio.id = 0; |
91 | } | 94 | } |
92 | var date = new Date(); | 95 | var date = new Date(); |
93 | var notaPedido = { | 96 | var notaPedido = { |
94 | id: 0, | 97 | id: 0, |
95 | fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) | 98 | fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) |
96 | .toISOString().slice(0, 19).replace('T', ' '), | 99 | .toISOString().slice(0, 19).replace('T', ' '), |
97 | vendedor: $scope.notaPedido.vendedor.nombre, | 100 | vendedor: $scope.notaPedido.vendedor.nombre, |
98 | idCliente: $scope.notaPedido.cliente.id, | 101 | idCliente: $scope.notaPedido.cliente.id, |
99 | domicilio: $scope.notaPedido.domicilio, | 102 | domicilio: $scope.notaPedido.domicilio, |
100 | precioCondicion: $scope.notaPedido.precioCondicion, | 103 | precioCondicion: $scope.notaPedido.precioCondicion, |
101 | bomba: $scope.notaPedido.bomba, | 104 | bomba: $scope.notaPedido.bomba, |
102 | flete: $scope.notaPedido.flete, | 105 | flete: $scope.notaPedido.flete, |
103 | total: $scope.getTotal() | 106 | total: $scope.getTotal() |
104 | }; | 107 | }; |
105 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( | 108 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( |
106 | function(data) { | 109 | function(data) { |
107 | focaModalService.alert('Nota pedido creada'); | 110 | focaModalService.alert('Nota pedido creada'); |
108 | if($scope.notaPedido.flete === 1) { | 111 | if($scope.notaPedido.flete === 1) { |
109 | var flete = { | 112 | var flete = { |
110 | idNotaPedido: data.data.id, | 113 | idNotaPedido: data.data.id, |
111 | idTransportista: $scope.notaPedido.fleteId, | 114 | idTransportista: $scope.notaPedido.fleteId, |
112 | idChofer: $scope.notaPedido.chofer.id, | 115 | idChofer: $scope.notaPedido.chofer.id, |
113 | idVehiculo: $scope.notaPedido.vehiculo.id, | 116 | idVehiculo: $scope.notaPedido.vehiculo.id, |
114 | kilometros: $scope.notaPedido.kilometros, | 117 | kilometros: $scope.notaPedido.kilometros, |
115 | costoKilometro: $scope.notaPedido.costoUnitarioKmFlete | 118 | costoKilometro: $scope.notaPedido.costoUnitarioKmFlete |
116 | }; | 119 | }; |
117 | crearNotaPedidoService.crearFlete(flete); | 120 | crearNotaPedidoService.crearFlete(flete); |
118 | } | 121 | } |
119 | var articulosNotaPedido = $scope.articulosTabla; | 122 | var articulosNotaPedido = $scope.articulosTabla; |
120 | for(var i = 0; i < articulosNotaPedido.length; i++) { | 123 | for(var i = 0; i < articulosNotaPedido.length; i++) { |
121 | delete articulosNotaPedido[i].edit; | 124 | delete articulosNotaPedido[i].edit; |
122 | articulosNotaPedido[i].idNotaPedido = data.data.id; | 125 | articulosNotaPedido[i].idNotaPedido = data.data.id; |
123 | crearNotaPedidoService | 126 | crearNotaPedidoService |
124 | .crearArticulosParaNotaPedido(articulosNotaPedido[i]); | 127 | .crearArticulosParaNotaPedido(articulosNotaPedido[i]); |
125 | } | 128 | } |
126 | $scope.limpiarPantalla(); | 129 | $scope.limpiarPantalla(); |
127 | } | 130 | } |
128 | ); | 131 | ); |
129 | }; | 132 | }; |
130 | 133 | ||
131 | $scope.seleccionarArticulo = function() { | 134 | $scope.seleccionarArticulo = function() { |
132 | if (idLista === undefined) { | 135 | if (idLista === undefined) { |
133 | focaModalService.alert( | 136 | focaModalService.alert( |
134 | 'Primero seleccione una lista de precio y condicion'); | 137 | 'Primero seleccione una lista de precio y condicion'); |
135 | return; | 138 | return; |
136 | } | 139 | } |
137 | var modalInstance = $uibModal.open( | 140 | var modalInstance = $uibModal.open( |
138 | { | 141 | { |
139 | ariaLabelledBy: 'Busqueda de Productos', | 142 | ariaLabelledBy: 'Busqueda de Productos', |
140 | templateUrl: 'modal-busqueda-productos.html', | 143 | templateUrl: 'modal-busqueda-productos.html', |
141 | controller: 'modalBusquedaProductosCtrl', | 144 | controller: 'modalBusquedaProductosCtrl', |
142 | resolve: { idLista: function() { return idLista; } }, | 145 | resolve: { idLista: function() { return idLista; } }, |
143 | size: 'lg' | 146 | size: 'lg' |
144 | } | 147 | } |
145 | ); | 148 | ); |
146 | modalInstance.result.then( | 149 | modalInstance.result.then( |
147 | function(producto) { | 150 | function(producto) { |
148 | var newArt = | 151 | var newArt = |
149 | { | 152 | { |
150 | id: 0, | 153 | id: 0, |
151 | codigo: producto.codigo, | 154 | codigo: producto.codigo, |
152 | sector: producto.sector, | 155 | sector: producto.sector, |
153 | descripcion: producto.descripcion, | 156 | descripcion: producto.descripcion, |
154 | item: $scope.articulosTabla.length + 1, | 157 | item: $scope.articulosTabla.length + 1, |
155 | nombre: producto.descripcion, | 158 | nombre: producto.descripcion, |
156 | precio: producto.precio.toFixed(2), | 159 | precio: producto.precio.toFixed(2), |
157 | costoUnitario: producto.costo, | 160 | costoUnitario: producto.costo, |
158 | edit: false | 161 | edit: false |
159 | }; | 162 | }; |
160 | $scope.articuloACargar = newArt; | 163 | $scope.articuloACargar = newArt; |
161 | $scope.cargando = false; | 164 | $scope.cargando = false; |
162 | }, function() { | 165 | }, function() { |
163 | // funcion ejecutada cuando se cancela el modal | 166 | // funcion ejecutada cuando se cancela el modal |
164 | } | 167 | } |
165 | ); | 168 | ); |
166 | }; | 169 | }; |
167 | 170 | ||
168 | $scope.seleccionarVendedor = function() { | 171 | $scope.seleccionarVendedor = function() { |
169 | var modalInstance = $uibModal.open( | 172 | var modalInstance = $uibModal.open( |
170 | { | 173 | { |
171 | ariaLabelledBy: 'Busqueda de Vendedores', | 174 | ariaLabelledBy: 'Busqueda de Vendedores', |
172 | templateUrl: 'modal-vendedores.html', | 175 | templateUrl: 'modal-vendedores.html', |
173 | controller: 'modalVendedoresCtrl', | 176 | controller: 'modalVendedoresCtrl', |
174 | size: 'lg' | 177 | size: 'lg' |
175 | } | 178 | } |
176 | ); | 179 | ); |
177 | modalInstance.result.then( | 180 | modalInstance.result.then( |
178 | function(vendedor) { | 181 | function(vendedor) { |
179 | addCabecera('Vendedor:', vendedor.NomVen); | 182 | addCabecera('Vendedor:', vendedor.NomVen); |
180 | $scope.notaPedido.vendedor.nombre = vendedor.NomVen; | 183 | $scope.notaPedido.vendedor.nombre = vendedor.NomVen; |
181 | }, function() { | 184 | }, function() { |
182 | 185 | ||
183 | } | 186 | } |
184 | ); | 187 | ); |
185 | }; | 188 | }; |
186 | 189 | ||
187 | $scope.seleccionarPetrolera = function() { | 190 | $scope.seleccionarPetrolera = function() { |
188 | var modalInstance = $uibModal.open( | 191 | var modalInstance = $uibModal.open( |
189 | { | 192 | { |
190 | ariaLabelledBy: 'Busqueda de Petrolera', | 193 | ariaLabelledBy: 'Busqueda de Petrolera', |
191 | templateUrl: 'modal-petroleras.html', | 194 | templateUrl: 'modal-petroleras.html', |
192 | controller: 'modalPetrolerasCtrl', | 195 | controller: 'modalPetrolerasCtrl', |
193 | size: 'lg' | 196 | size: 'lg' |
194 | } | 197 | } |
195 | ); | 198 | ); |
196 | modalInstance.result.then( | 199 | modalInstance.result.then( |
197 | function(petrolera) { | 200 | function(petrolera) { |
198 | $scope.notaPedido.petrolera = petrolera.NOM; | 201 | $scope.notaPedido.petrolera = petrolera.NOM; |
199 | }, function() { | 202 | }, function() { |
200 | 203 | ||
201 | } | 204 | } |
202 | ); | 205 | ); |
203 | }; | 206 | }; |
204 | 207 | ||
205 | $scope.seleccionarCliente = function() { | 208 | $scope.seleccionarCliente = function() { |
206 | var modalInstance = $uibModal.open( | 209 | var modalInstance = $uibModal.open( |
207 | { | 210 | { |
208 | ariaLabelledBy: 'Busqueda de Cliente', | 211 | ariaLabelledBy: 'Busqueda de Cliente', |
209 | templateUrl: 'foca-busqueda-cliente-modal.html', | 212 | templateUrl: 'foca-busqueda-cliente-modal.html', |
210 | controller: 'focaBusquedaClienteModalController', | 213 | controller: 'focaBusquedaClienteModalController', |
211 | size: 'lg' | 214 | size: 'lg' |
212 | } | 215 | } |
213 | ); | 216 | ); |
214 | modalInstance.result.then( | 217 | modalInstance.result.then( |
215 | function(cliente) { | 218 | function(cliente) { |
216 | $scope.notaPedido.cliente.nombre = cliente.nom; | 219 | $scope.notaPedido.cliente.nombre = cliente.nom; |
217 | $scope.notaPedido.cliente.id = cliente.cod; | 220 | $scope.notaPedido.cliente.id = cliente.cod; |
218 | crearNotaPedidoService.getDomiciliosByIdCliente(cliente.cod).then( | 221 | crearNotaPedidoService.getDomiciliosByIdCliente(cliente.cod).then( |
219 | function(data) { | 222 | function(data) { |
220 | if(data.data.length === 0){ | 223 | if(data.data.length === 0){ |
221 | focaModalService | 224 | focaModalService |
222 | .alert('El cliente no tienen domicilios de entrega') | 225 | .alert('El cliente no tienen domicilios de entrega') |
223 | .then( | 226 | .then( |
224 | function() { | 227 | function() { |
225 | $scope.seleccionarCliente(); | 228 | $scope.seleccionarCliente(); |
226 | $scope.notaPedido.cliente = {nombre: ''}; | 229 | $scope.notaPedido.cliente = {nombre: ''}; |
227 | } | 230 | } |
228 | ); | 231 | ); |
229 | return; | 232 | return; |
230 | } | 233 | } |
231 | $scope.domiciliosCliente = data.data; | 234 | var modalInstanceDomicilio = $uibModal.open( |
235 | { | ||
236 | ariaLabelledBy: 'Busqueda de Domicilios', | ||
237 | templateUrl: 'modal-domicilio.html', | ||
238 | controller: 'focaModalDomicilioController', | ||
239 | resolve: { idCliente: function() { return cliente.cod; }}, | ||
240 | size: 'lg', | ||
241 | backdrop: 'static', | ||
242 | } | ||
243 | ); | ||
244 | modalInstanceDomicilio.result.then( | ||
245 | function(domicilio) { | ||
246 | focaModalService.alert('Domicilio elegido' + domicilio.dom); | ||
247 | }, function() { | ||
248 | $scope.notaPedido.cliente.nombre = ''; | ||
249 | $scope.notaPedido.cliente.id = ''; | ||
250 | removeCabecera('Cliente:'); | ||
251 | $scope.seleccionarCliente(); | ||
252 | return; | ||
253 | } | ||
254 | ); | ||
232 | } | 255 | } |
233 | ); | 256 | ); |
234 | |||
235 | addCabecera('Cliente:', cliente.nom); | 257 | addCabecera('Cliente:', cliente.nom); |
236 | }, function() { | 258 | }, function() { |
237 | 259 | ||
238 | } | 260 | } |
239 | ); | 261 | ); |
240 | }; | 262 | }; |
241 | 263 | ||
242 | $scope.mostrarFichaCliente = function() { | 264 | $scope.mostrarFichaCliente = function() { |
243 | $uibModal.open( | 265 | $uibModal.open( |
244 | { | 266 | { |
245 | ariaLabelledBy: 'Datos del Cliente', | 267 | ariaLabelledBy: 'Datos del Cliente', |
246 | templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html', | 268 | templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html', |
247 | controller: 'focaCrearNotaPedidoFichaClienteController', | 269 | controller: 'focaCrearNotaPedidoFichaClienteController', |
248 | size: 'lg' | 270 | size: 'lg' |
249 | } | 271 | } |
250 | ); | 272 | ); |
251 | }; | 273 | }; |
252 | 274 | ||
253 | $scope.getTotal = function() { | 275 | $scope.getTotal = function() { |
254 | var total = 0; | 276 | var total = 0; |
255 | var arrayTempArticulos = $scope.articulosTabla; | 277 | var arrayTempArticulos = $scope.articulosTabla; |
256 | for (var i = 0; i < arrayTempArticulos.length; i++) { | 278 | for (var i = 0; i < arrayTempArticulos.length; i++) { |
257 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; | 279 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; |
258 | } | 280 | } |
259 | return total.toFixed(2); | 281 | return total.toFixed(2); |
260 | }; | 282 | }; |
261 | 283 | ||
262 | $scope.getSubTotal = function() { | 284 | $scope.getSubTotal = function() { |
263 | if($scope.articuloACargar) { | 285 | if($scope.articuloACargar) { |
264 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; | 286 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; |
265 | } | 287 | } |
266 | }; | 288 | }; |
267 | 289 | ||
268 | $scope.abrirModalListaPrecio = function() { | 290 | $scope.abrirModalListaPrecio = function() { |
269 | var modalInstance = $uibModal.open( | 291 | var modalInstance = $uibModal.open( |
270 | { | 292 | { |
271 | ariaLabelledBy: 'Busqueda de Precio Condición', | 293 | ariaLabelledBy: 'Busqueda de Precio Condición', |
272 | templateUrl: 'modal-precio-condicion.html', | 294 | templateUrl: 'modal-precio-condicion.html', |
273 | controller: 'focaModalPrecioCondicionController', | 295 | controller: 'focaModalPrecioCondicionController', |
274 | size: 'lg' | 296 | size: 'lg' |
275 | } | 297 | } |
276 | ); | 298 | ); |
277 | modalInstance.result.then( | 299 | modalInstance.result.then( |
278 | function(precioCondicion) { | 300 | function(precioCondicion) { |
279 | $scope.notaPedido.precioCondicion = precioCondicion.nombre; | 301 | $scope.notaPedido.precioCondicion = precioCondicion.nombre; |
280 | idLista = precioCondicion.idListaPrecio; | 302 | idLista = precioCondicion.idListaPrecio; |
281 | $scope.articulosTabla = []; | 303 | $scope.articulosTabla = []; |
282 | 304 | ||
283 | addCabecera('Precios y condiciones:', precioCondicion.nombre); | 305 | addCabecera('Precios y condiciones:', precioCondicion.nombre); |
284 | }, function() { | 306 | }, function() { |
285 | 307 | ||
286 | } | 308 | } |
287 | ); | 309 | ); |
288 | }; | 310 | }; |
289 | 311 | ||
290 | $scope.abrirModalFlete = function() { | 312 | $scope.abrirModalFlete = function() { |
291 | var modalInstance = $uibModal.open( | 313 | var modalInstance = $uibModal.open( |
292 | { | 314 | { |
293 | ariaLabelledBy: 'Busqueda de Flete', | 315 | ariaLabelledBy: 'Busqueda de Flete', |
294 | templateUrl: 'modal-flete.html', | 316 | templateUrl: 'modal-flete.html', |
295 | controller: 'focaModalFleteController', | 317 | controller: 'focaModalFleteController', |
296 | size: 'lg' | 318 | size: 'lg', |
319 | resolve: { | ||
320 | parametrosFlete: | ||
321 | function() { | ||
322 | return { | ||
323 | flete: $scope.notaPedido.flete, | ||
324 | bomba: $scope.notaPedido.bomba, | ||
325 | kilometros: $scope.notaPedido.kilometros | ||
326 | }; | ||
327 | } | ||
328 | } | ||
297 | } | 329 | } |
298 | ); | 330 | ); |
299 | modalInstance.result.then( | 331 | modalInstance.result.then( |
300 | function(flete) { | 332 | function(datos) { |
301 | $scope.limpiarFlete(); | 333 | $scope.notaPedido.flete = datos.flete; |
302 | $scope.notaPedido.fleteNombre = flete.nombre; | 334 | $scope.notaPedido.bomba = datos.bomba; |
303 | $scope.notaPedido.fleteId = flete.id; | 335 | $scope.notaPedido.kilometros = datos.kilometros; |
304 | $scope.choferes = flete.chofer; | 336 | |
305 | $scope.vehiculos = flete.vehiculo; | 337 | addCabecera('Flete:', datos.flete); |
306 | 338 | if(datos.flete === 'si') { | |
307 | addCabecera('Flete:', flete.nombre); | 339 | addCabecera('Bomba:', datos.bomba); |
340 | addCabecera('Kilometros:', datos.kilometros); | ||
341 | } else { | ||
342 | removeCabecera('Bomba:'); | ||
343 | removeCabecera('Kilometros:'); | ||
344 | } | ||
308 | }, function() { | 345 | }, function() { |
309 | 346 | ||
310 | } | 347 | } |
311 | ); | 348 | ); |
312 | }; | 349 | }; |
313 | 350 | ||
314 | $scope.abrirModalMoneda = function() { | 351 | $scope.abrirModalMoneda = function() { |
315 | var modalInstance = $uibModal.open( | 352 | var modalInstance = $uibModal.open( |
316 | { | 353 | { |
317 | ariaLabelledBy: 'Busqueda de Moneda', | 354 | ariaLabelledBy: 'Busqueda de Moneda', |
318 | templateUrl: 'modal-moneda.html', | 355 | templateUrl: 'modal-moneda.html', |
319 | controller: 'focaModalMonedaController', | 356 | controller: 'focaModalMonedaController', |
320 | size: 'lg' | 357 | size: 'lg' |
321 | } | 358 | } |
322 | ); | 359 | ); |
323 | modalInstance.result.then( | 360 | modalInstance.result.then( |
324 | function(moneda) { | 361 | function(moneda) { |
325 | $scope.notaPedido.moneda = { | 362 | $scope.notaPedido.moneda = { |
326 | id: moneda.ID, | 363 | id: moneda.ID, |
327 | detalle: moneda.DETALLE, | 364 | detalle: moneda.DETALLE, |
328 | simbolo: moneda.SIMBOLO | 365 | simbolo: moneda.SIMBOLO |
329 | }; | 366 | }; |
330 | 367 | ||
331 | addCabecera('Moneda:', moneda.DETALLE); | 368 | addCabecera('Moneda:', moneda.DETALLE); |
332 | }, function() { | 369 | }, function() { |
333 | 370 | ||
334 | } | 371 | } |
335 | ); | 372 | ); |
336 | }; | 373 | }; |
337 | 374 | ||
338 | $scope.agregarATabla = function(key) { | 375 | $scope.agregarATabla = function(key) { |
339 | if(key === 13) { | 376 | if(key === 13) { |
340 | if($scope.articuloACargar.cantidad === undefined || | 377 | if($scope.articuloACargar.cantidad === undefined || |
341 | $scope.articuloACargar.cantidad === 0 || | 378 | $scope.articuloACargar.cantidad === 0 || |
342 | $scope.articuloACargar.cantidad === null ){ | 379 | $scope.articuloACargar.cantidad === null ){ |
343 | focaModalService.alert('El valor debe ser al menos 1'); | 380 | focaModalService.alert('El valor debe ser al menos 1'); |
344 | return; | 381 | return; |
345 | } | 382 | } |
346 | $scope.articulosTabla.unshift($scope.articuloACargar); | 383 | $scope.articulosTabla.unshift($scope.articuloACargar); |
347 | $scope.cargando = true; | 384 | $scope.cargando = true; |
348 | } | 385 | } |
349 | }; | 386 | }; |
350 | 387 | ||
351 | $scope.quitarArticulo = function(key) { | 388 | $scope.quitarArticulo = function(key) { |
352 | $scope.articulosTabla.splice(key, 1); | 389 | $scope.articulosTabla.splice(key, 1); |
353 | }; | 390 | }; |
354 | 391 | ||
355 | $scope.editarArticulo = function(key, articulo) { | 392 | $scope.editarArticulo = function(key, articulo) { |
356 | if(key === 13) { | 393 | if(key === 13) { |
357 | if(articulo.cantidad === null || articulo.cantidad === 0 || | 394 | if(articulo.cantidad === null || articulo.cantidad === 0 || |
358 | articulo.cantidad === undefined){ | 395 | articulo.cantidad === undefined){ |
359 | focaModalService.alert('El valor debe ser al menos 1'); | 396 | focaModalService.alert('El valor debe ser al menos 1'); |
360 | return; | 397 | return; |
361 | } | 398 | } |
362 | articulo.edit = false; | 399 | articulo.edit = false; |
363 | } | 400 | } |
364 | }; | 401 | }; |
365 | 402 | ||
366 | $scope.cambioEdit = function(articulo) { | 403 | $scope.cambioEdit = function(articulo) { |
367 | articulo.edit = true; | 404 | articulo.edit = true; |
368 | }; | 405 | }; |
369 | 406 | ||
370 | $scope.limpiarFlete = function() { | 407 | $scope.limpiarFlete = function() { |
371 | $scope.notaPedido.fleteNombre = ''; | 408 | $scope.notaPedido.fleteNombre = ''; |
372 | $scope.notaPedido.chofer = ''; | 409 | $scope.notaPedido.chofer = ''; |
373 | $scope.notaPedido.vehiculo = ''; | 410 | $scope.notaPedido.vehiculo = ''; |
374 | $scope.notaPedido.kilometros = ''; | 411 | $scope.notaPedido.kilometros = ''; |
375 | $scope.notaPedido.costoUnitarioKmFlete = ''; | 412 | $scope.notaPedido.costoUnitarioKmFlete = ''; |
376 | $scope.choferes = ''; | 413 | $scope.choferes = ''; |
377 | $scope.vehiculos = ''; | 414 | $scope.vehiculos = ''; |
378 | }; | 415 | }; |
379 | 416 | ||
380 | $scope.limpiarPantalla = function() { | 417 | $scope.limpiarPantalla = function() { |
381 | $scope.limpiarFlete(); | 418 | $scope.limpiarFlete(); |
382 | $scope.notaPedido.flete = '0'; | 419 | $scope.notaPedido.flete = '0'; |
383 | $scope.notaPedido.bomba = '0'; | 420 | $scope.notaPedido.bomba = '0'; |
384 | $scope.notaPedido.precioCondicion = ''; | 421 | $scope.notaPedido.precioCondicion = ''; |
385 | $scope.articulosTabla = []; | 422 | $scope.articulosTabla = []; |
386 | $scope.notaPedido.vendedor.nombre = ''; | 423 | $scope.notaPedido.vendedor.nombre = ''; |
387 | $scope.notaPedido.cliente = {nombre: ''}; | 424 | $scope.notaPedido.cliente = {nombre: ''}; |
388 | $scope.notaPedido.domicilio = {dom: ''}; | 425 | $scope.notaPedido.domicilio = {dom: ''}; |
389 | $scope.domiciliosCliente = []; | 426 | $scope.domiciliosCliente = []; |
390 | }; | 427 | }; |
391 | 428 | ||
392 | $scope.resetFilter = function() { | 429 | $scope.resetFilter = function() { |
393 | $scope.articuloACargar = {}; | 430 | $scope.articuloACargar = {}; |
394 | $scope.cargando = true; | 431 | $scope.cargando = true; |
395 | }; | 432 | }; |
396 | 433 | ||
397 | $scope.selectFocus = function($event) { | 434 | $scope.selectFocus = function($event) { |
398 | $event.target.select(); | 435 | $event.target.select(); |
399 | }; | 436 | }; |
400 | 437 | ||
401 | $scope.salir = function() { | 438 | $scope.salir = function() { |
402 | $location.path('/'); | 439 | $location.path('/'); |
403 | }; | 440 | }; |
404 | 441 | ||
405 | function addCabecera(label, valor) { | 442 | function addCabecera(label, valor) { |
406 | var existe = false; | 443 | var propiedad = $filter('filter')($scope.cabecera, {label: label}); |
407 | 444 | if(propiedad.length === 1) { | |
408 | for (var i = $scope.cabecera.length - 1; i >= 0; i--) { | 445 | propiedad[0].valor = valor; |
409 | if ($scope.cabecera[i].label === label) { | 446 | } else { |
410 | $scope.cabecera[i].valor = valor; | 447 | $scope.cabecera.push({label: label, valor: valor}); |
411 | existe = true; | ||
412 | break; | ||
413 | } | ||
414 | |||
415 | } | 448 | } |
416 | 449 | } | |
417 | if (!existe) { | 450 | |
418 | $scope.cabecera.push({ | 451 | function removeCabecera(label) { |
419 | label: label, | 452 | var propiedad = $filter('filter')($scope.cabecera, {label: label}); |
420 | valor: valor | 453 | if(propiedad.length === 1){ |
421 | }); | 454 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); |
422 | } | 455 | } |
423 | } | 456 | } |
424 | } | 457 | } |
425 | ] | 458 | ] |
426 | ) | 459 | ) |
427 | .controller('notaPedidoListaCtrl', [ | 460 | .controller('notaPedidoListaCtrl', [ |
428 | '$scope', | 461 | '$scope', |
429 | 'crearNotaPedidoService', | 462 | 'crearNotaPedidoService', |
430 | '$location', | 463 | '$location', |
431 | function($scope, crearNotaPedidoService, $location) { | 464 | function($scope, crearNotaPedidoService, $location) { |
432 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { | 465 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { |
433 | $scope.notaPedidos = datos.data; | 466 | $scope.notaPedidos = datos.data; |
434 | }); | 467 | }); |
435 | $scope.editar = function(notaPedido) { | 468 | $scope.editar = function(notaPedido) { |
436 | crearNotaPedidoService.setNotaPedido(notaPedido); | 469 | crearNotaPedidoService.setNotaPedido(notaPedido); |
437 | $location.path('/venta-nota-pedido/abm/'); | 470 | $location.path('/venta-nota-pedido/abm/'); |
438 | }; | 471 | }; |
439 | $scope.crearPedido = function() { | 472 | $scope.crearPedido = function() { |
440 | crearNotaPedidoService.clearNotaPedido(); | 473 | crearNotaPedidoService.clearNotaPedido(); |
441 | $location.path('/venta-nota-pedido/abm/'); | 474 | $location.path('/venta-nota-pedido/abm/'); |
442 | }; | 475 | }; |
443 | } | 476 | } |
444 | ]) | 477 | ]) |
445 | .controller('focaCrearNotaPedidoFichaClienteController', [ | 478 | .controller('focaCrearNotaPedidoFichaClienteController', [ |
446 | '$scope', | 479 | '$scope', |
447 | 'crearNotaPedidoService', | 480 | 'crearNotaPedidoService', |
448 | '$location', | 481 | '$location', |
449 | function($scope, crearNotaPedidoService, $location) { | 482 | function($scope, crearNotaPedidoService, $location) { |
450 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { | 483 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { |
451 | $scope.notaPedidos = datos.data; | 484 | $scope.notaPedidos = datos.data; |
452 | }); | 485 | }); |
453 | $scope.editar = function(notaPedido) { | 486 | $scope.editar = function(notaPedido) { |
454 | crearNotaPedidoService.setNotaPedido(notaPedido); | 487 | crearNotaPedidoService.setNotaPedido(notaPedido); |
455 | $location.path('/venta-nota-pedido/abm/'); | 488 | $location.path('/venta-nota-pedido/abm/'); |
456 | }; | 489 | }; |
457 | $scope.crearPedido = function() { | 490 | $scope.crearPedido = function() { |
src/views/nota-pedido.html
1 | <div class="crear-nota-pedido"> | 1 | <div class="crear-nota-pedido"> |
2 | <form name="formCrearNota" ng-submit="crearNotaPedido()"> | 2 | <form name="formCrearNota" ng-submit="crearNotaPedido()"> |
3 | <div class="row"> | 3 | <div class="row"> |
4 | <div class="col-md-10 offset-md-1 col-lg-8 offset-lg-2"> | 4 | <div class="col-md-10 offset-md-1 col-lg-8 offset-lg-2"> |
5 | <div class="row p-1 panel-informativo"> | 5 | <div class="row p-1 panel-informativo"> |
6 | <div class="col-12"> | 6 | <div class="col-12"> |
7 | <div class="row"> | 7 | <div class="row"> |
8 | <div class="col-3"> | 8 | <div class="col-5"> |
9 | {{ now | date:'dd/MM/yyyy HH:mm'}} | 9 | <div class="h4">NOTA DE PEDIDO</div> |
10 | </div> | 10 | </div> |
11 | <div class="col-6 text-center"> | 11 | <div class="col-3">Nº {{puntoVenta}}-{{comprobante}}</div> |
12 | <div class="h2">NOTA DE PEDIDO</div> | 12 | <div class="col-4 text-right"> |
13 | Fecha: {{ now | date:'dd/MM/yyyy HH:mm'}} | ||
13 | </div> | 14 | </div> |
14 | <div class="col-3 text-right">{{puntoVenta}}-{{comprobante}}</div> | ||
15 | </div> | 15 | </div> |
16 | <div class="row"> | 16 | <div class="row"> |
17 | <div class="col-auto" ng-repeat="cab in cabecera"> | 17 | <div class="col-auto" ng-repeat="cab in cabecera"> |
18 | <span class="label" ng-bind="cab.label"></span> | 18 | <span class="label" ng-bind="cab.label"></span> |
19 | <span class="valor" ng-bind="cab.valor"></span> | 19 | <span class="valor" ng-bind="cab.valor"></span> |
20 | </div> | 20 | </div> |
21 | </div> | 21 | </div> |
22 | </div> | 22 | </div> |
23 | </div> | 23 | </div> |
24 | <div class="row p-1 botonera-secundaria"> | 24 | <div class="row p-1 botonera-secundaria"> |
25 | <div class=" col-12 col-sm-6 col-md-3 botonera" ng-repeat="boton in botonera"> | 25 | <div class="col-12"> |
26 | <button | 26 | <div class="row"> |
27 | type="button" | 27 | <div class="col-3 px-0 py-0" ng-repeat="boton in botonera"> |
28 | class="btn btn-default btn-block btn-xs" | 28 | <button |
29 | ng-bind="boton.texto" | 29 | type="button" |
30 | ng-click="boton.accion()" | 30 | class="btn btn-default btn-block btn-xs text-left py-2" |
31 | ></button> | 31 | ng-click="boton.accion()" |
32 | > | ||
33 | <i | ||
34 | class="fa fa-arrow-circle-right" | ||
35 | ng-show="boton.texto != ''" | ||
36 | ></i> | ||
37 | | ||
38 | {{boton.texto}} | ||
39 | </button> | ||
40 | </div> | ||
41 | </div> | ||
32 | </div> | 42 | </div> |
33 | </div> | 43 | </div> |
34 | </div> | 44 | </div> |
35 | </div> | 45 | </div> |
36 | </form> | 46 | </form> |
37 | <div class="row"> | 47 | <div class="row"> |
38 | <div class="col-md-10 col-lg-8 offset-md-1 offset-lg-2"> | 48 | <div class="col-md-10 col-lg-8 offset-md-1 offset-lg-2"> |
39 | <div class="row grilla-articulos align-items-end"> | 49 | <div class="row grilla-articulos align-items-end"> |
40 | <table class="table table-striped table-sm table-dark"> | 50 | <table class="table table-striped table-sm table-dark"> |
41 | <thead> | 51 | <thead> |
42 | <tr> | 52 | <tr> |
43 | <th>Sector</th> | ||
44 | <th>Código</th> | 53 | <th>Código</th> |
45 | <th>Descripción</th> | 54 | <th>Descripción</th> |
46 | <th>Precio Unitario</th> | ||
47 | <th>Cantidad</th> | 55 | <th>Cantidad</th> |
56 | <th>Precio Unitario</th> | ||
48 | <th>SubTotal</th> | 57 | <th>SubTotal</th> |
49 | <th> | 58 | <th> |
50 | <button | 59 | <button |
51 | class="btn btn-outline-secondary selectable" | 60 | class="btn btn-outline-secondary selectable" |
52 | style="float: right;" | 61 | style="float: right;" |
53 | ng-click="show = !show; masMenos()" | 62 | ng-click="show = !show; masMenos()" |
54 | > | 63 | > |
55 | <i | 64 | <i |
56 | class="fa fa-chevron-down" | 65 | class="fa fa-chevron-down" |
57 | ng-hide="show" | 66 | ng-hide="show" |
58 | aria-hidden="true" | 67 | aria-hidden="true" |
59 | > | 68 | > |
60 | </i> | 69 | </i> |
61 | <i | 70 | <i |
62 | class="fa fa-chevron-up" | 71 | class="fa fa-chevron-up" |
63 | ng-show="show" | 72 | ng-show="show" |
64 | aria-hidden="true"> | 73 | aria-hidden="true"> |
65 | </i> | 74 | </i> |
66 | </button> | 75 | </button> |
67 | </th> | 76 | </th> |
68 | </tr> | 77 | </tr> |
69 | </thead> | 78 | </thead> |
70 | <tbody> | 79 | <tbody> |
71 | <tr ng-show="!cargando"> | 80 | <tr ng-show="!cargando"> |
72 | <td><input | 81 | <td><input |
73 | class="form-control" | 82 | class="form-control" |
74 | ng-model="articuloACargar.sector" | 83 | ng-model="articuloACargar.sector + '-' + articuloACargar.codigo" |
75 | readonly></td> | ||
76 | <td><input | ||
77 | class="form-control" | ||
78 | ng-model="articuloACargar.codigo" | ||
79 | readonly></td> | 84 | readonly></td> |
80 | <td><input | 85 | <td><input |
81 | class="form-control" | 86 | class="form-control" |
82 | ng-model="articuloACargar.descripcion" | 87 | ng-model="articuloACargar.descripcion" |
83 | readonly></td> | 88 | readonly></td> |
84 | <td><input | 89 | <td class="text-right"><input |
85 | class="form-control" | ||
86 | ng-value="articuloACargar.precio | currency: '$'" | ||
87 | readonly></td> | ||
88 | <td><input | ||
89 | class="form-control" | 90 | class="form-control" |
90 | type="number" | 91 | type="number" |
91 | min="1" | 92 | min="1" |
92 | ng-model="articuloACargar.cantidad" | 93 | ng-model="articuloACargar.cantidad" |
93 | foca-focus="!cargando" | 94 | foca-focus="!cargando" |
94 | esc-key="resetFilter()" | 95 | esc-key="resetFilter()" |
95 | ng-keypress="agregarATabla($event.keyCode)"></td> | 96 | ng-keypress="agregarATabla($event.keyCode)"></td> |
96 | <td><input | 97 | <td class="text-right"><input |
98 | class="form-control" | ||
99 | ng-value="articuloACargar.precio | currency: '$'" | ||
100 | readonly></td> | ||
101 | <td class="text-right"><input | ||
97 | class="form-control" | 102 | class="form-control" |
98 | ng-value="getSubTotal() | currency: '$'" | 103 | ng-value="getSubTotal() | currency: '$'" |
99 | readonly></td> | 104 | readonly></td> |
100 | <td class="text-center"><button | 105 | <td class="text-center"><button |
101 | class="btn btn-outline-secondary btn-sm" | 106 | class="btn btn-outline-secondary btn-sm" |
102 | ng-click="agregarATabla(13)"> | 107 | ng-click="agregarATabla(13)"> |
103 | <i class="fa fa-save"></i> | 108 | <i class="fa fa-save"></i> |
104 | </button></td> | 109 | </button></td> |
105 | </tr> | 110 | </tr> |
106 | <tr | 111 | <tr |
107 | ng-repeat="(key, articulo) in articulosTabla" | 112 | ng-repeat="(key, articulo) in articulosTabla" |
108 | ng-show="show || key == 0" | 113 | ng-show="show || key == 0" |
109 | > | 114 | > |
110 | <td ng-bind="articulo.sector"></td> | 115 | <td ng-bind="articulo.sector + '-' + articulo.codigo"></td> |
111 | <td ng-bind="articulo.codigo"></td> | ||
112 | <td ng-bind="articulo.descripcion"></td> | 116 | <td ng-bind="articulo.descripcion"></td> |
113 | <td ng-bind="articulo.precio | currency: '$'"></td> | 117 | <td class="text-right"><input |
114 | <td><input | ||
115 | ng-show="articulo.edit" | 118 | ng-show="articulo.edit" |
116 | ng-model="articulo.cantidad" | 119 | ng-model="articulo.cantidad" |
117 | class="form-control" | 120 | class="form-control" |
118 | type="number" | 121 | type="number" |
119 | min="1" | 122 | min="1" |
120 | foca-focus="articulo.edit" | 123 | foca-focus="articulo.edit" |
121 | ng-keypress="editarArticulo($event.keyCode, articulo)" | 124 | ng-keypress="editarArticulo($event.keyCode, articulo)" |
122 | ng-focus="selectFocus($event)" | 125 | ng-focus="selectFocus($event)" |
123 | > | 126 | > |
124 | <i | 127 | <i |
125 | class="selectable" | 128 | class="selectable" |
126 | ng-click="cambioEdit(articulo)" | 129 | ng-click="cambioEdit(articulo)" |
127 | ng-hide="articulo.edit" | 130 | ng-hide="articulo.edit" |
128 | ng-bind="articulo.cantidad"> | 131 | ng-bind="articulo.cantidad"> |
129 | </i> | 132 | </i> |
130 | </td> | 133 | </td> |
134 | <td class="text-right" ng-bind="articulo.precio | currency: '$'"></td> | ||
131 | <td | 135 | <td |
136 | class="text-right" | ||
132 | ng-bind="(articulo.precio * articulo.cantidad) | currency: '$'"> | 137 | ng-bind="(articulo.precio * articulo.cantidad) | currency: '$'"> |
133 | </td> | 138 | </td> |
134 | <td class="text-center"> | 139 | <td class="text-center"> |
135 | <button | 140 | <button |
136 | class="btn btn-outline-secondary btn-sm" | 141 | class="btn btn-outline-secondary btn-sm" |
137 | ng-click="quitarArticulo(key)" | 142 | ng-click="quitarArticulo(key)" |
138 | > | 143 | > |
139 | <i class="fa fa-trash"></i> | 144 | <i class="fa fa-trash"></i> |
140 | </button> | 145 | </button> |
141 | </td> | 146 | </td> |
142 | </tr> | 147 | </tr> |
143 | <tr ng-show="cargando"> | 148 | <tr ng-show="cargando"> |
144 | <td colspan="7"> | 149 | <td colspan="6"> |
145 | <input | 150 | <input |
146 | placeholder="Seleccione Articulo" | 151 | placeholder="Seleccione Articulo" |
147 | class="form-control form-control-sm" | 152 | class="form-control form-control-sm" |
148 | readonly | 153 | readonly |
149 | ng-click="seleccionarArticulo()" | 154 | ng-click="seleccionarArticulo()" |
150 | /> | 155 | /> |
151 | </td> | 156 | </td> |
152 | </tr> | 157 | </tr> |
153 | </tbody> | 158 | </tbody> |
154 | <tfoot> | 159 | <tfoot> |
155 | <tr class=""> | 160 | <tr class=""> |
156 | <td colspan="4"> | 161 | <td colspan="3"> |
157 | <strong>Cantidad Items:</strong> | 162 | <strong>Cantidad Items:</strong> |
158 | <a ng-bind="articulosTabla.length"></a> | 163 | <a ng-bind="articulosTabla.length"></a> |
159 | </td> | 164 | </td> |
160 | <td class="text-right table-celda-total"><h3>Total:</h3></td> | 165 | <td class="text-right table-celda-total"><h3>Total:</h3></td> |
161 | <td class="table-celda-total text-right" colspan="1"> | 166 | <td class="table-celda-total text-right" colspan="1"> |
162 | <h3>{{getTotal() | currency: '$'}}</h3> | 167 | <h3>{{getTotal() | currency: '$'}}</h3> |
163 | </td> | 168 | </td> |
164 | <td colspan="2"></td> | 169 | <td colspan="2" class="text-right"> |
170 | <button | ||
171 | type="button" | ||
172 | class="btn btn-default btn-sm" | ||
173 | > | ||
174 | Totales | ||
175 | </button> | ||
176 | </td> | ||
165 | </tr> | 177 | </tr> |
166 | </tfoot> | 178 | </tfoot> |
167 | </table> | 179 | </table> |
168 | </div> | 180 | </div> |
169 | </div> | 181 | </div> |
170 | <div class="col-auto my-2"> | 182 | <div class="col-auto my-2 col-lg-2 botonera-lateral"> |
171 | <button | 183 | <div class="row align-items-end"> |
172 | ng-click="crearNotaPedido()" | 184 | <div class="col-12"> |
173 | type="submit" | 185 | <button |
174 | title="Crear nota pedido" | 186 | ng-click="crearNotaPedido()" |
175 | class="btn btn-default"> | 187 | type="submit" |
176 | Guardar | 188 | title="Crear nota pedido" |
177 | </button> | 189 | class="btn btn-default btn-block mb-2"> |
178 | <br/> | 190 | Guardar |
179 | <br/> | 191 | </button> |
180 | <button | 192 | <button |
181 | ng-click="salir()" | 193 | ng-click="salir()" |
182 | type="button" | 194 | type="button" |
183 | title="Salir" | 195 | title="Salir" |
184 | class="btn btn-default"> | 196 | class="btn btn-default btn-block"> |
185 | Salir | 197 | Salir |
186 | </button> | 198 | </button> |
199 | </div> | ||
200 | </div> | ||
187 | </div> | 201 | </div> |
188 | </div> | 202 | </div> |
189 | </div> | 203 | </div> |
190 | <!-- | 204 | <!-- |
191 | <form name="formCrearNota"> | 205 | <form name="formCrearNota"> |
192 | <uib-tabset active="active"> | 206 | <uib-tabset active="active"> |
193 | <uib-tab index="0" heading="General"> | 207 | <uib-tab index="0" heading="General"> |
194 | <input type="hidden" name="id" ng-model="notaPedido.id" /> | 208 | <input type="hidden" name="id" ng-model="notaPedido.id" /> |
195 | <div> | 209 | <div> |
196 | <div class="col-auto my-2"> | 210 | <div class="col-auto my-2"> |
197 | <button type="submit" title="Siguiente" class="btn btn-primary float-right">Siguiente</button> | 211 | <button type="submit" title="Siguiente" class="btn btn-primary float-right">Siguiente</button> |
198 | </div> | 212 | </div> |
199 | </div> | 213 | </div> |
200 | <br> | 214 | <br> |
201 | <br> | 215 | <br> |
202 | <div class="row"> | 216 | <div class="row"> |
203 | <div class="col-md-2"> | 217 | <div class="col-md-2"> |
204 | <div class="col-auto"> | 218 | <div class="col-auto"> |
205 | <label>Fecha de carga</label> | 219 | <label>Fecha de carga</label> |
206 | </div> | 220 | </div> |
207 | </div> | 221 | </div> |
208 | <div class="col-md-3"> | 222 | <div class="col-md-3"> |
209 | <div class="col-auto"> | 223 | <div class="col-auto"> |
210 | <input type="date" class="form-control" ng-model="notaPedido.fechaCarga" ng-required="true"> | 224 | <input type="date" class="form-control" ng-model="notaPedido.fechaCarga" ng-required="true"> |
211 | </div> | 225 | </div> |
212 | </div> | 226 | </div> |
213 | <div class="col-md-2"> | 227 | <div class="col-md-2"> |
214 | <div class="col-auto"> | 228 | <div class="col-auto"> |
215 | <label>Kilómetros</label> | 229 | <label>Kilómetros</label> |
216 | </div> | 230 | </div> |
217 | </div> | 231 | </div> |
218 | <div class="col-md-3"> | 232 | <div class="col-md-3"> |
219 | <div class="col-auto"> | 233 | <div class="col-auto"> |
220 | <input type="number" min="0" step="0.01" class="form-control" placeholder="Kilómetros recorridos para la entrega en el cliente" | 234 | <input type="number" min="0" step="0.01" class="form-control" placeholder="Kilómetros recorridos para la entrega en el cliente" |
221 | ng-model="notaPedido.kilometros" ng-required="true"> | 235 | ng-model="notaPedido.kilometros" ng-required="true"> |
222 | </div> | 236 | </div> |
223 | </div> | 237 | </div> |
224 | </div> | 238 | </div> |
225 | <div class="row my-3"> | 239 | <div class="row my-3"> |
226 | <div class="col-md-2"> | 240 | <div class="col-md-2"> |
227 | <div class="col-auto"> | 241 | <div class="col-auto"> |
228 | <label>Jurisdicción de IIBB</label> | 242 | <label>Jurisdicción de IIBB</label> |
229 | </div> | 243 | </div> |
230 | </div> | 244 | </div> |
231 | <div class="col-md-3"> | 245 | <div class="col-md-3"> |
232 | <div class="col-auto"> | 246 | <div class="col-auto"> |
233 | <input type="text" class="form-control" placeholder="Jurisdicción de IIBB donde se realiza la entrega" | 247 | <input type="text" class="form-control" placeholder="Jurisdicción de IIBB donde se realiza la entrega" |
234 | ng-model="notaPedido.jurisdiccionIIBB" ng-required="true"> | 248 | ng-model="notaPedido.jurisdiccionIIBB" ng-required="true"> |
235 | </div> | 249 | </div> |
236 | </div> | 250 | </div> |
237 | <div class="col-md-2"> | 251 | <div class="col-md-2"> |
238 | <div class="col-auto"> | 252 | <div class="col-auto"> |
239 | <label>Costo de financiación</label> | 253 | <label>Costo de financiación</label> |
240 | </div> | 254 | </div> |
241 | </div> | 255 | </div> |
242 | <div class="col-md-3"> | 256 | <div class="col-md-3"> |
243 | <div class="col-auto"> | 257 | <div class="col-auto"> |
244 | <div class="input-group mb-2"> | 258 | <div class="input-group mb-2"> |
245 | <div class="input-group-prepend"> | 259 | <div class="input-group-prepend"> |
246 | <div class="input-group-text">$</div> | 260 | <div class="input-group-text">$</div> |
247 | </div> | 261 | </div> |
248 | <input type="number" min="0" step="0.01" class="form-control" placeholder="Costo de financiación" | 262 | <input type="number" min="0" step="0.01" class="form-control" placeholder="Costo de financiación" |
249 | ng-model="notaPedido.costoFinanciacion"> | 263 | ng-model="notaPedido.costoFinanciacion"> |
250 | </div> | 264 | </div> |
251 | </div> | 265 | </div> |
252 | </div> | 266 | </div> |
253 | </div> | 267 | </div> |
254 | <div class="row"> | 268 | <div class="row"> |
255 | <div class="col-md-2"> | 269 | <div class="col-md-2"> |
256 | <div class="col-auto"> | 270 | <div class="col-auto"> |
257 | <label>Bomba</label> | 271 | <label>Bomba</label> |
258 | </div> | 272 | </div> |
259 | </div> | 273 | </div> |
260 | <div class="col-md-1"> | 274 | <div class="col-md-1"> |
261 | <div class="col-auto"> | 275 | <div class="col-auto"> |
262 | <div class="form-check custom-radio custom-control-inline"> | 276 | <div class="form-check custom-radio custom-control-inline"> |
263 | <input class="form-check-input" type="radio" name="radioBomba" value="1" ng-model="notaPedido.bomba"> | 277 | <input class="form-check-input" type="radio" name="radioBomba" value="1" ng-model="notaPedido.bomba"> |
264 | <label class="form-check-label"> | 278 | <label class="form-check-label"> |
265 | Si | 279 | Si |
266 | </label> | 280 | </label> |
267 | </div> | 281 | </div> |
268 | <div class="form-check custom-radio custom-control-inline"> | 282 | <div class="form-check custom-radio custom-control-inline"> |
269 | <input class="form-check-input" type="radio" name="radioBomba" value="0" ng-model="notaPedido.bomba"> | 283 | <input class="form-check-input" type="radio" name="radioBomba" value="0" ng-model="notaPedido.bomba"> |
270 | <label class="form-check-label"> | 284 | <label class="form-check-label"> |
271 | No | 285 | No |
272 | </label> | 286 | </label> |
273 | </div> | 287 | </div> |
274 | </div> | 288 | </div> |
275 | </div> | 289 | </div> |
276 | <div class="col-md-1"> | 290 | <div class="col-md-1"> |
277 | <div class="col-auto"> | 291 | <div class="col-auto"> |
278 | <label>Flete</label> | 292 | <label>Flete</label> |
279 | </div> | 293 | </div> |
280 | </div> | 294 | </div> |
281 | <div class="col-md-1"> | 295 | <div class="col-md-1"> |
282 | <div class="col-auto"> | 296 | <div class="col-auto"> |
283 | <div class="form-check custom-radio custom-control-inline"> | 297 | <div class="form-check custom-radio custom-control-inline"> |
284 | <input class="form-check-input" type="radio" name="radioFlete" value="1" ng-model="notaPedido.flete"> | 298 | <input class="form-check-input" type="radio" name="radioFlete" value="1" ng-model="notaPedido.flete"> |
285 | <label class="form-check-label"> | 299 | <label class="form-check-label"> |
286 | Si | 300 | Si |
287 | </label> | 301 | </label> |
288 | </div> | 302 | </div> |
289 | <div class="form-check custom-radio custom-control-inline"> | 303 | <div class="form-check custom-radio custom-control-inline"> |
290 | <input class="form-check-input" type="radio" name="radioFlete" value="0" ng-model="notaPedido.flete"> | 304 | <input class="form-check-input" type="radio" name="radioFlete" value="0" ng-model="notaPedido.flete"> |
291 | <label class="form-check-label"> | 305 | <label class="form-check-label"> |
292 | FOB | 306 | FOB |
293 | </label> | 307 | </label> |
294 | </div> | 308 | </div> |
295 | </div> | 309 | </div> |
296 | </div> | 310 | </div> |
297 | <div class="col-md-2"> | 311 | <div class="col-md-2"> |
298 | <div class="col-auto"> | 312 | <div class="col-auto"> |
299 | <label>Costo unitario kilometro flete</label> | 313 | <label>Costo unitario kilometro flete</label> |
300 | </div> | 314 | </div> |
301 | </div> | 315 | </div> |
302 | <div class="col-md-3"> | 316 | <div class="col-md-3"> |
303 | <div class="col-auto"> | 317 | <div class="col-auto"> |
304 | <div class="input-group mb-2"> | 318 | <div class="input-group mb-2"> |
305 | <div class="input-group-prepend"> | 319 | <div class="input-group-prepend"> |
306 | <div class="input-group-text">$</div> | 320 | <div class="input-group-text">$</div> |
307 | </div> | 321 | </div> |
308 | <input type="number" min="0" step="0.01" class="form-control" placeholder="Costo unitario del kilometro del flete" | 322 | <input type="number" min="0" step="0.01" class="form-control" placeholder="Costo unitario del kilometro del flete" |
309 | ng-model="notaPedido.costoUnitarioKmFlete" ng-required="true"> | 323 | ng-model="notaPedido.costoUnitarioKmFlete" ng-required="true"> |
310 | </div> | 324 | </div> |
311 | </div> | 325 | </div> |
312 | </div> | 326 | </div> |
313 | </div> | 327 | </div> |
314 | <div class="row my-3"> | 328 | <div class="row my-3"> |
315 | <div class="col-md-2"> | 329 | <div class="col-md-2"> |
316 | <div class="col-auto"> | 330 | <div class="col-auto"> |
317 | <label>Vendedor</label> | 331 | <label>Vendedor</label> |
318 | </div> | 332 | </div> |
319 | </div> | 333 | </div> |
320 | <div class="col-md-3"> | 334 | <div class="col-md-3"> |
321 | <div class="col-auto"> | 335 | <div class="col-auto"> |
322 | <input type="text" class="form-control" placeholder="Seleccione vendedor" ng-model="notaPedido.vendedor" | 336 | <input type="text" class="form-control" placeholder="Seleccione vendedor" ng-model="notaPedido.vendedor" |
323 | ng-click="seleccionarVendedor()" readonly> | 337 | ng-click="seleccionarVendedor()" readonly> |
324 | </div> | 338 | </div> |
325 | </div> | 339 | </div> |
326 | <div class="col-md-2"> | 340 | <div class="col-md-2"> |
327 | <div class="col-auto"> | 341 | <div class="col-auto"> |
328 | <label>Petrolera</label> | 342 | <label>Petrolera</label> |
329 | </div> | 343 | </div> |
330 | </div> | 344 | </div> |
331 | <div class="col-md-3"> | 345 | <div class="col-md-3"> |
332 | <div class="col-auto"> | 346 | <div class="col-auto"> |
333 | <input type="text" class="form-control" placeholder="Seleccione petrolera" ng-model="notaPedido.petrolera" | 347 | <input type="text" class="form-control" placeholder="Seleccione petrolera" ng-model="notaPedido.petrolera" |
334 | ng-click="seleccionarPetrolera()" readonly> | 348 | ng-click="seleccionarPetrolera()" readonly> |
335 | </div> | 349 | </div> |
336 | </div> | 350 | </div> |
337 | </div> | 351 | </div> |
338 | </div> | 352 | </div> |
339 | <div class="row"> | 353 | <div class="row"> |
340 | <div class="col-md-2"> | 354 | <div class="col-md-2"> |
341 | <div class="col-auto"> | 355 | <div class="col-auto"> |
342 | <label>Cliente</label> | 356 | <label>Cliente</label> |
343 | </div> | 357 | </div> |
344 | </div> | 358 | </div> |
345 | <div class="col-md-3"> | 359 | <div class="col-md-3"> |
346 | <div class="col-auto"> | 360 | <div class="col-auto"> |
347 | <input type="text" class="form-control" placeholder="Seleccione cliente" ng-model="notaPedido.cliente" | 361 | <input type="text" class="form-control" placeholder="Seleccione cliente" ng-model="notaPedido.cliente" |
348 | ng-click="seleccionarCliente()" ng-change="obtenerDomicilios()" readonly> | 362 | ng-click="seleccionarCliente()" ng-change="obtenerDomicilios()" readonly> |
349 | </div> | 363 | </div> |
350 | </div> | 364 | </div> |
351 | <div class="col-md-2"> | 365 | <div class="col-md-2"> |
352 | <div class="col-auto"> | 366 | <div class="col-auto"> |
353 | <label>Domicilio</label> | 367 | <label>Domicilio</label> |
354 | </div> | 368 | </div> |
355 | </div> | 369 | </div> |
356 | <div class="col-md-4"> | 370 | <div class="col-md-4"> |
357 | <div class="col-md-12 row" ng-repeat="domicilio in notaPedido.domicilio"> | 371 | <div class="col-md-12 row" ng-repeat="domicilio in notaPedido.domicilio"> |
358 | <div class="col-auto"> | 372 | <div class="col-auto"> |
359 | <input type="text" ng-model="domicilio.dom" placeholder="Domicilio" uib-typeahead=" | 373 | <input type="text" ng-model="domicilio.dom" placeholder="Domicilio" uib-typeahead=" |
360 | domi.dom | 374 | domi.dom |
361 | for domi | 375 | for domi |
362 | in domiciliosCliente | 376 | in domiciliosCliente |
363 | " | 377 | " |
364 | typeahead-no-results="sinResultados" typeahead-min-length="0" typeahead-on-select="seleccionar($item)" | 378 | typeahead-no-results="sinResultados" typeahead-min-length="0" typeahead-on-select="seleccionar($item)" |
365 | class="form-control mb-2" ng-disabled="domicilio.id > 0" ng-required="true"> | 379 | class="form-control mb-2" ng-disabled="domicilio.id > 0" ng-required="true"> |
366 | <i ng-show="cargandoClientes" class="fas fa-sync"></i> | 380 | <i ng-show="cargandoClientes" class="fas fa-sync"></i> |
367 | <div ng-show="sinResultados"> | 381 | <div ng-show="sinResultados"> |
368 | No se encontraron resultados. | 382 | No se encontraron resultados. |
369 | </div> | 383 | </div> |
370 | </div> | 384 | </div> |
371 | <a class="btn" ng-click="removeNewChoice(domicilio)" ng-if="domicilio.id==0">-</a> | 385 | <a class="btn" ng-click="removeNewChoice(domicilio)" ng-if="domicilio.id==0">-</a> |
372 | <a class="btn" ng-click="addNewDom()">+</a> | 386 | <a class="btn" ng-click="addNewDom()">+</a> |
373 | </div> | 387 | </div> |
374 | </div> | 388 | </div> |
375 | </div> | 389 | </div> |
376 | </uib-tab> | 390 | </uib-tab> |
377 | <uib-tab index="1" heading="Producto" disable="formCrearNota.$invalid"> | 391 | <uib-tab index="1" heading="Producto" disable="formCrearNota.$invalid"> |
378 | <div> | 392 | <div> |
379 | <div class="col-auto my-2"> | 393 | <div class="col-auto my-2"> |
380 | <button ng-click="crearNotaPedido()" type="button" title="Crear nota pedido" class="btn btn-primary float-right">Crear</button> | 394 | <button ng-click="crearNotaPedido()" type="button" title="Crear nota pedido" class="btn btn-primary float-right">Crear</button> |
381 | </div> | 395 | </div> |
382 | </div> | 396 | </div> |
383 | <br> | 397 | <br> |
384 | <br> | 398 | <br> |
385 | <div class="row"> | 399 | <div class="row"> |
386 | <div class="col-md-2"> | 400 | <div class="col-md-2"> |
387 | <div class="col-auto"> | 401 | <div class="col-auto"> |
388 | <label>Precios y condiciones</label> | 402 | <label>Precios y condiciones</label> |
389 | </div> | 403 | </div> |
390 | </div> | 404 | </div> |
391 | <div class="col-md-4"> | 405 | <div class="col-md-4"> |
392 | <div class="col-auto"> | 406 | <div class="col-auto"> |
393 | <select class="form-control" ng-change="cargarArticulos()" ng-model="notaPedido.precioCondicion" ng-options="preCond.id as preCond.nombre for preCond in precioCondiciones"> | 407 | <select class="form-control" ng-change="cargarArticulos()" ng-model="notaPedido.precioCondicion" ng-options="preCond.id as preCond.nombre for preCond in precioCondiciones"> |
394 | </select> | 408 | </select> |
395 | </div> | 409 | </div> |
396 | </div> | 410 | </div> |
397 | <div class="col-md-2"> | 411 | <div class="col-md-2"> |
398 | <div class="col-auto"> | 412 | <div class="col-auto"> |
399 | <label>Producto</label> | 413 | <label>Producto</label> |
400 | </div> | 414 | </div> |
401 | </div> | 415 | </div> |
402 | <div class="col-md-4"> | 416 | <div class="col-md-4"> |
403 | <div class="col-auto"> | 417 | <div class="col-auto"> |
404 | <input type="text" class="form-control" placeholder="Seleccione producto" ng-model="notaPedido.producto" | 418 | <input type="text" class="form-control" placeholder="Seleccione producto" ng-model="notaPedido.producto" |
405 | ng-click="seleccionarArticulo()" readonly> | 419 | ng-click="seleccionarArticulo()" readonly> |
406 | </div> | 420 | </div> |
407 | </div> | 421 | </div> |
408 | </div> | 422 | </div> |
409 | <div class="col-md-12"> | 423 | <div class="col-md-12"> |
410 | <table class="table my-3 table-hover table-nonfluid"> | 424 | <table class="table my-3 table-hover table-nonfluid"> |
411 | <thead> | 425 | <thead> |
412 | <tr> | 426 | <tr> |
413 | <th>Código</th> | 427 | <th>Código</th> |
414 | <th>Nombre</th> | 428 | <th>Nombre</th> |
415 | <th>Precio unitario</th> | 429 | <th>Precio unitario</th> |
416 | <th>Costo unitario bruto</th> | 430 | <th>Costo unitario bruto</th> |
417 | <th>Cantidad</th> | 431 | <th>Cantidad</th> |
418 | <th>Subtotal</th> | 432 | <th>Subtotal</th> |
419 | </tr> | 433 | </tr> |
420 | </thead> | 434 | </thead> |
421 | <tbody> | 435 | <tbody> |
422 | <tr ng-repeat="articulo in articulosTabla"> | 436 | <tr ng-repeat="articulo in articulosTabla"> |