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