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