Commit 1579628447ef86138d5ba8ac37b5ecdde6a6e0d9

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

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

This reverts commit 264b4437e4636ed49f15ddf90ae9c453ae9a329f.
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 }
657 } 654 }
658 ]); 655 ]);
659 656
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>
48 <div class="input-group-append" ng-hide="ingreso"> 40 <div class="input-group-append" ng-hide="ingreso">
49 <button 41 <button
50 ladda="searchLoading" 42 ladda="searchLoading"
51 data-spinner-color="#FF0000" 43 data-spinner-color="#FF0000"
52 class="btn btn-outline-secondary" 44 class="btn btn-outline-secondary"
53 type="button" 45 type="button"
54 ng-click="busquedaPress(13)"> 46 ng-click="busquedaPress(13)">
55 <i class="fa fa-search" aria-hidden="true"></i> 47 <i class="fa fa-search" aria-hidden="true"></i>
56 </button> 48 </button>
57 </div> 49 </div>
58 </div> 50 </div>
59 </div> 51 </div>
60 </div> 52 </div>
61 <div class="modal-body" id="modal-body"> 53 <div class="modal-body" id="modal-body">
62 54
63 <div ng-show="!primerBusqueda && !ingreso"> 55 <div ng-show="!primerBusqueda && !ingreso">
64 Debe realizar una primer búsqueda. 56 Debe realizar una primer búsqueda.
65 </div> 57 </div>
66 58
67 <table ng-show="primerBusqueda && !ingreso" class="table table-striped table-sm"> 59 <table ng-show="primerBusqueda && !ingreso" class="table table-striped table-sm">
68 <thead> 60 <thead>
69 <tr> 61 <tr>
70 <th>Código</th> 62 <th>Código</th>
71 <th>Nombre</th> 63 <th>Nombre</th>
72 <th>CUIT</th> 64 <th>CUIT</th>
73 <th></th> 65 <th></th>
74 </tr> 66 </tr>
75 </thead> 67 </thead>
76 <tbody> 68 <tbody>
77 <tr ng-show="currentPageClientes.length == 0 && primerBusqueda"> 69 <tr ng-show="currentPageClientes.length == 0 && primerBusqueda">
78 <td colspan="4"> 70 <td colspan="4">
79 No se encontraron resultados. 71 No se encontraron resultados.
80 </td> 72 </td>
81 </tr> 73 </tr>
82 <tr 74 <tr
83 class="selectable" 75 class="selectable"
84 ng-repeat="(key, cliente) in currentPageClientes" 76 ng-repeat="(key, cliente) in currentPageClientes"
85 ng-click="select(cliente)"> 77 ng-click="select(cliente)">
86 <td ng-bind="('00000'+cliente.cod).slice(-5)"></td> 78 <td ng-bind="('00000'+cliente.cod).slice(-5)"></td>
87 <td ng-bind="cliente.nom"></td> 79 <td ng-bind="cliente.nom"></td>
88 <td ng-bind="cliente.cuit"></td> 80 <td ng-bind="cliente.cuit"></td>
89 <td> 81 <td>
90 <button 82 <button
91 type="button" 83 type="button"
92 class="btn btn-xs p-1 float-right" 84 class="btn btn-xs p-1 float-right"
93 ng-class="{ 85 ng-class="{
94 'btn-secondary': selectedClientes != key, 86 'btn-secondary': selectedClientes != key,
95 'btn-primary': selectedClientes == key 87 'btn-primary': selectedClientes == key
96 }" 88 }"
97 ng-click="select(cliente)" 89 ng-click="select(cliente)"
98 foca-focus="selectedClientes == {{key}}" 90 foca-focus="selectedClientes == {{key}}"
99 ng-keydown="itemCliente($event.keyCode)" 91 ng-keydown="itemCliente($event.keyCode)"
100 > 92 >
101 <i class="fa fa-circle-thin" aria-hidden="true"></i> 93 <i class="fa fa-circle-thin" aria-hidden="true"></i>
102 </button> 94 </button>
103 </td> 95 </td>
104 </tr> 96 </tr>
105 </tbody> 97 </tbody>
106 </table> 98 </table>
107 99
108 <form name="formCliente"> 100 <form name="formCliente">
109 <uib-tabset class="tabs-right" ng-show="ingreso"> 101 <uib-tabset class="tabs-right" ng-show="ingreso">
110 <uib-tab heading="Datos cliente"> 102 <uib-tab heading="Datos cliente">
111 <div class="row"> 103 <div class="row">
112 <div class="col-3"> 104 <div class="col-3">
113 <label>Código</label> 105 <label>Código</label>
114 <input 106 <input
115 type="text" 107 type="text"
116 class="form-control form-control-sm" 108 class="form-control form-control-sm"
117 ng-model="cliente.codigo" 109 ng-model="cliente.codigo"
118 readonly 110 readonly
119 /> 111 />
120 </div> 112 </div>
121 <div class="col-9"> 113 <div class="col-9">
122 <label>Nombre</label> 114 <label>Nombre</label>
123 <input 115 <input
124 type="text" 116 type="text"
125 class="form-control form-control-sm" 117 class="form-control form-control-sm"
126 ng-model="cliente.NOM" 118 ng-model="cliente.NOM"
127 teclado-virtual 119 teclado-virtual
128 placeholder="Ingrese nombre" 120 placeholder="Ingrese nombre"
129 ng-required="true" 121 ng-required="true"
130 foca-focus="focused == 1 || ingreso" 122 foca-focus="focused == 1 || ingreso"
131 ng-focus="focus(1)" 123 ng-focus="focus(1)"
132 ng-keypress="next($event.keyCode)" 124 ng-keypress="next($event.keyCode)"
133 /> 125 />
134 </div> 126 </div>
135 </div> 127 </div>
136 <div class="row"> 128 <div class="row">
137 <div class="col-md-9 col-12"> 129 <div class="col-md-9 col-12">
138 <label>Domicilio</label> 130 <label>Domicilio</label>
139 <input 131 <input
140 type="text" 132 type="text"
141 class="form-control form-control-sm" 133 class="form-control form-control-sm"
142 ng-model="cliente.DOM" 134 ng-model="cliente.DOM"
143 teclado-virtual 135 teclado-virtual
144 placeholder="Ingrese domicilio" 136 placeholder="Ingrese domicilio"
145 ng-required="true" 137 ng-required="true"
146 ng-focus="focus(2)" 138 ng-focus="focus(2)"
147 foca-focus="focused == 2" 139 foca-focus="focused == 2"
148 ng-keypress="next($event.keyCode)" 140 ng-keypress="next($event.keyCode)"
149 /> 141 />
150 </div> 142 </div>
151 <div class="col-md-3 col-12"> 143 <div class="col-md-3 col-12">
152 <label>Código postal</label> 144 <label>Código postal</label>
153 <input 145 <input
154 type="text" 146 type="text"
155 class="form-control form-control-sm" 147 class="form-control form-control-sm"
156 ng-model="cliente.CPO" 148 ng-model="cliente.CPO"
157 placeholder="Ingrese CP" 149 placeholder="Ingrese CP"
158 ng-required="true" 150 ng-required="true"
159 ng-focus="focus(3)" 151 ng-focus="focus(3)"
160 foca-focus="focused == 3" 152 foca-focus="focused == 3"
161 ng-keypress="next($event.keyCode)" 153 ng-keypress="next($event.keyCode)"
162 teclado-virtual 154 teclado-virtual
163 /> 155 />
164 </div> 156 </div>
165 </div> 157 </div>
166 <div class="row"> 158 <div class="row">
167 <div class="col-md-6 col-12"> 159 <div class="col-md-6 col-12">
168 <label>Provincia</label> 160 <label>Provincia</label>
169 <div class="input-group"> 161 <div class="input-group">
170 <input 162 <input
171 type="text" 163 type="text"
172 class="form-control form-control-sm" 164 class="form-control form-control-sm"
173 ng-model="cliente.provincia.NOMBRE" 165 ng-model="cliente.provincia.NOMBRE"
174 ng-keypress="seleccionarProvincia($event.keyCode)" 166 ng-keypress="seleccionarProvincia($event.keyCode)"
175 placeholder="Seleccione provincia" 167 placeholder="Seleccione provincia"
176 ng-required="true" 168 ng-required="true"
177 ng-focus="focus(4)" 169 ng-focus="focus(4)"
178 foca-focus="focused == 4" 170 foca-focus="focused == 4"
179 teclado-virtual 171 teclado-virtual
180 /> 172 />
181 <div class="input-group-append"> 173 <div class="input-group-append">
182 <button 174 <button
183 ladda="searchLoading" 175 ladda="searchLoading"
184 class="btn btn-outline-secondary" 176 class="btn btn-outline-secondary"
185 type="button" 177 type="button"
186 ng-click="seleccionarProvincia(13)" 178 ng-click="seleccionarProvincia(13)"
187 > 179 >
188 <i class="fa fa-search" aria-hidden="true"></i> 180 <i class="fa fa-search" aria-hidden="true"></i>
189 </button> 181 </button>
190 </div> 182 </div>
191 </div> 183 </div>
192 </div> 184 </div>
193 <div class="col-md-6 col-12"> 185 <div class="col-md-6 col-12">
194 <label>Localidad</label> 186 <label>Localidad</label>
195 <div class="input-group"> 187 <div class="input-group">
196 <input 188 <input
197 type="text" 189 type="text"
198 class="form-control form-control-sm" 190 class="form-control form-control-sm"
199 ng-model="cliente.localidad.NOMBRE" 191 ng-model="cliente.localidad.NOMBRE"
200 ng-keypress="seleccionarLocalidad($event.keyCode)" 192 ng-keypress="seleccionarLocalidad($event.keyCode)"
201 placeholder="Seleccione localidad" 193 placeholder="Seleccione localidad"
202 ng-required="true" 194 ng-required="true"
203 foca-focus="focused == 5" 195 foca-focus="focused == 5"
204 ng-focus="focus(5)" 196 ng-focus="focus(5)"
205 teclado-virtual 197 teclado-virtual
206 /> 198 />
207 <div class="input-group-append"> 199 <div class="input-group-append">
208 <button 200 <button
209 ladda="searchLoading" 201 ladda="searchLoading"
210 class="btn btn-outline-secondary" 202 class="btn btn-outline-secondary"
211 type="button" 203 type="button"
212 ng-click="seleccionarLocalidad(13)" 204 ng-click="seleccionarLocalidad(13)"
213 > 205 >
214 <i class="fa fa-search" aria-hidden="true"></i> 206 <i class="fa fa-search" aria-hidden="true"></i>
215 </button> 207 </button>
216 </div> 208 </div>
217 </div> 209 </div>
218 </div> 210 </div>
219 </div> 211 </div>
220 <div class="row"> 212 <div class="row">
221 <div class="col-md-6 col-12"> 213 <div class="col-md-6 col-12">
222 <label>Zona</label> 214 <label>Zona</label>
223 <div class="input-group"> 215 <div class="input-group">
224 <input 216 <input
225 type="text" 217 type="text"
226 class="form-control form-control-sm" 218 class="form-control form-control-sm"
227 ng-model="cliente.zona.NOM" 219 ng-model="cliente.zona.NOM"
228 ng-keypress="seleccionarZona($event.keyCode)" 220 ng-keypress="seleccionarZona($event.keyCode)"
229 placeholder="Seleccione zona" 221 placeholder="Seleccione zona"
230 ng-required="true" 222 ng-required="true"
231 ng-focus="focus(6)" 223 ng-focus="focus(6)"
232 foca-focus="focused == 6" 224 foca-focus="focused == 6"
233 teclado-virtual 225 teclado-virtual
234 /> 226 />
235 <div class="input-group-append"> 227 <div class="input-group-append">
236 <button 228 <button
237 ladda="searchLoading" 229 ladda="searchLoading"
238 class="btn btn-outline-secondary" 230 class="btn btn-outline-secondary"
239 type="button" 231 type="button"
240 ng-click="seleccionarZona(13)" 232 ng-click="seleccionarZona(13)"
241 > 233 >
242 <i class="fa fa-search" aria-hidden="true"></i> 234 <i class="fa fa-search" aria-hidden="true"></i>
243 </button> 235 </button>
244 </div> 236 </div>
245 </div> 237 </div>
246 </div> 238 </div>
247 <div class="col-md-6 col-12"> 239 <div class="col-md-6 col-12">
248 <label> Actividad </label> 240 <label> Actividad </label>
249 <div class="input-group"> 241 <div class="input-group">
250 <input 242 <input
251 type="text" 243 type="text"
252 class="form-control form-control-sm" 244 class="form-control form-control-sm"
253 ng-model="cliente.actividad.NOM" 245 ng-model="cliente.actividad.NOM"
254 ng-keypress="seleccionarActividad($event.keyCode)" 246 ng-keypress="seleccionarActividad($event.keyCode)"
255 placeholder="Seleccione actividad" 247 placeholder="Seleccione actividad"
256 ng-required="true" 248 ng-required="true"
257 ng-focus="focus(7)" 249 ng-focus="focus(7)"
258 foca-focus="focused == 7" 250 foca-focus="focused == 7"
259 teclado-virtual 251 teclado-virtual
260 /> 252 />
261 <div class="input-group-append"> 253 <div class="input-group-append">
262 <button 254 <button
263 ladda="searchLoading" 255 ladda="searchLoading"
264 class="btn btn-outline-secondary" 256 class="btn btn-outline-secondary"
265 type="button" 257 type="button"
266 ng-click="seleccionarActividad(13)" 258 ng-click="seleccionarActividad(13)"
267 > 259 >
268 <i class="fa fa-search" aria-hidden="true"></i> 260 <i class="fa fa-search" aria-hidden="true"></i>
269 </button> 261 </button>
270 </div> 262 </div>
271 </div> 263 </div>
272 </div> 264 </div>
273 </div> 265 </div>
274 <div class="row"> 266 <div class="row">
275 <div class="col-md-6 col-12"> 267 <div class="col-md-6 col-12">
276 <label>Cobrador</label> 268 <label>Cobrador</label>
277 <div class="input-group"> 269 <div class="input-group">
278 <input 270 <input
279 type="text" 271 type="text"
280 class="form-control form-control-sm" 272 class="form-control form-control-sm"
281 ng-model="cliente.cobrador.NOM" 273 ng-model="cliente.cobrador.NOM"
282 ng-keypress="seleccionarCobrador($event.keyCode)" 274 ng-keypress="seleccionarCobrador($event.keyCode)"
283 placeholder="Seleccione cobrador" 275 placeholder="Seleccione cobrador"
284 ng-focus="focus(8)" 276 ng-focus="focus(8)"
285 foca-focus="focused == 8" 277 foca-focus="focused == 8"
286 teclado-virtual 278 teclado-virtual
287 /> 279 />
288 <div class="input-group-append"> 280 <div class="input-group-append">
289 <button 281 <button
290 ladda="searchLoading" 282 ladda="searchLoading"
291 class="btn btn-outline-secondary" 283 class="btn btn-outline-secondary"
292 type="button" 284 type="button"
293 ng-click="seleccionarCobrador(13)" 285 ng-click="seleccionarCobrador(13)"
294 > 286 >
295 <i class="fa fa-search" aria-hidden="true"></i> 287 <i class="fa fa-search" aria-hidden="true"></i>
296 </button> 288 </button>
297 </div> 289 </div>
298 </div> 290 </div>
299 </div> 291 </div>
300 <div class="col-md-6 col-12"> 292 <div class="col-md-6 col-12">
301 <label>Vendedor</label> 293 <label>Vendedor</label>
302 <div class="input-group"> 294 <div class="input-group">
303 <input 295 <input
304 type="text" 296 type="text"
305 class="form-control form-control-sm" 297 class="form-control form-control-sm"
306 ng-model="vendedor.NOM" 298 ng-model="vendedor.NOM"
307 disabled="true" 299 disabled="true"
308 /> 300 />
309 </div> 301 </div>
310 </div> 302 </div>
311 <div class="col-md-6 col-12"> 303 <div class="col-md-6 col-12">
312 <label>Email</label> 304 <label>Email</label>
313 <div class="input-group"> 305 <div class="input-group">
314 <input 306 <input
315 type="text" 307 type="text"
316 class="form-control form-control-sm" 308 class="form-control form-control-sm"
317 placeholder="Ingrese Email" 309 placeholder="Ingrese Email"
318 ng-model="cliente.MAIL" 310 ng-model="cliente.MAIL"
319 ng-required="true" 311 ng-required="true"
320 ng-keypress="next($event.keyCode)" 312 ng-keypress="next($event.keyCode)"
321 ng-focus="focus(10)" 313 ng-focus="focus(10)"
322 foca-focus="focused == 10" 314 foca-focus="focused == 10"
323 teclado-virtual> 315 teclado-virtual>
324 </div> 316 </div>
325 </div> 317 </div>
326 <div class="col-md-6 col-12"> 318 <div class="col-md-6 col-12">
327 <label>Telefono</label> 319 <label>Telefono</label>
328 <div class="input-group"> 320 <div class="input-group">
329 <input 321 <input
330 foca-tipo-input 322 foca-tipo-input
331 limite-numeros-max="20" 323 limite-numeros-max="20"
332 class="form-control form-control-sm" 324 class="form-control form-control-sm"
333 placeholder="Ingrese Telefono" 325 placeholder="Ingrese Telefono"
334 ng-model="cliente.TEL" 326 ng-model="cliente.TEL"
335 ng-required="true" 327 ng-required="true"
336 ng-keypress="next($event.keyCode)" 328 ng-keypress="next($event.keyCode)"
337 ng-focus="focus(11)" 329 ng-focus="focus(11)"
338 foca-focus="focused == 11" 330 foca-focus="focused == 11"
339 teclado-virtual> 331 teclado-virtual>
340 </div> 332 </div>
341 </div> 333 </div>
342 </div> 334 </div>
343 <div class="row"> 335 <div class="row">
344 <div class="col-6 d-flex"> 336 <div class="col-6 d-flex">
345 <div class="custom-control custom-checkbox mt-auto"> 337 <div class="custom-control custom-checkbox mt-auto">
346 <input 338 <input
347 type="checkbox" 339 type="checkbox"
348 class="custom-control-input" 340 class="custom-control-input"
349 id="checkDistribuidor" 341 id="checkDistribuidor"
350 ng-model="cliente.ES_MAY" 342 ng-model="cliente.ES_MAY"
351 checked 343 checked
352 disabled="disabled"> 344 disabled="disabled">
353 <label class="custom-control-label" for="checkDistribuidor">¿Este cliente es distribuidor?</label> 345 <label class="custom-control-label" for="checkDistribuidor">¿Este cliente es distribuidor?</label>
354 </div> 346 </div>
355 </div> 347 </div>
356 </div> 348 </div>
357 </uib-tab> 349 </uib-tab>
358 <uib-tab heading="Datos impositivos"> 350 <uib-tab heading="Datos impositivos">
359 <div class="row"> 351 <div class="row">
360 <div class="col-md-7 col-12"> 352 <div class="col-md-7 col-12">
361 <label>Responsabilidad ante el IVA</label> 353 <label>Responsabilidad ante el IVA</label>
362 <div class="input-group"> 354 <div class="input-group">
363 <input 355 <input
364 type="text" 356 type="text"
365 class="form-control form-control-sm" 357 class="form-control form-control-sm"
366 placeholder="Seleccione responsabilidad ante el IVA" 358 placeholder="Seleccione responsabilidad ante el IVA"
367 ng-model="cliente.iva.NOMBRE" 359 ng-model="cliente.iva.NOMBRE"
368 ng-keypress="seleccionarIva($event.keyCode)" 360 ng-keypress="seleccionarIva($event.keyCode)"
369 ng-required="true" 361 ng-required="true"
370 ng-focus="focus(12)" 362 ng-focus="focus(12)"
371 foca-focus="focused == 12" 363 foca-focus="focused == 12"
372 teclado-virtual 364 teclado-virtual
373 /> 365 />
374 <div class="input-group-append"> 366 <div class="input-group-append">
375 <button 367 <button
376 ladda="searchLoading" 368 ladda="searchLoading"
377 class="btn btn-outline-secondary" 369 class="btn btn-outline-secondary"
378 type="button" 370 type="button"
379 ng-click="seleccionarIva(13)" 371 ng-click="seleccionarIva(13)"
380 > 372 >
381 <i class="fa fa-search" aria-hidden="true"></i> 373 <i class="fa fa-search" aria-hidden="true"></i>
382 </button> 374 </button>
383 </div> 375 </div>
384 </div> 376 </div>
385 </div> 377 </div>
386 <div class="col-md-5 col-12"> 378 <div class="col-md-5 col-12">
387 <label>Factura que emite</label> 379 <label>Factura que emite</label>
388 <div class="input-group"> 380 <div class="input-group">
389 <input 381 <input
390 type="text" 382 type="text"
391 class="form-control form-control-sm" 383 class="form-control form-control-sm"
392 placeholder="Seleccione factura que emite" 384 placeholder="Seleccione factura que emite"
393 ng-model="cliente.tipoFactura.NOMBRE" 385 ng-model="cliente.tipoFactura.NOMBRE"
394 ng-required="true" 386 ng-required="true"
395 ng-keypress="seleccionarTipoFactura(13)" 387 ng-keypress="seleccionarTipoFactura(13)"
396 ng-focus="focus(13)" 388 ng-focus="focus(13)"
397 foca-focus="focused == 13" 389 foca-focus="focused == 13"
398 teclado-virtual> 390 teclado-virtual>
399 <div class="input-group-append"> 391 <div class="input-group-append">
400 <button 392 <button
401 ladda="searchLoading" 393 ladda="searchLoading"
402 class="btn btn-outline-secondary" 394 class="btn btn-outline-secondary"
403 type="button" 395 type="button"
404 ng-click="seleccionarTipoFactura(13)" 396 ng-click="seleccionarTipoFactura(13)"
405 > 397 >
406 <i class="fa fa-search" aria-hidden="true"></i> 398 <i class="fa fa-search" aria-hidden="true"></i>
407 </button> 399 </button>
408 </div> 400 </div>
409 </div> 401 </div>
410 </div> 402 </div>
411 </div> 403 </div>
412 404
413 <div class="row"> 405 <div class="row">
414 <div class= "col-md-4 col-12"> 406 <div class= "col-md-4 col-12">
415 <label>CUIT</label> 407 <label>CUIT</label>
416 <div class="d-flex"> 408 <div class="d-flex">
417 <input 409 <input
418 type="text" 410 type="text"
419 class="form-control form-control-sm col-2" 411 class="form-control form-control-sm col-2"
420 limite-numeros-max="2" 412 limite-numeros-max="2"
421 ng-model="cliente.cuit1" 413 ng-model="cliente.cuit1"
422 ng-required="true" 414 ng-required="true"
423 ng-keypress="pasarCampoCuit(1)" 415 ng-keypress="pasarCampoCuit(1)"
424 ng-focus="focus(14)" 416 ng-focus="focus(14)"
425 foca-focus="focused == 14" 417 foca-focus="focused == 14"
426 teclado-virtual 418 teclado-virtual
427 > 419 >
428 <span class="m-1"> - </span> 420 <span class="m-1"> - </span>
429 <input 421 <input
430 type="text" 422 type="text"
431 class="form-control form-control-sm col-5" 423 class="form-control form-control-sm col-5"
432 maxlength="8" 424 maxlength="8"
433 limite-numeros-max="8" 425 limite-numeros-max="8"
434 ng-keypress="pasarCampoCuit(2)" 426 ng-keypress="pasarCampoCuit(2)"
435 ng-model="cliente.cuit2" 427 ng-model="cliente.cuit2"
436 ng-required="true" 428 ng-required="true"
437 ng-focus="focus(15)" 429 ng-focus="focus(15)"
438 foca-focus="cuitActivo == 2 || focused == 15" 430 foca-focus="cuitActivo == 2 || focused == 15"
439 teclado-virtual 431 teclado-virtual
440 > 432 >
441 <span class="m-1"> - </span> 433 <span class="m-1"> - </span>
442 <input 434 <input
443 type="text" 435 type="text"
444 class="form-control form-control-sm col-2" 436 class="form-control form-control-sm col-2"
445 maxlength="1" 437 maxlength="1"
446 limite-numeros-max="1" 438 limite-numeros-max="1"
447 ng-keypress="pasarCampoCuit(3)" 439 ng-keypress="pasarCampoCuit(3)"
448 ng-model="cliente.cuit3" 440 ng-model="cliente.cuit3"
449 ng-required="true" 441 ng-required="true"
450 ng-focus="focus(16)" 442 ng-focus="focus(16)"
451 foca-focus="cuitActivo == 3 || focused == 16" 443 foca-focus="cuitActivo == 3 || focused == 16"
452 teclado-virtual 444 teclado-virtual
453 > 445 >
454 </div> 446 </div>
455 </div> 447 </div>
456 <div class="col-md-4 col-12"> 448 <div class="col-md-4 col-12">
457 <label>Clase de comprobante</label> 449 <label>Clase de comprobante</label>
458 <div class="input-group"> 450 <div class="input-group">
459 <input 451 <input
460 type="text" 452 type="text"
461 class="form-control form-control-sm" 453 class="form-control form-control-sm"
462 placeholder="Seleccione clase de comprobante" 454 placeholder="Seleccione clase de comprobante"
463 ng-keypress="seleccionarTipoComprobante($event.keyCode)" 455 ng-keypress="seleccionarTipoComprobante($event.keyCode)"
464 ng-model="cliente.tipoComprobante.NOMBRE" 456 ng-model="cliente.tipoComprobante.NOMBRE"
465 ng-required="true" 457 ng-required="true"
466 ng-focus="focus(17)" 458 ng-focus="focus(17)"
467 foca-focus="focused == 17" 459 foca-focus="focused == 17"
468 teclado-virtual> 460 teclado-virtual>
469 <div class="input-group-append"> 461 <div class="input-group-append">
470 <button 462 <button
471 ladda="searchLoading" 463 ladda="searchLoading"
472 class="btn btn-outline-secondary" 464 class="btn btn-outline-secondary"
473 type="button" 465 type="button"
474 ng-click="seleccionarTipoComprobante(13)" 466 ng-click="seleccionarTipoComprobante(13)"
475 > 467 >
476 <i class="fa fa-search" aria-hidden="true"></i> 468 <i class="fa fa-search" aria-hidden="true"></i>
477 </button> 469 </button>
478 </div> 470 </div>
479 </div> 471 </div>
480 </div> 472 </div>
481 <div class="col-md-4 col-12"> 473 <div class="col-md-4 col-12">
482 <label>Forma de pago</label> 474 <label>Forma de pago</label>
483 <div class="input-group"> 475 <div class="input-group">
484 <input 476 <input
485 type="text" 477 type="text"
486 class="form-control form-control-sm" 478 class="form-control form-control-sm"
487 placeholder="Seleccione forma de pago" 479 placeholder="Seleccione forma de pago"
488 ng-model="cliente.formaPago.NOMBRE" 480 ng-model="cliente.formaPago.NOMBRE"
489 ng-required="true" 481 ng-required="true"
490 ng-keypress="seleccionarFormaPago($event.keyCode)" 482 ng-keypress="seleccionarFormaPago($event.keyCode)"
491 ng-focus="focus(18)" 483 ng-focus="focus(18)"
492 foca-focus="focused == 18" 484 foca-focus="focused == 18"
493 teclado-virtual> 485 teclado-virtual>
494 <div class="input-group-append"> 486 <div class="input-group-append">
495 <button 487 <button
496 ladda="searchLoading" 488 ladda="searchLoading"
497 class="btn btn-outline-secondary" 489 class="btn btn-outline-secondary"
498 type="button" 490 type="button"
499 ng-click="seleccionarFormaPago(13)" 491 ng-click="seleccionarFormaPago(13)"
500 > 492 >
501 <i class="fa fa-search" aria-hidden="true"></i> 493 <i class="fa fa-search" aria-hidden="true"></i>
502 </button> 494 </button>
503 </div> 495 </div>
504 </div> 496 </div>
505 </div> 497 </div>
506 </div> 498 </div>
507 </uib-tab> 499 </uib-tab>
508 </uib-tabset> 500 </uib-tabset>
509 </form> 501 </form>
510 </div> 502 </div>
511 <div class="modal-footer py-1"> 503 <div class="modal-footer py-1">
512 <nav ng-show="currentPageClientes.length > 0 && primerBusqueda && !ingreso" class="mr-auto"> 504 <nav ng-show="currentPageClientes.length > 0 && primerBusqueda && !ingreso" class="mr-auto">
513 <ul class="pagination pagination-sm mb-0"> 505 <ul class="pagination pagination-sm mb-0">
514 <li class="page-item" ng-class="{'disabled': currentPage == 1}"> 506 <li class="page-item" ng-class="{'disabled': currentPage == 1}">
515 <a class="page-link" href="javascript:void()" ng-click="selectPage(currentPage - 1)"> 507 <a class="page-link" href="javascript:void()" ng-click="selectPage(currentPage - 1)">
516 <span aria-hidden="true">&laquo;</span> 508 <span aria-hidden="true">&laquo;</span>
517 <span class="sr-only">Anterior</span> 509 <span class="sr-only">Anterior</span>
518 </a> 510 </a>
519 </li> 511 </li>
520 <li 512 <li
521 class="page-item" 513 class="page-item"
522 ng-repeat="pagina in paginas" 514 ng-repeat="pagina in paginas"
523 ng-class="{'active': pagina == currentPage}" 515 ng-class="{'active': pagina == currentPage}"
524 > 516 >
525 <a 517 <a
526 class="page-link" 518 class="page-link"
527 href="javascript:void()" 519 href="javascript:void()"
528 ng-click="selectPage(pagina)" 520 ng-click="selectPage(pagina)"
529 ng-bind="pagina" 521 ng-bind="pagina"
530 ></a> 522 ></a>
531 </li> 523 </li>
532 <li class="page-item" ng-class="{'disabled': currentPage == lastPage}"> 524 <li class="page-item" ng-class="{'disabled': currentPage == lastPage}">
533 <a class="page-link" href="javascript:void()" ng-click="selectPage(currentPage + 1)"> 525 <a class="page-link" href="javascript:void()" ng-click="selectPage(currentPage + 1)">
534 <span aria-hidden="true">&raquo;</span> 526 <span aria-hidden="true">&raquo;</span>
535 <span class="sr-only">Siguiente</span> 527 <span class="sr-only">Siguiente</span>
536 </a> 528 </a>
537 </li> 529 </li>
538 </ul> 530 </ul>
539 </nav> 531 </nav>
540 <button class="btn btn-sm btn-secondary" type="button" ng-click="cancel()">Cancelar</button> 532 <button class="btn btn-sm btn-secondary" type="button" ng-click="cancel()">Cancelar</button>
541 <button 533 <button
542 class="btn btn-sm btn-primary" 534 class="btn btn-sm btn-primary"
543 type="button" 535 type="button"
544 ng-show="ingreso" 536 ng-show="ingreso"
545 ng-click="guardar()" 537 ng-click="guardar()"
546 >Guardar</button> 538 >Guardar</button>
547 </div> 539 </div>
548 540