Commit 9265e9b918337360c43d852411551237588310d5
Exists in
master
Merge branch 'master' of git.focasoftware.com:npm/foca-busqueda-cliente
Showing
7 changed files
Show diff stats
.jshintrc
gulpfile.js
... | ... | @@ -44,7 +44,6 @@ gulp.task('uglify', ['templates'], function() { |
44 | 44 | 'tmp/views.js' |
45 | 45 | ]), |
46 | 46 | concat('foca-busqueda-cliente.js'), |
47 | - replace("['ui.bootstrap', 'focaDirectivas', 'angular-ladda']", '[]'), | |
48 | 47 | replace('src/views/', ''), |
49 | 48 | gulp.dest(paths.tmp), |
50 | 49 | rename('foca-busqueda-cliente.min.js'), |
package.json
... | ... | @@ -2,13 +2,17 @@ |
2 | 2 | "name": "foca-busqueda-cliente", |
3 | 3 | "version": "1.0.0", |
4 | 4 | "description": "Búsqueda de clientes", |
5 | - "main": "dist/foca-abm-sectores.js", | |
5 | + "main": "dist/foca-busqueda-cliente.min.js", | |
6 | 6 | "scripts": { |
7 | 7 | "test": "echo \"Error: no test specified\" && exit 1", |
8 | + "gulp-pre-commit": "gulp pre-commit", | |
8 | 9 | "compile": "gulp uglify", |
9 | 10 | "postinstall": "npm run compile && gulp clean-post-install", |
10 | 11 | "install-dev": "npm install -D angular bootstrap angular-ladda ladda@1.0.6 angular-ui-bootstrap ui-bootstrap4 font-awesome jquery pre-commit jshint pump jasmine-core gulp gulp-connect gulp-angular-templatecache gulp-concat gulp-htmlmin gulp-jshint gulp-rename gulp-replace gulp-uglify-es gulp-clean gulp-uglify git+http://git.focasoftware.com/npm/foca-directivas.git" |
11 | 12 | }, |
13 | + "pre-commit": [ | |
14 | + "gulp-pre-commit" | |
15 | + ], | |
12 | 16 | "repository": { |
13 | 17 | "type": "git", |
14 | 18 | "url": "http://git.focasoftware.com/npm/foca-busqueda-cliente.git" |
... | ... | @@ -30,29 +34,29 @@ |
30 | 34 | "pump": "^3.0.x" |
31 | 35 | }, |
32 | 36 | "devDependencies": { |
33 | - "angular": "^1.7.4", | |
37 | + "angular": "^1.7.6", | |
34 | 38 | "angular-ladda": "^0.4.3", |
35 | 39 | "angular-ui-bootstrap": "^2.5.6", |
36 | - "bootstrap": "^4.1.3", | |
40 | + "bootstrap": "^4.2.1", | |
37 | 41 | "foca-directivas": "git+http://git.focasoftware.com/npm/foca-directivas.git", |
38 | 42 | "font-awesome": "^4.7.0", |
39 | 43 | "gulp": "^3.9.1", |
40 | - "gulp-angular-templatecache": "^2.2.1", | |
44 | + "gulp-angular-templatecache": "^2.2.6", | |
41 | 45 | "gulp-clean": "^0.4.0", |
42 | 46 | "gulp-concat": "^2.6.1", |
43 | - "gulp-connect": "^5.6.1", | |
47 | + "gulp-connect": "^5.7.0", | |
44 | 48 | "gulp-htmlmin": "^5.0.1", |
45 | 49 | "gulp-jshint": "^2.1.0", |
46 | 50 | "gulp-rename": "^1.4.0", |
47 | 51 | "gulp-replace": "^1.0.0", |
48 | 52 | "gulp-uglify": "^3.0.1", |
49 | 53 | "gulp-uglify-es": "^1.0.4", |
50 | - "jasmine-core": "^3.2.1", | |
54 | + "jasmine-core": "^3.3.0", | |
51 | 55 | "jquery": "^3.3.1", |
52 | - "jshint": "^2.9.6", | |
53 | - "ladda": "1.0.6", | |
56 | + "jshint": "^2.9.7", | |
57 | + "ladda": "^1.0.6", | |
54 | 58 | "pre-commit": "^1.2.2", |
55 | 59 | "pump": "^3.0.0", |
56 | - "ui-bootstrap4": "^3.0.5" | |
60 | + "ui-bootstrap4": "^3.0.6" | |
57 | 61 | } |
58 | 62 | } |
src/js/app.js
src/js/controller.js
1 | 1 | angular.module('focaBusquedaCliente') |
2 | 2 | .controller('focaBusquedaClienteModalController', [ |
3 | 3 | '$uibModalInstance', 'focaBusquedaClienteService', '$scope', '$filter', |
4 | - '$uibModal', 'focaModalService', | |
4 | + '$uibModal', 'focaModalService', '$timeout', 'vendedor', | |
5 | 5 | function($uibModalInstance, focaBusquedaClienteService, $scope, $filter, |
6 | - $uibModal, focaModalService) { | |
6 | + $uibModal, focaModalService, $timeout, vendedor) { | |
7 | 7 | |
8 | + $scope.vendedor = vendedor ? vendedor : {}; | |
8 | 9 | $scope.filters = ''; |
9 | 10 | $scope.primerBusqueda = false; |
10 | 11 | // pagination |
... | ... | @@ -14,6 +15,8 @@ angular.module('focaBusquedaCliente') |
14 | 15 | $scope.currentPageClientes = []; |
15 | 16 | $scope.selectedClientes = -1; |
16 | 17 | $scope.ingreso = false; |
18 | + $scope.regexCuit = new RegExp(/\b(20|23|24|27|30|33|34)(\D)?[0-9]{8}(\D)?[0-9]/g); | |
19 | + $scope.focused = 1; | |
17 | 20 | |
18 | 21 | $scope.cliente = { |
19 | 22 | COD: 0, |
... | ... | @@ -41,19 +44,27 @@ angular.module('focaBusquedaCliente') |
41 | 44 | }, |
42 | 45 | formaPago: { |
43 | 46 | NOMBRE: '' |
47 | + }, | |
48 | + cobrador: { | |
49 | + NomVen: '' | |
44 | 50 | } |
45 | 51 | }; |
46 | 52 | |
47 | 53 | $scope.busquedaPress = function(key) { |
48 | 54 | if (key === 13) { |
55 | + var funcion = ($scope.vendedor.CodVen) ? | |
56 | + 'obtenerClientesPorNombreOCuitByVendedor' : 'obtenerClientesPorNombreOCuit'; | |
57 | + | |
49 | 58 | $scope.searchLoading = true; |
50 | - focaBusquedaClienteService.obtenerClientesPorNombreOCuit($scope.filters).then( | |
51 | - function(res) { | |
52 | - $scope.primerBusqueda = true; | |
53 | - $scope.clientes = res.data; | |
54 | - $scope.search(true); | |
55 | - primera(); | |
56 | - $scope.searchLoading = false; | |
59 | + focaBusquedaClienteService | |
60 | + [funcion]($scope.filters, $scope.vendedor.CodVen) | |
61 | + .then( | |
62 | + function(res) { | |
63 | + $scope.primerBusqueda = true; | |
64 | + $scope.clientes = res.data; | |
65 | + $scope.search(true); | |
66 | + primera(); | |
67 | + $scope.searchLoading = false; | |
57 | 68 | }); |
58 | 69 | } |
59 | 70 | }; |
... | ... | @@ -130,22 +141,39 @@ angular.module('focaBusquedaCliente') |
130 | 141 | } |
131 | 142 | }; |
132 | 143 | |
144 | + $scope.focus = function(val) { | |
145 | + $scope.focused = val; | |
146 | + }; | |
147 | + | |
148 | + $scope.next = function(key) { | |
149 | + if (key === 13) $scope.focused++; | |
150 | + }; | |
151 | + | |
133 | 152 | $scope.seleccionarProvincia = function(key) { |
134 | 153 | if(key === 13) { |
135 | - var modalInstance = $uibModal.open( | |
136 | - { | |
137 | - ariaLabelledBy: 'Búsqueda de provincias', | |
138 | - templateUrl: 'modal-provincias.html', | |
139 | - controller: 'focaModalProvinciaController', | |
140 | - size: 'md', | |
141 | - resolve: {filters: function() { | |
142 | - return $scope.cliente.provincia; | |
143 | - }} | |
144 | - } | |
145 | - ); | |
146 | - modalInstance.result.then(function(provincia) { | |
154 | + var parametrosModal = { | |
155 | + query: '/provincia', | |
156 | + columnas: [ | |
157 | + { | |
158 | + propiedad: 'ID', | |
159 | + nombre: 'Codigo', | |
160 | + filtro: { | |
161 | + nombre: 'rellenarDigitos', | |
162 | + parametro: 3} | |
163 | + }, | |
164 | + { | |
165 | + propiedad: 'NOMBRE', | |
166 | + nombre: 'Nombre' | |
167 | + } | |
168 | + ], | |
169 | + titulo:'Búsqueda de provincias', | |
170 | + size: 'md' | |
171 | + }; | |
172 | + focaModalService.modal(parametrosModal).then(function(provincia) { | |
147 | 173 | $scope.cliente.provincia = provincia; |
148 | - $scope.focused = 3; | |
174 | + $timeout(function() { | |
175 | + $scope.focused = 5; | |
176 | + }); | |
149 | 177 | }, function() { |
150 | 178 | //TODO: función llamada cuando cancela el modal |
151 | 179 | }); |
... | ... | @@ -153,28 +181,34 @@ angular.module('focaBusquedaCliente') |
153 | 181 | }; |
154 | 182 | $scope.seleccionarLocalidad = function(key) { |
155 | 183 | if($scope.cliente.provincia.ID === undefined) { |
156 | - //TODO: Poner modal alert de foca | |
157 | - alert('Seleccione una provincia'); | |
184 | + focaModalService.alert('Seleccione una provincia'); | |
158 | 185 | return; |
159 | 186 | } |
160 | 187 | if(key === 13) { |
161 | - var modalInstance = $uibModal.open( | |
162 | - { | |
163 | - ariaLabelledBy: 'Búsqueda de localidades', | |
164 | - templateUrl: 'modal-localidades.html', | |
165 | - controller: 'focaModalLocalidadController', | |
166 | - size: 'md', | |
167 | - resolve: { | |
168 | - filters: { | |
169 | - idProvincia: $scope.cliente.provincia.ID, | |
170 | - busqueda: $scope.cliente.localidad.nombre | |
188 | + var parametrosModal = { | |
189 | + query: '/localidad/' + $scope.cliente.provincia.ID, | |
190 | + columnas: [ | |
191 | + { | |
192 | + propiedad: 'ID', | |
193 | + nombre: 'Código', | |
194 | + filtro: { | |
195 | + nombre: 'rellenarDigitos', | |
196 | + parametro: 3 | |
171 | 197 | } |
198 | + }, | |
199 | + { | |
200 | + propiedad: 'NOMBRE', | |
201 | + nombre: 'Nombre' | |
172 | 202 | } |
173 | - } | |
174 | - ); | |
175 | - modalInstance.result.then(function(localidad) { | |
203 | + ], | |
204 | + titulo:'Búsqueda de localidades', | |
205 | + size: 'md' | |
206 | + }; | |
207 | + focaModalService.modal(parametrosModal).then(function(localidad) { | |
176 | 208 | $scope.cliente.localidad = localidad; |
177 | - $scope.focused = 4; | |
209 | + $timeout(function() { | |
210 | + $scope.focused = 6; | |
211 | + }); | |
178 | 212 | }, function() { |
179 | 213 | //TODO: función llamada cuando cancela el modal |
180 | 214 | }); |
... | ... | @@ -182,129 +216,213 @@ angular.module('focaBusquedaCliente') |
182 | 216 | }; |
183 | 217 | $scope.seleccionarIva = function(key) { |
184 | 218 | if(key === 13) { |
185 | - var modalInstance = $uibModal.open( | |
186 | - { | |
187 | - ariaLabelledBy: 'Búsqueda de responsabilidad ante el IVA', | |
188 | - templateUrl: 'modal-iva.html', | |
189 | - controller: 'focaModalIvaController', | |
190 | - size: 'md', | |
191 | - resolve: {filters: function() { | |
192 | - return $scope.cliente.iva.NOMBRE; | |
193 | - }} | |
194 | - } | |
195 | - ); | |
196 | - modalInstance.result.then(function(iva) { | |
197 | - $scope.cliente.iva = iva; | |
198 | - }, function() { | |
199 | - //TODO: función llamada cuando cancela el modal | |
200 | - }); | |
219 | + var parametrosModal = { | |
220 | + query: '/iva', | |
221 | + columnas: [ | |
222 | + { | |
223 | + propiedad: 'ID', | |
224 | + nombre: 'Código', | |
225 | + filtro: { | |
226 | + nombre: 'rellenarDigitos', | |
227 | + parametro: 3 | |
228 | + } | |
229 | + }, | |
230 | + { | |
231 | + propiedad: 'NOMBRE', | |
232 | + nombre: 'Nombre' | |
233 | + } | |
234 | + ], | |
235 | + titulo:'Búsqueda de responsabilidad ante el IVA', | |
236 | + size: 'md' | |
237 | + }; | |
238 | + focaModalService.modal(parametrosModal).then( | |
239 | + function(iva) { | |
240 | + $scope.cliente.iva = iva; | |
241 | + $timeout(function() { | |
242 | + $scope.focused = 10; | |
243 | + }); | |
244 | + }, function() { | |
245 | + // funcion ejecutada cuando se cancela el modal | |
246 | + }); | |
201 | 247 | } |
202 | 248 | }; |
203 | 249 | $scope.seleccionarActividad = function(key) { |
204 | 250 | if(key === 13) { |
205 | - var modalInstance = $uibModal.open( | |
206 | - { | |
207 | - ariaLabelledBy: 'Búsqueda de actividades', | |
208 | - templateUrl: 'modal-actividad.html', | |
209 | - controller: 'focaModalActividadController', | |
210 | - size: 'md', | |
211 | - resolve: {filters: function() { | |
212 | - return $scope.cliente.actividad.NOM; | |
213 | - }} | |
214 | - } | |
215 | - ); | |
216 | - modalInstance.result.then(function(actividad) { | |
217 | - $scope.cliente.actividad = actividad; | |
218 | - }, function() { | |
219 | - //TODO: función llamada cuando cancela el modal | |
220 | - }); | |
251 | + var parametrosModal = { | |
252 | + query: '/actividad', | |
253 | + columnas: [ | |
254 | + { | |
255 | + propiedad: 'ID', | |
256 | + nombre: 'Código', | |
257 | + filtro: { | |
258 | + nombre: 'rellenarDigitos', | |
259 | + parametro: 3 | |
260 | + } | |
261 | + }, | |
262 | + { | |
263 | + propiedad: 'NOM', | |
264 | + nombre: 'Nombre' | |
265 | + } | |
266 | + ], | |
267 | + titulo: 'Búsqueda de actividades', | |
268 | + size: 'md' | |
269 | + }; | |
270 | + focaModalService.modal(parametrosModal).then( | |
271 | + function(actividad) { | |
272 | + $scope.cliente.actividad = actividad; | |
273 | + $timeout(function() { | |
274 | + $scope.focused = 8; | |
275 | + }); | |
276 | + }, function() { | |
277 | + // funcion ejecutada cuando se cancela el modal | |
278 | + }); | |
221 | 279 | } |
222 | 280 | }; |
223 | 281 | $scope.seleccionarZona = function(key) { |
224 | 282 | if(key === 13) { |
225 | - var modalInstance = $uibModal.open( | |
226 | - { | |
227 | - ariaLabelledBy: 'Búsqueda de zonas', | |
228 | - templateUrl: 'modal-zona.html', | |
229 | - controller: 'focaModalZonaController', | |
230 | - size: 'md', | |
231 | - resolve: {filters: function() { | |
232 | - return $scope.cliente.zona.NOM; | |
233 | - }} | |
234 | - } | |
235 | - ); | |
236 | - modalInstance.result.then(function(zona) { | |
237 | - $scope.cliente.zona = zona; | |
238 | - }, function() { | |
239 | - //TODO: función llamada cuando cancela el modal | |
240 | - }); | |
283 | + var parametrosModal = { | |
284 | + query: '/zona', | |
285 | + columnas: [ | |
286 | + { | |
287 | + propiedad: 'ID', | |
288 | + nombre: 'Código', | |
289 | + filtro: { | |
290 | + nombre: 'rellenarDigitos', | |
291 | + parametro: 3 | |
292 | + } | |
293 | + }, | |
294 | + { | |
295 | + propiedad: 'NOM', | |
296 | + nombre: 'Nombre' | |
297 | + } | |
298 | + ], | |
299 | + titulo: 'Búsqueda de zonas', | |
300 | + size: 'md' | |
301 | + }; | |
302 | + focaModalService.modal(parametrosModal).then( | |
303 | + function(zona) { | |
304 | + $scope.cliente.zona = zona; | |
305 | + $timeout(function() { | |
306 | + $scope.focused = 7; | |
307 | + }); | |
308 | + }, function() { | |
309 | + // funcion ejecutada cuando se cancela el modal | |
310 | + }); | |
241 | 311 | } |
242 | 312 | }; |
243 | 313 | $scope.seleccionarTipoFactura = function(key) { |
244 | 314 | if(key === 13) { |
245 | - var modalInstance = $uibModal.open( | |
246 | - { | |
247 | - ariaLabelledBy: 'Búsqueda de tipos de factura', | |
248 | - templateUrl: 'modal-tipo-factura.html', | |
249 | - controller: 'focaModalTipoFacturaController', | |
250 | - size: 'md', | |
251 | - resolve: {filters: function() { | |
252 | - return $scope.cliente.tipoFactura.NOMBRE; | |
253 | - }} | |
254 | - } | |
255 | - ); | |
256 | - modalInstance.result.then(function(tipoFactura) { | |
257 | - $scope.cliente.tipoFactura = tipoFactura; | |
258 | - }, function() { | |
259 | - //TODO: función llamada cuando cancela el modal | |
260 | - }); | |
315 | + var parametrosModal = { | |
316 | + query: '/tipo-factura', | |
317 | + columnas: [ | |
318 | + { | |
319 | + propiedad: 'ID', | |
320 | + nombre: 'Código' | |
321 | + }, | |
322 | + { | |
323 | + propiedad: 'NOMBRE', | |
324 | + nombre: 'Nombre' | |
325 | + } | |
326 | + ], | |
327 | + titulo: 'Búsqueda de tipos de factura', | |
328 | + size: 'md' | |
329 | + }; | |
330 | + focaModalService.modal(parametrosModal).then( | |
331 | + function(tipoFactura) { | |
332 | + $scope.cliente.tipoFactura = tipoFactura; | |
333 | + $timeout(function() { | |
334 | + $scope.focused = 11; | |
335 | + }); | |
336 | + }, function() { | |
337 | + // funcion ejecutada cuando se cancela el modal | |
338 | + }); | |
261 | 339 | } |
262 | 340 | }; |
263 | 341 | $scope.seleccionarTipoComprobante = function(key) { |
264 | 342 | if(key === 13) { |
265 | - var modalInstance = $uibModal.open( | |
266 | - { | |
267 | - ariaLabelledBy: 'Búsqueda de tipos de comprobante', | |
268 | - templateUrl: 'modal-tipo-comprobante.html', | |
269 | - controller: 'focaModalTipoComprobanteController', | |
270 | - size: 'md', | |
271 | - resolve: {filters: function() { | |
272 | - return $scope.cliente.tipoComprobante.NOMBRE; | |
273 | - }} | |
274 | - } | |
275 | - ); | |
276 | - modalInstance.result.then(function(tipoComprobante) { | |
277 | - $scope.cliente.tipoComprobante = tipoComprobante; | |
278 | - }, function() { | |
279 | - //TODO: función llamada cuando cancela el modal | |
280 | - }); | |
343 | + var parametrosModal = { | |
344 | + query: '/tipo-comprobante', | |
345 | + columnas: [ | |
346 | + { | |
347 | + propiedad: 'ID', | |
348 | + nombre: 'Código' | |
349 | + }, | |
350 | + { | |
351 | + propiedad: 'NOMBRE', | |
352 | + nombre: 'Nombre' | |
353 | + } | |
354 | + ], | |
355 | + titulo: 'Búsqueda de tipos de comprobante', | |
356 | + size: 'md' | |
357 | + }; | |
358 | + focaModalService.modal(parametrosModal).then( | |
359 | + function(tipoComprobante) { | |
360 | + $scope.cliente.tipoComprobante = tipoComprobante; | |
361 | + $timeout(function() { | |
362 | + $scope.focused = 13; | |
363 | + }); | |
364 | + }, function() { | |
365 | + // funcion ejecutada cuando se cancela el modal | |
366 | + }); | |
281 | 367 | } |
282 | 368 | }; |
283 | 369 | $scope.seleccionarFormaPago = function(key) { |
284 | 370 | if(key === 13) { |
285 | - var modalInstance = $uibModal.open( | |
286 | - { | |
287 | - ariaLabelledBy: 'Búsqueda de formas de pago', | |
288 | - templateUrl: 'modal-forma-pago.html', | |
289 | - controller: 'focaModalFormaPagoController', | |
290 | - size: 'md', | |
291 | - resolve: {filters: function() { | |
292 | - return $scope.cliente.formaPago.NOMBRE; | |
293 | - }} | |
294 | - } | |
295 | - ); | |
296 | - modalInstance.result.then(function(formaPago) { | |
297 | - $scope.cliente.formaPago = formaPago; | |
298 | - }, function() { | |
299 | - //TODO: función llamada cuando cancela el modal | |
300 | - }); | |
371 | + var parametrosModal = { | |
372 | + query: '/forma-pago', | |
373 | + columnas: [ | |
374 | + { | |
375 | + propiedad: 'ID', | |
376 | + nombre: 'Código', | |
377 | + filtro: { | |
378 | + nombre: 'rellenarDigitos', | |
379 | + parametro: 3 | |
380 | + } | |
381 | + }, | |
382 | + { | |
383 | + propiedad: 'NOMBRE', | |
384 | + nombre: 'Nombre' | |
385 | + } | |
386 | + ], | |
387 | + titulo: 'Búsqueda de formas de pago', | |
388 | + size: 'md' | |
389 | + }; | |
390 | + focaModalService.modal(parametrosModal).then( | |
391 | + function(formaPago) { | |
392 | + $scope.cliente.formaPago = formaPago; | |
393 | + }, function() { | |
394 | + // funcion ejecutada cuando se cancela el modal | |
395 | + }); | |
396 | + } | |
397 | + }; | |
398 | + $scope.seleccionarCobrador = function(key) { | |
399 | + if(key === 13) { | |
400 | + var parametrosModal = { | |
401 | + query: '/cobrador', | |
402 | + columnas: [ | |
403 | + { | |
404 | + propiedad: 'CodVen', | |
405 | + nombre: 'Código' | |
406 | + }, | |
407 | + { | |
408 | + propiedad: 'NomVen', | |
409 | + nombre: 'Nombre' | |
410 | + } | |
411 | + ], | |
412 | + titulo: 'Búsqueda de cobradores', | |
413 | + size: 'md' | |
414 | + }; | |
415 | + focaModalService.modal(parametrosModal).then( | |
416 | + function(cobrador) { | |
417 | + $scope.cliente.cobrador = cobrador; | |
418 | + }, function() { | |
419 | + // funcion ejecutada cuando se cancela el modal | |
420 | + }); | |
301 | 421 | } |
302 | 422 | }; |
303 | 423 | |
304 | 424 | $scope.guardar = function() { |
305 | 425 | |
306 | - if(!validarForm()) return; | |
307 | - | |
308 | 426 | $scope.cliente.PCX = $scope.cliente.provincia.ID; |
309 | 427 | $scope.cliente.LOX = $scope.cliente.localidad.ID; |
310 | 428 | $scope.cliente.IVA = $scope.cliente.iva.ID; |
... | ... | @@ -313,6 +431,8 @@ angular.module('focaBusquedaCliente') |
313 | 431 | $scope.cliente.TIP = $scope.cliente.tipoFactura.ID; |
314 | 432 | $scope.cliente.TCO = $scope.cliente.tipoComprobante.ID; |
315 | 433 | $scope.cliente.FPA = $scope.cliente.formaPago.ID; |
434 | + $scope.cliente.VEN = $scope.vendedor.CodVen; | |
435 | + $scope.cliente.idCobrador = $scope.cliente.cobrador.CodVen; | |
316 | 436 | |
317 | 437 | delete $scope.cliente.provincia; |
318 | 438 | delete $scope.cliente.localidad; |
... | ... | @@ -322,10 +442,19 @@ angular.module('focaBusquedaCliente') |
322 | 442 | delete $scope.cliente.tipoFactura; |
323 | 443 | delete $scope.cliente.tipoComprobante; |
324 | 444 | delete $scope.cliente.formaPago; |
325 | - | |
326 | - focaBusquedaClienteService.guardarCliente($scope.cliente).then(function(res) { | |
327 | - $scope.select(res.data, true); | |
328 | - }); | |
445 | + delete $scope.cliente.cobrador; | |
446 | + | |
447 | + focaBusquedaClienteService | |
448 | + .guardarCliente($scope.cliente) | |
449 | + .then(function(res) { | |
450 | + var cliente = { | |
451 | + cod: res.data.COD, | |
452 | + cuit: res.data.CUIT, | |
453 | + esNuevo: res.data.esNuevo, | |
454 | + nom: res.data.NOM | |
455 | + }; | |
456 | + $scope.select(cliente, true); | |
457 | + }); | |
329 | 458 | }; |
330 | 459 | |
331 | 460 | function calcularPages(paginaActual) { |
... | ... | @@ -391,14 +520,5 @@ angular.module('focaBusquedaCliente') |
391 | 520 | $scope.selectedClientes = 0; |
392 | 521 | } |
393 | 522 | } |
394 | - | |
395 | - function validarForm() { | |
396 | - var regexCuit = new RegExp(/\b(20|23|24|27|30|33|34)(\D)?[0-9]{8}(\D)?[0-9]/g); | |
397 | - if(!regexCuit.test($scope.cliente.CUIT)) { | |
398 | - focaModalService.alert('Número de CUIT inválido') | |
399 | - return false; | |
400 | - } | |
401 | - return true; | |
402 | - } | |
403 | 523 | } |
404 | 524 | ]); |
src/js/service.js
1 | 1 | angular.module('focaBusquedaCliente') |
2 | 2 | .service('focaBusquedaClienteService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { |
3 | 3 | return { |
4 | - obtenerClientes: function() { | |
5 | - return $http.get(API_ENDPOINT.URL + '/cliente'); | |
6 | - }, | |
7 | - obtenerCliente: function(id) { | |
8 | - return $http.get(API_ENDPOINT.URL + '/cliente/' + id); | |
4 | + obtenerClientesPorNombreOCuitByVendedor: function(nombreOCuit, idVendedor) { | |
5 | + return $http.post(API_ENDPOINT.URL + '/cliente/listar', | |
6 | + {nombreOCuit: nombreOCuit, idVendedor: idVendedor}); | |
9 | 7 | }, |
10 | 8 | obtenerClientesPorNombreOCuit: function(nombreOCuit) { |
11 | - return $http.post(API_ENDPOINT.URL + '/cliente', {nombreOCuit: nombreOCuit}); | |
9 | + return $http.post(API_ENDPOINT.URL + '/cliente/listar', | |
10 | + {nombreOCuit: nombreOCuit}); | |
12 | 11 | }, |
13 | 12 | guardarCliente: function(cliente) { |
14 | 13 | return $http.post(API_ENDPOINT.URL + '/cliente', {cliente: cliente}); |
src/views/foca-busqueda-cliente-modal.html
1 | 1 | <div class="modal-header py-1"> |
2 | 2 | <div class="row w-100"> |
3 | - <div class="col-lg-6"> | |
3 | + <div class="col-lg-4 col-7"> | |
4 | 4 | <h5 class="modal-title my-1" ng-hide="ingreso">Búsqueda de Cliente</h5> |
5 | 5 | <h5 class="modal-title my-1" ng-show="ingreso">Crear Cliente</h5> |
6 | 6 | </div> |
7 | - <div ng-show="ingreso" class="col-lg-6"> | |
8 | - <div class="custom-control custom-checkbox"> | |
7 | + <div ng-show="ingreso" class="col-lg-6 col-5 front-index"> | |
8 | + <div class="custom-control custom-checkbox mt-2"> | |
9 | 9 | <input |
10 | 10 | type="checkbox" |
11 | 11 | class="custom-control-input" |
... | ... | @@ -14,11 +14,12 @@ |
14 | 14 | <label class="custom-control-label" for="checkProspecto">¿Es prospecto?</label> |
15 | 15 | </div> |
16 | 16 | </div> |
17 | - <div class="input-group col-lg-6 pr-0 my-2"> | |
17 | + <div class="input-group col-lg-6 offset-lg-2 pr-0 my-2"> | |
18 | 18 | <button |
19 | 19 | class="btn btn-outline-primary mr-2" |
20 | 20 | ng-click="ingreso = true" |
21 | - ng-show="!ingreso"> | |
21 | + ng-show="!ingreso && vendedor.CodVen" | |
22 | + title="Nuevo"> | |
22 | 23 | <i class="fa fa-plus" aria-hidden="true"></i> |
23 | 24 | </button> |
24 | 25 | <input |
... | ... | @@ -98,7 +99,7 @@ |
98 | 99 | |
99 | 100 | <form name="formCliente"> |
100 | 101 | <uib-tabset class="tabs-right" ng-show="ingreso"> |
101 | - <uib-tab heading="Datos clientes"> | |
102 | + <uib-tab heading="Datos cliente"> | |
102 | 103 | <div class="row"> |
103 | 104 | <div class="col-3"> |
104 | 105 | <label>Código</label> |
... | ... | @@ -106,7 +107,6 @@ |
106 | 107 | type="text" |
107 | 108 | class="form-control form-control-sm" |
108 | 109 | ng-model="cliente.codigo" |
109 | - ng-required="true" | |
110 | 110 | readonly |
111 | 111 | /> |
112 | 112 | </div> |
... | ... | @@ -114,28 +114,33 @@ |
114 | 114 | <label>Nombre</label> |
115 | 115 | <input |
116 | 116 | type="text" |
117 | - foca-focus="ingreso" | |
118 | 117 | class="form-control form-control-sm" |
119 | 118 | ng-model="cliente.NOM" |
119 | + teclado-virtual | |
120 | 120 | placeholder="Ingrese nombre" |
121 | 121 | ng-required="true" |
122 | - teclado-virtual | |
122 | + foca-focus="focused == 1 || ingreso" | |
123 | + ng-focus="focus(1)" | |
124 | + ng-keypress="next($event.keyCode)" | |
123 | 125 | /> |
124 | 126 | </div> |
125 | 127 | </div> |
126 | 128 | <div class="row"> |
127 | - <div class="col-9"> | |
129 | + <div class="col-md-9 col-12"> | |
128 | 130 | <label>Domicilio</label> |
129 | 131 | <input |
130 | 132 | type="text" |
131 | 133 | class="form-control form-control-sm" |
132 | 134 | ng-model="cliente.DOM" |
135 | + teclado-virtual | |
133 | 136 | placeholder="Ingrese domicilio" |
134 | 137 | ng-required="true" |
135 | - teclado-virtual | |
138 | + ng-focus="focus(2)" | |
139 | + foca-focus="focused == 2" | |
140 | + ng-keypress="next($event.keyCode)" | |
136 | 141 | /> |
137 | 142 | </div> |
138 | - <div class="col-3"> | |
143 | + <div class="col-md-3 col-12"> | |
139 | 144 | <label>Código postal</label> |
140 | 145 | <input |
141 | 146 | type="text" |
... | ... | @@ -143,12 +148,15 @@ |
143 | 148 | ng-model="cliente.CPO" |
144 | 149 | placeholder="Ingrese CP" |
145 | 150 | ng-required="true" |
151 | + ng-focus="focus(3)" | |
152 | + foca-focus="focused == 3" | |
153 | + ng-keypress="next($event.keyCode)" | |
146 | 154 | teclado-virtual |
147 | 155 | /> |
148 | 156 | </div> |
149 | 157 | </div> |
150 | 158 | <div class="row"> |
151 | - <div class="col-6"> | |
159 | + <div class="col-md-6 col-12"> | |
152 | 160 | <label>Provincia</label> |
153 | 161 | <div class="input-group"> |
154 | 162 | <input |
... | ... | @@ -158,6 +166,8 @@ |
158 | 166 | ng-keypress="seleccionarProvincia($event.keyCode)" |
159 | 167 | placeholder="Ingrese provincia" |
160 | 168 | ng-required="true" |
169 | + ng-focus="focus(4)" | |
170 | + foca-focus="focused == 4" | |
161 | 171 | teclado-virtual |
162 | 172 | /> |
163 | 173 | <div class="input-group-append"> |
... | ... | @@ -172,7 +182,7 @@ |
172 | 182 | </div> |
173 | 183 | </div> |
174 | 184 | </div> |
175 | - <div class="col-6"> | |
185 | + <div class="col-md-6 col-12"> | |
176 | 186 | <label>Localidad</label> |
177 | 187 | <div class="input-group"> |
178 | 188 | <input |
... | ... | @@ -182,6 +192,8 @@ |
182 | 192 | ng-keypress="seleccionarLocalidad($event.keyCode)" |
183 | 193 | placeholder="Ingrese localidad" |
184 | 194 | ng-required="true" |
195 | + foca-focus="focused == 5" | |
196 | + ng-focus="focus(5)" | |
185 | 197 | teclado-virtual |
186 | 198 | /> |
187 | 199 | <div class="input-group-append"> |
... | ... | @@ -198,7 +210,7 @@ |
198 | 210 | </div> |
199 | 211 | </div> |
200 | 212 | <div class="row"> |
201 | - <div class="col-6"> | |
213 | + <div class="col-md-6 col-12"> | |
202 | 214 | <label>Zona</label> |
203 | 215 | <div class="input-group"> |
204 | 216 | <input |
... | ... | @@ -208,6 +220,8 @@ |
208 | 220 | ng-keypress="seleccionarZona($event.keyCode)" |
209 | 221 | placeholder="Ingrese zona" |
210 | 222 | ng-required="true" |
223 | + ng-focus="focus(6)" | |
224 | + foca-focus="focused == 6" | |
211 | 225 | teclado-virtual |
212 | 226 | /> |
213 | 227 | <div class="input-group-append"> |
... | ... | @@ -222,7 +236,7 @@ |
222 | 236 | </div> |
223 | 237 | </div> |
224 | 238 | </div> |
225 | - <div class="col-6"> | |
239 | + <div class="col-md-6 col-12"> | |
226 | 240 | <label>Actividad</label> |
227 | 241 | <div class="input-group"> |
228 | 242 | <input |
... | ... | @@ -232,6 +246,8 @@ |
232 | 246 | ng-keypress="seleccionarActividad($event.keyCode)" |
233 | 247 | placeholder="Ingrese actividad" |
234 | 248 | ng-required="true" |
249 | + ng-focus="focus(7)" | |
250 | + foca-focus="focused == 7" | |
235 | 251 | teclado-virtual |
236 | 252 | /> |
237 | 253 | <div class="input-group-append"> |
... | ... | @@ -248,14 +264,53 @@ |
248 | 264 | </div> |
249 | 265 | </div> |
250 | 266 | <div class="row"> |
251 | - <div class="col-6"> | |
252 | - <div class="custom-control custom-checkbox"> | |
267 | + <div class="col-md-6 col-12"> | |
268 | + <label>Cobrador</label> | |
269 | + <div class="input-group"> | |
270 | + <input | |
271 | + type="text" | |
272 | + class="form-control form-control-sm" | |
273 | + ng-model="cliente.cobrador.NomVen" | |
274 | + ng-keypress="seleccionarCobrador($event.keyCode)" | |
275 | + placeholder="Ingrese cobrador" | |
276 | + ng-focus="focus(8)" | |
277 | + foca-focus="focused == 8" | |
278 | + teclado-virtual | |
279 | + /> | |
280 | + <div class="input-group-append"> | |
281 | + <button | |
282 | + ladda="searchLoading" | |
283 | + class="btn btn-outline-secondary form-control-sm" | |
284 | + type="button" | |
285 | + ng-click="seleccionarCobrador(13)" | |
286 | + > | |
287 | + <i class="fa fa-search" aria-hidden="true"></i> | |
288 | + </button> | |
289 | + </div> | |
290 | + </div> | |
291 | + </div> | |
292 | + <div class="col-md-6 col-12"> | |
293 | + <label>Vendedor</label> | |
294 | + <div class="input-group"> | |
295 | + <input | |
296 | + type="text" | |
297 | + class="form-control form-control-sm" | |
298 | + ng-model="vendedor.NomVen" | |
299 | + disabled="true" | |
300 | + /> | |
301 | + </div> | |
302 | + </div> | |
303 | + </div> | |
304 | + <div class="row"> | |
305 | + <div class="col-6 d-flex"> | |
306 | + <div class="custom-control custom-checkbox mt-auto"> | |
253 | 307 | <input |
254 | 308 | type="checkbox" |
255 | 309 | class="custom-control-input" |
256 | 310 | id="checkDistribuidor" |
257 | 311 | ng-model="cliente.ES_MAY" |
258 | - checked> | |
312 | + checked | |
313 | + disabled="disabled"> | |
259 | 314 | <label class="custom-control-label" for="checkDistribuidor">¿Este cliente es distribuidor?</label> |
260 | 315 | </div> |
261 | 316 | </div> |
... | ... | @@ -263,15 +318,18 @@ |
263 | 318 | </uib-tab> |
264 | 319 | <uib-tab heading="Datos impositivos"> |
265 | 320 | <div class="row"> |
266 | - <div class="col-7"> | |
321 | + <div class="col-md-7 col-12"> | |
267 | 322 | <label>Responsabilidad ante el IVA</label> |
268 | 323 | <div class="input-group"> |
269 | 324 | <input |
270 | 325 | type="text" |
271 | 326 | class="form-control form-control-sm" |
327 | + placeholder="Ingrese responsabilidad ante el IVA" | |
272 | 328 | ng-model="cliente.iva.NOMBRE" |
273 | 329 | ng-keypress="seleccionarIva($event.keyCode)" |
274 | 330 | ng-required="true" |
331 | + ng-focus="focus(9)" | |
332 | + foca-focus="focused == 9" | |
275 | 333 | teclado-virtual |
276 | 334 | /> |
277 | 335 | <div class="input-group-append"> |
... | ... | @@ -286,7 +344,7 @@ |
286 | 344 | </div> |
287 | 345 | </div> |
288 | 346 | </div> |
289 | - <div class="col-5"> | |
347 | + <div class="col-md-5 col-12"> | |
290 | 348 | <label>Factura que emite</label> |
291 | 349 | <div class="input-group"> |
292 | 350 | <input |
... | ... | @@ -296,6 +354,8 @@ |
296 | 354 | ng-model="cliente.tipoFactura.NOMBRE" |
297 | 355 | ng-required="true" |
298 | 356 | ng-keypress="seleccionarTipoFactura(13)" |
357 | + ng-focus="focus(10)" | |
358 | + foca-focus="focused == 10" | |
299 | 359 | teclado-virtual> |
300 | 360 | <div class="input-group-append"> |
301 | 361 | <button |
... | ... | @@ -311,7 +371,7 @@ |
311 | 371 | </div> |
312 | 372 | </div> |
313 | 373 | <div class="row"> |
314 | - <div class="col-4"> | |
374 | + <div class="col-md-4 col-12"> | |
315 | 375 | <label>CUIT</label> |
316 | 376 | <div class="input-group"> |
317 | 377 | <input |
... | ... | @@ -320,10 +380,15 @@ |
320 | 380 | placeholder="Ingrese CUIT" |
321 | 381 | ng-model="cliente.CUIT" |
322 | 382 | ng-required="true" |
383 | + ng-pattern="regexCuit" | |
384 | + ng-maxlength="13" | |
385 | + ng-keypress="next($event.keyCode)" | |
386 | + ng-focus="focus(11)" | |
387 | + foca-focus="focused == 11" | |
323 | 388 | teclado-virtual> |
324 | 389 | </div> |
325 | 390 | </div> |
326 | - <div class="col-4"> | |
391 | + <div class="col-md-4 col-12"> | |
327 | 392 | <label>Clase de comprobante</label> |
328 | 393 | <div class="input-group"> |
329 | 394 | <input |
... | ... | @@ -333,6 +398,8 @@ |
333 | 398 | ng-keypress="seleccionarTipoComprobante($event.keyCode)" |
334 | 399 | ng-model="cliente.tipoComprobante.NOMBRE" |
335 | 400 | ng-required="true" |
401 | + ng-focus="focus(12)" | |
402 | + foca-focus="focused == 12" | |
336 | 403 | teclado-virtual> |
337 | 404 | <div class="input-group-append"> |
338 | 405 | <button |
... | ... | @@ -346,7 +413,7 @@ |
346 | 413 | </div> |
347 | 414 | </div> |
348 | 415 | </div> |
349 | - <div class="col-4"> | |
416 | + <div class="col-md-4 col-12"> | |
350 | 417 | <label>Forma de pago</label> |
351 | 418 | <div class="input-group"> |
352 | 419 | <input |
... | ... | @@ -356,6 +423,8 @@ |
356 | 423 | ng-model="cliente.formaPago.NOMBRE" |
357 | 424 | ng-required="true" |
358 | 425 | ng-keypress="seleccionarFormaPago($event.keyCode)" |
426 | + ng-focus="focus(13)" | |
427 | + foca-focus="focused == 13" | |
359 | 428 | teclado-virtual> |
360 | 429 | <div class="input-group-append"> |
361 | 430 | <button |
... | ... | @@ -404,5 +473,10 @@ |
404 | 473 | </ul> |
405 | 474 | </nav> |
406 | 475 | <button class="btn btn-sm btn-secondary" type="button" ng-click="cancel()">Cancelar</button> |
407 | - <button class="btn btn-sm btn-primary" type="button" ng-show="ingreso" ng-click="guardar()">Guardar</button> | |
476 | + <button | |
477 | + class="btn btn-sm btn-primary" | |
478 | + type="button" | |
479 | + ng-show="ingreso" | |
480 | + ng-click="guardar()" | |
481 | + ng-disabled="!formCliente.$valid">Guardar</button> | |
408 | 482 | </div> |