Commit 7c48dfd19c84f7587db35c7efeb03231c4da08cb

Authored by Luigi
1 parent c8733ea3c8
Exists in master

Editar datos de Cliente

src/js/controller.js
1 angular.module('focaAbmCliente') 1 angular.module('focaAbmCliente')
2 .controller('focaAbmClienteController', [ 2 .controller('focaAbmClienteController', [
3 '$scope', 'focaAbmClienteService', '$location', '$uibModal', 3 '$scope', 'focaBotoneraLateralService', '$timeout', '$uibModal','focaModalService',
4 'focaModalService', 'focaBotoneraLateralService', '$timeout', '$localStorage', 4 'focaAbmClienteService','$filter',
5 '$routeParams', '$filter', 5 function($scope, focaBotoneraLateralService, $timeout, $uibModal,focaModalService,
6 function($scope, focaAbmClienteService, $location, $uibModal, focaModalService, 6 focaAbmClienteService, $filter) {
7 focaBotoneraLateralService, $timeout, $localStorage, $routeParams, $filter) { 7 $scope.cliente= {
8 NOM: undefined,
9 COD: undefined
10 };
11 $scope.vendedor = {};
12
13 $scope.botonCliente = [{
14 label: 'Cliente',
15 image: 'cliente.png'
16 }];
17
18 $scope.botonera = [
19 {
20 label: 'Datos Cliente',
21 image: 'datoscliente.png',
22 },
23 {
24 label: 'Domicilios de entrega',
25 image: 'dimiciliodeentrega.png'
26 },
27 {
28 label: 'Precio y Condiciones',
29 image: 'precios-condiciones.png'
30 }
31 ];
8 32
9 //SETEO BOTONERA LATERAL 33 //SETEO BOTONERA LATERAL
10 $timeout(function() { 34 $timeout(function() {
11 focaBotoneraLateralService.showSalir(false); 35 focaBotoneraLateralService.showSalir(true);
12 focaBotoneraLateralService.showPausar(false); 36 focaBotoneraLateralService.showPausar(false);
13 focaBotoneraLateralService.showCancelar(false); 37 focaBotoneraLateralService.showCancelar(false);
14 focaBotoneraLateralService.showGuardar(true); 38 focaBotoneraLateralService.showGuardar(false);
15 }); 39 });
16 40
17 } 41 $scope.seleccionarCliente = function() {
18 ]); 42 var datos = null;
43 focaAbmClienteService.getAllClientes()
44 .then(function (res) {
45 datos = res.data;
46 focaModalService.modal({
47 titulo: 'Clientes',
48 data: datos,
49 size: 'md',
50 columnas: [
51 {
52 propiedad: 'COD',
53 nombre: 'Codigo'
54 },
55 {
56 propiedad: 'NOM',
57 nombre: 'Nombre'
58 },
59 {
60 propiedad: 'CUIT',
61 nombre: 'CUIT'
62 }
63 ],
64 }).then(function (res) {
65 $scope.cliente.NOM = res.NOM;
66 $scope.cliente.COD = res.COD;
67 $scope.$broadcast('addCabecera', {
68 label: 'Cliente:',
69 valor: $filter('rellenarDigitos')
70 ($scope.cliente.COD, 5) + ' - ' + $scope.cliente.NOM
71 });
72 }).catch(function (e) {
73 console.log(e);
74 });
75 });
76 };
77
78 $scope.seleccionarDatosCliente = function () {
79 if ($scope.cliente.NOM === undefined || $scope.cliente.COD === undefined) {
80 focaModalService.alert('Seleccione cliente');
81 return;
82 } else {
83 var modalInstanceCliente = $uibModal.open(
84 {
85 ariaLabelledBy: '',
86 templateUrl: 'foca-modal-cliente.html',
87 controller: 'focaModalClienteController',
88 resolve: {
89 idCliente: function () { return $scope.cliente.COD; },
90 },
91 size: 'lg',
92 }
93 );
94 modalInstanceCliente.result
95 .then( function(data) {
96 if (data) {
97 console.log('Data 2: ', data);
98 $scope.cliente.NOM = data.NOM;
99 $scope.$broadcast('cleanCabecera');
100 $scope.$broadcast('addCabecera', {
101 label: 'Cliente:',
102 valor: $filter('rellenarDigitos')($scope.cliente.NOM)
103 });
104 console.log('Data', data);
105 }
106 });
107 }
108 };
109
110 $scope.seleccionarDomiciliosDeEntrega = function () {
111 if ($scope.cliente.NOM === undefined || $scope.cliente.COD === undefined) {
112 focaModalService.alert('Seleccione un cliente');
113 return;
114 }
115 var modalInstanceDomicilio = $uibModal.open(
116 {
117 ariaLabelledBy: 'Busqueda de Domicilios',
118 templateUrl: 'modal-domicilio.html',
119 controller: 'focaModalDomicilioController',
120 resolve: {
121 idCliente: function () { return $scope.cliente.COD; },
122 esNuevo: function () { return $scope.cliente.esNuevo; }
123 },
124 size: 'lg',
125 }
126 );
127 modalInstanceDomicilio.result.then( function(data) {
128 if (data) {
129 $scope.$broadcast('addCabecera', {
130 label: 'Domicilio:',
131 valor: data.Calle + ' ' + data.Numero + ' - ' + data.Localidad +
132 ' - ' + data.Provincia
133 });
134 }
135 });
136 };
137
138 $scope.seleccionarPrecioYCondiciones = function () {
139
140 if ($scope.cliente.NOM === undefined || $scope.cliente.COD === undefined) {
141 focaModalService.alert('Seleccione cliente');
142 return;
143 }
144 var modalInstance = $uibModal.open(
145 {
146 ariaLabelledBy: 'Busqueda de Precio Condición',
147 templateUrl: 'modal-precio-condicion.html',
148 controller: 'focaModalPrecioCondicionController',
149 size: 'lg',
150 resolve: {
151 idListaPrecio: function () {
152 return $scope.cliente.MOD || null;
153 }
154 }
155 }
156 );
157
158 modalInstance.result.then( function (data) {
159 if (data) {
160 console.log('Data: ', data);
161 }
162
163 }, function () {
164
165 }
166 );
167 };
168
169
170 }
171 ]);
19 172
src/js/controllerCliente.js
File was created 1 angular.module('focaAbmCliente')
2 .controller('focaModalClienteController', [
3 '$scope', '$timeout', '$uibModalInstance', 'focaModalService',
4 'focaAbmClienteService', 'idCliente',
5
6 function ($scope, $timeout, $uibModalInstance, focaModalService,
7 focaAbmClienteService, idCliente) {
8
9 $scope.cliente = {
10 provincia: {},
11 localidad: {},
12 zona: {},
13 actividad: {},
14 cobrador: {},
15 vendedor: {},
16 iva: {},
17 tipoFactura: {},
18 tipoComprobante: {},
19 formaPago: {}
20 };
21 $scope.regexCuit = new RegExp(/\b(20|23|24|27|30|33|34)(\D)?[0-9]{8}(\D)?[0-9]/);
22
23 $scope.vendedor = {};
24
25 focaAbmClienteService.obtenerClientePorCodigo(idCliente)
26 .then(function (res) {
27 var data = res.data[0];
28 $scope.cliente.codigo = data.COD;
29 $scope.cliente.DOM = data.DOM;
30 $scope.cliente.NOM = data.NOM;
31 $scope.cliente.CPO = data.CPO;
32 $scope.cliente.provincia.ID = data.PCX;
33 $scope.cliente.provincia.NOMBRE = data.PCI;
34 $scope.cliente.localidad.ID = data.LOX;
35 $scope.cliente.localidad.NOMBRE = data.LOC;
36 $scope.cliente.zona.ID = data.zona.ID;
37 $scope.cliente.zona.NOM = data.zona.NOM;
38 $scope.cliente.actividad.NOM = data.actividad.NOM;
39 $scope.cliente.actividad.ID = data.actividad.ID;
40 $scope.cliente.cobrador.NOM = data.cobrador ? data.cobrador.NOM : '';
41 $scope.cliente.cobrador.NUM = data.cobrador ? data.cobrador.NUM : undefined;
42 $scope.cliente.cobrador.ID = data.cobrador ? data.cobrador.id : undefined;
43 $scope.vendedor.NOM = data.vendedor.NOM;
44 $scope.vendedor.id = data.vendedor.id;
45 $scope.cliente.MAIL = data.MAIL;
46 $scope.cliente.TEL = data.TEL;
47 $scope.cliente.iva.NOMBRE = data.iva.NOMBRE;
48 $scope.cliente.tipoFactura.NOMBRE = data.tipoFactura.NOMBRE;
49 $scope.cliente.tipoFactura.ID = data.tipoFactura.ID;
50 var cuit = data.CUIT.split('-');
51 $scope.cliente.cuit1 = cuit[0];
52 $scope.cliente.cuit2 = cuit[1];
53 $scope.cliente.cuit3 = cuit[2];
54 $scope.cliente.tipoComprobante.NOMBRE = data.tipoComprobante.NOMBRE;
55 $scope.cliente.tipoComprobante.ID = data.tipoComprobante.ID;
56 $scope.cliente.formaPago.NOMBRE = data.formaPago.NOMBRE;
57 $scope.cliente.formaPago.ID = data.formaPago.ID;
58 $scope.cliente.ES_PROS = data.ES_PROS;
59 $scope.cliente.ES_MAY = data.ES_MAY;
60
61
62 $scope.editando = true;
63
64 })
65 .catch(function (e) { console.log(e); });
66
67
68
69
70 $scope.cancel = function () {
71 $uibModalInstance.dismiss('cancel');
72 };
73
74 $scope.guardar = function () {
75 if (!$scope.cliente.NOM) {
76 focaModalService.alert('Ingrese Nombre');
77 return;
78 } else if (!$scope.cliente.CPO) {
79 focaModalService.alert('Ingrese Codigo Postal');
80 return;
81 } else if (!$scope.cliente.provincia.NOMBRE) {
82 focaModalService.alert('Seleccione una provincia');
83 return;
84 } else if (!$scope.cliente.DOM) {
85 focaModalService.alert('Ingrese Domicilio');
86 return;
87 } else if (!$scope.cliente.localidad.NOMBRE) {
88 focaModalService.alert('Seleccione una localidad');
89 return;
90 } else if (!$scope.cliente.zona.NOM) {
91 focaModalService.alert('Seleccione una zona');
92 return;
93 } else if (!$scope.cliente.actividad.NOM) {
94 focaModalService.alert('Seleccione actividad');
95 return;
96 } else if (!$scope.cliente.cobrador.NUM) {
97 focaModalService.alert('Seleccione un cobrador');
98 return;
99 } else if (!$scope.vendedor.NOM) {
100 focaModalService.alert('Seleccione un vendedor');
101 return;
102 } else if ($scope.cliente.MAIL && !validateEmails($scope.cliente.MAIL)) {
103 focaModalService.alert('Ingrese un formato de email válido');
104 return;
105 } else if (!$scope.cliente.TEL) {
106 focaModalService.alert('Ingrese un numero de telefono');
107 return;
108 } else if (!$scope.cliente.iva.NOMBRE) {
109 focaModalService.alert('Seleccione responsabilidad ante el IVA');
110 return;
111 } else if (!$scope.cliente.tipoFactura.NOMBRE) {
112 focaModalService.alert('Seleccione tipo de Factura');
113 return;
114 } else if (!$scope.cliente.cuit1 && !$scope.cliente.cuit2 && !$scope.cliente.cuit3) {
115 focaModalService.alert('Ingrese CUIT');
116 return;
117 } else if (!$scope.cliente.cuit1 || !$scope.cliente.cuit2 || !$scope.cliente.cuit3) {
118 focaModalService.alert('Ingrese CUIT válido');
119 return;
120 } else if (!$scope.regexCuit.test($scope.cliente.cuit1 + $scope.cliente.cuit2 + $scope.cliente.cuit3)) {
121 focaModalService.alert('Ingrese CUIT con formato: XX-XXXXXXXX-X');
122 return;
123 } else if (!$scope.cliente.tipoComprobante.NOMBRE) {
124 focaModalService.alert('Seleccione un Comprobante');
125 return;
126 } else if (!$scope.cliente.formaPago.NOMBRE) {
127 focaModalService.alert('Seleccione una forma de pago');
128 return;
129 }
130
131 $scope.cliente.actividad.ID = parseInt($scope.cliente.actividad.ID);
132
133 var cliente = crearCopia();
134
135 focaAbmClienteService
136 .guardarCliente(cliente)
137 .then(function () {
138 $uibModalInstance.close(cliente);
139 })
140 .catch(function (e) {
141 console.log(e);
142 });
143 };
144 $scope.seleccionarProvincia = function (key) {
145 if (key === 13) {
146 var parametrosModal = {
147 searchText: $scope.cliente.provincia.NOMBRE,
148 query: '/provincia',
149 columnas: [
150 {
151 propiedad: 'ID',
152 nombre: 'Codigo',
153 filtro: {
154 nombre: 'rellenarDigitos',
155 parametro: 3
156 }
157 },
158 {
159 propiedad: 'NOMBRE',
160 nombre: 'Nombre'
161 }
162 ],
163 titulo: 'Búsqueda de provincias',
164 size: 'md'
165 };
166 focaModalService.modal(parametrosModal).then(function (provincia) {
167 $scope.cliente.provincia = provincia;
168 $timeout(function () {
169 $scope.focused = 4;
170 });
171 }, function () {
172 //TODO: función llamada cuando cancela el modal
173 });
174 }
175 };
176 $scope.seleccionarLocalidad = function (key) {
177 if ($scope.cliente.provincia.ID === undefined) {
178 focaModalService.alert('Seleccione una provincia');
179 return;
180 }
181 if (key === 13) {
182 var parametrosModal = {
183 searchText: $scope.cliente.localidad.NOMBRE,
184 query: '/localidad/' + parseInt($scope.cliente.provincia.ID),
185 columnas: [
186 {
187 propiedad: 'ID',
188 nombre: 'Código',
189 },
190 {
191 propiedad: 'NOMBRE',
192 nombre: 'Nombre'
193 }
194 ],
195 titulo: 'Búsqueda de localidades',
196 size: 'md'
197 };
198 focaModalService.modal(parametrosModal).then(function (localidad) {
199 $scope.cliente.localidad = localidad;
200 $timeout(function () {
201 $scope.focused = 5;
202 });
203 }, function () {
204 //TODO: función llamada cuando cancela el modal
205 });
206 }
207 };
208 $scope.seleccionarZona = function (key) {
209 if (key === 13) {
210 var parametrosModal = {
211 searchText: $scope.cliente.zona.NOM,
212 query: '/zona',
213 columnas: [
214 {
215 propiedad: 'ID',
216 nombre: 'Código',
217 filtro: {
218 nombre: 'rellenarDigitos',
219 parametro: 3
220 }
221 },
222 {
223 propiedad: 'NOM',
224 nombre: 'Nombre'
225 }
226 ],
227 titulo: 'Búsqueda de zonas',
228 size: 'md'
229 };
230 focaModalService.modal(parametrosModal).then(
231 function (zona) {
232 $scope.cliente.zona = zona;
233 $timeout(function () {
234 $scope.focused = 6;
235 });
236 }, function () {
237 // funcion ejecutada cuando se cancela el modal
238 });
239 }
240 };
241 $scope.seleccionarActividad = function (key) {
242 if (key === 13) {
243 var parametrosModal = {
244 searchText: $scope.cliente.actividad.NOM,
245 query: '/actividad',
246 columnas: [
247 {
248 propiedad: 'ID',
249 nombre: 'Código',
250 filtro: {
251 nombre: 'rellenarDigitos',
252 parametro: 3
253 }
254 },
255 {
256 propiedad: 'NOM',
257 nombre: 'Nombre'
258 }
259 ],
260 titulo: 'Búsqueda de actividades',
261 size: 'md'
262 };
263 focaModalService.modal(parametrosModal).then(
264 function (actividad) {
265 $scope.cliente.actividad = actividad;
266 $timeout(function () {
267 $scope.focused = 7;
268 });
269 }, function () {
270 // funcion ejecutada cuando se cancela el modal
271 });
272 }
273 };
274 $scope.seleccionarCobrador = function (key) {
275 if (key === 13) {
276 var parametrosModal = {
277 searchText: $scope.cliente.cobrador.NOM,
278 query: '/cobrador',
279 columnas: [
280 {
281 propiedad: 'NUM',
282 nombre: 'Código'
283 },
284 {
285 propiedad: 'NOM',
286 nombre: 'Nombre'
287 }
288 ],
289 titulo: 'Búsqueda de cobradores',
290 size: 'md'
291 };
292 focaModalService.modal(parametrosModal).then(
293 function (cobrador) {
294 $scope.cliente.cobrador = cobrador;
295 }, function () {
296 // funcion ejecutada cuando se cancela el modal
297 });
298 }
299 };
300 $scope.seleccionarVendedor = function (key) {
301 if (key === 13) {
302 var parametrosModal = {
303 titulo: 'Búsqueda vendedores',
304 query: '/vendedor',
305 columnas: [
306 {
307 propiedad: 'NUM',
308 nombre: 'Código',
309 filtro: {
310 nombre: 'rellenarDigitos',
311 parametro: 3
312 }
313 },
314 {
315 propiedad: 'NOM',
316 nombre: 'Nombre'
317 }
318 ],
319 size: 'md'
320 };
321 focaModalService.modal(parametrosModal).then(
322 function (vendedor) {
323 console.log("vendedor seleccionado => ", vendedor);
324 $scope.vendedor = vendedor;
325 }, function () {
326 // funcion ejecutada cuando se cancela el modal
327 });
328 }
329 };
330 $scope.seleccionarIva = function (key) {
331 if (key === 13) {
332 var parametrosModal = {
333 query: '/iva',
334 searchText: $scope.cliente.iva.NOMBRE,
335 columnas: [
336 {
337 propiedad: 'ID',
338 nombre: 'Código',
339 filtro: {
340 nombre: 'rellenarDigitos',
341 parametro: 3
342 }
343 },
344 {
345 propiedad: 'NOMBRE',
346 nombre: 'Nombre'
347 }
348 ],
349 titulo: 'Búsqueda de responsabilidad ante el IVA',
350 size: 'md'
351 };
352 focaModalService.modal(parametrosModal).then(
353 function (iva) {
354 if (iva) {
355 delete $scope.cliente.tipoFactura.NOMBRE;
356 }
357 $scope.cliente.iva = iva;
358 $timeout(function () {
359 $scope.focused = 12;
360 });
361 }, function () {
362 // funcion ejecutada cuando se cancela el modal
363 });
364 }
365 };
366 $scope.seleccionarTipoFactura = function (key) {
367
368 if ($scope.cliente.iva.NOMBRE == '') {
369 focaModalService.alert('Seleccione una responsabilidad ante el IVA');
370 return;
371 }
372
373 if (key === 13) {
374 var datos;
375 if ($scope.cliente.iva.ID == 1) {
376 datos = [
377 {
378 ID: 'A',
379 NOMBRE: 'Factura A'
380 },
381 {
382 ID: 'M',
383 NOMBRE: 'Factura M'
384 },
385 {
386 ID: 'R',
387 NOMBRE: 'Remito'
388 }
389 ];
390 } else {
391 datos = [
392 {
393 ID: 'B',
394 NOMBRE: 'Factura B'
395 },
396 {
397 ID: 'R',
398 NOMBRE: 'Remito'
399 }
400 ];
401 }
402 focaModalService.modal({
403 titulo: 'Seleccionar Factura',
404 data: datos,
405 size: 'md',
406 columnas: [
407 {
408 propiedad: 'ID',
409 NOMBRE: 'Codigo'
410 },
411 {
412 propiedad: 'NOMBRE',
413 NOMBRE: 'Factura'
414 }
415 ],
416 }).then(function (res) {
417 $scope.cliente.tipoFactura = res;
418 });
419 }
420 };
421 $scope.pasarCampoCuit = function (numeroCuit) {
422 if (numeroCuit === 1 && $scope.cliente.cuit1.length === 2) {
423 $scope.cuitActivo = 2;
424 } else if (numeroCuit === 2 && $scope.cliente.cuit2.length === 8) {
425 $scope.cuitActivo = 3;
426 }
427 };
428 $scope.seleccionarTipoComprobante = function (key) {
429 if (key === 13) {
430 var parametrosModal = {
431 searchText: $scope.cliente.tipoComprobante.NOMBRE,
432 query: '/tipo-comprobante',
433 columnas: [
434 {
435 propiedad: 'ID',
436 nombre: 'Código'
437 },
438 {
439 propiedad: 'NOMBRE',
440 nombre: 'Nombre'
441 }
442 ],
443 titulo: 'Búsqueda de tipos de comprobante',
444 size: 'md'
445 };
446 focaModalService.modal(parametrosModal).then(
447 function (tipoComprobante) {
448 $scope.cliente.tipoComprobante = tipoComprobante;
449 $timeout(function () {
450 $scope.focused = 17;
451 });
452 }, function () {
453 // funcion ejecutada cuando se cancela el modal
454 });
455 }
456 };
457 $scope.seleccionarFormaPago = function (key) {
458 if (key === 13) {
459 var parametrosModal = {
460 searchText: $scope.cliente.formaPago.NOMBRE,
461 query: '/forma-pago',
462 columnas: [
463 {
464 propiedad: 'ID',
465 nombre: 'Código',
466 filtro: {
467 nombre: 'rellenarDigitos',
468 parametro: 3
469 }
470 },
471 {
472 propiedad: 'NOMBRE',
473 nombre: 'Nombre'
474 }
475 ],
476 titulo: 'Búsqueda de formas de pago',
477 size: 'md'
478 };
479 focaModalService.modal(parametrosModal).then(
480 function (formaPago) {
481 $scope.cliente.formaPago = formaPago;
482 }, function () {
483 // funcion ejecutada cuando se cancela el modal
484 });
485 }
486 };
487
488 function crearCopia() {
489 var cliente = angular.copy($scope.cliente);
490 cliente.COD = cliente.codigo;
491 cliente.CPO = cliente.CPO;
492 cliente.PCX = parseInt(cliente.provincia.ID);
493 cliente.LOX = parseInt(cliente.localidad.ID);
494 cliente.LOC = cliente.localidad.NOMBRE;
495 cliente.PCI = cliente.provincia.NOMBRE;
496 cliente.IVA = cliente.iva.ID;
497 cliente.ACT = cliente.actividad.ID;
498 cliente.ZON = (parseInt(cliente.zona.ID)).toString();
499 cliente.TIP = cliente.tipoFactura.ID;
500 cliente.TCO = cliente.tipoComprobante.ID;
501 cliente.FPA = cliente.formaPago.ID;
502 cliente.VEN = $scope.vendedor.id;
503 cliente.CUIT = `${cliente.cuit1}-${cliente.cuit2}-${cliente.cuit3}`;
504 cliente.idCobrador = cliente.cobrador.ID;
505
506 delete cliente.codigo;
507 delete cliente.provincia;
508 delete cliente.localidad;
509 delete cliente.iva;
510 delete cliente.actividad;
511 delete cliente.zona;
512 delete cliente.tipoFactura;
513 delete cliente.tipoComprobante;
514 delete cliente.formaPago;
515 delete cliente.cobrador;
516 delete cliente.cuit1;
517 delete cliente.cuit2;
518 delete cliente.cuit3;
519 delete cliente.vendedor;
520
521 return cliente;
522 }
523 function validateEmails(emails) {
524 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,}))$/;
525 var arr = emails.split(',');
526 var result = true;
527 arr.forEach(function (email) {
528 var val = String(email).trim().toLowerCase();
529 if (!re.test(val)) result = false;
530 });
531 return result;
532 }
533
534 }]);
1 angular.module('focaAbmCliente') 1 angular.module('focaAbmCliente')
2 .factory('focaAbmCliente', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) { 2 .factory('focaAbmClienteService', ['$http', 'API_ENDPOINT', function($http, API_ENDPOINT) {
3 return { 3 return {
4 4 getAllClientes: function () {
5 return $http.get(API_ENDPOINT.URL + '/cliente');
6 },
7 obtenerClientePorCodigo: function (cod) {
8 return $http.get(API_ENDPOINT.URL + '/cliente-codigo/' + cod );
9 },
10 guardarCliente: function (cliente) {
11 return $http.post(API_ENDPOINT.URL + '/cliente', { cliente: cliente });
12 }
5 }; 13 };
6 }]); 14 }]);
7 15
src/views/foca-abm-cliente.html
1 <div class="row"> 1 <div class="row">
2 <foca-cabecera-facturador 2 <foca-cabecera-facturador
3 titulo="'Cliente'" 3 titulo="'Cliente'"
4 fecha="now" 4 fecha="now"
5 class="mb-0 col-lg-12" 5 class="mb-0 col-lg-12"
6 ></foca-cabecera-facturador> 6 ></foca-cabecera-facturador>
7 </div> 7 </div>
8 <div class="row"> 8 <div class="row">
9 <div class="col-12 col-md-10 p-0 mt-4 border border-white rounded"> 9 <div class="col-12 col-md-10 p-0 mt-4 border border-white rounded">
10 <div class="row px-5 py-2 botonera-secundaria"> 10 <div class="row px-5 py-2 botonera-secundaria">
11 <div class="col-12"> 11 <div class="col-12">
12 <foca-botonera-facturador
13 botones="botonCliente"
14 max="1"
15 class="row"
16 >
17 </foca-botonera-facturador>
18 </div>
19 </div>
20 <div class="col-12 col-md-12 p-0 border border-white rounded">
21 <div class="row px-5 py-2 botonera-secundaria">
22 <div class="col-12">
12 <foca-botonera-facturador botones="botonera" max="6" class="row"></foca-botonera-facturador> 23 <foca-botonera-facturador botones="botonera" max="6" class="row"></foca-botonera-facturador>
13 </div> 24 </div>
14 </div> 25 </div>
15 </div> 26 </div>
16 </div> 27 </div>
17
src/views/foca-modal-cliente.html
File was created 1 <div class="modal-header py-1">
2 <div class="row w-100">
3 <div class="col-lg-4 col-7">
4 <h5 class="modal-title my-1">Editar Cliente</h5>
5 </div>
6 <div class="col-lg-6 col-5 front-index">
7 <div class="custom-control custom-checkbox mt-2">
8 <input
9 type="checkbox"
10 class="custom-control-input"
11 id="checkProspecto"
12 ng-model="cliente.ES_PROS">
13 <label class="custom-control-label" for="checkProspecto">¿Es prospecto?</label>
14 </div>
15 </div>
16 </div>
17 </div>
18 <div class="modal-body" id="modal-body">
19 <form name="formCliente">
20 <fieldset>
21 <uib-tabset class="tabs-right">
22 <uib-tab heading="Datos cliente">
23 <div class="row">
24 <div class="col-3 mt-2">
25 <label>Código</label>
26 <input
27 type="text"
28 class="form-control form-control-sm"
29 ng-model="cliente.codigo"
30 readonly
31 />
32 </div>
33 <div class="col-9 mt-2">
34 <label>Nombre</label>
35 <input
36 type="text"
37 class="form-control form-control-sm"
38 ng-model="cliente.NOM"
39 teclado-virtual
40 placeholder="Ingrese nombre"
41 ng-required="true"
42 foca-focus="focused == 1"
43 ng-focus="focus(1)"
44 ng-keypress="next($event.keyCode)"
45 />
46 </div>
47 </div>
48 <div class="row">
49 <div class="col-md-9 col-12 mt-2">
50 <label>Domicilio</label>
51 <input
52 type="text"
53 class="form-control form-control-sm"
54 ng-model="cliente.DOM"
55 teclado-virtual
56 placeholder="Ingrese domicilio"
57 ng-required="true"
58 ng-focus="focus(2)"
59 foca-focus="focused == 2"
60 ng-keypress="next($event.keyCode)"
61 />
62 </div>
63 <div class="col-md-3 col-12 mt-2">
64 <label>Código postal</label>
65 <input
66 type="text"
67 class="form-control form-control-sm"
68 ng-model="cliente.CPO"
69 placeholder="Ingrese CP"
70 ng-required="true"
71 ng-focus="focus(3)"
72 foca-focus="focused == 3"
73 ng-keypress="next($event.keyCode)"
74 teclado-virtual
75 />
76 </div>
77 </div>
78 <div class="row">
79 <div class="col-md-6 col-12 mt-2">
80 <label>Provincia</label>
81 <div class="input-group">
82 <input
83 type="text"
84 class="form-control form-control-sm"
85 ng-model="cliente.provincia.NOMBRE"
86 ng-keypress="seleccionarProvincia($event.keyCode)"
87 placeholder="Seleccione provincia"
88 ng-required="true"
89 ng-focus="focus(4)"
90 foca-focus="focused == 4"
91 teclado-virtual
92 />
93 <button
94 ng-show="cliente.provincia.NOMBRE !== ''"
95 type="button"
96 class="clear-input"
97 ng-click=
98 "cliente.provincia.NOMBRE = '';
99 cliente.provincia.ID = undefined"
100 ><i class="fa fa-times"></i>
101 </button>
102 <div class="input-group-append">
103 <button
104 ladda="searchLoading"
105 class="btn btn-outline-secondary"
106 type="button"
107 ng-click="seleccionarProvincia(13)"
108 ><i class="fa fa-search" aria-hidden="true"></i>
109 </button>
110 </div>
111 </div>
112 </div>
113 <div class="col-md-6 col-12 mt-2">
114 <label>Localidad</label>
115 <div class="input-group">
116 <input
117 type="text"
118 class="form-control form-control-sm"
119 ng-model="cliente.localidad.NOMBRE"
120 ng-keypress="seleccionarLocalidad($event.keyCode)"
121 placeholder="Seleccione localidad"
122 ng-required="true"
123 foca-focus="focused == 5"
124 ng-focus="focus(5)"
125 teclado-virtual
126 />
127 <button
128 ng-show="cliente.localidad.NOMBRE !== ''"
129 type="button"
130 class="clear-input"
131 ng-click="cliente.localidad.NOMBRE = ''"
132 ><i class="fa fa-times"></i>
133 </button>
134 <div class="input-group-append">
135 <button
136 ladda="searchLoading"
137 class="btn btn-outline-secondary"
138 type="button"
139 ng-click="seleccionarLocalidad(13)"
140 ><i class="fa fa-search" aria-hidden="true"></i>
141 </button>
142 </div>
143 </div>
144 </div>
145 </div>
146 <div class="row">
147 <div class="col-md-6 col-12 mt-2">
148 <label>Zona</label>
149 <div class="input-group">
150 <input
151 type="text"
152 class="form-control form-control-sm"
153 ng-model="cliente.zona.NOM"
154 ng-keypress="seleccionarZona($event.keyCode)"
155 placeholder="Seleccione zona"
156 ng-required="true"
157 ng-focus="focus(6)"
158 foca-focus="focused == 6"
159 teclado-virtual
160 />
161 <button
162 ng-show="cliente.zona.NOM !== ''"
163 type="button"
164 class="clear-input"
165 ng-click="cliente.zona.NOM = ''"
166 ><i class="fa fa-times"></i>
167 </button>
168 <div class="input-group-append">
169 <button
170 ladda="searchLoading"
171 class="btn btn-outline-secondary"
172 type="button"
173 ng-click="seleccionarZona(13)"
174 ><i class="fa fa-search" aria-hidden="true"></i>
175 </button>
176 </div>
177 </div>
178 </div>
179 <div class="col-md-6 col-12 mt-2">
180 <label> Actividad </label>
181 <div class="input-group">
182 <input
183 type="text"
184 class="form-control form-control-sm"
185 ng-model="cliente.actividad.NOM"
186 ng-keypress="seleccionarActividad($event.keyCode)"
187 placeholder="Seleccione actividad"
188 ng-required="true"
189 ng-focus="focus(7)"
190 foca-focus="focused == 7"
191 teclado-virtual
192 />
193 <button
194 ng-show="cliente.actividad.NOM !== ''"
195 type="button"
196 class="clear-input"
197 ng-click="cliente.actividad.NOM = ''"
198 ><i class="fa fa-times"></i>
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="seleccionarActividad(13)"
206 ><i class="fa fa-search" aria-hidden="true"></i>
207 </button>
208 </div>
209 </div>
210 </div>
211 </div>
212 <div class="row">
213 <div class="col-md-6 col-12 mt-2">
214 <label>Cobrador</label>
215 <div class="input-group">
216 <input
217 type="text"
218 class="form-control form-control-sm"
219 ng-model="cliente.cobrador.NOM"
220 ng-keypress="seleccionarCobrador($event.keyCode)"
221 placeholder="Seleccione cobrador"
222 ng-focus="focus(8)"
223 foca-focus="focused == 8"
224 teclado-virtual
225 />
226 <button
227 ng-show="cliente.cobrador.NOM !== ''"
228 type="button"
229 class="clear-input"
230 ng-click="cliente.cobrador.NOM = ''"
231 ><i class="fa fa-times"></i>
232 </button>
233 <div class="input-group-append">
234 <button
235 ladda="searchLoading"
236 class="btn btn-outline-secondary"
237 type="button"
238 ng-click="seleccionarCobrador(13)"
239 ><i class="fa fa-search" aria-hidden="true"></i>
240 </button>
241 </div>
242 </div>
243 </div>
244 <div class="col-md-6 col-12 mt-2">
245 <label>Vendedor</label>
246 <div class="input-group">
247 <input
248 type="text"
249 class="form-control form-control-sm"
250 ng-model="vendedor.NOM"
251 ng-keypress="seleccionarVendedor($event.keyCode)"
252 placeholder="Seleccione vendedor"
253 ng-focus="focus(9)"
254 foca-focus="focused == 9"
255 teclado-virtual
256 />
257 <button
258 ng-show="vendedor.NOM !== ''"
259 type="button"
260 class="clear-input"
261 ng-click="vendedor.NOM = ''"
262 ><i class="fa fa-times"></i>
263 </button>
264 <div class="input-group-append">
265 <button
266 ladda="searchLoading"
267 class="btn btn-outline-secondary"
268 type="button"
269 ng-click="seleccionarVendedor(13)"
270 ><i class="fa fa-search" aria-hidden="true"></i>
271 </button>
272 </div>
273 </div>
274 </div>
275 <div class="col-md-6 col-12 mt-2">
276 <label>Email</label>
277 <div class="input-group">
278 <input
279 type="text"
280 class="form-control form-control-sm"
281 placeholder="Ingrese Email"
282 ng-model="cliente.MAIL"
283 ng-required="true"
284 ng-keypress="next($event.keyCode)"
285 ng-focus="focus(10)"
286 foca-focus="focused == 10"
287 teclado-virtual>
288 </div>
289 </div>
290 <div class="col-md-6 col-12 mt-2">
291 <label>Telefono</label>
292 <div class="input-group">
293 <input
294 foca-tipo-input
295 limite-numeros-max="20"
296 class="form-control form-control-sm"
297 placeholder="Ingrese Telefono"
298 ng-model="cliente.TEL"
299 ng-required="true"
300 ng-keypress="next($event.keyCode)"
301 ng-focus="focus(11)"
302 foca-focus="focused == 11"
303 teclado-virtual>
304 </div>
305 </div>
306 </div>
307 <div class="row">
308 <div class="col-6 d-flex mt-3">
309 <div class="custom-control custom-checkbox mt-auto">
310 <input
311 type="checkbox"
312 class="custom-control-input"
313 id="checkDistribuidor"
314 ng-model="cliente.ES_MAY"
315 checked
316 disabled="disabled">
317 <label class="custom-control-label" for="checkDistribuidor">¿Este cliente es distribuidor?</label>
318 </div>
319 </div>
320 </div>
321 </uib-tab>
322 <uib-tab heading="Datos impositivos">
323 <div class="row">
324 <div class="col-md-7 col-12 mt-2">
325 <label>Responsabilidad ante el IVA</label>
326 <div class="input-group">
327 <input
328 type="text"
329 class="form-control form-control-sm"
330 placeholder="Seleccione responsabilidad ante el IVA"
331 ng-model="cliente.iva.NOMBRE"
332 ng-keypress="seleccionarIva($event.keyCode)"
333 ng-required="true"
334 ng-focus="focus(12)"
335 foca-focus="focused == 12"
336 teclado-virtual
337 />
338 <button
339 ng-show="cliente.iva.NOMBRE !== ''"
340 type="button"
341 class="clear-input"
342 ng-click="cliente.iva.NOMBRE = ''"
343 ><i class="fa fa-times"></i>
344 </button>
345 <div class="input-group-append">
346 <button
347 ladda="searchLoading"
348 class="btn btn-outline-secondary"
349 type="button"
350 ng-click="seleccionarIva(13)"
351 ><i class="fa fa-search" aria-hidden="true"></i>
352 </button>
353 </div>
354 </div>
355 </div>
356 <div class="col-md-5 col-12 mt-2">
357 <label>Factura que emite</label>
358 <div class="input-group">
359 <input
360 type="text"
361 class="form-control form-control-sm"
362 placeholder="Seleccione factura que emite"
363 ng-model="cliente.tipoFactura.NOMBRE"
364 ng-required="true"
365 ng-keypress="seleccionarTipoFactura(13)"
366 ng-focus="focus(13)"
367 foca-focus="focused == 13"
368 teclado-virtual>
369 <button
370 ng-show="cliente.tipoFactura.NOMBRE !== ''"
371 type="button"
372 class="clear-input"
373 ng-click="cliente.tipoFactura.NOMBRE = ''"
374 ><i class="fa fa-times"></i>
375 </button>
376 <div class="input-group-append">
377 <button
378 ladda="searchLoading"
379 class="btn btn-outline-secondary"
380 type="button"
381 ng-click="seleccionarTipoFactura(13)"
382 ><i class="fa fa-search" aria-hidden="true"></i>
383 </button>
384 </div>
385 </div>
386 </div>
387 </div>
388 <div class="row">
389 <div class= "col-md-4 col-12 mt-2">
390 <label>CUIT</label>
391 <div class="d-flex">
392 <input
393 type="text"
394 class="text-center form-control form-control-sm col-2"
395 limite-numeros-max="2"
396 ng-model="cliente.cuit1"
397 ng-required="true"
398 ng-keypress="pasarCampoCuit(1)"
399 ng-focus="focus(14)"
400 foca-focus="focused == 14"
401 teclado-virtual
402 foca-tipo-input
403 >
404 <span class="m-1"> - </span>
405 <input
406 type="text"
407 class="text-center form-control form-control-sm col-5"
408 maxlength="8"
409 limite-numeros-max="8"
410 ng-keypress="pasarCampoCuit(2)"
411 ng-model="cliente.cuit2"
412 ng-required="true"
413 ng-focus="focus(15)"
414 foca-focus="cuitActivo == 2 || focused == 15"
415 teclado-virtual
416 foca-tipo-input
417 >
418 <span class="m-1"> - </span>
419 <input
420 type="text"
421 class="text-center form-control form-control-sm col-2"
422 maxlength="1"
423 limite-numeros-max="1"
424 ng-keypress="pasarCampoCuit(3)"
425 ng-model="cliente.cuit3"
426 ng-required="true"
427 ng-focus="focus(16)"
428 foca-focus="cuitActivo == 3 || focused == 16"
429 teclado-virtual
430 foca-tipo-input
431 >
432 </div>
433 </div>
434 <div class="col-md-4 col-12 mt-2">
435 <label>Clase de comprobante</label>
436 <div class="input-group">
437 <input
438 type="text"
439 class="form-control form-control-sm"
440 placeholder="Seleccione clase de comprobante"
441 ng-keypress="seleccionarTipoComprobante($event.keyCode)"
442 ng-model="cliente.tipoComprobante.NOMBRE"
443 ng-required="true"
444 ng-focus="focus(17)"
445 foca-focus="focused == 17"
446 teclado-virtual>
447 <button
448 ng-show="cliente.tipoComprobante.NOMBRE !== ''"
449 type="button"
450 class="clear-input"
451 ng-click="cliente.tipoComprobante.NOMBRE = ''"
452 ><i class="fa fa-times"></i>
453 </button>
454 <div class="input-group-append">
455 <button
456 ladda="searchLoading"
457 class="btn btn-outline-secondary"
458 type="button"
459 ng-click="seleccionarTipoComprobante(13)"
460 ><i class="fa fa-search" aria-hidden="true"></i>
461 </button>
462 </div>
463 </div>
464 </div>
465 <div class="col-md-4 col-12 mt-2">
466 <label>Forma de pago</label>
467 <div class="input-group">
468 <input
469 type="text"
470 class="form-control form-control-sm"
471 placeholder="Seleccione forma de pago"
472 ng-model="cliente.formaPago.NOMBRE"
473 ng-required="true"
474 ng-keypress="seleccionarFormaPago($event.keyCode)"
475 ng-focus="focus(18)"
476 foca-focus="focused == 18"
477 teclado-virtual>
478 <button
479 ng-show="cliente.formaPago.NOMBRE !== ''"
480 type="button"
481 class="clear-input"
482 ng-click="cliente.formaPago.NOMBRE = ''"
483 ><i class="fa fa-times"></i>
484 </button>
485 <div class="input-group-append">
486 <button
487 ladda="searchLoading"
488 class="btn btn-outline-secondary"
489 type="button"
490 ng-click="seleccionarFormaPago(13)"
491 ><i class="fa fa-search" aria-hidden="true"></i>
492 </button>
493 </div>
494 </div>
495 </div>
496 </div>
497 </uib-tab>
498 </uib-tabset>
499 </fieldset>
500 </form>
501 </div>
502 <div class="modal-footer py-1">
503 <button
504 class="btn btn-sm btn-secondary"
505 type="button"
506 data-dismiss="modal"
507 ng-click="cancel()">Cancelar
508 </button>
509 <button
510 class="btn btn-sm btn-primary"
511 type="button"
512 ng-click="guardar()"
513 >Guardar
514 </button>
515 </div>
516