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