Commit e499a011cfb2475e5741985b237231ac6c641b9f
Exists in
master
Merge branch 'master' into 'master'
Master (pmarco) See merge request modulos-npm/foca-crear-nota-pedido!37
Showing
2 changed files
Show diff stats
src/js/controller.js
1 | angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', | 1 | angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
2 | [ | 2 | [ |
3 | '$scope', '$uibModal', '$location', '$filter', 'crearNotaPedidoService', | 3 | '$scope', '$uibModal', '$location', '$filter', 'crearNotaPedidoService', |
4 | 'focaModalService', | 4 | 'focaModalService', |
5 | function( | 5 | function( |
6 | $scope, $uibModal, $location, $filter, crearNotaPedidoService, focaModalService | 6 | $scope, $uibModal, $location, $filter, crearNotaPedidoService, focaModalService |
7 | ) { | 7 | ) { |
8 | $scope.botonera = [ | 8 | $scope.botonera = [ |
9 | {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}}, | 9 | {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}}, |
10 | {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}}, | 10 | {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}}, |
11 | {texto: 'Proveedor', accion: function() {$scope.seleccionarProveedor();}}, | 11 | {texto: 'Proveedor', accion: function() {$scope.seleccionarProveedor();}}, |
12 | {texto: 'Moneda', accion: function() {$scope.abrirModalMoneda();}}, | 12 | {texto: 'Moneda', accion: function() {$scope.abrirModalMoneda();}}, |
13 | { | 13 | { |
14 | texto: 'Precios y condiciones', | 14 | texto: 'Precios y condiciones', |
15 | accion: function() {$scope.abrirModalListaPrecio();}}, | 15 | accion: function() {$scope.abrirModalListaPrecio();}}, |
16 | {texto: 'Flete', accion: function() {$scope.abrirModalFlete();}}, | 16 | {texto: 'Flete', accion: function() {$scope.abrirModalFlete();}}, |
17 | {texto: '', accion: function() {}}, | 17 | {texto: '', accion: function() {}}, |
18 | {texto: '', accion: function() {}} | 18 | {texto: '', accion: function() {}} |
19 | ]; | 19 | ]; |
20 | $scope.datepickerAbierto = false; | ||
20 | 21 | ||
21 | $scope.show = false; | 22 | $scope.show = false; |
22 | $scope.cargando = true; | 23 | $scope.cargando = true; |
23 | $scope.dateOptions = { | 24 | $scope.dateOptions = { |
24 | maxDate: new Date(), | 25 | maxDate: new Date(), |
25 | minDate: new Date(2010, 0, 1) | 26 | minDate: new Date(2010, 0, 1) |
26 | }; | 27 | }; |
27 | 28 | ||
28 | $scope.notaPedido = { | 29 | $scope.notaPedido = { |
29 | vendedor: {}, | 30 | vendedor: {}, |
30 | cliente: {}, | 31 | cliente: {}, |
31 | domicilio: {dom: ''}, | 32 | domicilio: {dom: ''}, |
32 | moneda: {detalle: ''} | 33 | moneda: {detalle: ''} |
33 | }; | 34 | }; |
34 | 35 | ||
35 | $scope.cabecera = []; | 36 | $scope.cabecera = []; |
36 | $scope.showCabecera = true; | 37 | $scope.showCabecera = true; |
37 | 38 | ||
38 | $scope.now = new Date(); | 39 | $scope.now = new Date(); |
39 | $scope.puntoVenta = Math.round(Math.random() * 10000); | 40 | $scope.puntoVenta = Math.round(Math.random() * 10000); |
40 | $scope.comprobante = Math.round(Math.random() * 1000000); | 41 | $scope.comprobante = Math.round(Math.random() * 1000000); |
41 | 42 | ||
42 | $scope.articulosTabla = []; | 43 | $scope.articulosTabla = []; |
43 | var idLista; | 44 | var idLista; |
44 | var notaPedidoTemp = crearNotaPedidoService.getNotaPedido(); | 45 | var notaPedidoTemp = crearNotaPedidoService.getNotaPedido(); |
45 | crearNotaPedidoService.getPrecioCondicion().then( | 46 | crearNotaPedidoService.getPrecioCondicion().then( |
46 | function(res) { | 47 | function(res) { |
47 | $scope.precioCondiciones = res.data; | 48 | $scope.precioCondiciones = res.data; |
48 | } | 49 | } |
49 | ); | 50 | ); |
50 | if (notaPedidoTemp !== undefined) { | 51 | if (notaPedidoTemp !== undefined) { |
51 | notaPedidoTemp.fechaCarga = new Date(notaPedidoTemp.fechaCarga); | 52 | notaPedidoTemp.fechaCarga = new Date(notaPedidoTemp.fechaCarga); |
52 | $scope.notaPedido = notaPedidoTemp; | 53 | $scope.notaPedido = notaPedidoTemp; |
53 | $scope.notaPedido.flete = ($scope.notaPedido.flete).toString(); | 54 | $scope.notaPedido.flete = ($scope.notaPedido.flete).toString(); |
54 | $scope.notaPedido.bomba = ($scope.notaPedido.bomba).toString(); | 55 | $scope.notaPedido.bomba = ($scope.notaPedido.bomba).toString(); |
55 | idLista = $scope.notaPedido.precioCondicion; | 56 | idLista = $scope.notaPedido.precioCondicion; |
56 | crearNotaPedidoService | 57 | crearNotaPedidoService |
57 | .getArticulosByIdNotaPedido($scope.notaPedido.id).then( | 58 | .getArticulosByIdNotaPedido($scope.notaPedido.id).then( |
58 | function(res) { | 59 | function(res) { |
59 | $scope.articulosTabla = res.data; | 60 | $scope.articulosTabla = res.data; |
60 | } | 61 | } |
61 | ); | 62 | ); |
62 | //TODO DOMICILIOS QUE SE CARGAN AL EDITAR NOTA DE PEDIDO | 63 | //TODO DOMICILIOS QUE SE CARGAN AL EDITAR NOTA DE PEDIDO |
63 | //(NO REQUERIDO EN ESTA VERSION) | 64 | //(NO REQUERIDO EN ESTA VERSION) |
64 | // crearNotaPedidoService.getDomiciliosByIdNotaPedido($scope.notaPedido.id).then( | 65 | // crearNotaPedidoService.getDomiciliosByIdNotaPedido($scope.notaPedido.id).then( |
65 | // function(res) { | 66 | // function(res) { |
66 | // $scope.notaPedido.domicilio = res.data; | 67 | // $scope.notaPedido.domicilio = res.data; |
67 | // } | 68 | // } |
68 | // ); | 69 | // ); |
69 | } else { | 70 | } else { |
70 | $scope.notaPedido.fechaCarga = new Date(); | 71 | $scope.notaPedido.fechaCarga = new Date(); |
71 | $scope.notaPedido.bomba = '0'; | 72 | $scope.notaPedido.bomba = '0'; |
72 | $scope.notaPedido.flete = '0'; | 73 | $scope.notaPedido.flete = '0'; |
73 | idLista = undefined; | 74 | idLista = undefined; |
74 | } | 75 | } |
75 | //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO | 76 | //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO |
76 | // $scope.addNewDom = function() { | 77 | // $scope.addNewDom = function() { |
77 | // $scope.notaPedido.domicilio.push({ 'id': 0 }); | 78 | // $scope.notaPedido.domicilio.push({ 'id': 0 }); |
78 | // }; | 79 | // }; |
79 | // $scope.removeNewChoice = function(choice) { | 80 | // $scope.removeNewChoice = function(choice) { |
80 | // if ($scope.notaPedido.domicilio.length > 1) { | 81 | // if ($scope.notaPedido.domicilio.length > 1) { |
81 | // $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex( | 82 | // $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex( |
82 | // function(c) { | 83 | // function(c) { |
83 | // return c.$$hashKey === choice.$$hashKey; | 84 | // return c.$$hashKey === choice.$$hashKey; |
84 | // } | 85 | // } |
85 | // ), 1); | 86 | // ), 1); |
86 | // } | 87 | // } |
87 | // }; | 88 | // }; |
88 | $scope.crearNotaPedido = function() { | 89 | $scope.crearNotaPedido = function() { |
89 | if($scope.articulosTabla.length === 0) { | 90 | if($scope.articulosTabla.length === 0) { |
90 | focaModalService.alert('Debe cargar almenos un articulo'); | 91 | focaModalService.alert('Debe cargar almenos un articulo'); |
91 | return; | 92 | return; |
92 | } | 93 | } |
93 | if($scope.notaPedido.domicilio.id === undefined) { | 94 | if($scope.notaPedido.domicilio.id === undefined) { |
94 | $scope.notaPedido.domicilio.id = 0; | 95 | $scope.notaPedido.domicilio.id = 0; |
95 | } | 96 | } |
96 | var date = new Date(); | 97 | var date = new Date(); |
97 | var notaPedido = { | 98 | var notaPedido = { |
98 | id: 0, | 99 | id: 0, |
99 | fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) | 100 | fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) |
100 | .toISOString().slice(0, 19).replace('T', ' '), | 101 | .toISOString().slice(0, 19).replace('T', ' '), |
101 | vendedor: $scope.notaPedido.vendedor.nombre, | 102 | vendedor: $scope.notaPedido.vendedor.nombre, |
102 | idCliente: $scope.notaPedido.cliente.id, | 103 | idCliente: $scope.notaPedido.cliente.id, |
103 | domicilio: $scope.notaPedido.domicilio, | 104 | domicilio: $scope.notaPedido.domicilio, |
104 | bomba: $scope.notaPedido.bomba, | 105 | bomba: $scope.notaPedido.bomba, |
105 | flete: $scope.notaPedido.flete, | 106 | flete: $scope.notaPedido.flete, |
106 | total: $scope.getTotal() | 107 | total: $scope.getTotal() |
107 | }; | 108 | }; |
108 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( | 109 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( |
109 | function(data) { | 110 | function(data) { |
110 | focaModalService.alert('Nota pedido creada'); | 111 | focaModalService.alert('Nota pedido creada'); |
111 | if($scope.notaPedido.flete === 1) { | 112 | if($scope.notaPedido.flete === 1) { |
112 | var flete = { | 113 | var flete = { |
113 | idNotaPedido: data.data.id, | 114 | idNotaPedido: data.data.id, |
114 | idTransportista: $scope.notaPedido.fleteId, | 115 | idTransportista: $scope.notaPedido.fleteId, |
115 | idChofer: $scope.notaPedido.chofer.id, | 116 | idChofer: $scope.notaPedido.chofer.id, |
116 | idVehiculo: $scope.notaPedido.vehiculo.id, | 117 | idVehiculo: $scope.notaPedido.vehiculo.id, |
117 | kilometros: $scope.notaPedido.kilometros, | 118 | kilometros: $scope.notaPedido.kilometros, |
118 | costoKilometro: $scope.notaPedido.costoUnitarioKmFlete | 119 | costoKilometro: $scope.notaPedido.costoUnitarioKmFlete |
119 | }; | 120 | }; |
120 | crearNotaPedidoService.crearFlete(flete); | 121 | crearNotaPedidoService.crearFlete(flete); |
121 | } | 122 | } |
122 | var articulosNotaPedido = $scope.articulosTabla; | 123 | var articulosNotaPedido = $scope.articulosTabla; |
123 | for(var i = 0; i < articulosNotaPedido.length; i++) { | 124 | for(var i = 0; i < articulosNotaPedido.length; i++) { |
124 | delete articulosNotaPedido[i].edit; | 125 | delete articulosNotaPedido[i].edit; |
125 | articulosNotaPedido[i].idNotaPedido = data.data.id; | 126 | articulosNotaPedido[i].idNotaPedido = data.data.id; |
126 | crearNotaPedidoService | 127 | crearNotaPedidoService |
127 | .crearArticulosParaNotaPedido(articulosNotaPedido[i]); | 128 | .crearArticulosParaNotaPedido(articulosNotaPedido[i]); |
128 | } | 129 | } |
129 | $scope.limpiarPantalla(); | 130 | $scope.limpiarPantalla(); |
130 | } | 131 | } |
131 | ); | 132 | ); |
132 | }; | 133 | }; |
133 | 134 | ||
134 | $scope.seleccionarArticulo = function() { | 135 | $scope.seleccionarArticulo = function() { |
135 | if (idLista === undefined) { | 136 | if (idLista === undefined) { |
136 | focaModalService.alert( | 137 | focaModalService.alert( |
137 | 'Primero seleccione una lista de precio y condicion'); | 138 | 'Primero seleccione una lista de precio y condicion'); |
138 | return; | 139 | return; |
139 | } | 140 | } |
140 | var modalInstance = $uibModal.open( | 141 | var modalInstance = $uibModal.open( |
141 | { | 142 | { |
142 | ariaLabelledBy: 'Busqueda de Productos', | 143 | ariaLabelledBy: 'Busqueda de Productos', |
143 | templateUrl: 'modal-busqueda-productos.html', | 144 | templateUrl: 'modal-busqueda-productos.html', |
144 | controller: 'modalBusquedaProductosCtrl', | 145 | controller: 'modalBusquedaProductosCtrl', |
145 | resolve: { idLista: function() { return idLista; } }, | 146 | resolve: { idLista: function() { return idLista; } }, |
146 | size: 'lg' | 147 | size: 'lg' |
147 | } | 148 | } |
148 | ); | 149 | ); |
149 | modalInstance.result.then( | 150 | modalInstance.result.then( |
150 | function(producto) { | 151 | function(producto) { |
151 | var newArt = | 152 | var newArt = |
152 | { | 153 | { |
153 | id: 0, | 154 | id: 0, |
154 | codigo: producto.codigo, | 155 | codigo: producto.codigo, |
155 | sector: producto.sector, | 156 | sector: producto.sector, |
156 | sectorCodigo: producto.sector + '-' + producto.codigo, | 157 | sectorCodigo: producto.sector + '-' + producto.codigo, |
157 | descripcion: producto.descripcion, | 158 | descripcion: producto.descripcion, |
158 | item: $scope.articulosTabla.length + 1, | 159 | item: $scope.articulosTabla.length + 1, |
159 | nombre: producto.descripcion, | 160 | nombre: producto.descripcion, |
160 | precio: producto.precio.toFixed(2), | 161 | precio: producto.precio.toFixed(2), |
161 | costoUnitario: producto.costo, | 162 | costoUnitario: producto.costo, |
162 | edit: false | 163 | edit: false |
163 | }; | 164 | }; |
164 | $scope.articuloACargar = newArt; | 165 | $scope.articuloACargar = newArt; |
165 | $scope.cargando = false; | 166 | $scope.cargando = false; |
166 | }, function() { | 167 | }, function() { |
167 | // funcion ejecutada cuando se cancela el modal | 168 | // funcion ejecutada cuando se cancela el modal |
168 | } | 169 | } |
169 | ); | 170 | ); |
170 | }; | 171 | }; |
171 | 172 | ||
172 | $scope.seleccionarVendedor = function() { | 173 | $scope.seleccionarVendedor = function() { |
173 | var modalInstance = $uibModal.open( | 174 | var modalInstance = $uibModal.open( |
174 | { | 175 | { |
175 | ariaLabelledBy: 'Busqueda de Vendedores', | 176 | ariaLabelledBy: 'Busqueda de Vendedores', |
176 | templateUrl: 'modal-vendedores.html', | 177 | templateUrl: 'modal-vendedores.html', |
177 | controller: 'modalVendedoresCtrl', | 178 | controller: 'modalVendedoresCtrl', |
178 | size: 'lg' | 179 | size: 'lg' |
179 | } | 180 | } |
180 | ); | 181 | ); |
181 | modalInstance.result.then( | 182 | modalInstance.result.then( |
182 | function(vendedor) { | 183 | function(vendedor) { |
183 | addCabecera('Vendedor:', vendedor.NomVen); | 184 | addCabecera('Vendedor:', vendedor.NomVen); |
184 | $scope.notaPedido.vendedor.nombre = vendedor.NomVen; | 185 | $scope.notaPedido.vendedor.nombre = vendedor.NomVen; |
185 | }, function() { | 186 | }, function() { |
186 | 187 | ||
187 | } | 188 | } |
188 | ); | 189 | ); |
189 | }; | 190 | }; |
190 | 191 | ||
191 | $scope.seleccionarProveedor = function() { | 192 | $scope.seleccionarProveedor = function() { |
192 | var modalInstance = $uibModal.open( | 193 | var modalInstance = $uibModal.open( |
193 | { | 194 | { |
194 | ariaLabelledBy: 'Busqueda de Proveedor', | 195 | ariaLabelledBy: 'Busqueda de Proveedor', |
195 | templateUrl: 'modal-proveedor.html', | 196 | templateUrl: 'modal-proveedor.html', |
196 | controller: 'focaModalProveedorCtrl', | 197 | controller: 'focaModalProveedorCtrl', |
197 | size: 'lg' | 198 | size: 'lg' |
198 | } | 199 | } |
199 | ); | 200 | ); |
200 | modalInstance.result.then( | 201 | modalInstance.result.then( |
201 | function(proveedor) { | 202 | function(proveedor) { |
202 | $scope.notaPedido.proveedor = proveedor.NOM; | 203 | $scope.notaPedido.proveedor = proveedor.NOM; |
203 | addCabecera('Proveedor:', proveedor.NOM); | 204 | addCabecera('Proveedor:', proveedor.NOM); |
204 | }, function() { | 205 | }, function() { |
205 | 206 | ||
206 | } | 207 | } |
207 | ); | 208 | ); |
208 | }; | 209 | }; |
209 | 210 | ||
210 | $scope.seleccionarCliente = function() { | 211 | $scope.seleccionarCliente = function() { |
211 | var modalInstance = $uibModal.open( | 212 | var modalInstance = $uibModal.open( |
212 | { | 213 | { |
213 | ariaLabelledBy: 'Busqueda de Cliente', | 214 | ariaLabelledBy: 'Busqueda de Cliente', |
214 | templateUrl: 'foca-busqueda-cliente-modal.html', | 215 | templateUrl: 'foca-busqueda-cliente-modal.html', |
215 | controller: 'focaBusquedaClienteModalController', | 216 | controller: 'focaBusquedaClienteModalController', |
216 | size: 'lg' | 217 | size: 'lg' |
217 | } | 218 | } |
218 | ); | 219 | ); |
219 | modalInstance.result.then( | 220 | modalInstance.result.then( |
220 | function(cliente) { | 221 | function(cliente) { |
221 | $scope.notaPedido.cliente.nombre = cliente.nom; | 222 | $scope.notaPedido.cliente.nombre = cliente.nom; |
222 | $scope.notaPedido.cliente.id = cliente.cod; | 223 | $scope.notaPedido.cliente.id = cliente.cod; |
223 | crearNotaPedidoService.getDomiciliosByIdCliente(cliente.cod).then( | 224 | crearNotaPedidoService.getDomiciliosByIdCliente(cliente.cod).then( |
224 | function(data) { | 225 | function(data) { |
225 | if(data.data.length === 0){ | 226 | if(data.data.length === 0){ |
226 | focaModalService | 227 | focaModalService |
227 | .alert('El cliente no tienen domicilios de entrega') | 228 | .alert('El cliente no tienen domicilios de entrega') |
228 | .then( | 229 | .then( |
229 | function() { | 230 | function() { |
230 | $scope.seleccionarCliente(); | 231 | $scope.seleccionarCliente(); |
231 | $scope.notaPedido.cliente = {nombre: ''}; | 232 | $scope.notaPedido.cliente = {nombre: ''}; |
232 | } | 233 | } |
233 | ); | 234 | ); |
234 | return; | 235 | return; |
235 | } | 236 | } |
236 | var modalInstanceDomicilio = $uibModal.open( | 237 | var modalInstanceDomicilio = $uibModal.open( |
237 | { | 238 | { |
238 | ariaLabelledBy: 'Busqueda de Domicilios', | 239 | ariaLabelledBy: 'Busqueda de Domicilios', |
239 | templateUrl: 'modal-domicilio.html', | 240 | templateUrl: 'modal-domicilio.html', |
240 | controller: 'focaModalDomicilioController', | 241 | controller: 'focaModalDomicilioController', |
241 | resolve: { idCliente: function() { return cliente.cod; }}, | 242 | resolve: { idCliente: function() { return cliente.cod; }}, |
242 | size: 'lg', | 243 | size: 'lg', |
243 | backdrop: 'static', | 244 | backdrop: 'static', |
244 | } | 245 | } |
245 | ); | 246 | ); |
246 | modalInstanceDomicilio.result.then( | 247 | modalInstanceDomicilio.result.then( |
247 | function(domicilio) { | 248 | function(domicilio) { |
248 | focaModalService.alert('Domicilio elegido' + domicilio.dom); | 249 | focaModalService.alert('Domicilio elegido' + domicilio.dom); |
249 | }, function() { | 250 | }, function() { |
250 | $scope.notaPedido.cliente.nombre = ''; | 251 | $scope.notaPedido.cliente.nombre = ''; |
251 | $scope.notaPedido.cliente.id = ''; | 252 | $scope.notaPedido.cliente.id = ''; |
252 | removeCabecera('Cliente:'); | 253 | removeCabecera('Cliente:'); |
253 | $scope.seleccionarCliente(); | 254 | $scope.seleccionarCliente(); |
254 | return; | 255 | return; |
255 | } | 256 | } |
256 | ); | 257 | ); |
257 | } | 258 | } |
258 | ); | 259 | ); |
259 | addCabecera('Cliente:', cliente.nom); | 260 | addCabecera('Cliente:', cliente.nom); |
260 | }, function() { | 261 | }, function() { |
261 | 262 | ||
262 | } | 263 | } |
263 | ); | 264 | ); |
264 | }; | 265 | }; |
265 | 266 | ||
266 | $scope.mostrarFichaCliente = function() { | 267 | $scope.mostrarFichaCliente = function() { |
267 | $uibModal.open( | 268 | $uibModal.open( |
268 | { | 269 | { |
269 | ariaLabelledBy: 'Datos del Cliente', | 270 | ariaLabelledBy: 'Datos del Cliente', |
270 | templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html', | 271 | templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html', |
271 | controller: 'focaCrearNotaPedidoFichaClienteController', | 272 | controller: 'focaCrearNotaPedidoFichaClienteController', |
272 | size: 'lg' | 273 | size: 'lg' |
273 | } | 274 | } |
274 | ); | 275 | ); |
275 | }; | 276 | }; |
276 | 277 | ||
277 | $scope.getTotal = function() { | 278 | $scope.getTotal = function() { |
278 | var total = 0; | 279 | var total = 0; |
279 | var arrayTempArticulos = $scope.articulosTabla; | 280 | var arrayTempArticulos = $scope.articulosTabla; |
280 | for (var i = 0; i < arrayTempArticulos.length; i++) { | 281 | for (var i = 0; i < arrayTempArticulos.length; i++) { |
281 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; | 282 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; |
282 | } | 283 | } |
283 | return total.toFixed(2); | 284 | return total.toFixed(2); |
284 | }; | 285 | }; |
285 | 286 | ||
286 | $scope.getSubTotal = function() { | 287 | $scope.getSubTotal = function() { |
287 | if($scope.articuloACargar) { | 288 | if($scope.articuloACargar) { |
288 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; | 289 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; |
289 | } | 290 | } |
290 | }; | 291 | }; |
291 | 292 | ||
292 | $scope.abrirModalListaPrecio = function() { | 293 | $scope.abrirModalListaPrecio = function() { |
293 | var modalInstance = $uibModal.open( | 294 | var modalInstance = $uibModal.open( |
294 | { | 295 | { |
295 | ariaLabelledBy: 'Busqueda de Precio Condición', | 296 | ariaLabelledBy: 'Busqueda de Precio Condición', |
296 | templateUrl: 'modal-precio-condicion.html', | 297 | templateUrl: 'modal-precio-condicion.html', |
297 | controller: 'focaModalPrecioCondicionController', | 298 | controller: 'focaModalPrecioCondicionController', |
298 | size: 'lg' | 299 | size: 'lg' |
299 | } | 300 | } |
300 | ); | 301 | ); |
301 | modalInstance.result.then( | 302 | modalInstance.result.then( |
302 | function(precioCondicion) { | 303 | function(precioCondicion) { |
303 | var cabecera = ''; | 304 | var cabecera = ''; |
304 | var plazosConcat = ''; | 305 | var plazosConcat = ''; |
305 | if(!Array.isArray(precioCondicion)) { | 306 | if(!Array.isArray(precioCondicion)) { |
306 | $scope.plazosPagos = precioCondicion.plazoPago; | 307 | $scope.plazosPagos = precioCondicion.plazoPago; |
307 | idLista = precioCondicion.idListaPrecio; | 308 | idLista = precioCondicion.idListaPrecio; |
308 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { | 309 | for(var i = 0; i < precioCondicion.plazoPago.length; i++) { |
309 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; | 310 | plazosConcat += precioCondicion.plazoPago[i].dias + ' '; |
310 | } | 311 | } |
311 | cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); | 312 | cabecera = precioCondicion.nombre + ' ' + plazosConcat.trim(); |
312 | } else { //Cuando se ingresan los plazos manualmente | 313 | } else { //Cuando se ingresan los plazos manualmente |
313 | idLista = -1; //-1, el modal productos busca todos los productos | 314 | idLista = -1; //-1, el modal productos busca todos los productos |
314 | $scope.notaPedido.plazoPago = precioCondicion; | 315 | $scope.notaPedido.plazoPago = precioCondicion; |
315 | for(var j = 0; j < precioCondicion.length; j++) { | 316 | for(var j = 0; j < precioCondicion.length; j++) { |
316 | plazosConcat += precioCondicion[j].dias + ' '; | 317 | plazosConcat += precioCondicion[j].dias + ' '; |
317 | } | 318 | } |
318 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); | 319 | cabecera = 'Ingreso manual ' + plazosConcat.trim(); |
319 | } | 320 | } |
320 | $scope.articulosTabla = []; | 321 | $scope.articulosTabla = []; |
321 | addCabecera('Precios y condiciones:', cabecera); | 322 | addCabecera('Precios y condiciones:', cabecera); |
322 | }, function() { | 323 | }, function() { |
323 | 324 | ||
324 | } | 325 | } |
325 | ); | 326 | ); |
326 | }; | 327 | }; |
327 | 328 | ||
328 | $scope.abrirModalFlete = function() { | 329 | $scope.abrirModalFlete = function() { |
329 | var modalInstance = $uibModal.open( | 330 | var modalInstance = $uibModal.open( |
330 | { | 331 | { |
331 | ariaLabelledBy: 'Busqueda de Flete', | 332 | ariaLabelledBy: 'Busqueda de Flete', |
332 | templateUrl: 'modal-flete.html', | 333 | templateUrl: 'modal-flete.html', |
333 | controller: 'focaModalFleteController', | 334 | controller: 'focaModalFleteController', |
334 | size: 'lg', | 335 | size: 'lg', |
335 | resolve: { | 336 | resolve: { |
336 | parametrosFlete: | 337 | parametrosFlete: |
337 | function() { | 338 | function() { |
338 | return { | 339 | return { |
339 | flete: $scope.notaPedido.flete, | 340 | flete: $scope.notaPedido.flete, |
340 | bomba: $scope.notaPedido.bomba, | 341 | bomba: $scope.notaPedido.bomba, |
341 | kilometros: $scope.notaPedido.kilometros | 342 | kilometros: $scope.notaPedido.kilometros |
342 | }; | 343 | }; |
343 | } | 344 | } |
344 | } | 345 | } |
345 | } | 346 | } |
346 | ); | 347 | ); |
347 | modalInstance.result.then( | 348 | modalInstance.result.then( |
348 | function(datos) { | 349 | function(datos) { |
349 | $scope.notaPedido.flete = datos.flete; | 350 | $scope.notaPedido.flete = datos.flete; |
350 | $scope.notaPedido.bomba = datos.bomba; | 351 | $scope.notaPedido.bomba = datos.bomba; |
351 | $scope.notaPedido.kilometros = datos.kilometros; | 352 | $scope.notaPedido.kilometros = datos.kilometros; |
352 | 353 | ||
353 | addCabecera('Flete:', datos.flete); | 354 | addCabecera('Flete:', datos.flete); |
354 | if(datos.flete === 'si') { | 355 | if(datos.flete === 'si') { |
355 | addCabecera('Bomba:', datos.bomba); | 356 | addCabecera('Bomba:', datos.bomba); |
356 | addCabecera('Kilometros:', datos.kilometros); | 357 | addCabecera('Kilometros:', datos.kilometros); |
357 | } else { | 358 | } else { |
358 | removeCabecera('Bomba:'); | 359 | removeCabecera('Bomba:'); |
359 | removeCabecera('Kilometros:'); | 360 | removeCabecera('Kilometros:'); |
360 | } | 361 | } |
361 | }, function() { | 362 | }, function() { |
362 | 363 | ||
363 | } | 364 | } |
364 | ); | 365 | ); |
365 | }; | 366 | }; |
366 | 367 | ||
367 | $scope.abrirModalMoneda = function() { | 368 | $scope.abrirModalMoneda = function() { |
368 | var modalInstance = $uibModal.open( | 369 | var modalInstance = $uibModal.open( |
369 | { | 370 | { |
370 | ariaLabelledBy: 'Busqueda de Moneda', | 371 | ariaLabelledBy: 'Busqueda de Moneda', |
371 | templateUrl: 'modal-moneda.html', | 372 | templateUrl: 'modal-moneda.html', |
372 | controller: 'focaModalMonedaController', | 373 | controller: 'focaModalMonedaController', |
373 | size: 'lg' | 374 | size: 'lg' |
374 | } | 375 | } |
375 | ); | 376 | ); |
376 | modalInstance.result.then( | 377 | modalInstance.result.then( |
377 | function(moneda) { | 378 | function(moneda) { |
378 | $scope.notaPedido.moneda = { | 379 | $scope.notaPedido.moneda = { |
379 | id: moneda.ID, | 380 | id: moneda.ID, |
380 | detalle: moneda.DETALLE, | 381 | detalle: moneda.DETALLE, |
381 | simbolo: moneda.SIMBOLO | 382 | simbolo: moneda.SIMBOLO |
382 | }; | 383 | }; |
383 | 384 | ||
384 | addCabecera('Moneda:', moneda.DETALLE); | 385 | addCabecera('Moneda:', moneda.DETALLE); |
385 | }, function() { | 386 | }, function() { |
386 | 387 | ||
387 | } | 388 | } |
388 | ); | 389 | ); |
389 | }; | 390 | }; |
390 | 391 | ||
391 | $scope.agregarATabla = function(key) { | 392 | $scope.agregarATabla = function(key) { |
392 | if(key === 13) { | 393 | if(key === 13) { |
393 | if($scope.articuloACargar.cantidad === undefined || | 394 | if($scope.articuloACargar.cantidad === undefined || |
394 | $scope.articuloACargar.cantidad === 0 || | 395 | $scope.articuloACargar.cantidad === 0 || |
395 | $scope.articuloACargar.cantidad === null ){ | 396 | $scope.articuloACargar.cantidad === null ){ |
396 | focaModalService.alert('El valor debe ser al menos 1'); | 397 | focaModalService.alert('El valor debe ser al menos 1'); |
397 | return; | 398 | return; |
398 | } | 399 | } |
399 | delete $scope.articuloACargar.sectorCodigo; | 400 | delete $scope.articuloACargar.sectorCodigo; |
400 | $scope.articulosTabla.push($scope.articuloACargar); | 401 | $scope.articulosTabla.push($scope.articuloACargar); |
401 | $scope.cargando = true; | 402 | $scope.cargando = true; |
402 | } | 403 | } |
403 | }; | 404 | }; |
404 | 405 | ||
405 | $scope.quitarArticulo = function(key) { | 406 | $scope.quitarArticulo = function(key) { |
406 | $scope.articulosTabla.splice(key, 1); | 407 | $scope.articulosTabla.splice(key, 1); |
407 | }; | 408 | }; |
408 | 409 | ||
409 | $scope.editarArticulo = function(key, articulo) { | 410 | $scope.editarArticulo = function(key, articulo) { |
410 | if(key === 13) { | 411 | if(key === 13) { |
411 | if(articulo.cantidad === null || articulo.cantidad === 0 || | 412 | if(articulo.cantidad === null || articulo.cantidad === 0 || |
412 | articulo.cantidad === undefined){ | 413 | articulo.cantidad === undefined){ |
413 | focaModalService.alert('El valor debe ser al menos 1'); | 414 | focaModalService.alert('El valor debe ser al menos 1'); |
414 | return; | 415 | return; |
415 | } | 416 | } |
416 | articulo.edit = false; | 417 | articulo.edit = false; |
417 | } | 418 | } |
418 | }; | 419 | }; |
419 | 420 | ||
420 | $scope.cambioEdit = function(articulo) { | 421 | $scope.cambioEdit = function(articulo) { |
421 | articulo.edit = true; | 422 | articulo.edit = true; |
422 | }; | 423 | }; |
423 | 424 | ||
424 | $scope.limpiarFlete = function() { | 425 | $scope.limpiarFlete = function() { |
425 | $scope.notaPedido.fleteNombre = ''; | 426 | $scope.notaPedido.fleteNombre = ''; |
426 | $scope.notaPedido.chofer = ''; | 427 | $scope.notaPedido.chofer = ''; |
427 | $scope.notaPedido.vehiculo = ''; | 428 | $scope.notaPedido.vehiculo = ''; |
428 | $scope.notaPedido.kilometros = ''; | 429 | $scope.notaPedido.kilometros = ''; |
429 | $scope.notaPedido.costoUnitarioKmFlete = ''; | 430 | $scope.notaPedido.costoUnitarioKmFlete = ''; |
430 | $scope.choferes = ''; | 431 | $scope.choferes = ''; |
431 | $scope.vehiculos = ''; | 432 | $scope.vehiculos = ''; |
432 | }; | 433 | }; |
433 | 434 | ||
434 | $scope.limpiarPantalla = function() { | 435 | $scope.limpiarPantalla = function() { |
435 | $scope.limpiarFlete(); | 436 | $scope.limpiarFlete(); |
436 | $scope.notaPedido.flete = '0'; | 437 | $scope.notaPedido.flete = '0'; |
437 | $scope.notaPedido.bomba = '0'; | 438 | $scope.notaPedido.bomba = '0'; |
438 | $scope.notaPedido.precioCondicion = ''; | 439 | $scope.notaPedido.precioCondicion = ''; |
439 | $scope.articulosTabla = []; | 440 | $scope.articulosTabla = []; |
440 | $scope.notaPedido.vendedor.nombre = ''; | 441 | $scope.notaPedido.vendedor.nombre = ''; |
441 | $scope.notaPedido.cliente = {nombre: ''}; | 442 | $scope.notaPedido.cliente = {nombre: ''}; |
442 | $scope.notaPedido.domicilio = {dom: ''}; | 443 | $scope.notaPedido.domicilio = {dom: ''}; |
443 | $scope.domiciliosCliente = []; | 444 | $scope.domiciliosCliente = []; |
444 | }; | 445 | }; |
445 | 446 | ||
446 | $scope.resetFilter = function() { | 447 | $scope.resetFilter = function() { |
447 | $scope.articuloACargar = {}; | 448 | $scope.articuloACargar = {}; |
448 | $scope.cargando = true; | 449 | $scope.cargando = true; |
449 | }; | 450 | }; |
450 | 451 | ||
451 | $scope.selectFocus = function($event) { | 452 | $scope.selectFocus = function($event) { |
452 | $event.target.select(); | 453 | $event.target.select(); |
453 | }; | 454 | }; |
454 | 455 | ||
455 | $scope.salir = function() { | 456 | $scope.salir = function() { |
456 | $location.path('/'); | 457 | $location.path('/'); |
457 | }; | 458 | }; |
458 | 459 | ||
459 | function addCabecera(label, valor) { | 460 | function addCabecera(label, valor) { |
460 | var propiedad = $filter('filter')($scope.cabecera, {label: label}); | 461 | var propiedad = $filter('filter')($scope.cabecera, {label: label}); |
461 | if(propiedad.length === 1) { | 462 | if(propiedad.length === 1) { |
462 | propiedad[0].valor = valor; | 463 | propiedad[0].valor = valor; |
463 | } else { | 464 | } else { |
464 | $scope.cabecera.push({label: label, valor: valor}); | 465 | $scope.cabecera.push({label: label, valor: valor}); |
465 | } | 466 | } |
466 | } | 467 | } |
467 | 468 | ||
468 | function removeCabecera(label) { | 469 | function removeCabecera(label) { |
469 | var propiedad = $filter('filter')($scope.cabecera, {label: label}); | 470 | var propiedad = $filter('filter')($scope.cabecera, {label: label}); |
470 | if(propiedad.length === 1){ | 471 | if(propiedad.length === 1){ |
471 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); | 472 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); |
472 | } | 473 | } |
473 | } | 474 | } |
474 | } | 475 | } |
475 | ] | 476 | ] |
476 | ) | 477 | ) |
477 | .controller('notaPedidoListaCtrl', [ | 478 | .controller('notaPedidoListaCtrl', [ |
478 | '$scope', | 479 | '$scope', |
479 | 'crearNotaPedidoService', | 480 | 'crearNotaPedidoService', |
480 | '$location', | 481 | '$location', |
481 | function($scope, crearNotaPedidoService, $location) { | 482 | function($scope, crearNotaPedidoService, $location) { |
482 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { | 483 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { |
483 | $scope.notaPedidos = datos.data; | 484 | $scope.notaPedidos = datos.data; |
484 | }); | 485 | }); |
485 | $scope.editar = function(notaPedido) { | 486 | $scope.editar = function(notaPedido) { |
486 | crearNotaPedidoService.setNotaPedido(notaPedido); | 487 | crearNotaPedidoService.setNotaPedido(notaPedido); |
487 | $location.path('/venta-nota-pedido/abm/'); | 488 | $location.path('/venta-nota-pedido/abm/'); |
488 | }; | 489 | }; |
489 | $scope.crearPedido = function() { | 490 | $scope.crearPedido = function() { |
490 | crearNotaPedidoService.clearNotaPedido(); | 491 | crearNotaPedidoService.clearNotaPedido(); |
491 | $location.path('/venta-nota-pedido/abm/'); | 492 | $location.path('/venta-nota-pedido/abm/'); |
492 | }; | 493 | }; |
493 | } | 494 | } |
494 | ]) | 495 | ]) |
495 | .controller('focaCrearNotaPedidoFichaClienteController', [ | 496 | .controller('focaCrearNotaPedidoFichaClienteController', [ |
496 | '$scope', | 497 | '$scope', |
497 | 'crearNotaPedidoService', | 498 | 'crearNotaPedidoService', |
498 | '$location', | 499 | '$location', |
499 | function($scope, crearNotaPedidoService, $location) { | 500 | function($scope, crearNotaPedidoService, $location) { |
500 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { | 501 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { |
501 | $scope.notaPedidos = datos.data; | 502 | $scope.notaPedidos = datos.data; |
502 | }); | 503 | }); |
503 | $scope.editar = function(notaPedido) { | 504 | $scope.editar = function(notaPedido) { |
504 | crearNotaPedidoService.setNotaPedido(notaPedido); | 505 | crearNotaPedidoService.setNotaPedido(notaPedido); |
505 | $location.path('/venta-nota-pedido/abm/'); | 506 | $location.path('/venta-nota-pedido/abm/'); |
506 | }; | 507 | }; |
507 | $scope.crearPedido = function() { | 508 | $scope.crearPedido = function() { |
508 | crearNotaPedidoService.clearNotaPedido(); | 509 | crearNotaPedidoService.clearNotaPedido(); |
509 | $location.path('/venta-nota-pedido/abm/'); | 510 | $location.path('/venta-nota-pedido/abm/'); |
510 | }; | 511 | }; |
511 | } | 512 | } |
512 | ]); | 513 | ]); |
513 | 514 |
src/views/nota-pedido.html
1 | <div class="crear-nota-pedido"> | 1 | <div class="crear-nota-pedido"> |
2 | <form name="formCrearNota" ng-submit="crearNotaPedido()"> | 2 | <form name="formCrearNota" ng-submit="crearNotaPedido()"> |
3 | <div class="row"> | 3 | <div class="row"> |
4 | <div class="col-md-10 offset-md-1 col-lg-8 offset-lg-2"> | 4 | <div class="col-md-10 offset-md-1 col-lg-8 offset-lg-2"> |
5 | <div class="row p-1 panel-informativo"> | 5 | <div class="row p-1 panel-informativo"> |
6 | <div class="col-12"> | 6 | <div class="col-12"> |
7 | <div class="row"> | 7 | <div class="row"> |
8 | <div class="col-12 col-sm-4 nota-pedido"> | 8 | <div class="col-12 col-sm-4 nota-pedido"> |
9 | <h5>NOTA DE PEDIDO</h5> | 9 | <h5>NOTA DE PEDIDO</h5> |
10 | </div> | 10 | </div> |
11 | <div class="col-6 col-sm-4 numero-pedido">Nº {{puntoVenta}}-{{comprobante}}</div> | 11 | <div class="col-6 col-sm-4 numero-pedido">Nº {{puntoVenta}}-{{comprobante}}</div> |
12 | <div class="col-6 col-sm-4 text-right"> | 12 | <div class="col-6 col-sm-4 text-right crear-nota-pedido-fecha"> |
13 | Fecha: {{ now | date:'dd/MM/yyyy HH:mm'}} | 13 | Fecha: |
14 | <span | ||
15 | ng-show="!datepickerAbierto" | ||
16 | ng-bind="now | date:'dd/MM/yyyy HH:mm'" | ||
17 | ng-click="datepickerAbierto = true" | ||
18 | > | ||
19 | </span> | ||
20 | <input | ||
21 | ng-show="datepickerAbierto" | ||
22 | type="date" | ||
23 | ng-model="now" | ||
24 | ng-change="datepickerAbierto = false" | ||
25 | ng-blur="datepickerAbierto = false" | ||
26 | class="form-control form-control-sm col-8 float-right" | ||
27 | foca-focus="datepickerAbierto" | ||
28 | /> | ||
14 | </div> | 29 | </div> |
15 | </div> | 30 | </div> |
16 | <div class="row"> | 31 | <div class="row"> |
17 | <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera"> | 32 | <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera"> |
18 | <span class="label" ng-bind="cab.label"></span> | 33 | <span class="label" ng-bind="cab.label"></span> |
19 | <span class="valor" ng-bind="cab.valor"></span> | 34 | <span class="valor" ng-bind="cab.valor"></span> |
20 | </div> | 35 | </div> |
21 | <a | 36 | <a |
22 | class="btn col-12 btn-secondary d-sm-none" | 37 | class="btn col-12 btn-secondary d-sm-none" |
23 | ng-show="cabecera.length > 0" | 38 | ng-show="cabecera.length > 0" |
24 | ng-click="showCabecera = !showCabecera" | 39 | ng-click="showCabecera = !showCabecera" |
25 | > | 40 | > |
26 | <i | 41 | <i |
27 | class="fa fa-chevron-down" | 42 | class="fa fa-chevron-down" |
28 | ng-hide="showCabecera" | 43 | ng-hide="showCabecera" |
29 | aria-hidden="true" | 44 | aria-hidden="true" |
30 | > | 45 | > |
31 | </i> | 46 | </i> |
32 | <i | 47 | <i |
33 | class="fa fa-chevron-up" | 48 | class="fa fa-chevron-up" |
34 | ng-show="showCabecera" | 49 | ng-show="showCabecera" |
35 | aria-hidden="true"> | 50 | aria-hidden="true"> |
36 | </i> | 51 | </i> |
37 | </a> | 52 | </a> |
38 | </div> | 53 | </div> |
39 | </div> | 54 | </div> |
40 | </div> | 55 | </div> |
41 | <div class="row p-1 botonera-secundaria"> | 56 | <div class="row p-1 botonera-secundaria"> |
42 | <div class="col-12"> | 57 | <div class="col-12"> |
43 | <div class="row"> | 58 | <div class="row"> |
44 | <div class="col-6 col-sm-3 px-0 py-0" ng-repeat="boton in botonera"> | 59 | <div class="col-6 col-sm-3 px-0 py-0" ng-repeat="boton in botonera"> |
45 | <button | 60 | <button |
46 | type="button" | 61 | type="button" |
47 | class="btn btn-default btn-block btn-xs text-left py-2" | 62 | class="btn btn-default btn-block btn-xs text-left py-2" |
48 | ng-click="boton.accion()" | 63 | ng-click="boton.accion()" |
49 | ng-class="{'d-none d-sm-block': boton.texto == ''}" | 64 | ng-class="{'d-none d-sm-block': boton.texto == ''}" |
50 | > | 65 | > |
51 | <i | 66 | <i |
52 | class="fa fa-arrow-circle-right" | 67 | class="fa fa-arrow-circle-right" |
53 | ng-show="boton.texto != ''" | 68 | ng-show="boton.texto != ''" |
54 | ></i> | 69 | ></i> |
55 | | 70 | |
56 | {{boton.texto}} | 71 | {{boton.texto}} |
57 | </button> | 72 | </button> |
58 | </div> | 73 | </div> |
59 | </div> | 74 | </div> |
60 | </div> | 75 | </div> |
61 | </div> | 76 | </div> |
62 | </div> | 77 | </div> |
63 | </div> | 78 | </div> |
64 | </form> | 79 | </form> |
65 | <div class="row"> | 80 | <div class="row"> |
66 | <div class="col-12 col-md-10 col-lg-8 offset-md-1 offset-lg-2"> | 81 | <div class="col-12 col-md-10 col-lg-8 offset-md-1 offset-lg-2"> |
67 | <!-- PC --> | 82 | <!-- PC --> |
68 | <div class="row grilla-articulo align-items-end"> | 83 | <div class="row grilla-articulo align-items-end"> |
69 | <table class="table tabla-articulo table-striped table-sm table-dark"> | 84 | <table class="table tabla-articulo table-striped table-sm table-dark"> |
70 | <thead> | 85 | <thead> |
71 | <tr class="d-flex"> | 86 | <tr class="d-flex"> |
72 | <th class="">#</th> | 87 | <th class="">#</th> |
73 | <th class="col">Código</th> | 88 | <th class="col">Código</th> |
74 | <th class="col-4">Descripción</th> | 89 | <th class="col-4">Descripción</th> |
75 | <th class="col text-right">Cantidad</th> | 90 | <th class="col text-right">Cantidad</th> |
76 | <th class="col text-right">Precio Unitario</th> | 91 | <th class="col text-right">Precio Unitario</th> |
77 | <th class="col text-right">SubTotal</th> | 92 | <th class="col text-right">SubTotal</th> |
78 | <th class="text-right"> | 93 | <th class="text-right"> |
79 | <button | 94 | <button |
80 | class="btn btn-outline-secondary selectable" | 95 | class="btn btn-outline-secondary selectable" |
81 | ng-click="show = !show; masMenos()" | 96 | ng-click="show = !show; masMenos()" |
82 | > | 97 | > |
83 | <i | 98 | <i |
84 | class="fa fa-chevron-down" | 99 | class="fa fa-chevron-down" |
85 | ng-show="show" | 100 | ng-show="show" |
86 | aria-hidden="true" | 101 | aria-hidden="true" |
87 | > | 102 | > |
88 | </i> | 103 | </i> |
89 | <i | 104 | <i |
90 | class="fa fa-chevron-up" | 105 | class="fa fa-chevron-up" |
91 | ng-hide="show" | 106 | ng-hide="show" |
92 | aria-hidden="true"> | 107 | aria-hidden="true"> |
93 | </i> | 108 | </i> |
94 | </button> | 109 | </button> |
95 | </th> | 110 | </th> |
96 | </tr> | 111 | </tr> |
97 | </thead> | 112 | </thead> |
98 | <tbody class="tabla-articulo-body"> | 113 | <tbody class="tabla-articulo-body"> |
99 | <tr | 114 | <tr |
100 | ng-repeat="(key, articulo) in articulosTabla" | 115 | ng-repeat="(key, articulo) in articulosTabla" |
101 | ng-show="show || key == (articulosTabla.length - 1)" | 116 | ng-show="show || key == (articulosTabla.length - 1)" |
102 | class="d-flex" | 117 | class="d-flex" |
103 | > | 118 | > |
104 | <td ng-bind="key + 1"></td> | 119 | <td ng-bind="key + 1"></td> |
105 | <td | 120 | <td |
106 | class="col" | 121 | class="col" |
107 | ng-bind="articulo.sector + '-' + articulo.codigo" | 122 | ng-bind="articulo.sector + '-' + articulo.codigo" |
108 | ></td> | 123 | ></td> |
109 | <td | 124 | <td |
110 | class="col-4" | 125 | class="col-4" |
111 | ng-bind="articulo.descripcion" | 126 | ng-bind="articulo.descripcion" |
112 | ></td> | 127 | ></td> |
113 | <td class="col text-right"> | 128 | <td class="col text-right"> |
114 | <input | 129 | <input |
115 | ng-show="articulo.edit" | 130 | ng-show="articulo.edit" |
116 | ng-model="articulo.cantidad" | 131 | ng-model="articulo.cantidad" |
117 | class="form-control" | 132 | class="form-control" |
118 | type="number" | 133 | type="number" |
119 | min="1" | 134 | min="1" |
120 | foca-focus="articulo.edit" | 135 | foca-focus="articulo.edit" |
121 | ng-keypress="editarArticulo($event.keyCode, articulo)" | 136 | ng-keypress="editarArticulo($event.keyCode, articulo)" |
122 | ng-focus="selectFocus($event)" | 137 | ng-focus="selectFocus($event)" |
123 | > | 138 | > |
124 | <i | 139 | <i |
125 | class="selectable" | 140 | class="selectable" |
126 | ng-click="cambioEdit(articulo)" | 141 | ng-click="cambioEdit(articulo)" |
127 | ng-hide="articulo.edit" | 142 | ng-hide="articulo.edit" |
128 | ng-bind="articulo.cantidad"> | 143 | ng-bind="articulo.cantidad"> |
129 | </i> | 144 | </i> |
130 | </td> | 145 | </td> |
131 | <td | 146 | <td |
132 | class="col text-right" | 147 | class="col text-right" |
133 | ng-bind="articulo.precio | currency: '$'" | 148 | ng-bind="articulo.precio | currency: '$'" |
134 | ></td> | 149 | ></td> |
135 | <td | 150 | <td |
136 | class="col text-right" | 151 | class="col text-right" |
137 | ng-bind="(articulo.precio * articulo.cantidad) | currency: '$'"> | 152 | ng-bind="(articulo.precio * articulo.cantidad) | currency: '$'"> |
138 | </td> | 153 | </td> |
139 | <td class="text-center"> | 154 | <td class="text-center"> |
140 | <button | 155 | <button |
141 | class="btn btn-outline-secondary" | 156 | class="btn btn-outline-secondary" |
142 | ng-click="quitarArticulo(key)" | 157 | ng-click="quitarArticulo(key)" |
143 | > | 158 | > |
144 | <i class="fa fa-trash"></i> | 159 | <i class="fa fa-trash"></i> |
145 | </button> | 160 | </button> |
146 | </td> | 161 | </td> |
147 | </tr> | 162 | </tr> |
148 | </tbody> | 163 | </tbody> |
149 | <tfoot> | 164 | <tfoot> |
150 | <tr ng-show="!cargando" class="d-flex"> | 165 | <tr ng-show="!cargando" class="d-flex"> |
151 | <td | 166 | <td |
152 | class="align-middle" | 167 | class="align-middle" |
153 | ng-bind="articulosTabla.length + 1" | 168 | ng-bind="articulosTabla.length + 1" |
154 | ></td> | 169 | ></td> |
155 | <td class="col"> | 170 | <td class="col"> |
156 | <input | 171 | <input |
157 | class="form-control" | 172 | class="form-control" |
158 | ng-model="articuloACargar.sectorCodigo" | 173 | ng-model="articuloACargar.sectorCodigo" |
159 | readonly | 174 | readonly |
160 | > | 175 | > |
161 | </td> | 176 | </td> |
162 | <td class="col-4 tabla-articulo-descripcion"> | 177 | <td class="col-4 tabla-articulo-descripcion"> |
163 | <input | 178 | <input |
164 | class="form-control" | 179 | class="form-control" |
165 | ng-model="articuloACargar.descripcion" | 180 | ng-model="articuloACargar.descripcion" |
166 | readonly | 181 | readonly |
167 | > | 182 | > |
168 | </td> | 183 | </td> |
169 | <td class="col text-right"> | 184 | <td class="col text-right"> |
170 | <input | 185 | <input |
171 | class="form-control" | 186 | class="form-control" |
172 | type="number" | 187 | type="number" |
173 | min="1" | 188 | min="1" |
174 | ng-model="articuloACargar.cantidad" | 189 | ng-model="articuloACargar.cantidad" |
175 | foca-focus="!cargando" | 190 | foca-focus="!cargando" |
176 | esc-key="resetFilter()" | 191 | esc-key="resetFilter()" |
177 | ng-keypress="agregarATabla($event.keyCode)" | 192 | ng-keypress="agregarATabla($event.keyCode)" |
178 | > | 193 | > |
179 | </td> | 194 | </td> |
180 | <td class="col text-right"> | 195 | <td class="col text-right"> |
181 | <input | 196 | <input |
182 | class="form-control" | 197 | class="form-control" |
183 | ng-value="articuloACargar.precio | currency: '$'" | 198 | ng-value="articuloACargar.precio | currency: '$'" |
184 | readonly | 199 | readonly |
185 | > | 200 | > |
186 | </td> | 201 | </td> |
187 | <td class="col text-right"> | 202 | <td class="col text-right"> |
188 | <input | 203 | <input |
189 | class="form-control" | 204 | class="form-control" |
190 | ng-value="getSubTotal() | currency: '$'" | 205 | ng-value="getSubTotal() | currency: '$'" |
191 | readonly | 206 | readonly |
192 | ></td> | 207 | ></td> |
193 | <td class="text-center align-middle"> | 208 | <td class="text-center align-middle"> |
194 | <button | 209 | <button |
195 | class="btn btn-outline-secondary" | 210 | class="btn btn-outline-secondary" |
196 | ng-click="agregarATabla(13)" | 211 | ng-click="agregarATabla(13)" |
197 | > | 212 | > |
198 | <i class="fa fa-save"></i> | 213 | <i class="fa fa-save"></i> |
199 | </button> | 214 | </button> |
200 | </td> | 215 | </td> |
201 | </tr> | 216 | </tr> |
202 | <tr ng-show="cargando" class="d-flex"> | 217 | <tr ng-show="cargando" class="d-flex"> |
203 | <td colspan="7" class="col-12"> | 218 | <td colspan="7" class="col-12"> |
204 | <input | 219 | <input |
205 | placeholder="Seleccione Articulo" | 220 | placeholder="Seleccione Articulo" |
206 | class="form-control form-control-sm" | 221 | class="form-control form-control-sm" |
207 | readonly | 222 | readonly |
208 | ng-click="seleccionarArticulo()" | 223 | ng-click="seleccionarArticulo()" |
209 | /> | 224 | /> |
210 | </td> | 225 | </td> |
211 | </tr> | 226 | </tr> |
212 | <tr class="d-flex"> | 227 | <tr class="d-flex"> |
213 | <td colspan="4"> | 228 | <td colspan="4"> |
214 | <strong>Cantidad Items:</strong> | 229 | <strong>Cantidad Items:</strong> |
215 | <a ng-bind="articulosTabla.length"></a> | 230 | <a ng-bind="articulosTabla.length"></a> |
216 | </td> | 231 | </td> |
217 | <td class="text-right ml-auto table-celda-total"><h3>Total:</h3></td> | 232 | <td class="text-right ml-auto table-celda-total"><h3>Total:</h3></td> |
218 | <td class="table-celda-total text-right" colspan="1"> | 233 | <td class="table-celda-total text-right" colspan="1"> |
219 | <h3>{{getTotal() | currency: '$'}}</h3> | 234 | <h3>{{getTotal() | currency: '$'}}</h3> |
220 | </td> | 235 | </td> |
221 | <td class="text-right"> | 236 | <td class="text-right"> |
222 | <button | 237 | <button |
223 | type="button" | 238 | type="button" |
224 | class="btn btn-default btn-sm" | 239 | class="btn btn-default btn-sm" |
225 | > | 240 | > |
226 | Totales | 241 | Totales |
227 | </button> | 242 | </button> |
228 | </td> | 243 | </td> |
229 | </tr> | 244 | </tr> |
230 | </tfoot> | 245 | </tfoot> |
231 | </table> | 246 | </table> |
232 | </div> | 247 | </div> |
233 | </div> | 248 | </div> |
234 | <div class="col-auto my-2 col-lg-2 botonera-lateral"> | 249 | <div class="col-auto my-2 col-lg-2 botonera-lateral"> |
235 | <div class="row align-items-end"> | 250 | <div class="row align-items-end"> |
236 | <div class="col-12"> | 251 | <div class="col-12"> |
237 | <button | 252 | <button |
238 | ng-click="crearNotaPedido()" | 253 | ng-click="crearNotaPedido()" |
239 | type="submit" | 254 | type="submit" |
240 | title="Crear nota pedido" | 255 | title="Crear nota pedido" |
241 | class="btn btn-default btn-block mb-2"> | 256 | class="btn btn-default btn-block mb-2"> |
242 | Guardar | 257 | Guardar |
243 | </button> | 258 | </button> |
244 | <button | 259 | <button |
245 | ng-click="salir()" | 260 | ng-click="salir()" |
246 | type="button" | 261 | type="button" |
247 | title="Salir" | 262 | title="Salir" |
248 | class="btn btn-default btn-block"> | 263 | class="btn btn-default btn-block"> |
249 | Salir | 264 | Salir |
250 | </button> | 265 | </button> |
251 | </div> | 266 | </div> |
252 | </div> | 267 | </div> |
253 | </div> | 268 | </div> |
254 | </div> | 269 | </div> |
255 | </div> | 270 | </div> |
256 | 271 |