Commit b4d08929ec8214fa4b716c5cc6f53c8a821894a8

Authored by Marcelo Puebla
1 parent 1579628447
Exists in master and in 1 other branch develop

Revert "Revert "Agregada cruz para borrar contenido de filtro de busqueda.""

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