Commit a3d7762f9554e764fe516a1d7f37f51f31a64b44

Authored by Nicolás Guarnieri
Exists in master

merge

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 '"focaModalProveedor","focaBusquedaCliente","focaModalPrecioCondicion",'+ 47 '"focaModalProveedor","focaBusquedaCliente","focaModalPrecioCondicion",'+
48 '"focaModalFlete","focaDirectivas","focaModal","focaModalDomicilio"', ''), 48 '"focaModalFlete","focaDirectivas","focaModal","focaModalDomicilio",'+
49 '"angular-ladda"', ''),
49 gulp.dest(paths.dist) 50 gulp.dest(paths.dist)
50 ] 51 ]
51 ); 52 );
52 }); 53 });
53 54
54 gulp.task('clean', function(){ 55 gulp.task('clean', function(){
55 return gulp.src(['tmp', 'dist'], {read: false}) 56 return gulp.src(['tmp', 'dist'], {read: false})
56 .pipe(clean()); 57 .pipe(clean());
57 }); 58 });
58 59
59 gulp.task('pre-commit', function() { 60 gulp.task('pre-commit', function() {
60 return pump( 61 return pump(
61 [ 62 [
62 gulp.src(paths.srcJS), 63 gulp.src(paths.srcJS),
63 jshint('.jshintrc'), 64 jshint('.jshintrc'),
64 jshint.reporter('default'), 65 jshint.reporter('default'),
65 jshint.reporter('fail') 66 jshint.reporter('fail')
66 ] 67 ]
67 ); 68 );
68 69
69 gulp.start('uglify'); 70 gulp.start('uglify');
70 }); 71 });
71 72
72 gulp.task('webserver', function() { 73 gulp.task('webserver', function() {
73 pump [ 74 pump [
74 connect.server({port: 3300, host: '0.0.0.0'}) 75 connect.server({port: 3300, host: '0.0.0.0'})
75 ] 76 ]
76 }); 77 });
77 78
78 gulp.task('clean-post-install', function() { 79 gulp.task('clean-post-install', function() {
79 return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js', 80 return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js',
80 'index.html'], {read: false}) 81 'index.html'], {read: false})
81 .pipe(clean()); 82 .pipe(clean());
82 }); 83 });
83 84
84 gulp.task('default', ['webserver']); 85 gulp.task('default', ['webserver']);
85 86
86 gulp.task('watch', function() { 87 gulp.task('watch', function() {
87 gulp.watch([paths.srcJS, paths.srcViews], ['uglify']); 88 gulp.watch([paths.srcJS, paths.srcViews], ['uglify']);
88 }); 89 });
89 90
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 <link href="node_modules/ladda/dist/ladda-themeless.min.css" rel="stylesheet">
9 10
10 <!--VENDOR JS--> 11 <!--VENDOR JS-->
11 <script src="node_modules/jquery/dist/jquery.min.js"></script> 12 <script src="node_modules/jquery/dist/jquery.min.js"></script>
12 <script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script> 13 <script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
13 <script src="node_modules/angular/angular.min.js"></script> 14 <script src="node_modules/angular/angular.min.js"></script>
14 <script src="node_modules/angular-route/angular-route.min.js"></script> 15 <script src="node_modules/angular-route/angular-route.min.js"></script>
15 <script src="node_modules/ui-bootstrap4/dist/ui-bootstrap-tpls.js"></script> 16 <script src="node_modules/ui-bootstrap4/dist/ui-bootstrap-tpls.js"></script>
17 <script src="node_modules/ladda/dist/spin.min.js"></script>
18 <script src="node_modules/ladda/dist/ladda.min.js"></script>
19 <script src="node_modules/angular-ladda/dist/angular-ladda.min.js"></script>
16 20
17 <script src="node_modules/foca-directivas/dist/foca-directivas.min.js"></script> 21 <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> 22 <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> 23 <script src="node_modules/foca-modal-busqueda-productos/dist/foca-busqueda-productos.min.js"></script>
20 <script src="node_modules/foca-modal-proveedor/dist/foca-modal-proveedor.min.js"></script> 24 <script src="node_modules/foca-modal-proveedor/dist/foca-modal-proveedor.min.js"></script>
21 <script src="node_modules/foca-busqueda-cliente/dist/foca-busqueda-cliente.min.js"></script> 25 <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> 26 <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> 27 <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> 28 <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> 29 <script src="node_modules/foca-modal-domicilio/dist/foca-modal-domicilios.min.js"></script>
26 30
27 <script src="src/js/app.js"></script> 31 <script src="src/js/app.js"></script>
28 <script src="src/js/controller.js"></script> 32 <script src="src/js/controller.js"></script>
29 <script src="src/js/service.js"></script> 33 <script src="src/js/service.js"></script>
30 <script src="src/js/route.js"></script> 34 <script src="src/js/route.js"></script>
31 35
32 <script src="src/etc/develop.js"></script> 36 <script src="src/etc/develop.js"></script>
33 </head> 37 </head>
34 <body> 38 <body>
35 <div ng-view class="container-fluid"></div> 39 <div ng-view class="container-fluid"></div>
36 </body> 40 </body>
37 </html> 41 </html>
38 42
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-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" 11 "install-dev": "npm install -D jasmine-core pre-commit angular angular-ladda ladda@1.0.6 angular-route bootstrap ui-bootstrap4 font-awesome gulp gulp-angular-templatecache gulp-connect gulp-clean gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-sequence gulp-uglify-es gulp-uglify jquery jshint pump git+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"
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-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 }, 28 },
29 "devDependencies": { 29 "devDependencies": {
30 "angular": "^1.7.5", 30 "angular": "^1.7.5",
31 "angular-ladda": "^0.4.3",
31 "angular-route": "^1.7.5", 32 "angular-route": "^1.7.5",
32 "bootstrap": "^4.1.3", 33 "bootstrap": "^4.1.3",
33 "foca-busqueda-cliente": "git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git", 34 "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", 35 "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", 36 "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", 37 "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", 38 "foca-modal-domicilio": "git+https://debo.suite.repo/modulos-npm/foca-modal-domicilio.git",
38 "foca-modal-flete": "git+https://debo.suite.repo/modulos-npm/foca-modal-flete", 39 "foca-modal-flete": "git+https://debo.suite.repo/modulos-npm/foca-modal-flete",
39 "foca-modal-proveedor": "git+https://debo.suite.repo/modulos-npm/foca-modal-proveedor.git",
40 "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",
41 "foca-modal-proveedor": "git+https://debo.suite.repo/modulos-npm/foca-modal-proveedor.git",
41 "foca-modal-vendedores": "git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git", 42 "foca-modal-vendedores": "git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git",
42 "font-awesome": "^4.7.0", 43 "font-awesome": "^4.7.0",
43 "gulp": "^3.9.1", 44 "gulp": "^3.9.1",
44 "gulp-angular-templatecache": "2.2.2", 45 "gulp-angular-templatecache": "^2.2.2",
45 "gulp-clean": "^0.4.0", 46 "gulp-clean": "^0.4.0",
46 "gulp-concat": "^2.6.1", 47 "gulp-concat": "^2.6.1",
47 "gulp-connect": "^5.6.1", 48 "gulp-connect": "^5.6.1",
48 "gulp-htmlmin": "^5.0.1", 49 "gulp-htmlmin": "^5.0.1",
49 "gulp-jshint": "^2.1.0", 50 "gulp-jshint": "^2.1.0",
50 "gulp-rename": "^1.4.0", 51 "gulp-rename": "^1.4.0",
51 "gulp-replace": "^1.0.0", 52 "gulp-replace": "^1.0.0",
52 "gulp-sequence": "^1.0.0", 53 "gulp-sequence": "^1.0.0",
53 "gulp-uglify": "^3.0.1", 54 "gulp-uglify": "^3.0.1",
54 "gulp-uglify-es": "^1.0.4", 55 "gulp-uglify-es": "^1.0.4",
55 "jasmine-core": "^3.2.1", 56 "jasmine-core": "^3.3.0",
56 "jquery": "^3.3.1", 57 "jquery": "^3.3.1",
57 "jshint": "^2.9.6", 58 "jshint": "^2.9.6",
59 "ladda": "1.0.6",
58 "pre-commit": "^1.2.2", 60 "pre-commit": "^1.2.2",
59 "pump": "^3.0.0", 61 "pump": "^3.0.0",
60 "ui-bootstrap4": "^3.0.5" 62 "ui-bootstrap4": "^3.0.5"
61 } 63 }
62 } 64 }
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 'focaModalProveedor', 6 'focaModalProveedor',
7 'focaBusquedaCliente', 7 'focaBusquedaCliente',
8 'focaModalPrecioCondicion', 8 'focaModalPrecioCondicion',
9 'focaModalFlete', 9 'focaModalFlete',
10 'focaDirectivas', 10 'focaDirectivas',
11 'focaModal', 11 'focaModal',
12 'focaModalDomicilio' 12 'focaModalDomicilio',
13 'angular-ladda'
13 ]); 14 ]);
14 15
src/js/controller.js
1 angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', 1 angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl',
2 [ 2 [
3 '$scope', '$uibModal', '$location', '$filter', 'crearNotaPedidoService', 3 '$scope', '$uibModal', '$location', '$filter', 'crearNotaPedidoService',
4 'focaModalService', 4 'focaModalService',
5 function( 5 function(
6 $scope, $uibModal, $location, $filter, crearNotaPedidoService, focaModalService 6 $scope, $uibModal, $location, $filter, crearNotaPedidoService, focaModalService
7 ) { 7 ) {
8 $scope.botonera = [ 8 $scope.botonera = [
9 {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}}, 9 {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}},
10 {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}}, 10 {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}},
11 {texto: 'Proveedor', accion: function() {$scope.seleccionarProveedor();}}, 11 {texto: 'Proveedor', accion: function() {$scope.seleccionarProveedor();}},
12 {texto: 'Moneda', accion: function() {$scope.abrirModalMoneda();}}, 12 {texto: 'Moneda', accion: function() {$scope.abrirModalMoneda();}},
13 { 13 {
14 texto: 'Precios y condiciones', 14 texto: 'Precios y condiciones',
15 accion: function() {$scope.abrirModalListaPrecio();}}, 15 accion: function() {$scope.abrirModalListaPrecio();}},
16 {texto: 'Flete', accion: function() {$scope.abrirModalFlete();}}, 16 {texto: 'Flete', accion: function() {$scope.abrirModalFlete();}},
17 {texto: '', accion: function() {}}, 17 {texto: '', accion: function() {}},
18 {texto: '', accion: function() {}} 18 {texto: '', accion: function() {}}
19 ]; 19 ];
20 $scope.datepickerAbierto = false;
20 21
21 $scope.show = false; 22 $scope.show = false;
22 $scope.cargando = true; 23 $scope.cargando = true;
23 $scope.dateOptions = { 24 $scope.dateOptions = {
24 maxDate: new Date(), 25 maxDate: new Date(),
25 minDate: new Date(2010, 0, 1) 26 minDate: new Date(2010, 0, 1)
26 }; 27 };
27 28
28 $scope.notaPedido = { 29 $scope.notaPedido = {
29 vendedor: {}, 30 vendedor: {},
30 cliente: {}, 31 cliente: {},
31 domicilio: {dom: ''}, 32 domicilio: {dom: ''},
32 moneda: {detalle: ''} 33 moneda: {detalle: ''}
33 }; 34 };
34 35
35 $scope.cabecera = []; 36 $scope.cabecera = [];
36 $scope.showCabecera = true; 37 $scope.showCabecera = true;
37 38
38 $scope.now = new Date(); 39 $scope.now = new Date();
39 $scope.puntoVenta = Math.round(Math.random() * 10000); 40 $scope.puntoVenta = Math.round(Math.random() * 10000);
40 $scope.comprobante = Math.round(Math.random() * 1000000); 41 $scope.comprobante = Math.round(Math.random() * 1000000);
41 42
42 $scope.articulosTabla = []; 43 $scope.articulosTabla = [];
43 var idLista; 44 $scope.idLista = undefined;
44 var notaPedidoTemp = crearNotaPedidoService.getNotaPedido(); 45 var notaPedidoTemp = crearNotaPedidoService.getNotaPedido();
45 crearNotaPedidoService.getPrecioCondicion().then( 46 crearNotaPedidoService.getPrecioCondicion().then(
46 function(res) { 47 function(res) {
47 $scope.precioCondiciones = res.data; 48 $scope.precioCondiciones = res.data;
48 } 49 }
49 ); 50 );
50 if (notaPedidoTemp !== undefined) { 51 if (notaPedidoTemp !== undefined) {
51 notaPedidoTemp.fechaCarga = new Date(notaPedidoTemp.fechaCarga); 52 notaPedidoTemp.fechaCarga = new Date(notaPedidoTemp.fechaCarga);
52 $scope.notaPedido = notaPedidoTemp; 53 $scope.notaPedido = notaPedidoTemp;
53 $scope.notaPedido.flete = ($scope.notaPedido.flete).toString(); 54 $scope.notaPedido.flete = ($scope.notaPedido.flete).toString();
54 $scope.notaPedido.bomba = ($scope.notaPedido.bomba).toString(); 55 $scope.notaPedido.bomba = ($scope.notaPedido.bomba).toString();
55 idLista = $scope.notaPedido.precioCondicion; 56 $scope.idLista = $scope.notaPedido.precioCondicion;
56 crearNotaPedidoService 57 crearNotaPedidoService
57 .getArticulosByIdNotaPedido($scope.notaPedido.id).then( 58 .getArticulosByIdNotaPedido($scope.notaPedido.id).then(
58 function(res) { 59 function(res) {
59 $scope.articulosTabla = res.data; 60 $scope.articulosTabla = res.data;
60 } 61 }
61 ); 62 );
62 //TODO DOMICILIOS QUE SE CARGAN AL EDITAR NOTA DE PEDIDO 63 //TODO DOMICILIOS QUE SE CARGAN AL EDITAR NOTA DE PEDIDO
63 //(NO REQUERIDO EN ESTA VERSION) 64 //(NO REQUERIDO EN ESTA VERSION)
64 // crearNotaPedidoService.getDomiciliosByIdNotaPedido($scope.notaPedido.id).then( 65 // crearNotaPedidoService.getDomiciliosByIdNotaPedido($scope.notaPedido.id).then(
65 // function(res) { 66 // function(res) {
66 // $scope.notaPedido.domicilio = res.data; 67 // $scope.notaPedido.domicilio = res.data;
67 // } 68 // }
68 // ); 69 // );
69 } else { 70 } else {
70 $scope.notaPedido.fechaCarga = new Date(); 71 $scope.notaPedido.fechaCarga = new Date();
71 $scope.notaPedido.bomba = '0'; 72 $scope.notaPedido.bomba = '0';
72 $scope.notaPedido.flete = '0'; 73 $scope.notaPedido.flete = '0';
73 idLista = undefined; 74 $scope.idLista = undefined;
74 } 75 }
75 //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO 76 //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO
76 // $scope.addNewDom = function() { 77 // $scope.addNewDom = function() {
77 // $scope.notaPedido.domicilio.push({ 'id': 0 }); 78 // $scope.notaPedido.domicilio.push({ 'id': 0 });
78 // }; 79 // };
79 // $scope.removeNewChoice = function(choice) { 80 // $scope.removeNewChoice = function(choice) {
80 // if ($scope.notaPedido.domicilio.length > 1) { 81 // if ($scope.notaPedido.domicilio.length > 1) {
81 // $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex( 82 // $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex(
82 // function(c) { 83 // function(c) {
83 // return c.$$hashKey === choice.$$hashKey; 84 // return c.$$hashKey === choice.$$hashKey;
84 // } 85 // }
85 // ), 1); 86 // ), 1);
86 // } 87 // }
87 // }; 88 // };
88 $scope.crearNotaPedido = function() { 89 $scope.crearNotaPedido = function() {
89 if($scope.articulosTabla.length === 0) { 90 if($scope.articulosTabla.length === 0) {
90 focaModalService.alert('Debe cargar almenos un articulo'); 91 focaModalService.alert('Debe cargar almenos un articulo');
91 return; 92 return;
92 } 93 }
93 if($scope.notaPedido.domicilio.id === undefined) { 94 if($scope.notaPedido.domicilio.id === undefined) {
94 $scope.notaPedido.domicilio.id = 0; 95 $scope.notaPedido.domicilio.id = 0;
95 } 96 }
96 var date = new Date(); 97 var date = new Date();
97 var notaPedido = { 98 var notaPedido = {
98 id: 0, 99 id: 0,
99 fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) 100 fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000))
100 .toISOString().slice(0, 19).replace('T', ' '), 101 .toISOString().slice(0, 19).replace('T', ' '),
101 vendedor: $scope.notaPedido.vendedor.nombre, 102 vendedor: $scope.notaPedido.vendedor.nombre,
102 idCliente: $scope.notaPedido.cliente.id, 103 idCliente: $scope.notaPedido.cliente.id,
103 domicilio: $scope.notaPedido.domicilio, 104 domicilio: $scope.notaPedido.domicilio,
104 precioCondicion: $scope.notaPedido.precioCondicion,
105 bomba: $scope.notaPedido.bomba, 105 bomba: $scope.notaPedido.bomba,
106 flete: $scope.notaPedido.flete, 106 flete: $scope.notaPedido.flete,
107 total: $scope.getTotal() 107 total: $scope.getTotal()
108 }; 108 };
109 crearNotaPedidoService.crearNotaPedido(notaPedido).then( 109 crearNotaPedidoService.crearNotaPedido(notaPedido).then(
110 function(data) { 110 function(data) {
111 focaModalService.alert('Nota pedido creada');
112 if($scope.notaPedido.flete === 1) { 111 if($scope.notaPedido.flete === 1) {
113 var flete = { 112 var flete = {
114 idNotaPedido: data.data.id, 113 idNotaPedido: data.data.id,
115 idTransportista: $scope.notaPedido.fleteId, 114 idTransportista: $scope.notaPedido.fleteId,
116 idChofer: $scope.notaPedido.chofer.id, 115 idChofer: $scope.notaPedido.chofer.id,
117 idVehiculo: $scope.notaPedido.vehiculo.id, 116 idVehiculo: $scope.notaPedido.vehiculo.id,
118 kilometros: $scope.notaPedido.kilometros, 117 kilometros: $scope.notaPedido.kilometros,
119 costoKilometro: $scope.notaPedido.costoUnitarioKmFlete 118 costoKilometro: $scope.notaPedido.costoUnitarioKmFlete
120 }; 119 };
121 crearNotaPedidoService.crearFlete(flete); 120 crearNotaPedidoService.crearFlete(flete);
122 } 121 }
123 var articulosNotaPedido = $scope.articulosTabla; 122 var articulosNotaPedido = $scope.articulosTabla;
124 for(var i = 0; i < articulosNotaPedido.length; i++) { 123 for(var i = 0; i < articulosNotaPedido.length; i++) {
125 delete articulosNotaPedido[i].edit; 124 delete articulosNotaPedido[i].editCantidad;
125 delete articulosNotaPedido[i].editPrecio;
126 articulosNotaPedido[i].idNotaPedido = data.data.id; 126 articulosNotaPedido[i].idNotaPedido = data.data.id;
127 crearNotaPedidoService 127 crearNotaPedidoService
128 .crearArticulosParaNotaPedido(articulosNotaPedido[i]); 128 .crearArticulosParaNotaPedido(articulosNotaPedido[i]);
129 } 129 }
130 var plazos = $scope.plazosPagos;
131 for(var j = 0; j < plazos.length; j++) {
132 var json = {
133 idPedido: data.data.id,
134 dias: plazos[j].dias
135 };
136 crearNotaPedidoService.crearPlazosParaNotaPedido(json);
137 }
138 focaModalService.alert('Nota pedido creada');
130 $scope.limpiarPantalla(); 139 $scope.limpiarPantalla();
131 } 140 }
132 ); 141 );
133 }; 142 };
134 143
135 $scope.seleccionarArticulo = function() { 144 $scope.seleccionarArticulo = function() {
136 if (idLista === undefined) { 145 if ($scope.idLista === undefined) {
137 focaModalService.alert( 146 focaModalService.alert(
138 'Primero seleccione una lista de precio y condicion'); 147 'Primero seleccione una lista de precio y condicion');
139 return; 148 return;
140 } 149 }
141 var modalInstance = $uibModal.open( 150 var modalInstance = $uibModal.open(
142 { 151 {
143 ariaLabelledBy: 'Busqueda de Productos', 152 ariaLabelledBy: 'Busqueda de Productos',
144 templateUrl: 'modal-busqueda-productos.html', 153 templateUrl: 'modal-busqueda-productos.html',
145 controller: 'modalBusquedaProductosCtrl', 154 controller: 'modalBusquedaProductosCtrl',
146 resolve: { idLista: function() { return idLista; } }, 155 resolve: { idLista: function() { return $scope.idLista; } },
147 size: 'lg' 156 size: 'lg'
148 } 157 }
149 ); 158 );
150 modalInstance.result.then( 159 modalInstance.result.then(
151 function(producto) { 160 function(producto) {
152 var newArt = 161 var newArt =
153 { 162 {
154 id: 0, 163 id: 0,
155 codigo: producto.codigo, 164 codigo: producto.codigo,
156 sector: producto.sector, 165 sector: producto.sector,
157 sectorCodigo: producto.sector + '-' + producto.codigo, 166 sectorCodigo: producto.sector + '-' + producto.codigo,
158 descripcion: producto.descripcion, 167 descripcion: producto.descripcion,
159 item: $scope.articulosTabla.length + 1, 168 item: $scope.articulosTabla.length + 1,
160 nombre: producto.descripcion, 169 nombre: producto.descripcion,
161 precio: producto.precio.toFixed(2), 170 precio: parseFloat(producto.precio.toFixed(2)),
162 costoUnitario: producto.costo, 171 costoUnitario: producto.costo,
163 edit: false 172 editCantidad: false,
173 editPrecio: false
164 }; 174 };
165 $scope.articuloACargar = newArt; 175 $scope.articuloACargar = newArt;
166 $scope.cargando = false; 176 $scope.cargando = false;
167 }, function() { 177 }, function() {
168 // funcion ejecutada cuando se cancela el modal 178 // funcion ejecutada cuando se cancela el modal
169 } 179 }
170 ); 180 );
171 }; 181 };
172 182
173 $scope.seleccionarVendedor = function() { 183 $scope.seleccionarVendedor = function() {
174 var modalInstance = $uibModal.open( 184 var modalInstance = $uibModal.open(
175 { 185 {
176 ariaLabelledBy: 'Busqueda de Vendedores', 186 ariaLabelledBy: 'Busqueda de Vendedores',
177 templateUrl: 'modal-vendedores.html', 187 templateUrl: 'modal-vendedores.html',
178 controller: 'modalVendedoresCtrl', 188 controller: 'modalVendedoresCtrl',
179 size: 'lg' 189 size: 'lg'
180 } 190 }
181 ); 191 );
182 modalInstance.result.then( 192 modalInstance.result.then(
183 function(vendedor) { 193 function(vendedor) {
184 addCabecera('Vendedor:', vendedor.NomVen); 194 addCabecera('Vendedor:', vendedor.NomVen);
185 $scope.notaPedido.vendedor.nombre = vendedor.NomVen; 195 $scope.notaPedido.vendedor.nombre = vendedor.NomVen;
186 }, function() { 196 }, function() {
187 197
188 } 198 }
189 ); 199 );
190 }; 200 };
191 201
192 $scope.seleccionarProveedor = function() { 202 $scope.seleccionarProveedor = function() {
193 var modalInstance = $uibModal.open( 203 var modalInstance = $uibModal.open(
194 { 204 {
195 ariaLabelledBy: 'Busqueda de Proveedor', 205 ariaLabelledBy: 'Busqueda de Proveedor',
196 templateUrl: 'modal-proveedor.html', 206 templateUrl: 'modal-proveedor.html',
197 controller: 'focaModalProveedorCtrl', 207 controller: 'focaModalProveedorCtrl',
198 size: 'lg' 208 size: 'lg'
199 } 209 }
200 ); 210 );
201 modalInstance.result.then( 211 modalInstance.result.then(
202 function(proveedor) { 212 function(proveedor) {
203 $scope.notaPedido.proveedor = proveedor.NOM; 213 $scope.notaPedido.proveedor = proveedor.NOM;
204 addCabecera('Proveedor:', proveedor.NOM); 214 addCabecera('Proveedor:', proveedor.NOM);
205 }, function() { 215 }, function() {
206 216
207 } 217 }
208 ); 218 );
209 }; 219 };
210 220
211 $scope.seleccionarCliente = function() { 221 $scope.seleccionarCliente = function() {
212 var modalInstance = $uibModal.open( 222 var modalInstance = $uibModal.open(
213 { 223 {
214 ariaLabelledBy: 'Busqueda de Cliente', 224 ariaLabelledBy: 'Busqueda de Cliente',
215 templateUrl: 'foca-busqueda-cliente-modal.html', 225 templateUrl: 'foca-busqueda-cliente-modal.html',
216 controller: 'focaBusquedaClienteModalController', 226 controller: 'focaBusquedaClienteModalController',
217 size: 'lg' 227 size: 'lg'
218 } 228 }
219 ); 229 );
220 modalInstance.result.then( 230 modalInstance.result.then(
221 function(cliente) { 231 function(cliente) {
222 $scope.notaPedido.cliente.nombre = cliente.nom; 232 $scope.notaPedido.cliente.nombre = cliente.nom;
223 $scope.notaPedido.cliente.id = cliente.cod; 233 $scope.notaPedido.cliente.id = cliente.cod;
224 crearNotaPedidoService.getDomiciliosByIdCliente(cliente.cod).then( 234 crearNotaPedidoService.getDomiciliosByIdCliente(cliente.cod).then(
225 function(data) { 235 function(data) {
226 if(data.data.length === 0){ 236 if(data.data.length === 0){
227 focaModalService 237 focaModalService
228 .alert('El cliente no tienen domicilios de entrega') 238 .alert('El cliente no tienen domicilios de entrega')
229 .then( 239 .then(
230 function() { 240 function() {
231 $scope.seleccionarCliente(); 241 $scope.seleccionarCliente();
232 $scope.notaPedido.cliente = {nombre: ''}; 242 $scope.notaPedido.cliente = {nombre: ''};
233 } 243 }
234 ); 244 );
235 return; 245 return;
236 } 246 }
237 var modalInstanceDomicilio = $uibModal.open( 247 var modalInstanceDomicilio = $uibModal.open(
238 { 248 {
239 ariaLabelledBy: 'Busqueda de Domicilios', 249 ariaLabelledBy: 'Busqueda de Domicilios',
240 templateUrl: 'modal-domicilio.html', 250 templateUrl: 'modal-domicilio.html',
241 controller: 'focaModalDomicilioController', 251 controller: 'focaModalDomicilioController',
242 resolve: { idCliente: function() { return cliente.cod; }}, 252 resolve: { idCliente: function() { return cliente.cod; }},
243 size: 'lg', 253 size: 'lg',
244 backdrop: 'static', 254 backdrop: 'static',
245 } 255 }
246 ); 256 );
247 modalInstanceDomicilio.result.then( 257 modalInstanceDomicilio.result.then(
248 function(domicilio) { 258 function(domicilio) {
249 focaModalService.alert('Domicilio elegido' + domicilio.dom); 259 focaModalService.alert('Domicilio elegido' + domicilio.dom);
250 }, function() { 260 }, function() {
251 $scope.notaPedido.cliente.nombre = ''; 261 $scope.notaPedido.cliente.nombre = '';
252 $scope.notaPedido.cliente.id = ''; 262 $scope.notaPedido.cliente.id = '';
253 removeCabecera('Cliente:'); 263 removeCabecera('Cliente:');
254 $scope.seleccionarCliente(); 264 $scope.seleccionarCliente();
255 return; 265 return;
256 } 266 }
257 ); 267 );
258 } 268 }
259 ); 269 );
260 addCabecera('Cliente:', cliente.nom); 270 addCabecera('Cliente:', cliente.nom);
261 }, function() { 271 }, function() {
262 272
263 } 273 }
264 ); 274 );
265 }; 275 };
266 276
267 $scope.mostrarFichaCliente = function() { 277 $scope.mostrarFichaCliente = function() {
268 $uibModal.open( 278 $uibModal.open(
269 { 279 {
270 ariaLabelledBy: 'Datos del Cliente', 280 ariaLabelledBy: 'Datos del Cliente',
271 templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html', 281 templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html',
272 controller: 'focaCrearNotaPedidoFichaClienteController', 282 controller: 'focaCrearNotaPedidoFichaClienteController',
273 size: 'lg' 283 size: 'lg'
274 } 284 }
275 ); 285 );
276 }; 286 };
277 287
278 $scope.getTotal = function() { 288 $scope.getTotal = function() {
279 var total = 0; 289 var total = 0;
280 var arrayTempArticulos = $scope.articulosTabla; 290 var arrayTempArticulos = $scope.articulosTabla;
281 for (var i = 0; i < arrayTempArticulos.length; i++) { 291 for (var i = 0; i < arrayTempArticulos.length; i++) {
282 total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; 292 total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad;
283 } 293 }
284 return total.toFixed(2); 294 return total.toFixed(2);
285 }; 295 };
286 296
287 $scope.getSubTotal = function() { 297 $scope.getSubTotal = function() {
288 if($scope.articuloACargar) { 298 if($scope.articuloACargar) {
289 return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; 299 return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad;
290 } 300 }
291 }; 301 };
292 302
293 $scope.abrirModalListaPrecio = function() { 303 $scope.abrirModalListaPrecio = function() {
294 var modalInstance = $uibModal.open( 304 var modalInstance = $uibModal.open(
295 { 305 {
296 ariaLabelledBy: 'Busqueda de Precio Condición', 306 ariaLabelledBy: 'Busqueda de Precio Condición',
297 templateUrl: 'modal-precio-condicion.html', 307 templateUrl: 'modal-precio-condicion.html',
298 controller: 'focaModalPrecioCondicionController', 308 controller: 'focaModalPrecioCondicionController',
299 size: 'lg' 309 size: 'lg'
300 } 310 }
301 ); 311 );
302 modalInstance.result.then( 312 modalInstance.result.then(
303 function(precioCondicion) { 313 function(precioCondicion) {
304 $scope.notaPedido.precioCondicion = precioCondicion.nombre; 314 var cabecera = '';
305 idLista = precioCondicion.idListaPrecio; 315 var plazosConcat = '';
316 if(!Array.isArray(precioCondicion)) {
317 $scope.plazosPagos = precioCondicion.plazoPago;
318 $scope.idLista = precioCondicion.idListaPrecio;
319 for(var i = 0; i < precioCondicion.plazoPago.length; i++) {
320 plazosConcat += precioCondicion.plazoPago[i].dias + ' ';
321 }
322 cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim();
323 } else { //Cuando se ingresan los plazos manualmente
324 $scope.idLista = -1; //-1, el modal productos busca todos los productos
325 $scope.plazosPagos = precioCondicion;
326 for(var j = 0; j < precioCondicion.length; j++) {
327 plazosConcat += precioCondicion[j].dias + ' ';
328 }
329 cabecera = 'Ingreso manual ' + plazosConcat.trim();
330 }
306 $scope.articulosTabla = []; 331 $scope.articulosTabla = [];
307 332 addCabecera('Precios y condiciones:', cabecera);
308 addCabecera('Precios y condiciones:', precioCondicion.nombre);
309 }, function() { 333 }, function() {
310 334
311 } 335 }
312 ); 336 );
313 }; 337 };
314 338
315 $scope.abrirModalFlete = function() { 339 $scope.abrirModalFlete = function() {
316 var modalInstance = $uibModal.open( 340 var modalInstance = $uibModal.open(
317 { 341 {
318 ariaLabelledBy: 'Busqueda de Flete', 342 ariaLabelledBy: 'Busqueda de Flete',
319 templateUrl: 'modal-flete.html', 343 templateUrl: 'modal-flete.html',
320 controller: 'focaModalFleteController', 344 controller: 'focaModalFleteController',
321 size: 'lg', 345 size: 'lg',
322 resolve: { 346 resolve: {
323 parametrosFlete: 347 parametrosFlete:
324 function() { 348 function() {
325 return { 349 return {
326 flete: $scope.notaPedido.flete, 350 flete: $scope.notaPedido.flete,
327 bomba: $scope.notaPedido.bomba, 351 bomba: $scope.notaPedido.bomba,
328 kilometros: $scope.notaPedido.kilometros 352 kilometros: $scope.notaPedido.kilometros
329 }; 353 };
330 } 354 }
331 } 355 }
332 } 356 }
333 ); 357 );
334 modalInstance.result.then( 358 modalInstance.result.then(
335 function(datos) { 359 function(datos) {
336 $scope.notaPedido.flete = datos.flete; 360 $scope.notaPedido.flete = datos.flete;
337 $scope.notaPedido.bomba = datos.bomba; 361 $scope.notaPedido.bomba = datos.bomba;
338 $scope.notaPedido.kilometros = datos.kilometros; 362 $scope.notaPedido.kilometros = datos.kilometros;
339 363
340 addCabecera('Flete:', datos.flete); 364 addCabecera('Flete:', datos.flete);
341 if(datos.flete === 'si') { 365 if(datos.flete === 'si') {
342 addCabecera('Bomba:', datos.bomba); 366 addCabecera('Bomba:', datos.bomba);
343 addCabecera('Kilometros:', datos.kilometros); 367 addCabecera('Kilometros:', datos.kilometros);
344 } else { 368 } else {
345 removeCabecera('Bomba:'); 369 removeCabecera('Bomba:');
346 removeCabecera('Kilometros:'); 370 removeCabecera('Kilometros:');
347 } 371 }
348 }, function() { 372 }, function() {
349 373
350 } 374 }
351 ); 375 );
352 }; 376 };
353 377
354 $scope.abrirModalMoneda = function() { 378 $scope.abrirModalMoneda = function() {
355 var modalInstance = $uibModal.open( 379 var modalInstance = $uibModal.open(
356 { 380 {
357 ariaLabelledBy: 'Busqueda de Moneda', 381 ariaLabelledBy: 'Busqueda de Moneda',
358 templateUrl: 'modal-moneda.html', 382 templateUrl: 'modal-moneda.html',
359 controller: 'focaModalMonedaController', 383 controller: 'focaModalMonedaController',
360 size: 'lg' 384 size: 'lg'
361 } 385 }
362 ); 386 );
363 modalInstance.result.then( 387 modalInstance.result.then(
364 function(moneda) { 388 function(moneda) {
365 $scope.notaPedido.moneda = { 389 $scope.notaPedido.moneda = {
366 id: moneda.ID, 390 id: moneda.ID,
367 detalle: moneda.DETALLE, 391 detalle: moneda.DETALLE,
368 simbolo: moneda.SIMBOLO 392 simbolo: moneda.SIMBOLO
369 }; 393 };
370 394
371 addCabecera('Moneda:', moneda.DETALLE); 395 addCabecera('Moneda:', moneda.DETALLE);
396 $scope.abrirModalCotizacion(moneda.ID);
397 }, function() {
398
399 }
400 );
401 };
402
403 $scope.abrirModalCotizacion = function(idMoneda) {
404 var modalInstance = $uibModal.open(
405 {
406 ariaLabelledBy: 'Busqueda de Cotización',
407 templateUrl: 'modal-cotizacion.html',
408 controller: 'focaModalCotizacionController',
409 size: 'lg',
410 resolve: {idMoneda: function() {return idMoneda;}}
411 }
412 );
413 modalInstance.result.then(
414 function(cotizacion) {
415 $scope.notaPedido.cotizacion = {
416 id: cotizacion.ID,
417 cotizacion: cotizacion.COTIZACION
418 };
419
420 addCabecera(
421 'Fecha cotizacion:',
422 $filter('date')(cotizacion.FECHA, 'dd/MM/yyyy')
423 );
424 addCabecera('Cotizacion:', cotizacion.COTIZACION);
372 }, function() { 425 }, function() {
373 426
374 } 427 }
375 ); 428 );
376 }; 429 };
377 430
378 $scope.agregarATabla = function(key) { 431 $scope.agregarATabla = function(key) {
379 if(key === 13) { 432 if(key === 13) {
380 if($scope.articuloACargar.cantidad === undefined || 433 if($scope.articuloACargar.cantidad === undefined ||
381 $scope.articuloACargar.cantidad === 0 || 434 $scope.articuloACargar.cantidad === 0 ||
382 $scope.articuloACargar.cantidad === null ){ 435 $scope.articuloACargar.cantidad === null ){
383 focaModalService.alert('El valor debe ser al menos 1'); 436 focaModalService.alert('El valor debe ser al menos 1');
384 return; 437 return;
385 } 438 }
386 delete $scope.articuloACargar.sectorCodigo; 439 delete $scope.articuloACargar.sectorCodigo;
387 $scope.articulosTabla.push($scope.articuloACargar); 440 $scope.articulosTabla.push($scope.articuloACargar);
388 $scope.cargando = true; 441 $scope.cargando = true;
389 } 442 }
390 }; 443 };
391 444
392 $scope.quitarArticulo = function(key) { 445 $scope.quitarArticulo = function(key) {
393 $scope.articulosTabla.splice(key, 1); 446 $scope.articulosTabla.splice(key, 1);
394 }; 447 };
395 448
396 $scope.editarArticulo = function(key, articulo) { 449 $scope.editarArticulo = function(key, articulo) {
397 if(key === 13) { 450 if(key === 13) {
398 if(articulo.cantidad === null || articulo.cantidad === 0 || 451 if(articulo.cantidad === null || articulo.cantidad === 0 ||
399 articulo.cantidad === undefined){ 452 articulo.cantidad === undefined){
400 focaModalService.alert('El valor debe ser al menos 1'); 453 focaModalService.alert('El valor debe ser al menos 1');
401 return; 454 return;
402 } 455 }
403 articulo.edit = false; 456 articulo.editCantidad = false;
457 articulo.editPrecio = false;
404 } 458 }
405 }; 459 };
406 460
407 $scope.cambioEdit = function(articulo) { 461 $scope.cambioEdit = function(articulo, propiedad) {
408 articulo.edit = true; 462 if(propiedad === 'cantidad') {
463 articulo.editCantidad = true;
464 } else if(propiedad === 'precio') {
465 articulo.editPrecio = true;
466 }
409 }; 467 };
410 468
411 $scope.limpiarFlete = function() { 469 $scope.limpiarFlete = function() {
412 $scope.notaPedido.fleteNombre = ''; 470 $scope.notaPedido.fleteNombre = '';
413 $scope.notaPedido.chofer = ''; 471 $scope.notaPedido.chofer = '';
414 $scope.notaPedido.vehiculo = ''; 472 $scope.notaPedido.vehiculo = '';
415 $scope.notaPedido.kilometros = ''; 473 $scope.notaPedido.kilometros = '';
416 $scope.notaPedido.costoUnitarioKmFlete = ''; 474 $scope.notaPedido.costoUnitarioKmFlete = '';
417 $scope.choferes = ''; 475 $scope.choferes = '';
418 $scope.vehiculos = ''; 476 $scope.vehiculos = '';
419 }; 477 };
420 478
421 $scope.limpiarPantalla = function() { 479 $scope.limpiarPantalla = function() {
422 $scope.limpiarFlete(); 480 $scope.limpiarFlete();
423 $scope.notaPedido.flete = '0'; 481 $scope.notaPedido.flete = '0';
424 $scope.notaPedido.bomba = '0'; 482 $scope.notaPedido.bomba = '0';
425 $scope.notaPedido.precioCondicion = ''; 483 $scope.notaPedido.precioCondicion = '';
426 $scope.articulosTabla = []; 484 $scope.articulosTabla = [];
427 $scope.notaPedido.vendedor.nombre = ''; 485 $scope.notaPedido.vendedor.nombre = '';
428 $scope.notaPedido.cliente = {nombre: ''}; 486 $scope.notaPedido.cliente = {nombre: ''};
429 $scope.notaPedido.domicilio = {dom: ''}; 487 $scope.notaPedido.domicilio = {dom: ''};
430 $scope.domiciliosCliente = []; 488 $scope.domiciliosCliente = [];
431 }; 489 };
432 490
433 $scope.resetFilter = function() { 491 $scope.resetFilter = function() {
434 $scope.articuloACargar = {}; 492 $scope.articuloACargar = {};
435 $scope.cargando = true; 493 $scope.cargando = true;
436 }; 494 };
437 495
438 $scope.selectFocus = function($event) { 496 $scope.selectFocus = function($event) {
439 $event.target.select(); 497 $event.target.select();
440 }; 498 };
441 499
442 $scope.salir = function() { 500 $scope.salir = function() {
443 $location.path('/'); 501 $location.path('/');
444 }; 502 };
445 503
446 function addCabecera(label, valor) { 504 function addCabecera(label, valor) {
447 var propiedad = $filter('filter')($scope.cabecera, {label: label}); 505 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true);
448 if(propiedad.length === 1) { 506 if(propiedad.length === 1) {
449 propiedad[0].valor = valor; 507 propiedad[0].valor = valor;
450 } else { 508 } else {
451 $scope.cabecera.push({label: label, valor: valor}); 509 $scope.cabecera.push({label: label, valor: valor});
452 } 510 }
453 } 511 }
454 512
455 function removeCabecera(label) { 513 function removeCabecera(label) {
456 var propiedad = $filter('filter')($scope.cabecera, {label: label}); 514 var propiedad = $filter('filter')($scope.cabecera, {label: label}, true);
457 if(propiedad.length === 1){ 515 if(propiedad.length === 1){
458 $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); 516 $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1);
459 } 517 }
460 } 518 }
461 } 519 }
462 ] 520 ]
463 ) 521 )
464 .controller('notaPedidoListaCtrl', [ 522 .controller('notaPedidoListaCtrl', [
465 '$scope', 523 '$scope',
466 'crearNotaPedidoService', 524 'crearNotaPedidoService',
467 '$location', 525 '$location',
468 function($scope, crearNotaPedidoService, $location) { 526 function($scope, crearNotaPedidoService, $location) {
469 crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { 527 crearNotaPedidoService.obtenerNotaPedido().then(function(datos) {
470 $scope.notaPedidos = datos.data; 528 $scope.notaPedidos = datos.data;
471 }); 529 });
472 $scope.editar = function(notaPedido) { 530 $scope.editar = function(notaPedido) {
473 crearNotaPedidoService.setNotaPedido(notaPedido); 531 crearNotaPedidoService.setNotaPedido(notaPedido);
474 $location.path('/venta-nota-pedido/abm/'); 532 $location.path('/venta-nota-pedido/abm/');
475 }; 533 };
476 $scope.crearPedido = function() { 534 $scope.crearPedido = function() {
477 crearNotaPedidoService.clearNotaPedido(); 535 crearNotaPedidoService.clearNotaPedido();
478 $location.path('/venta-nota-pedido/abm/'); 536 $location.path('/venta-nota-pedido/abm/');
479 }; 537 };
480 } 538 }
481 ]) 539 ])
482 .controller('focaCrearNotaPedidoFichaClienteController', [ 540 .controller('focaCrearNotaPedidoFichaClienteController', [
483 '$scope', 541 '$scope',
484 'crearNotaPedidoService', 542 'crearNotaPedidoService',
485 '$location', 543 '$location',
486 function($scope, crearNotaPedidoService, $location) { 544 function($scope, crearNotaPedidoService, $location) {
487 crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { 545 crearNotaPedidoService.obtenerNotaPedido().then(function(datos) {
488 $scope.notaPedidos = datos.data; 546 $scope.notaPedidos = datos.data;
489 }); 547 });
490 $scope.editar = function(notaPedido) { 548 $scope.editar = function(notaPedido) {
491 crearNotaPedidoService.setNotaPedido(notaPedido); 549 crearNotaPedidoService.setNotaPedido(notaPedido);
492 $location.path('/venta-nota-pedido/abm/'); 550 $location.path('/venta-nota-pedido/abm/');
493 }; 551 };
494 $scope.crearPedido = function() { 552 $scope.crearPedido = function() {
495 crearNotaPedidoService.clearNotaPedido(); 553 crearNotaPedidoService.clearNotaPedido();
496 $location.path('/venta-nota-pedido/abm/'); 554 $location.path('/venta-nota-pedido/abm/');
497 }; 555 };
1 angular.module('focaCrearNotaPedido') 1 angular.module('focaCrearNotaPedido')
2 .service('crearNotaPedidoService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { 2 .service('crearNotaPedidoService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) {
3 var route = API_ENDPOINT.URL; 3 var route = API_ENDPOINT.URL;
4 return { 4 return {
5 crearNotaPedido: function(notaPedido) { 5 crearNotaPedido: function(notaPedido) {
6 return $http.post(route + '/nota-pedido', {notaPedido: notaPedido}); 6 return $http.post(route + '/nota-pedido', {notaPedido: notaPedido});
7 }, 7 },
8 obtenerNotaPedido: function() { 8 obtenerNotaPedido: function() {
9 return $http.get(route +'/nota-pedido'); 9 return $http.get(route +'/nota-pedido');
10 }, 10 },
11 setNotaPedido: function(notaPedido) { 11 setNotaPedido: function(notaPedido) {
12 this.notaPedido = notaPedido; 12 this.notaPedido = notaPedido;
13 }, 13 },
14 clearNotaPedido: function() { 14 clearNotaPedido: function() {
15 this.notaPedido = undefined; 15 this.notaPedido = undefined;
16 }, 16 },
17 getNotaPedido: function() { 17 getNotaPedido: function() {
18 return this.notaPedido; 18 return this.notaPedido;
19 }, 19 },
20 getArticulosByIdNotaPedido: function(id) { 20 getArticulosByIdNotaPedido: function(id) {
21 return $http.get(route+'/articulos/nota-pedido/'+id); 21 return $http.get(route+'/articulos/nota-pedido/'+id);
22 }, 22 },
23 crearArticulosParaNotaPedido: function(articuloNotaPedido) { 23 crearArticulosParaNotaPedido: function(articuloNotaPedido) {
24 return $http.post(route + '/articulos/nota-pedido', 24 return $http.post(route + '/articulos/nota-pedido',
25 {articuloNotaPedido: articuloNotaPedido}); 25 {articuloNotaPedido: articuloNotaPedido});
26 }, 26 },
27 getDomiciliosByIdNotaPedido: function(id) { 27 getDomiciliosByIdNotaPedido: function(id) {
28 return $http.get(route +'/nota-pedido/'+id+'/domicilios'); 28 return $http.get(route +'/nota-pedido/'+id+'/domicilios');
29 }, 29 },
30 getDomiciliosByIdCliente: function(id) { 30 getDomiciliosByIdCliente: function(id) {
31 var idTipoEntrega = 2;//Solo traigo los domicilios que tienen tipo 2 (tipo entrega) 31 var idTipoEntrega = 2;//Solo traigo los domicilios que tienen tipo 2 (tipo entrega)
32 return $http.get(route + '/domicilio/tipo/' + idTipoEntrega + '/cliente/' + id ); 32 return $http.get(route + '/domicilio/tipo/' + idTipoEntrega + '/cliente/' + id );
33 }, 33 },
34 getPrecioCondicion: function() { 34 getPrecioCondicion: function() {
35 return $http.get(route + '/precio-condicion'); 35 return $http.get(route + '/precio-condicion');
36 }, 36 },
37 getPrecioCondicionById: function(id) { 37 getPrecioCondicionById: function(id) {
38 return $http.get(route + '/precio-condicion/' + id); 38 return $http.get(route + '/precio-condicion/' + id);
39 }, 39 },
40 getPlazoPagoByPrecioCondicion: function(id) { 40 getPlazoPagoByPrecioCondicion: function(id) {
41 return $http.get(route + '/plazo-pago/precio-condicion/'+ id); 41 return $http.get(route + '/plazo-pago/precio-condicion/'+ id);
42 }, 42 },
43 crearFlete: function(flete) { 43 crearFlete: function(flete) {
44 return $http.post(route + '/flete', {flete : flete}); 44 return $http.post(route + '/flete', {flete : flete});
45 },
46 crearPlazosParaNotaPedido: function(plazos) {
47 return $http.post(route + '/plazo-pago/nota-pedido', plazos);
45 } 48 }
46 }; 49 };
47 }]); 50 }]);
48 51
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()" class="mb-0">
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-12 col-sm-4 nota-pedido"> 8 <div class="col-12 col-sm-4 nota-pedido">
9 <h5>NOTA DE PEDIDO</h5> 9 <h5>NOTA DE PEDIDO</h5>
10 </div> 10 </div>
11 <div class="col-5 col-sm-4 numero-pedido">Nº {{puntoVenta}}-{{comprobante}}</div> 11 <div class="col-5 col-sm-4 numero-pedido">Nº {{puntoVenta}}-{{comprobante}}</div>
12 <div class="col-7 col-sm-4 text-right"> 12 <div class="col-7 col-sm-4 text-right">
13 Fecha: {{ now | date:'dd/MM/yyyy HH:mm'}} 13 Fecha:
14 <span
15 ng-show="!datepickerAbierto"
16 ng-bind="now | date:'dd/MM/yyyy HH:mm'"
17 ng-click="datepickerAbierto = true"
18 >
19 </span>
20 <input
21 ng-show="datepickerAbierto"
22 type="date"
23 ng-model="now"
24 ng-change="datepickerAbierto = false"
25 ng-blur="datepickerAbierto = false"
26 class="form-control form-control-sm col-8 float-right"
27 foca-focus="datepickerAbierto"
28 hasta-hoy
29 />
14 </div> 30 </div>
15 </div> 31 </div>
16 <div class="row"> 32 <div class="row">
17 <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera"> 33 <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera">
18 <span class="label" ng-bind="cab.label"></span> 34 <span class="label" ng-bind="cab.label"></span>
19 <span class="valor" ng-bind="cab.valor"></span> 35 <span class="valor" ng-bind="cab.valor"></span>
20 </div> 36 </div>
21 <a 37 <a
22 class="btn col-12 btn-secondary d-sm-none" 38 class="btn col-12 btn-secondary d-sm-none"
23 ng-show="cabecera.length > 0" 39 ng-show="cabecera.length > 0"
24 ng-click="showCabecera = !showCabecera" 40 ng-click="showCabecera = !showCabecera"
25 > 41 >
26 <i 42 <i
27 class="fa fa-chevron-down" 43 class="fa fa-chevron-down"
28 ng-hide="showCabecera" 44 ng-hide="showCabecera"
29 aria-hidden="true" 45 aria-hidden="true"
30 > 46 >
31 </i> 47 </i>
32 <i 48 <i
33 class="fa fa-chevron-up" 49 class="fa fa-chevron-up"
34 ng-show="showCabecera" 50 ng-show="showCabecera"
35 aria-hidden="true"> 51 aria-hidden="true">
36 </i> 52 </i>
37 </a> 53 </a>
38 </div> 54 </div>
39 </div> 55 </div>
40 </div> 56 </div>
41 <div class="row p-1 botonera-secundaria"> 57 <div class="row p-1 botonera-secundaria">
42 <div class="col-12"> 58 <div class="col-12">
43 <div class="row"> 59 <div class="row">
44 <div class="col-6 col-sm-3 px-0 py-0" ng-repeat="boton in botonera"> 60 <div class="col-6 col-sm-3 px-0 py-0" ng-repeat="boton in botonera">
45 <button 61 <button
46 type="button" 62 type="button"
47 class="btn btn-default btn-block btn-xs text-left py-2" 63 class="btn btn-default btn-block btn-xs text-left py-2"
48 ng-click="boton.accion()" 64 ng-click="boton.accion()"
49 ng-class="{'d-none d-sm-block': boton.texto == ''}" 65 ng-class="{'d-none d-sm-block': boton.texto == ''}"
50 > 66 >
51 <i 67 <i
52 class="fa fa-arrow-circle-right" 68 class="fa fa-arrow-circle-right"
53 ng-show="boton.texto != ''" 69 ng-show="boton.texto != ''"
54 ></i> 70 ></i>
55 &nbsp; 71 &nbsp;
56 {{boton.texto}} 72 {{boton.texto}}
57 </button> 73 </button>
58 </div> 74 </div>
59 </div> 75 </div>
60 </div> 76 </div>
61 </div> 77 </div>
62 </div> 78 </div>
63 </div> 79 </div>
64 </form> 80 </form>
65 <div class="row"> 81 <div class="row">
66 <div class="col-12 col-md-10 col-lg-8 offset-md-1 offset-lg-2"> 82 <div class="col-12 col-md-10 col-lg-8 offset-md-1 offset-lg-2">
67 <!-- PC --> 83 <!-- PC -->
68 <div class="row grilla-articulo align-items-end d-none d-sm-block"> 84 <div class="row grilla-articulo align-items-end d-none d-sm-block">
69 <table class="table tabla-articulo table-striped table-sm table-dark"> 85 <table class="table tabla-articulo table-striped table-sm table-dark">
70 <thead> 86 <thead>
71 <tr class="d-flex"> 87 <tr class="d-flex">
72 <th class="">#</th> 88 <th class="">#</th>
73 <th class="col">Código</th> 89 <th class="col">Código</th>
74 <th class="col-4">Descripción</th> 90 <th class="col-4">Descripción</th>
75 <th class="col text-right">Cantidad</th> 91 <th class="col text-right">Cantidad</th>
76 <th class="col text-right">Precio Unitario</th> 92 <th class="col text-right">Precio Unitario</th>
77 <th class="col text-right">SubTotal</th> 93 <th class="col text-right">SubTotal</th>
78 <th class="text-right"> 94 <th class="text-right">
79 <button 95 <button
80 class="btn btn-outline-secondary selectable" 96 class="btn btn-outline-secondary selectable"
81 ng-click="show = !show; masMenos()" 97 ng-click="show = !show; masMenos()"
82 > 98 >
83 <i 99 <i
84 class="fa fa-chevron-down" 100 class="fa fa-chevron-down"
85 ng-show="show" 101 ng-show="show"
86 aria-hidden="true" 102 aria-hidden="true"
87 > 103 >
88 </i> 104 </i>
89 <i 105 <i
90 class="fa fa-chevron-up" 106 class="fa fa-chevron-up"
91 ng-hide="show" 107 ng-hide="show"
92 aria-hidden="true"> 108 aria-hidden="true">
93 </i> 109 </i>
94 </button> 110 </button>
95 </th> 111 </th>
96 </tr> 112 </tr>
97 </thead> 113 </thead>
98 <tbody class="tabla-articulo-body"> 114 <tbody class="tabla-articulo-body">
99 <tr 115 <tr
100 ng-repeat="(key, articulo) in articulosTabla" 116 ng-repeat="(key, articulo) in articulosTabla"
101 ng-show="show || key == (articulosTabla.length - 1)" 117 ng-show="show || key == (articulosTabla.length - 1)"
102 class="d-flex" 118 class="d-flex"
103 > 119 >
104 <td ng-bind="key + 1"></td> 120 <td ng-bind="key + 1"></td>
105 <td 121 <td
106 class="col" 122 class="col"
107 ng-bind="articulo.sector + '-' + articulo.codigo" 123 ng-bind="articulo.sector + '-' + articulo.codigo"
108 ></td> 124 ></td>
109 <td 125 <td
110 class="col-4" 126 class="col-4"
111 ng-bind="articulo.descripcion" 127 ng-bind="articulo.descripcion"
112 ></td> 128 ></td>
113 <td class="col text-right"> 129 <td class="col text-right">
114 <input 130 <input
115 ng-show="articulo.edit" 131 ng-show="articulo.editCantidad"
116 ng-model="articulo.cantidad" 132 ng-model="articulo.cantidad"
117 class="form-control" 133 class="form-control"
118 type="number" 134 type="number"
119 min="1" 135 min="1"
120 foca-focus="articulo.edit" 136 foca-focus="articulo.editCantidad"
121 ng-keypress="editarArticulo($event.keyCode, articulo)" 137 ng-keypress="editarArticulo($event.keyCode, articulo)"
122 ng-focus="selectFocus($event)" 138 ng-focus="selectFocus($event)"
123 > 139 >
124 <i 140 <i
125 class="selectable" 141 class="selectable"
126 ng-click="cambioEdit(articulo)" 142 ng-click="cambioEdit(articulo, 'cantidad')"
127 ng-hide="articulo.edit" 143 ng-hide="articulo.editCantidad"
128 ng-bind="articulo.cantidad"> 144 ng-bind="articulo.cantidad">
129 </i> 145 </i>
130 </td> 146 </td>
131 <td 147 <td class="col text-right">
132 class="col text-right" 148 <input
133 ng-bind="articulo.precio | currency: '$'" 149 ng-show="articulo.editPrecio"
134 ></td> 150 ng-model="articulo.precio"
151 class="form-control"
152 type="number"
153 min="1"
154 step="0.01"
155 foca-focus="articulo.editPrecio"
156 ng-keypress="editarArticulo($event.keyCode, articulo)"
157 ng-focus="selectFocus($event)"
158 >
159 <i
160 class="selectable"
161 ng-click="idLista == -1 && cambioEdit(articulo, 'precio')"
162 ng-hide="articulo.editPrecio"
163 ng-bind="articulo.precio">
164 </i>
165 </td>
135 <td 166 <td
136 class="col text-right" 167 class="col text-right"
137 ng-bind="(articulo.precio * articulo.cantidad) | currency: '$'"> 168 ng-bind="(articulo.precio * articulo.cantidad) | currency: '$'">
138 </td> 169 </td>
139 <td class="text-center"> 170 <td class="text-center">
140 <button 171 <button
141 class="btn btn-outline-secondary" 172 class="btn btn-outline-secondary"
142 ng-click="quitarArticulo(key)" 173 ng-click="quitarArticulo(key)"
143 > 174 >
144 <i class="fa fa-trash"></i> 175 <i class="fa fa-trash"></i>
145 </button> 176 </button>
146 </td> 177 </td>
147 </tr> 178 </tr>
148 </tbody> 179 </tbody>
149 <tfoot> 180 <tfoot>
150 <tr ng-show="!cargando" class="d-flex"> 181 <tr ng-show="!cargando" class="d-flex">
151 <td 182 <td
152 class="align-middle" 183 class="align-middle"
153 ng-bind="articulosTabla.length + 1" 184 ng-bind="articulosTabla.length + 1"
154 ></td> 185 ></td>
155 <td class="col"> 186 <td class="col">
156 <input 187 <input
157 class="form-control" 188 class="form-control"
158 ng-model="articuloACargar.sectorCodigo" 189 ng-model="articuloACargar.sectorCodigo"
159 readonly 190 readonly
160 > 191 >
161 </td> 192 </td>
162 <td class="col-4 tabla-articulo-descripcion"> 193 <td class="col-4 tabla-articulo-descripcion">
163 <input 194 <input
164 class="form-control" 195 class="form-control"
165 ng-model="articuloACargar.descripcion" 196 ng-model="articuloACargar.descripcion"
166 readonly 197 readonly
167 > 198 >
168 </td> 199 </td>
169 <td class="col text-right"> 200 <td class="col text-right">
170 <input 201 <input
171 class="form-control" 202 class="form-control"
172 type="number" 203 type="number"
173 min="1" 204 min="1"
174 ng-model="articuloACargar.cantidad" 205 ng-model="articuloACargar.cantidad"
175 foca-focus="!cargando" 206 foca-focus="!cargando"
176 esc-key="resetFilter()" 207 esc-key="resetFilter()"
177 ng-keypress="agregarATabla($event.keyCode)" 208 ng-keypress="agregarATabla($event.keyCode)"
178 > 209 >
179 </td> 210 </td>
180 <td class="col text-right"> 211 <td class="col text-right">
181 <input 212 <input
182 class="form-control" 213 class="form-control"
183 ng-value="articuloACargar.precio | currency: '$'" 214 ng-value="articuloACargar.precio | currency: '$'"
215 ng-show="idLista != -1"
184 readonly 216 readonly
185 > 217 >
218 <input
219 class="form-control"
220 type="number"
221 step="0.01"
222 ng-model="articuloACargar.precio"
223 esc-key="resetFilter()"
224 ng-keypress="agregarATabla($event.keyCode)"
225 ng-show="idLista == -1"
226 >
186 </td> 227 </td>
187 <td class="col text-right"> 228 <td class="col text-right">
188 <input 229 <input
189 class="form-control" 230 class="form-control"
190 ng-value="getSubTotal() | currency: '$'" 231 ng-value="getSubTotal() | currency: '$'"
191 readonly 232 readonly
192 ></td> 233 ></td>
193 <td class="text-center align-middle"> 234 <td class="text-center align-middle">
194 <button 235 <button
195 class="btn btn-outline-secondary" 236 class="btn btn-outline-secondary"
196 ng-click="agregarATabla(13)" 237 ng-click="agregarATabla(13)"
197 > 238 >
198 <i class="fa fa-save"></i> 239 <i class="fa fa-save"></i>
199 </button> 240 </button>
200 </td> 241 </td>
201 </tr> 242 </tr>
202 <tr ng-show="cargando" class="d-flex"> 243 <tr ng-show="cargando" class="d-flex">
203 <td colspan="7" class="col-12"> 244 <td colspan="7" class="col-12">
204 <input 245 <input
205 placeholder="Seleccione Articulo" 246 placeholder="Seleccione Articulo"
206 class="form-control form-control-sm" 247 class="form-control form-control-sm"
207 readonly 248 readonly
208 ng-click="seleccionarArticulo()" 249 ng-click="seleccionarArticulo()"
209 /> 250 />
210 </td> 251 </td>
211 </tr> 252 </tr>
212 <tr class="d-flex"> 253 <tr class="d-flex">
213 <td colspan="4" class="no-border-top"> 254 <td colspan="4" class="no-border-top">
214 <strong>Cantidad Items:</strong> 255 <strong>Cantidad Items:</strong>
215 <a ng-bind="articulosTabla.length"></a> 256 <a ng-bind="articulosTabla.length"></a>
216 </td> 257 </td>
217 <td class="text-right ml-auto table-celda-total no-border-top"><h3>Total:</h3></td> 258 <td class="text-right ml-auto table-celda-total no-border-top"><h3>Total:</h3></td>
218 <td class="table-celda-total text-right no-border-top" colspan="1"> 259 <td class="table-celda-total text-right no-border-top" colspan="1">
219 <h3>{{getTotal() | currency: '$'}}</h3> 260 <h3>{{getTotal() | currency: '$'}}</h3>
220 </td> 261 </td>
221 <td class="text-right no-border-top"> 262 <td class="text-right no-border-top">
222 <button 263 <button
223 type="button" 264 type="button"
224 class="btn btn-default btn-sm" 265 class="btn btn-default btn-sm"
225 > 266 >
226 Totales 267 Totales
227 </button> 268 </button>
228 </td> 269 </td>
229 </tr> 270 </tr>
230 </tfoot> 271 </tfoot>
231 </table> 272 </table>
232 </div> 273 </div>
233 274
234 <!-- MOBILE --> 275 <!-- MOBILE -->
235 <div class="row d-sm-none"> 276 <div class="row d-sm-none">
236 <table class="table table-sm table-striped table-dark margin-bottom-mobile"> 277 <table class="table table-sm table-striped table-dark margin-bottom-mobile">
237 <thead> 278 <thead>
238 <tr class="d-flex"> 279 <tr class="d-flex">
239 <th class="">#</th> 280 <th class="">#</th>
240 <th class="col px-0"> 281 <th class="col px-0">
241 <div class="d-flex"> 282 <div class="d-flex">
242 <div class="col-4 px-1">Código</div> 283 <div class="col-4 px-1">Código</div>
243 <div class="col-8 px-1">Descripción</div> 284 <div class="col-8 px-1">Descripción</div>
244 </div> 285 </div>
245 <div class="d-flex"> 286 <div class="d-flex">
246 <div class="col-3 px-1">Cantidad</div> 287 <div class="col-3 px-1">Cantidad</div>
247 <div class="col px-1 text-right">P. Uni.</div> 288 <div class="col px-1 text-right">P. Uni.</div>
248 <div class="col px-1 text-right">Subtotal</div> 289 <div class="col px-1 text-right">Subtotal</div>
249 </div> 290 </div>
250 </th> 291 </th>
251 <th class="text-center tamaño-boton"> 292 <th class="text-center tamaño-boton">
252 &nbsp; 293 &nbsp;
253 </th> 294 </th>
254 </tr> 295 </tr>
255 </thead> 296 </thead>
256 <tbody> 297 <tbody>
257 <tr 298 <tr
258 ng-repeat="(key, articulo) in articulosTabla" 299 ng-repeat="(key, articulo) in articulosTabla"
259 ng-show="show || key == articulosTabla.length - 1" 300 ng-show="show || key == articulosTabla.length - 1"
260 > 301 >
261 <td class="w-100 align-middle d-flex p-0"> 302 <td class="w-100 align-middle d-flex p-0">
262 <div class="align-middle p-1"> 303 <div class="align-middle p-1">
263 <span ng-bind="key+1" class="align-middle"></span> 304 <span ng-bind="key+1" class="align-middle"></span>
264 </div> 305 </div>
265 <div class="col px-0"> 306 <div class="col px-0">
266 <div class="d-flex"> 307 <div class="d-flex">
267 <div class="col-4 px-1"> 308 <div class="col-4 px-1">
268 <span 309 <span
269 ng-bind="articulo.sector + '-' + articulo.codigo" 310 ng-bind="articulo.sector + '-' + articulo.codigo"
270 ></span> 311 ></span>
271 </div> 312 </div>
272 <div class="col-8 px-1"> 313 <div class="col-8 px-1">
273 <span ng-bind="articulo.descripcion"></span> 314 <span ng-bind="articulo.descripcion"></span>
274 </div> 315 </div>
275 </div> 316 </div>
276 <div class="d-flex"> 317 <div class="d-flex">
277 <div class="col-3 px-1"> 318 <div class="col-3 px-1">
278 <span ng-bind="'x' + articulo.cantidad"></span> 319 <span ng-bind="'x' + articulo.cantidad"></span>
279 </div> 320 </div>
280 <div class="col-3 px-1 text-right"> 321 <div class="col-3 px-1 text-right">
281 <span ng-bind="articulo.precio | currency: '$'"></span> 322 <span ng-bind="articulo.precio | currency: '$'"></span>
282 </div> 323 </div>
283 <div class="col px-1 text-right"> 324 <div class="col px-1 text-right">
284 <span 325 <span
285 ng-bind="(articulo.precio * articulo.cantidad) | currency: '$'" 326 ng-bind="(articulo.precio * articulo.cantidad) | currency: '$'"
286 > 327 >
287 </span> 328 </span>
288 </div> 329 </div>
289 </div> 330 </div>
290 </div> 331 </div>
291 <div class="align-middle p-1"> 332 <div class="align-middle p-1">
292 <button 333 <button
293 class="btn btn-outline-secondary" 334 class="btn btn-outline-secondary"
294 ng-click="quitarArticulo(key)" 335 ng-click="quitarArticulo(key)"
295 > 336 >
296 <i class="fa fa-trash"></i> 337 <i class="fa fa-trash"></i>
297 </button> 338 </button>
298 </div> 339 </div>
299 </td> 340 </td>
300 </tr> 341 </tr>
301 </tbody> 342 </tbody>
302 <tfoot> 343 <tfoot>
303 <!-- CARGANDO ITEM --> 344 <!-- CARGANDO ITEM -->
304 <tr ng-show="!cargando" class="d-flex"> 345 <tr ng-show="!cargando" class="d-flex">
305 <td 346 <td
306 class="align-middle p-1" 347 class="align-middle p-1"
307 ng-bind="articulosTabla.length + 1" 348 ng-bind="articulosTabla.length + 1"
308 ></td> 349 ></td>
309 <td class="col p-0"> 350 <td class="col p-0">
310 <div class="d-flex"> 351 <div class="d-flex">
311 <div class="col-4 px-1"> 352 <div class="col-4 px-1">
312 <span 353 <span
313 ng-bind="articuloACargar.sectorCodigo" 354 ng-bind="articuloACargar.sectorCodigo"
314 ></span> 355 ></span>
315 </div> 356 </div>
316 <div class="col-8 px-1"> 357 <div class="col-8 px-1">
317 <span ng-bind="articuloACargar.descripcion"></span> 358 <span ng-bind="articuloACargar.descripcion"></span>
318 </div> 359 </div>
319 </div> 360 </div>
320 <div class="d-flex"> 361 <div class="d-flex">
321 <div class="col-3 px-1 m-1"> 362 <div class="col-3 px-1 m-1">
322 <input 363 <input
323 class="form-control p-1" 364 class="form-control p-1"
324 type="number" 365 type="number"
325 min="1" 366 min="1"
326 ng-model="articuloACargar.cantidad" 367 ng-model="articuloACargar.cantidad"
327 foca-focus="!cargando" 368 foca-focus="!cargando"
328 ng-keypress="agregarATabla($event.keyCode)" 369 ng-keypress="agregarATabla($event.keyCode)"
329 style="height: auto; line-height: 1.1em" 370 style="height: auto; line-height: 1.1em"
330 > 371 >
331 </div> 372 </div>
332 <div class="col-3 px-1 text-right"> 373 <div class="col-3 px-1 text-right">
333 <span ng-bind="articuloACargar.precio | currency: '$'"></span> 374 <span ng-bind="articuloACargar.precio | currency: '$'"></span>
334 </div> 375 </div>
335 <div class="col px-1 text-right"> 376 <div class="col px-1 text-right">
336 <span 377 <span
337 ng-bind="getSubTotal() | currency: '$'" 378 ng-bind="getSubTotal() | currency: '$'"
338 > 379 >
339 </span> 380 </span>
340 </div> 381 </div>
341 </div> 382 </div>
342 </td> 383 </td>
343 <td class="text-center align-middle"> 384 <td class="text-center align-middle">
344 <button 385 <button
345 class="btn btn-outline-secondary" 386 class="btn btn-outline-secondary"
346 ng-click="agregarATabla(13)" 387 ng-click="agregarATabla(13)"
347 > 388 >
348 <i class="fa fa-save"></i> 389 <i class="fa fa-save"></i>
349 </button> 390 </button>
350 </td> 391 </td>
351 </tr> 392 </tr>
352 <!-- SELECCIONAR PRODUCTO --> 393 <!-- SELECCIONAR PRODUCTO -->
353 <tr ng-show="cargando" class="d-flex"> 394 <tr ng-show="cargando" class="d-flex">
354 <td class="col-12"> 395 <td class="col-12">
355 <input 396 <input
356 placeholder="Seleccione Articulo" 397 placeholder="Seleccione Articulo"
357 class="form-control form-control-sm" 398 class="form-control form-control-sm"
358 readonly 399 readonly
359 ng-click="seleccionarArticulo()" 400 ng-click="seleccionarArticulo()"
360 /> 401 />
361 </td> 402 </td>
362 </tr> 403 </tr>
363 <!-- TOOGLE EXPANDIR --> 404 <!-- TOOGLE EXPANDIR -->
364 <tr> 405 <tr>
365 <td class="col"> 406 <td class="col">
366 <button 407 <button
367 class="btn btn-outline-secondary selectable w-100" 408 class="btn btn-outline-secondary selectable w-100"
368 ng-click="show = !show; masMenos()" 409 ng-click="show = !show; masMenos()"
369 ng-show="articulosTabla.length > 0" 410 ng-show="articulosTabla.length > 0"
370 > 411 >
371 <i 412 <i
372 class="fa fa-chevron-down" 413 class="fa fa-chevron-down"
373 ng-hide="show" 414 ng-hide="show"
374 aria-hidden="true" 415 aria-hidden="true"
375 > 416 >
376 </i> 417 </i>
377 <i 418 <i
378 class="fa fa-chevron-up" 419 class="fa fa-chevron-up"
379 ng-show="show" 420 ng-show="show"
380 aria-hidden="true"> 421 aria-hidden="true">
381 </i> 422 </i>
382 </button> 423 </button>
383 </td> 424 </td>
384 </tr> 425 </tr>
385 <!-- FOOTER --> 426 <!-- FOOTER -->
386 <tr class="d-flex"> 427 <tr class="d-flex">
387 <td class="align-middle no-border-top" colspan="2"> 428 <td class="align-middle no-border-top" colspan="2">
388 <strong>Cantidad Items:</strong> 429 <strong>Cantidad Items:</strong>
389 <a ng-bind="articulosTabla.length"></a> 430 <a ng-bind="articulosTabla.length"></a>
390 </td> 431 </td>
391 <td class="text-right ml-auto table-celda-total no-border-top"><h3>Total:</h3></td> 432 <td class="text-right ml-auto table-celda-total no-border-top"><h3>Total:</h3></td>
392 <td class="table-celda-total text-right no-border-top"> 433 <td class="table-celda-total text-right no-border-top">
393 <h3>{{getTotal() | currency: '$'}}</h3> 434 <h3>{{getTotal() | currency: '$'}}</h3>
394 </td> 435 </td>
395 </tr> 436 </tr>
396 </tfoot> 437 </tfoot>
397 </table> 438 </table>
398 </div> 439 </div>
399 </div> 440 </div>
400 <div class="col-auto my-2 col-lg-2 botonera-lateral d-none d-sm-block"> 441 <div class="col-auto my-2 col-lg-2 botonera-lateral d-none d-sm-block">
401 <div class="row align-items-end"> 442 <div class="row align-items-end">
402 <div class="col-12"> 443 <div class="col-12">
403 <button 444 <button
404 ng-click="crearNotaPedido()" 445 ng-click="crearNotaPedido()"
405 type="submit" 446 type="submit"
406 title="Crear nota pedido" 447 title="Crear nota pedido"
407 class="btn btn-default btn-block mb-2"> 448 class="btn btn-default btn-block mb-2">
408 Guardar 449 Guardar
409 </button> 450 </button>
410 <button 451 <button
411 ng-click="salir()" 452 ng-click="salir()"
412 type="button" 453 type="button"
413 title="Salir" 454 title="Salir"
414 class="btn btn-default btn-block"> 455 class="btn btn-default btn-block">
415 Salir 456 Salir
416 </button> 457 </button>
417 </div> 458 </div>
418 </div> 459 </div>
419 </div> 460 </div>
420 </div> 461 </div>
421 <div class="row d-sm-none fixed-bottom"> 462 <div class="row d-sm-none fixed-bottom">
422 <div class="w-100 bg-dark d-flex px-3 acciones-mobile"> 463 <div class="w-100 bg-dark d-flex px-3 acciones-mobile">
423 <span class="ml-3 text-muted" ng-click="salir()">Salir</span> 464 <span class="ml-3 text-muted" ng-click="salir()">Salir</span>
424 <span class="mr-3 ml-auto" ng-click="crearNotaPedido()">Guardar</span> 465 <span class="mr-3 ml-auto" ng-click="crearNotaPedido()">Guardar</span>
425 </div> 466 </div>
426 </div> 467 </div>
427 </div> 468 </div>
428 469