Commit 2adebe2d119ec7f997d9eed14b3f302ba7a5181e

Authored by Jose Pinto
Exists in master and in 1 other branch develop

Merge branch 'master' into 'develop'

Master

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