Commit 06f8bfde97b18cc924b19b15c26ffa13f01f8b22
Exists in
master
Merge branch 'master' into 'develop'
Master(mpuebla) See merge request !35
Showing
3 changed files
Show diff stats
src/js/controller.js
... | ... | @@ -2,24 +2,27 @@ angular.module('focaBusquedaCliente') |
2 | 2 | .controller('focaBusquedaClienteModalController', [ |
3 | 3 | '$uibModalInstance', 'focaBusquedaClienteService', '$scope', '$filter', |
4 | 4 | '$uibModal', 'focaModalService', '$timeout', 'vendedor', 'cobrador', |
5 | - function($uibModalInstance, focaBusquedaClienteService, $scope, $filter, | |
5 | + function ($uibModalInstance, focaBusquedaClienteService, $scope, $filter, | |
6 | 6 | $uibModal, focaModalService, $timeout, vendedor, cobrador) { |
7 | 7 | |
8 | 8 | $scope.cobrador = cobrador ? cobrador : {}; |
9 | 9 | $scope.vendedor = vendedor ? vendedor : {}; |
10 | 10 | $scope.filters = ''; |
11 | 11 | $scope.primerBusqueda = false; |
12 | - // pagination | |
12 | + | |
13 | + //#region pagination | |
13 | 14 | $scope.numPerPage = 10; |
14 | 15 | $scope.currentPage = 1; |
15 | 16 | $scope.filteredClientes = []; |
16 | 17 | $scope.currentPageClientes = []; |
17 | 18 | $scope.selectedClientes = -1; |
18 | 19 | $scope.ingreso = false; |
20 | + $scope.accion = ''; | |
19 | 21 | $scope.regexCuit = new RegExp(/\b(20|23|24|27|30|33|34)(\D)?[0-9]{8}(\D)?[0-9]/); |
20 | 22 | $scope.focused = 1; |
23 | + //#endregion | |
21 | 24 | |
22 | - $scope.cliente = { | |
25 | + $scope.clienteTemplate = { | |
23 | 26 | COD: 0, |
24 | 27 | ES_MAY: true, |
25 | 28 | cuit1: '', |
... | ... | @@ -50,11 +53,11 @@ angular.module('focaBusquedaCliente') |
50 | 53 | NOMBRE: '' |
51 | 54 | }, |
52 | 55 | cobrador: { |
53 | - NomVen: '' | |
56 | + NOM: '' | |
54 | 57 | } |
55 | - }; | |
56 | - | |
57 | - $scope.busquedaPress = function(key) { | |
58 | + }; | |
59 | + $scope.cliente = angular.copy($scope.clienteTemplate); | |
60 | + $scope.busquedaPress = function (key) { | |
58 | 61 | if (key === 13) { |
59 | 62 | var funcion; |
60 | 63 | if ($scope.vendedor.id) { |
... | ... | @@ -64,29 +67,29 @@ angular.module('focaBusquedaCliente') |
64 | 67 | } else { |
65 | 68 | funcion = 'obtenerClientesPorNombreOCuit'; |
66 | 69 | } |
67 | - | |
70 | + | |
68 | 71 | $scope.searchLoading = true; |
69 | 72 | focaBusquedaClienteService |
70 | - [funcion]($scope.filters, $scope.vendedor.id || $scope.cobrador.id) | |
73 | + [funcion]($scope.filters, $scope.vendedor.id || $scope.cobrador.id) | |
71 | 74 | .then( |
72 | - function(res) { | |
75 | + function (res) { | |
73 | 76 | $scope.primerBusqueda = true; |
74 | 77 | $scope.clientes = res.data; |
75 | 78 | $scope.search(true); |
76 | 79 | primera(); |
77 | 80 | $scope.searchLoading = false; |
78 | - }); | |
81 | + }); | |
79 | 82 | } |
80 | 83 | }; |
81 | 84 | |
82 | 85 | $scope.search = function (pressed) { |
83 | 86 | if ($scope.primerBusqueda) { |
84 | 87 | $scope.filteredClientes = $filter('filter')( |
85 | - $scope.clientes, {$: $scope.filters} | |
88 | + $scope.clientes, { $: $scope.filters } | |
86 | 89 | ); |
87 | 90 | |
88 | 91 | if (pressed && $scope.filteredClientes.length === 0) { |
89 | - $timeout(function() { | |
92 | + $timeout(function () { | |
90 | 93 | angular.element('#search')[0].focus(); |
91 | 94 | $scope.filters = ''; |
92 | 95 | }); |
... | ... | @@ -114,12 +117,12 @@ angular.module('focaBusquedaCliente') |
114 | 117 | $scope.currentPage = page; |
115 | 118 | }; |
116 | 119 | |
117 | - $scope.select = function(cliente, esNuevo = false) { | |
120 | + $scope.select = function (cliente, esNuevo = false) { | |
118 | 121 | cliente.esNuevo = esNuevo; |
119 | 122 | $uibModalInstance.close(cliente); |
120 | 123 | }; |
121 | 124 | |
122 | - $scope.cancel = function() { | |
125 | + $scope.cancel = function () { | |
123 | 126 | if ($scope.ingreso) { |
124 | 127 | $scope.ingreso = false; |
125 | 128 | } else { |
... | ... | @@ -127,13 +130,63 @@ angular.module('focaBusquedaCliente') |
127 | 130 | } |
128 | 131 | }; |
129 | 132 | |
130 | - $scope.busquedaDown = function(key) { | |
133 | + $scope.crearCliente = function () { | |
134 | + $scope.cliente = angular.copy($scope.clienteTemplate); | |
135 | + $scope.vendedor.NOM = ''; | |
136 | + $scope.vendedor.id = undefined; | |
137 | + $scope.cliente.cobrador.NOM = ''; | |
138 | + $scope.cliente.cobrador.ID = undefined; | |
139 | + $scope.accion = "Crear Cliente"; | |
140 | + $scope.ingreso = true; | |
141 | + } | |
142 | + | |
143 | + $scope.openModal = function (cliente) { | |
144 | + focaBusquedaClienteService.obtenerClientePorCodigo(cliente.cod) | |
145 | + .then(function (res) { | |
146 | + var data = res.data[0]; | |
147 | + $scope.cliente.codigo = res.data[0].COD; | |
148 | + $scope.cliente.NOM = data.NOM; | |
149 | + $scope.cliente.DOM = data.DOM; | |
150 | + $scope.cliente.CPO = data.CPO; | |
151 | + $scope.cliente.provincia.ID = data.PCX; | |
152 | + $scope.cliente.provincia.NOMBRE = data.PCI; | |
153 | + $scope.cliente.localidad.ID = data.LOX; | |
154 | + $scope.cliente.localidad.NOMBRE = data.LOC; | |
155 | + $scope.cliente.zona.ID = data.zona.ID; | |
156 | + $scope.cliente.zona.NOM = data.zona.NOM; | |
157 | + $scope.cliente.actividad.NOM = data.ACT; | |
158 | + $scope.cliente.cobrador.NOM = data.cobrador ? data.cobrador.NOM : ''; | |
159 | + $scope.cliente.cobrador.ID = data.cobrador ? data.cobrador.id : undefined; | |
160 | + $scope.vendedor.NOM = data.vendedor.NOM; | |
161 | + $scope.vendedor.id = data.vendedor.id; | |
162 | + $scope.cliente.MAIL = data.MAIL; | |
163 | + $scope.cliente.TEL = data.TEL; | |
164 | + $scope.cliente.iva.NOMBRE = data.iva.NOMBRE; | |
165 | + $scope.cliente.tipoFactura.NOMBRE = data.tipoFactura.NOMBRE; | |
166 | + $scope.cliente.tipoFactura.ID = data.tipoFactura.ID; | |
167 | + var cuit = data.CUIT.split('-'); | |
168 | + $scope.cliente.cuit1 = cuit[0]; | |
169 | + $scope.cliente.cuit2 = cuit[1]; | |
170 | + $scope.cliente.cuit3 = cuit[2]; | |
171 | + $scope.cliente.tipoComprobante.NOMBRE = data.tipoComprobante.NOMBRE; | |
172 | + $scope.cliente.tipoComprobante.ID = data.tipoComprobante.ID; | |
173 | + $scope.cliente.formaPago.NOMBRE = data.formaPago.NOMBRE; | |
174 | + $scope.cliente.formaPago.ID = data.formaPago.ID; | |
175 | + $scope.cliente.ES_PROS = data.ES_PROS; | |
176 | + $scope.cliente.ES_MAY = data.ES_MAY; | |
177 | + $scope.accion = "Cliente"; | |
178 | + $scope.ingreso = true; | |
179 | + }) | |
180 | + .catch(function (e) { console.log(e); }) | |
181 | + } | |
182 | + | |
183 | + $scope.busquedaDown = function (key) { | |
131 | 184 | if (key === 40) { |
132 | 185 | primera(key); |
133 | 186 | } |
134 | 187 | }; |
135 | 188 | |
136 | - $scope.itemCliente = function(key) { | |
189 | + $scope.itemCliente = function (key) { | |
137 | 190 | if (key === 38) { |
138 | 191 | anterior(key); |
139 | 192 | } |
... | ... | @@ -151,15 +204,15 @@ angular.module('focaBusquedaCliente') |
151 | 204 | } |
152 | 205 | }; |
153 | 206 | |
154 | - $scope.focus = function(val) { | |
207 | + $scope.focus = function (val) { | |
155 | 208 | $scope.focused = val; |
156 | 209 | }; |
157 | 210 | |
158 | - $scope.next = function(key) { | |
211 | + $scope.next = function (key) { | |
159 | 212 | if (key === 13) $scope.focused++; |
160 | 213 | }; |
161 | 214 | |
162 | - $scope.seleccionarProvincia = function(key) { | |
215 | + $scope.seleccionarProvincia = function (key) { | |
163 | 216 | if (key === 13) { |
164 | 217 | var parametrosModal = { |
165 | 218 | searchText: $scope.cliente.provincia.NOMBRE, |
... | ... | @@ -178,20 +231,20 @@ angular.module('focaBusquedaCliente') |
178 | 231 | nombre: 'Nombre' |
179 | 232 | } |
180 | 233 | ], |
181 | - titulo:'Bรบsqueda de provincias', | |
234 | + titulo: 'Bรบsqueda de provincias', | |
182 | 235 | size: 'md' |
183 | 236 | }; |
184 | - focaModalService.modal(parametrosModal).then(function(provincia) { | |
237 | + focaModalService.modal(parametrosModal).then(function (provincia) { | |
185 | 238 | $scope.cliente.provincia = provincia; |
186 | - $timeout(function() { | |
239 | + $timeout(function () { | |
187 | 240 | $scope.focused = 4; |
188 | 241 | }); |
189 | - }, function() { | |
242 | + }, function () { | |
190 | 243 | //TODO: funciรณn llamada cuando cancela el modal |
191 | 244 | }); |
192 | 245 | } |
193 | 246 | }; |
194 | - $scope.seleccionarLocalidad = function(key) { | |
247 | + $scope.seleccionarLocalidad = function (key) { | |
195 | 248 | if ($scope.cliente.provincia.ID === undefined) { |
196 | 249 | focaModalService.alert('Seleccione una provincia'); |
197 | 250 | return; |
... | ... | @@ -214,20 +267,20 @@ angular.module('focaBusquedaCliente') |
214 | 267 | nombre: 'Nombre' |
215 | 268 | } |
216 | 269 | ], |
217 | - titulo:'Bรบsqueda de localidades', | |
270 | + titulo: 'Bรบsqueda de localidades', | |
218 | 271 | size: 'md' |
219 | 272 | }; |
220 | - focaModalService.modal(parametrosModal).then(function(localidad) { | |
273 | + focaModalService.modal(parametrosModal).then(function (localidad) { | |
221 | 274 | $scope.cliente.localidad = localidad; |
222 | - $timeout(function() { | |
275 | + $timeout(function () { | |
223 | 276 | $scope.focused = 5; |
224 | 277 | }); |
225 | - }, function() { | |
278 | + }, function () { | |
226 | 279 | //TODO: funciรณn llamada cuando cancela el modal |
227 | 280 | }); |
228 | 281 | } |
229 | 282 | }; |
230 | - $scope.seleccionarIva = function(key) { | |
283 | + $scope.seleccionarIva = function (key) { | |
231 | 284 | if (key === 13) { |
232 | 285 | var parametrosModal = { |
233 | 286 | query: '/iva', |
... | ... | @@ -246,24 +299,24 @@ angular.module('focaBusquedaCliente') |
246 | 299 | nombre: 'Nombre' |
247 | 300 | } |
248 | 301 | ], |
249 | - titulo:'Bรบsqueda de responsabilidad ante el IVA', | |
302 | + titulo: 'Bรบsqueda de responsabilidad ante el IVA', | |
250 | 303 | size: 'md' |
251 | 304 | }; |
252 | 305 | focaModalService.modal(parametrosModal).then( |
253 | - function(iva) { | |
306 | + function (iva) { | |
254 | 307 | if (iva) { |
255 | 308 | delete $scope.cliente.tipoFactura.NOMBRE; |
256 | 309 | } |
257 | 310 | $scope.cliente.iva = iva; |
258 | - $timeout(function() { | |
311 | + $timeout(function () { | |
259 | 312 | $scope.focused = 12; |
260 | 313 | }); |
261 | - }, function() { | |
314 | + }, function () { | |
262 | 315 | // funcion ejecutada cuando se cancela el modal |
263 | 316 | }); |
264 | 317 | } |
265 | 318 | }; |
266 | - $scope.seleccionarActividad = function(key) { | |
319 | + $scope.seleccionarActividad = function (key) { | |
267 | 320 | if (key === 13) { |
268 | 321 | var parametrosModal = { |
269 | 322 | searchText: $scope.cliente.actividad.NOM, |
... | ... | @@ -286,17 +339,17 @@ angular.module('focaBusquedaCliente') |
286 | 339 | size: 'md' |
287 | 340 | }; |
288 | 341 | focaModalService.modal(parametrosModal).then( |
289 | - function(actividad) { | |
342 | + function (actividad) { | |
290 | 343 | $scope.cliente.actividad = actividad; |
291 | - $timeout(function() { | |
344 | + $timeout(function () { | |
292 | 345 | $scope.focused = 7; |
293 | 346 | }); |
294 | - }, function() { | |
347 | + }, function () { | |
295 | 348 | // funcion ejecutada cuando se cancela el modal |
296 | 349 | }); |
297 | 350 | } |
298 | 351 | }; |
299 | - $scope.seleccionarZona = function(key) { | |
352 | + $scope.seleccionarZona = function (key) { | |
300 | 353 | if (key === 13) { |
301 | 354 | var parametrosModal = { |
302 | 355 | searchText: $scope.cliente.zona.NOM, |
... | ... | @@ -319,18 +372,18 @@ angular.module('focaBusquedaCliente') |
319 | 372 | size: 'md' |
320 | 373 | }; |
321 | 374 | focaModalService.modal(parametrosModal).then( |
322 | - function(zona) { | |
375 | + function (zona) { | |
323 | 376 | $scope.cliente.zona = zona; |
324 | - $timeout(function() { | |
377 | + $timeout(function () { | |
325 | 378 | $scope.focused = 6; |
326 | 379 | }); |
327 | - }, function() { | |
380 | + }, function () { | |
328 | 381 | // funcion ejecutada cuando se cancela el modal |
329 | 382 | }); |
330 | 383 | } |
331 | 384 | }; |
332 | - $scope.seleccionarTipoFactura = function(key) { | |
333 | - | |
385 | + $scope.seleccionarTipoFactura = function (key) { | |
386 | + | |
334 | 387 | if ($scope.cliente.iva.NOMBRE == '') { |
335 | 388 | focaModalService.alert('Seleccione una responsabilidad ante el IVA'); |
336 | 389 | return; |
... | ... | @@ -372,19 +425,19 @@ angular.module('focaBusquedaCliente') |
372 | 425 | columnas: [ |
373 | 426 | { |
374 | 427 | propiedad: 'ID', |
375 | - NOMBRE: 'Codigo' | |
428 | + NOMBRE: 'Codigo' | |
376 | 429 | }, |
377 | 430 | { |
378 | 431 | propiedad: 'NOMBRE', |
379 | 432 | NOMBRE: 'Factura' |
380 | 433 | } |
381 | 434 | ], |
382 | - }).then(function(res) { | |
435 | + }).then(function (res) { | |
383 | 436 | $scope.cliente.tipoFactura = res; |
384 | 437 | }); |
385 | 438 | } |
386 | 439 | }; |
387 | - $scope.seleccionarTipoComprobante = function(key) { | |
440 | + $scope.seleccionarTipoComprobante = function (key) { | |
388 | 441 | if (key === 13) { |
389 | 442 | var parametrosModal = { |
390 | 443 | searchText: $scope.cliente.tipoComprobante.NOMBRE, |
... | ... | @@ -403,17 +456,17 @@ angular.module('focaBusquedaCliente') |
403 | 456 | size: 'md' |
404 | 457 | }; |
405 | 458 | focaModalService.modal(parametrosModal).then( |
406 | - function(tipoComprobante) { | |
459 | + function (tipoComprobante) { | |
407 | 460 | $scope.cliente.tipoComprobante = tipoComprobante; |
408 | - $timeout(function() { | |
461 | + $timeout(function () { | |
409 | 462 | $scope.focused = 17; |
410 | 463 | }); |
411 | - }, function() { | |
464 | + }, function () { | |
412 | 465 | // funcion ejecutada cuando se cancela el modal |
413 | 466 | }); |
414 | 467 | } |
415 | 468 | }; |
416 | - $scope.seleccionarFormaPago = function(key) { | |
469 | + $scope.seleccionarFormaPago = function (key) { | |
417 | 470 | if (key === 13) { |
418 | 471 | var parametrosModal = { |
419 | 472 | searchText: $scope.cliente.formaPago.NOMBRE, |
... | ... | @@ -436,14 +489,14 @@ angular.module('focaBusquedaCliente') |
436 | 489 | size: 'md' |
437 | 490 | }; |
438 | 491 | focaModalService.modal(parametrosModal).then( |
439 | - function(formaPago) { | |
492 | + function (formaPago) { | |
440 | 493 | $scope.cliente.formaPago = formaPago; |
441 | - }, function() { | |
494 | + }, function () { | |
442 | 495 | // funcion ejecutada cuando se cancela el modal |
443 | 496 | }); |
444 | 497 | } |
445 | 498 | }; |
446 | - $scope.seleccionarCobrador = function(key) { | |
499 | + $scope.seleccionarCobrador = function (key) { | |
447 | 500 | if (key === 13) { |
448 | 501 | var parametrosModal = { |
449 | 502 | searchText: $scope.cliente.cobrador.NOM, |
... | ... | @@ -462,23 +515,53 @@ angular.module('focaBusquedaCliente') |
462 | 515 | size: 'md' |
463 | 516 | }; |
464 | 517 | focaModalService.modal(parametrosModal).then( |
465 | - function(cobrador) { | |
518 | + function (cobrador) { | |
466 | 519 | $scope.cliente.cobrador = cobrador; |
467 | - }, function() { | |
520 | + }, function () { | |
521 | + // funcion ejecutada cuando se cancela el modal | |
522 | + }); | |
523 | + } | |
524 | + }; | |
525 | + $scope.seleccionarVendedor = function (key) { | |
526 | + if (key === 13) { | |
527 | + var parametrosModal = { | |
528 | + titulo: 'Bรบsqueda vendedores', | |
529 | + query: '/vendedor', | |
530 | + columnas: [ | |
531 | + { | |
532 | + propiedad: 'NUM', | |
533 | + nombre: 'Cรณdigo', | |
534 | + filtro: { | |
535 | + nombre: 'rellenarDigitos', | |
536 | + parametro: 3 | |
537 | + } | |
538 | + }, | |
539 | + { | |
540 | + propiedad: 'NOM', | |
541 | + nombre: 'Nombre' | |
542 | + } | |
543 | + ], | |
544 | + size: 'md' | |
545 | + }; | |
546 | + focaModalService.modal(parametrosModal).then( | |
547 | + function (vendedor) { | |
548 | + console.log("vendedor seleccionado => ", vendedor); | |
549 | + $scope.vendedor = vendedor; | |
550 | + }, function () { | |
468 | 551 | // funcion ejecutada cuando se cancela el modal |
469 | 552 | }); |
470 | 553 | } |
471 | 554 | }; |
472 | 555 | |
473 | - $scope.pasarCampoCuit = function(numeroCuit) { | |
556 | + $scope.pasarCampoCuit = function (numeroCuit) { | |
474 | 557 | if (numeroCuit === 1 && $scope.cliente.cuit1.length === 2) { |
475 | 558 | $scope.cuitActivo = 2; |
476 | - } else if ( numeroCuit === 2 && $scope.cliente.cuit2.length === 8) { | |
559 | + } else if (numeroCuit === 2 && $scope.cliente.cuit2.length === 8) { | |
477 | 560 | $scope.cuitActivo = 3; |
478 | 561 | } |
479 | 562 | }; |
480 | 563 | |
481 | - $scope.guardar = function() { | |
564 | + $scope.guardar = function () { | |
482 | 565 | if (!$scope.cliente.NOM) { |
483 | 566 | focaModalService.alert('Ingrese Nombre'); |
484 | 567 | return; |
... | ... | @@ -503,6 +586,9 @@ angular.module('focaBusquedaCliente') |
503 | 586 | } else if (!$scope.cliente.cobrador.NUM) { |
504 | 587 | focaModalService.alert('Seleccione un cobrador'); |
505 | 588 | return; |
589 | + } else if (!$scope.vendedor.NOM) { | |
590 | + focaModalService.alert('Seleccione un vendedor'); | |
591 | + return; | |
506 | 592 | } else if ($scope.cliente.MAIL && !validateEmails($scope.cliente.MAIL)) { |
507 | 593 | focaModalService.alert('Ingrese un formato de email vรกlido'); |
508 | 594 | return; |
... | ... | @@ -518,10 +604,10 @@ angular.module('focaBusquedaCliente') |
518 | 604 | } else if (!$scope.cliente.cuit1 && !$scope.cliente.cuit2 && !$scope.cliente.cuit3) { |
519 | 605 | focaModalService.alert('Ingrese CUIT'); |
520 | 606 | return; |
521 | - } else if (!$scope.cliente.cuit1 || !$scope.cliente.cuit2 || !$scope.cliente.cuit3){ | |
607 | + } else if (!$scope.cliente.cuit1 || !$scope.cliente.cuit2 || !$scope.cliente.cuit3) { | |
522 | 608 | focaModalService.alert('Ingrese CUIT vรกlido'); |
523 | 609 | return; |
524 | - } else if (!$scope.regexCuit.test($scope.cliente.cuit1 + $scope.cliente.cuit2 + $scope.cliente.cuit3) ) { | |
610 | + } else if (!$scope.regexCuit.test($scope.cliente.cuit1 + $scope.cliente.cuit2 + $scope.cliente.cuit3)) { | |
525 | 611 | focaModalService.alert('Ingrese CUIT con formato: XX-XXXXXXXX-X'); |
526 | 612 | return; |
527 | 613 | } else if (!$scope.cliente.tipoComprobante.NOMBRE) { |
... | ... | @@ -532,11 +618,13 @@ angular.module('focaBusquedaCliente') |
532 | 618 | return; |
533 | 619 | } |
534 | 620 | |
621 | + $scope.cliente.actividad.ID = parseInt($scope.cliente.actividad.ID); | |
622 | + | |
535 | 623 | var cliente = crearCopia(); |
536 | 624 | |
537 | 625 | focaBusquedaClienteService |
538 | 626 | .guardarCliente(cliente) |
539 | - .then(function(res) { | |
627 | + .then(function (res) { | |
540 | 628 | var cliente = { |
541 | 629 | cod: res.data.COD, |
542 | 630 | cuit: res.data.CUIT, |
... | ... | @@ -547,7 +635,7 @@ angular.module('focaBusquedaCliente') |
547 | 635 | }); |
548 | 636 | }; |
549 | 637 | |
550 | - function crearCopia(){ | |
638 | + function crearCopia() { | |
551 | 639 | var cliente = angular.copy($scope.cliente); |
552 | 640 | |
553 | 641 | cliente.PCX = cliente.provincia.ID; |
... | ... | @@ -558,7 +646,7 @@ angular.module('focaBusquedaCliente') |
558 | 646 | cliente.TIP = cliente.tipoFactura.ID; |
559 | 647 | cliente.TCO = cliente.tipoComprobante.ID; |
560 | 648 | cliente.FPA = cliente.formaPago.ID; |
561 | - cliente.VEN = vendedor.ID; | |
649 | + cliente.VEN = $scope.vendedor.id; | |
562 | 650 | cliente.CUIT = cliente.cuit1 + cliente.cuit2 + cliente.cuit3; |
563 | 651 | cliente.idCobrador = cliente.cobrador.ID; |
564 | 652 | |
... | ... | @@ -578,12 +666,13 @@ angular.module('focaBusquedaCliente') |
578 | 666 | return cliente; |
579 | 667 | } |
580 | 668 | |
669 | + //#region PAGINADOR | |
581 | 670 | function calcularPages(paginaActual) { |
582 | 671 | var paginas = []; |
583 | 672 | paginas.push(paginaActual); |
584 | 673 | |
585 | 674 | if (paginaActual - 1 > 1) { |
586 | - | |
675 | + | |
587 | 676 | paginas.unshift(paginaActual - 1); |
588 | 677 | if (paginaActual - 2 > 1) { |
589 | 678 | paginas.unshift(paginaActual - 2); |
... | ... | @@ -621,10 +710,10 @@ angular.module('focaBusquedaCliente') |
621 | 710 | } |
622 | 711 | |
623 | 712 | function siguiente() { |
624 | - if ($scope.selectedClientes < $scope.currentPageClientes.length - 1 ) { | |
713 | + if ($scope.selectedClientes < $scope.currentPageClientes.length - 1) { | |
625 | 714 | $scope.selectedClientes++; |
626 | 715 | } else { |
627 | - avanzarPagina(); | |
716 | + avanzarPagina(); | |
628 | 717 | } |
629 | 718 | } |
630 | 719 | |
... | ... | @@ -641,11 +730,13 @@ angular.module('focaBusquedaCliente') |
641 | 730 | $scope.selectedClientes = 0; |
642 | 731 | } |
643 | 732 | } |
733 | + //#endregion | |
734 | + | |
644 | 735 | function validateEmails(emails) { |
645 | 736 | var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; |
646 | 737 | var arr = emails.split(','); |
647 | 738 | var result = true; |
648 | - arr.forEach(function(email) { | |
739 | + arr.forEach(function (email) { | |
649 | 740 | var val = String(email).trim().toLowerCase(); |
650 | 741 | if (!re.test(val)) result = false; |
651 | 742 | }); |
src/js/service.js
1 | 1 | angular.module('focaBusquedaCliente') |
2 | - .service('focaBusquedaClienteService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { | |
2 | + .service('focaBusquedaClienteService', ['$http', 'API_ENDPOINT', function ($http, API_ENDPOINT) { | |
3 | 3 | return { |
4 | - obtenerClientesPorNombreOCuitByVendedor: function(nombreOCuit, idVendedor) { | |
4 | + obtenerClientesPorNombreOCuitByVendedor: function (nombreOCuit, idVendedor) { | |
5 | 5 | return $http.post(API_ENDPOINT.URL + '/cliente/listar', |
6 | - {nombreOCuit: nombreOCuit, idVendedor: idVendedor}); | |
6 | + { nombreOCuit: nombreOCuit, idVendedor: idVendedor }); | |
7 | 7 | }, |
8 | - obtenerClientesPorNombreOCuitByCobrador: function(nombreOCuit, idCobrador) { | |
8 | + obtenerClientesPorNombreOCuitByCobrador: function (nombreOCuit, idCobrador) { | |
9 | 9 | return $http.post(API_ENDPOINT.URL + '/cliente/listar', |
10 | - {nombreOCuit: nombreOCuit, idCobrador: idCobrador}); | |
10 | + { nombreOCuit: nombreOCuit, idCobrador: idCobrador }); | |
11 | 11 | }, |
12 | - obtenerClientesPorNombreOCuit: function(nombreOCuit) { | |
12 | + obtenerClientesPorNombreOCuit: function (nombreOCuit) { | |
13 | 13 | return $http.post(API_ENDPOINT.URL + '/cliente/listar', |
14 | - {nombreOCuit: nombreOCuit}); | |
14 | + { nombreOCuit: nombreOCuit }); | |
15 | 15 | }, |
16 | - guardarCliente: function(cliente) { | |
17 | - return $http.post(API_ENDPOINT.URL + '/cliente', {cliente: cliente}); | |
16 | + obtenerClientePorCodigo: function (cod) { | |
17 | + return $http.get(API_ENDPOINT.URL + '/cliente-codigo/' + cod ); | |
18 | + }, | |
19 | + guardarCliente: function (cliente) { | |
20 | + return $http.post(API_ENDPOINT.URL + '/cliente', { cliente: cliente }); | |
18 | 21 | } |
19 | 22 | }; |
20 | 23 | }]); |
src/views/foca-busqueda-cliente-modal.html
... | ... | @@ -2,11 +2,12 @@ |
2 | 2 | <div class="row w-100"> |
3 | 3 | <div class="col-lg-4 col-7"> |
4 | 4 | <h5 class="modal-title my-1" ng-hide="ingreso">Bรบsqueda de Cliente</h5> |
5 | - <h5 class="modal-title my-1" ng-show="ingreso">Crear Cliente</h5> | |
5 | + <h5 class="modal-title my-1" ng-show="ingreso" ng-bind="accion"></h5> | |
6 | 6 | </div> |
7 | 7 | <div ng-show="ingreso" class="col-lg-6 col-5 front-index"> |
8 | 8 | <div class="custom-control custom-checkbox mt-2"> |
9 | - <input | |
9 | + <input | |
10 | + ng-disabled="accion == 'Cliente'" | |
10 | 11 | type="checkbox" |
11 | 12 | class="custom-control-input" |
12 | 13 | id="checkProspecto" |
... | ... | @@ -17,8 +18,8 @@ |
17 | 18 | <div class="input-group col-lg-6 offset-lg-2 pr-0 my-2"> |
18 | 19 | <button |
19 | 20 | class="btn btn-outline-debo mr-2" |
20 | - ng-click="ingreso = true" | |
21 | - ng-show="!ingreso && vendedor.NUM" | |
21 | + ng-click="crearCliente()" | |
22 | + ng-show="!ingreso" | |
22 | 23 | title="Nuevo"> |
23 | 24 | <i class="fa fa-plus" aria-hidden="true"></i> |
24 | 25 | </button> |
... | ... | @@ -70,7 +71,7 @@ |
70 | 71 | <th>Cรณdigo</th> |
71 | 72 | <th>Nombre</th> |
72 | 73 | <th>CUIT</th> |
73 | - <th></th> | |
74 | + <th colspan="2"></th> | |
74 | 75 | </tr> |
75 | 76 | </thead> |
76 | 77 | <tbody> |
... | ... | @@ -82,13 +83,21 @@ |
82 | 83 | <tr |
83 | 84 | class="selectable" |
84 | 85 | ng-repeat="(key, cliente) in currentPageClientes" |
85 | - ng-click="select(cliente)"> | |
86 | + > | |
86 | 87 | <td ng-bind="('00000'+cliente.cod).slice(-5)"></td> |
87 | 88 | <td ng-bind="cliente.nom"></td> |
88 | 89 | <td ng-bind="cliente.cuit"></td> |
89 | 90 | <td> |
90 | 91 | <button |
91 | 92 | type="button" |
93 | + class="btn btn-xs p-1" | |
94 | + ng-click="openModal(cliente)" | |
95 | + ><i class="fa fa-eye"></i> | |
96 | + </button> | |
97 | + </td> | |
98 | + <td> | |
99 | + <button | |
100 | + type="button" | |
92 | 101 | class="btn btn-xs p-1 float-right" |
93 | 102 | ng-class="{ |
94 | 103 | 'btn-secondary': selectedClientes != key, |
... | ... | @@ -106,21 +115,22 @@ |
106 | 115 | </table> |
107 | 116 | |
108 | 117 | <form name="formCliente"> |
109 | - <uib-tabset class="tabs-right" ng-show="ingreso"> | |
110 | - <uib-tab heading="Datos cliente"> | |
111 | - <div class="row"> | |
112 | - <div class="col-3"> | |
113 | - <label>Cรณdigo</label> | |
114 | - <input | |
118 | + <fieldset ng-disabled="accion == 'Cliente'"> | |
119 | + <uib-tabset class="tabs-right" ng-show="ingreso"> | |
120 | + <uib-tab heading="Datos cliente"> | |
121 | + <div class="row"> | |
122 | + <div class="col-3 mt-2"> | |
123 | + <label>Cรณdigo</label> | |
124 | + <input | |
115 | 125 | type="text" |
116 | 126 | class="form-control form-control-sm" |
117 | 127 | ng-model="cliente.codigo" |
118 | 128 | readonly |
119 | - /> | |
120 | - </div> | |
121 | - <div class="col-9"> | |
122 | - <label>Nombre</label> | |
123 | - <input | |
129 | + /> | |
130 | + </div> | |
131 | + <div class="col-9 mt-2"> | |
132 | + <label>Nombre</label> | |
133 | + <input | |
124 | 134 | type="text" |
125 | 135 | class="form-control form-control-sm" |
126 | 136 | ng-model="cliente.NOM" |
... | ... | @@ -130,13 +140,13 @@ |
130 | 140 | foca-focus="focused == 1 || ingreso" |
131 | 141 | ng-focus="focus(1)" |
132 | 142 | ng-keypress="next($event.keyCode)" |
133 | - /> | |
143 | + /> | |
144 | + </div> | |
134 | 145 | </div> |
135 | - </div> | |
136 | - <div class="row"> | |
137 | - <div class="col-md-9 col-12"> | |
138 | - <label>Domicilio</label> | |
139 | - <input | |
146 | + <div class="row"> | |
147 | + <div class="col-md-9 col-12 mt-2"> | |
148 | + <label>Domicilio</label> | |
149 | + <input | |
140 | 150 | type="text" |
141 | 151 | class="form-control form-control-sm" |
142 | 152 | ng-model="cliente.DOM" |
... | ... | @@ -146,11 +156,11 @@ |
146 | 156 | ng-focus="focus(2)" |
147 | 157 | foca-focus="focused == 2" |
148 | 158 | ng-keypress="next($event.keyCode)" |
149 | - /> | |
150 | - </div> | |
151 | - <div class="col-md-3 col-12"> | |
152 | - <label>Cรณdigo postal</label> | |
153 | - <input | |
159 | + /> | |
160 | + </div> | |
161 | + <div class="col-md-3 col-12 mt-2"> | |
162 | + <label>Cรณdigo postal</label> | |
163 | + <input | |
154 | 164 | type="text" |
155 | 165 | class="form-control form-control-sm" |
156 | 166 | ng-model="cliente.CPO" |
... | ... | @@ -160,424 +170,431 @@ |
160 | 170 | foca-focus="focused == 3" |
161 | 171 | ng-keypress="next($event.keyCode)" |
162 | 172 | teclado-virtual |
163 | - /> | |
164 | - </div> | |
165 | - </div> | |
166 | - <div class="row"> | |
167 | - <div class="col-md-6 col-12"> | |
168 | - <label>Provincia</label> | |
169 | - <div class="input-group"> | |
170 | - <input | |
171 | - type="text" | |
172 | - class="form-control form-control-sm" | |
173 | - ng-model="cliente.provincia.NOMBRE" | |
174 | - ng-keypress="seleccionarProvincia($event.keyCode)" | |
175 | - placeholder="Seleccione provincia" | |
176 | - ng-required="true" | |
177 | - ng-focus="focus(4)" | |
178 | - foca-focus="focused == 4" | |
179 | - teclado-virtual | |
180 | 173 | /> |
181 | - <button | |
182 | - ng-show="cliente.provincia.NOMBRE.length >= 1" | |
183 | - type="button" | |
184 | - class="clear-input" | |
185 | - ng-click="cliente.provincia.NOMBRE = ''" | |
186 | - > | |
187 | - <i class="fa fa-times"></i> | |
188 | - </button> | |
189 | - <div class="input-group-append"> | |
190 | - <button | |
191 | - ladda="searchLoading" | |
192 | - class="btn btn-outline-secondary" | |
174 | + </div> | |
175 | + </div> | |
176 | + <div class="row"> | |
177 | + <div class="col-md-6 col-12 mt-2"> | |
178 | + <label>Provincia</label> | |
179 | + <div class="input-group"> | |
180 | + <input | |
181 | + type="text" | |
182 | + class="form-control form-control-sm" | |
183 | + ng-model="cliente.provincia.NOMBRE" | |
184 | + ng-keypress="seleccionarProvincia($event.keyCode)" | |
185 | + placeholder="Seleccione provincia" | |
186 | + ng-required="true" | |
187 | + ng-focus="focus(4)" | |
188 | + foca-focus="focused == 4" | |
189 | + teclado-virtual | |
190 | + /> | |
191 | + <button | |
192 | + ng-show="cliente.provincia.NOMBRE !== ''" | |
193 | 193 | type="button" |
194 | - ng-click="seleccionarProvincia(13)" | |
195 | - > | |
196 | - <i class="fa fa-search" aria-hidden="true"></i> | |
194 | + class="clear-input" | |
195 | + ng-click= | |
196 | + "cliente.provincia.NOMBRE = ''; | |
197 | + cliente.provincia.ID = undefined" | |
198 | + ><i class="fa fa-times"></i> | |
197 | 199 | </button> |
200 | + <div class="input-group-append"> | |
201 | + <button | |
202 | + ladda="searchLoading" | |
203 | + class="btn btn-outline-secondary" | |
204 | + type="button" | |
205 | + ng-click="seleccionarProvincia(13)" | |
206 | + ><i class="fa fa-search" aria-hidden="true"></i> | |
207 | + </button> | |
208 | + </div> | |
198 | 209 | </div> |
199 | 210 | </div> |
200 | - </div> | |
201 | - <div class="col-md-6 col-12"> | |
202 | - <label>Localidad</label> | |
203 | - <div class="input-group"> | |
204 | - <input | |
205 | - type="text" | |
206 | - class="form-control form-control-sm" | |
207 | - ng-model="cliente.localidad.NOMBRE" | |
208 | - ng-keypress="seleccionarLocalidad($event.keyCode)" | |
209 | - placeholder="Seleccione localidad" | |
210 | - ng-required="true" | |
211 | - foca-focus="focused == 5" | |
212 | - ng-focus="focus(5)" | |
213 | - teclado-virtual | |
214 | - /> | |
215 | - <button | |
216 | - ng-show="cliente.localidad.NOMBRE.length >= 1" | |
217 | - type="button" | |
218 | - class="clear-input" | |
219 | - ng-click="cliente.localidad.NOMBRE = ''" | |
220 | - > | |
221 | - <i class="fa fa-times"></i> | |
222 | - </button> | |
223 | - <div class="input-group-append"> | |
224 | - <button | |
225 | - ladda="searchLoading" | |
226 | - class="btn btn-outline-secondary" | |
211 | + <div class="col-md-6 col-12 mt-2"> | |
212 | + <label>Localidad</label> | |
213 | + <div class="input-group"> | |
214 | + <input | |
215 | + type="text" | |
216 | + class="form-control form-control-sm" | |
217 | + ng-model="cliente.localidad.NOMBRE" | |
218 | + ng-keypress="seleccionarLocalidad($event.keyCode)" | |
219 | + placeholder="Seleccione localidad" | |
220 | + ng-required="true" | |
221 | + foca-focus="focused == 5" | |
222 | + ng-focus="focus(5)" | |
223 | + teclado-virtual | |
224 | + /> | |
225 | + <button | |
226 | + ng-show="cliente.localidad.NOMBRE !== ''" | |
227 | 227 | type="button" |
228 | - ng-click="seleccionarLocalidad(13)" | |
229 | - > | |
230 | - <i class="fa fa-search" aria-hidden="true"></i> | |
228 | + class="clear-input" | |
229 | + ng-click="cliente.localidad.NOMBRE = ''" | |
230 | + ><i class="fa fa-times"></i> | |
231 | 231 | </button> |
232 | + <div class="input-group-append"> | |
233 | + <button | |
234 | + ladda="searchLoading" | |
235 | + class="btn btn-outline-secondary" | |
236 | + type="button" | |
237 | + ng-click="seleccionarLocalidad(13)" | |
238 | + ><i class="fa fa-search" aria-hidden="true"></i> | |
239 | + </button> | |
240 | + </div> | |
232 | 241 | </div> |
233 | 242 | </div> |
234 | 243 | </div> |
235 | - </div> | |
236 | - <div class="row"> | |
237 | - <div class="col-md-6 col-12"> | |
238 | - <label>Zona</label> | |
239 | - <div class="input-group"> | |
240 | - <input | |
241 | - type="text" | |
242 | - class="form-control form-control-sm" | |
243 | - ng-model="cliente.zona.NOM" | |
244 | - ng-keypress="seleccionarZona($event.keyCode)" | |
245 | - placeholder="Seleccione zona" | |
246 | - ng-required="true" | |
247 | - ng-focus="focus(6)" | |
248 | - foca-focus="focused == 6" | |
249 | - teclado-virtual | |
250 | - /> | |
251 | - <button | |
252 | - ng-show="cliente.zona.NOM.length >= 1" | |
253 | - type="button" | |
254 | - class="clear-input" | |
255 | - ng-click="cliente.zona.NOM = ''" | |
256 | - > | |
257 | - <i class="fa fa-times"></i> | |
258 | - </button> | |
259 | - <div class="input-group-append"> | |
260 | - <button | |
261 | - ladda="searchLoading" | |
262 | - class="btn btn-outline-secondary" | |
244 | + <div class="row"> | |
245 | + <div class="col-md-6 col-12 mt-2"> | |
246 | + <label>Zona</label> | |
247 | + <div class="input-group"> | |
248 | + <input | |
249 | + type="text" | |
250 | + class="form-control form-control-sm" | |
251 | + ng-model="cliente.zona.NOM" | |
252 | + ng-keypress="seleccionarZona($event.keyCode)" | |
253 | + placeholder="Seleccione zona" | |
254 | + ng-required="true" | |
255 | + ng-focus="focus(6)" | |
256 | + foca-focus="focused == 6" | |
257 | + teclado-virtual | |
258 | + /> | |
259 | + <button | |
260 | + ng-show="cliente.zona.NOM !== ''" | |
263 | 261 | type="button" |
264 | - ng-click="seleccionarZona(13)" | |
265 | - > | |
266 | - <i class="fa fa-search" aria-hidden="true"></i> | |
262 | + class="clear-input" | |
263 | + ng-click="cliente.zona.NOM = ''" | |
264 | + ><i class="fa fa-times"></i> | |
267 | 265 | </button> |
266 | + <div class="input-group-append"> | |
267 | + <button | |
268 | + ladda="searchLoading" | |
269 | + class="btn btn-outline-secondary" | |
270 | + type="button" | |
271 | + ng-click="seleccionarZona(13)" | |
272 | + ><i class="fa fa-search" aria-hidden="true"></i> | |
273 | + </button> | |
274 | + </div> | |
268 | 275 | </div> |
269 | 276 | </div> |
270 | - </div> | |
271 | - <div class="col-md-6 col-12"> | |
272 | - <label> Actividad </label> | |
273 | - <div class="input-group"> | |
274 | - <input | |
275 | - type="text" | |
276 | - class="form-control form-control-sm" | |
277 | - ng-model="cliente.actividad.NOM" | |
278 | - ng-keypress="seleccionarActividad($event.keyCode)" | |
279 | - placeholder="Seleccione actividad" | |
280 | - ng-required="true" | |
281 | - ng-focus="focus(7)" | |
282 | - foca-focus="focused == 7" | |
283 | - teclado-virtual | |
284 | - /> | |
285 | - <button | |
286 | - ng-show="cliente.actividad.NOM.length >= 1" | |
287 | - type="button" | |
288 | - class="clear-input" | |
289 | - ng-click="cliente.actividad.NOM = ''" | |
290 | - > | |
291 | - <i class="fa fa-times"></i> | |
292 | - </button> | |
293 | - <div class="input-group-append"> | |
294 | - <button | |
295 | - ladda="searchLoading" | |
296 | - class="btn btn-outline-secondary" | |
277 | + <div class="col-md-6 col-12 mt-2"> | |
278 | + <label> Actividad </label> | |
279 | + <div class="input-group"> | |
280 | + <input | |
281 | + type="text" | |
282 | + class="form-control form-control-sm" | |
283 | + ng-model="cliente.actividad.NOM" | |
284 | + ng-keypress="seleccionarActividad($event.keyCode)" | |
285 | + placeholder="Seleccione actividad" | |
286 | + ng-required="true" | |
287 | + ng-focus="focus(7)" | |
288 | + foca-focus="focused == 7" | |
289 | + teclado-virtual | |
290 | + /> | |
291 | + <button | |
292 | + ng-show="cliente.actividad.NOM !== ''" | |
297 | 293 | type="button" |
298 | - ng-click="seleccionarActividad(13)" | |
299 | - > | |
300 | - <i class="fa fa-search" aria-hidden="true"></i> | |
294 | + class="clear-input" | |
295 | + ng-click="cliente.actividad.NOM = ''" | |
296 | + ><i class="fa fa-times"></i> | |
301 | 297 | </button> |
298 | + <div class="input-group-append"> | |
299 | + <button | |
300 | + ladda="searchLoading" | |
301 | + class="btn btn-outline-secondary" | |
302 | + type="button" | |
303 | + ng-click="seleccionarActividad(13)" | |
304 | + ><i class="fa fa-search" aria-hidden="true"></i> | |
305 | + </button> | |
306 | + </div> | |
302 | 307 | </div> |
303 | 308 | </div> |
304 | 309 | </div> |
305 | - </div> | |
306 | - <div class="row"> | |
307 | - <div class="col-md-6 col-12"> | |
308 | - <label>Cobrador</label> | |
309 | - <div class="input-group"> | |
310 | - <input | |
311 | - type="text" | |
312 | - class="form-control form-control-sm" | |
313 | - ng-model="cliente.cobrador.NOM" | |
314 | - ng-keypress="seleccionarCobrador($event.keyCode)" | |
315 | - placeholder="Seleccione cobrador" | |
316 | - ng-focus="focus(8)" | |
317 | - foca-focus="focused == 8" | |
318 | - teclado-virtual | |
319 | - /> | |
320 | - <button | |
321 | - ng-show="cliente.cobrador.NOM.length >= 1" | |
322 | - type="button" | |
323 | - class="clear-input" | |
324 | - ng-click="cliente.cobrador.NOM = ''" | |
325 | - > | |
326 | - <i class="fa fa-times"></i> | |
327 | - </button> | |
328 | - <div class="input-group-append"> | |
329 | - <button | |
330 | - ladda="searchLoading" | |
331 | - class="btn btn-outline-secondary" | |
310 | + <div class="row"> | |
311 | + <div class="col-md-6 col-12 mt-2"> | |
312 | + <label>Cobrador</label> | |
313 | + <div class="input-group"> | |
314 | + <input | |
315 | + type="text" | |
316 | + class="form-control form-control-sm" | |
317 | + ng-model="cliente.cobrador.NOM" | |
318 | + ng-keypress="seleccionarCobrador($event.keyCode)" | |
319 | + placeholder="Seleccione cobrador" | |
320 | + ng-focus="focus(8)" | |
321 | + foca-focus="focused == 8" | |
322 | + teclado-virtual | |
323 | + /> | |
324 | + <button | |
325 | + ng-show="cliente.cobrador.NOM !== ''" | |
332 | 326 | type="button" |
333 | - ng-click="seleccionarCobrador(13)" | |
334 | - > | |
335 | - <i class="fa fa-search" aria-hidden="true"></i> | |
327 | + class="clear-input" | |
328 | + ng-click="cliente.cobrador.NOM = ''" | |
329 | + ><i class="fa fa-times"></i> | |
336 | 330 | </button> |
331 | + <div class="input-group-append"> | |
332 | + <button | |
333 | + ladda="searchLoading" | |
334 | + class="btn btn-outline-secondary" | |
335 | + type="button" | |
336 | + ng-click="seleccionarCobrador(13)" | |
337 | + ><i class="fa fa-search" aria-hidden="true"></i> | |
338 | + </button> | |
339 | + </div> | |
337 | 340 | </div> |
338 | 341 | </div> |
339 | - </div> | |
340 | - <div class="col-md-6 col-12"> | |
341 | - <label>Vendedor</label> | |
342 | - <div class="input-group"> | |
343 | - <input | |
344 | - type="text" | |
345 | - class="form-control form-control-sm" | |
346 | - ng-model="vendedor.NOM" | |
347 | - disabled="true" | |
348 | - /> | |
342 | + <div class="col-md-6 col-12 mt-2"> | |
343 | + <label>Vendedor</label> | |
344 | + <div class="input-group"> | |
345 | + <input | |
346 | + type="text" | |
347 | + class="form-control form-control-sm" | |
348 | + ng-model="vendedor.NOM" | |
349 | + ng-keypress="seleccionarVendedor($event.keyCode)" | |
350 | + placeholder="Seleccione vendedor" | |
351 | + ng-focus="focus(9)" | |
352 | + foca-focus="focused == 9" | |
353 | + teclado-virtual | |
354 | + /> | |
355 | + <button | |
356 | + ng-show="vendedor.NOM !== ''" | |
357 | + type="button" | |
358 | + class="clear-input" | |
359 | + ng-click="vendedor.NOM = ''" | |
360 | + ><i class="fa fa-times"></i> | |
361 | + </button> | |
362 | + <div class="input-group-append"> | |
363 | + <button | |
364 | + ladda="searchLoading" | |
365 | + class="btn btn-outline-secondary" | |
366 | + type="button" | |
367 | + ng-click="seleccionarVendedor(13)" | |
368 | + ><i class="fa fa-search" aria-hidden="true"></i> | |
369 | + </button> | |
370 | + </div> | |
371 | + </div> | |
349 | 372 | </div> |
350 | - </div> | |
351 | - <div class="col-md-6 col-12"> | |
352 | - <label>Email</label> | |
353 | - <div class="input-group"> | |
354 | - <input | |
355 | - type="text" | |
356 | - class="form-control form-control-sm" | |
357 | - placeholder="Ingrese Email" | |
358 | - ng-model="cliente.MAIL" | |
359 | - ng-required="true" | |
360 | - ng-keypress="next($event.keyCode)" | |
361 | - ng-focus="focus(10)" | |
362 | - foca-focus="focused == 10" | |
363 | - teclado-virtual> | |
373 | + <div class="col-md-6 col-12 mt-2"> | |
374 | + <label>Email</label> | |
375 | + <div class="input-group"> | |
376 | + <input | |
377 | + type="text" | |
378 | + class="form-control form-control-sm" | |
379 | + placeholder="Ingrese Email" | |
380 | + ng-model="cliente.MAIL" | |
381 | + ng-required="true" | |
382 | + ng-keypress="next($event.keyCode)" | |
383 | + ng-focus="focus(10)" | |
384 | + foca-focus="focused == 10" | |
385 | + teclado-virtual> | |
386 | + </div> | |
364 | 387 | </div> |
365 | - </div> | |
366 | - <div class="col-md-6 col-12"> | |
367 | - <label>Telefono</label> | |
368 | - <div class="input-group"> | |
369 | - <input | |
370 | - foca-tipo-input | |
371 | - limite-numeros-max="20" | |
372 | - class="form-control form-control-sm" | |
373 | - placeholder="Ingrese Telefono" | |
374 | - ng-model="cliente.TEL" | |
375 | - ng-required="true" | |
376 | - ng-keypress="next($event.keyCode)" | |
377 | - ng-focus="focus(11)" | |
378 | - foca-focus="focused == 11" | |
379 | - teclado-virtual> | |
388 | + <div class="col-md-6 col-12 mt-2"> | |
389 | + <label>Telefono</label> | |
390 | + <div class="input-group"> | |
391 | + <input | |
392 | + foca-tipo-input | |
393 | + limite-numeros-max="20" | |
394 | + class="form-control form-control-sm" | |
395 | + placeholder="Ingrese Telefono" | |
396 | + ng-model="cliente.TEL" | |
397 | + ng-required="true" | |
398 | + ng-keypress="next($event.keyCode)" | |
399 | + ng-focus="focus(11)" | |
400 | + foca-focus="focused == 11" | |
401 | + teclado-virtual> | |
402 | + </div> | |
380 | 403 | </div> |
381 | 404 | </div> |
382 | - </div> | |
383 | - <div class="row"> | |
384 | - <div class="col-6 d-flex"> | |
385 | - <div class="custom-control custom-checkbox mt-auto"> | |
386 | - <input | |
387 | - type="checkbox" | |
388 | - class="custom-control-input" | |
389 | - id="checkDistribuidor" | |
390 | - ng-model="cliente.ES_MAY" | |
391 | - checked | |
392 | - disabled="disabled"> | |
393 | - <label class="custom-control-label" for="checkDistribuidor">ยฟEste cliente es distribuidor?</label> | |
405 | + <div class="row"> | |
406 | + <div class="col-6 d-flex mt-3"> | |
407 | + <div class="custom-control custom-checkbox mt-auto"> | |
408 | + <input | |
409 | + type="checkbox" | |
410 | + class="custom-control-input" | |
411 | + id="checkDistribuidor" | |
412 | + ng-model="cliente.ES_MAY" | |
413 | + checked | |
414 | + disabled="disabled"> | |
415 | + <label class="custom-control-label" for="checkDistribuidor">ยฟEste cliente es distribuidor?</label> | |
416 | + </div> | |
394 | 417 | </div> |
395 | 418 | </div> |
396 | - </div> | |
397 | - </uib-tab> | |
398 | - <uib-tab heading="Datos impositivos"> | |
399 | - <div class="row"> | |
400 | - <div class="col-md-7 col-12"> | |
401 | - <label>Responsabilidad ante el IVA</label> | |
402 | - <div class="input-group"> | |
403 | - <input | |
404 | - type="text" | |
405 | - class="form-control form-control-sm" | |
406 | - placeholder="Seleccione responsabilidad ante el IVA" | |
407 | - ng-model="cliente.iva.NOMBRE" | |
408 | - ng-keypress="seleccionarIva($event.keyCode)" | |
409 | - ng-required="true" | |
410 | - ng-focus="focus(12)" | |
411 | - foca-focus="focused == 12" | |
412 | - teclado-virtual | |
413 | - /> | |
414 | - <button | |
415 | - ng-show="cliente.iva.NOMBRE.length >= 1" | |
416 | - type="button" | |
417 | - class="clear-input" | |
418 | - ng-click="cliente.iva.NOMBRE = ''" | |
419 | - > | |
420 | - <i class="fa fa-times"></i> | |
421 | - </button> | |
422 | - <div class="input-group-append"> | |
423 | - <button | |
424 | - ladda="searchLoading" | |
425 | - class="btn btn-outline-secondary" | |
419 | + </uib-tab> | |
420 | + <uib-tab heading="Datos impositivos"> | |
421 | + <div class="row"> | |
422 | + <div class="col-md-7 col-12 mt-2"> | |
423 | + <label>Responsabilidad ante el IVA</label> | |
424 | + <div class="input-group"> | |
425 | + <input | |
426 | + type="text" | |
427 | + class="form-control form-control-sm" | |
428 | + placeholder="Seleccione responsabilidad ante el IVA" | |
429 | + ng-model="cliente.iva.NOMBRE" | |
430 | + ng-keypress="seleccionarIva($event.keyCode)" | |
431 | + ng-required="true" | |
432 | + ng-focus="focus(12)" | |
433 | + foca-focus="focused == 12" | |
434 | + teclado-virtual | |
435 | + /> | |
436 | + <button | |
437 | + ng-show="cliente.iva.NOMBRE !== ''" | |
426 | 438 | type="button" |
427 | - ng-click="seleccionarIva(13)" | |
428 | - > | |
429 | - <i class="fa fa-search" aria-hidden="true"></i> | |
439 | + class="clear-input" | |
440 | + ng-click="cliente.iva.NOMBRE = ''" | |
441 | + ><i class="fa fa-times"></i> | |
430 | 442 | </button> |
443 | + <div class="input-group-append"> | |
444 | + <button | |
445 | + ladda="searchLoading" | |
446 | + class="btn btn-outline-secondary" | |
447 | + type="button" | |
448 | + ng-click="seleccionarIva(13)" | |
449 | + ><i class="fa fa-search" aria-hidden="true"></i> | |
450 | + </button> | |
451 | + </div> | |
431 | 452 | </div> |
432 | 453 | </div> |
433 | - </div> | |
434 | - <div class="col-md-5 col-12"> | |
435 | - <label>Factura que emite</label> | |
436 | - <div class="input-group"> | |
437 | - <input | |
438 | - type="text" | |
439 | - class="form-control form-control-sm" | |
440 | - placeholder="Seleccione factura que emite" | |
441 | - ng-model="cliente.tipoFactura.NOMBRE" | |
442 | - ng-required="true" | |
443 | - ng-keypress="seleccionarTipoFactura(13)" | |
444 | - ng-focus="focus(13)" | |
445 | - foca-focus="focused == 13" | |
446 | - teclado-virtual> | |
447 | - <button | |
448 | - ng-show="cliente.tipoFactura.NOMBRE.length >= 1" | |
449 | - type="button" | |
450 | - class="clear-input" | |
451 | - ng-click="cliente.tipoFactura.NOMBRE = ''" | |
452 | - > | |
453 | - <i class="fa fa-times"></i> | |
454 | - </button> | |
455 | - <div class="input-group-append"> | |
456 | - <button | |
457 | - ladda="searchLoading" | |
458 | - class="btn btn-outline-secondary" | |
454 | + <div class="col-md-5 col-12 mt-2"> | |
455 | + <label>Factura que emite</label> | |
456 | + <div class="input-group"> | |
457 | + <input | |
458 | + type="text" | |
459 | + class="form-control form-control-sm" | |
460 | + placeholder="Seleccione factura que emite" | |
461 | + ng-model="cliente.tipoFactura.NOMBRE" | |
462 | + ng-required="true" | |
463 | + ng-keypress="seleccionarTipoFactura(13)" | |
464 | + ng-focus="focus(13)" | |
465 | + foca-focus="focused == 13" | |
466 | + teclado-virtual> | |
467 | + <button | |
468 | + ng-show="cliente.tipoFactura.NOMBRE !== ''" | |
459 | 469 | type="button" |
460 | - ng-click="seleccionarTipoFactura(13)" | |
461 | - > | |
462 | - <i class="fa fa-search" aria-hidden="true"></i> | |
470 | + class="clear-input" | |
471 | + ng-click="cliente.tipoFactura.NOMBRE = ''" | |
472 | + ><i class="fa fa-times"></i> | |
463 | 473 | </button> |
474 | + <div class="input-group-append"> | |
475 | + <button | |
476 | + ladda="searchLoading" | |
477 | + class="btn btn-outline-secondary" | |
478 | + type="button" | |
479 | + ng-click="seleccionarTipoFactura(13)" | |
480 | + ><i class="fa fa-search" aria-hidden="true"></i> | |
481 | + </button> | |
482 | + </div> | |
464 | 483 | </div> |
465 | 484 | </div> |
466 | 485 | </div> |
467 | - </div> | |
468 | - | |
469 | - <div class="row"> | |
470 | - <div class= "col-md-4 col-12"> | |
471 | - <label>CUIT</label> | |
472 | - <div class="d-flex"> | |
473 | - <input | |
474 | - type="text" | |
475 | - class="form-control form-control-sm col-2" | |
476 | - limite-numeros-max="2" | |
477 | - ng-model="cliente.cuit1" | |
478 | - ng-required="true" | |
479 | - ng-keypress="pasarCampoCuit(1)" | |
480 | - ng-focus="focus(14)" | |
481 | - foca-focus="focused == 14" | |
482 | - teclado-virtual | |
483 | - > | |
484 | - <span class="m-1"> - </span> | |
485 | - <input | |
486 | - type="text" | |
487 | - class="form-control form-control-sm col-5" | |
488 | - maxlength="8" | |
489 | - limite-numeros-max="8" | |
490 | - ng-keypress="pasarCampoCuit(2)" | |
491 | - ng-model="cliente.cuit2" | |
492 | - ng-required="true" | |
493 | - ng-focus="focus(15)" | |
494 | - foca-focus="cuitActivo == 2 || focused == 15" | |
495 | - teclado-virtual | |
496 | - > | |
497 | - <span class="m-1"> - </span> | |
498 | - <input | |
499 | - type="text" | |
500 | - class="form-control form-control-sm col-2" | |
501 | - maxlength="1" | |
502 | - limite-numeros-max="1" | |
503 | - ng-keypress="pasarCampoCuit(3)" | |
504 | - ng-model="cliente.cuit3" | |
505 | - ng-required="true" | |
506 | - ng-focus="focus(16)" | |
507 | - foca-focus="cuitActivo == 3 || focused == 16" | |
508 | - teclado-virtual | |
509 | - > | |
486 | + <div class="row"> | |
487 | + <div class= "col-md-4 col-12 mt-2"> | |
488 | + <label>CUIT</label> | |
489 | + <div class="d-flex"> | |
490 | + <input | |
491 | + type="text" | |
492 | + class="text-center form-control form-control-sm col-2" | |
493 | + limite-numeros-max="2" | |
494 | + ng-model="cliente.cuit1" | |
495 | + ng-required="true" | |
496 | + ng-keypress="pasarCampoCuit(1)" | |
497 | + ng-focus="focus(14)" | |
498 | + foca-focus="focused == 14" | |
499 | + teclado-virtual | |
500 | + foca-tipo-input | |
501 | + > | |
502 | + <span class="m-1"> - </span> | |
503 | + <input | |
504 | + type="text" | |
505 | + class="text-center form-control form-control-sm col-5" | |
506 | + maxlength="8" | |
507 | + limite-numeros-max="8" | |
508 | + ng-keypress="pasarCampoCuit(2)" | |
509 | + ng-model="cliente.cuit2" | |
510 | + ng-required="true" | |
511 | + ng-focus="focus(15)" | |
512 | + foca-focus="cuitActivo == 2 || focused == 15" | |
513 | + teclado-virtual | |
514 | + foca-tipo-input | |
515 | + > | |
516 | + <span class="m-1"> - </span> | |
517 | + <input | |
518 | + type="text" | |
519 | + class="text-center form-control form-control-sm col-2" | |
520 | + maxlength="1" | |
521 | + limite-numeros-max="1" | |
522 | + ng-keypress="pasarCampoCuit(3)" | |
523 | + ng-model="cliente.cuit3" | |
524 | + ng-required="true" | |
525 | + ng-focus="focus(16)" | |
526 | + foca-focus="cuitActivo == 3 || focused == 16" | |
527 | + teclado-virtual | |
528 | + foca-tipo-input | |
529 | + > | |
530 | + </div> | |
510 | 531 | </div> |
511 | - </div> | |
512 | - <div class="col-md-4 col-12"> | |
513 | - <label>Clase de comprobante</label> | |
514 | - <div class="input-group"> | |
515 | - <input | |
516 | - type="text" | |
517 | - class="form-control form-control-sm" | |
518 | - placeholder="Seleccione clase de comprobante" | |
519 | - ng-keypress="seleccionarTipoComprobante($event.keyCode)" | |
520 | - ng-model="cliente.tipoComprobante.NOMBRE" | |
521 | - ng-required="true" | |
522 | - ng-focus="focus(17)" | |
523 | - foca-focus="focused == 17" | |
524 | - teclado-virtual> | |
525 | - <button | |
526 | - ng-show="cliente.tipoComprobante.NOMBRE.length >= 1" | |
527 | - type="button" | |
528 | - class="clear-input" | |
529 | - ng-click="cliente.tipoComprobante.NOMBRE = ''" | |
530 | - > | |
531 | - <i class="fa fa-times"></i> | |
532 | - </button> | |
533 | - <div class="input-group-append"> | |
534 | - <button | |
535 | - ladda="searchLoading" | |
536 | - class="btn btn-outline-secondary" | |
532 | + <div class="col-md-4 col-12 mt-2"> | |
533 | + <label>Clase de comprobante</label> | |
534 | + <div class="input-group"> | |
535 | + <input | |
536 | + type="text" | |
537 | + class="form-control form-control-sm" | |
538 | + placeholder="Seleccione clase de comprobante" | |
539 | + ng-keypress="seleccionarTipoComprobante($event.keyCode)" | |
540 | + ng-model="cliente.tipoComprobante.NOMBRE" | |
541 | + ng-required="true" | |
542 | + ng-focus="focus(17)" | |
543 | + foca-focus="focused == 17" | |
544 | + teclado-virtual> | |
545 | + <button | |
546 | + ng-show="cliente.tipoComprobante.NOMBRE !== ''" | |
537 | 547 | type="button" |
538 | - ng-click="seleccionarTipoComprobante(13)" | |
539 | - > | |
540 | - <i class="fa fa-search" aria-hidden="true"></i> | |
541 | - </button> | |
548 | + class="clear-input" | |
549 | + ng-click="cliente.tipoComprobante.NOMBRE = ''" | |
550 | + ><i class="fa fa-times"></i> | |
551 | + </button> | |
552 | + <div class="input-group-append"> | |
553 | + <button | |
554 | + ladda="searchLoading" | |
555 | + class="btn btn-outline-secondary" | |
556 | + type="button" | |
557 | + ng-click="seleccionarTipoComprobante(13)" | |
558 | + ><i class="fa fa-search" aria-hidden="true"></i> | |
559 | + </button> | |
560 | + </div> | |
542 | 561 | </div> |
543 | 562 | </div> |
544 | - </div> | |
545 | - <div class="col-md-4 col-12"> | |
546 | - <label>Forma de pago</label> | |
547 | - <div class="input-group"> | |
548 | - <input | |
549 | - type="text" | |
550 | - class="form-control form-control-sm" | |
551 | - placeholder="Seleccione forma de pago" | |
552 | - ng-model="cliente.formaPago.NOMBRE" | |
553 | - ng-required="true" | |
554 | - ng-keypress="seleccionarFormaPago($event.keyCode)" | |
555 | - ng-focus="focus(18)" | |
556 | - foca-focus="focused == 18" | |
557 | - teclado-virtual> | |
558 | - <button | |
559 | - ng-show="cliente.formaPago.NOMBRE.length >= 1" | |
560 | - type="button" | |
561 | - class="clear-input" | |
562 | - ng-click="cliente.formaPago.NOMBRE = ''" | |
563 | - > | |
564 | - <i class="fa fa-times"></i> | |
565 | - </button> | |
566 | - <div class="input-group-append"> | |
567 | - <button | |
568 | - ladda="searchLoading" | |
569 | - class="btn btn-outline-secondary" | |
563 | + <div class="col-md-4 col-12 mt-2"> | |
564 | + <label>Forma de pago</label> | |
565 | + <div class="input-group"> | |
566 | + <input | |
567 | + type="text" | |
568 | + class="form-control form-control-sm" | |
569 | + placeholder="Seleccione forma de pago" | |
570 | + ng-model="cliente.formaPago.NOMBRE" | |
571 | + ng-required="true" | |
572 | + ng-keypress="seleccionarFormaPago($event.keyCode)" | |
573 | + ng-focus="focus(18)" | |
574 | + foca-focus="focused == 18" | |
575 | + teclado-virtual> | |
576 | + <button | |
577 | + ng-show="cliente.formaPago.NOMBRE !== ''" | |
570 | 578 | type="button" |
571 | - ng-click="seleccionarFormaPago(13)" | |
572 | - > | |
573 | - <i class="fa fa-search" aria-hidden="true"></i> | |
579 | + class="clear-input" | |
580 | + ng-click="cliente.formaPago.NOMBRE = ''" | |
581 | + ><i class="fa fa-times"></i> | |
574 | 582 | </button> |
583 | + <div class="input-group-append"> | |
584 | + <button | |
585 | + ladda="searchLoading" | |
586 | + class="btn btn-outline-secondary" | |
587 | + type="button" | |
588 | + ng-click="seleccionarFormaPago(13)" | |
589 | + ><i class="fa fa-search" aria-hidden="true"></i> | |
590 | + </button> | |
591 | + </div> | |
575 | 592 | </div> |
576 | 593 | </div> |
577 | 594 | </div> |
578 | - </div> | |
579 | - </uib-tab> | |
580 | - </uib-tabset> | |
595 | + </uib-tab> | |
596 | + </uib-tabset> | |
597 | + </fieldset> | |
581 | 598 | </form> |
582 | 599 | </div> |
583 | 600 | <div class="modal-footer py-1"> |
... | ... | @@ -609,11 +626,24 @@ |
609 | 626 | </li> |
610 | 627 | </ul> |
611 | 628 | </nav> |
612 | - <button class="btn btn-sm btn-secondary" type="button" ng-click="cancel()">Cancelar</button> | |
613 | 629 | <button |
630 | + ng-hide="accion == 'Cliente'" | |
631 | + class="btn btn-sm btn-secondary" | |
632 | + type="button" | |
633 | + ng-click="cancel()">Cancelar | |
634 | + </button> | |
635 | + <button | |
636 | + ng-show="accion == 'Cliente'" | |
637 | + class="btn btn-sm btn-secondary" | |
638 | + type="button" | |
639 | + ng-click="cancel()">Volver | |
640 | + </button> | |
641 | + <button | |
642 | + ng-hide="accion == 'Cliente'" | |
614 | 643 | class="btn btn-sm btn-primary" |
615 | 644 | type="button" |
616 | 645 | ng-show="ingreso" |
617 | 646 | ng-click="guardar()" |
618 | - >Guardar</button> | |
647 | + >Guardar | |
648 | + </button> | |
619 | 649 | </div> |