Commit 8c88aaa3ddab5c182b16761bc9e85f158327c49e

Authored by Pablo Marco del Pont
Exists in master

Merge branch 'master' of https://debo.suite.repo/modulos-npm/foca-crear-nota-pedido

# Conflicts:
#	package.json
#	src/js/controller.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",'+
47 '"focaModalPetroleras","focaBusquedaCliente","focaModalPrecioCondicion"', ''),
46 gulp.dest(paths.dist) 48 gulp.dest(paths.dist)
47 ] 49 ]
48 ); 50 );
49 }); 51 });
50 52
51 gulp.task('clean', function(){ 53 gulp.task('clean', function(){
52 return gulp.src(['tmp', 'dist'], {read: false}) 54 return gulp.src(['tmp', 'dist'], {read: false})
53 .pipe(clean()); 55 .pipe(clean());
54 }); 56 });
55 57
56 gulp.task('pre-commit', function() { 58 gulp.task('pre-commit', function() {
57 return pump( 59 return pump(
58 [ 60 [
59 gulp.src(paths.srcJS), 61 gulp.src(paths.srcJS),
60 jshint('.jshintrc'), 62 jshint('.jshintrc'),
61 jshint.reporter('default'), 63 jshint.reporter('default'),
62 jshint.reporter('fail') 64 jshint.reporter('fail')
63 ] 65 ]
64 ); 66 );
65 67
66 gulp.start('uglify'); 68 gulp.start('uglify');
67 }); 69 });
68 70
69 gulp.task('webserver', function() { 71 gulp.task('webserver', function() {
70 pump [ 72 pump [
71 connect.server({port: 3000}) 73 connect.server({port: 3000})
72 ] 74 ]
73 }); 75 });
74 76
77 gulp.task('clean-post-install', function() {
78 return gulp.src(['src', 'tmp', '.jshintrc','readme.md', '.gitignore', 'gulpfile.js',
79 'index.html'], {read: false})
80 .pipe(clean());
81 });
82
75 gulp.task('default', ['webserver']); 83 gulp.task('default', ['webserver']);
76 84
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 23
23 <script src="src/js/app.js"></script> 24 <script src="src/js/app.js"></script>
24 <script src="src/js/controller.js"></script> 25 <script src="src/js/controller.js"></script>
25 <script src="src/js/service.js"></script> 26 <script src="src/js/service.js"></script>
26 <script src="src/js/route.js"></script> 27 <script src="src/js/route.js"></script>
27 28
28 <script src="src/etc/develop.js"></script> 29 <script src="src/etc/develop.js"></script>
29 </head> 30 </head>
30 <body> 31 <body>
31 <div ng-view class="container-fluid"></div> 32 <div ng-view class="container-fluid"></div>
32 </body> 33 </body>
33 </html> 34 </html>
34 35
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 "postinstall": "npm run compile && rm -R src && rm index.html && rm .jshintrc && rm gulpfile.js", 9 "gulp-pre-commit": "gulp pre-commit",
10 "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 jquery jshint pump" 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/nguarnieri/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"
11 }, 12 },
13 "pre-commit": [
14 "gulp-pre-commit"
15 ],
12 "repository": { 16 "repository": {
13 "type": "git", 17 "type": "git",
14 "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"
15 }, 19 },
16 "author": "Foca Software", 20 "author": "Foca Software",
17 "license": "ISC", 21 "license": "ISC",
18 "dependencies": { 22 "peerDependencies": {
19 "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git", 23 "foca-busqueda-cliente": "git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente.git",
20 "foca-modal-busqueda-productos": "git+https://debo.suite.repo/nguarnieri/foca-modal-busqueda-productos", 24 "foca-directivas": "git+https://debo.suite.repo/modulos-npm/foca-directivas.git",
21 "foca-modal-petroleras": "git+https://debo.suite.repo/modulos-npm/foca-modal-petroleras.git", 25 "foca-modal-busqueda-productos": "git+https://debo.suite.repo/nguarnieri/foca-modal-busqueda-productos",
22 "foca-modal-vendedores": "git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git", 26 "foca-modal-petroleras": "git+https://debo.suite.repo/modulos-npm/foca-modal-petroleras.git",
23 "jquery": "^3.3.x" 27 "foca-modal-vendedores": "git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git"
24 }, 28 },
25 "devDependencies": { 29 "devDependencies": {
26 "angular": "^1.7.5", 30 "angular": "^1.7.5",
27 "angular-route": "^1.7.5", 31 "angular-route": "^1.7.5",
28 "bootstrap": "^4.1.3", 32 "bootstrap": "^4.1.3",
29 "foca-busqueda-cliente": "git+https://debo.suite.repo/modulos-npm/foca-busqueda-cliente", 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",
35 "foca-modal-busqueda-productos": "git+https://debo.suite.repo/nguarnieri/foca-modal-busqueda-productos",
36 "foca-modal-petroleras": "git+https://debo.suite.repo/modulos-npm/foca-modal-petroleras.git",
37 "foca-modal-precio-condiciones": "git+https://debo.suite.repo/modulos-npm/foca-modal-precio-condiciones.git",
38 "foca-modal-vendedores": "git+https://debo.suite.repo/modulos-npm/foca-modal-vendedores.git",
30 "font-awesome": "^4.7.0", 39 "font-awesome": "^4.7.0",
31 "gulp": "^3.9.1", 40 "gulp": "^3.9.1",
32 "gulp-angular-templatecache": "2.2.2", 41 "gulp-angular-templatecache": "2.2.2",
33 "gulp-clean": "^0.4.0", 42 "gulp-clean": "^0.4.0",
34 "gulp-concat": "^2.6.1", 43 "gulp-concat": "^2.6.1",
35 "gulp-connect": "^5.6.1", 44 "gulp-connect": "^5.6.1",
36 "gulp-htmlmin": "^5.0.1", 45 "gulp-htmlmin": "^5.0.1",
37 "gulp-jshint": "^2.1.0", 46 "gulp-jshint": "^2.1.0",
38 "gulp-rename": "^1.4.0", 47 "gulp-rename": "^1.4.0",
39 "gulp-replace": "^1.0.0", 48 "gulp-replace": "^1.0.0",
49 "gulp-sequence": "^1.0.0",
40 "gulp-uglify": "^3.0.1", 50 "gulp-uglify": "^3.0.1",
41 "gulp-uglify-es": "^1.0.4", 51 "gulp-uglify-es": "^1.0.4",
42 "jasmine-core": "^3.2.1", 52 "jasmine-core": "^3.2.1",
53 "jquery": "^3.3.1",
43 "jshint": "^2.9.6", 54 "jshint": "^2.9.6",
44 "pre-commit": "^1.2.2", 55 "pre-commit": "^1.2.2",
45 "pump": "^3.0.0", 56 "pump": "^3.0.0",
46 "ui-bootstrap4": "^3.0.5" 57 "ui-bootstrap4": "^3.0.5"
47 } 58 }
48 } 59 }
49 60
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 ]); 9 ]);
9 10
src/js/controller.js
1 angular.module('focaCrearNotaPedido') 1 angular.module('focaCrearNotaPedido')
2 .controller('notaPedidoCtrl', 2 .controller('notaPedidoCtrl',
3 ['$scope', '$uibModal', '$location', 'crearNotaPedidoService', 3 ['$scope', '$uibModal', '$location', 'crearNotaPedidoService',
4 function($scope, $uibModal, $location, crearNotaPedidoService) { 4 function($scope, $uibModal, $location, crearNotaPedidoService) {
5 $scope.show = false; 5 $scope.show = false;
6 6
7 $scope.dateOptions = { 7 $scope.dateOptions = {
8 maxDate: new Date(), 8 maxDate: new Date(),
9 minDate: new Date(2010, 0, 1) 9 minDate: new Date(2010, 0, 1)
10 }; 10 };
11 11
12 $scope.notaPedido = { 12 $scope.notaPedido = {
13 vendedor: {}, 13 vendedor: {},
14 cliente: {} 14 cliente: {}
15 }; 15 };
16 $scope.articulosTabla = []; 16 $scope.articulosTabla = [];
17 var idLista; 17 var idLista;
18 var notaPedidoTemp = crearNotaPedidoService.getNotaPedido(); 18 var notaPedidoTemp = crearNotaPedidoService.getNotaPedido();
19 $scope.domiciliosCliente = crearNotaPedidoService.getDomicilios(1); 19 $scope.domiciliosCliente = crearNotaPedidoService.getDomicilios(1);
20 crearNotaPedidoService.getPrecioCondicion().then( 20 crearNotaPedidoService.getPrecioCondicion().then(
21 function(res) { 21 function(res) {
22 $scope.precioCondiciones = res.data; 22 $scope.precioCondiciones = res.data;
23 } 23 }
24 ); 24 );
25 if (notaPedidoTemp != undefined) { 25 if (notaPedidoTemp !== undefined) {
26 notaPedidoTemp.fechaCarga = new Date(notaPedidoTemp.fechaCarga); 26 notaPedidoTemp.fechaCarga = new Date(notaPedidoTemp.fechaCarga);
27 $scope.notaPedido = notaPedidoTemp; 27 $scope.notaPedido = notaPedidoTemp;
28 $scope.notaPedido.flete = ($scope.notaPedido.flete).toString(); 28 $scope.notaPedido.flete = ($scope.notaPedido.flete).toString();
29 $scope.notaPedido.bomba = ($scope.notaPedido.bomba).toString(); 29 $scope.notaPedido.bomba = ($scope.notaPedido.bomba).toString();
30 idLista = $scope.notaPedido.precioCondicion; 30 idLista = $scope.notaPedido.precioCondicion;
31 crearNotaPedidoService 31 crearNotaPedidoService
32 .getArticulosByIdNotaPedido($scope.notaPedido.id).then( 32 .getArticulosByIdNotaPedido($scope.notaPedido.id).then(
33 function(res) { 33 function(res) {
34 $scope.articulosTabla = res.data; 34 $scope.articulosTabla = res.data;
35 } 35 }
36 ); 36 );
37 crearNotaPedidoService.getDomiciliosByIdNotaPedido($scope.notaPedido.id).then( 37 crearNotaPedidoService.getDomiciliosByIdNotaPedido($scope.notaPedido.id).then(
38 function(res) { 38 function(res) {
39 $scope.notaPedido.domicilio = res.data; 39 $scope.notaPedido.domicilio = res.data;
40 } 40 }
41 ) 41 );
42 } else { 42 } else {
43 $scope.notaPedido.fechaCarga = new Date(); 43 $scope.notaPedido.fechaCarga = new Date();
44 $scope.notaPedido.domicilio = [{ id: 0 }] 44 $scope.notaPedido.domicilio = [{ id: 0 }];
45 $scope.notaPedido.bomba = '1'; 45 $scope.notaPedido.bomba = '1';
46 $scope.notaPedido.flete = '1'; 46 $scope.notaPedido.flete = '1';
47 idLista = undefined; 47 idLista = undefined;
48 } 48 }
49 $scope.addNewDom = function() { 49 $scope.addNewDom = function() {
50 $scope.notaPedido.domicilio.push({ 'id': 0 }); 50 $scope.notaPedido.domicilio.push({ 'id': 0 });
51 } 51 };
52 $scope.removeNewChoice = function(choice) { 52 $scope.removeNewChoice = function(choice) {
53 if ($scope.notaPedido.domicilio.length > 1) { 53 if ($scope.notaPedido.domicilio.length > 1) {
54 $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex( 54 $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex(
55 function(c) { 55 function(c) {
56 return c.$$hashKey == choice.$$hashKey; 56 return c.$$hashKey === choice.$$hashKey;
57 } 57 }
58 ), 1) 58 ), 1);
59 } 59 }
60 } 60 };
61 $scope.crearNotaPedido = function() { 61 $scope.crearNotaPedido = function() {
62 var notaPedido = { 62 var notaPedido = {
63 id: 0, 63 id: 0,
64 precioCondicion: $scope.notaPedido.precioCondicion, 64 precioCondicion: $scope.notaPedido.precioCondicion,
65 fechaCarga: $scope.notaPedido.fechaCarga, 65 fechaCarga: $scope.notaPedido.fechaCarga,
66 vendedor: $scope.notaPedido.vendedor, 66 vendedor: $scope.notaPedido.vendedor,
67 cliente: $scope.notaPedido.cliente, 67 cliente: $scope.notaPedido.cliente,
68 producto: $scope.notaPedido.producto, 68 producto: $scope.notaPedido.producto,
69 bomba: $scope.notaPedido.bomba, 69 bomba: $scope.notaPedido.bomba,
70 petrolera: $scope.notaPedido.petrolera, 70 petrolera: $scope.notaPedido.petrolera,
71 domicilio: $scope.notaPedido.domicilio, 71 domicilio: $scope.notaPedido.domicilio,
72 kilometros: $scope.notaPedido.kilometros, 72 kilometros: $scope.notaPedido.kilometros,
73 jurisdiccionIIBB: $scope.notaPedido.jurisdiccionIIBB, 73 jurisdiccionIIBB: $scope.notaPedido.jurisdiccionIIBB,
74 costoFinanciacion: $scope.notaPedido.costoFinanciacion, 74 costoFinanciacion: $scope.notaPedido.costoFinanciacion,
75 flete: $scope.notaPedido.flete, 75 flete: $scope.notaPedido.flete,
76 costoUnitarioKmFlete: $scope.notaPedido.costoUnitarioKmFlete, 76 costoUnitarioKmFlete: $scope.notaPedido.costoUnitarioKmFlete,
77 total : $scope.articulosTabla[0].subTotal 77 total: $scope.articulosTabla[0].subTotal
78 } 78 };
79 crearNotaPedidoService.crearNotaPedido(notaPedido).then( 79 crearNotaPedidoService.crearNotaPedido(notaPedido).then(
80 function(res) { 80 function() {
81 alert('Nota pedido creada'); 81 alert('Nota pedido creada');
82 $location.path('/venta-nota-pedido'); 82 $location.path('/venta-nota-pedido');
83 } 83 }
84 ) 84 );
85 var articulosNotaPedido = $scope.articulosTabla; 85 var articulosNotaPedido = $scope.articulosTabla;
86 for(var i = 0; i< articulosNotaPedido.length;i++) { 86 for(var i = 0; i< articulosNotaPedido.length;i++) {
87 crearNotaPedidoService 87 crearNotaPedidoService
88 .crearArticulosParaNotaPedido(articulosNotaPedido[i]).then( 88 .crearArticulosParaNotaPedido(articulosNotaPedido[i]).then(
89 function() {
89 function(res) { 90 return;
90 return; 91 }
91 } 92 );
92 ) 93 }
93 } 94 };
94 95 $scope.siguienteTab = function() {
95 } 96 $scope.active = 1;
96 $scope.siguienteTab = function() { 97 };
97 $scope.active = 1; 98 $scope.seleccionarArticulo = function() {
98 } 99 if (idLista === undefined) {
99 $scope.seleccionarArticulo = function() { 100 alert('primero seleccione una lista de precio y condicion');
100 if (idLista == undefined) { 101 return;
101 alert('primero seleccione una lista de precio y condicion'); 102 }
102 return; 103 var modalInstance = $uibModal.open(
103 } 104 {
104 var modalInstance = $uibModal.open( 105 ariaLabelledBy: 'Busqueda de Productos',
105 { 106 templateUrl: 'modal-busqueda-productos.html',
106 ariaLabelledBy: 'Busqueda de Productos', 107 controller: 'modalBusquedaProductosCtrl',
107 templateUrl: 'modal-busqueda-productos.html', 108 resolve: { idLista: function() { return idLista; } },
108 controller: 'modalBusquedaProductosCtrl', 109 size: 'lg'
109 resolve: { idLista: function() { return idLista } }, 110 }
110 size: 'lg' 111 );
111 } 112 modalInstance.result.then(
112 ) 113 function(producto) {
113 modalInstance.result.then( 114 var newArt =
114 function(producto) { 115 {
115 var newArt = 116 id: 0,
116 { 117 codigo: producto.FiltroSectorCodigo,
117 id: 0, 118 item: $scope.articulosTabla.length + 1,
118 codigo: producto.FiltroSectorCodigo, 119 nombre: producto.descripcion,
119 item: $scope.articulosTabla.length + 1, 120 precio: producto.precio,
120 nombre: producto.descripcion, 121 costoUnitario: producto.costo,
121 precio: producto.precio, 122 cantidad: 1
122 costoUnitario: producto.costo, 123 };
123 cantidad: 1 124 $scope.articulosTabla.unshift(newArt);
124 } 125 }, function() {
125 $scope.articulosTabla.unshift(newArt); 126 // funcion ejecutada cuando se cancela el modal
126 }, function() { 127 }
127 // funcion ejecutada cuando se cancela el modal 128 );
128 } 129 };
129 ); 130 $scope.seleccionarVendedor = function() {
130 } 131 var modalInstance = $uibModal.open(
131 $scope.seleccionarVendedor = function() { 132 {
132 var modalInstance = $uibModal.open( 133 ariaLabelledBy: 'Busqueda de Vendedores',
133 { 134 templateUrl: 'modal-vendedores.html',
134 ariaLabelledBy: 'Busqueda de Vendedores', 135 controller: 'modalVendedoresCtrl',
135 templateUrl: 'modal-vendedores.html', 136 size: 'lg'
136 controller: 'modalVendedoresCtrl', 137 }
137 size: 'lg' 138 );
138 } 139 modalInstance.result.then(
139 ) 140 function(vendedor) {
140 modalInstance.result.then( 141 $scope.notaPedido.vendedor.nombre = vendedor.NomVen;
141 function(vendedor) { 142 }, function() {
142 $scope.notaPedido.vendedor.nombre = vendedor.NomVen; 143
143 }, function() { 144 }
144 145 );
145 } 146 };
146 ); 147 $scope.seleccionarPetrolera = function() {
147 } 148 var modalInstance = $uibModal.open(
148 $scope.seleccionarPetrolera = function() { 149 {
149 var modalInstance = $uibModal.open( 150 ariaLabelledBy: 'Busqueda de Petrolera',
150 { 151 templateUrl: 'modal-petroleras.html',
151 ariaLabelledBy: 'Busqueda de Petrolera', 152 controller: 'modalPetrolerasCtrl',
152 templateUrl: 'modal-petroleras.html', 153 size: 'lg'
153 controller: 'modalPetrolerasCtrl', 154 }
154 size: 'lg' 155 );
155 } 156 modalInstance.result.then(
156 ) 157 function(petrolera) {
157 modalInstance.result.then( 158 $scope.notaPedido.petrolera = petrolera.NOM;
158 function(petrolera) { 159 }, function() {
159 $scope.notaPedido.petrolera = petrolera.NOM; 160
160 }, function() { 161 }
161 162 );
162 } 163 };
163 ); 164 $scope.seleccionarCliente = function() {
164 } 165 var modalInstance = $uibModal.open(
165 $scope.seleccionarCliente = function() { 166 {
166 var modalInstance = $uibModal.open( 167 ariaLabelledBy: 'Busqueda de Cliente',
167 { 168 templateUrl: 'foca-busqueda-cliente-modal.html',
168 ariaLabelledBy: 'Busqueda de Cliente', 169 controller: 'focaBusquedaClienteModalController',
169 templateUrl: 'foca-busqueda-cliente-modal.html', 170 size: 'lg'
170 controller: 'focaBusquedaClienteModalController', 171 }
171 size: 'lg' 172 );
172 } 173 modalInstance.result.then(
173 ) 174 function(cliente) {
174 modalInstance.result.then( 175 $scope.notaPedido.cliente.nombre = cliente.nom;
175 function(cliente) { 176 }, function() {
176 $scope.notaPedido.cliente.nombre = cliente.nom; 177
177 }, function() { 178 }
178 179 );
179 } 180 };
180 ); 181 $scope.mostrarFichaCliente = function() {
181 }; 182 $uibModal.open(
182 $scope.mostrarFichaCliente = function() { 183 {
183 $uibModal.open( 184 ariaLabelledBy: 'Datos del Cliente',
184 { 185 templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html',
185 ariaLabelledBy: 'Datos del Cliente', 186 controller: 'focaCrearNotaPedidoFichaClienteController',
186 templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html', 187 size: 'lg'
187 controller: 'focaCrearNotaPedidoFichaClienteController', 188 }
188 size: 'lg' 189 );
189 } 190 };
190 ); 191 $scope.obtenerDomicilios = function(id) {
191 }; 192 crearNotaPedidoService.getDomicilios(id).then(
192 $scope.obtenerDomicilios = function(id) { 193 function(res) {
193 crearNotaPedidoService.getDomicilios(id).then( 194 $scope.notaPedido.domicilio = res.data;
194 function(res) { 195 }
195 $scope.notaPedido.domicilio = res.data; 196 );
196 } 197 };
197 ) 198 $scope.getSubTotal = function(item) {
198 } 199 var subTotal = 0;
199 $scope.getSubTotal = function(item) { 200 var array = $scope.articulosTabla.filter(
200 var subTotal = 0; 201 function(a) {
202 return a.item <= item;
203 }
204 );
205 for (var i = 0; i < array.length; i++) {
206 subTotal += array[i].precio * array[i].cantidad;
207 }
208 return subTotal.toFixed(2);
209 };
210 $scope.cargarArticulos = function() {
211 idLista = $scope.notaPedido.precioCondicion;
212 $scope.articulosTabla = [];
213 };
214 $scope.abrirModalListaPrecio = function() {
215 var modalInstance = $uibModal.open(
216 {
217 ariaLabelledBy: 'Busqueda de Precio Condición',
218 templateUrl: 'modal-precio-condicion.html',
201 var array = $scope.articulosTabla.filter( 219 controller: 'focaModalPrecioCondicionController',
202 function(a) { 220 size: 'lg'
203 return a.item <= item; 221 }
204 } 222 );
205 ); 223 modalInstance.result.then(
206 for (var i = 0; i < array.length; i++) { 224 function(precioCondicion) {
207 subTotal += array[i].precio * array[i].cantidad 225 $scope.notaPedido.precioCondicion = precioCondicion.nombre;
208 } 226 }, function() {
209 return subTotal.toFixed(2); 227
210 } 228 }
211 $scope.cargarArticulos = function() { 229 );
212 idLista = $scope.notaPedido.precioCondicion; 230 };
213 $scope.articulosTabla = []; 231 }
214 } 232 ]
215 } 233 )
216 ] 234 .controller('notaPedidoListaCtrl', [
217 ) 235 '$scope',
218 .controller('notaPedidoListaCtrl', [ 236 'crearNotaPedidoService',
219 '$scope', 237 '$location',
220 'crearNotaPedidoService', 238 function($scope, crearNotaPedidoService, $location) {
221 '$location', 239 crearNotaPedidoService.obtenerNotaPedido().then(function(datos) {
222 function($scope, crearNotaPedidoService, $location) { 240 $scope.notaPedidos = datos.data;
223 crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { 241 });
224 $scope.notaPedidos = datos.data; 242 $scope.editar = function(notaPedido) {
225 }); 243 crearNotaPedidoService.setNotaPedido(notaPedido);
226 $scope.editar = function(notaPedido) { 244 $location.path('/venta-nota-pedido/abm/');
227 crearNotaPedidoService.setNotaPedido(notaPedido); 245 };
228 $location.path('/venta-nota-pedido/abm/'); 246 $scope.crearPedido = function() {
229 } 247 crearNotaPedidoService.clearNotaPedido();
230 $scope.crearPedido = function() { 248 $location.path('/venta-nota-pedido/abm/');
231 crearNotaPedidoService.clearNotaPedido(); 249 };
232 $location.path('/venta-nota-pedido/abm/'); 250 }
233 } 251 ])
234 } 252 .controller('focaCrearNotaPedidoFichaClienteController', [
235 ]) 253 '$scope',
236 .controller('focaCrearNotaPedidoFichaClienteController', [ 254 'crearNotaPedidoService',
237 '$scope', 255 '$location',
238 'crearNotaPedidoService', 256 function($scope, crearNotaPedidoService, $location) {
239 '$location', 257 crearNotaPedidoService.obtenerNotaPedido().then(function(datos) {
240 function($scope, crearNotaPedidoService, $location) { 258 $scope.notaPedidos = datos.data;
241 crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { 259 });
242 $scope.notaPedidos = datos.data; 260 $scope.editar = function(notaPedido) {
243 }); 261 crearNotaPedidoService.setNotaPedido(notaPedido);
244 $scope.editar = function(notaPedido) { 262 $location.path('/venta-nota-pedido/abm/');
245 crearNotaPedidoService.setNotaPedido(notaPedido); 263 }
246 $location.path('/venta-nota-pedido/abm/'); 264 $scope.crearPedido = function() {
247 } 265 crearNotaPedidoService.clearNotaPedido();
248 $scope.crearPedido = function() { 266 $location.path('/venta-nota-pedido/abm/');
249 crearNotaPedidoService.clearNotaPedido(); 267 }
250 $location.path('/venta-nota-pedido/abm/'); 268 }
251 } 269 ]);
252 } 270
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 var notaPedido;
5 return { 4 return {
6 crearNotaPedido: function(notaPedido) { 5 crearNotaPedido: function(notaPedido) {
7 return $http.post(route + '/nota-pedido', {notaPedido: notaPedido}); 6 return $http.post(route + '/nota-pedido', {notaPedido: notaPedido});
8 }, 7 },
9 obtenerNotaPedido: function() { 8 obtenerNotaPedido: function() {
10 return $http.get(route +'/nota-pedido'); 9 return $http.get(route +'/nota-pedido');
11 }, 10 },
12 setNotaPedido: function(notaPedido) { 11 setNotaPedido: function(notaPedido) {
13 this.notaPedido = notaPedido; 12 this.notaPedido = notaPedido;
14 }, 13 },
15 clearNotaPedido: function() { 14 clearNotaPedido: function() {
16 this.notaPedido = undefined; 15 this.notaPedido = undefined;
17 }, 16 },
18 getNotaPedido: function() { 17 getNotaPedido: function() {
19 return this.notaPedido; 18 return this.notaPedido;
20 }, 19 },
21 getArticulosByIdNotaPedido: function(id) { 20 getArticulosByIdNotaPedido: function(id) {
22 return $http.get(route+'/articulos/nota-pedido/'+id); 21 return $http.get(route+'/articulos/nota-pedido/'+id);
23 }, 22 },
24 crearArticulosParaNotaPedido: function(articuloNotaPedido) { 23 crearArticulosParaNotaPedido: function(articuloNotaPedido) {
25 return $http.post(route + '/articulos/nota-pedido', {articuloNotaPedido: articuloNotaPedido}); 24 return $http.post(route + '/articulos/nota-pedido',
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 //EN DESARROLLO 30 //EN DESARROLLO
31 getDomicilios: function(id) { 31 getDomicilios: function(id) {
32 // return $http.get(route + '/'+id) 32 // return $http.get(route + '/'+id)
33 id='le asigno un valor para pasar pre commit';
33 var domicilio = [ 34 var domicilio = [
34 { 35 {
35 id: 1, 36 id: 1,
36 dom: 'RISSO PATRON 781' 37 dom: 'RISSO PATRON 781'
37 }, 38 },
38 { 39 {
39 id: 2, 40 id: 2,
40 dom: 'MARIANO MORENO 533' 41 dom: 'MARIANO MORENO 533'
41 }, 42 },
42 { 43 {
43 id: 3, 44 id: 3,
44 dom: 'SALTA 796' 45 dom: 'SALTA 796'
45 } 46 }
46 ] 47 ];
47 return domicilio; 48 return domicilio;
48 }, 49 },
49 getPrecioCondicion: function() { 50 getPrecioCondicion: function() {
50 return $http.get(route + '/precio-condicion') 51 return $http.get(route + '/precio-condicion');
51 }, 52 },
52 getPrecioCondicionById: function(id) { 53 getPrecioCondicionById: function(id) {
53 return $http.get(route + '/precio-condicion/' + id) 54 return $http.get(route + '/precio-condicion/' + id);
54 }, 55 },
55 getPlazoPagoByPrecioCondicion: function(id) { 56 getPlazoPagoByPrecioCondicion: function(id) {
56 return $http.get(route + '/plazo-pago/precio-condicion/'+ id) 57 return $http.get(route + '/plazo-pago/precio-condicion/'+ id);
57 } 58 }
58 } 59 };
59 }]) 60 }]);
src/views/nota-pedido.html
1 <div class="row"> 1 <div class="row">
2 <div class="col-md-10 col-lg-8 offset-md-1 offset-lg-2"> 2 <div class="col-md-10 col-lg-8 offset-md-1 offset-lg-2">
3 <div class="row bg-secondary p-3"> 3 <div class="row bg-secondary p-3">
4 <div class="form-group col-12 col-sm-6 col-md-4"> 4 <div class="form-group col-12 col-sm-6 col-md-4">
5 <div class="input-group"> 5 <div class="input-group">
6 <input 6 <input
7 type="text" 7 type="text"
8 class="form-control" 8 class="form-control"
9 uib-datepicker-popup="dd/MM/yyyy" 9 uib-datepicker-popup="dd/MM/yyyy"
10 ng-model="notaPedido.fechaCarga" 10 ng-model="notaPedido.fechaCarga"
11 is-open="popup1.opened" 11 is-open="popup1.opened"
12 datepicker-options="dateOptions" 12 datepicker-options="dateOptions"
13 close-text="Cerrar" 13 close-text="Cerrar"
14 current-text="Hoy" 14 current-text="Hoy"
15 clear-text="Borrar" 15 clear-text="Borrar"
16 alt-input-formats="altInputFormats" 16 alt-input-formats="altInputFormats"
17 /> 17 />
18 <span class="input-group-append"> 18 <span class="input-group-append">
19 <button type="button" class="btn btn-default" ng-click="popup1.opened = true"> 19 <button type="button" class="btn btn-default" ng-click="popup1.opened = true">
20 <i class="fa fa-calendar"></i> 20 <i class="fa fa-calendar"></i>
21 </button> 21 </button>
22 </span> 22 </span>
23 </div> 23 </div>
24 </div> 24 </div>
25 <div class="form-group col-12 col-sm-6 col-md-4"> 25 <div class="form-group col-12 col-sm-6 col-md-4">
26 <div class="input-group"> 26 <div class="input-group">
27 <input 27 <input
28 class="form-control" 28 class="form-control"
29 type="text" 29 type="text"
30 ng-model="notaPedido.vendedor.nombre" 30 ng-model="notaPedido.vendedor.nombre"
31 placeholder="Seleccione Vendedor" 31 placeholder="Seleccione Vendedor"
32 readonly="true" 32 readonly="true"
33 > 33 >
34 <span class="input-group-append"> 34 <span class="input-group-append">
35 <button type="button" class="btn btn-default" ng-click="seleccionarVendedor()"> 35 <button type="button" class="btn btn-default" ng-click="seleccionarVendedor()">
36 <i class="fa fa-search"></i> 36 <i class="fa fa-search"></i>
37 </button> 37 </button>
38 </span> 38 </span>
39 </div> 39 </div>
40 </div> 40 </div>
41 <div class="form-group col-12 col-sm-6 col-md-4"> 41 <div class="form-group col-12 col-sm-6 col-md-4">
42 <div class="input-group"> 42 <div class="input-group">
43 <input 43 <input
44 class="form-control selectable" 44 class="form-control selectable"
45 type="text" 45 type="text"
46 ng-model="notaPedido.cliente.nombre" 46 ng-model="notaPedido.cliente.nombre"
47 placeholder="Seleccione Cliente" 47 placeholder="Seleccione Cliente"
48 readonly="true" 48 readonly="true"
49 ng-click="mostrarFichaCliente()" 49 ng-click="mostrarFichaCliente()"
50 > 50 >
51 <span class="input-group-append"> 51 <span class="input-group-append">
52 <button type="button" class="btn btn-default" ng-click="seleccionarCliente()"> 52 <button type="button" class="btn btn-default" ng-click="seleccionarCliente()">
53 <i class="fa fa-search"></i> 53 <i class="fa fa-search"></i>
54 </button> 54 </button>
55 </span> 55 </span>
56 </div> 56 </div>
57 </div> 57 </div>
58 <div class="form-group col-12 col-sm-6 col-md-4"> 58 <div class="form-group col-12 col-sm-6 col-md-4">
59 <input 59 <input
60 class="form-control selectable" 60 class="form-control selectable"
61 type="text" 61 type="text"
62 readonly="true" 62 readonly="true"
63 ng-bind="vendedor.nombre" 63 ng-bind="vendedor.nombre"
64 ng-click="abrirModalDomicilio()" 64 ng-click="abrirModalDomicilio()"
65 placeholder="Seleccione Domicilio" 65 placeholder="Seleccione Domicilio"
66 > 66 >
67 </div> 67 </div>
68 <div class="form-group col-12 col-sm-6 col-md-4"> 68 <div class="form-group col-12 col-sm-6 col-md-4">
69 <input 69 <input
70 class="form-control selectable" 70 class="form-control selectable"
71 type="text" 71 type="text"
72 readonly="true" 72 readonly="true"
73 ng-bind="vendedor.nombre" 73 ng-bind="notaPedido.precioCondicion"
74 ng-click="abrirModalListaPrecio()" 74 ng-click="abrirModalListaPrecio()"
75 placeholder="Seleccione Lista de precio" 75 placeholder="Seleccione Lista de precio"
76 > 76 >
77 </div> 77 </div>
78 </div> 78 </div>
79 </div> 79 </div>
80 </div> 80 </div>
81 <div class="row"> 81 <div class="row">
82 <div class="col-md-10 col-lg-8 offset-md-1 offset-lg-2"> 82 <div class="col-md-10 col-lg-8 offset-md-1 offset-lg-2">
83 <div class="row"> 83 <div class="row">
84 </div> 84 </div>
85 <div class="row"> 85 <div class="row">
86 <table class="table table-striped table-sm"> 86 <table class="table table-striped table-sm">
87 <thead> 87 <thead>
88 <tr> 88 <tr>
89 <th>Sector</th> 89 <th>Sector</th>
90 <th>Código</th> 90 <th>Código</th>
91 <th>Descripción</th> 91 <th>Descripción</th>
92 <th>Cantidad</th> 92 <th>Cantidad</th>
93 <th>Precio Unitario</th> 93 <th>Precio Unitario</th>
94 <th>SubTotal</th> 94 <th>SubTotal</th>
95 <th></th> 95 <th></th>
96 <th></th> 96 <th></th>
97 </tr> 97 </tr>
98 </thead> 98 </thead>
99 <tbody> 99 <tbody>
100 <tr> 100 <tr>
101 <td colspan="2"><input class="form-control" readonly ng-click="seleccionarArticulo()"></td> 101 <td colspan="2"><input class="form-control" readonly ng-click="seleccionarArticulo()"></td>
102 <td></td> 102 <td></td>
103 <td></td> 103 <td></td>
104 <td></td> 104 <td></td>
105 <td></td> 105 <td></td>
106 <td></td> 106 <td></td>
107 <td></td> 107 <td></td>
108 </tr> 108 </tr>
109 <tr style="cursor: pointer;" ng-click="show = !show"> 109 <tr style="cursor: pointer;" ng-click="show = !show">
110 <td>1</td> 110 <td>1</td>
111 <td>1</td> 111 <td>1</td>
112 <td>Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit...</td> 112 <td>Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit...</td>
113 <td>{{10000 | number: 2}}</td> 113 <td>{{10000 | number: 2}}</td>
114 <td>{{1000000000 | currency:'$'}}</td> 114 <td>{{1000000000 | currency:'$'}}</td>
115 <td>{{1000000000 | currency:'$'}}</td> 115 <td>{{1000000000 | currency:'$'}}</td>
116 <td></td> 116 <td></td>
117 <td> 117 <td>
118 <button class="btn btn-outline-secondary" style="float: right;"> 118 <button class="btn btn-outline-secondary" style="float: right;">
119 <i class="fa fa-chevron-down" ng-hide="show" aria-hidden="true"></i> 119 <i class="fa fa-chevron-down" ng-hide="show" aria-hidden="true"></i>
120 <i class="fa fa-chevron-up" ng-show="show" aria-hidden="true"></i> 120 <i class="fa fa-chevron-up" ng-show="show" aria-hidden="true"></i>
121 </button> 121 </button>
122 </td> 122 </td>
123 </tr> 123 </tr>
124 <tr ng-show="show"> 124 <tr ng-show="show">
125 <td>1</td> 125 <td>1</td>
126 <td>2</td> 126 <td>2</td>
127 <td>Lorem Ipsum</td> 127 <td>Lorem Ipsum</td>
128 <td>1</td> 128 <td>1</td>
129 <td>{{1000000000 | currency:'U$D'}}</td> 129 <td>{{1000000000 | currency:'U$D'}}</td>
130 <td>{{10 | currency:'$'}}</td> 130 <td>{{10 | currency:'$'}}</td>
131 <td></td> 131 <td></td>
132 <td></td> 132 <td></td>
133 </tr> 133 </tr>
134 <tr ng-show="show"> 134 <tr ng-show="show">
135 <td>1</td> 135 <td>1</td>
136 <td>2</td> 136 <td>2</td>
137 <td>Lorem Ipsum</td> 137 <td>Lorem Ipsum</td>
138 <td>1</td> 138 <td>1</td>
139 <td>{{10 | currency:'$'}}</td> 139 <td>{{10 | currency:'$'}}</td>
140 <td>{{10 | currency:'$'}}</td> 140 <td>{{10 | currency:'$'}}</td>
141 <td></td> 141 <td></td>
142 <td></td> 142 <td></td>
143 </tr> 143 </tr>
144 </tbody> 144 </tbody>
145 <tfoot> 145 <tfoot>
146 <tr class="table-secondary"> 146 <tr class="table-secondary">
147 <td colspan="5"><b>Cantidad Items:</b> 3</td> 147 <td colspan="5"><b>Cantidad Items:</b> 3</td>
148 <td colspan="3">{{30 | currency:'$'}}</td> 148 <td colspan="3">{{30 | currency:'$'}}</td>
149 </tr> 149 </tr>
150 </tfoot> 150 </tfoot>
151 </table> 151 </table>
152 </div> 152 </div>
153 </div> 153 </div>
154 </div> 154 </div>
155 155
156 <!-- 156 <!--
157 <form name="formCrearNota"> 157 <form name="formCrearNota">
158 <uib-tabset active="active"> 158 <uib-tabset active="active">
159 <uib-tab index="0" heading="General"> 159 <uib-tab index="0" heading="General">
160 <input type="hidden" name="id" ng-model="notaPedido.id" /> 160 <input type="hidden" name="id" ng-model="notaPedido.id" />
161 <div> 161 <div>
162 <div class="col-auto my-2"> 162 <div class="col-auto my-2">
163 <button type="submit" title="Siguiente" class="btn btn-primary float-right">Siguiente</button> 163 <button type="submit" title="Siguiente" class="btn btn-primary float-right">Siguiente</button>
164 </div> 164 </div>
165 </div> 165 </div>
166 <br> 166 <br>
167 <br> 167 <br>
168 <div class="row"> 168 <div class="row">
169 <div class="col-md-2"> 169 <div class="col-md-2">
170 <div class="col-auto"> 170 <div class="col-auto">
171 <label>Fecha de carga</label> 171 <label>Fecha de carga</label>
172 </div> 172 </div>
173 </div> 173 </div>
174 <div class="col-md-3"> 174 <div class="col-md-3">
175 <div class="col-auto"> 175 <div class="col-auto">
176 <input type="date" class="form-control" ng-model="notaPedido.fechaCarga" ng-required="true"> 176 <input type="date" class="form-control" ng-model="notaPedido.fechaCarga" ng-required="true">
177 </div> 177 </div>
178 </div> 178 </div>
179 <div class="col-md-2"> 179 <div class="col-md-2">
180 <div class="col-auto"> 180 <div class="col-auto">
181 <label>Kilómetros</label> 181 <label>Kilómetros</label>
182 </div> 182 </div>
183 </div> 183 </div>
184 <div class="col-md-3"> 184 <div class="col-md-3">
185 <div class="col-auto"> 185 <div class="col-auto">
186 <input type="number" min="0" step="0.01" class="form-control" placeholder="Kilómetros recorridos para la entrega en el cliente" 186 <input type="number" min="0" step="0.01" class="form-control" placeholder="Kilómetros recorridos para la entrega en el cliente"
187 ng-model="notaPedido.kilometros" ng-required="true"> 187 ng-model="notaPedido.kilometros" ng-required="true">
188 </div> 188 </div>
189 </div> 189 </div>
190 </div> 190 </div>
191 <div class="row my-3"> 191 <div class="row my-3">
192 <div class="col-md-2"> 192 <div class="col-md-2">
193 <div class="col-auto"> 193 <div class="col-auto">
194 <label>Jurisdicción de IIBB</label> 194 <label>Jurisdicción de IIBB</label>
195 </div> 195 </div>
196 </div> 196 </div>
197 <div class="col-md-3"> 197 <div class="col-md-3">
198 <div class="col-auto"> 198 <div class="col-auto">
199 <input type="text" class="form-control" placeholder="Jurisdicción de IIBB donde se realiza la entrega" 199 <input type="text" class="form-control" placeholder="Jurisdicción de IIBB donde se realiza la entrega"
200 ng-model="notaPedido.jurisdiccionIIBB" ng-required="true"> 200 ng-model="notaPedido.jurisdiccionIIBB" ng-required="true">
201 </div> 201 </div>
202 </div> 202 </div>
203 <div class="col-md-2"> 203 <div class="col-md-2">
204 <div class="col-auto"> 204 <div class="col-auto">
205 <label>Costo de financiación</label> 205 <label>Costo de financiación</label>
206 </div> 206 </div>
207 </div> 207 </div>
208 <div class="col-md-3"> 208 <div class="col-md-3">
209 <div class="col-auto"> 209 <div class="col-auto">
210 <div class="input-group mb-2"> 210 <div class="input-group mb-2">
211 <div class="input-group-prepend"> 211 <div class="input-group-prepend">
212 <div class="input-group-text">$</div> 212 <div class="input-group-text">$</div>
213 </div> 213 </div>
214 <input type="number" min="0" step="0.01" class="form-control" placeholder="Costo de financiación" 214 <input type="number" min="0" step="0.01" class="form-control" placeholder="Costo de financiación"
215 ng-model="notaPedido.costoFinanciacion"> 215 ng-model="notaPedido.costoFinanciacion">
216 </div> 216 </div>
217 </div> 217 </div>
218 </div> 218 </div>
219 </div> 219 </div>
220 <div class="row"> 220 <div class="row">
221 <div class="col-md-2"> 221 <div class="col-md-2">
222 <div class="col-auto"> 222 <div class="col-auto">
223 <label>Bomba</label> 223 <label>Bomba</label>
224 </div> 224 </div>
225 </div> 225 </div>
226 <div class="col-md-1"> 226 <div class="col-md-1">
227 <div class="col-auto"> 227 <div class="col-auto">
228 <div class="form-check custom-radio custom-control-inline"> 228 <div class="form-check custom-radio custom-control-inline">
229 <input class="form-check-input" type="radio" name="radioBomba" value="1" ng-model="notaPedido.bomba"> 229 <input class="form-check-input" type="radio" name="radioBomba" value="1" ng-model="notaPedido.bomba">
230 <label class="form-check-label"> 230 <label class="form-check-label">
231 Si 231 Si
232 </label> 232 </label>
233 </div> 233 </div>
234 <div class="form-check custom-radio custom-control-inline"> 234 <div class="form-check custom-radio custom-control-inline">
235 <input class="form-check-input" type="radio" name="radioBomba" value="0" ng-model="notaPedido.bomba"> 235 <input class="form-check-input" type="radio" name="radioBomba" value="0" ng-model="notaPedido.bomba">
236 <label class="form-check-label"> 236 <label class="form-check-label">
237 No 237 No
238 </label> 238 </label>
239 </div> 239 </div>
240 </div> 240 </div>
241 </div> 241 </div>
242 <div class="col-md-1"> 242 <div class="col-md-1">
243 <div class="col-auto"> 243 <div class="col-auto">
244 <label>Flete</label> 244 <label>Flete</label>
245 </div> 245 </div>
246 </div> 246 </div>
247 <div class="col-md-1"> 247 <div class="col-md-1">
248 <div class="col-auto"> 248 <div class="col-auto">
249 <div class="form-check custom-radio custom-control-inline"> 249 <div class="form-check custom-radio custom-control-inline">
250 <input class="form-check-input" type="radio" name="radioFlete" value="1" ng-model="notaPedido.flete"> 250 <input class="form-check-input" type="radio" name="radioFlete" value="1" ng-model="notaPedido.flete">
251 <label class="form-check-label"> 251 <label class="form-check-label">
252 Si 252 Si
253 </label> 253 </label>
254 </div> 254 </div>
255 <div class="form-check custom-radio custom-control-inline"> 255 <div class="form-check custom-radio custom-control-inline">
256 <input class="form-check-input" type="radio" name="radioFlete" value="0" ng-model="notaPedido.flete"> 256 <input class="form-check-input" type="radio" name="radioFlete" value="0" ng-model="notaPedido.flete">
257 <label class="form-check-label"> 257 <label class="form-check-label">
258 FOB 258 FOB
259 </label> 259 </label>
260 </div> 260 </div>
261 </div> 261 </div>
262 </div> 262 </div>
263 <div class="col-md-2"> 263 <div class="col-md-2">
264 <div class="col-auto"> 264 <div class="col-auto">
265 <label>Costo unitario kilometro flete</label> 265 <label>Costo unitario kilometro flete</label>
266 </div> 266 </div>
267 </div> 267 </div>
268 <div class="col-md-3"> 268 <div class="col-md-3">
269 <div class="col-auto"> 269 <div class="col-auto">
270 <div class="input-group mb-2"> 270 <div class="input-group mb-2">
271 <div class="input-group-prepend"> 271 <div class="input-group-prepend">
272 <div class="input-group-text">$</div> 272 <div class="input-group-text">$</div>
273 </div> 273 </div>
274 <input type="number" min="0" step="0.01" class="form-control" placeholder="Costo unitario del kilometro del flete" 274 <input type="number" min="0" step="0.01" class="form-control" placeholder="Costo unitario del kilometro del flete"
275 ng-model="notaPedido.costoUnitarioKmFlete" ng-required="true"> 275 ng-model="notaPedido.costoUnitarioKmFlete" ng-required="true">
276 </div> 276 </div>
277 </div> 277 </div>
278 </div> 278 </div>
279 </div> 279 </div>
280 <div class="row my-3"> 280 <div class="row my-3">
281 <div class="col-md-2"> 281 <div class="col-md-2">
282 <div class="col-auto"> 282 <div class="col-auto">
283 <label>Vendedor</label> 283 <label>Vendedor</label>
284 </div> 284 </div>
285 </div> 285 </div>
286 <div class="col-md-3"> 286 <div class="col-md-3">
287 <div class="col-auto"> 287 <div class="col-auto">
288 <input type="text" class="form-control" placeholder="Seleccione vendedor" ng-model="notaPedido.vendedor" 288 <input type="text" class="form-control" placeholder="Seleccione vendedor" ng-model="notaPedido.vendedor"
289 ng-click="seleccionarVendedor()" readonly> 289 ng-click="seleccionarVendedor()" readonly>
290 </div> 290 </div>
291 </div> 291 </div>
292 <div class="col-md-2"> 292 <div class="col-md-2">
293 <div class="col-auto"> 293 <div class="col-auto">
294 <label>Petrolera</label> 294 <label>Petrolera</label>
295 </div> 295 </div>
296 </div> 296 </div>
297 <div class="col-md-3"> 297 <div class="col-md-3">
298 <div class="col-auto"> 298 <div class="col-auto">
299 <input type="text" class="form-control" placeholder="Seleccione petrolera" ng-model="notaPedido.petrolera" 299 <input type="text" class="form-control" placeholder="Seleccione petrolera" ng-model="notaPedido.petrolera"
300 ng-click="seleccionarPetrolera()" readonly> 300 ng-click="seleccionarPetrolera()" readonly>
301 </div> 301 </div>
302 </div> 302 </div>
303 </div> 303 </div>
304 </div> 304 </div>
305 <div class="row"> 305 <div class="row">
306 <div class="col-md-2"> 306 <div class="col-md-2">
307 <div class="col-auto"> 307 <div class="col-auto">
308 <label>Cliente</label> 308 <label>Cliente</label>
309 </div> 309 </div>
310 </div> 310 </div>
311 <div class="col-md-3"> 311 <div class="col-md-3">
312 <div class="col-auto"> 312 <div class="col-auto">
313 <input type="text" class="form-control" placeholder="Seleccione cliente" ng-model="notaPedido.cliente" 313 <input type="text" class="form-control" placeholder="Seleccione cliente" ng-model="notaPedido.cliente"
314 ng-click="seleccionarCliente()" ng-change="obtenerDomicilios()" readonly> 314 ng-click="seleccionarCliente()" ng-change="obtenerDomicilios()" readonly>
315 </div> 315 </div>
316 </div> 316 </div>
317 <div class="col-md-2"> 317 <div class="col-md-2">
318 <div class="col-auto"> 318 <div class="col-auto">
319 <label>Domicilio</label> 319 <label>Domicilio</label>
320 </div> 320 </div>
321 </div> 321 </div>
322 <div class="col-md-4"> 322 <div class="col-md-4">
323 <div class="col-md-12 row" ng-repeat="domicilio in notaPedido.domicilio"> 323 <div class="col-md-12 row" ng-repeat="domicilio in notaPedido.domicilio">
324 <div class="col-auto"> 324 <div class="col-auto">
325 <input type="text" ng-model="domicilio.dom" placeholder="Domicilio" uib-typeahead=" 325 <input type="text" ng-model="domicilio.dom" placeholder="Domicilio" uib-typeahead="
326 domi.dom 326 domi.dom
327 for domi 327 for domi
328 in domiciliosCliente 328 in domiciliosCliente
329 " 329 "
330 typeahead-no-results="sinResultados" typeahead-min-length="0" typeahead-on-select="seleccionar($item)" 330 typeahead-no-results="sinResultados" typeahead-min-length="0" typeahead-on-select="seleccionar($item)"
331 class="form-control mb-2" ng-disabled="domicilio.id > 0" ng-required="true"> 331 class="form-control mb-2" ng-disabled="domicilio.id > 0" ng-required="true">
332 <i ng-show="cargandoClientes" class="fas fa-sync"></i> 332 <i ng-show="cargandoClientes" class="fas fa-sync"></i>
333 <div ng-show="sinResultados"> 333 <div ng-show="sinResultados">
334 No se encontraron resultados. 334 No se encontraron resultados.
335 </div> 335 </div>
336 </div> 336 </div>
337 <a class="btn" ng-click="removeNewChoice(domicilio)" ng-if="domicilio.id==0">-</a> 337 <a class="btn" ng-click="removeNewChoice(domicilio)" ng-if="domicilio.id==0">-</a>
338 <a class="btn" ng-click="addNewDom()">+</a> 338 <a class="btn" ng-click="addNewDom()">+</a>
339 </div> 339 </div>
340 </div> 340 </div>
341 </div> 341 </div>
342 </uib-tab> 342 </uib-tab>
343 <uib-tab index="1" heading="Producto" disable="formCrearNota.$invalid"> 343 <uib-tab index="1" heading="Producto" disable="formCrearNota.$invalid">
344 <div> 344 <div>
345 <div class="col-auto my-2"> 345 <div class="col-auto my-2">
346 <button ng-click="crearNotaPedido()" type="button" title="Crear nota pedido" class="btn btn-primary float-right">Crear</button> 346 <button ng-click="crearNotaPedido()" type="button" title="Crear nota pedido" class="btn btn-primary float-right">Crear</button>
347 </div> 347 </div>
348 </div> 348 </div>
349 <br> 349 <br>
350 <br> 350 <br>
351 <div class="row"> 351 <div class="row">
352 <div class="col-md-2"> 352 <div class="col-md-2">
353 <div class="col-auto"> 353 <div class="col-auto">
354 <label>Precios y condiciones</label> 354 <label>Precios y condiciones</label>
355 </div> 355 </div>
356 </div> 356 </div>
357 <div class="col-md-4"> 357 <div class="col-md-4">
358 <div class="col-auto"> 358 <div class="col-auto">
359 <select class="form-control" ng-change="cargarArticulos()" ng-model="notaPedido.precioCondicion" ng-options="preCond.id as preCond.nombre for preCond in precioCondiciones"> 359 <select class="form-control" ng-change="cargarArticulos()" ng-model="notaPedido.precioCondicion" ng-options="preCond.id as preCond.nombre for preCond in precioCondiciones">
360 </select> 360 </select>
361 </div> 361 </div>
362 </div> 362 </div>
363 <div class="col-md-2"> 363 <div class="col-md-2">
364 <div class="col-auto"> 364 <div class="col-auto">
365 <label>Producto</label> 365 <label>Producto</label>
366 </div> 366 </div>
367 </div> 367 </div>
368 <div class="col-md-4"> 368 <div class="col-md-4">
369 <div class="col-auto"> 369 <div class="col-auto">
370 <input type="text" class="form-control" placeholder="Seleccione producto" ng-model="notaPedido.producto" 370 <input type="text" class="form-control" placeholder="Seleccione producto" ng-model="notaPedido.producto"
371 ng-click="seleccionarArticulo()" readonly> 371 ng-click="seleccionarArticulo()" readonly>
372 </div> 372 </div>
373 </div> 373 </div>
374 </div> 374 </div>
375 <div class="col-md-12"> 375 <div class="col-md-12">
376 <table class="table my-3 table-hover table-nonfluid"> 376 <table class="table my-3 table-hover table-nonfluid">
377 <thead> 377 <thead>
378 <tr> 378 <tr>
379 <th>Código</th> 379 <th>Código</th>
380 <th>Nombre</th> 380 <th>Nombre</th>
381 <th>Precio unitario</th> 381 <th>Precio unitario</th>
382 <th>Costo unitario bruto</th> 382 <th>Costo unitario bruto</th>
383 <th>Cantidad</th> 383 <th>Cantidad</th>
384 <th>Subtotal</th> 384 <th>Subtotal</th>
385 </tr> 385 </tr>
386 </thead> 386 </thead>
387 <tbody> 387 <tbody>
388 <tr ng-repeat="articulo in articulosTabla"> 388 <tr ng-repeat="articulo in articulosTabla">
389 <td ng-bind="articulo.codigo"></td> 389 <td ng-bind="articulo.codigo"></td>
390 <td ng-bind="articulo.nombre"></td> 390 <td ng-bind="articulo.nombre"></td>
391 <td ng-bind="articulo.precio"></td> 391 <td ng-bind="articulo.precio"></td>
392 <td ng-bind="articulo.costoUnitario"></td> 392 <td ng-bind="articulo.costoUnitario"></td>
393 <td><input ng-model="articulo.cantidad" class="form-control" type="number" min="0" value="1"></td> 393 <td><input ng-model="articulo.cantidad" class="form-control" type="number" min="0" value="1"></td>
394 <td ng-bind="getSubTotal(articulo.item)"></td> 394 <td ng-bind="getSubTotal(articulo.item)"></td>
395 </tr> 395 </tr>
396 </tbody> 396 </tbody>
397 </table> 397 </table>
398 </div> 398 </div>
399 </uib-tab> 399 </uib-tab>
400 </uib-tabset> 400 </uib-tabset>
401 </form>--> 401 </form>-->