@acontplus/ng-customer 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,891 @@
1
+ import { IdentificationNumberVo, SEPARADORES_REGEX, HttpClientFactory, isSuccessResponse, SRI_DOCUMENT_TYPE, SEPARATOR_KEY_CODE } from '@acontplus/core';
2
+ import { DateFormatter, getValidId, isValidField, parseJSONSafe } from '@acontplus/utils';
3
+ import * as i0 from '@angular/core';
4
+ import { inject, signal, ChangeDetectionStrategy, Component, input, output, computed } from '@angular/core';
5
+ import { from, forkJoin } from 'rxjs';
6
+ import { NotificationService } from '@acontplus/ng-notifications';
7
+ import { MatDialogRef, MAT_DIALOG_DATA, MatDialogContent, MatDialogActions } from '@angular/material/dialog';
8
+ import { MatInputChipComponent, ToUpperCaseDirective, MatThemeButtonComponent, MatDynamicCardComponent } from '@acontplus/ng-components';
9
+ import * as i1 from '@angular/material/button';
10
+ import { MatButtonModule } from '@angular/material/button';
11
+ import * as i2 from '@angular/forms';
12
+ import { FormGroup, FormControl, Validators, ReactiveFormsModule } from '@angular/forms';
13
+ import * as i3 from '@angular/material/tabs';
14
+ import { MatTabsModule } from '@angular/material/tabs';
15
+ import * as i4 from '@angular/material/form-field';
16
+ import { MatFormFieldModule } from '@angular/material/form-field';
17
+ import * as i5 from '@angular/material/input';
18
+ import { MatInputModule } from '@angular/material/input';
19
+ import * as i6 from '@angular/material/select';
20
+ import { MatSelectModule } from '@angular/material/select';
21
+ import * as i7 from '@angular/material/slide-toggle';
22
+ import { MatSlideToggleModule } from '@angular/material/slide-toggle';
23
+ import { MatCheckbox } from '@angular/material/checkbox';
24
+ import { MatIcon } from '@angular/material/icon';
25
+ import { MatTooltip } from '@angular/material/tooltip';
26
+ import * as i8 from '@angular/material/datepicker';
27
+ import { MatDatepickerModule } from '@angular/material/datepicker';
28
+ import { provideNativeDateAdapter } from '@angular/material/core';
29
+ import * as i1$1 from '@angular/material/card';
30
+ import { MatCardModule } from '@angular/material/card';
31
+ import { MatDividerModule } from '@angular/material/divider';
32
+ import * as i2$1 from '@angular/material/chips';
33
+ import { MatChipsModule } from '@angular/material/chips';
34
+
35
+ class CustomerUseCase {
36
+ repo;
37
+ constructor(repo) {
38
+ this.repo = repo;
39
+ }
40
+ getAll(params) {
41
+ return this.repo.getAll(params);
42
+ }
43
+ getFormData() {
44
+ return this.repo.getFormData();
45
+ }
46
+ getById(id) {
47
+ return this.repo.getById(id);
48
+ }
49
+ checkExistence(identificationNumber) {
50
+ return this.repo.checkExistence(identificationNumber);
51
+ }
52
+ create(params) {
53
+ return this.repo.create(params);
54
+ }
55
+ update(params) {
56
+ return this.repo.update(params);
57
+ }
58
+ updateState(id) {
59
+ return this.repo.updateState(id);
60
+ }
61
+ search(filter) {
62
+ return this.repo.search(filter);
63
+ }
64
+ }
65
+
66
+ class CustomerExternalUseCase {
67
+ repo;
68
+ constructor(repo) {
69
+ this.repo = repo;
70
+ }
71
+ getById(identification) {
72
+ const idNumber = new IdentificationNumberVo(identification);
73
+ return this.repo.getById(idNumber);
74
+ }
75
+ }
76
+
77
+ const CUSTOMER_API = {
78
+ BILLING: '/api',
79
+ };
80
+
81
+ class CompanySearchMapper {
82
+ static toJson(params) {
83
+ return JSON.stringify({
84
+ textSearch: params.search,
85
+ });
86
+ }
87
+ static fromJson(response) {
88
+ let customers = [];
89
+ if (response && response.code === '1') {
90
+ const results = JSON.parse(response.payload) || [];
91
+ customers = results.map((item) => ({
92
+ id: item.idCliente,
93
+ identificationTypeId: item.idTipoIdentificacion,
94
+ creditTimeId: item.idTiempoCredito,
95
+ customerId: item.customerId,
96
+ status: item.estado,
97
+ email: item.correo,
98
+ phone: item.telefono,
99
+ address: item.direccion,
100
+ licensePlate: item.placa,
101
+ creditDays: item.diasCredito,
102
+ sriValidation: item.validationSri,
103
+ businessName: item.nombreFiscal,
104
+ tradeName: item.nombreComercial,
105
+ identificationNumber: item.numeroIdentificacion,
106
+ identificationType: item.tipoIdentificacion,
107
+ sriCode: item.codigoSri,
108
+ companyRuc: item.rucEmpresa,
109
+ companyId: item.companyId,
110
+ name: item.nombreFiscal,
111
+ }));
112
+ }
113
+ return customers;
114
+ }
115
+ }
116
+
117
+ class CustomerCreateUpdateMapper {
118
+ static toJson(param) {
119
+ return {
120
+ idCliente: getValidId(param.idCliente),
121
+ idEmpleado: getValidId(param.idEmpleado),
122
+ idTipoIdentificacion: param.idTipoIdentificacion,
123
+ idTipoClienteProveedor: getValidId(param.idTipoClienteProveedor),
124
+ idTipoEntidad: getValidId(param.idTipoEntidad),
125
+ idCiudad: getValidId(param.idCiudad),
126
+ idSubContribuyente: getValidId(param.idSubContribuyente),
127
+ idTiempoCredito: getValidId(param.idTiempoCredito),
128
+ idEmpresa: getValidId(param.idEmpresa),
129
+ idCargo: getValidId(param.idCargo),
130
+ numeroIdentificacion: param.numeroIdentificacion,
131
+ nombreFiscal: param.nombreFiscal,
132
+ nombreComercial: param.nombreComercial,
133
+ direccion: isValidField(param.direccion),
134
+ telefono: isValidField(param.telefono),
135
+ correo: isValidField(param.correo),
136
+ placa: isValidField(param.placa),
137
+ montoCredito: isValidField(param.montoCredito),
138
+ nota: isValidField(param.nota),
139
+ validationSri: param.validationSri,
140
+ idFormaPagoSri: getValidId(param.idFormaPagoSri),
141
+ estado: param.estado ?? true,
142
+ infoCrediticia: param.dataInfoCred && JSON.stringify(param.dataInfoCred),
143
+ configValorBruto: param.configValorBruto ?? null,
144
+ birthDate: DateFormatter.isValid(param.birthDate)
145
+ ? DateFormatter.toUTCString(param.birthDate)
146
+ : null,
147
+ };
148
+ }
149
+ static fromJson(response) {
150
+ if (!response)
151
+ return response;
152
+ const result = {
153
+ id: 0,
154
+ };
155
+ if (response.code === '1' && typeof response.payload === 'string') {
156
+ try {
157
+ const parsed = JSON.parse(response.payload);
158
+ if (Array.isArray(parsed) && parsed.length > 0) {
159
+ const { idCliente } = parsed[0];
160
+ result.id = idCliente;
161
+ }
162
+ }
163
+ catch (error) {
164
+ console.error('Error parsing payload JSON:', error);
165
+ }
166
+ }
167
+ return result;
168
+ }
169
+ }
170
+
171
+ class CustomerFormDataMapper {
172
+ static toJson() {
173
+ return JSON.stringify({
174
+ tipo: 2,
175
+ });
176
+ }
177
+ static fromJson(response) {
178
+ const result = {};
179
+ if (response.code === '1') {
180
+ const mainData = JSON.parse(response.payload);
181
+ result.tipoIdentificacion = mainData[0];
182
+ result.tipoContribuyentes = mainData[1];
183
+ result.tiempoCreditos = mainData[2] || [];
184
+ const ciudades = mainData[3];
185
+ result.ciudades = ciudades.reduce((acc, ciudade) => {
186
+ const dataExists = acc.find((c) => c.idProvincia === ciudade.idProvincia);
187
+ if (!dataExists) {
188
+ acc.push({
189
+ idProvincia: ciudade.idProvincia,
190
+ nombre: ciudade.provincia,
191
+ ciudades: [
192
+ {
193
+ idCiudad: ciudade.idCiudad,
194
+ nombre: ciudade.ciudad,
195
+ },
196
+ ],
197
+ });
198
+ }
199
+ else {
200
+ dataExists.ciudades.push({
201
+ idCiudad: ciudade.idCiudad,
202
+ nombre: ciudade.ciudad,
203
+ });
204
+ }
205
+ return acc;
206
+ }, []);
207
+ result.tiposCliente = mainData[4] || [];
208
+ result.empresas = mainData[5] || [];
209
+ result.cargos = mainData[6] || [];
210
+ result.formasPagoSri = mainData[7] || [];
211
+ result.housingTypes = mainData[8] || [];
212
+ result.maritalStatuses = mainData[9] || [];
213
+ result.employees = mainData[10] || [];
214
+ }
215
+ return result;
216
+ }
217
+ }
218
+
219
+ class CustomerGetByIdMapper {
220
+ static fromJson(response) {
221
+ if (response.code !== '1' || !response.payload) {
222
+ return {};
223
+ }
224
+ const data = JSON.parse(response.payload)[0];
225
+ return {
226
+ idCliente: data.idCliente,
227
+ idTipoClienteProveedor: data.idTipoClienteProveedor,
228
+ idTipoEntidad: data.idTipoEntidad,
229
+ idSubContribuyente: data.idSubContribuyente,
230
+ idTiempoCredito: data.idTiempoCredito,
231
+ idTipoIdentificacion: data.idTipoIdentificacion,
232
+ idCiudad: data.idCiudad,
233
+ numeroIdentificacion: data.numeroIdentificacion,
234
+ identificacionComprador: data.numeroIdentificacion,
235
+ razonSocialComprador: data.nombreFiscal,
236
+ nombreFiscal: data.nombreFiscal,
237
+ montoCredito: data.montoCredito,
238
+ nombreComercial: data.nombreComercial,
239
+ direccion: data.direccion,
240
+ telefono: data.telefono,
241
+ correo: data.correo,
242
+ estado: data.estado,
243
+ idEmpleado: data.idEmpleado,
244
+ diasCredito: data.diasCredito,
245
+ empleado: data.empleado,
246
+ idEmpresa: data.idEmpresa,
247
+ idCargo: data.idCargo,
248
+ placa: data.placa,
249
+ validationSri: data.validationSri,
250
+ codigoSri: data.codigoSri,
251
+ correos: data.correo ? data.correo.split(SEPARADORES_REGEX) : [],
252
+ telefonos: data.telefono ? data.telefono.split(SEPARADORES_REGEX) : [],
253
+ placas: data.placa ? data.placa.split(SEPARADORES_REGEX) : [],
254
+ idFormaPagoSri: data.idFormaPagoSri,
255
+ dataInfoCred: parseJSONSafe(data.infoCrediticia, {}),
256
+ nota: data.nota?.trim() ?? '',
257
+ configValorBruto: data.configValorBruto ?? false,
258
+ };
259
+ }
260
+ }
261
+
262
+ class ListCustomerMapper {
263
+ static toJson(params) {
264
+ return JSON.stringify({
265
+ ...params,
266
+ type: 1,
267
+ tipo: 1, // remove after
268
+ pageIndex: params.pageIndex,
269
+ pageSize: params.pageSize,
270
+ });
271
+ }
272
+ static fromJson(response) {
273
+ // Initialize with backend-aligned shape (PageIndex is commonly 1-based server-side)
274
+ const result = {
275
+ items: [],
276
+ pageIndex: 1,
277
+ pageSize: 0,
278
+ totalCount: 0,
279
+ totalPages: 0,
280
+ hasPreviousPage: false,
281
+ hasNextPage: false,
282
+ metadata: {},
283
+ };
284
+ // Parse payload (backend sends JSON string in payload)
285
+ const parsed = typeof response?.payload === 'string' ? JSON.parse(response.payload) : response?.payload;
286
+ const dataArray = Array.isArray(parsed) ? parsed[0] ?? [] : Array.isArray(parsed?.items) ? parsed.items : [];
287
+ // Map each item to UI-friendly fields, preserving source values
288
+ result.items = dataArray.map((item, index) => ({
289
+ index: index + 1,
290
+ id: item.idCliente,
291
+ identificationTypeId: item.idTipoIdentificacion,
292
+ identification: item.numeroIdentificacion,
293
+ businessName: item.nombreFiscal,
294
+ tradeName: item.nombreComercial,
295
+ address: item.direccion,
296
+ phone: item.telefono,
297
+ email: item.correo,
298
+ finalConsumer: item.consumidorFinal,
299
+ sriValidation: item.validacionSri ?? item.validationSri,
300
+ sriValidationName: (item.validationSri ?? item.validacionSri) ? 'SI' : 'NO',
301
+ identificationType: item.tipoIdentificacion,
302
+ status: item.estado,
303
+ statusName: item.estado ? 'Activo' : 'Inactivo',
304
+ isFinalConsumer: item.codTipoIdentificacion === 'CF',
305
+ totalRecords: item.totalRecords ?? item.TotalCount,
306
+ }));
307
+ // Flexible pagination extraction (prefer explicit backend values)
308
+ const pageIndex = response?.PageIndex ?? response?.pageIndex ?? 1;
309
+ const pageSize = response?.PageSize ?? response?.pageSize ?? result.items.length;
310
+ const totalCountFromItem = result.items.length > 0 ? result.items[0].totalRecords : undefined;
311
+ const totalCount = response?.TotalCount ?? response?.totalCount ?? totalCountFromItem ?? result.items.length;
312
+ const metadata = response?.Metadata ?? response?.metadata ?? {};
313
+ result.pageIndex = Number.isFinite(pageIndex) ? pageIndex : 1;
314
+ result.pageSize = Number.isFinite(pageSize) ? pageSize : result.items.length;
315
+ result.totalCount = Number.isFinite(totalCount) ? totalCount : result.items.length;
316
+ result.totalPages = result.pageSize > 0 ? Math.ceil(result.totalCount / result.pageSize) : 0;
317
+ // Backend semantics show HasPreviousPage as PageIndex > 1
318
+ result.hasPreviousPage = result.pageIndex > 1;
319
+ result.hasNextPage = result.pageIndex < result.totalPages;
320
+ result.metadata = metadata;
321
+ return result;
322
+ }
323
+ }
324
+
325
+ class CustomerExternalHttpRepository {
326
+ get http() {
327
+ return HttpClientFactory.getClient(); // siempre toma el último cliente configurado
328
+ }
329
+ get url() {
330
+ return `${CUSTOMER_API.BILLING}/Consultas/`;
331
+ }
332
+ getById(identification) {
333
+ const id = identification.getId();
334
+ let endpoint = '';
335
+ if (identification.isValidRuc()) {
336
+ endpoint = `GetRucSRI?Ruc=${id}`;
337
+ }
338
+ else if (identification.isValidCedula()) {
339
+ endpoint = `GetCedulaSri?Ruc=${id}`;
340
+ }
341
+ else {
342
+ throw new Error('Número de identificación inválido para SRI');
343
+ }
344
+ return this.http.get(`${this.url}${endpoint}`).then(response => {
345
+ const idCard = response.numeroRuc ? response.numeroRuc : response.identificacion;
346
+ const businessName = response.razonSocial ? response.razonSocial : response.nombreCompleto;
347
+ const data = {
348
+ phone: response.telefono,
349
+ email: response.email,
350
+ idCard,
351
+ businessName,
352
+ address: response.direccion,
353
+ };
354
+ return {
355
+ status: response.error ? 'warning' : 'success',
356
+ code: response.error ? 'EXTERNAL_API_ERROR' : 'SUCCESS',
357
+ data,
358
+ message: response.error ?? 'External API call completed',
359
+ timestamp: new Date().toISOString(),
360
+ };
361
+ });
362
+ }
363
+ }
364
+
365
+ class CustomerHttpRepository {
366
+ get http() {
367
+ return HttpClientFactory.getClient(); // siempre toma el último cliente configurado
368
+ }
369
+ get url() {
370
+ return `${CUSTOMER_API.BILLING}/CompanyCustomer/`;
371
+ }
372
+ checkExistence(identificationNumber) {
373
+ const searchPayload = JSON.stringify({
374
+ textSearch: identificationNumber,
375
+ tipo: 3,
376
+ });
377
+ return this.http.get(`${this.url}?json=${searchPayload}`).then(response => {
378
+ const result = {
379
+ status: 'warning',
380
+ code: response.code ?? 'UNKNOWN_ERROR',
381
+ data: null,
382
+ message: response.message ?? 'Unknown error occurred',
383
+ timestamp: new Date().toISOString(),
384
+ };
385
+ if (response.code === '1' && response.payload) {
386
+ const parsedData = JSON.parse(response.payload);
387
+ if (Array.isArray(parsedData) && parsedData.length > 0 && Array.isArray(parsedData[0])) {
388
+ const [customer] = parsedData[0];
389
+ if (customer) {
390
+ result.status = 'success';
391
+ result.data = customer;
392
+ }
393
+ }
394
+ }
395
+ return result;
396
+ });
397
+ }
398
+ getFormData() {
399
+ const json = CustomerFormDataMapper.toJson();
400
+ return this.http.get(`${this.url}?json=${json}`).then((response) => {
401
+ const data = CustomerFormDataMapper.fromJson(response);
402
+ return {
403
+ status: 'success',
404
+ code: response.code ?? 'SUCCESS',
405
+ data,
406
+ timestamp: new Date().toISOString(),
407
+ };
408
+ });
409
+ }
410
+ getAll(obj) {
411
+ const json = ListCustomerMapper.toJson(obj);
412
+ return this.http
413
+ .get(`${this.url}?json=${json}`)
414
+ .then((response) => {
415
+ const data = ListCustomerMapper.fromJson(response);
416
+ return {
417
+ status: 'success',
418
+ code: response.code ?? 'SUCCESS',
419
+ data,
420
+ timestamp: new Date().toISOString(),
421
+ };
422
+ });
423
+ }
424
+ create(dto) {
425
+ return this.http
426
+ .post(this.url, { data: CustomerCreateUpdateMapper.toJson(dto.data) })
427
+ .then(response => {
428
+ console.log(response);
429
+ const data = CustomerCreateUpdateMapper.fromJson(response);
430
+ return {
431
+ status: response.code === '1' ? 'success' : 'warning',
432
+ code: response.code ?? 'OPERATION_FAILED',
433
+ data,
434
+ message: response.message ?? 'Operation completed with issues',
435
+ timestamp: new Date().toISOString(),
436
+ };
437
+ });
438
+ }
439
+ update(dto) {
440
+ return this.http
441
+ .put(`${this.url}${dto.id}`, {
442
+ data: CustomerCreateUpdateMapper.toJson(dto.data),
443
+ })
444
+ .then(response => {
445
+ console.log(response);
446
+ return {
447
+ status: response.code === '1' ? 'success' : 'warning',
448
+ code: response.code ?? 'OPERATION_FAILED',
449
+ message: response.message ?? 'Operation completed with issues',
450
+ timestamp: new Date().toISOString(),
451
+ };
452
+ });
453
+ }
454
+ updateState(id) {
455
+ return this.http.delete(`${this.url}${id}`).then(response => {
456
+ return {
457
+ status: response.code === '1' ? 'success' : 'warning',
458
+ code: response.code,
459
+ message: response.message,
460
+ timestamp: new Date().toISOString(),
461
+ };
462
+ });
463
+ }
464
+ getById(id) {
465
+ return this.http
466
+ .get(`${this.url}GetId/${id}`)
467
+ .then(response => {
468
+ const data = CustomerGetByIdMapper.fromJson(response);
469
+ return {
470
+ status: response.code === '1' ? 'success' : 'warning',
471
+ code: response.code ?? 'OPERATION_FAILED',
472
+ data,
473
+ message: response.message ?? 'Operation completed with issues',
474
+ timestamp: new Date().toISOString(),
475
+ };
476
+ });
477
+ }
478
+ search(params) {
479
+ const json = CompanySearchMapper.toJson(params);
480
+ return this.http.get(`${this.url}Search?json=${json}`).then(response => {
481
+ const data = CompanySearchMapper.fromJson(response);
482
+ return {
483
+ status: response.code === '1' ? 'success' : 'warning',
484
+ code: response.code,
485
+ data,
486
+ message: response.message,
487
+ timestamp: new Date().toISOString(),
488
+ };
489
+ });
490
+ }
491
+ }
492
+
493
+ class CustomerAddEditComponent {
494
+ dialogRef = inject((MatDialogRef));
495
+ customerUseCase = inject(CustomerUseCase);
496
+ customerExternalUseCase = inject(CustomerExternalUseCase);
497
+ btnText = signal('Guardar', ...(ngDevMode ? [{ debugName: "btnText" }] : []));
498
+ paramsOptions = inject(MAT_DIALOG_DATA);
499
+ params = this.paramsOptions.data;
500
+ notificationService = inject(NotificationService);
501
+ title = 'Nuevo Cliente';
502
+ loading = false;
503
+ emails = [];
504
+ telephones = [];
505
+ tiemposCredito = signal([], ...(ngDevMode ? [{ debugName: "tiemposCredito" }] : []));
506
+ tipoContribuyentes = signal([], ...(ngDevMode ? [{ debugName: "tipoContribuyentes" }] : []));
507
+ tiposCliente = signal([], ...(ngDevMode ? [{ debugName: "tiposCliente" }] : []));
508
+ tiposIdentificacion = signal([], ...(ngDevMode ? [{ debugName: "tiposIdentificacion" }] : []));
509
+ formasPagoSri = signal([], ...(ngDevMode ? [{ debugName: "formasPagoSri" }] : []));
510
+ placas = signal([], ...(ngDevMode ? [{ debugName: "placas" }] : []));
511
+ ciudades = signal([], ...(ngDevMode ? [{ debugName: "ciudades" }] : []));
512
+ cargos = signal([], ...(ngDevMode ? [{ debugName: "cargos" }] : []));
513
+ empresas = signal([], ...(ngDevMode ? [{ debugName: "empresas" }] : []));
514
+ employees = signal([], ...(ngDevMode ? [{ debugName: "employees" }] : []));
515
+ maritalStatuses = signal([], ...(ngDevMode ? [{ debugName: "maritalStatuses" }] : []));
516
+ housingTypes = signal([], ...(ngDevMode ? [{ debugName: "housingTypes" }] : []));
517
+ showRefresh = signal(true, ...(ngDevMode ? [{ debugName: "showRefresh" }] : []));
518
+ endsWith001Validator(control) {
519
+ const value = control.value;
520
+ if (value && value.length >= 3) {
521
+ if (!value.endsWith('001')) {
522
+ return { endsWith001: true };
523
+ }
524
+ }
525
+ return null;
526
+ }
527
+ customerForm = new FormGroup({
528
+ direccion: new FormControl('', Validators.required),
529
+ idCargo: new FormControl(0),
530
+ idCliente: new FormControl(0),
531
+ idEmpresa: new FormControl(0),
532
+ idFormaPagoSri: new FormControl(0),
533
+ idTipoClienteProveedor: new FormControl(0),
534
+ idTipoEntidad: new FormControl(0),
535
+ idCiudad: new FormControl(0),
536
+ idEmpleado: new FormControl(0),
537
+ nombreFiscal: new FormControl('', Validators.required),
538
+ nombreComercial: new FormControl(''),
539
+ numeroIdentificacion: new FormControl({ value: '', disabled: false }, [
540
+ Validators.required,
541
+ Validators.minLength(13),
542
+ Validators.maxLength(13),
543
+ this.endsWith001Validator,
544
+ ]),
545
+ correo: new FormControl(''),
546
+ telefono: new FormControl(''),
547
+ placa: new FormControl(''),
548
+ nota: new FormControl(''),
549
+ estado: new FormControl(false),
550
+ birthDate: new FormControl(null),
551
+ validationSri: new FormControl(false),
552
+ configValorBruto: new FormControl(false),
553
+ dataInfoCred: new FormGroup({
554
+ maritalStatusId: new FormControl(null),
555
+ conyugeNombre: new FormControl(null),
556
+ conyugeTel: new FormControl(null),
557
+ refFamNombre: new FormControl(null),
558
+ refFamTel: new FormControl(null),
559
+ housingTypeId: new FormControl(null),
560
+ dirVivienda: new FormControl(null),
561
+ refDomicilio: new FormControl(null),
562
+ sector: new FormControl(null),
563
+ barrio: new FormControl(null),
564
+ calle: new FormControl(null),
565
+ }),
566
+ });
567
+ getCustomer(codigo, id) {
568
+ this.customerForm.patchValue({
569
+ validationSri: false,
570
+ });
571
+ from(this.customerUseCase.checkExistence(id)).subscribe(response => {
572
+ if (isSuccessResponse(response) && response.data) {
573
+ alert('El cliente ya se encuentra registrado en su empresa');
574
+ this.notificationService.toastr.show({
575
+ type: 'warning',
576
+ message: 'El cliente ya se encuentra registrado en su empresa',
577
+ });
578
+ this.customerForm.patchValue({ numeroIdentificacion: null });
579
+ return;
580
+ }
581
+ if (codigo === SRI_DOCUMENT_TYPE.PASSPORT) {
582
+ this.customerForm.patchValue({
583
+ validationSri: true,
584
+ });
585
+ return;
586
+ }
587
+ from(this.customerExternalUseCase.getById(id)).subscribe(secondResponse => {
588
+ if (!isSuccessResponse(secondResponse) || !secondResponse.data) {
589
+ this.notificationService.toastr.show({
590
+ type: 'info',
591
+ message: ' No se encontró información en el SRI',
592
+ });
593
+ return;
594
+ }
595
+ const { phone, email, idCard, // numeroRuc
596
+ businessName, // razonSocial
597
+ address, // direccion
598
+ } = secondResponse.data;
599
+ if (phone && typeof phone === 'string') {
600
+ this.telephones = phone.split(SEPARADORES_REGEX) || [];
601
+ }
602
+ if (email && typeof email === 'string') {
603
+ this.emails = email.split(SEPARADORES_REGEX) || [];
604
+ }
605
+ if (idCard) {
606
+ this.customerForm.patchValue({
607
+ numeroIdentificacion: idCard,
608
+ nombreFiscal: businessName,
609
+ validationSri: true,
610
+ direccion: address,
611
+ nombreComercial: businessName,
612
+ });
613
+ }
614
+ });
615
+ });
616
+ }
617
+ getLoadData() {
618
+ if (this.isUpdate()) {
619
+ return forkJoin([
620
+ from(this.customerUseCase.getFormData()),
621
+ from(this.customerUseCase.getById(this.params.id)),
622
+ ]);
623
+ }
624
+ return from(this.customerUseCase.getFormData());
625
+ }
626
+ ngOnInit() {
627
+ try {
628
+ this.getLoadData().subscribe(response => {
629
+ let mainDataForm = {};
630
+ let dataCompanyCustomer = {};
631
+ if (Array.isArray(response)) {
632
+ mainDataForm = response[0].data;
633
+ dataCompanyCustomer = response[1];
634
+ }
635
+ else {
636
+ mainDataForm = response.data;
637
+ }
638
+ this.tiposIdentificacion.set(mainDataForm.tipoIdentificacion);
639
+ this.tiemposCredito.set(mainDataForm.tiempoCreditos);
640
+ this.tipoContribuyentes.set(mainDataForm.tipoContribuyentes);
641
+ this.formasPagoSri.set(mainDataForm.formasPagoSri);
642
+ this.tiposCliente.set(mainDataForm.tiposCliente);
643
+ this.ciudades.set(mainDataForm.ciudades);
644
+ this.cargos.set(mainDataForm.cargos);
645
+ this.empresas.set(mainDataForm.empresas);
646
+ this.employees.set(mainDataForm.employees);
647
+ this.maritalStatuses.set(mainDataForm.maritalStatuses);
648
+ this.housingTypes.set(mainDataForm.housingTypes);
649
+ if (this.isDataOfSri()) {
650
+ const { codigoSri, numeroIdentificacion } = this.params;
651
+ const dataIdentificacion = this.tiposIdentificacion().find((ti) => ti.codigoSri === codigoSri);
652
+ if (dataIdentificacion) {
653
+ const idTipoIdentificacionCtrl = this.customerForm.get('idTipoIdentificacion');
654
+ idTipoIdentificacionCtrl?.setValue(dataIdentificacion.idTipoIdentificacion);
655
+ const numeroIdentificacionCtrl = this.customerForm.get('numeroIdentificacion');
656
+ numeroIdentificacionCtrl?.setValue(numeroIdentificacion);
657
+ const idTiempoCreditoCtrl = this.customerForm.get('idTiempoCredito');
658
+ idTiempoCreditoCtrl?.setValue(this.tiemposCredito().length > 0
659
+ ? this.tiemposCredito()[0].idTiempoCredito
660
+ : 0);
661
+ this.updateFormControlNumeroIdentificacion(dataIdentificacion.codigoSri);
662
+ this.onKeyDownGovernmentId();
663
+ }
664
+ return;
665
+ }
666
+ if (this.isCreate()) {
667
+ const dataIdentificacion = this.tiposIdentificacion().find((ti) => ti.codigoSri === SRI_DOCUMENT_TYPE.RUC);
668
+ if (dataIdentificacion) {
669
+ const idTipoIdentificacionCtrl = this.customerForm.get('idTipoIdentificacion');
670
+ idTipoIdentificacionCtrl?.setValue(dataIdentificacion.idTipoIdentificacion);
671
+ this.setIdentificationTypeChange(dataIdentificacion.codigoSri);
672
+ }
673
+ const idTiempoCreditoCtrl = this.customerForm.get('idTiempoCredito');
674
+ idTiempoCreditoCtrl?.setValue(this.tiemposCredito().length > 0
675
+ ? this.tiemposCredito()[0].idTiempoCredito
676
+ : 0);
677
+ }
678
+ else {
679
+ this.title = 'Editar Cliente';
680
+ this.btnText.set('Actualizar');
681
+ this.emails = dataCompanyCustomer.correos;
682
+ this.telephones = dataCompanyCustomer.telefonos;
683
+ this.placas.set(dataCompanyCustomer.placas);
684
+ const { dataInfoCred, ...rest } = dataCompanyCustomer;
685
+ this.customerForm.patchValue(rest);
686
+ if (dataInfoCred) {
687
+ this.customerForm.get('dataInfoCred')?.patchValue(dataInfoCred);
688
+ }
689
+ this.updateFormControlNumeroIdentificacion(rest.codigoSri);
690
+ }
691
+ });
692
+ }
693
+ catch (error) {
694
+ // Handle error appropriately
695
+ }
696
+ }
697
+ identificationTypeChange(event) {
698
+ const dt = this.tiposIdentificacion().find(item => item.idTipoIdentificacion === Number(event.value));
699
+ this.setIdentificationTypeChange(dt.codigoSri);
700
+ }
701
+ updateFormControlNumeroIdentificacion(codigoSri) {
702
+ const idNumberControl = this.customerForm.get('numeroIdentificacion');
703
+ this.showRefresh.set(false);
704
+ if ([SRI_DOCUMENT_TYPE.RUC, SRI_DOCUMENT_TYPE.CEDULA].includes(codigoSri)) {
705
+ let lengthValidator;
706
+ this.showRefresh.set(true);
707
+ if (codigoSri === SRI_DOCUMENT_TYPE.CEDULA) {
708
+ lengthValidator = [Validators.minLength(10), Validators.maxLength(10)];
709
+ }
710
+ else if (codigoSri === SRI_DOCUMENT_TYPE.RUC) {
711
+ lengthValidator = [
712
+ Validators.minLength(13),
713
+ Validators.maxLength(13),
714
+ this.endsWith001Validator,
715
+ ];
716
+ }
717
+ if (lengthValidator) {
718
+ idNumberControl?.setValidators([
719
+ Validators.required,
720
+ Validators.pattern(/^\d+$/), // Solo números
721
+ ...lengthValidator,
722
+ ]);
723
+ }
724
+ }
725
+ else {
726
+ idNumberControl?.setValidators([Validators.required]);
727
+ }
728
+ idNumberControl?.updateValueAndValidity();
729
+ }
730
+ setIdentificationTypeChange(codigoSri) {
731
+ const idNumberControl = this.customerForm.get('numeroIdentificacion');
732
+ idNumberControl?.reset();
733
+ idNumberControl?.clearValidators();
734
+ this.updateFormControlNumeroIdentificacion(codigoSri);
735
+ }
736
+ get numeroIdentificacionControl() {
737
+ return this.customerForm.get('numeroIdentificacion');
738
+ }
739
+ get birthDateCtrl() {
740
+ return this.customerForm.get('birthDate');
741
+ }
742
+ onKeyDownGovernmentId($event) {
743
+ if ($event) {
744
+ $event.preventDefault();
745
+ }
746
+ if (this.numeroIdentificacionControl?.invalid)
747
+ return;
748
+ const idTipoIdentificacion = this.customerForm.get('idTipoIdentificacion')?.value;
749
+ const numeroIdentificacion = this.customerForm.get('numeroIdentificacion')?.value;
750
+ const codigoSri = this.tiposIdentificacion().find((x) => x.idTipoIdentificacion == idTipoIdentificacion).codigoSri;
751
+ if (numeroIdentificacion) {
752
+ this.getCustomer(codigoSri, numeroIdentificacion);
753
+ }
754
+ }
755
+ isDataOfSri = () => this.params.dataOfSri;
756
+ isCreate = () => !(this.params.id > 0);
757
+ isUpdate = () => this.params.id > 0;
758
+ onSave() {
759
+ this.customerForm.patchValue({
760
+ telefono: this.telephones.length > 0 ? this.telephones.join(SEPARATOR_KEY_CODE.SLASH) : null,
761
+ });
762
+ this.customerForm.patchValue({
763
+ correo: this.emails.length > 0 ? this.emails.join(SEPARATOR_KEY_CODE.SLASH) : null,
764
+ });
765
+ this.customerForm.patchValue({
766
+ placa: this.placas().length > 0 ? this.placas().join(SEPARATOR_KEY_CODE.SLASH) : null,
767
+ });
768
+ const dataForm = {
769
+ ...this.customerForm.value,
770
+ };
771
+ if (this.customerForm.invalid) {
772
+ this.notificationService.toastr.show({
773
+ type: 'warning',
774
+ message: 'Ingrese todos datos requeridos',
775
+ });
776
+ return;
777
+ }
778
+ if (this.isUpdate()) {
779
+ const sendParams = {
780
+ id: this.params.id,
781
+ data: dataForm,
782
+ };
783
+ from(this.customerUseCase.update(sendParams)).subscribe(response => {
784
+ this.notificationService.toastr.show({
785
+ type: isSuccessResponse(response) ? 'success' : 'warning',
786
+ message: `${response.message}`,
787
+ });
788
+ if (isSuccessResponse(response)) {
789
+ this.dialogRef.close({
790
+ id: this.params.id,
791
+ });
792
+ }
793
+ });
794
+ }
795
+ if (this.isCreate()) {
796
+ from(this.customerUseCase.create(dataForm)).subscribe(response => {
797
+ this.notificationService.toastr.show({
798
+ type: isSuccessResponse(response) ? 'success' : 'warning',
799
+ message: `${response.message}`,
800
+ });
801
+ if (isSuccessResponse(response)) {
802
+ this.dialogRef.close(response.data);
803
+ }
804
+ });
805
+ }
806
+ }
807
+ close() {
808
+ this.dialogRef.close();
809
+ }
810
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: CustomerAddEditComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
811
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.1", type: CustomerAddEditComponent, isStandalone: true, selector: "acp-customer-add-edit", providers: [
812
+ provideNativeDateAdapter(),
813
+ {
814
+ provide: CustomerUseCase,
815
+ useFactory: () => new CustomerUseCase(new CustomerHttpRepository()),
816
+ },
817
+ {
818
+ provide: CustomerExternalUseCase,
819
+ useFactory: () => new CustomerExternalUseCase(new CustomerExternalHttpRepository()),
820
+ },
821
+ ], ngImport: i0, template: "<mat-dialog-content>\n <form\n (ngSubmit)=\"onSave()\"\n id=\"formCompanyCustomer\"\n [formGroup]=\"customerForm\"\n autocomplete=\"off\"\n >\n <mat-tab-group>\n <mat-tab label=\"DATOS PRINCIPALES\">\n <div class=\"d-grid gap-2 mx-3 mt-2\">\n <div\n class=\"row row-cols-xxl-2 row-cols-xl-2 row-cols-lg-2 row-cols-md-2 row-cols-sm-2 row-cols-1 g-1\"\n >\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>Tipo Identificaci\u00F3n: </mat-label>\n <mat-select\n formControlName=\"idTipoIdentificacion\"\n (selectionChange)=\"identificationTypeChange($event)\"\n >\n @for (item of tiposIdentificacion(); track $index) {\n <mat-option [value]=\"item.idTipoIdentificacion\">{{\n item.descripcion\n }}</mat-option>\n }\n </mat-select>\n </mat-form-field>\n </div>\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>N\u00FAmero de Identificaci\u00F3n</mat-label>\n <input\n type=\"text\"\n matInput\n (keydown.enter)=\"onKeyDownGovernmentId($event)\"\n formControlName=\"numeroIdentificacion\"\n />\n @if (\n numeroIdentificacionControl?.invalid &&\n (numeroIdentificacionControl?.dirty || numeroIdentificacionControl?.touched)\n ) {\n @if (numeroIdentificacionControl?.hasError('required')) {\n <mat-error> El n\u00FAmero de identificaci\u00F3n es obligatorio. </mat-error>\n }\n\n @if (numeroIdentificacionControl?.hasError('minlength')) {\n <mat-error>\n Debe tener al menos\n {{ numeroIdentificacionControl?.errors?.['minlength'].requiredLength }}\n d\u00EDgitos.\n </mat-error>\n }\n @if (numeroIdentificacionControl?.hasError('maxlength')) {\n <mat-error>\n No puede tener m\u00E1s de\n {{ numeroIdentificacionControl?.errors?.['maxlength'].requiredLength }}\n d\u00EDgitos.\n </mat-error>\n }\n @if (numeroIdentificacionControl?.hasError('pattern')) {\n <mat-error> Solo se permiten caracteres num\u00E9ricos. </mat-error>\n }\n @if (numeroIdentificacionControl?.hasError('endsWith001')) {\n <mat-error> Los \u00FAltimos tres d\u00EDgitos deben ser 001. </mat-error>\n }\n }\n\n @if (showRefresh()) {\n <ng-container matSuffix>\n <button type=\"button\" mat-icon-button (click)=\"onKeyDownGovernmentId($event)\">\n <mat-icon>refresh</mat-icon>\n </button>\n </ng-container>\n }\n </mat-form-field>\n </div>\n </div>\n\n <div\n class=\"row row-cols-xxl-2 row-cols-xl-2 row-cols-lg-2 row-cols-md-2 row-cols-sm-2 row-cols-1 g-1\"\n >\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>Nombre Fiscal:</mat-label>\n <input\n matInput\n autocomplete=\"off\"\n formControlName=\"nombreFiscal\"\n id=\"nombreComercial\"\n placeholder=\"Ej: TECNOMEGA\"\n acpToUpperCase\n />\n </mat-form-field>\n </div>\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>Nombre Comercial:</mat-label>\n <input\n matInput\n autocomplete=\"off\"\n formControlName=\"nombreComercial\"\n placeholder=\"Ej: TECNOMEGA\"\n acpToUpperCase\n type=\"text\"\n />\n </mat-form-field>\n </div>\n </div>\n\n <div>\n <mat-form-field class=\"w-100\">\n <mat-label>Direcci\u00F3n:</mat-label>\n <input\n matInput\n formControlName=\"direccion\"\n placeholder=\"AV. 09 DE OCTUBRE...\"\n acpToUpperCase\n />\n </mat-form-field>\n </div>\n\n <div\n class=\"row row-cols-xxl-2 row-cols-xl-2 row-cols-lg-2 row-cols-md-2 row-cols-sm-2 row-cols-1 g-1\"\n >\n <div class=\"col\">\n <acp-mat-input-chip [chips]=\"emails\" [labelText]=\"'Correo'\" />\n </div>\n <div class=\"col\">\n <acp-mat-input-chip [chips]=\"telephones\" [labelText]=\"'Tel\u00E9fono'\" />\n </div>\n </div>\n\n @if (isUpdate()) {\n <div class=\"vstack gap-2 mt-2\">\n <span>Estado</span>\n <mat-slide-toggle formControlName=\"estado\">\n {{ customerForm.value.estado ? 'Activo' : 'Inactivo' }}\n </mat-slide-toggle>\n </div>\n }\n </div>\n </mat-tab>\n <mat-tab label=\"DATOS ADICIONALES\">\n <div class=\"d-grid gap-2 mx-3 mt-2\">\n <div\n class=\"row row-cols-xxl-2 row-cols-xl-2 row-cols-lg-2 row-cols-md-2 row-cols-sm-2 row-cols-1 g-1\"\n >\n <div class=\"col\">\n <acp-mat-dynamic-card title=\"Informaci\u00F3n B\u00E1sica\" [isHeaderVisible]=\"true\">\n <div\n class=\"row row-cols-xxl-2 row-cols-xl-2 row-cols-lg-2 row-cols-md-2 row-cols-sm-2 row-cols-1 g-2\"\n >\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>Tipo Contribuyente: </mat-label>\n <mat-select formControlName=\"idSubContribuyente\">\n @for (item of tipoContribuyentes(); track $index) {\n <mat-option [value]=\"item.idSubContribuyente\">\n {{ item.descripcion }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n </div>\n\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>Tiempo Cr\u00E9dito: </mat-label>\n <mat-select formControlName=\"idTiempoCredito\">\n @for (item of tiemposCredito(); track $index) {\n <mat-option [value]=\"item.idTiempoCredito\">\n {{ item.descripcion }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n </div>\n\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>Ciudad</mat-label>\n <mat-select formControlName=\"idCiudad\">\n <mat-option [value]=\"0\">-- Ninguno --</mat-option>\n @for (group of ciudades(); track $index) {\n <mat-optgroup [label]=\"group.nombre\">\n @for (item of group.ciudades; track $index) {\n <mat-option [value]=\"item.idCiudad\">{{ item.nombre }}</mat-option>\n }\n </mat-optgroup>\n }\n </mat-select>\n </mat-form-field>\n </div>\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>Tipo Cliente: </mat-label>\n <mat-select formControlName=\"idTipoClienteProveedor\">\n <mat-option [value]=\"0\">--Ninguno--</mat-option>\n @for (item of tiposCliente(); track $index) {\n <mat-option [value]=\"item.idTipoClienteProveedor\">\n {{ item.descripcion }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n </div>\n\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>Empresa: </mat-label>\n <mat-select formControlName=\"idEmpresa\">\n <mat-option [value]=\"0\">--Ninguno--</mat-option>\n\n @for (item of empresas(); track $index) {\n <mat-option [value]=\"item.idEmpresa\">\n {{ item.descripcion }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n </div>\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>Fecha Nacimiento</mat-label>\n <input matInput [matDatepicker]=\"birthDate\" formControlName=\"birthDate\" />\n <mat-hint>MM/DD/YYYY</mat-hint>\n <mat-datepicker-toggle\n matIconSuffix\n [for]=\"birthDate\"\n ></mat-datepicker-toggle>\n <mat-datepicker #birthDate></mat-datepicker>\n @if (birthDateCtrl?.invalid && birthDateCtrl?.touched) {\n <mat-error> Fecha inv\u00E1lida </mat-error>\n }\n </mat-form-field>\n </div>\n </div>\n </acp-mat-dynamic-card>\n </div>\n <div class=\"col\">\n <acp-mat-dynamic-card title=\"Informaci\u00F3n Laboral\" [isHeaderVisible]=\"true\">\n <div\n class=\"row row-cols-xxl-2 row-cols-xl-2 row-cols-lg-2 row-cols-md-2 row-cols-sm-2 row-cols-1 g-1\"\n >\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>Empleado: </mat-label>\n <mat-select formControlName=\"idEmpleado\">\n <mat-option [value]=\"0\">--Ninguno--</mat-option>\n\n @for (item of employees(); track $index) {\n <mat-option [value]=\"item.idEmpleado\">\n {{ item.nombreCompleto }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n </div>\n\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>Cargo: </mat-label>\n <mat-select formControlName=\"idCargo\">\n <mat-option [value]=\"0\">--Ninguno--</mat-option>\n\n @for (item of cargos(); track $index) {\n <mat-option [value]=\"item.idCargo\">\n {{ item.descripcion }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n </div>\n\n <div class=\"col w-100\">\n <mat-form-field class=\"w-100\">\n <mat-label>Observaci\u00F3n</mat-label>\n <textarea matInput placeholder=\"...\" formControlName=\"nota\"></textarea>\n </mat-form-field>\n </div>\n </div>\n </acp-mat-dynamic-card>\n </div>\n </div>\n <div\n class=\"row row-cols-xxl-2 row-cols-xl-2 row-cols-lg-2 row-cols-md-2 row-cols-sm-2 row-cols-1 g-1\"\n >\n <div class=\"col\">\n <acp-mat-dynamic-card title=\"Configuraci\u00F3n Financiera\" [isHeaderVisible]=\"true\">\n <div\n class=\"row row-cols-xxl-1 row-cols-xl-1 row-cols-lg-1 row-cols-md-1 row-cols-sm-1 row-cols-1 g-2 mt-2\"\n >\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>Forma de pago: </mat-label>\n <mat-select formControlName=\"idFormaPagoSri\">\n <mat-option [value]=\"0\">--Ninguno--</mat-option>\n\n @for (item of formasPagoSri(); track $index) {\n <mat-option [value]=\"item.idFormaPagoSri\">\n {{ item.descripcion }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n </div>\n\n <div class=\"col\">\n <acp-mat-input-chip labelText=\"Placa\" [chips]=\"placas()\" />\n </div>\n\n <div class=\"col w-100\">\n <mat-checkbox formControlName=\"configValorBruto\"\n >Activar configuraci\u00F3n de valor bruto\n <mat-icon\n matTooltip=\"valor total de un bien o servicio sin incluir impuestos, deducciones o descuentos (uso dentro del reporte)\"\n >info</mat-icon\n ></mat-checkbox\n >\n </div>\n </div>\n </acp-mat-dynamic-card>\n </div>\n <div class=\"col\"></div>\n </div>\n </div>\n </mat-tab>\n <mat-tab label=\"INFORMACI\u00D3N CREDITICIA\">\n <div class=\"d-grid gap-2 mx-3 mt-2\">\n <div\n class=\"row row-cols-xxl-2 row-cols-xl-2 row-cols-lg-2 row-cols-md-2 row-cols-sm-2 row-cols-1 g-1\"\n >\n <div class=\"col\">\n <acp-mat-dynamic-card title=\"Informaci\u00F3n Personal\" [isHeaderVisible]=\"true\">\n <div\n formGroupName=\"dataInfoCred\"\n class=\"row row-cols-xxl-2 row-cols-xl-2 row-cols-lg-2 row-cols-md-2 row-cols-sm-1 row-cols-1 g-2 mt-2\"\n >\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>Estado Civil: </mat-label>\n <mat-select formControlName=\"maritalStatusId\">\n <mat-option [value]=\"0\">Seleccionar...</mat-option>\n\n @for (item of maritalStatuses(); track $index) {\n <mat-option [value]=\"item.id\">\n {{ item.name }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n </div>\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>Esposo(a):</mat-label>\n <input\n matInput\n formControlName=\"conyugeNombre\"\n placeholder=\"Nombre del c\u00F3nyuge\"\n />\n </mat-form-field>\n </div>\n\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>Tel\u00E9fono Personal:</mat-label>\n <input matInput formControlName=\"conyugeTel\" placeholder=\"09xxxxxxxx\" />\n </mat-form-field>\n </div>\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>Tel\u00E9fono Referencia:</mat-label>\n <input matInput formControlName=\"refFamTel\" placeholder=\"09xxxxxxxx\" />\n </mat-form-field>\n </div>\n <div class=\"col w-100\">\n <mat-form-field class=\"w-100\">\n <mat-label>Referencia Familiar:</mat-label>\n <input\n matInput\n formControlName=\"refFamNombre\"\n placeholder=\"Nombre de referencia familiar\"\n />\n </mat-form-field>\n </div>\n </div>\n </acp-mat-dynamic-card>\n </div>\n <div class=\"col\">\n <acp-mat-dynamic-card title=\"Informaci\u00F3n de Vivienda\" [isHeaderVisible]=\"true\">\n <div\n formGroupName=\"dataInfoCred\"\n class=\"row row-cols-xxl-2 row-cols-xl-2 row-cols-lg-2 row-cols-md-2 row-cols-sm-1 row-cols-1 g-2 mt-2\"\n >\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>Tipo de Vivienda: </mat-label>\n <mat-select formControlName=\"housingTypeId\">\n <mat-option [value]=\"0\">Seleccionar...</mat-option>\n\n @for (item of housingTypes(); track $index) {\n <mat-option [value]=\"item.id\">\n {{ item.name }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n </div>\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>Sector:</mat-label>\n <input matInput formControlName=\"sector\" placeholder=\"Nombre del sector\" />\n </mat-form-field>\n </div>\n\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>Barrio:</mat-label>\n <input matInput formControlName=\"barrio\" placeholder=\"Nombre del barrio\" />\n </mat-form-field>\n </div>\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>Calle:</mat-label>\n <input matInput formControlName=\"calle\" placeholder=\"Nombre de la calle\" />\n </mat-form-field>\n </div>\n <div class=\"col w-100\">\n <mat-form-field class=\"w-100\">\n <mat-label>Direcci\u00F3n Completa</mat-label>\n <textarea\n matInput\n formControlName=\"dirVivienda\"\n placeholder=\"Direcci\u00F3n completa de la vivienda (Sector, Barrio y Calle)\"\n ></textarea>\n </mat-form-field>\n </div>\n <div class=\"col w-100\">\n <mat-form-field class=\"w-100\">\n <mat-label>Descripci\u00F3n del Punto de Referencia:</mat-label>\n <textarea\n matInput\n formControlName=\"refDomicilio\"\n placeholder=\"Descripci\u00F3n detallada del punto de referencia\"\n ></textarea>\n </mat-form-field>\n </div>\n </div>\n </acp-mat-dynamic-card>\n </div>\n </div>\n </div>\n </mat-tab>\n </mat-tab-group>\n </form>\n</mat-dialog-content>\n<mat-dialog-actions>\n <acp-mat-theme-button type=\"submit\" form=\"formCompanyCustomer\" [text]=\"btnText()\" />\n<<<<<<<< HEAD:projects/acontplus-ui-components/src/lib/customers-ui/client/client-add-edit/client-add-edit.component.html\n <acp-mat-theme-button type=\"button\" variant=\"dark\" text=\"Cerrar\" (handleClick)=\"close()\" />\n========\n>>>>>>>> e8b4dd251833a4e8d200bdc036806a3191730767:packages/ng-customer/src/lib/ui/components/customer-add-edit/customer-add-edit.component.html\n</mat-dialog-actions>\n", styles: [""], dependencies: [{ kind: "directive", type: MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i2.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "ngmodule", type: MatTabsModule }, { kind: "component", type: i3.MatTab, selector: "mat-tab", inputs: ["disabled", "label", "aria-label", "aria-labelledby", "labelClass", "bodyClass", "id"], exportAs: ["matTab"] }, { kind: "component", type: i3.MatTabGroup, selector: "mat-tab-group", inputs: ["color", "fitInkBarToContent", "mat-stretch-tabs", "mat-align-tabs", "dynamicHeight", "selectedIndex", "headerPosition", "animationDuration", "contentTabIndex", "disablePagination", "disableRipple", "preserveContent", "backgroundColor", "aria-label", "aria-labelledby"], outputs: ["selectedIndexChange", "focusChange", "animationDone", "selectedTabChange"], exportAs: ["matTabGroup"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i4.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4.MatLabel, selector: "mat-label" }, { kind: "directive", type: i4.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i4.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i4.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i5.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i6.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "component", type: i6.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "component", type: i6.MatOptgroup, selector: "mat-optgroup", inputs: ["label", "disabled"], exportAs: ["matOptgroup"] }, { kind: "ngmodule", type: MatSlideToggleModule }, { kind: "component", type: i7.MatSlideToggle, selector: "mat-slide-toggle", inputs: ["name", "id", "labelPosition", "aria-label", "aria-labelledby", "aria-describedby", "required", "color", "disabled", "disableRipple", "tabIndex", "checked", "hideIcon", "disabledInteractive"], outputs: ["change", "toggleChange"], exportAs: ["matSlideToggle"] }, { kind: "component", type: MatInputChipComponent, selector: "acp-mat-input-chip", inputs: ["chips", "labelText", "placelholder"] }, { kind: "directive", type: ToUpperCaseDirective, selector: "[acpToUpperCase]" }, { kind: "component", type: MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatDatepickerModule }, { kind: "component", type: i8.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i8.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i8.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "component", type: MatThemeButtonComponent, selector: "acp-mat-theme-button", inputs: ["variant", "text", "icon", "outlined", "disabled", "useThemeColor", "type", "matStyle", "title", "ariaLabel", "name", "id", "form", "tabIndex", "testId"], outputs: ["handleClick"] }, { kind: "component", type: MatDynamicCardComponent, selector: "acp-mat-dynamic-card", inputs: ["cardTitle", "cardSubtitle", "avatarImageUrl", "isHeaderVisible", "contentPadding", "hasDivider", "areActionsVisible", "primaryButtonText", "secondaryButtonText", "primaryButtonIcon", "secondaryButtonIcon", "buttonsPosition"], outputs: ["primaryButtonClicked", "secondaryButtonClicked", "cardClicked"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
822
+ }
823
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: CustomerAddEditComponent, decorators: [{
824
+ type: Component,
825
+ args: [{ selector: 'acp-customer-add-edit', imports: [
826
+ MatDialogContent,
827
+ MatDialogActions,
828
+ MatButtonModule,
829
+ ReactiveFormsModule,
830
+ MatTabsModule,
831
+ MatFormFieldModule,
832
+ MatInputModule,
833
+ MatSelectModule,
834
+ MatSlideToggleModule,
835
+ MatInputChipComponent,
836
+ ToUpperCaseDirective,
837
+ MatCheckbox,
838
+ MatIcon,
839
+ MatTooltip,
840
+ MatDatepickerModule,
841
+ MatThemeButtonComponent,
842
+ MatDynamicCardComponent,
843
+ ], providers: [
844
+ provideNativeDateAdapter(),
845
+ {
846
+ provide: CustomerUseCase,
847
+ useFactory: () => new CustomerUseCase(new CustomerHttpRepository()),
848
+ },
849
+ {
850
+ provide: CustomerExternalUseCase,
851
+ useFactory: () => new CustomerExternalUseCase(new CustomerExternalHttpRepository()),
852
+ },
853
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<mat-dialog-content>\n <form\n (ngSubmit)=\"onSave()\"\n id=\"formCompanyCustomer\"\n [formGroup]=\"customerForm\"\n autocomplete=\"off\"\n >\n <mat-tab-group>\n <mat-tab label=\"DATOS PRINCIPALES\">\n <div class=\"d-grid gap-2 mx-3 mt-2\">\n <div\n class=\"row row-cols-xxl-2 row-cols-xl-2 row-cols-lg-2 row-cols-md-2 row-cols-sm-2 row-cols-1 g-1\"\n >\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>Tipo Identificaci\u00F3n: </mat-label>\n <mat-select\n formControlName=\"idTipoIdentificacion\"\n (selectionChange)=\"identificationTypeChange($event)\"\n >\n @for (item of tiposIdentificacion(); track $index) {\n <mat-option [value]=\"item.idTipoIdentificacion\">{{\n item.descripcion\n }}</mat-option>\n }\n </mat-select>\n </mat-form-field>\n </div>\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>N\u00FAmero de Identificaci\u00F3n</mat-label>\n <input\n type=\"text\"\n matInput\n (keydown.enter)=\"onKeyDownGovernmentId($event)\"\n formControlName=\"numeroIdentificacion\"\n />\n @if (\n numeroIdentificacionControl?.invalid &&\n (numeroIdentificacionControl?.dirty || numeroIdentificacionControl?.touched)\n ) {\n @if (numeroIdentificacionControl?.hasError('required')) {\n <mat-error> El n\u00FAmero de identificaci\u00F3n es obligatorio. </mat-error>\n }\n\n @if (numeroIdentificacionControl?.hasError('minlength')) {\n <mat-error>\n Debe tener al menos\n {{ numeroIdentificacionControl?.errors?.['minlength'].requiredLength }}\n d\u00EDgitos.\n </mat-error>\n }\n @if (numeroIdentificacionControl?.hasError('maxlength')) {\n <mat-error>\n No puede tener m\u00E1s de\n {{ numeroIdentificacionControl?.errors?.['maxlength'].requiredLength }}\n d\u00EDgitos.\n </mat-error>\n }\n @if (numeroIdentificacionControl?.hasError('pattern')) {\n <mat-error> Solo se permiten caracteres num\u00E9ricos. </mat-error>\n }\n @if (numeroIdentificacionControl?.hasError('endsWith001')) {\n <mat-error> Los \u00FAltimos tres d\u00EDgitos deben ser 001. </mat-error>\n }\n }\n\n @if (showRefresh()) {\n <ng-container matSuffix>\n <button type=\"button\" mat-icon-button (click)=\"onKeyDownGovernmentId($event)\">\n <mat-icon>refresh</mat-icon>\n </button>\n </ng-container>\n }\n </mat-form-field>\n </div>\n </div>\n\n <div\n class=\"row row-cols-xxl-2 row-cols-xl-2 row-cols-lg-2 row-cols-md-2 row-cols-sm-2 row-cols-1 g-1\"\n >\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>Nombre Fiscal:</mat-label>\n <input\n matInput\n autocomplete=\"off\"\n formControlName=\"nombreFiscal\"\n id=\"nombreComercial\"\n placeholder=\"Ej: TECNOMEGA\"\n acpToUpperCase\n />\n </mat-form-field>\n </div>\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>Nombre Comercial:</mat-label>\n <input\n matInput\n autocomplete=\"off\"\n formControlName=\"nombreComercial\"\n placeholder=\"Ej: TECNOMEGA\"\n acpToUpperCase\n type=\"text\"\n />\n </mat-form-field>\n </div>\n </div>\n\n <div>\n <mat-form-field class=\"w-100\">\n <mat-label>Direcci\u00F3n:</mat-label>\n <input\n matInput\n formControlName=\"direccion\"\n placeholder=\"AV. 09 DE OCTUBRE...\"\n acpToUpperCase\n />\n </mat-form-field>\n </div>\n\n <div\n class=\"row row-cols-xxl-2 row-cols-xl-2 row-cols-lg-2 row-cols-md-2 row-cols-sm-2 row-cols-1 g-1\"\n >\n <div class=\"col\">\n <acp-mat-input-chip [chips]=\"emails\" [labelText]=\"'Correo'\" />\n </div>\n <div class=\"col\">\n <acp-mat-input-chip [chips]=\"telephones\" [labelText]=\"'Tel\u00E9fono'\" />\n </div>\n </div>\n\n @if (isUpdate()) {\n <div class=\"vstack gap-2 mt-2\">\n <span>Estado</span>\n <mat-slide-toggle formControlName=\"estado\">\n {{ customerForm.value.estado ? 'Activo' : 'Inactivo' }}\n </mat-slide-toggle>\n </div>\n }\n </div>\n </mat-tab>\n <mat-tab label=\"DATOS ADICIONALES\">\n <div class=\"d-grid gap-2 mx-3 mt-2\">\n <div\n class=\"row row-cols-xxl-2 row-cols-xl-2 row-cols-lg-2 row-cols-md-2 row-cols-sm-2 row-cols-1 g-1\"\n >\n <div class=\"col\">\n <acp-mat-dynamic-card title=\"Informaci\u00F3n B\u00E1sica\" [isHeaderVisible]=\"true\">\n <div\n class=\"row row-cols-xxl-2 row-cols-xl-2 row-cols-lg-2 row-cols-md-2 row-cols-sm-2 row-cols-1 g-2\"\n >\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>Tipo Contribuyente: </mat-label>\n <mat-select formControlName=\"idSubContribuyente\">\n @for (item of tipoContribuyentes(); track $index) {\n <mat-option [value]=\"item.idSubContribuyente\">\n {{ item.descripcion }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n </div>\n\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>Tiempo Cr\u00E9dito: </mat-label>\n <mat-select formControlName=\"idTiempoCredito\">\n @for (item of tiemposCredito(); track $index) {\n <mat-option [value]=\"item.idTiempoCredito\">\n {{ item.descripcion }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n </div>\n\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>Ciudad</mat-label>\n <mat-select formControlName=\"idCiudad\">\n <mat-option [value]=\"0\">-- Ninguno --</mat-option>\n @for (group of ciudades(); track $index) {\n <mat-optgroup [label]=\"group.nombre\">\n @for (item of group.ciudades; track $index) {\n <mat-option [value]=\"item.idCiudad\">{{ item.nombre }}</mat-option>\n }\n </mat-optgroup>\n }\n </mat-select>\n </mat-form-field>\n </div>\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>Tipo Cliente: </mat-label>\n <mat-select formControlName=\"idTipoClienteProveedor\">\n <mat-option [value]=\"0\">--Ninguno--</mat-option>\n @for (item of tiposCliente(); track $index) {\n <mat-option [value]=\"item.idTipoClienteProveedor\">\n {{ item.descripcion }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n </div>\n\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>Empresa: </mat-label>\n <mat-select formControlName=\"idEmpresa\">\n <mat-option [value]=\"0\">--Ninguno--</mat-option>\n\n @for (item of empresas(); track $index) {\n <mat-option [value]=\"item.idEmpresa\">\n {{ item.descripcion }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n </div>\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>Fecha Nacimiento</mat-label>\n <input matInput [matDatepicker]=\"birthDate\" formControlName=\"birthDate\" />\n <mat-hint>MM/DD/YYYY</mat-hint>\n <mat-datepicker-toggle\n matIconSuffix\n [for]=\"birthDate\"\n ></mat-datepicker-toggle>\n <mat-datepicker #birthDate></mat-datepicker>\n @if (birthDateCtrl?.invalid && birthDateCtrl?.touched) {\n <mat-error> Fecha inv\u00E1lida </mat-error>\n }\n </mat-form-field>\n </div>\n </div>\n </acp-mat-dynamic-card>\n </div>\n <div class=\"col\">\n <acp-mat-dynamic-card title=\"Informaci\u00F3n Laboral\" [isHeaderVisible]=\"true\">\n <div\n class=\"row row-cols-xxl-2 row-cols-xl-2 row-cols-lg-2 row-cols-md-2 row-cols-sm-2 row-cols-1 g-1\"\n >\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>Empleado: </mat-label>\n <mat-select formControlName=\"idEmpleado\">\n <mat-option [value]=\"0\">--Ninguno--</mat-option>\n\n @for (item of employees(); track $index) {\n <mat-option [value]=\"item.idEmpleado\">\n {{ item.nombreCompleto }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n </div>\n\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>Cargo: </mat-label>\n <mat-select formControlName=\"idCargo\">\n <mat-option [value]=\"0\">--Ninguno--</mat-option>\n\n @for (item of cargos(); track $index) {\n <mat-option [value]=\"item.idCargo\">\n {{ item.descripcion }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n </div>\n\n <div class=\"col w-100\">\n <mat-form-field class=\"w-100\">\n <mat-label>Observaci\u00F3n</mat-label>\n <textarea matInput placeholder=\"...\" formControlName=\"nota\"></textarea>\n </mat-form-field>\n </div>\n </div>\n </acp-mat-dynamic-card>\n </div>\n </div>\n <div\n class=\"row row-cols-xxl-2 row-cols-xl-2 row-cols-lg-2 row-cols-md-2 row-cols-sm-2 row-cols-1 g-1\"\n >\n <div class=\"col\">\n <acp-mat-dynamic-card title=\"Configuraci\u00F3n Financiera\" [isHeaderVisible]=\"true\">\n <div\n class=\"row row-cols-xxl-1 row-cols-xl-1 row-cols-lg-1 row-cols-md-1 row-cols-sm-1 row-cols-1 g-2 mt-2\"\n >\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>Forma de pago: </mat-label>\n <mat-select formControlName=\"idFormaPagoSri\">\n <mat-option [value]=\"0\">--Ninguno--</mat-option>\n\n @for (item of formasPagoSri(); track $index) {\n <mat-option [value]=\"item.idFormaPagoSri\">\n {{ item.descripcion }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n </div>\n\n <div class=\"col\">\n <acp-mat-input-chip labelText=\"Placa\" [chips]=\"placas()\" />\n </div>\n\n <div class=\"col w-100\">\n <mat-checkbox formControlName=\"configValorBruto\"\n >Activar configuraci\u00F3n de valor bruto\n <mat-icon\n matTooltip=\"valor total de un bien o servicio sin incluir impuestos, deducciones o descuentos (uso dentro del reporte)\"\n >info</mat-icon\n ></mat-checkbox\n >\n </div>\n </div>\n </acp-mat-dynamic-card>\n </div>\n <div class=\"col\"></div>\n </div>\n </div>\n </mat-tab>\n <mat-tab label=\"INFORMACI\u00D3N CREDITICIA\">\n <div class=\"d-grid gap-2 mx-3 mt-2\">\n <div\n class=\"row row-cols-xxl-2 row-cols-xl-2 row-cols-lg-2 row-cols-md-2 row-cols-sm-2 row-cols-1 g-1\"\n >\n <div class=\"col\">\n <acp-mat-dynamic-card title=\"Informaci\u00F3n Personal\" [isHeaderVisible]=\"true\">\n <div\n formGroupName=\"dataInfoCred\"\n class=\"row row-cols-xxl-2 row-cols-xl-2 row-cols-lg-2 row-cols-md-2 row-cols-sm-1 row-cols-1 g-2 mt-2\"\n >\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>Estado Civil: </mat-label>\n <mat-select formControlName=\"maritalStatusId\">\n <mat-option [value]=\"0\">Seleccionar...</mat-option>\n\n @for (item of maritalStatuses(); track $index) {\n <mat-option [value]=\"item.id\">\n {{ item.name }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n </div>\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>Esposo(a):</mat-label>\n <input\n matInput\n formControlName=\"conyugeNombre\"\n placeholder=\"Nombre del c\u00F3nyuge\"\n />\n </mat-form-field>\n </div>\n\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>Tel\u00E9fono Personal:</mat-label>\n <input matInput formControlName=\"conyugeTel\" placeholder=\"09xxxxxxxx\" />\n </mat-form-field>\n </div>\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>Tel\u00E9fono Referencia:</mat-label>\n <input matInput formControlName=\"refFamTel\" placeholder=\"09xxxxxxxx\" />\n </mat-form-field>\n </div>\n <div class=\"col w-100\">\n <mat-form-field class=\"w-100\">\n <mat-label>Referencia Familiar:</mat-label>\n <input\n matInput\n formControlName=\"refFamNombre\"\n placeholder=\"Nombre de referencia familiar\"\n />\n </mat-form-field>\n </div>\n </div>\n </acp-mat-dynamic-card>\n </div>\n <div class=\"col\">\n <acp-mat-dynamic-card title=\"Informaci\u00F3n de Vivienda\" [isHeaderVisible]=\"true\">\n <div\n formGroupName=\"dataInfoCred\"\n class=\"row row-cols-xxl-2 row-cols-xl-2 row-cols-lg-2 row-cols-md-2 row-cols-sm-1 row-cols-1 g-2 mt-2\"\n >\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>Tipo de Vivienda: </mat-label>\n <mat-select formControlName=\"housingTypeId\">\n <mat-option [value]=\"0\">Seleccionar...</mat-option>\n\n @for (item of housingTypes(); track $index) {\n <mat-option [value]=\"item.id\">\n {{ item.name }}\n </mat-option>\n }\n </mat-select>\n </mat-form-field>\n </div>\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>Sector:</mat-label>\n <input matInput formControlName=\"sector\" placeholder=\"Nombre del sector\" />\n </mat-form-field>\n </div>\n\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>Barrio:</mat-label>\n <input matInput formControlName=\"barrio\" placeholder=\"Nombre del barrio\" />\n </mat-form-field>\n </div>\n <div class=\"col\">\n <mat-form-field class=\"w-100\">\n <mat-label>Calle:</mat-label>\n <input matInput formControlName=\"calle\" placeholder=\"Nombre de la calle\" />\n </mat-form-field>\n </div>\n <div class=\"col w-100\">\n <mat-form-field class=\"w-100\">\n <mat-label>Direcci\u00F3n Completa</mat-label>\n <textarea\n matInput\n formControlName=\"dirVivienda\"\n placeholder=\"Direcci\u00F3n completa de la vivienda (Sector, Barrio y Calle)\"\n ></textarea>\n </mat-form-field>\n </div>\n <div class=\"col w-100\">\n <mat-form-field class=\"w-100\">\n <mat-label>Descripci\u00F3n del Punto de Referencia:</mat-label>\n <textarea\n matInput\n formControlName=\"refDomicilio\"\n placeholder=\"Descripci\u00F3n detallada del punto de referencia\"\n ></textarea>\n </mat-form-field>\n </div>\n </div>\n </acp-mat-dynamic-card>\n </div>\n </div>\n </div>\n </mat-tab>\n </mat-tab-group>\n </form>\n</mat-dialog-content>\n<mat-dialog-actions>\n <acp-mat-theme-button type=\"submit\" form=\"formCompanyCustomer\" [text]=\"btnText()\" />\n<<<<<<<< HEAD:projects/acontplus-ui-components/src/lib/customers-ui/client/client-add-edit/client-add-edit.component.html\n <acp-mat-theme-button type=\"button\" variant=\"dark\" text=\"Cerrar\" (handleClick)=\"close()\" />\n========\n>>>>>>>> e8b4dd251833a4e8d200bdc036806a3191730767:packages/ng-customer/src/lib/ui/components/customer-add-edit/customer-add-edit.component.html\n</mat-dialog-actions>\n" }]
854
+ }] });
855
+
856
+ class CustomerCardComponent {
857
+ customer = input.required(...(ngDevMode ? [{ debugName: "customer" }] : []));
858
+ editCustomer = output();
859
+ deleteCustomer = output();
860
+ getLogoSliceBusinessName = computed(() => {
861
+ const name = this.customer()?.businessName || '';
862
+ return name.slice(0, 1);
863
+ }, ...(ngDevMode ? [{ debugName: "getLogoSliceBusinessName" }] : []));
864
+ onEditClick() {
865
+ // Emits the customer object to the parent component
866
+ this.editCustomer.emit(this.customer());
867
+ }
868
+ onDeleteClick() {
869
+ // Emits the customer object to the parent component
870
+ this.deleteCustomer.emit(this.customer());
871
+ }
872
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: CustomerCardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
873
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.1", type: CustomerCardComponent, isStandalone: true, selector: "acp-customer-card", inputs: { customer: { classPropertyName: "customer", publicName: "customer", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { editCustomer: "editCustomer", deleteCustomer: "deleteCustomer" }, ngImport: i0, template: "<mat-card class=\"customer-card\">\n <!-- Header -->\n <div class=\"card-header\">\n <div class=\"avatar\" aria-label=\"Logo de cliente\">{{ getLogoSliceBusinessName() }}</div>\n <h5 class=\"businessName\">{{ customer().businessName }}</h5>\n <p class=\"tradeName\">{{ customer().tradeName }}</p>\n </div>\n\n <!-- Card content -->\n <mat-card-content>\n <div class=\"info\">\n <p><strong>ID:</strong> 1234567890 (RUC)</p>\n <p><strong>Email:</strong> {{ customer().email }}</p>\n <p><strong>Tel\u00E9fono:</strong> {{ customer().phone }}</p>\n <p><strong>Direcci\u00F3n:</strong>{{ customer().address }}</p>\n\n <div class=\"chips\">\n <mat-chip-set>\n <mat-chip color=\"primary\">{{ customer().statusName }}</mat-chip>\n </mat-chip-set>\n </div>\n </div>\n </mat-card-content>\n\n <!-- Card actions -->\n @if (!customer().isFinalConsumer) {\n <mat-card-actions class=\"actions gap-2\">\n <acp-mat-theme-button matStyle=\"icon\" icon=\"edit\" (handleClick)=\"onEditClick()\" />\n <acp-mat-theme-button\n matStyle=\"icon\"\n icon=\"delete\"\n variant=\"danger\"\n (handleClick)=\"onDeleteClick()\"\n />\n </mat-card-actions>\n }\n</mat-card>\n", styles: [".customer-card{width:345px;border-radius:16px}.card-header{display:flex;flex-direction:column;align-items:center;padding:16px;background-color:#e3f2fd;border-top-left-radius:16px;border-top-right-radius:16px}.card-header .businessName{text-align:center;font-size:14px;font-weight:500}.card-header .tradeName{text-align:center;font-size:12px;color:#6c757d}.avatar{width:80px;height:80px;border-radius:50%;background-color:#1976d2;display:flex;justify-content:center;align-items:center;font-size:32px;color:#fff;margin-bottom:12px}.info p{margin:4px 0}.chips{margin-top:12px;display:flex;gap:8px}.actions{justify-content:flex-end;padding:16px}\n"], dependencies: [{ kind: "ngmodule", type: MatCardModule }, { kind: "component", type: i1$1.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i1$1.MatCardActions, selector: "mat-card-actions", inputs: ["align"], exportAs: ["matCardActions"] }, { kind: "directive", type: i1$1.MatCardContent, selector: "mat-card-content" }, { kind: "ngmodule", type: MatDividerModule }, { kind: "ngmodule", type: MatChipsModule }, { kind: "component", type: i2$1.MatChip, selector: "mat-basic-chip, [mat-basic-chip], mat-chip, [mat-chip]", inputs: ["role", "id", "aria-label", "aria-description", "value", "color", "removable", "highlighted", "disableRipple", "disabled"], outputs: ["removed", "destroyed"], exportAs: ["matChip"] }, { kind: "component", type: i2$1.MatChipSet, selector: "mat-chip-set", inputs: ["disabled", "role", "tabIndex"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: MatThemeButtonComponent, selector: "acp-mat-theme-button", inputs: ["variant", "text", "icon", "outlined", "disabled", "useThemeColor", "type", "matStyle", "title", "ariaLabel", "name", "id", "form", "tabIndex", "testId"], outputs: ["handleClick"] }] });
874
+ }
875
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.1", ngImport: i0, type: CustomerCardComponent, decorators: [{
876
+ type: Component,
877
+ args: [{ selector: 'acp-customer-card', imports: [
878
+ MatCardModule,
879
+ MatDividerModule,
880
+ MatChipsModule,
881
+ MatButtonModule,
882
+ MatThemeButtonComponent,
883
+ ], template: "<mat-card class=\"customer-card\">\n <!-- Header -->\n <div class=\"card-header\">\n <div class=\"avatar\" aria-label=\"Logo de cliente\">{{ getLogoSliceBusinessName() }}</div>\n <h5 class=\"businessName\">{{ customer().businessName }}</h5>\n <p class=\"tradeName\">{{ customer().tradeName }}</p>\n </div>\n\n <!-- Card content -->\n <mat-card-content>\n <div class=\"info\">\n <p><strong>ID:</strong> 1234567890 (RUC)</p>\n <p><strong>Email:</strong> {{ customer().email }}</p>\n <p><strong>Tel\u00E9fono:</strong> {{ customer().phone }}</p>\n <p><strong>Direcci\u00F3n:</strong>{{ customer().address }}</p>\n\n <div class=\"chips\">\n <mat-chip-set>\n <mat-chip color=\"primary\">{{ customer().statusName }}</mat-chip>\n </mat-chip-set>\n </div>\n </div>\n </mat-card-content>\n\n <!-- Card actions -->\n @if (!customer().isFinalConsumer) {\n <mat-card-actions class=\"actions gap-2\">\n <acp-mat-theme-button matStyle=\"icon\" icon=\"edit\" (handleClick)=\"onEditClick()\" />\n <acp-mat-theme-button\n matStyle=\"icon\"\n icon=\"delete\"\n variant=\"danger\"\n (handleClick)=\"onDeleteClick()\"\n />\n </mat-card-actions>\n }\n</mat-card>\n", styles: [".customer-card{width:345px;border-radius:16px}.card-header{display:flex;flex-direction:column;align-items:center;padding:16px;background-color:#e3f2fd;border-top-left-radius:16px;border-top-right-radius:16px}.card-header .businessName{text-align:center;font-size:14px;font-weight:500}.card-header .tradeName{text-align:center;font-size:12px;color:#6c757d}.avatar{width:80px;height:80px;border-radius:50%;background-color:#1976d2;display:flex;justify-content:center;align-items:center;font-size:32px;color:#fff;margin-bottom:12px}.info p{margin:4px 0}.chips{margin-top:12px;display:flex;gap:8px}.actions{justify-content:flex-end;padding:16px}\n"] }]
884
+ }] });
885
+
886
+ /**
887
+ * Generated bundle index. Do not edit.
888
+ */
889
+
890
+ export { CUSTOMER_API, CompanySearchMapper, CustomerAddEditComponent, CustomerCardComponent, CustomerCreateUpdateMapper, CustomerExternalHttpRepository, CustomerExternalUseCase, CustomerFormDataMapper, CustomerGetByIdMapper, CustomerHttpRepository, CustomerUseCase, ListCustomerMapper };
891
+ //# sourceMappingURL=acontplus-ng-customer.mjs.map