@sfinges/sf-solicitud 0.1.7 → 0.3.0

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.
@@ -1,33 +1,37 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, inject, DestroyRef, input, computed, signal, effect, untracked, Component, output } from '@angular/core';
3
- import * as i1 from '@angular/common';
2
+ import { InjectionToken, inject, DestroyRef, Injector, input, output, signal, computed, afterNextRender, Component, effect, untracked } from '@angular/core';
3
+ import * as i1$1 from '@angular/common';
4
4
  import { registerLocaleData, CommonModule } from '@angular/common';
5
5
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
6
- import * as i3 from 'primeng/button';
6
+ import * as i2 from 'primeng/button';
7
7
  import { ButtonModule } from 'primeng/button';
8
8
  import * as i3$1 from 'primeng/card';
9
9
  import { CardModule } from 'primeng/card';
10
- import * as i4 from 'primeng/message';
10
+ import * as i7 from 'primeng/message';
11
11
  import { MessageModule } from 'primeng/message';
12
- import * as i5 from 'primeng/skeleton';
12
+ import * as i5$1 from 'primeng/skeleton';
13
13
  import { SkeletonModule } from 'primeng/skeleton';
14
- import * as i6 from 'primeng/table';
14
+ import * as i6$1 from 'primeng/table';
15
15
  import { TableModule } from 'primeng/table';
16
- import * as i7 from 'primeng/tag';
16
+ import * as i7$1 from 'primeng/tag';
17
17
  import { TagModule } from 'primeng/tag';
18
- import localeEsCO from '@angular/common/locales/es-CO';
19
- import * as i2 from '@angular/forms';
20
- import { FormsModule } from '@angular/forms';
21
- import * as i4$1 from 'primeng/checkbox';
18
+ import * as i8$1 from 'primeng/tooltip';
19
+ import { TooltipModule } from 'primeng/tooltip';
20
+ import * as i1 from '@angular/forms';
21
+ import { FormGroup, FormControl, Validators, ReactiveFormsModule, FormsModule } from '@angular/forms';
22
+ import * as i3 from 'primeng/checkbox';
22
23
  import { CheckboxModule } from 'primeng/checkbox';
23
- import * as i5$1 from 'primeng/dialog';
24
+ import * as i4 from 'primeng/datepicker';
25
+ import { DatePickerModule } from 'primeng/datepicker';
26
+ import * as i5 from 'primeng/dialog';
24
27
  import { DialogModule } from 'primeng/dialog';
25
- import * as i6$1 from 'primeng/inputnumber';
26
- import { InputNumberModule } from 'primeng/inputnumber';
28
+ import * as i6 from 'primeng/inputtext';
29
+ import { InputTextModule } from 'primeng/inputtext';
27
30
  import * as i8 from 'primeng/select';
28
31
  import { SelectModule } from 'primeng/select';
29
- import * as i12 from 'primeng/tooltip';
30
- import { TooltipModule } from 'primeng/tooltip';
32
+ import localeEsCO from '@angular/common/locales/es-CO';
33
+ import * as i6$2 from 'primeng/inputnumber';
34
+ import { InputNumberModule } from 'primeng/inputnumber';
31
35
 
32
36
  /**
33
37
  * Modelos de una solicitud de crédito como los pintan los componentes de sf-solicitud. Los hosts los arman con lo que
@@ -36,6 +40,455 @@ import { TooltipModule } from 'primeng/tooltip';
36
40
 
37
41
  const APPLICATION_PERSON_SERVICE = new InjectionToken('APPLICATION_PERSON_SERVICE');
38
42
 
43
+ /** Los mismos patrones y largos que valida PeopleService (PersonEditValidator): lo inválido no sale del formulario. */
44
+ const EMAIL = /^[^@\s]+@[^@\s]+\.[^@\s]+$/;
45
+ const PHONE = /^\+?[0-9][0-9 -]{5,18}[0-9]$/;
46
+ const ACCOUNT_NUMBER = /^[0-9][0-9-]{2,18}[0-9]$/;
47
+ /** El correo principal también queda en Personas.Email, varchar(50). */
48
+ const EMAIL_MAX = 50;
49
+ const CONTACT_TYPES = [
50
+ { value: 'MOVIL', label: 'Celular' },
51
+ { value: 'CORREO', label: 'Correo' },
52
+ { value: 'TELEFONO', label: 'Teléfono' },
53
+ { value: 'OTRO', label: 'Otro' }
54
+ ];
55
+ /**
56
+ * El id (sin el prefijo del diálogo) del elemento enfocable de cada control, en el orden en que se ven: así el foco va
57
+ * al primer campo inválido. Un `p-select` o `p-datepicker` enfoca su `inputId`.
58
+ */
59
+ const FIELD_IDS = {
60
+ data: {
61
+ firstName: 'fn',
62
+ secondName: 'sn',
63
+ lastName: 'ln',
64
+ secondLastName: 'sln',
65
+ gender: 'gender',
66
+ maritalStatus: 'marital',
67
+ birthDate: 'bdate',
68
+ birthPlace: 'bplace',
69
+ documentIssueDate: 'idate',
70
+ documentIssuePlace: 'iplace'
71
+ },
72
+ contact: { type: 'ctype', value: 'cvalue', description: 'cdesc', primary: 'cprimary' },
73
+ address: { addressType: 'atype', line1: 'line1', line2: 'line2', cityCode: 'city', neighborhood: 'hood', phone: 'aphone' },
74
+ account: { bankId: 'bank', accountTypeId: 'atype2', number: 'number', primary: 'aprimary' }
75
+ };
76
+ /** El patrón y el largo del valor del contacto según su tipo. */
77
+ function contactValue(type) {
78
+ return (control) => {
79
+ const value = text(control.value);
80
+ if (!value)
81
+ return null;
82
+ if (type() === 'CORREO') {
83
+ if (value.length > EMAIL_MAX)
84
+ return { maxlength: { requiredLength: EMAIL_MAX } };
85
+ return EMAIL.test(value) ? null : { email: true };
86
+ }
87
+ if (type() === 'MOVIL' || type() === 'TELEFONO')
88
+ return PHONE.test(value) ? null : { phone: true };
89
+ return null;
90
+ };
91
+ }
92
+ /** El texto de un control, sin espacios. Un `p-select` limpiado deja `null`, no ''. */
93
+ function text(value) {
94
+ return value == null ? '' : String(value).trim();
95
+ }
96
+ let nextId$2 = 0;
97
+ /**
98
+ * El diálogo de edición de `lib-application-person`. Arma el formulario de lo que se edita, valida en cada campo y
99
+ * guarda por el puerto. No se cierra mientras guarda. Al terminar emite `saved` con `saved` o `uncertain`: en los dos
100
+ * casos el padre recarga la persona; con `uncertain` además avisa que revise antes de repetir, porque agregar no es
101
+ * idempotente. Una cuenta bancaria pide confirmación con el resumen antes de guardar: cambia a dónde va el dinero.
102
+ */
103
+ class PersonEditDialogComponent {
104
+ gateway = inject(APPLICATION_PERSON_SERVICE);
105
+ destroyRef = inject(DestroyRef);
106
+ injector = inject(Injector);
107
+ target = input.required();
108
+ documentType = input.required();
109
+ documentNumber = input.required();
110
+ /** El nombre de la persona, para que quede claro a quién se edita. */
111
+ personName = input('');
112
+ options = input({});
113
+ /** Si las listas todavía cargan o fallaron: mientras tanto, los campos de lista se piden como texto. */
114
+ optionsState = input('ready');
115
+ saved = output();
116
+ closed = output();
117
+ /** Volver a pedir las listas que fallaron. */
118
+ retryOptions = output();
119
+ id = `sfs-edit-${++nextId$2}`;
120
+ visible = signal(true);
121
+ saving = signal(false);
122
+ /** Por qué no se guardó (un 4xx), para mostrarlo arriba de los botones. */
123
+ error = signal(null);
124
+ /** La cuenta está lista y se muestra el resumen para confirmarla. */
125
+ confirming = signal(false);
126
+ /**
127
+ * El contacto ya es el principal de su tipo. No se puede desmarcar: el principal se cambia marcando otro, y el
128
+ * servicio rechaza dejar el tipo sin principal (el correo y el celular principales son también los de la persona).
129
+ */
130
+ primaryLocked = signal(false);
131
+ contactTypes = CONTACT_TYPES;
132
+ emailMax = EMAIL_MAX;
133
+ /** Las fechas de nacimiento y expedición no pueden ser futuras. */
134
+ today = new Date();
135
+ isNew = computed(() => this.target().kind !== 'data' && !this.target().item);
136
+ header = computed(() => {
137
+ const t = this.target();
138
+ const verb = t.kind === 'data' ? 'Editar' : this.isNew() ? 'Agregar' : 'Editar';
139
+ const what = { data: 'datos básicos', contact: 'contacto', address: 'dirección', account: 'cuenta' }[t.kind];
140
+ return `${verb} ${what}`;
141
+ });
142
+ saveLabel = computed(() => {
143
+ if (this.target().kind === 'account')
144
+ return this.confirming() ? 'Confirmar y guardar cuenta' : 'Revisar cuenta';
145
+ return this.isNew() ? 'Agregar' : 'Guardar cambios';
146
+ });
147
+ // Un formulario por tipo; solo se usa el del target. Los textos arrancan en '', pero un p-select limpiado deja null:
148
+ // por eso los valores se leen con text().
149
+ dataForm = new FormGroup({
150
+ firstName: new FormControl('', { nonNullable: true, validators: [Validators.required, Validators.maxLength(50)] }),
151
+ secondName: new FormControl('', { nonNullable: true, validators: [Validators.maxLength(50)] }),
152
+ lastName: new FormControl('', { nonNullable: true, validators: [Validators.required, Validators.maxLength(50)] }),
153
+ secondLastName: new FormControl('', { nonNullable: true, validators: [Validators.maxLength(50)] }),
154
+ gender: new FormControl(''),
155
+ maritalStatus: new FormControl(''),
156
+ birthDate: new FormControl(null),
157
+ birthPlace: new FormControl('', { validators: [Validators.maxLength(50)] }),
158
+ documentIssueDate: new FormControl(null),
159
+ documentIssuePlace: new FormControl('', { validators: [Validators.maxLength(20)] })
160
+ });
161
+ /** Aparte, porque el validador del valor depende del tipo. */
162
+ contactType = new FormControl('MOVIL', { nonNullable: true, validators: [Validators.required] });
163
+ contactForm = new FormGroup({
164
+ type: this.contactType,
165
+ description: new FormControl('', { nonNullable: true, validators: [Validators.maxLength(50)] }),
166
+ value: new FormControl('', {
167
+ nonNullable: true,
168
+ validators: [Validators.required, Validators.maxLength(100), contactValue(() => this.contactType.value)]
169
+ }),
170
+ primary: new FormControl(false, { nonNullable: true })
171
+ });
172
+ addressForm = new FormGroup({
173
+ addressType: new FormControl('', { validators: [Validators.maxLength(10)] }),
174
+ line1: new FormControl('', { nonNullable: true, validators: [Validators.required, Validators.maxLength(150)] }),
175
+ line2: new FormControl('', { nonNullable: true, validators: [Validators.maxLength(60)] }),
176
+ cityCode: new FormControl('', { validators: [Validators.required, Validators.maxLength(10)] }),
177
+ neighborhood: new FormControl('', { nonNullable: true, validators: [Validators.maxLength(50)] }),
178
+ phone: new FormControl('', { nonNullable: true, validators: [Validators.maxLength(50), Validators.pattern(PHONE)] })
179
+ });
180
+ accountForm = new FormGroup({
181
+ bankId: new FormControl('', { validators: [Validators.required, Validators.maxLength(4)] }),
182
+ accountTypeId: new FormControl(null, { validators: [Validators.required] }),
183
+ number: new FormControl('', { nonNullable: true, validators: [Validators.required, Validators.maxLength(20), Validators.pattern(ACCOUNT_NUMBER)] }),
184
+ primary: new FormControl(false, { nonNullable: true })
185
+ });
186
+ /** Los datos básicos como estaban al abrir: solo se mandan los que cambiaron. */
187
+ initialData = null;
188
+ /** El correo principal al abrir: si cambia, el usuario de la persona queda inactivo hasta validarlo. */
189
+ originalEmail = signal(null);
190
+ /** El resumen de la cuenta que se va a guardar, con el número enmascarado. */
191
+ accountSummary = computed(() => {
192
+ if (!this.confirming())
193
+ return '';
194
+ const v = this.accountForm.getRawValue();
195
+ const bank = this.labelOf(this.options().banks, text(v.bankId)) || `banco ${text(v.bankId)}`;
196
+ const type = this.labelOf(this.options().accountTypes, v.accountTypeId) || 'cuenta';
197
+ const digits = text(v.number).replace(/\D/g, '');
198
+ const action = this.isNew() ? 'Se agregará' : 'Quedará';
199
+ return `${action} la cuenta ${type.toLowerCase()} de ${bank} terminada en ${digits.slice(-4)}${v.primary ? ', como cuenta principal' : ''}.`;
200
+ });
201
+ ngOnInit() {
202
+ const t = this.target();
203
+ switch (t.kind) {
204
+ case 'data': {
205
+ const v = t.item ?? {};
206
+ this.dataForm.setValue({
207
+ firstName: v.firstName ?? '',
208
+ secondName: v.secondName ?? '',
209
+ lastName: v.lastName ?? '',
210
+ secondLastName: v.secondLastName ?? '',
211
+ gender: v.gender ?? '',
212
+ maritalStatus: v.maritalStatus ?? '',
213
+ birthDate: fromIso(v.birthDate),
214
+ birthPlace: v.birthPlace ?? '',
215
+ documentIssueDate: fromIso(v.documentIssueDate),
216
+ documentIssuePlace: v.documentIssuePlace ?? ''
217
+ });
218
+ this.initialData = this.dataValues();
219
+ break;
220
+ }
221
+ case 'contact': {
222
+ const c = t.item;
223
+ if (c) {
224
+ this.contactForm.setValue({
225
+ type: (c.type ?? 'OTRO').toUpperCase(),
226
+ description: c.description ?? '',
227
+ value: c.value ?? '',
228
+ primary: !!c.primary
229
+ });
230
+ // Corregir no cambia el tipo: un contacto de otro tipo es otro contacto.
231
+ this.contactType.disable();
232
+ if (c.primary) {
233
+ this.contactForm.controls.primary.disable();
234
+ this.primaryLocked.set(true);
235
+ }
236
+ if (c.primary && (c.type ?? '').toUpperCase() === 'CORREO')
237
+ this.originalEmail.set(text(c.value).toLowerCase());
238
+ }
239
+ // El valor depende del tipo: al cambiar el tipo se vuelve a validar.
240
+ this.contactType.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => this.contactForm.controls.value.updateValueAndValidity());
241
+ break;
242
+ }
243
+ case 'address': {
244
+ const a = t.item;
245
+ if (a) {
246
+ this.addressForm.setValue({
247
+ addressType: a.addressType ?? '',
248
+ line1: a.line1 ?? a.address ?? '',
249
+ line2: a.line2 ?? '',
250
+ cityCode: text(a.cityCode),
251
+ neighborhood: a.neighborhood ?? '',
252
+ phone: a.phone ?? ''
253
+ });
254
+ }
255
+ break;
256
+ }
257
+ case 'account': {
258
+ const a = t.item;
259
+ if (a) {
260
+ this.accountForm.setValue({
261
+ bankId: text(a.bankId),
262
+ accountTypeId: a.accountTypeId ?? null,
263
+ number: a.number ?? '',
264
+ primary: !!a.primary
265
+ });
266
+ }
267
+ // Cambiar algo después de ver el resumen obliga a revisarlo de nuevo.
268
+ this.accountForm.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)).subscribe(() => this.confirming.set(false));
269
+ break;
270
+ }
271
+ }
272
+ }
273
+ /** El formulario del target. */
274
+ form() {
275
+ switch (this.target().kind) {
276
+ case 'data':
277
+ return this.dataForm;
278
+ case 'contact':
279
+ return this.contactForm;
280
+ case 'address':
281
+ return this.addressForm;
282
+ case 'account':
283
+ return this.accountForm;
284
+ }
285
+ }
286
+ /** Lo que cambió de los datos básicos; vacío si nada. */
287
+ dataChanges() {
288
+ if (!this.initialData)
289
+ return {};
290
+ const now = this.dataValues();
291
+ const changes = {};
292
+ for (const key of Object.keys(now)) {
293
+ // Una fecha borrada no se manda: el servicio no quita fechas, y vacía la tomaría como "sin cambio".
294
+ if (now[key] !== this.initialData[key] && !(key.endsWith('Date') && !now[key]))
295
+ changes[key] = now[key];
296
+ }
297
+ return changes;
298
+ }
299
+ /** Si al guardar cambia el correo principal (aviso de que el usuario de la persona queda inactivo). */
300
+ changesPrimaryEmail() {
301
+ if (this.target().kind !== 'contact')
302
+ return false;
303
+ const { type, value, primary } = this.contactForm.getRawValue();
304
+ if (type !== 'CORREO' || !primary)
305
+ return false;
306
+ return text(value).toLowerCase() !== (this.originalEmail() ?? '');
307
+ }
308
+ invalid(control) {
309
+ return control.invalid && (control.touched || control.dirty);
310
+ }
311
+ optionsOf(list) {
312
+ return !!list && list.length > 0;
313
+ }
314
+ /** El nombre accesible de una lista: con el error, porque `p-select` no deja enlazar el mensaje con aria-describedby. */
315
+ selectLabel(label, control, error) {
316
+ return this.invalid(control) ? `${label}. ${error}` : label;
317
+ }
318
+ save() {
319
+ if (this.saving())
320
+ return;
321
+ const form = this.form();
322
+ if (form.invalid) {
323
+ form.markAllAsTouched();
324
+ this.focusFirstInvalid();
325
+ return;
326
+ }
327
+ // Una cuenta se confirma con el resumen antes de guardar.
328
+ if (this.target().kind === 'account' && !this.confirming()) {
329
+ this.error.set(null);
330
+ this.confirming.set(true);
331
+ return;
332
+ }
333
+ const request = this.request();
334
+ if (!request) {
335
+ this.error.set('No hay cambios para guardar.');
336
+ return;
337
+ }
338
+ this.error.set(null);
339
+ this.saving.set(true);
340
+ request.pipe(takeUntilDestroyed(this.destroyRef)).subscribe({
341
+ next: () => {
342
+ this.saving.set(false);
343
+ this.saved.emit('saved');
344
+ this.visible.set(false);
345
+ },
346
+ error: (raw) => {
347
+ this.saving.set(false);
348
+ const status = raw?.status ?? 0;
349
+ if (status >= 400 && status < 500) {
350
+ // Rechazado: no se guardó nada y se puede corregir y volver a intentar.
351
+ this.confirming.set(false);
352
+ this.error.set(rejection(status, raw?.message));
353
+ return;
354
+ }
355
+ // 5xx o sin respuesta: no se sabe si quedó. El padre recarga y avisa; no se reintenta a ciegas.
356
+ this.saved.emit('uncertain');
357
+ this.visible.set(false);
358
+ }
359
+ });
360
+ }
361
+ /** Cancelar; en el resumen de la cuenta, volver al formulario. */
362
+ cancel() {
363
+ if (this.confirming()) {
364
+ this.confirming.set(false);
365
+ return;
366
+ }
367
+ this.onVisibleChange(false);
368
+ }
369
+ onVisibleChange(visible) {
370
+ if (!visible && this.saving())
371
+ return;
372
+ this.visible.set(visible);
373
+ }
374
+ onHide() {
375
+ this.closed.emit();
376
+ }
377
+ request() {
378
+ const t = this.target();
379
+ const type = this.documentType();
380
+ const number = this.documentNumber();
381
+ switch (t.kind) {
382
+ case 'data': {
383
+ const changes = this.dataChanges();
384
+ return Object.keys(changes).length && this.gateway.updatePerson ? this.gateway.updatePerson(type, number, changes) : null;
385
+ }
386
+ case 'contact': {
387
+ const v = this.contactForm.getRawValue();
388
+ return this.gateway.saveContact
389
+ ? this.gateway.saveContact(type, number, {
390
+ id: t.item?.id ?? null,
391
+ type: text(v.type),
392
+ description: text(v.description),
393
+ value: text(v.value),
394
+ primary: v.primary
395
+ })
396
+ : null;
397
+ }
398
+ case 'address': {
399
+ const v = this.addressForm.getRawValue();
400
+ return this.gateway.saveAddress
401
+ ? this.gateway.saveAddress(type, number, {
402
+ id: t.item?.id ?? null,
403
+ addressType: text(v.addressType),
404
+ line1: text(v.line1),
405
+ line2: text(v.line2),
406
+ // El formulario no pide el país: se conserva el de la dirección; una nueva va sin país, como las
407
+ // que ya existen en las bases.
408
+ countryCode: text(t.item?.countryCode),
409
+ cityCode: text(v.cityCode),
410
+ neighborhood: text(v.neighborhood),
411
+ phone: text(v.phone)
412
+ })
413
+ : null;
414
+ }
415
+ case 'account': {
416
+ const v = this.accountForm.getRawValue();
417
+ return this.gateway.saveAccount
418
+ ? this.gateway.saveAccount(type, number, {
419
+ id: t.item?.id ?? null,
420
+ bankId: text(v.bankId),
421
+ accountTypeId: v.accountTypeId ?? 0,
422
+ accountTypeDescription: this.labelOf(this.options().accountTypes, v.accountTypeId),
423
+ number: text(v.number),
424
+ primary: v.primary
425
+ })
426
+ : null;
427
+ }
428
+ }
429
+ }
430
+ labelOf(list, value) {
431
+ return (list ?? []).find((option) => option.value === value)?.label ?? '';
432
+ }
433
+ dataValues() {
434
+ const v = this.dataForm.getRawValue();
435
+ return {
436
+ firstName: text(v.firstName).toUpperCase(),
437
+ secondName: text(v.secondName).toUpperCase(),
438
+ lastName: text(v.lastName).toUpperCase(),
439
+ secondLastName: text(v.secondLastName).toUpperCase(),
440
+ // Limpiar una lista deja '' (se quita el valor), no null (que el servicio toma como "sin cambio").
441
+ gender: text(v.gender),
442
+ maritalStatus: text(v.maritalStatus),
443
+ birthDate: toIso(v.birthDate),
444
+ birthPlace: text(v.birthPlace),
445
+ documentIssueDate: toIso(v.documentIssueDate),
446
+ documentIssuePlace: text(v.documentIssuePlace)
447
+ };
448
+ }
449
+ /** El foco al primer campo inválido, en el orden en que se ven (no al primer input del formulario). */
450
+ focusFirstInvalid() {
451
+ const kind = this.target().kind;
452
+ const form = this.form();
453
+ const name = Object.keys(FIELD_IDS[kind]).find((key) => form.get(key)?.invalid);
454
+ if (!name)
455
+ return;
456
+ const elementId = `${this.id}-${FIELD_IDS[kind][name]}`;
457
+ afterNextRender(() => document.getElementById(elementId)?.focus(), { injector: this.injector });
458
+ }
459
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: PersonEditDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
460
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: PersonEditDialogComponent, isStandalone: true, selector: "lib-person-edit-dialog", inputs: { target: { classPropertyName: "target", publicName: "target", isSignal: true, isRequired: true, transformFunction: null }, documentType: { classPropertyName: "documentType", publicName: "documentType", isSignal: true, isRequired: true, transformFunction: null }, documentNumber: { classPropertyName: "documentNumber", publicName: "documentNumber", isSignal: true, isRequired: true, transformFunction: null }, personName: { classPropertyName: "personName", publicName: "personName", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, optionsState: { classPropertyName: "optionsState", publicName: "optionsState", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { saved: "saved", closed: "closed", retryOptions: "retryOptions" }, ngImport: i0, template: "<p-dialog\n [header]=\"header()\"\n [visible]=\"visible()\"\n (visibleChange)=\"onVisibleChange($event)\"\n (onHide)=\"onHide()\"\n [modal]=\"true\"\n [draggable]=\"false\"\n [closable]=\"!saving()\"\n [closeOnEscape]=\"!saving()\"\n [style]=\"{ width: target().kind === 'data' ? '44rem' : '32rem', maxWidth: '95vw' }\"\n [breakpoints]=\"{ '575px': '95vw' }\">\n <div [id]=\"id\" class=\"sfs-edit\">\n @if (personName()) {\n <p class=\"sfs-edit-who sfs-muted\">{{ personName() }} \u00B7 Documento {{ documentNumber() }}</p>\n }\n\n <!-- Las listas (ciudades, bancos\u2026) las pide el padre al abrir el primer di\u00E1logo. Mientras no est\u00E9n, esos campos se\n piden como texto: se dice por qu\u00E9 y, si fallaron, se pueden volver a pedir. -->\n @if (target().kind !== 'contact') {\n @switch (optionsState()) {\n @case ('loading') {\n <p-message severity=\"info\" text=\"Cargando las listas de opciones\u2026\"></p-message>\n }\n @case ('error') {\n <p-message severity=\"warn\">\n <div class=\"sfs-inline\">\n <span>No se pudieron cargar las listas: escriba los c\u00F3digos o vuelva a intentarlo.</span>\n <p-button label=\"Reintentar\" icon=\"pi pi-refresh\" [text]=\"true\" (onClick)=\"retryOptions.emit()\"></p-button>\n </div>\n </p-message>\n }\n }\n }\n\n @switch (target().kind) {\n @case ('data') {\n <form [formGroup]=\"dataForm\" class=\"sfs-edit-grid\" (ngSubmit)=\"save()\">\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-fn'\">Primer nombre <span class=\"sfs-req\" aria-hidden=\"true\">*</span></label>\n <input pInputText [id]=\"id + '-fn'\" formControlName=\"firstName\" autocomplete=\"off\" maxlength=\"50\" aria-required=\"true\"\n [attr.aria-invalid]=\"invalid(dataForm.controls.firstName)\" [attr.aria-describedby]=\"invalid(dataForm.controls.firstName) ? id + '-fn-err' : null\" />\n @if (invalid(dataForm.controls.firstName)) { <small [id]=\"id + '-fn-err'\" class=\"sfs-edit-err\"><i class=\"pi pi-exclamation-circle\" aria-hidden=\"true\"></i>Escriba el primer nombre.</small> }\n </div>\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-sn'\">Segundo nombre</label>\n <input pInputText [id]=\"id + '-sn'\" formControlName=\"secondName\" autocomplete=\"off\" maxlength=\"50\" />\n </div>\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-ln'\">Primer apellido <span class=\"sfs-req\" aria-hidden=\"true\">*</span></label>\n <input pInputText [id]=\"id + '-ln'\" formControlName=\"lastName\" autocomplete=\"off\" maxlength=\"50\" aria-required=\"true\"\n [attr.aria-invalid]=\"invalid(dataForm.controls.lastName)\" [attr.aria-describedby]=\"invalid(dataForm.controls.lastName) ? id + '-ln-err' : null\" />\n @if (invalid(dataForm.controls.lastName)) { <small [id]=\"id + '-ln-err'\" class=\"sfs-edit-err\"><i class=\"pi pi-exclamation-circle\" aria-hidden=\"true\"></i>Escriba el primer apellido.</small> }\n </div>\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-sln'\">Segundo apellido</label>\n <input pInputText [id]=\"id + '-sln'\" formControlName=\"secondLastName\" autocomplete=\"off\" maxlength=\"50\" />\n </div>\n\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-gender'\">Sexo</label>\n @if (optionsOf(options().genders)) {\n <p-select [inputId]=\"id + '-gender'\" formControlName=\"gender\" [options]=\"options().genders!\" optionLabel=\"label\" optionValue=\"value\"\n placeholder=\"Seleccione\" [showClear]=\"true\" appendTo=\"body\"></p-select>\n } @else {\n <input pInputText [id]=\"id + '-gender'\" formControlName=\"gender\" maxlength=\"10\" />\n }\n </div>\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-marital'\">Estado civil</label>\n @if (optionsOf(options().maritalStatuses)) {\n <p-select [inputId]=\"id + '-marital'\" formControlName=\"maritalStatus\" [options]=\"options().maritalStatuses!\" optionLabel=\"label\"\n optionValue=\"value\" placeholder=\"Seleccione\" [showClear]=\"true\" appendTo=\"body\"></p-select>\n } @else {\n <input pInputText [id]=\"id + '-marital'\" formControlName=\"maritalStatus\" maxlength=\"15\" />\n }\n </div>\n\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-bdate'\">Fecha de nacimiento</label>\n <p-datepicker [inputId]=\"id + '-bdate'\" formControlName=\"birthDate\" dateFormat=\"yy-mm-dd\" [showIcon]=\"true\" [maxDate]=\"today\"\n appendTo=\"body\"></p-datepicker>\n </div>\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-bplace'\">Lugar de nacimiento</label>\n @if (optionsOf(options().cities)) {\n <p-select [inputId]=\"id + '-bplace'\" formControlName=\"birthPlace\" [options]=\"options().cities!\" optionLabel=\"label\" optionValue=\"value\"\n placeholder=\"Seleccione\" [filter]=\"true\" filterBy=\"label\" [showClear]=\"true\" [virtualScroll]=\"true\" [virtualScrollItemSize]=\"38\"\n appendTo=\"body\"></p-select>\n } @else {\n <input pInputText [id]=\"id + '-bplace'\" formControlName=\"birthPlace\" maxlength=\"50\" />\n }\n </div>\n\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-idate'\">Fecha de expedici\u00F3n</label>\n <p-datepicker [inputId]=\"id + '-idate'\" formControlName=\"documentIssueDate\" dateFormat=\"yy-mm-dd\" [showIcon]=\"true\" [maxDate]=\"today\"\n appendTo=\"body\"></p-datepicker>\n </div>\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-iplace'\">Lugar de expedici\u00F3n</label>\n @if (optionsOf(options().cities)) {\n <p-select [inputId]=\"id + '-iplace'\" formControlName=\"documentIssuePlace\" [options]=\"options().cities!\" optionLabel=\"label\" optionValue=\"value\"\n placeholder=\"Seleccione\" [filter]=\"true\" filterBy=\"label\" [showClear]=\"true\" [virtualScroll]=\"true\" [virtualScrollItemSize]=\"38\"\n appendTo=\"body\"></p-select>\n } @else {\n <input pInputText [id]=\"id + '-iplace'\" formControlName=\"documentIssuePlace\" maxlength=\"20\" />\n }\n </div>\n </form>\n }\n\n @case ('contact') {\n <form [formGroup]=\"contactForm\" class=\"sfs-edit-stack\" (ngSubmit)=\"save()\">\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-ctype'\">Tipo <span class=\"sfs-req\" aria-hidden=\"true\">*</span></label>\n <p-select [inputId]=\"id + '-ctype'\" formControlName=\"type\" [options]=\"contactTypes\" optionLabel=\"label\" optionValue=\"value\" appendTo=\"body\"></p-select>\n @if (!isNew()) { <small class=\"sfs-muted\">Para un contacto de otro tipo, agregue uno nuevo.</small> }\n </div>\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-cvalue'\">{{ contactForm.controls.type.value === 'CORREO' ? 'Correo' : contactForm.controls.type.value === 'OTRO' ? 'Valor' : 'N\u00FAmero' }}\n <span class=\"sfs-req\" aria-hidden=\"true\">*</span></label>\n <input pInputText [id]=\"id + '-cvalue'\" formControlName=\"value\" [attr.maxlength]=\"contactForm.controls.type.value === 'CORREO' ? emailMax : 100\" aria-required=\"true\"\n [attr.type]=\"contactForm.controls.type.value === 'CORREO' ? 'email' : 'text'\"\n [attr.inputmode]=\"contactForm.controls.type.value === 'CORREO' ? 'email' : contactForm.controls.type.value === 'OTRO' ? null : 'tel'\"\n [attr.autocomplete]=\"'off'\"\n [attr.aria-invalid]=\"invalid(contactForm.controls.value)\" [attr.aria-describedby]=\"invalid(contactForm.controls.value) ? id + '-cvalue-err' : null\" />\n @if (invalid(contactForm.controls.value)) {\n <small [id]=\"id + '-cvalue-err'\" class=\"sfs-edit-err\"><i class=\"pi pi-exclamation-circle\" aria-hidden=\"true\"></i>\n @if (contactForm.controls.value.hasError('required')) { Escriba el {{ contactForm.controls.type.value === 'CORREO' ? 'correo' : 'valor' }}. }\n @else if (contactForm.controls.value.hasError('email')) { El correo no tiene un formato v\u00E1lido (nombre&#64;dominio.com). }\n @else if (contactForm.controls.value.hasError('phone')) { Escriba solo n\u00FAmeros (de 7 a 20), con espacios o guiones si quiere. }\n @else if (contactForm.controls.value.hasError('maxlength')) { El correo puede tener hasta {{ emailMax }} caracteres. }\n </small>\n }\n </div>\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-cdesc'\">Descripci\u00F3n</label>\n <input pInputText [id]=\"id + '-cdesc'\" formControlName=\"description\" maxlength=\"50\" placeholder=\"Por ejemplo: personal, oficina\" />\n </div>\n <div class=\"sfs-edit-check\">\n <p-checkbox\n [inputId]=\"id + '-cprimary'\"\n formControlName=\"primary\"\n [binary]=\"true\"\n [ariaLabelledBy]=\"primaryLocked() ? id + '-cprimary-lbl ' + id + '-cprimary-hint' : id + '-cprimary-lbl'\"\n ></p-checkbox>\n <label [id]=\"id + '-cprimary-lbl'\" [for]=\"id + '-cprimary'\">Principal de su tipo</label>\n </div>\n @if (primaryLocked()) {\n <small [id]=\"id + '-cprimary-hint'\" class=\"sfs-muted\">Para cambiar el principal, marque como principal otro contacto de este tipo.</small>\n }\n @if (changesPrimaryEmail()) {\n <p-message severity=\"warn\" [text]=\"'Es el correo principal: si la persona entra a la plataforma, su usuario quedar\u00E1 inactivo hasta que valide el correo nuevo.'\"></p-message>\n }\n </form>\n }\n\n @case ('address') {\n <form [formGroup]=\"addressForm\" class=\"sfs-edit-stack\" (ngSubmit)=\"save()\">\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-atype'\">Tipo de direcci\u00F3n</label>\n @if (optionsOf(options().addressTypes)) {\n <p-select [inputId]=\"id + '-atype'\" formControlName=\"addressType\" [options]=\"options().addressTypes!\" optionLabel=\"label\" optionValue=\"value\"\n placeholder=\"Seleccione\" appendTo=\"body\"></p-select>\n } @else {\n <input pInputText [id]=\"id + '-atype'\" formControlName=\"addressType\" maxlength=\"10\" />\n }\n </div>\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-line1'\">Direcci\u00F3n <span class=\"sfs-req\" aria-hidden=\"true\">*</span></label>\n <input pInputText [id]=\"id + '-line1'\" formControlName=\"line1\" maxlength=\"150\" autocomplete=\"street-address\" aria-required=\"true\"\n [attr.aria-invalid]=\"invalid(addressForm.controls.line1)\" [attr.aria-describedby]=\"invalid(addressForm.controls.line1) ? id + '-line1-err' : null\" />\n @if (invalid(addressForm.controls.line1)) { <small [id]=\"id + '-line1-err'\" class=\"sfs-edit-err\"><i class=\"pi pi-exclamation-circle\" aria-hidden=\"true\"></i>Escriba la direcci\u00F3n.</small> }\n </div>\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-line2'\">Complemento</label>\n <input pInputText [id]=\"id + '-line2'\" formControlName=\"line2\" maxlength=\"60\" placeholder=\"Apartamento, torre, oficina\" />\n </div>\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-city'\">Ciudad <span class=\"sfs-req\" aria-hidden=\"true\">*</span></label>\n @if (optionsOf(options().cities)) {\n <p-select [inputId]=\"id + '-city'\" formControlName=\"cityCode\" [options]=\"options().cities!\" optionLabel=\"label\" optionValue=\"value\"\n placeholder=\"Seleccione\" [filter]=\"true\" filterBy=\"label\" [virtualScroll]=\"true\" [virtualScrollItemSize]=\"38\" appendTo=\"body\"\n [ariaLabel]=\"selectLabel('Ciudad', addressForm.controls.cityCode, 'Seleccione la ciudad.')\"></p-select>\n } @else {\n <input pInputText [id]=\"id + '-city'\" formControlName=\"cityCode\" maxlength=\"10\" placeholder=\"C\u00F3digo DANE\"\n [attr.aria-invalid]=\"invalid(addressForm.controls.cityCode)\" [attr.aria-describedby]=\"invalid(addressForm.controls.cityCode) ? id + '-city-err' : null\" />\n }\n @if (invalid(addressForm.controls.cityCode)) { <small [id]=\"id + '-city-err'\" class=\"sfs-edit-err\"><i class=\"pi pi-exclamation-circle\" aria-hidden=\"true\"></i>Seleccione la ciudad.</small> }\n </div>\n <div class=\"sfs-edit-row\">\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-hood'\">Barrio</label>\n <input pInputText [id]=\"id + '-hood'\" formControlName=\"neighborhood\" maxlength=\"50\" />\n </div>\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-aphone'\">Tel\u00E9fono</label>\n <input pInputText [id]=\"id + '-aphone'\" formControlName=\"phone\" maxlength=\"50\" inputmode=\"tel\" autocomplete=\"off\"\n [attr.aria-invalid]=\"invalid(addressForm.controls.phone)\" [attr.aria-describedby]=\"invalid(addressForm.controls.phone) ? id + '-aphone-err' : null\" />\n @if (invalid(addressForm.controls.phone)) { <small [id]=\"id + '-aphone-err'\" class=\"sfs-edit-err\"><i class=\"pi pi-exclamation-circle\" aria-hidden=\"true\"></i>Escriba solo n\u00FAmeros (de 7 a 20).</small> }\n </div>\n </div>\n </form>\n }\n\n @case ('account') {\n <form [formGroup]=\"accountForm\" class=\"sfs-edit-stack\" (ngSubmit)=\"save()\">\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-bank'\">Banco <span class=\"sfs-req\" aria-hidden=\"true\">*</span></label>\n @if (optionsOf(options().banks)) {\n <p-select [inputId]=\"id + '-bank'\" formControlName=\"bankId\" [options]=\"options().banks!\" optionLabel=\"label\" optionValue=\"value\"\n placeholder=\"Seleccione\" [filter]=\"true\" filterBy=\"label\" appendTo=\"body\"\n [ariaLabel]=\"selectLabel('Banco', accountForm.controls.bankId, 'Seleccione el banco.')\"></p-select>\n } @else {\n <input pInputText [id]=\"id + '-bank'\" formControlName=\"bankId\" maxlength=\"4\" placeholder=\"C\u00F3digo del banco\"\n [attr.aria-invalid]=\"invalid(accountForm.controls.bankId)\" [attr.aria-describedby]=\"invalid(accountForm.controls.bankId) ? id + '-bank-err' : null\" />\n }\n @if (invalid(accountForm.controls.bankId)) { <small [id]=\"id + '-bank-err'\" class=\"sfs-edit-err\"><i class=\"pi pi-exclamation-circle\" aria-hidden=\"true\"></i>Seleccione el banco.</small> }\n </div>\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-atype2'\">Tipo de cuenta <span class=\"sfs-req\" aria-hidden=\"true\">*</span></label>\n <p-select [inputId]=\"id + '-atype2'\" formControlName=\"accountTypeId\" [options]=\"options().accountTypes ?? []\" optionLabel=\"label\"\n optionValue=\"value\" placeholder=\"Seleccione\" appendTo=\"body\"\n [emptyMessage]=\"optionsState() === 'loading' ? 'Cargando\u2026' : 'No se pudieron cargar los tipos de cuenta.'\"\n [ariaLabel]=\"selectLabel('Tipo de cuenta', accountForm.controls.accountTypeId, 'Seleccione el tipo de cuenta.')\"></p-select>\n @if (invalid(accountForm.controls.accountTypeId)) { <small [id]=\"id + '-atype2-err'\" class=\"sfs-edit-err\"><i class=\"pi pi-exclamation-circle\" aria-hidden=\"true\"></i>Seleccione el tipo de cuenta.</small> }\n </div>\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-number'\">N\u00FAmero <span class=\"sfs-req\" aria-hidden=\"true\">*</span></label>\n <input pInputText [id]=\"id + '-number'\" formControlName=\"number\" maxlength=\"20\" inputmode=\"numeric\" autocomplete=\"off\" aria-required=\"true\"\n [attr.aria-invalid]=\"invalid(accountForm.controls.number)\" [attr.aria-describedby]=\"invalid(accountForm.controls.number) ? id + '-number-err' : null\" />\n @if (invalid(accountForm.controls.number)) {\n <small [id]=\"id + '-number-err'\" class=\"sfs-edit-err\"><i class=\"pi pi-exclamation-circle\" aria-hidden=\"true\"></i>\n {{ accountForm.controls.number.hasError('required') ? 'Escriba el n\u00FAmero de la cuenta.' : 'Escriba solo n\u00FAmeros (de 4 a 20), con guiones si quiere.' }}\n </small>\n }\n </div>\n <div class=\"sfs-edit-check\">\n <p-checkbox [inputId]=\"id + '-aprimary'\" formControlName=\"primary\" [binary]=\"true\"></p-checkbox>\n <label [for]=\"id + '-aprimary'\">Cuenta principal</label>\n </div>\n </form>\n }\n }\n\n <div aria-live=\"polite\">\n @if (confirming()) {\n <p-message severity=\"warn\">\n <div class=\"sfs-edit-confirm\">\n <strong>Revise la cuenta antes de guardarla</strong>\n <span>{{ accountSummary() }} Los desembolsos y pagos a la persona pueden usar esta cuenta.</span>\n </div>\n </p-message>\n }\n @if (error(); as message) {\n <p-message severity=\"error\" [text]=\"message\"></p-message>\n }\n </div>\n </div>\n\n <ng-template #footer>\n <p-button [label]=\"confirming() ? 'Volver' : 'Cancelar'\" severity=\"secondary\" [text]=\"true\" [disabled]=\"saving()\" (onClick)=\"cancel()\"></p-button>\n <p-button [label]=\"saveLabel()\" icon=\"pi pi-check\" [loading]=\"saving()\" (onClick)=\"save()\"></p-button>\n </ng-template>\n</p-dialog>\n", styles: [".sfs-title{margin:0;font-size:1.125rem;font-weight:600}.sfs-subtitle{margin:0;font-size:1rem;font-weight:600}.sfs-muted{color:var(--p-text-muted-color)}.sfs-section-title{display:flex;align-items:center;gap:.5rem;margin:0 0 .75rem;font-size:1rem;font-weight:600}.sfs-section-title i{color:var(--primary-color, var(--p-primary-color))}.sfs-inline{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem}.sfs-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:.5rem;margin-bottom:.75rem}.sfs-break{overflow-wrap:anywhere}.sfs-nowrap{white-space:nowrap}.sfs-right{text-align:right}.sfs-strong{font-weight:600}.sfs-tag-gap{margin-left:.5rem}.sfs-stack{display:flex;flex-direction:column;gap:1rem}.sfs-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.sfs-summary{display:grid;grid-template-columns:minmax(8rem,max-content) 1fr;gap:.25rem 1rem;margin:0}.sfs-summary dt{color:var(--p-text-muted-color)}.sfs-summary dd{margin:0;text-align:right;font-variant-numeric:tabular-nums}@media (max-width: 575px){:host ::ng-deep .sfs-stack-table .p-datatable-table-container{overflow:visible!important}:host ::ng-deep .sfs-stack-table table,:host ::ng-deep .sfs-stack-table tbody{display:block;width:100%}:host ::ng-deep .sfs-stack-table thead{display:block!important;position:absolute!important;width:1px!important;height:1px!important;overflow:hidden!important;clip-path:inset(50%);white-space:nowrap}:host ::ng-deep .sfs-stack-table tbody tr{display:flex;flex-direction:column;margin-bottom:.5rem;padding:.5rem .75rem;border:1px solid var(--p-content-border-color);border-radius:var(--p-content-border-radius, 6px)}:host ::ng-deep .sfs-stack-table tbody td{display:flex;align-items:center;justify-content:flex-end;gap:.375rem;padding:.3rem 0;border:0;text-align:right}:host ::ng-deep .sfs-stack-table tbody td[data-label]:before{content:attr(data-label);margin-right:auto;padding-right:1rem;color:var(--p-text-muted-color);text-align:left}:host ::ng-deep .sfs-stack-table tbody td.sfs-stack-title{order:-1;display:block;font-weight:600;text-align:left}:host ::ng-deep .sfs-stack-table tfoot,:host ::ng-deep .sfs-stack-table .sfs-stack-hide{display:none}}\n", ".sfs-edit{display:flex;flex-direction:column;gap:1rem}.sfs-edit-who{margin:0;font-size:.875rem}.sfs-edit-stack{display:flex;flex-direction:column;gap:1rem}.sfs-edit-grid,.sfs-edit-row{display:grid;grid-template-columns:minmax(0,1fr);gap:1rem}@media (min-width: 576px){.sfs-edit-grid,.sfs-edit-row{grid-template-columns:repeat(2,minmax(0,1fr))}}.sfs-edit-field{display:flex;flex-direction:column;gap:.35rem;min-width:0}.sfs-edit-field>label{font-size:.875rem;font-weight:600}.sfs-edit-field input,.sfs-edit-field ::ng-deep .p-select,.sfs-edit-field ::ng-deep .p-datepicker{width:100%}.sfs-edit-check{display:flex;align-items:center;gap:.5rem;min-height:2.75rem}.sfs-req{color:var(--p-text-muted-color)}.sfs-edit-err{display:flex;align-items:flex-start;gap:.35rem;color:var(--p-message-error-simple-color, var(--p-text-color))}.sfs-edit-confirm{display:flex;flex-direction:column;gap:.25rem}\n"], dependencies: [{ kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.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: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i2.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: CheckboxModule }, { kind: "component", type: i3.Checkbox, selector: "p-checkbox, p-checkBox, p-check-box", inputs: ["value", "name", "disabled", "binary", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "style", "inputStyle", "styleClass", "inputClass", "indeterminate", "size", "formControl", "checkboxIcon", "readonly", "required", "autofocus", "trueValue", "falseValue", "variant"], outputs: ["onChange", "onFocus", "onBlur"] }, { kind: "ngmodule", type: DatePickerModule }, { kind: "component", type: i4.DatePicker, selector: "p-datePicker, p-datepicker, p-date-picker", inputs: ["iconDisplay", "style", "styleClass", "inputStyle", "inputId", "name", "inputStyleClass", "placeholder", "ariaLabelledBy", "ariaLabel", "iconAriaLabel", "disabled", "dateFormat", "multipleSeparator", "rangeSeparator", "inline", "showOtherMonths", "selectOtherMonths", "showIcon", "fluid", "icon", "appendTo", "readonlyInput", "shortYearCutoff", "monthNavigator", "yearNavigator", "hourFormat", "timeOnly", "stepHour", "stepMinute", "stepSecond", "showSeconds", "required", "showOnFocus", "showWeek", "startWeekFromFirstDayOfYear", "showClear", "dataType", "selectionMode", "maxDateCount", "showButtonBar", "todayButtonStyleClass", "clearButtonStyleClass", "autofocus", "autoZIndex", "baseZIndex", "panelStyleClass", "panelStyle", "keepInvalid", "hideOnDateTimeSelect", "touchUI", "timeSeparator", "focusTrap", "showTransitionOptions", "hideTransitionOptions", "tabindex", "variant", "size", "minDate", "maxDate", "disabledDates", "disabledDays", "yearRange", "showTime", "responsiveOptions", "numberOfMonths", "firstDayOfWeek", "locale", "view", "defaultDate"], outputs: ["onFocus", "onBlur", "onClose", "onSelect", "onClear", "onInput", "onTodayClick", "onClearClick", "onMonthChange", "onYearChange", "onClickOutside", "onShow"] }, { kind: "ngmodule", type: DialogModule }, { kind: "component", type: i5.Dialog, selector: "p-dialog", inputs: ["header", "draggable", "resizable", "positionLeft", "positionTop", "contentStyle", "contentStyleClass", "modal", "closeOnEscape", "dismissableMask", "rtl", "closable", "responsive", "appendTo", "breakpoints", "styleClass", "maskStyleClass", "maskStyle", "showHeader", "breakpoint", "blockScroll", "autoZIndex", "baseZIndex", "minX", "minY", "focusOnShow", "maximizable", "keepInViewport", "focusTrap", "transitionOptions", "closeIcon", "closeAriaLabel", "closeTabindex", "minimizeIcon", "maximizeIcon", "closeButtonProps", "maximizeButtonProps", "visible", "style", "position", "role", "content", "contentTemplate", "footerTemplate", "closeIconTemplate", "maximizeIconTemplate", "minimizeIconTemplate", "headlessTemplate"], outputs: ["onShow", "onHide", "visibleChange", "onResizeInit", "onResizeEnd", "onDragEnd", "onMaximize"] }, { kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i6.InputText, selector: "[pInputText]", inputs: ["variant", "fluid", "pSize"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i7.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant"], outputs: ["onClose"] }, { kind: "ngmodule", type: SelectModule }, { kind: "component", type: i8.Select, selector: "p-select", inputs: ["id", "scrollHeight", "filter", "name", "style", "panelStyle", "styleClass", "panelStyleClass", "readonly", "required", "editable", "appendTo", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "variant", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "autoDisplayFirst", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "size", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "maxlength", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "fluid", "disabled", "itemSize", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "filterValue", "options"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }] });
461
+ }
462
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: PersonEditDialogComponent, decorators: [{
463
+ type: Component,
464
+ args: [{ selector: 'lib-person-edit-dialog', imports: [ReactiveFormsModule, ButtonModule, CheckboxModule, DatePickerModule, DialogModule, InputTextModule, MessageModule, SelectModule], template: "<p-dialog\n [header]=\"header()\"\n [visible]=\"visible()\"\n (visibleChange)=\"onVisibleChange($event)\"\n (onHide)=\"onHide()\"\n [modal]=\"true\"\n [draggable]=\"false\"\n [closable]=\"!saving()\"\n [closeOnEscape]=\"!saving()\"\n [style]=\"{ width: target().kind === 'data' ? '44rem' : '32rem', maxWidth: '95vw' }\"\n [breakpoints]=\"{ '575px': '95vw' }\">\n <div [id]=\"id\" class=\"sfs-edit\">\n @if (personName()) {\n <p class=\"sfs-edit-who sfs-muted\">{{ personName() }} \u00B7 Documento {{ documentNumber() }}</p>\n }\n\n <!-- Las listas (ciudades, bancos\u2026) las pide el padre al abrir el primer di\u00E1logo. Mientras no est\u00E9n, esos campos se\n piden como texto: se dice por qu\u00E9 y, si fallaron, se pueden volver a pedir. -->\n @if (target().kind !== 'contact') {\n @switch (optionsState()) {\n @case ('loading') {\n <p-message severity=\"info\" text=\"Cargando las listas de opciones\u2026\"></p-message>\n }\n @case ('error') {\n <p-message severity=\"warn\">\n <div class=\"sfs-inline\">\n <span>No se pudieron cargar las listas: escriba los c\u00F3digos o vuelva a intentarlo.</span>\n <p-button label=\"Reintentar\" icon=\"pi pi-refresh\" [text]=\"true\" (onClick)=\"retryOptions.emit()\"></p-button>\n </div>\n </p-message>\n }\n }\n }\n\n @switch (target().kind) {\n @case ('data') {\n <form [formGroup]=\"dataForm\" class=\"sfs-edit-grid\" (ngSubmit)=\"save()\">\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-fn'\">Primer nombre <span class=\"sfs-req\" aria-hidden=\"true\">*</span></label>\n <input pInputText [id]=\"id + '-fn'\" formControlName=\"firstName\" autocomplete=\"off\" maxlength=\"50\" aria-required=\"true\"\n [attr.aria-invalid]=\"invalid(dataForm.controls.firstName)\" [attr.aria-describedby]=\"invalid(dataForm.controls.firstName) ? id + '-fn-err' : null\" />\n @if (invalid(dataForm.controls.firstName)) { <small [id]=\"id + '-fn-err'\" class=\"sfs-edit-err\"><i class=\"pi pi-exclamation-circle\" aria-hidden=\"true\"></i>Escriba el primer nombre.</small> }\n </div>\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-sn'\">Segundo nombre</label>\n <input pInputText [id]=\"id + '-sn'\" formControlName=\"secondName\" autocomplete=\"off\" maxlength=\"50\" />\n </div>\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-ln'\">Primer apellido <span class=\"sfs-req\" aria-hidden=\"true\">*</span></label>\n <input pInputText [id]=\"id + '-ln'\" formControlName=\"lastName\" autocomplete=\"off\" maxlength=\"50\" aria-required=\"true\"\n [attr.aria-invalid]=\"invalid(dataForm.controls.lastName)\" [attr.aria-describedby]=\"invalid(dataForm.controls.lastName) ? id + '-ln-err' : null\" />\n @if (invalid(dataForm.controls.lastName)) { <small [id]=\"id + '-ln-err'\" class=\"sfs-edit-err\"><i class=\"pi pi-exclamation-circle\" aria-hidden=\"true\"></i>Escriba el primer apellido.</small> }\n </div>\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-sln'\">Segundo apellido</label>\n <input pInputText [id]=\"id + '-sln'\" formControlName=\"secondLastName\" autocomplete=\"off\" maxlength=\"50\" />\n </div>\n\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-gender'\">Sexo</label>\n @if (optionsOf(options().genders)) {\n <p-select [inputId]=\"id + '-gender'\" formControlName=\"gender\" [options]=\"options().genders!\" optionLabel=\"label\" optionValue=\"value\"\n placeholder=\"Seleccione\" [showClear]=\"true\" appendTo=\"body\"></p-select>\n } @else {\n <input pInputText [id]=\"id + '-gender'\" formControlName=\"gender\" maxlength=\"10\" />\n }\n </div>\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-marital'\">Estado civil</label>\n @if (optionsOf(options().maritalStatuses)) {\n <p-select [inputId]=\"id + '-marital'\" formControlName=\"maritalStatus\" [options]=\"options().maritalStatuses!\" optionLabel=\"label\"\n optionValue=\"value\" placeholder=\"Seleccione\" [showClear]=\"true\" appendTo=\"body\"></p-select>\n } @else {\n <input pInputText [id]=\"id + '-marital'\" formControlName=\"maritalStatus\" maxlength=\"15\" />\n }\n </div>\n\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-bdate'\">Fecha de nacimiento</label>\n <p-datepicker [inputId]=\"id + '-bdate'\" formControlName=\"birthDate\" dateFormat=\"yy-mm-dd\" [showIcon]=\"true\" [maxDate]=\"today\"\n appendTo=\"body\"></p-datepicker>\n </div>\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-bplace'\">Lugar de nacimiento</label>\n @if (optionsOf(options().cities)) {\n <p-select [inputId]=\"id + '-bplace'\" formControlName=\"birthPlace\" [options]=\"options().cities!\" optionLabel=\"label\" optionValue=\"value\"\n placeholder=\"Seleccione\" [filter]=\"true\" filterBy=\"label\" [showClear]=\"true\" [virtualScroll]=\"true\" [virtualScrollItemSize]=\"38\"\n appendTo=\"body\"></p-select>\n } @else {\n <input pInputText [id]=\"id + '-bplace'\" formControlName=\"birthPlace\" maxlength=\"50\" />\n }\n </div>\n\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-idate'\">Fecha de expedici\u00F3n</label>\n <p-datepicker [inputId]=\"id + '-idate'\" formControlName=\"documentIssueDate\" dateFormat=\"yy-mm-dd\" [showIcon]=\"true\" [maxDate]=\"today\"\n appendTo=\"body\"></p-datepicker>\n </div>\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-iplace'\">Lugar de expedici\u00F3n</label>\n @if (optionsOf(options().cities)) {\n <p-select [inputId]=\"id + '-iplace'\" formControlName=\"documentIssuePlace\" [options]=\"options().cities!\" optionLabel=\"label\" optionValue=\"value\"\n placeholder=\"Seleccione\" [filter]=\"true\" filterBy=\"label\" [showClear]=\"true\" [virtualScroll]=\"true\" [virtualScrollItemSize]=\"38\"\n appendTo=\"body\"></p-select>\n } @else {\n <input pInputText [id]=\"id + '-iplace'\" formControlName=\"documentIssuePlace\" maxlength=\"20\" />\n }\n </div>\n </form>\n }\n\n @case ('contact') {\n <form [formGroup]=\"contactForm\" class=\"sfs-edit-stack\" (ngSubmit)=\"save()\">\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-ctype'\">Tipo <span class=\"sfs-req\" aria-hidden=\"true\">*</span></label>\n <p-select [inputId]=\"id + '-ctype'\" formControlName=\"type\" [options]=\"contactTypes\" optionLabel=\"label\" optionValue=\"value\" appendTo=\"body\"></p-select>\n @if (!isNew()) { <small class=\"sfs-muted\">Para un contacto de otro tipo, agregue uno nuevo.</small> }\n </div>\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-cvalue'\">{{ contactForm.controls.type.value === 'CORREO' ? 'Correo' : contactForm.controls.type.value === 'OTRO' ? 'Valor' : 'N\u00FAmero' }}\n <span class=\"sfs-req\" aria-hidden=\"true\">*</span></label>\n <input pInputText [id]=\"id + '-cvalue'\" formControlName=\"value\" [attr.maxlength]=\"contactForm.controls.type.value === 'CORREO' ? emailMax : 100\" aria-required=\"true\"\n [attr.type]=\"contactForm.controls.type.value === 'CORREO' ? 'email' : 'text'\"\n [attr.inputmode]=\"contactForm.controls.type.value === 'CORREO' ? 'email' : contactForm.controls.type.value === 'OTRO' ? null : 'tel'\"\n [attr.autocomplete]=\"'off'\"\n [attr.aria-invalid]=\"invalid(contactForm.controls.value)\" [attr.aria-describedby]=\"invalid(contactForm.controls.value) ? id + '-cvalue-err' : null\" />\n @if (invalid(contactForm.controls.value)) {\n <small [id]=\"id + '-cvalue-err'\" class=\"sfs-edit-err\"><i class=\"pi pi-exclamation-circle\" aria-hidden=\"true\"></i>\n @if (contactForm.controls.value.hasError('required')) { Escriba el {{ contactForm.controls.type.value === 'CORREO' ? 'correo' : 'valor' }}. }\n @else if (contactForm.controls.value.hasError('email')) { El correo no tiene un formato v\u00E1lido (nombre&#64;dominio.com). }\n @else if (contactForm.controls.value.hasError('phone')) { Escriba solo n\u00FAmeros (de 7 a 20), con espacios o guiones si quiere. }\n @else if (contactForm.controls.value.hasError('maxlength')) { El correo puede tener hasta {{ emailMax }} caracteres. }\n </small>\n }\n </div>\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-cdesc'\">Descripci\u00F3n</label>\n <input pInputText [id]=\"id + '-cdesc'\" formControlName=\"description\" maxlength=\"50\" placeholder=\"Por ejemplo: personal, oficina\" />\n </div>\n <div class=\"sfs-edit-check\">\n <p-checkbox\n [inputId]=\"id + '-cprimary'\"\n formControlName=\"primary\"\n [binary]=\"true\"\n [ariaLabelledBy]=\"primaryLocked() ? id + '-cprimary-lbl ' + id + '-cprimary-hint' : id + '-cprimary-lbl'\"\n ></p-checkbox>\n <label [id]=\"id + '-cprimary-lbl'\" [for]=\"id + '-cprimary'\">Principal de su tipo</label>\n </div>\n @if (primaryLocked()) {\n <small [id]=\"id + '-cprimary-hint'\" class=\"sfs-muted\">Para cambiar el principal, marque como principal otro contacto de este tipo.</small>\n }\n @if (changesPrimaryEmail()) {\n <p-message severity=\"warn\" [text]=\"'Es el correo principal: si la persona entra a la plataforma, su usuario quedar\u00E1 inactivo hasta que valide el correo nuevo.'\"></p-message>\n }\n </form>\n }\n\n @case ('address') {\n <form [formGroup]=\"addressForm\" class=\"sfs-edit-stack\" (ngSubmit)=\"save()\">\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-atype'\">Tipo de direcci\u00F3n</label>\n @if (optionsOf(options().addressTypes)) {\n <p-select [inputId]=\"id + '-atype'\" formControlName=\"addressType\" [options]=\"options().addressTypes!\" optionLabel=\"label\" optionValue=\"value\"\n placeholder=\"Seleccione\" appendTo=\"body\"></p-select>\n } @else {\n <input pInputText [id]=\"id + '-atype'\" formControlName=\"addressType\" maxlength=\"10\" />\n }\n </div>\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-line1'\">Direcci\u00F3n <span class=\"sfs-req\" aria-hidden=\"true\">*</span></label>\n <input pInputText [id]=\"id + '-line1'\" formControlName=\"line1\" maxlength=\"150\" autocomplete=\"street-address\" aria-required=\"true\"\n [attr.aria-invalid]=\"invalid(addressForm.controls.line1)\" [attr.aria-describedby]=\"invalid(addressForm.controls.line1) ? id + '-line1-err' : null\" />\n @if (invalid(addressForm.controls.line1)) { <small [id]=\"id + '-line1-err'\" class=\"sfs-edit-err\"><i class=\"pi pi-exclamation-circle\" aria-hidden=\"true\"></i>Escriba la direcci\u00F3n.</small> }\n </div>\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-line2'\">Complemento</label>\n <input pInputText [id]=\"id + '-line2'\" formControlName=\"line2\" maxlength=\"60\" placeholder=\"Apartamento, torre, oficina\" />\n </div>\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-city'\">Ciudad <span class=\"sfs-req\" aria-hidden=\"true\">*</span></label>\n @if (optionsOf(options().cities)) {\n <p-select [inputId]=\"id + '-city'\" formControlName=\"cityCode\" [options]=\"options().cities!\" optionLabel=\"label\" optionValue=\"value\"\n placeholder=\"Seleccione\" [filter]=\"true\" filterBy=\"label\" [virtualScroll]=\"true\" [virtualScrollItemSize]=\"38\" appendTo=\"body\"\n [ariaLabel]=\"selectLabel('Ciudad', addressForm.controls.cityCode, 'Seleccione la ciudad.')\"></p-select>\n } @else {\n <input pInputText [id]=\"id + '-city'\" formControlName=\"cityCode\" maxlength=\"10\" placeholder=\"C\u00F3digo DANE\"\n [attr.aria-invalid]=\"invalid(addressForm.controls.cityCode)\" [attr.aria-describedby]=\"invalid(addressForm.controls.cityCode) ? id + '-city-err' : null\" />\n }\n @if (invalid(addressForm.controls.cityCode)) { <small [id]=\"id + '-city-err'\" class=\"sfs-edit-err\"><i class=\"pi pi-exclamation-circle\" aria-hidden=\"true\"></i>Seleccione la ciudad.</small> }\n </div>\n <div class=\"sfs-edit-row\">\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-hood'\">Barrio</label>\n <input pInputText [id]=\"id + '-hood'\" formControlName=\"neighborhood\" maxlength=\"50\" />\n </div>\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-aphone'\">Tel\u00E9fono</label>\n <input pInputText [id]=\"id + '-aphone'\" formControlName=\"phone\" maxlength=\"50\" inputmode=\"tel\" autocomplete=\"off\"\n [attr.aria-invalid]=\"invalid(addressForm.controls.phone)\" [attr.aria-describedby]=\"invalid(addressForm.controls.phone) ? id + '-aphone-err' : null\" />\n @if (invalid(addressForm.controls.phone)) { <small [id]=\"id + '-aphone-err'\" class=\"sfs-edit-err\"><i class=\"pi pi-exclamation-circle\" aria-hidden=\"true\"></i>Escriba solo n\u00FAmeros (de 7 a 20).</small> }\n </div>\n </div>\n </form>\n }\n\n @case ('account') {\n <form [formGroup]=\"accountForm\" class=\"sfs-edit-stack\" (ngSubmit)=\"save()\">\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-bank'\">Banco <span class=\"sfs-req\" aria-hidden=\"true\">*</span></label>\n @if (optionsOf(options().banks)) {\n <p-select [inputId]=\"id + '-bank'\" formControlName=\"bankId\" [options]=\"options().banks!\" optionLabel=\"label\" optionValue=\"value\"\n placeholder=\"Seleccione\" [filter]=\"true\" filterBy=\"label\" appendTo=\"body\"\n [ariaLabel]=\"selectLabel('Banco', accountForm.controls.bankId, 'Seleccione el banco.')\"></p-select>\n } @else {\n <input pInputText [id]=\"id + '-bank'\" formControlName=\"bankId\" maxlength=\"4\" placeholder=\"C\u00F3digo del banco\"\n [attr.aria-invalid]=\"invalid(accountForm.controls.bankId)\" [attr.aria-describedby]=\"invalid(accountForm.controls.bankId) ? id + '-bank-err' : null\" />\n }\n @if (invalid(accountForm.controls.bankId)) { <small [id]=\"id + '-bank-err'\" class=\"sfs-edit-err\"><i class=\"pi pi-exclamation-circle\" aria-hidden=\"true\"></i>Seleccione el banco.</small> }\n </div>\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-atype2'\">Tipo de cuenta <span class=\"sfs-req\" aria-hidden=\"true\">*</span></label>\n <p-select [inputId]=\"id + '-atype2'\" formControlName=\"accountTypeId\" [options]=\"options().accountTypes ?? []\" optionLabel=\"label\"\n optionValue=\"value\" placeholder=\"Seleccione\" appendTo=\"body\"\n [emptyMessage]=\"optionsState() === 'loading' ? 'Cargando\u2026' : 'No se pudieron cargar los tipos de cuenta.'\"\n [ariaLabel]=\"selectLabel('Tipo de cuenta', accountForm.controls.accountTypeId, 'Seleccione el tipo de cuenta.')\"></p-select>\n @if (invalid(accountForm.controls.accountTypeId)) { <small [id]=\"id + '-atype2-err'\" class=\"sfs-edit-err\"><i class=\"pi pi-exclamation-circle\" aria-hidden=\"true\"></i>Seleccione el tipo de cuenta.</small> }\n </div>\n <div class=\"sfs-edit-field\">\n <label [for]=\"id + '-number'\">N\u00FAmero <span class=\"sfs-req\" aria-hidden=\"true\">*</span></label>\n <input pInputText [id]=\"id + '-number'\" formControlName=\"number\" maxlength=\"20\" inputmode=\"numeric\" autocomplete=\"off\" aria-required=\"true\"\n [attr.aria-invalid]=\"invalid(accountForm.controls.number)\" [attr.aria-describedby]=\"invalid(accountForm.controls.number) ? id + '-number-err' : null\" />\n @if (invalid(accountForm.controls.number)) {\n <small [id]=\"id + '-number-err'\" class=\"sfs-edit-err\"><i class=\"pi pi-exclamation-circle\" aria-hidden=\"true\"></i>\n {{ accountForm.controls.number.hasError('required') ? 'Escriba el n\u00FAmero de la cuenta.' : 'Escriba solo n\u00FAmeros (de 4 a 20), con guiones si quiere.' }}\n </small>\n }\n </div>\n <div class=\"sfs-edit-check\">\n <p-checkbox [inputId]=\"id + '-aprimary'\" formControlName=\"primary\" [binary]=\"true\"></p-checkbox>\n <label [for]=\"id + '-aprimary'\">Cuenta principal</label>\n </div>\n </form>\n }\n }\n\n <div aria-live=\"polite\">\n @if (confirming()) {\n <p-message severity=\"warn\">\n <div class=\"sfs-edit-confirm\">\n <strong>Revise la cuenta antes de guardarla</strong>\n <span>{{ accountSummary() }} Los desembolsos y pagos a la persona pueden usar esta cuenta.</span>\n </div>\n </p-message>\n }\n @if (error(); as message) {\n <p-message severity=\"error\" [text]=\"message\"></p-message>\n }\n </div>\n </div>\n\n <ng-template #footer>\n <p-button [label]=\"confirming() ? 'Volver' : 'Cancelar'\" severity=\"secondary\" [text]=\"true\" [disabled]=\"saving()\" (onClick)=\"cancel()\"></p-button>\n <p-button [label]=\"saveLabel()\" icon=\"pi pi-check\" [loading]=\"saving()\" (onClick)=\"save()\"></p-button>\n </ng-template>\n</p-dialog>\n", styles: [".sfs-title{margin:0;font-size:1.125rem;font-weight:600}.sfs-subtitle{margin:0;font-size:1rem;font-weight:600}.sfs-muted{color:var(--p-text-muted-color)}.sfs-section-title{display:flex;align-items:center;gap:.5rem;margin:0 0 .75rem;font-size:1rem;font-weight:600}.sfs-section-title i{color:var(--primary-color, var(--p-primary-color))}.sfs-inline{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem}.sfs-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:.5rem;margin-bottom:.75rem}.sfs-break{overflow-wrap:anywhere}.sfs-nowrap{white-space:nowrap}.sfs-right{text-align:right}.sfs-strong{font-weight:600}.sfs-tag-gap{margin-left:.5rem}.sfs-stack{display:flex;flex-direction:column;gap:1rem}.sfs-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.sfs-summary{display:grid;grid-template-columns:minmax(8rem,max-content) 1fr;gap:.25rem 1rem;margin:0}.sfs-summary dt{color:var(--p-text-muted-color)}.sfs-summary dd{margin:0;text-align:right;font-variant-numeric:tabular-nums}@media (max-width: 575px){:host ::ng-deep .sfs-stack-table .p-datatable-table-container{overflow:visible!important}:host ::ng-deep .sfs-stack-table table,:host ::ng-deep .sfs-stack-table tbody{display:block;width:100%}:host ::ng-deep .sfs-stack-table thead{display:block!important;position:absolute!important;width:1px!important;height:1px!important;overflow:hidden!important;clip-path:inset(50%);white-space:nowrap}:host ::ng-deep .sfs-stack-table tbody tr{display:flex;flex-direction:column;margin-bottom:.5rem;padding:.5rem .75rem;border:1px solid var(--p-content-border-color);border-radius:var(--p-content-border-radius, 6px)}:host ::ng-deep .sfs-stack-table tbody td{display:flex;align-items:center;justify-content:flex-end;gap:.375rem;padding:.3rem 0;border:0;text-align:right}:host ::ng-deep .sfs-stack-table tbody td[data-label]:before{content:attr(data-label);margin-right:auto;padding-right:1rem;color:var(--p-text-muted-color);text-align:left}:host ::ng-deep .sfs-stack-table tbody td.sfs-stack-title{order:-1;display:block;font-weight:600;text-align:left}:host ::ng-deep .sfs-stack-table tfoot,:host ::ng-deep .sfs-stack-table .sfs-stack-hide{display:none}}\n", ".sfs-edit{display:flex;flex-direction:column;gap:1rem}.sfs-edit-who{margin:0;font-size:.875rem}.sfs-edit-stack{display:flex;flex-direction:column;gap:1rem}.sfs-edit-grid,.sfs-edit-row{display:grid;grid-template-columns:minmax(0,1fr);gap:1rem}@media (min-width: 576px){.sfs-edit-grid,.sfs-edit-row{grid-template-columns:repeat(2,minmax(0,1fr))}}.sfs-edit-field{display:flex;flex-direction:column;gap:.35rem;min-width:0}.sfs-edit-field>label{font-size:.875rem;font-weight:600}.sfs-edit-field input,.sfs-edit-field ::ng-deep .p-select,.sfs-edit-field ::ng-deep .p-datepicker{width:100%}.sfs-edit-check{display:flex;align-items:center;gap:.5rem;min-height:2.75rem}.sfs-req{color:var(--p-text-muted-color)}.sfs-edit-err{display:flex;align-items:flex-start;gap:.35rem;color:var(--p-message-error-simple-color, var(--p-text-color))}.sfs-edit-confirm{display:flex;flex-direction:column;gap:.25rem}\n"] }]
465
+ }] });
466
+ /**
467
+ * El motivo de un rechazo, para la persona. Con un 400 se muestra el `message` del host si lo da: el host decide si el
468
+ * texto del servidor sirve para la persona (la librería no traduce).
469
+ */
470
+ function rejection(status, message) {
471
+ if (status === 401)
472
+ return 'Su sesión venció. Vuelva a iniciar sesión y repita el cambio.';
473
+ if (status === 403)
474
+ return 'Su perfil no tiene permiso para esta edición. Si se lo acaban de dar, espere unos minutos.';
475
+ if (status === 404)
476
+ return 'No se encontró la persona o el registro, o la edición no está disponible en este ambiente. Cierre y vuelva a cargar los datos.';
477
+ if (status === 400 && message)
478
+ return `No se guardó: ${message}`;
479
+ return 'No se guardó. Revise los datos e intente de nuevo.';
480
+ }
481
+ function fromIso(value) {
482
+ const match = /^(\d{4})-(\d{2})-(\d{2})/.exec(value ?? '');
483
+ return match ? new Date(Number(match[1]), Number(match[2]) - 1, Number(match[3])) : null;
484
+ }
485
+ function toIso(value) {
486
+ if (!value)
487
+ return '';
488
+ const pad = (n) => n.toString().padStart(2, '0');
489
+ return `${value.getFullYear()}-${pad(value.getMonth() + 1)}-${pad(value.getDate())}`;
490
+ }
491
+
39
492
  /** Locale de moneda y números de los componentes: `| currency: 'COP' : 'symbol-narrow' : '1.0-0' : 'es-CO'`. */
40
493
  const LOCALE = 'es-CO';
41
494
  let localeRegistered = false;
@@ -98,8 +551,19 @@ let nextId$1 = 0;
98
551
  class ApplicationPersonComponent {
99
552
  gateway = inject(APPLICATION_PERSON_SERVICE);
100
553
  destroyRef = inject(DestroyRef);
554
+ injector = inject(Injector);
101
555
  /** Las personas de la solicitud; el titular es la de rol "Titular" o, si no hay, la primera. */
102
556
  parties = input.required();
557
+ /**
558
+ * Qué secciones del titular puede editar el perfil (lo decide el host con sus permisos). Sin permiso, el botón no
559
+ * aparece; tampoco si el host no implementa el método de esa sección en el puerto.
560
+ */
561
+ permissions = input({});
562
+ /**
563
+ * Se guardaron los datos básicos del titular. El nombre de la cabecera sale de `parties`, que trae el host: con
564
+ * esto el host sabe que tiene que volver a leer la solicitud para mostrar el nombre nuevo.
565
+ */
566
+ personUpdated = output();
103
567
  locale = LOCALE;
104
568
  ids = { more: `sfs-person-more-${++nextId$1}`, prefix: `sfs-person-${nextId$1}` };
105
569
  hasAccounts = typeof this.gateway.getAccounts === 'function';
@@ -137,6 +601,28 @@ class ApplicationPersonComponent {
137
601
  ].map((field) => ({ label: field.label, value: field.value?.toString().trim() || '—' }));
138
602
  });
139
603
  contacts = computed(() => this.person()?.contacts ?? []);
604
+ // ---- Edición
605
+ canEdit = computed(() => {
606
+ const p = this.permissions() ?? {};
607
+ return {
608
+ data: !!p.data && typeof this.gateway.updatePerson === 'function',
609
+ contacts: !!p.contacts && typeof this.gateway.saveContact === 'function',
610
+ addresses: !!p.addresses && typeof this.gateway.saveAddress === 'function',
611
+ accounts: !!p.accounts && typeof this.gateway.saveAccount === 'function'
612
+ };
613
+ });
614
+ editing = signal(null);
615
+ editOptions = signal({});
616
+ editOptionsState = signal('loading');
617
+ /** Se está recargando una sección después de guardar: lo de antes sigue a la vista, con aria-busy. */
618
+ refreshingPerson = signal(false);
619
+ refreshingAccounts = signal(false);
620
+ /** El resultado del último guardado, que se anuncia (aria-live) arriba de las secciones. */
621
+ editNotice = signal(null);
622
+ optionsRequested = false;
623
+ /** El botón que abrió el diálogo y la sección donde está: el foco vuelve ahí al cerrarlo. */
624
+ opener = null;
625
+ openerSection = null;
140
626
  addresses = computed(() => this.person()?.addresses ?? []);
141
627
  personRequest;
142
628
  accountsRequest;
@@ -184,38 +670,116 @@ class ApplicationPersonComponent {
184
670
  this.loadPerson();
185
671
  this.loadAccounts();
186
672
  }
187
- loadPerson() {
673
+ /**
674
+ * @param refresh Después de guardar: lo que se ve no se reemplaza por el esqueleto mientras llega (así no se pierden
675
+ * las secciones ni el botón que tenía el foco); se marca ocupado.
676
+ */
677
+ loadPerson(refresh = false) {
188
678
  const holder = this.holder();
189
679
  if (!holder?.documentNumber || !holder.documentType)
190
680
  return;
191
681
  this.personRequest?.unsubscribe();
192
- this.personState.set('loading');
682
+ const keep = refresh && this.personState() === 'ready';
683
+ if (keep)
684
+ this.refreshingPerson.set(true);
685
+ else
686
+ this.personState.set('loading');
193
687
  this.personRequest = this.gateway
194
688
  .getPerson(holder.documentType, holder.documentNumber)
195
689
  .pipe(takeUntilDestroyed(this.destroyRef))
196
690
  .subscribe({
197
691
  next: (person) => {
692
+ this.refreshingPerson.set(false);
198
693
  this.person.set(person);
199
694
  this.personState.set(person ? 'ready' : 'empty');
200
695
  },
201
- error: () => this.personState.set('error')
696
+ error: () => {
697
+ this.refreshingPerson.set(false);
698
+ this.personState.set('error');
699
+ }
202
700
  });
203
701
  }
204
- loadAccounts() {
702
+ loadAccounts(refresh = false) {
205
703
  const holder = this.holder();
206
704
  if (!holder?.documentNumber || !holder.documentType || !this.gateway.getAccounts)
207
705
  return;
208
706
  this.accountsRequest?.unsubscribe();
209
- this.accountsState.set('loading');
707
+ const keep = refresh && this.accountsState() === 'ready';
708
+ if (keep)
709
+ this.refreshingAccounts.set(true);
710
+ else
711
+ this.accountsState.set('loading');
210
712
  this.accountsRequest = this.gateway
211
713
  .getAccounts(holder.documentType, holder.documentNumber)
212
714
  .pipe(takeUntilDestroyed(this.destroyRef))
213
715
  .subscribe({
214
716
  next: (accounts) => {
717
+ this.refreshingAccounts.set(false);
215
718
  this.accounts.set(accounts ?? []);
216
719
  this.accountsState.set('ready');
217
720
  },
218
- error: () => this.accountsState.set('error')
721
+ error: () => {
722
+ this.refreshingAccounts.set(false);
723
+ this.accountsState.set('error');
724
+ }
725
+ });
726
+ }
727
+ edit(target, event) {
728
+ const opener = event?.target?.closest('button') ?? document.activeElement;
729
+ this.opener = opener;
730
+ this.openerSection = opener?.closest('section')?.getAttribute('aria-labelledby') ?? null;
731
+ this.editNotice.set(null);
732
+ this.loadEditOptions();
733
+ this.editing.set(target);
734
+ }
735
+ onEditSaved(result) {
736
+ const kind = this.editing()?.kind;
737
+ // Lo que se ve tiene que ser lo guardado: se recarga la sección, se haya guardado o no se sepa.
738
+ if (kind === 'account')
739
+ this.loadAccounts(true);
740
+ else
741
+ this.loadPerson(true);
742
+ if (kind === 'data' && result === 'saved')
743
+ this.personUpdated.emit();
744
+ this.editNotice.set(result === 'saved'
745
+ ? { severity: 'success', text: 'Se guardaron los cambios.' }
746
+ : {
747
+ severity: 'warn',
748
+ text: 'No se pudo confirmar si se guardó. Se volvieron a cargar los datos: revíselos antes de intentarlo de nuevo.'
749
+ });
750
+ }
751
+ onEditClosed() {
752
+ this.editing.set(null);
753
+ const opener = this.opener;
754
+ const section = this.openerSection;
755
+ this.opener = null;
756
+ this.openerSection = null;
757
+ // Al botón que abrió el diálogo. Las filas se vuelven a pintar al recargar: si su botón ya no está, el foco va al
758
+ // título de la sección, que no se desmonta.
759
+ afterNextRender(() => {
760
+ const target = opener?.isConnected ? opener : section ? document.getElementById(section) : null;
761
+ target?.focus();
762
+ }, { injector: this.injector });
763
+ }
764
+ /** Las listas de los formularios: se piden una vez, al abrir el primero. Si fallan, se pueden volver a pedir. */
765
+ loadEditOptions(retry = false) {
766
+ if (!this.gateway.getEditOptions) {
767
+ this.editOptionsState.set('ready');
768
+ return;
769
+ }
770
+ if (this.optionsRequested && !retry)
771
+ return;
772
+ this.optionsRequested = true;
773
+ this.editOptionsState.set('loading');
774
+ this.gateway
775
+ .getEditOptions()
776
+ .pipe(takeUntilDestroyed(this.destroyRef))
777
+ .subscribe({
778
+ next: (options) => {
779
+ this.editOptions.set(options ?? {});
780
+ this.editOptionsState.set('ready');
781
+ },
782
+ error: () => this.editOptionsState.set('error')
219
783
  });
220
784
  }
221
785
  holderKey() {
@@ -223,11 +787,11 @@ class ApplicationPersonComponent {
223
787
  return holder ? `${holder.documentType ?? ''}|${holder.documentNumber}` : null;
224
788
  }
225
789
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: ApplicationPersonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
226
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: ApplicationPersonComponent, isStandalone: true, selector: "lib-application-person", inputs: { parties: { classPropertyName: "parties", publicName: "parties", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0, template: "<p-card>\n @if (holder(); as titular) {\n <div class=\"sfs-person-head\">\n <div class=\"sfs-person-avatar\" aria-hidden=\"true\">{{ initials() }}</div>\n <div class=\"sfs-person-main\">\n <div class=\"sfs-person-name\">\n <h2 class=\"sfs-title\">{{ titular.name || '\u2014' }}</h2>\n @if (holderIdentity(); as identity) {\n <p-tag [value]=\"identity.label\" [icon]=\"identity.icon\" [severity]=\"identity.severity\"></p-tag>\n }\n </div>\n <div class=\"sfs-person-facts\">\n <span>Documento {{ titular.documentNumber || '\u2014' }}</span>\n <span>{{ titular.age != null ? (titular.age | number: '1.0-0' : locale) + ' a\u00F1os' : 'Edad: \u2014' }}</span>\n <span><i class=\"pi pi-mobile\" aria-hidden=\"true\"></i><span class=\"sfs-sr-only\">Celular: </span> {{ titular.phone || '\u2014' }}</span>\n <span class=\"sfs-break\"><i class=\"pi pi-envelope\" aria-hidden=\"true\"></i><span class=\"sfs-sr-only\">Correo: </span> {{ titular.email || '\u2014' }}</span>\n @if (others().length) {\n <span>{{ others().length }} {{ others().length === 1 ? 'persona m\u00E1s' : 'personas m\u00E1s' }} en la solicitud</span>\n }\n </div>\n </div>\n <!-- pButton y no p-button: el componente no deja poner aria-expanded en su <button>. -->\n <button pButton type=\"button\" class=\"sfs-person-toggle\" severity=\"secondary\" [text]=\"true\" label=\"Datos de la persona\" aria-label=\"Datos de la persona\"\n [icon]=\"expanded() ? 'pi pi-chevron-up' : 'pi pi-chevron-down'\" iconPos=\"right\"\n [attr.aria-expanded]=\"expanded()\" [attr.aria-controls]=\"ids.more\"\n (click)=\"toggle()\"></button>\n </div>\n\n @if (expanded()) {\n <div [id]=\"ids.more\" class=\"sfs-person-more\">\n <section [attr.aria-labelledby]=\"ids.prefix + '-general'\">\n <h3 [id]=\"ids.prefix + '-general'\" class=\"sfs-section-title\"><i class=\"pi pi-id-card\" aria-hidden=\"true\"></i> Informaci\u00F3n general</h3>\n @switch (personState()) {\n @case ('loading') {\n <div class=\"sfs-person-grid\" aria-busy=\"true\">\n @for (i of [1, 2, 3, 4, 5, 6, 7, 8]; track i) { <p-skeleton height=\"2.5rem\"></p-skeleton> }\n </div>\n }\n @case ('empty') {\n <p-message severity=\"info\" text=\"La persona no est\u00E1 registrada: se muestran solo los datos de la solicitud.\"></p-message>\n }\n @case ('missing') {\n <p-message severity=\"warn\" text=\"La solicitud no trae el tipo o el n\u00FAmero de documento del titular: no se pueden consultar sus datos.\"></p-message>\n }\n @case ('error') {\n <p-message severity=\"error\">\n <div class=\"sfs-inline\">\n <span>No se pudieron cargar los datos de la persona.</span>\n <p-button label=\"Reintentar\" icon=\"pi pi-refresh\" [text]=\"true\" (onClick)=\"loadPerson()\"></p-button>\n </div>\n </p-message>\n }\n @case ('ready') {\n <dl class=\"sfs-person-grid sfs-dl\">\n @for (field of generalFields(); track field.label) {\n <div class=\"sfs-field\">\n <dt>{{ field.label }}</dt>\n <dd>{{ field.value }}</dd>\n </div>\n }\n </dl>\n }\n }\n </section>\n\n @if (personState() === 'ready') {\n <section [attr.aria-labelledby]=\"ids.prefix + '-contact'\">\n <h3 [id]=\"ids.prefix + '-contact'\" class=\"sfs-section-title\"><i class=\"pi pi-phone\" aria-hidden=\"true\"></i> Informaci\u00F3n de contacto</h3>\n <p-table [value]=\"contacts()\" styleClass=\"p-datatable-sm\" [scrollable]=\"true\">\n <ng-template #header>\n <tr><th>Tipo</th><th>Descripci\u00F3n</th><th>Valor</th></tr>\n </ng-template>\n <ng-template #body let-c>\n <tr>\n <td>{{ c.type || '\u2014' }}</td>\n <td>{{ c.description || '\u2014' }}</td>\n <td class=\"sfs-break\">\n {{ c.value || '\u2014' }}\n @if (c.primary) { <span class=\"sfs-tag-gap\"><p-tag value=\"Principal\" severity=\"info\"></p-tag></span> }\n </td>\n </tr>\n </ng-template>\n <ng-template #emptymessage>\n <tr><td colspan=\"3\">La persona no tiene medios de contacto registrados.</td></tr>\n </ng-template>\n </p-table>\n </section>\n\n <section [attr.aria-labelledby]=\"ids.prefix + '-address'\">\n <h3 [id]=\"ids.prefix + '-address'\" class=\"sfs-section-title\"><i class=\"pi pi-home\" aria-hidden=\"true\"></i> Direcciones</h3>\n <p-table [value]=\"addresses()\" styleClass=\"p-datatable-sm\" [scrollable]=\"true\">\n <ng-template #header>\n <tr><th>Direcci\u00F3n</th><th>Pa\u00EDs</th><th>Ciudad</th><th>Barrio</th><th>Tel\u00E9fono</th></tr>\n </ng-template>\n <ng-template #body let-a>\n <tr>\n <td>{{ a.address || '\u2014' }}</td>\n <td>{{ a.country || '\u2014' }}</td>\n <td>{{ a.city || '\u2014' }}</td>\n <td>{{ a.neighborhood || '\u2014' }}</td>\n <td>{{ a.phone || '\u2014' }}</td>\n </tr>\n </ng-template>\n <ng-template #emptymessage>\n <tr><td colspan=\"5\">La persona no tiene direcciones registradas.</td></tr>\n </ng-template>\n </p-table>\n </section>\n }\n\n @if (hasAccounts && accountsState() !== 'missing') {\n <section [attr.aria-labelledby]=\"ids.prefix + '-accounts'\">\n <h3 [id]=\"ids.prefix + '-accounts'\" class=\"sfs-section-title\"><i class=\"pi pi-wallet\" aria-hidden=\"true\"></i> Cuentas</h3>\n @switch (accountsState()) {\n @case ('loading') { <p-skeleton height=\"5rem\" aria-busy=\"true\"></p-skeleton> }\n @case ('error') {\n <p-message severity=\"error\">\n <div class=\"sfs-inline\">\n <span>No se pudieron cargar las cuentas.</span>\n <p-button label=\"Reintentar\" icon=\"pi pi-refresh\" [text]=\"true\" (onClick)=\"loadAccounts()\"></p-button>\n </div>\n </p-message>\n }\n @case ('ready') {\n <p-table [value]=\"accounts()\" styleClass=\"p-datatable-sm\" [scrollable]=\"true\">\n <ng-template #header>\n <tr><th>Banco</th><th>Tipo de cuenta</th><th>N\u00FAmero</th></tr>\n </ng-template>\n <ng-template #body let-a>\n <tr>\n <td>{{ a.bank || '\u2014' }}</td>\n <td>{{ a.accountType || '\u2014' }}</td>\n <td>{{ a.number || '\u2014' }}</td>\n </tr>\n </ng-template>\n <ng-template #emptymessage>\n <tr><td colspan=\"3\">La persona no tiene cuentas registradas.</td></tr>\n </ng-template>\n </p-table>\n }\n }\n </section>\n }\n\n @if (others().length) {\n <section [attr.aria-labelledby]=\"ids.prefix + '-others'\">\n <h3 [id]=\"ids.prefix + '-others'\" class=\"sfs-section-title\"><i class=\"pi pi-users\" aria-hidden=\"true\"></i> Otras personas de la solicitud</h3>\n <p-table [value]=\"others()\" styleClass=\"p-datatable-sm\" [scrollable]=\"true\" dataKey=\"documentNumber\">\n <ng-template #header>\n <tr><th>Rol</th><th>Documento</th><th>Nombre</th><th>Identidad</th><th>Edad</th><th>Celular</th><th>Correo</th></tr>\n </ng-template>\n <ng-template #body let-p>\n <tr>\n <td>{{ p.role || '\u2014' }}</td>\n <td>{{ p.documentNumber || '\u2014' }}</td>\n <td>{{ p.name || '\u2014' }}</td>\n <td class=\"sfs-nowrap\">\n @if (identityView(p.identity); as identity) {\n <p-tag [value]=\"identity.short\" [icon]=\"identity.icon\" [severity]=\"identity.severity\"></p-tag>\n } @else { \u2014 }\n </td>\n <td>{{ p.age != null ? (p.age | number: '1.0-0' : locale) : '\u2014' }}</td>\n <td>{{ p.phone || '\u2014' }}</td>\n <td class=\"sfs-break\">{{ p.email || '\u2014' }}</td>\n </tr>\n </ng-template>\n </p-table>\n </section>\n }\n </div>\n }\n } @else {\n <p-message severity=\"info\" text=\"La solicitud no tiene titular registrado.\"></p-message>\n }\n</p-card>\n", styles: [".sfs-title{margin:0;font-size:1.125rem;font-weight:600}.sfs-subtitle{margin:0;font-size:1rem;font-weight:600}.sfs-muted{color:var(--p-text-muted-color)}.sfs-section-title{display:flex;align-items:center;gap:.5rem;margin:0 0 .75rem;font-size:1rem;font-weight:600}.sfs-section-title i{color:var(--primary-color, var(--p-primary-color))}.sfs-inline{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem}.sfs-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:.5rem;margin-bottom:.75rem}.sfs-break{overflow-wrap:anywhere}.sfs-nowrap{white-space:nowrap}.sfs-right{text-align:right}.sfs-strong{font-weight:600}.sfs-tag-gap{margin-left:.5rem}.sfs-stack{display:flex;flex-direction:column;gap:1rem}.sfs-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.sfs-summary{display:grid;grid-template-columns:minmax(8rem,max-content) 1fr;gap:.25rem 1rem;margin:0}.sfs-summary dt{color:var(--p-text-muted-color)}.sfs-summary dd{margin:0;text-align:right;font-variant-numeric:tabular-nums}@media (max-width: 575px){:host ::ng-deep .sfs-stack-table .p-datatable-table-container{overflow:visible!important}:host ::ng-deep .sfs-stack-table table,:host ::ng-deep .sfs-stack-table tbody{display:block;width:100%}:host ::ng-deep .sfs-stack-table thead{display:block!important;position:absolute!important;width:1px!important;height:1px!important;overflow:hidden!important;clip-path:inset(50%);white-space:nowrap}:host ::ng-deep .sfs-stack-table tbody tr{display:flex;flex-direction:column;margin-bottom:.5rem;padding:.5rem .75rem;border:1px solid var(--p-content-border-color);border-radius:var(--p-content-border-radius, 6px)}:host ::ng-deep .sfs-stack-table tbody td{display:flex;align-items:center;justify-content:flex-end;gap:.375rem;padding:.3rem 0;border:0;text-align:right}:host ::ng-deep .sfs-stack-table tbody td[data-label]:before{content:attr(data-label);margin-right:auto;padding-right:1rem;color:var(--p-text-muted-color);text-align:left}:host ::ng-deep .sfs-stack-table tbody td.sfs-stack-title{order:-1;display:block;font-weight:600;text-align:left}:host ::ng-deep .sfs-stack-table tfoot,:host ::ng-deep .sfs-stack-table .sfs-stack-hide{display:none}}\n", ".sfs-person-head{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem}.sfs-person-avatar{display:flex;align-items:center;justify-content:center;width:3.5rem;height:3.5rem;flex-shrink:0;border-radius:50%;font-size:1.25rem;font-weight:700;color:var(--primary-color, var(--p-primary-color));background:var(--p-highlight-background)}.sfs-person-main{display:flex;flex-direction:column;gap:.25rem;flex:1 1 14rem;min-width:0}@media (max-width: 575px){:host ::ng-deep .sfs-person-toggle.p-button{width:100%;justify-content:space-between}}.sfs-person-name{display:flex;flex-wrap:wrap;align-items:center;gap:.25rem .75rem}.sfs-person-facts{display:flex;flex-wrap:wrap;gap:.25rem 1rem;font-size:.875rem;color:var(--p-text-muted-color)}.sfs-person-facts i{font-size:.8rem}.sfs-person-more{display:flex;flex-direction:column;gap:1.25rem;margin-top:1rem;padding-top:1rem;border-top:1px solid var(--p-content-border-color)}.sfs-person-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.75rem 1rem}@media (min-width: 768px){.sfs-person-grid{grid-template-columns:repeat(4,minmax(0,1fr))}}.sfs-dl{margin:0}.sfs-field{display:flex;flex-direction:column;min-width:0}.sfs-field dt{font-size:.8rem;color:var(--p-text-muted-color)}.sfs-field dd{margin:0;overflow-wrap:anywhere}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: i1.DecimalPipe, name: "number" }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i3.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain", "fluid", "label", "icon", "buttonProps"] }, { kind: "component", type: i3.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: CardModule }, { kind: "component", type: i3$1.Card, selector: "p-card", inputs: ["header", "subheader", "style", "styleClass"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i4.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant"], outputs: ["onClose"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i5.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "style", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "ngmodule", type: TableModule }, { kind: "component", type: i6.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorStyleClass", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showJumpToPageInput", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "selectionPageOnly", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowSelectable", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "scrollDirection", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "virtualScrollDelay", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "autoLayout", "exportFunction", "exportHeader", "stateKey", "stateStorage", "editMode", "groupRowsBy", "size", "showGridlines", "stripedRows", "groupRowsByOrder", "responsiveLayout", "breakpoint", "paginatorLocale", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "virtualRowHeight", "selectAll"], outputs: ["contextMenuSelectionChange", "selectAllChange", "selectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { kind: "ngmodule", type: TagModule }, { kind: "component", type: i7.Tag, selector: "p-tag", inputs: ["style", "styleClass", "severity", "value", "icon", "rounded"] }] });
790
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: ApplicationPersonComponent, isStandalone: true, selector: "lib-application-person", inputs: { parties: { classPropertyName: "parties", publicName: "parties", isSignal: true, isRequired: true, transformFunction: null }, permissions: { classPropertyName: "permissions", publicName: "permissions", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { personUpdated: "personUpdated" }, ngImport: i0, template: "<p-card>\n @if (holder(); as titular) {\n <div class=\"sfs-person-head\">\n <div class=\"sfs-person-avatar\" aria-hidden=\"true\">{{ initials() }}</div>\n <div class=\"sfs-person-main\">\n <div class=\"sfs-person-name\">\n <h2 class=\"sfs-title\">{{ titular.name || '\u2014' }}</h2>\n @if (holderIdentity(); as identity) {\n <p-tag [value]=\"identity.label\" [icon]=\"identity.icon\" [severity]=\"identity.severity\"></p-tag>\n }\n </div>\n <div class=\"sfs-person-facts\">\n <span>Documento {{ titular.documentNumber || '\u2014' }}</span>\n <span>{{ titular.age != null ? (titular.age | number: '1.0-0' : locale) + ' a\u00F1os' : 'Edad: \u2014' }}</span>\n <span><i class=\"pi pi-mobile\" aria-hidden=\"true\"></i><span class=\"sfs-sr-only\">Celular: </span> {{ titular.phone || '\u2014' }}</span>\n <span class=\"sfs-break\"><i class=\"pi pi-envelope\" aria-hidden=\"true\"></i><span class=\"sfs-sr-only\">Correo: </span> {{ titular.email || '\u2014' }}</span>\n @if (others().length) {\n <span>{{ others().length }} {{ others().length === 1 ? 'persona m\u00E1s' : 'personas m\u00E1s' }} en la solicitud</span>\n }\n </div>\n </div>\n <!-- pButton y no p-button: el componente no deja poner aria-expanded en su <button>. -->\n <button pButton type=\"button\" class=\"sfs-person-toggle\" severity=\"secondary\" [text]=\"true\" label=\"Datos de la persona\" aria-label=\"Datos de la persona\"\n [icon]=\"expanded() ? 'pi pi-chevron-up' : 'pi pi-chevron-down'\" iconPos=\"right\"\n [attr.aria-expanded]=\"expanded()\" [attr.aria-controls]=\"ids.more\"\n (click)=\"toggle()\"></button>\n </div>\n\n @if (expanded()) {\n <div [id]=\"ids.more\" class=\"sfs-person-more\">\n <div aria-live=\"polite\">\n @if (editNotice(); as notice) {\n <p-message [severity]=\"notice.severity\" [text]=\"notice.text\"></p-message>\n }\n </div>\n\n <section [attr.aria-labelledby]=\"ids.prefix + '-general'\" [attr.aria-busy]=\"refreshingPerson() || null\">\n <div class=\"sfs-head\">\n <h3 [id]=\"ids.prefix + '-general'\" class=\"sfs-section-title\" tabindex=\"-1\"><i class=\"pi pi-id-card\" aria-hidden=\"true\"></i> Informaci\u00F3n general</h3>\n @if (canEdit().data && personState() === 'ready') {\n <p-button label=\"Editar\" icon=\"pi pi-pencil\" severity=\"secondary\" [text]=\"true\" ariaLabel=\"Editar datos b\u00E1sicos\"\n (onClick)=\"edit({ kind: 'data', item: person()?.edit ?? null }, $event)\"></p-button>\n }\n </div>\n @switch (personState()) {\n @case ('loading') {\n <div class=\"sfs-person-grid\" aria-busy=\"true\">\n @for (i of [1, 2, 3, 4, 5, 6, 7, 8]; track i) { <p-skeleton height=\"2.5rem\"></p-skeleton> }\n </div>\n }\n @case ('empty') {\n <p-message severity=\"info\" text=\"La persona no est\u00E1 registrada: se muestran solo los datos de la solicitud.\"></p-message>\n }\n @case ('missing') {\n <p-message severity=\"warn\" text=\"La solicitud no trae el tipo o el n\u00FAmero de documento del titular: no se pueden consultar sus datos.\"></p-message>\n }\n @case ('error') {\n <p-message severity=\"error\">\n <div class=\"sfs-inline\">\n <span>No se pudieron cargar los datos de la persona.</span>\n <p-button label=\"Reintentar\" icon=\"pi pi-refresh\" [text]=\"true\" (onClick)=\"loadPerson()\"></p-button>\n </div>\n </p-message>\n }\n @case ('ready') {\n <dl class=\"sfs-person-grid sfs-dl\">\n @for (field of generalFields(); track field.label) {\n <div class=\"sfs-field\">\n <dt>{{ field.label }}</dt>\n <dd>{{ field.value }}</dd>\n </div>\n }\n </dl>\n }\n }\n </section>\n\n @if (personState() === 'ready') {\n <section [attr.aria-labelledby]=\"ids.prefix + '-contact'\" [attr.aria-busy]=\"refreshingPerson() || null\">\n <div class=\"sfs-head\">\n <h3 [id]=\"ids.prefix + '-contact'\" class=\"sfs-section-title\" tabindex=\"-1\"><i class=\"pi pi-phone\" aria-hidden=\"true\"></i> Informaci\u00F3n de contacto</h3>\n @if (canEdit().contacts) {\n <p-button label=\"Agregar\" icon=\"pi pi-plus\" severity=\"secondary\" [text]=\"true\" ariaLabel=\"Agregar contacto\"\n (onClick)=\"edit({ kind: 'contact', item: null }, $event)\"></p-button>\n }\n </div>\n <p-table [value]=\"contacts()\" styleClass=\"p-datatable-sm\" [scrollable]=\"true\">\n <ng-template #header>\n <tr><th>Tipo</th><th>Descripci\u00F3n</th><th>Valor</th>@if (canEdit().contacts) { <th><span class=\"sfs-sr-only\">Acciones</span></th> }</tr>\n </ng-template>\n <ng-template #body let-c>\n <tr>\n <td>{{ c.type || '\u2014' }}</td>\n <td>{{ c.description || '\u2014' }}</td>\n <td class=\"sfs-break\">\n {{ c.value || '\u2014' }}\n @if (c.primary) { <span class=\"sfs-tag-gap\"><p-tag value=\"Principal\" severity=\"info\"></p-tag></span> }\n </td>\n @if (canEdit().contacts) {\n <td class=\"sfs-row-actions\">\n @if (c.id != null) {\n <p-button icon=\"pi pi-pencil\" severity=\"secondary\" [text]=\"true\" [rounded]=\"true\"\n [ariaLabel]=\"'Editar contacto ' + (c.value || '')\" [pTooltip]=\"'Editar contacto'\" tooltipPosition=\"left\"\n (onClick)=\"edit({ kind: 'contact', item: c }, $event)\"></p-button>\n }\n </td>\n }\n </tr>\n </ng-template>\n <ng-template #emptymessage>\n <tr><td [attr.colspan]=\"canEdit().contacts ? 4 : 3\">La persona no tiene medios de contacto registrados.</td></tr>\n </ng-template>\n </p-table>\n </section>\n\n <section [attr.aria-labelledby]=\"ids.prefix + '-address'\" [attr.aria-busy]=\"refreshingPerson() || null\">\n <div class=\"sfs-head\">\n <h3 [id]=\"ids.prefix + '-address'\" class=\"sfs-section-title\" tabindex=\"-1\"><i class=\"pi pi-home\" aria-hidden=\"true\"></i> Direcciones</h3>\n @if (canEdit().addresses) {\n <p-button label=\"Agregar\" icon=\"pi pi-plus\" severity=\"secondary\" [text]=\"true\" ariaLabel=\"Agregar direcci\u00F3n\"\n (onClick)=\"edit({ kind: 'address', item: null }, $event)\"></p-button>\n }\n </div>\n <p-table [value]=\"addresses()\" styleClass=\"p-datatable-sm\" [scrollable]=\"true\">\n <ng-template #header>\n <tr><th>Direcci\u00F3n</th><th>Pa\u00EDs</th><th>Ciudad</th><th>Barrio</th><th>Tel\u00E9fono</th>@if (canEdit().addresses) { <th><span class=\"sfs-sr-only\">Acciones</span></th> }</tr>\n </ng-template>\n <ng-template #body let-a>\n <tr>\n <td>{{ a.address || '\u2014' }}</td>\n <td>{{ a.country || '\u2014' }}</td>\n <td>{{ a.city || '\u2014' }}</td>\n <td>{{ a.neighborhood || '\u2014' }}</td>\n <td>{{ a.phone || '\u2014' }}</td>\n @if (canEdit().addresses) {\n <td class=\"sfs-row-actions\">\n @if (a.id != null) {\n <p-button icon=\"pi pi-pencil\" severity=\"secondary\" [text]=\"true\" [rounded]=\"true\"\n [ariaLabel]=\"'Editar direcci\u00F3n ' + (a.address || '')\" [pTooltip]=\"'Editar direcci\u00F3n'\" tooltipPosition=\"left\"\n (onClick)=\"edit({ kind: 'address', item: a }, $event)\"></p-button>\n }\n </td>\n }\n </tr>\n </ng-template>\n <ng-template #emptymessage>\n <tr><td [attr.colspan]=\"canEdit().addresses ? 6 : 5\">La persona no tiene direcciones registradas.</td></tr>\n </ng-template>\n </p-table>\n </section>\n }\n\n @if (hasAccounts && accountsState() !== 'missing') {\n <section [attr.aria-labelledby]=\"ids.prefix + '-accounts'\" [attr.aria-busy]=\"refreshingAccounts() || null\">\n <div class=\"sfs-head\">\n <h3 [id]=\"ids.prefix + '-accounts'\" class=\"sfs-section-title\" tabindex=\"-1\"><i class=\"pi pi-wallet\" aria-hidden=\"true\"></i> Cuentas</h3>\n @if (canEdit().accounts && accountsState() === 'ready') {\n <p-button label=\"Agregar\" icon=\"pi pi-plus\" severity=\"secondary\" [text]=\"true\" ariaLabel=\"Agregar cuenta\"\n (onClick)=\"edit({ kind: 'account', item: null }, $event)\"></p-button>\n }\n </div>\n @switch (accountsState()) {\n @case ('loading') { <p-skeleton height=\"5rem\" aria-busy=\"true\"></p-skeleton> }\n @case ('error') {\n <p-message severity=\"error\">\n <div class=\"sfs-inline\">\n <span>No se pudieron cargar las cuentas.</span>\n <p-button label=\"Reintentar\" icon=\"pi pi-refresh\" [text]=\"true\" (onClick)=\"loadAccounts()\"></p-button>\n </div>\n </p-message>\n }\n @case ('ready') {\n <p-table [value]=\"accounts()\" styleClass=\"p-datatable-sm\" [scrollable]=\"true\">\n <ng-template #header>\n <tr><th>Banco</th><th>Tipo de cuenta</th><th>N\u00FAmero</th>@if (canEdit().accounts) { <th><span class=\"sfs-sr-only\">Acciones</span></th> }</tr>\n </ng-template>\n <ng-template #body let-a>\n <tr>\n <td>{{ a.bank || '\u2014' }}</td>\n <td>{{ a.accountType || '\u2014' }}</td>\n <td>\n {{ a.number || '\u2014' }}\n @if (a.primary) { <span class=\"sfs-tag-gap\"><p-tag value=\"Principal\" severity=\"info\"></p-tag></span> }\n </td>\n @if (canEdit().accounts) {\n <td class=\"sfs-row-actions\">\n @if (a.id) {\n <p-button icon=\"pi pi-pencil\" severity=\"secondary\" [text]=\"true\" [rounded]=\"true\"\n [ariaLabel]=\"'Editar cuenta ' + (a.number || '')\" [pTooltip]=\"'Editar cuenta'\" tooltipPosition=\"left\"\n (onClick)=\"edit({ kind: 'account', item: a }, $event)\"></p-button>\n }\n </td>\n }\n </tr>\n </ng-template>\n <ng-template #emptymessage>\n <tr><td [attr.colspan]=\"canEdit().accounts ? 4 : 3\">La persona no tiene cuentas registradas.</td></tr>\n </ng-template>\n </p-table>\n }\n }\n </section>\n }\n\n @if (others().length) {\n <section [attr.aria-labelledby]=\"ids.prefix + '-others'\">\n <h3 [id]=\"ids.prefix + '-others'\" class=\"sfs-section-title\"><i class=\"pi pi-users\" aria-hidden=\"true\"></i> Otras personas de la solicitud</h3>\n <p-table [value]=\"others()\" styleClass=\"p-datatable-sm\" [scrollable]=\"true\" dataKey=\"documentNumber\">\n <ng-template #header>\n <tr><th>Rol</th><th>Documento</th><th>Nombre</th><th>Identidad</th><th>Edad</th><th>Celular</th><th>Correo</th></tr>\n </ng-template>\n <ng-template #body let-p>\n <tr>\n <td>{{ p.role || '\u2014' }}</td>\n <td>{{ p.documentNumber || '\u2014' }}</td>\n <td>{{ p.name || '\u2014' }}</td>\n <td class=\"sfs-nowrap\">\n @if (identityView(p.identity); as identity) {\n <p-tag [value]=\"identity.short\" [icon]=\"identity.icon\" [severity]=\"identity.severity\"></p-tag>\n } @else { \u2014 }\n </td>\n <td>{{ p.age != null ? (p.age | number: '1.0-0' : locale) : '\u2014' }}</td>\n <td>{{ p.phone || '\u2014' }}</td>\n <td class=\"sfs-break\">{{ p.email || '\u2014' }}</td>\n </tr>\n </ng-template>\n </p-table>\n </section>\n }\n </div>\n }\n\n @if (editing(); as target) {\n <lib-person-edit-dialog [target]=\"target\" [documentType]=\"titular.documentType ?? ''\" [documentNumber]=\"titular.documentNumber\"\n [personName]=\"titular.name\" [options]=\"editOptions()\" [optionsState]=\"editOptionsState()\" (saved)=\"onEditSaved($event)\" (closed)=\"onEditClosed()\"\n (retryOptions)=\"loadEditOptions(true)\"></lib-person-edit-dialog>\n }\n } @else {\n <p-message severity=\"info\" text=\"La solicitud no tiene titular registrado.\"></p-message>\n }\n</p-card>\n", styles: [".sfs-title{margin:0;font-size:1.125rem;font-weight:600}.sfs-subtitle{margin:0;font-size:1rem;font-weight:600}.sfs-muted{color:var(--p-text-muted-color)}.sfs-section-title{display:flex;align-items:center;gap:.5rem;margin:0 0 .75rem;font-size:1rem;font-weight:600}.sfs-section-title i{color:var(--primary-color, var(--p-primary-color))}.sfs-inline{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem}.sfs-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:.5rem;margin-bottom:.75rem}.sfs-break{overflow-wrap:anywhere}.sfs-nowrap{white-space:nowrap}.sfs-right{text-align:right}.sfs-strong{font-weight:600}.sfs-tag-gap{margin-left:.5rem}.sfs-stack{display:flex;flex-direction:column;gap:1rem}.sfs-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.sfs-summary{display:grid;grid-template-columns:minmax(8rem,max-content) 1fr;gap:.25rem 1rem;margin:0}.sfs-summary dt{color:var(--p-text-muted-color)}.sfs-summary dd{margin:0;text-align:right;font-variant-numeric:tabular-nums}@media (max-width: 575px){:host ::ng-deep .sfs-stack-table .p-datatable-table-container{overflow:visible!important}:host ::ng-deep .sfs-stack-table table,:host ::ng-deep .sfs-stack-table tbody{display:block;width:100%}:host ::ng-deep .sfs-stack-table thead{display:block!important;position:absolute!important;width:1px!important;height:1px!important;overflow:hidden!important;clip-path:inset(50%);white-space:nowrap}:host ::ng-deep .sfs-stack-table tbody tr{display:flex;flex-direction:column;margin-bottom:.5rem;padding:.5rem .75rem;border:1px solid var(--p-content-border-color);border-radius:var(--p-content-border-radius, 6px)}:host ::ng-deep .sfs-stack-table tbody td{display:flex;align-items:center;justify-content:flex-end;gap:.375rem;padding:.3rem 0;border:0;text-align:right}:host ::ng-deep .sfs-stack-table tbody td[data-label]:before{content:attr(data-label);margin-right:auto;padding-right:1rem;color:var(--p-text-muted-color);text-align:left}:host ::ng-deep .sfs-stack-table tbody td.sfs-stack-title{order:-1;display:block;font-weight:600;text-align:left}:host ::ng-deep .sfs-stack-table tfoot,:host ::ng-deep .sfs-stack-table .sfs-stack-hide{display:none}}\n", ".sfs-person-head{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem}.sfs-person-avatar{display:flex;align-items:center;justify-content:center;width:3.5rem;height:3.5rem;flex-shrink:0;border-radius:50%;font-size:1.25rem;font-weight:700;color:var(--primary-color, var(--p-primary-color));background:var(--p-highlight-background)}.sfs-person-main{display:flex;flex-direction:column;gap:.25rem;flex:1 1 14rem;min-width:0}@media (max-width: 575px){:host ::ng-deep .sfs-person-toggle.p-button{width:100%;justify-content:space-between}}.sfs-person-name{display:flex;flex-wrap:wrap;align-items:center;gap:.25rem .75rem}.sfs-person-facts{display:flex;flex-wrap:wrap;gap:.25rem 1rem;font-size:.875rem;color:var(--p-text-muted-color)}.sfs-person-facts i{font-size:.8rem}.sfs-person-more{display:flex;flex-direction:column;gap:1.25rem;margin-top:1rem;padding-top:1rem;border-top:1px solid var(--p-content-border-color)}.sfs-person-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.75rem 1rem}@media (min-width: 768px){.sfs-person-grid{grid-template-columns:repeat(4,minmax(0,1fr))}}.sfs-dl{margin:0}.sfs-field{display:flex;flex-direction:column;min-width:0}.sfs-field dt{font-size:.8rem;color:var(--p-text-muted-color)}.sfs-field dd{margin:0;overflow-wrap:anywhere}.sfs-head .sfs-section-title{margin:0}.sfs-row-actions{width:1%;white-space:nowrap;text-align:right}.sfs-section-title:focus:not(:focus-visible){outline:none}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: i1$1.DecimalPipe, name: "number" }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i2.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain", "fluid", "label", "icon", "buttonProps"] }, { kind: "component", type: i2.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: CardModule }, { kind: "component", type: i3$1.Card, selector: "p-card", inputs: ["header", "subheader", "style", "styleClass"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i7.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant"], outputs: ["onClose"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i5$1.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "style", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "ngmodule", type: TableModule }, { kind: "component", type: i6$1.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorStyleClass", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showJumpToPageInput", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "selectionPageOnly", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowSelectable", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "scrollDirection", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "virtualScrollDelay", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "autoLayout", "exportFunction", "exportHeader", "stateKey", "stateStorage", "editMode", "groupRowsBy", "size", "showGridlines", "stripedRows", "groupRowsByOrder", "responsiveLayout", "breakpoint", "paginatorLocale", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "virtualRowHeight", "selectAll"], outputs: ["contextMenuSelectionChange", "selectAllChange", "selectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { kind: "ngmodule", type: TagModule }, { kind: "component", type: i7$1.Tag, selector: "p-tag", inputs: ["style", "styleClass", "severity", "value", "icon", "rounded"] }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i8$1.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "component", type: PersonEditDialogComponent, selector: "lib-person-edit-dialog", inputs: ["target", "documentType", "documentNumber", "personName", "options", "optionsState"], outputs: ["saved", "closed", "retryOptions"] }] });
227
791
  }
228
792
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: ApplicationPersonComponent, decorators: [{
229
793
  type: Component,
230
- args: [{ selector: 'lib-application-person', imports: [CommonModule, ButtonModule, CardModule, MessageModule, SkeletonModule, TableModule, TagModule], template: "<p-card>\n @if (holder(); as titular) {\n <div class=\"sfs-person-head\">\n <div class=\"sfs-person-avatar\" aria-hidden=\"true\">{{ initials() }}</div>\n <div class=\"sfs-person-main\">\n <div class=\"sfs-person-name\">\n <h2 class=\"sfs-title\">{{ titular.name || '\u2014' }}</h2>\n @if (holderIdentity(); as identity) {\n <p-tag [value]=\"identity.label\" [icon]=\"identity.icon\" [severity]=\"identity.severity\"></p-tag>\n }\n </div>\n <div class=\"sfs-person-facts\">\n <span>Documento {{ titular.documentNumber || '\u2014' }}</span>\n <span>{{ titular.age != null ? (titular.age | number: '1.0-0' : locale) + ' a\u00F1os' : 'Edad: \u2014' }}</span>\n <span><i class=\"pi pi-mobile\" aria-hidden=\"true\"></i><span class=\"sfs-sr-only\">Celular: </span> {{ titular.phone || '\u2014' }}</span>\n <span class=\"sfs-break\"><i class=\"pi pi-envelope\" aria-hidden=\"true\"></i><span class=\"sfs-sr-only\">Correo: </span> {{ titular.email || '\u2014' }}</span>\n @if (others().length) {\n <span>{{ others().length }} {{ others().length === 1 ? 'persona m\u00E1s' : 'personas m\u00E1s' }} en la solicitud</span>\n }\n </div>\n </div>\n <!-- pButton y no p-button: el componente no deja poner aria-expanded en su <button>. -->\n <button pButton type=\"button\" class=\"sfs-person-toggle\" severity=\"secondary\" [text]=\"true\" label=\"Datos de la persona\" aria-label=\"Datos de la persona\"\n [icon]=\"expanded() ? 'pi pi-chevron-up' : 'pi pi-chevron-down'\" iconPos=\"right\"\n [attr.aria-expanded]=\"expanded()\" [attr.aria-controls]=\"ids.more\"\n (click)=\"toggle()\"></button>\n </div>\n\n @if (expanded()) {\n <div [id]=\"ids.more\" class=\"sfs-person-more\">\n <section [attr.aria-labelledby]=\"ids.prefix + '-general'\">\n <h3 [id]=\"ids.prefix + '-general'\" class=\"sfs-section-title\"><i class=\"pi pi-id-card\" aria-hidden=\"true\"></i> Informaci\u00F3n general</h3>\n @switch (personState()) {\n @case ('loading') {\n <div class=\"sfs-person-grid\" aria-busy=\"true\">\n @for (i of [1, 2, 3, 4, 5, 6, 7, 8]; track i) { <p-skeleton height=\"2.5rem\"></p-skeleton> }\n </div>\n }\n @case ('empty') {\n <p-message severity=\"info\" text=\"La persona no est\u00E1 registrada: se muestran solo los datos de la solicitud.\"></p-message>\n }\n @case ('missing') {\n <p-message severity=\"warn\" text=\"La solicitud no trae el tipo o el n\u00FAmero de documento del titular: no se pueden consultar sus datos.\"></p-message>\n }\n @case ('error') {\n <p-message severity=\"error\">\n <div class=\"sfs-inline\">\n <span>No se pudieron cargar los datos de la persona.</span>\n <p-button label=\"Reintentar\" icon=\"pi pi-refresh\" [text]=\"true\" (onClick)=\"loadPerson()\"></p-button>\n </div>\n </p-message>\n }\n @case ('ready') {\n <dl class=\"sfs-person-grid sfs-dl\">\n @for (field of generalFields(); track field.label) {\n <div class=\"sfs-field\">\n <dt>{{ field.label }}</dt>\n <dd>{{ field.value }}</dd>\n </div>\n }\n </dl>\n }\n }\n </section>\n\n @if (personState() === 'ready') {\n <section [attr.aria-labelledby]=\"ids.prefix + '-contact'\">\n <h3 [id]=\"ids.prefix + '-contact'\" class=\"sfs-section-title\"><i class=\"pi pi-phone\" aria-hidden=\"true\"></i> Informaci\u00F3n de contacto</h3>\n <p-table [value]=\"contacts()\" styleClass=\"p-datatable-sm\" [scrollable]=\"true\">\n <ng-template #header>\n <tr><th>Tipo</th><th>Descripci\u00F3n</th><th>Valor</th></tr>\n </ng-template>\n <ng-template #body let-c>\n <tr>\n <td>{{ c.type || '\u2014' }}</td>\n <td>{{ c.description || '\u2014' }}</td>\n <td class=\"sfs-break\">\n {{ c.value || '\u2014' }}\n @if (c.primary) { <span class=\"sfs-tag-gap\"><p-tag value=\"Principal\" severity=\"info\"></p-tag></span> }\n </td>\n </tr>\n </ng-template>\n <ng-template #emptymessage>\n <tr><td colspan=\"3\">La persona no tiene medios de contacto registrados.</td></tr>\n </ng-template>\n </p-table>\n </section>\n\n <section [attr.aria-labelledby]=\"ids.prefix + '-address'\">\n <h3 [id]=\"ids.prefix + '-address'\" class=\"sfs-section-title\"><i class=\"pi pi-home\" aria-hidden=\"true\"></i> Direcciones</h3>\n <p-table [value]=\"addresses()\" styleClass=\"p-datatable-sm\" [scrollable]=\"true\">\n <ng-template #header>\n <tr><th>Direcci\u00F3n</th><th>Pa\u00EDs</th><th>Ciudad</th><th>Barrio</th><th>Tel\u00E9fono</th></tr>\n </ng-template>\n <ng-template #body let-a>\n <tr>\n <td>{{ a.address || '\u2014' }}</td>\n <td>{{ a.country || '\u2014' }}</td>\n <td>{{ a.city || '\u2014' }}</td>\n <td>{{ a.neighborhood || '\u2014' }}</td>\n <td>{{ a.phone || '\u2014' }}</td>\n </tr>\n </ng-template>\n <ng-template #emptymessage>\n <tr><td colspan=\"5\">La persona no tiene direcciones registradas.</td></tr>\n </ng-template>\n </p-table>\n </section>\n }\n\n @if (hasAccounts && accountsState() !== 'missing') {\n <section [attr.aria-labelledby]=\"ids.prefix + '-accounts'\">\n <h3 [id]=\"ids.prefix + '-accounts'\" class=\"sfs-section-title\"><i class=\"pi pi-wallet\" aria-hidden=\"true\"></i> Cuentas</h3>\n @switch (accountsState()) {\n @case ('loading') { <p-skeleton height=\"5rem\" aria-busy=\"true\"></p-skeleton> }\n @case ('error') {\n <p-message severity=\"error\">\n <div class=\"sfs-inline\">\n <span>No se pudieron cargar las cuentas.</span>\n <p-button label=\"Reintentar\" icon=\"pi pi-refresh\" [text]=\"true\" (onClick)=\"loadAccounts()\"></p-button>\n </div>\n </p-message>\n }\n @case ('ready') {\n <p-table [value]=\"accounts()\" styleClass=\"p-datatable-sm\" [scrollable]=\"true\">\n <ng-template #header>\n <tr><th>Banco</th><th>Tipo de cuenta</th><th>N\u00FAmero</th></tr>\n </ng-template>\n <ng-template #body let-a>\n <tr>\n <td>{{ a.bank || '\u2014' }}</td>\n <td>{{ a.accountType || '\u2014' }}</td>\n <td>{{ a.number || '\u2014' }}</td>\n </tr>\n </ng-template>\n <ng-template #emptymessage>\n <tr><td colspan=\"3\">La persona no tiene cuentas registradas.</td></tr>\n </ng-template>\n </p-table>\n }\n }\n </section>\n }\n\n @if (others().length) {\n <section [attr.aria-labelledby]=\"ids.prefix + '-others'\">\n <h3 [id]=\"ids.prefix + '-others'\" class=\"sfs-section-title\"><i class=\"pi pi-users\" aria-hidden=\"true\"></i> Otras personas de la solicitud</h3>\n <p-table [value]=\"others()\" styleClass=\"p-datatable-sm\" [scrollable]=\"true\" dataKey=\"documentNumber\">\n <ng-template #header>\n <tr><th>Rol</th><th>Documento</th><th>Nombre</th><th>Identidad</th><th>Edad</th><th>Celular</th><th>Correo</th></tr>\n </ng-template>\n <ng-template #body let-p>\n <tr>\n <td>{{ p.role || '\u2014' }}</td>\n <td>{{ p.documentNumber || '\u2014' }}</td>\n <td>{{ p.name || '\u2014' }}</td>\n <td class=\"sfs-nowrap\">\n @if (identityView(p.identity); as identity) {\n <p-tag [value]=\"identity.short\" [icon]=\"identity.icon\" [severity]=\"identity.severity\"></p-tag>\n } @else { \u2014 }\n </td>\n <td>{{ p.age != null ? (p.age | number: '1.0-0' : locale) : '\u2014' }}</td>\n <td>{{ p.phone || '\u2014' }}</td>\n <td class=\"sfs-break\">{{ p.email || '\u2014' }}</td>\n </tr>\n </ng-template>\n </p-table>\n </section>\n }\n </div>\n }\n } @else {\n <p-message severity=\"info\" text=\"La solicitud no tiene titular registrado.\"></p-message>\n }\n</p-card>\n", styles: [".sfs-title{margin:0;font-size:1.125rem;font-weight:600}.sfs-subtitle{margin:0;font-size:1rem;font-weight:600}.sfs-muted{color:var(--p-text-muted-color)}.sfs-section-title{display:flex;align-items:center;gap:.5rem;margin:0 0 .75rem;font-size:1rem;font-weight:600}.sfs-section-title i{color:var(--primary-color, var(--p-primary-color))}.sfs-inline{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem}.sfs-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:.5rem;margin-bottom:.75rem}.sfs-break{overflow-wrap:anywhere}.sfs-nowrap{white-space:nowrap}.sfs-right{text-align:right}.sfs-strong{font-weight:600}.sfs-tag-gap{margin-left:.5rem}.sfs-stack{display:flex;flex-direction:column;gap:1rem}.sfs-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.sfs-summary{display:grid;grid-template-columns:minmax(8rem,max-content) 1fr;gap:.25rem 1rem;margin:0}.sfs-summary dt{color:var(--p-text-muted-color)}.sfs-summary dd{margin:0;text-align:right;font-variant-numeric:tabular-nums}@media (max-width: 575px){:host ::ng-deep .sfs-stack-table .p-datatable-table-container{overflow:visible!important}:host ::ng-deep .sfs-stack-table table,:host ::ng-deep .sfs-stack-table tbody{display:block;width:100%}:host ::ng-deep .sfs-stack-table thead{display:block!important;position:absolute!important;width:1px!important;height:1px!important;overflow:hidden!important;clip-path:inset(50%);white-space:nowrap}:host ::ng-deep .sfs-stack-table tbody tr{display:flex;flex-direction:column;margin-bottom:.5rem;padding:.5rem .75rem;border:1px solid var(--p-content-border-color);border-radius:var(--p-content-border-radius, 6px)}:host ::ng-deep .sfs-stack-table tbody td{display:flex;align-items:center;justify-content:flex-end;gap:.375rem;padding:.3rem 0;border:0;text-align:right}:host ::ng-deep .sfs-stack-table tbody td[data-label]:before{content:attr(data-label);margin-right:auto;padding-right:1rem;color:var(--p-text-muted-color);text-align:left}:host ::ng-deep .sfs-stack-table tbody td.sfs-stack-title{order:-1;display:block;font-weight:600;text-align:left}:host ::ng-deep .sfs-stack-table tfoot,:host ::ng-deep .sfs-stack-table .sfs-stack-hide{display:none}}\n", ".sfs-person-head{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem}.sfs-person-avatar{display:flex;align-items:center;justify-content:center;width:3.5rem;height:3.5rem;flex-shrink:0;border-radius:50%;font-size:1.25rem;font-weight:700;color:var(--primary-color, var(--p-primary-color));background:var(--p-highlight-background)}.sfs-person-main{display:flex;flex-direction:column;gap:.25rem;flex:1 1 14rem;min-width:0}@media (max-width: 575px){:host ::ng-deep .sfs-person-toggle.p-button{width:100%;justify-content:space-between}}.sfs-person-name{display:flex;flex-wrap:wrap;align-items:center;gap:.25rem .75rem}.sfs-person-facts{display:flex;flex-wrap:wrap;gap:.25rem 1rem;font-size:.875rem;color:var(--p-text-muted-color)}.sfs-person-facts i{font-size:.8rem}.sfs-person-more{display:flex;flex-direction:column;gap:1.25rem;margin-top:1rem;padding-top:1rem;border-top:1px solid var(--p-content-border-color)}.sfs-person-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.75rem 1rem}@media (min-width: 768px){.sfs-person-grid{grid-template-columns:repeat(4,minmax(0,1fr))}}.sfs-dl{margin:0}.sfs-field{display:flex;flex-direction:column;min-width:0}.sfs-field dt{font-size:.8rem;color:var(--p-text-muted-color)}.sfs-field dd{margin:0;overflow-wrap:anywhere}\n"] }]
794
+ args: [{ selector: 'lib-application-person', imports: [CommonModule, ButtonModule, CardModule, MessageModule, SkeletonModule, TableModule, TagModule, TooltipModule, PersonEditDialogComponent], template: "<p-card>\n @if (holder(); as titular) {\n <div class=\"sfs-person-head\">\n <div class=\"sfs-person-avatar\" aria-hidden=\"true\">{{ initials() }}</div>\n <div class=\"sfs-person-main\">\n <div class=\"sfs-person-name\">\n <h2 class=\"sfs-title\">{{ titular.name || '\u2014' }}</h2>\n @if (holderIdentity(); as identity) {\n <p-tag [value]=\"identity.label\" [icon]=\"identity.icon\" [severity]=\"identity.severity\"></p-tag>\n }\n </div>\n <div class=\"sfs-person-facts\">\n <span>Documento {{ titular.documentNumber || '\u2014' }}</span>\n <span>{{ titular.age != null ? (titular.age | number: '1.0-0' : locale) + ' a\u00F1os' : 'Edad: \u2014' }}</span>\n <span><i class=\"pi pi-mobile\" aria-hidden=\"true\"></i><span class=\"sfs-sr-only\">Celular: </span> {{ titular.phone || '\u2014' }}</span>\n <span class=\"sfs-break\"><i class=\"pi pi-envelope\" aria-hidden=\"true\"></i><span class=\"sfs-sr-only\">Correo: </span> {{ titular.email || '\u2014' }}</span>\n @if (others().length) {\n <span>{{ others().length }} {{ others().length === 1 ? 'persona m\u00E1s' : 'personas m\u00E1s' }} en la solicitud</span>\n }\n </div>\n </div>\n <!-- pButton y no p-button: el componente no deja poner aria-expanded en su <button>. -->\n <button pButton type=\"button\" class=\"sfs-person-toggle\" severity=\"secondary\" [text]=\"true\" label=\"Datos de la persona\" aria-label=\"Datos de la persona\"\n [icon]=\"expanded() ? 'pi pi-chevron-up' : 'pi pi-chevron-down'\" iconPos=\"right\"\n [attr.aria-expanded]=\"expanded()\" [attr.aria-controls]=\"ids.more\"\n (click)=\"toggle()\"></button>\n </div>\n\n @if (expanded()) {\n <div [id]=\"ids.more\" class=\"sfs-person-more\">\n <div aria-live=\"polite\">\n @if (editNotice(); as notice) {\n <p-message [severity]=\"notice.severity\" [text]=\"notice.text\"></p-message>\n }\n </div>\n\n <section [attr.aria-labelledby]=\"ids.prefix + '-general'\" [attr.aria-busy]=\"refreshingPerson() || null\">\n <div class=\"sfs-head\">\n <h3 [id]=\"ids.prefix + '-general'\" class=\"sfs-section-title\" tabindex=\"-1\"><i class=\"pi pi-id-card\" aria-hidden=\"true\"></i> Informaci\u00F3n general</h3>\n @if (canEdit().data && personState() === 'ready') {\n <p-button label=\"Editar\" icon=\"pi pi-pencil\" severity=\"secondary\" [text]=\"true\" ariaLabel=\"Editar datos b\u00E1sicos\"\n (onClick)=\"edit({ kind: 'data', item: person()?.edit ?? null }, $event)\"></p-button>\n }\n </div>\n @switch (personState()) {\n @case ('loading') {\n <div class=\"sfs-person-grid\" aria-busy=\"true\">\n @for (i of [1, 2, 3, 4, 5, 6, 7, 8]; track i) { <p-skeleton height=\"2.5rem\"></p-skeleton> }\n </div>\n }\n @case ('empty') {\n <p-message severity=\"info\" text=\"La persona no est\u00E1 registrada: se muestran solo los datos de la solicitud.\"></p-message>\n }\n @case ('missing') {\n <p-message severity=\"warn\" text=\"La solicitud no trae el tipo o el n\u00FAmero de documento del titular: no se pueden consultar sus datos.\"></p-message>\n }\n @case ('error') {\n <p-message severity=\"error\">\n <div class=\"sfs-inline\">\n <span>No se pudieron cargar los datos de la persona.</span>\n <p-button label=\"Reintentar\" icon=\"pi pi-refresh\" [text]=\"true\" (onClick)=\"loadPerson()\"></p-button>\n </div>\n </p-message>\n }\n @case ('ready') {\n <dl class=\"sfs-person-grid sfs-dl\">\n @for (field of generalFields(); track field.label) {\n <div class=\"sfs-field\">\n <dt>{{ field.label }}</dt>\n <dd>{{ field.value }}</dd>\n </div>\n }\n </dl>\n }\n }\n </section>\n\n @if (personState() === 'ready') {\n <section [attr.aria-labelledby]=\"ids.prefix + '-contact'\" [attr.aria-busy]=\"refreshingPerson() || null\">\n <div class=\"sfs-head\">\n <h3 [id]=\"ids.prefix + '-contact'\" class=\"sfs-section-title\" tabindex=\"-1\"><i class=\"pi pi-phone\" aria-hidden=\"true\"></i> Informaci\u00F3n de contacto</h3>\n @if (canEdit().contacts) {\n <p-button label=\"Agregar\" icon=\"pi pi-plus\" severity=\"secondary\" [text]=\"true\" ariaLabel=\"Agregar contacto\"\n (onClick)=\"edit({ kind: 'contact', item: null }, $event)\"></p-button>\n }\n </div>\n <p-table [value]=\"contacts()\" styleClass=\"p-datatable-sm\" [scrollable]=\"true\">\n <ng-template #header>\n <tr><th>Tipo</th><th>Descripci\u00F3n</th><th>Valor</th>@if (canEdit().contacts) { <th><span class=\"sfs-sr-only\">Acciones</span></th> }</tr>\n </ng-template>\n <ng-template #body let-c>\n <tr>\n <td>{{ c.type || '\u2014' }}</td>\n <td>{{ c.description || '\u2014' }}</td>\n <td class=\"sfs-break\">\n {{ c.value || '\u2014' }}\n @if (c.primary) { <span class=\"sfs-tag-gap\"><p-tag value=\"Principal\" severity=\"info\"></p-tag></span> }\n </td>\n @if (canEdit().contacts) {\n <td class=\"sfs-row-actions\">\n @if (c.id != null) {\n <p-button icon=\"pi pi-pencil\" severity=\"secondary\" [text]=\"true\" [rounded]=\"true\"\n [ariaLabel]=\"'Editar contacto ' + (c.value || '')\" [pTooltip]=\"'Editar contacto'\" tooltipPosition=\"left\"\n (onClick)=\"edit({ kind: 'contact', item: c }, $event)\"></p-button>\n }\n </td>\n }\n </tr>\n </ng-template>\n <ng-template #emptymessage>\n <tr><td [attr.colspan]=\"canEdit().contacts ? 4 : 3\">La persona no tiene medios de contacto registrados.</td></tr>\n </ng-template>\n </p-table>\n </section>\n\n <section [attr.aria-labelledby]=\"ids.prefix + '-address'\" [attr.aria-busy]=\"refreshingPerson() || null\">\n <div class=\"sfs-head\">\n <h3 [id]=\"ids.prefix + '-address'\" class=\"sfs-section-title\" tabindex=\"-1\"><i class=\"pi pi-home\" aria-hidden=\"true\"></i> Direcciones</h3>\n @if (canEdit().addresses) {\n <p-button label=\"Agregar\" icon=\"pi pi-plus\" severity=\"secondary\" [text]=\"true\" ariaLabel=\"Agregar direcci\u00F3n\"\n (onClick)=\"edit({ kind: 'address', item: null }, $event)\"></p-button>\n }\n </div>\n <p-table [value]=\"addresses()\" styleClass=\"p-datatable-sm\" [scrollable]=\"true\">\n <ng-template #header>\n <tr><th>Direcci\u00F3n</th><th>Pa\u00EDs</th><th>Ciudad</th><th>Barrio</th><th>Tel\u00E9fono</th>@if (canEdit().addresses) { <th><span class=\"sfs-sr-only\">Acciones</span></th> }</tr>\n </ng-template>\n <ng-template #body let-a>\n <tr>\n <td>{{ a.address || '\u2014' }}</td>\n <td>{{ a.country || '\u2014' }}</td>\n <td>{{ a.city || '\u2014' }}</td>\n <td>{{ a.neighborhood || '\u2014' }}</td>\n <td>{{ a.phone || '\u2014' }}</td>\n @if (canEdit().addresses) {\n <td class=\"sfs-row-actions\">\n @if (a.id != null) {\n <p-button icon=\"pi pi-pencil\" severity=\"secondary\" [text]=\"true\" [rounded]=\"true\"\n [ariaLabel]=\"'Editar direcci\u00F3n ' + (a.address || '')\" [pTooltip]=\"'Editar direcci\u00F3n'\" tooltipPosition=\"left\"\n (onClick)=\"edit({ kind: 'address', item: a }, $event)\"></p-button>\n }\n </td>\n }\n </tr>\n </ng-template>\n <ng-template #emptymessage>\n <tr><td [attr.colspan]=\"canEdit().addresses ? 6 : 5\">La persona no tiene direcciones registradas.</td></tr>\n </ng-template>\n </p-table>\n </section>\n }\n\n @if (hasAccounts && accountsState() !== 'missing') {\n <section [attr.aria-labelledby]=\"ids.prefix + '-accounts'\" [attr.aria-busy]=\"refreshingAccounts() || null\">\n <div class=\"sfs-head\">\n <h3 [id]=\"ids.prefix + '-accounts'\" class=\"sfs-section-title\" tabindex=\"-1\"><i class=\"pi pi-wallet\" aria-hidden=\"true\"></i> Cuentas</h3>\n @if (canEdit().accounts && accountsState() === 'ready') {\n <p-button label=\"Agregar\" icon=\"pi pi-plus\" severity=\"secondary\" [text]=\"true\" ariaLabel=\"Agregar cuenta\"\n (onClick)=\"edit({ kind: 'account', item: null }, $event)\"></p-button>\n }\n </div>\n @switch (accountsState()) {\n @case ('loading') { <p-skeleton height=\"5rem\" aria-busy=\"true\"></p-skeleton> }\n @case ('error') {\n <p-message severity=\"error\">\n <div class=\"sfs-inline\">\n <span>No se pudieron cargar las cuentas.</span>\n <p-button label=\"Reintentar\" icon=\"pi pi-refresh\" [text]=\"true\" (onClick)=\"loadAccounts()\"></p-button>\n </div>\n </p-message>\n }\n @case ('ready') {\n <p-table [value]=\"accounts()\" styleClass=\"p-datatable-sm\" [scrollable]=\"true\">\n <ng-template #header>\n <tr><th>Banco</th><th>Tipo de cuenta</th><th>N\u00FAmero</th>@if (canEdit().accounts) { <th><span class=\"sfs-sr-only\">Acciones</span></th> }</tr>\n </ng-template>\n <ng-template #body let-a>\n <tr>\n <td>{{ a.bank || '\u2014' }}</td>\n <td>{{ a.accountType || '\u2014' }}</td>\n <td>\n {{ a.number || '\u2014' }}\n @if (a.primary) { <span class=\"sfs-tag-gap\"><p-tag value=\"Principal\" severity=\"info\"></p-tag></span> }\n </td>\n @if (canEdit().accounts) {\n <td class=\"sfs-row-actions\">\n @if (a.id) {\n <p-button icon=\"pi pi-pencil\" severity=\"secondary\" [text]=\"true\" [rounded]=\"true\"\n [ariaLabel]=\"'Editar cuenta ' + (a.number || '')\" [pTooltip]=\"'Editar cuenta'\" tooltipPosition=\"left\"\n (onClick)=\"edit({ kind: 'account', item: a }, $event)\"></p-button>\n }\n </td>\n }\n </tr>\n </ng-template>\n <ng-template #emptymessage>\n <tr><td [attr.colspan]=\"canEdit().accounts ? 4 : 3\">La persona no tiene cuentas registradas.</td></tr>\n </ng-template>\n </p-table>\n }\n }\n </section>\n }\n\n @if (others().length) {\n <section [attr.aria-labelledby]=\"ids.prefix + '-others'\">\n <h3 [id]=\"ids.prefix + '-others'\" class=\"sfs-section-title\"><i class=\"pi pi-users\" aria-hidden=\"true\"></i> Otras personas de la solicitud</h3>\n <p-table [value]=\"others()\" styleClass=\"p-datatable-sm\" [scrollable]=\"true\" dataKey=\"documentNumber\">\n <ng-template #header>\n <tr><th>Rol</th><th>Documento</th><th>Nombre</th><th>Identidad</th><th>Edad</th><th>Celular</th><th>Correo</th></tr>\n </ng-template>\n <ng-template #body let-p>\n <tr>\n <td>{{ p.role || '\u2014' }}</td>\n <td>{{ p.documentNumber || '\u2014' }}</td>\n <td>{{ p.name || '\u2014' }}</td>\n <td class=\"sfs-nowrap\">\n @if (identityView(p.identity); as identity) {\n <p-tag [value]=\"identity.short\" [icon]=\"identity.icon\" [severity]=\"identity.severity\"></p-tag>\n } @else { \u2014 }\n </td>\n <td>{{ p.age != null ? (p.age | number: '1.0-0' : locale) : '\u2014' }}</td>\n <td>{{ p.phone || '\u2014' }}</td>\n <td class=\"sfs-break\">{{ p.email || '\u2014' }}</td>\n </tr>\n </ng-template>\n </p-table>\n </section>\n }\n </div>\n }\n\n @if (editing(); as target) {\n <lib-person-edit-dialog [target]=\"target\" [documentType]=\"titular.documentType ?? ''\" [documentNumber]=\"titular.documentNumber\"\n [personName]=\"titular.name\" [options]=\"editOptions()\" [optionsState]=\"editOptionsState()\" (saved)=\"onEditSaved($event)\" (closed)=\"onEditClosed()\"\n (retryOptions)=\"loadEditOptions(true)\"></lib-person-edit-dialog>\n }\n } @else {\n <p-message severity=\"info\" text=\"La solicitud no tiene titular registrado.\"></p-message>\n }\n</p-card>\n", styles: [".sfs-title{margin:0;font-size:1.125rem;font-weight:600}.sfs-subtitle{margin:0;font-size:1rem;font-weight:600}.sfs-muted{color:var(--p-text-muted-color)}.sfs-section-title{display:flex;align-items:center;gap:.5rem;margin:0 0 .75rem;font-size:1rem;font-weight:600}.sfs-section-title i{color:var(--primary-color, var(--p-primary-color))}.sfs-inline{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem}.sfs-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:.5rem;margin-bottom:.75rem}.sfs-break{overflow-wrap:anywhere}.sfs-nowrap{white-space:nowrap}.sfs-right{text-align:right}.sfs-strong{font-weight:600}.sfs-tag-gap{margin-left:.5rem}.sfs-stack{display:flex;flex-direction:column;gap:1rem}.sfs-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.sfs-summary{display:grid;grid-template-columns:minmax(8rem,max-content) 1fr;gap:.25rem 1rem;margin:0}.sfs-summary dt{color:var(--p-text-muted-color)}.sfs-summary dd{margin:0;text-align:right;font-variant-numeric:tabular-nums}@media (max-width: 575px){:host ::ng-deep .sfs-stack-table .p-datatable-table-container{overflow:visible!important}:host ::ng-deep .sfs-stack-table table,:host ::ng-deep .sfs-stack-table tbody{display:block;width:100%}:host ::ng-deep .sfs-stack-table thead{display:block!important;position:absolute!important;width:1px!important;height:1px!important;overflow:hidden!important;clip-path:inset(50%);white-space:nowrap}:host ::ng-deep .sfs-stack-table tbody tr{display:flex;flex-direction:column;margin-bottom:.5rem;padding:.5rem .75rem;border:1px solid var(--p-content-border-color);border-radius:var(--p-content-border-radius, 6px)}:host ::ng-deep .sfs-stack-table tbody td{display:flex;align-items:center;justify-content:flex-end;gap:.375rem;padding:.3rem 0;border:0;text-align:right}:host ::ng-deep .sfs-stack-table tbody td[data-label]:before{content:attr(data-label);margin-right:auto;padding-right:1rem;color:var(--p-text-muted-color);text-align:left}:host ::ng-deep .sfs-stack-table tbody td.sfs-stack-title{order:-1;display:block;font-weight:600;text-align:left}:host ::ng-deep .sfs-stack-table tfoot,:host ::ng-deep .sfs-stack-table .sfs-stack-hide{display:none}}\n", ".sfs-person-head{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem}.sfs-person-avatar{display:flex;align-items:center;justify-content:center;width:3.5rem;height:3.5rem;flex-shrink:0;border-radius:50%;font-size:1.25rem;font-weight:700;color:var(--primary-color, var(--p-primary-color));background:var(--p-highlight-background)}.sfs-person-main{display:flex;flex-direction:column;gap:.25rem;flex:1 1 14rem;min-width:0}@media (max-width: 575px){:host ::ng-deep .sfs-person-toggle.p-button{width:100%;justify-content:space-between}}.sfs-person-name{display:flex;flex-wrap:wrap;align-items:center;gap:.25rem .75rem}.sfs-person-facts{display:flex;flex-wrap:wrap;gap:.25rem 1rem;font-size:.875rem;color:var(--p-text-muted-color)}.sfs-person-facts i{font-size:.8rem}.sfs-person-more{display:flex;flex-direction:column;gap:1.25rem;margin-top:1rem;padding-top:1rem;border-top:1px solid var(--p-content-border-color)}.sfs-person-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.75rem 1rem}@media (min-width: 768px){.sfs-person-grid{grid-template-columns:repeat(4,minmax(0,1fr))}}.sfs-dl{margin:0}.sfs-field{display:flex;flex-direction:column;min-width:0}.sfs-field dt{font-size:.8rem;color:var(--p-text-muted-color)}.sfs-field dd{margin:0;overflow-wrap:anywhere}.sfs-head .sfs-section-title{margin:0}.sfs-row-actions{width:1%;white-space:nowrap;text-align:right}.sfs-section-title:focus:not(:focus-visible){outline:none}\n"] }]
231
795
  }], ctorParameters: () => [] });
232
796
 
233
797
  /** Métodos de cargo que se configuran en pesos; el resto es un porcentaje (fracción en el core). */
@@ -263,6 +827,11 @@ class LineSimulatorComponent {
263
827
  canEdit = input(false);
264
828
  /** Cargos cuyo valor configurado puede cambiar (por nombre, sin importar mayúsculas). */
265
829
  editableCharges = input([]);
830
+ /**
831
+ * Puede elegir otra tasa entre las del producto (`simulation.allowedRates`) y la de la línea. Lo decide el host con
832
+ * el perfil (en TFB, la opción API / LOANS / RATE); el back lo vuelve a revisar.
833
+ */
834
+ canEditRate = input(false);
266
835
  /**
267
836
  * Muestra "Guardar condiciones". Va en false si el perfil nunca puede guardar (se oculta, no se deshabilita) o si
268
837
  * el formulario guarda por su cuenta y escucha `lineChange`.
@@ -296,13 +865,27 @@ class LineSimulatorComponent {
296
865
  garnishment: `sfs-sim-garnishment-${n}`,
297
866
  capacityTitle: `sfs-sim-capacity-title-${n}`,
298
867
  resultTitle: `sfs-sim-result-title-${n}`,
299
- saveReason: `sfs-sim-save-reason-${n}`
868
+ saveReason: `sfs-sim-save-reason-${n}`,
869
+ installment: `sfs-sim-installment-${n}`,
870
+ installmentError: `sfs-sim-installment-error-${n}`,
871
+ rate: `sfs-sim-rate-${n}`,
872
+ rateLabel: `sfs-sim-rate-label-${n}`,
873
+ charges: `sfs-sim-charges-${n}`,
874
+ chargesTitle: `sfs-sim-charges-title-${n}`
300
875
  };
301
876
  })();
302
877
  selectedLine = signal(null);
303
878
  termInput = signal(null);
304
879
  amountInput = signal(null);
305
880
  chargeInputs = signal({});
881
+ /** La cuota que digitó la persona; null mientras no la toque (se ve el disponible nómina). */
882
+ installmentInput = signal(null);
883
+ /** La cuota con que se simuló lo que se ve; null si fue por capacidad. */
884
+ simulatedInstallment = signal(null);
885
+ /** La tasa elegida para la línea; se reinicia al elegir otra línea. */
886
+ rateInput = signal(null);
887
+ /** Los cargos se despliegan a pedido: la mayoría de las veces no se tocan. */
888
+ chargesOpen = signal(false);
306
889
  /** La capacidad editada; null mientras no se toque. */
307
890
  capacityInput = signal(null);
308
891
  confirmVisible = signal(false);
@@ -317,6 +900,47 @@ class LineSimulatorComponent {
317
900
  /** Contra qué se mide si la capacidad cambió: la que se simuló. */
318
901
  referenceCapacity = computed(() => this.simulatedCapacity() ?? this.capacity());
319
902
  currentCapacity = computed(() => this.capacityInput() ?? this.referenceCapacity());
903
+ /** Disponible nómina: la cuota total más alta (capacidad más aporte). Null mientras no hay simulación. */
904
+ maxInstallment = computed(() => {
905
+ const c = this.simulation()?.capacity;
906
+ if (!c)
907
+ return null;
908
+ return c.maxInstallment ?? c.payrollCapacity + (c.contribution ?? 0);
909
+ });
910
+ /** La cuota que se ve: la digitada, o la cuota total de la línea simulada. */
911
+ currentInstallment = computed(() => this.installmentInput() ?? this.line()?.installment ?? null);
912
+ /**
913
+ * La cuota se digita solo si el host la soporta: lo dice al mandar el disponible nómina (`capacity.maxInstallment`).
914
+ * Un host que no la manda (forms-ui, por ahora) ve lo de antes.
915
+ */
916
+ installmentEditable = computed(() => this.simulation()?.capacity?.maxInstallment != null && (this.canEdit() || this.capacityEditable()));
917
+ /** La tasa se elige con el permiso de la tasa y el de editar la solicitud en su estado. */
918
+ rateEditable = computed(() => this.canEditRate() && this.canEdit());
919
+ /** Por qué la cuota no sirve; null si sirve. */
920
+ installmentError = computed(() => {
921
+ const value = this.installmentInput();
922
+ if (value === null)
923
+ return null;
924
+ if (value <= 0)
925
+ return 'La cuota tiene que ser mayor que cero.';
926
+ const max = this.maxInstallment();
927
+ if (max !== null && value > max)
928
+ return 'La cuota no puede superar el disponible nómina.';
929
+ return null;
930
+ });
931
+ /** Las tasas que se pueden elegir para la línea: las del producto y la suya, de menor a mayor. */
932
+ rateOptions = computed(() => {
933
+ const line = this.line();
934
+ if (!line)
935
+ return [];
936
+ const lineRate = line.lineRate ?? line.rate;
937
+ const rates = new Set([...(this.simulation()?.allowedRates ?? []), lineRate, line.rate].map((r) => round(r, 4)));
938
+ return [...rates]
939
+ .sort((a, b) => a - b)
940
+ .map((rate) => ({ value: rate, label: `${formatRate(rate)} % M.V.${sameValue(rate, lineRate) ? ' (de la línea)' : ''}` }));
941
+ });
942
+ /** La tasa que se ve: la elegida o la simulada. */
943
+ currentRate = computed(() => this.rateInput() ?? this.line()?.rate ?? null);
320
944
  lineOptions = computed(() => (this.simulation()?.lines ?? []).map((line) => ({
321
945
  value: line.line,
322
946
  label: line.lineName || `Línea ${line.line}`,
@@ -370,6 +994,12 @@ class LineSimulatorComponent {
370
994
  const zero = this.zeroChargeNames();
371
995
  return this.showZeroCharges() || !zero.size ? this.chargeRows() : this.chargeRows().filter((row) => !zero.has(row.name));
372
996
  });
997
+ /** Cargos del crédito (se descuentan del desembolso o se suman al capital). */
998
+ creditChargeRows = computed(() => this.visibleChargeRows().filter((row) => row.type === 'ADMIN'));
999
+ /** Cargos que van en la cuota (seguro, aporte…). */
1000
+ installmentChargeRows = computed(() => this.visibleChargeRows().filter((row) => row.type === 'CUOTA'));
1001
+ /** Cuántos cargos se cambiaron sin recalcular: se dice en el botón aunque estén plegados. */
1002
+ editedChargesCount = computed(() => Object.keys(this.editedCharges()).length);
373
1003
  /** Cargos editados que difieren de lo que calculó el simulador, en la unidad del core (fracción o pesos). */
374
1004
  editedCharges = computed(() => {
375
1005
  const inputs = this.chargeInputs();
@@ -395,11 +1025,38 @@ class LineSimulatorComponent {
395
1025
  return false;
396
1026
  return ((this.termInput() ?? line.term) !== line.term ||
397
1027
  (this.amountInput() ?? line.amount) !== line.amount ||
1028
+ !sameValue(this.currentRate() ?? line.rate, line.rate) ||
1029
+ this.installmentChanged() ||
398
1030
  Object.keys(this.editedCharges()).length > 0);
399
1031
  });
1032
+ /** La cuota digitada no es con la que se simuló. */
1033
+ installmentChanged = computed(() => {
1034
+ const typed = this.installmentInput();
1035
+ if (typed === null)
1036
+ return false;
1037
+ return !sameValue(typed, this.simulatedInstallment() ?? this.line()?.installment ?? typed);
1038
+ });
1039
+ /** Algo digitado no sirve: no se recalcula ni se guarda. */
400
1040
  hasNegativeInput = computed(() => (this.amountInput() ?? 0) < 0 ||
1041
+ !!this.installmentError() ||
401
1042
  Object.values(this.chargeInputs()).some((v) => v !== null && v !== undefined && v < 0) ||
402
1043
  CAPACITY_FIELDS.some((f) => this.currentCapacity()[f.key] < 0));
1044
+ /** El resumen de lo que se gira: máximo a financiar, descuentos, desembolso, compras, sanear y neto a girar. */
1045
+ summary = computed(() => {
1046
+ const l = this.line();
1047
+ if (!l)
1048
+ return null;
1049
+ const s = this.simulation();
1050
+ return {
1051
+ maxAmount: l.defaultAmount,
1052
+ amount: l.amount,
1053
+ creditDiscounts: l.administrativeCharges,
1054
+ disbursement: l.disbursement,
1055
+ purchases: s?.purchasesInPayslip ?? null,
1056
+ cleanUp: s?.purchasesToCleanUp ?? null,
1057
+ net: l.transfer
1058
+ };
1059
+ });
403
1060
  /** Por qué no se puede guardar ahora, para mostrarlo junto al botón; null si se puede. */
404
1061
  saveUnavailableReason = computed(() => {
405
1062
  const blocked = this.saveBlockedReason();
@@ -438,10 +1095,7 @@ class LineSimulatorComponent {
438
1095
  row('Plazo', 'term', hasSaved ? s.term : null, l.term),
439
1096
  row('Tasa', 'rate', hasSaved ? s.rate : null, l.rate),
440
1097
  row('Cuota total', 'money', hasSaved ? s.totalInstallment : null, l.installment),
441
- row('Seguro', 'money', null, l.insurance),
442
- row('Cargos administrativos', 'money', null, l.administrativeCharges),
443
- row('Desembolso', 'money', null, l.disbursement),
444
- row('Giro al cliente', 'money', null, l.transfer)
1098
+ row('Seguro', 'money', null, l.insurance)
445
1099
  ];
446
1100
  });
447
1101
  /**
@@ -460,6 +1114,7 @@ class LineSimulatorComponent {
460
1114
  return (l.line !== s.line ||
461
1115
  l.term !== s.term ||
462
1116
  !sameValue(l.amount, s.amount) ||
1117
+ !sameValue(l.rate, s.rate) ||
463
1118
  this.chargeRows().some((row) => row.savedInput !== null && !sameValue(row.savedInput, row.simulatedInput)));
464
1119
  });
465
1120
  /** Lo que se anuncia al lector de pantalla cuando cambia la simulación (región siempre montada). */
@@ -495,6 +1150,9 @@ class LineSimulatorComponent {
495
1150
  const requested = this.pendingRequest;
496
1151
  this.pendingRequest = null;
497
1152
  if (requested) {
1153
+ this.simulatedInstallment.set(requested.installment ?? null);
1154
+ if (this.installmentInput() !== null && sameValue(this.installmentInput(), requested.installment ?? NaN))
1155
+ this.installmentInput.set(null);
498
1156
  this.simulatedCapacity.set(requested.capacity);
499
1157
  if (this.capacityInput() && sameCapacity(this.capacityInput(), requested.capacity))
500
1158
  this.capacityInput.set(null);
@@ -504,6 +1162,8 @@ class LineSimulatorComponent {
504
1162
  this.lastRequest = null;
505
1163
  this.capacityInput.set(null);
506
1164
  this.simulatedCapacity.set(null);
1165
+ this.installmentInput.set(null);
1166
+ this.simulatedInstallment.set(null);
507
1167
  }
508
1168
  const keep = requested ? simulation.lines.find((l) => l.line === this.selectedLine()) : undefined;
509
1169
  const saved = simulation.lines.find((l) => l.line === this.saved()?.line);
@@ -563,6 +1223,7 @@ class LineSimulatorComponent {
563
1223
  const line = this.simulation()?.lines.find((l) => l.line === code);
564
1224
  this.termInput.set(line?.term ?? null);
565
1225
  this.amountInput.set(line?.amount ?? null);
1226
+ this.rateInput.set(line?.rate ?? null);
566
1227
  const inputs = {};
567
1228
  for (const row of this.chargeRows())
568
1229
  inputs[row.name] = row.simulatedInput;
@@ -584,23 +1245,42 @@ class LineSimulatorComponent {
584
1245
  const line = this.line();
585
1246
  this.touched.set(true);
586
1247
  const edited = this.editedCharges();
1248
+ const installment = this.installmentInput() ?? this.simulatedInstallment();
1249
+ // Con una cuota nueva el monto sale de ella (máximo a financiar): el monto anterior no se manda como pedido.
1250
+ const amount = this.installmentChanged() && (this.amountInput() ?? line?.amount) === line?.amount ? null : (this.amountInput() ?? line?.amount ?? null);
587
1251
  const lines = line
588
1252
  ? [
589
1253
  {
590
1254
  line: line.line,
591
1255
  term: this.termInput() ?? line.term,
592
- amount: this.amountInput() ?? line.amount,
1256
+ amount,
593
1257
  defaultTerm: line.defaultTerm ?? null,
594
1258
  defaultAmount: line.defaultAmount,
595
- editedCharges: Object.keys(edited).length ? edited : null
1259
+ editedCharges: Object.keys(edited).length ? edited : null,
1260
+ rate: this.chosenRate()
596
1261
  }
597
1262
  ]
598
1263
  : [];
599
- const request = { capacity: this.currentCapacity(), lines };
1264
+ const request = { capacity: this.currentCapacity(), lines, installment: installment ?? null };
600
1265
  this.pendingRequest = request;
601
1266
  this.lastRequest = request;
602
1267
  this.simulate.emit(request);
603
1268
  }
1269
+ /** La tasa elegida, solo si es otra que la de la línea (el back exige el permiso cuando llega una). */
1270
+ chosenRate() {
1271
+ const line = this.line();
1272
+ const rate = this.currentRate();
1273
+ if (!line || rate === null)
1274
+ return null;
1275
+ return sameValue(rate, line.lineRate ?? line.rate) ? null : rate;
1276
+ }
1277
+ setInstallment(value) {
1278
+ this.installmentInput.set(value);
1279
+ }
1280
+ /** Vuelve a la cuota más alta: el disponible nómina. */
1281
+ useMaxInstallment() {
1282
+ this.installmentInput.set(this.maxInstallment());
1283
+ }
604
1284
  retrySimulation() {
605
1285
  if (this.lastRequest)
606
1286
  this.pendingRequest = this.lastRequest;
@@ -636,6 +1316,9 @@ class LineSimulatorComponent {
636
1316
  term: line.term,
637
1317
  amount: line.amount,
638
1318
  editedCharges: Object.keys(editedCharges).length ? editedCharges : null,
1319
+ // Solo cuando se usan: un host que no los conoce recibe lo mismo que antes.
1320
+ ...(sameValue(line.rate, line.lineRate ?? line.rate) ? {} : { rate: line.rate }),
1321
+ ...(this.simulatedInstallment() !== null ? { installment: this.simulatedInstallment() } : {}),
639
1322
  ...(this.capacityEditable() ? { capacity: this.referenceCapacity() } : {})
640
1323
  });
641
1324
  }
@@ -643,7 +1326,7 @@ class LineSimulatorComponent {
643
1326
  return type === 'ADMIN' ? 'Crédito' : 'Cuota';
644
1327
  }
645
1328
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: LineSimulatorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
646
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: LineSimulatorComponent, isStandalone: true, selector: "lib-line-simulator", inputs: { capacity: { classPropertyName: "capacity", publicName: "capacity", isSignal: true, isRequired: true, transformFunction: null }, capacityEditable: { classPropertyName: "capacityEditable", publicName: "capacityEditable", isSignal: true, isRequired: false, transformFunction: null }, simulation: { classPropertyName: "simulation", publicName: "simulation", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, errorMessage: { classPropertyName: "errorMessage", publicName: "errorMessage", isSignal: true, isRequired: false, transformFunction: null }, saved: { classPropertyName: "saved", publicName: "saved", isSignal: true, isRequired: false, transformFunction: null }, canEdit: { classPropertyName: "canEdit", publicName: "canEdit", isSignal: true, isRequired: false, transformFunction: null }, editableCharges: { classPropertyName: "editableCharges", publicName: "editableCharges", isSignal: true, isRequired: false, transformFunction: null }, showSave: { classPropertyName: "showSave", publicName: "showSave", isSignal: true, isRequired: false, transformFunction: null }, saveBlockedReason: { classPropertyName: "saveBlockedReason", publicName: "saveBlockedReason", isSignal: true, isRequired: false, transformFunction: null }, saving: { classPropertyName: "saving", publicName: "saving", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { simulate: "simulate", save: "save", retry: "retry", lineChange: "lineChange", unsavedChange: "unsavedChange" }, ngImport: i0, template: "<div class=\"sfs-stack\">\n <!-- Capacidad de pago -->\n <section [attr.aria-labelledby]=\"ids.capacityTitle\">\n <h3 [id]=\"ids.capacityTitle\" class=\"sfs-subtitle sfs-gap-bottom\">Capacidad de pago</h3>\n @if (capacityEditable()) {\n <div class=\"sfs-capacity-grid\">\n @for (field of capacityFields; track field.key) {\n <div class=\"sfs-control\">\n <label [for]=\"ids.capacity + field.key\">{{ field.label }}</label>\n <p-inputnumber [inputId]=\"ids.capacity + field.key\" [ngModel]=\"currentCapacity()[field.key]\" (ngModelChange)=\"setCapacity(field.key, $event)\"\n mode=\"currency\" currency=\"COP\" [locale]=\"locale\" [minFractionDigits]=\"0\" [maxFractionDigits]=\"0\" [min]=\"0\" [fluid]=\"true\"></p-inputnumber>\n </div>\n }\n <div class=\"sfs-control sfs-control--check\">\n <p-checkbox [inputId]=\"ids.garnishment\" [binary]=\"true\" [ngModel]=\"currentCapacity().hasGarnishment\" (ngModelChange)=\"setGarnishment($event)\"></p-checkbox>\n <label [for]=\"ids.garnishment\">Tiene embargo</label>\n </div>\n </div>\n }\n <!-- Indicadores en grilla: varios por fila en escritorio, para que la capacidad no ocupe media pantalla. -->\n @if (!capacityEditable() || simulation()) {\n <dl class=\"sfs-metrics\" [class.sfs-gap-top]=\"capacityEditable()\">\n @if (!capacityEditable()) {\n <div><dt>Ingresos</dt><dd>{{ capacity().income | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Descuentos de ley</dt><dd>{{ capacity().legalDeductions | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Otras afiliaciones</dt><dd>{{ capacity().otherAffiliations | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Otros descuentos</dt><dd>{{ capacity().otherDeductions | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Compras de cartera</dt><dd>{{ capacity().purchasesValue | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Embargo</dt><dd>{{ capacity().hasGarnishment ? 'S\u00ED' : 'No' }}</dd></div>\n }\n @if (simulation(); as s) {\n <div><dt>Cuota disponible</dt><dd class=\"sfs-strong\">{{ s.capacity.availableInstallment | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Monto m\u00E1ximo</dt><dd class=\"sfs-strong\">{{ s.capacity.maxAmount != null ? (s.capacity.maxAmount | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale) : '\u2014' }}</dd></div>\n }\n </dl>\n }\n </section>\n\n @switch (state()) {\n @case ('loading') {\n <div class=\"sfs-stack\" aria-busy=\"true\">\n <p-skeleton height=\"2.5rem\"></p-skeleton>\n <p-skeleton height=\"12rem\"></p-skeleton>\n </div>\n }\n @case ('error') {\n <p-message severity=\"error\">\n <div class=\"sfs-inline\">\n <span>{{ errorMessage() || 'No se pudo simular la solicitud.' }}</span>\n <p-button label=\"Reintentar\" icon=\"pi pi-refresh\" [text]=\"true\" (onClick)=\"retrySimulation()\"></p-button>\n </div>\n </p-message>\n @if (capacityEditable() && pendingChanges()) {\n <div class=\"sfs-actions\">\n <p-button label=\"Recalcular\" icon=\"pi pi-calculator\" severity=\"secondary\" [text]=\"true\" [disabled]=\"hasNegativeInput()\" (onClick)=\"recalculate()\"></p-button>\n </div>\n }\n }\n @case ('idle') {\n @if (capacityEditable()) {\n <div class=\"sfs-actions\">\n <p-button label=\"Simular\" icon=\"pi pi-calculator\" [disabled]=\"hasNegativeInput()\" (onClick)=\"recalculate()\"></p-button>\n </div>\n } @else {\n <p class=\"sfs-muted sfs-no-top\">Todav\u00EDa no hay una simulaci\u00F3n para esta solicitud.</p>\n }\n }\n @case ('ready') {\n @if (simulation()?.warnings?.length) {\n <p-message severity=\"warn\">\n <ul class=\"sfs-list\">\n @for (w of simulation()?.warnings ?? []; track $index) { <li>{{ w }}</li> }\n </ul>\n </p-message>\n }\n\n @if (!lineOptions().length) {\n <p-message severity=\"info\" text=\"El simulador no devolvi\u00F3 l\u00EDneas para esta solicitud. Revise la pagadur\u00EDa, el producto y la capacidad de pago.\"></p-message>\n }\n\n <!-- L\u00EDnea, plazo, monto y tasa en una sola fila en escritorio. p-select pone el inputId en un span: el nombre\n accesible va por ariaLabelledBy. -->\n <div class=\"sfs-conditions\">\n <div class=\"sfs-control sfs-conditions__line\">\n <label [id]=\"ids.lineLabel\" [for]=\"ids.line\" class=\"sfs-strong\">L\u00EDnea</label>\n <p-select [inputId]=\"ids.line\" [ariaLabelledBy]=\"ids.lineLabel\" [options]=\"lineOptions()\" optionLabel=\"label\" optionValue=\"value\" optionDisabled=\"disabled\"\n [ngModel]=\"selectedLine()\" (ngModelChange)=\"chooseLine($event)\" placeholder=\"Seleccione una l\u00EDnea\" [fluid]=\"true\"></p-select>\n </div>\n @if (line(); as l) {\n @if (!l.error) {\n <div class=\"sfs-control\">\n <label [for]=\"ids.term\">Plazo (cuotas)</label>\n <p-inputnumber [inputId]=\"ids.term\" [ngModel]=\"termInput()\" (ngModelChange)=\"termInput.set($event)\"\n [min]=\"simulation()?.minTerm ?? 1\" [max]=\"simulation()?.maxTerm ?? 600\" [useGrouping]=\"false\"\n [disabled]=\"!canEdit()\" [fluid]=\"true\"></p-inputnumber>\n </div>\n <div class=\"sfs-control\">\n <label [for]=\"ids.amount\">Monto</label>\n <p-inputnumber [inputId]=\"ids.amount\" [ngModel]=\"amountInput()\" (ngModelChange)=\"amountInput.set($event)\"\n mode=\"currency\" currency=\"COP\" [locale]=\"locale\" [minFractionDigits]=\"0\" [maxFractionDigits]=\"0\" [min]=\"0\"\n [disabled]=\"!canEdit()\" [fluid]=\"true\"></p-inputnumber>\n </div>\n <div class=\"sfs-control sfs-conditions__rate\">\n <span>Tasa</span>\n <span class=\"sfs-strong\">{{ l.rate | number: '1.0-4' : locale }} % M.V.</span>\n </div>\n }\n }\n </div>\n @if (saved()?.line && saved()?.line !== selectedLine()) {\n <small class=\"sfs-muted sfs-no-gap\">La l\u00EDnea guardada es {{ savedLineName() }}. Al guardar se cambia por la elegida.</small>\n }\n\n @if (line(); as l) {\n @if (l.error) {\n <p-message severity=\"error\" text=\"Esta l\u00EDnea no se pudo simular. Elija otra o intente m\u00E1s tarde.\"></p-message>\n } @else {\n <!-- Cargos de la l\u00EDnea, con lo guardado al lado -->\n <p-table [value]=\"visibleChargeRows()\" size=\"small\" [scrollable]=\"true\" dataKey=\"name\" styleClass=\"sfs-stack-table\">\n <ng-template #header>\n <tr>\n <th>Cargo</th>\n <th>Tipo</th>\n <th class=\"sfs-right\">Guardado</th>\n <th class=\"sfs-right\">Configurado</th>\n <th class=\"sfs-right\">Valor</th>\n </tr>\n </ng-template>\n <ng-template #body let-row>\n <tr>\n <td class=\"sfs-stack-title\">{{ row.label }}</td>\n <td data-label=\"Tipo\">{{ chargeTypeLabel(row.type) }}</td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Guardado\">\n @if (row.savedInput === null) { \u2014 }\n @else { {{ row.percentage ? (row.savedInput | number: '1.0-4' : locale) + ' %' : (row.savedInput | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale) }} }\n </td>\n <td class=\"sfs-right\" data-label=\"Configurado\">\n @if (row.editable) {\n <label [for]=\"row.id\" class=\"sfs-sr-only\">{{ row.label }}</label>\n <p-inputnumber [inputId]=\"row.id\" [ngModel]=\"chargeInputs()[row.name]\" (ngModelChange)=\"setChargeInput(row.name, $event)\"\n [min]=\"0\" [minFractionDigits]=\"0\" [maxFractionDigits]=\"row.percentage ? 4 : 0\" [locale]=\"locale\"\n [suffix]=\"row.percentage ? ' %' : ''\" [prefix]=\"row.percentage ? '' : '$ '\" inputStyleClass=\"sfs-charge-input\"></p-inputnumber>\n } @else {\n {{ row.percentage ? (row.simulatedInput | number: '1.0-4' : locale) + ' %' : (row.simulatedInput | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale) }}\n }\n </td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Valor\">{{ row.value | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</td>\n </tr>\n </ng-template>\n <ng-template #emptymessage>\n <tr><td colspan=\"5\">La l\u00EDnea no tiene cargos.</td></tr>\n </ng-template>\n </p-table>\n @if (zeroChargesCount()) {\n <!-- Los cargos en cero (sin guardado, sin configurado y sin valor) ocupan espacio y no cambian nada. -->\n <div class=\"sfs-no-gap\">\n <p-button [label]=\"showZeroCharges() ? 'Ocultar los cargos en cero' : 'Ver ' + zeroChargesCount() + (zeroChargesCount() === 1 ? ' cargo en cero' : ' cargos en cero')\"\n [icon]=\"showZeroCharges() ? 'pi pi-eye-slash' : 'pi pi-eye'\" [text]=\"true\" size=\"small\" severity=\"secondary\"\n [ariaLabel]=\"showZeroCharges() ? 'Ocultar los cargos en cero' : 'Ver los cargos en cero'\"\n (onClick)=\"showZeroCharges.set(!showZeroCharges())\"></p-button>\n </div>\n }\n\n <!-- Resultado frente a lo guardado -->\n <section [attr.aria-labelledby]=\"ids.resultTitle\">\n <div class=\"sfs-head\">\n <h3 [id]=\"ids.resultTitle\" class=\"sfs-subtitle\">Resultado</h3>\n <p-tag [value]=\"l.viable ? 'Viable' : 'No viable'\" [severity]=\"l.viable ? 'success' : 'warn'\"></p-tag>\n </div>\n <p-table [value]=\"comparison()\" size=\"small\" [scrollable]=\"true\" dataKey=\"label\" styleClass=\"sfs-stack-table\">\n <ng-template #header>\n <tr><th>Concepto</th><th class=\"sfs-right\">Guardado</th><th class=\"sfs-right\">Simulaci\u00F3n</th></tr>\n </ng-template>\n <ng-template #body let-row>\n <tr>\n <td class=\"sfs-stack-title\">{{ row.label }}</td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Guardado\">\n <ng-container *ngTemplateOutlet=\"valueTpl; context: { $implicit: row.saved, kind: row.kind }\"></ng-container>\n </td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Simulaci\u00F3n\">\n @if (row.changed) { <span class=\"sfs-tag-before\"><p-tag value=\"Cambia\" severity=\"warn\"></p-tag></span> }\n <span [class.sfs-strong]=\"row.changed\">\n <ng-container *ngTemplateOutlet=\"valueTpl; context: { $implicit: row.simulated, kind: row.kind }\"></ng-container>\n </span>\n </td>\n </tr>\n </ng-template>\n </p-table>\n @if (!l.viable && l.viabilityReasons.length) {\n <ul class=\"sfs-list sfs-gap-top\">\n @for (reason of l.viabilityReasons; track $index) { <li>{{ reason }}</li> }\n </ul>\n }\n </section>\n\n <!-- Acciones -->\n <div class=\"sfs-actions\">\n @if (canEdit() || capacityEditable()) {\n <p-button label=\"Recalcular\" icon=\"pi pi-calculator\" severity=\"secondary\" [text]=\"true\"\n [disabled]=\"!pendingChanges() || hasNegativeInput()\" (onClick)=\"recalculate()\"></p-button>\n }\n @if (showSave()) {\n <!-- pButton y no p-button: sin poder guardar el bot\u00F3n queda aria-disabled (no disabled) para que el\n motivo se vea con Tab y con el mouse; openConfirm() corta el clic cuando hay motivo. -->\n <button pButton type=\"button\" label=\"Guardar condiciones\" aria-label=\"Guardar condiciones\"\n [icon]=\"saveUnavailableReason() ? 'pi pi-lock' : 'pi pi-save'\"\n [class.sfs-unavailable]=\"!!saveUnavailableReason()\"\n [attr.aria-disabled]=\"saveUnavailableReason() ? 'true' : null\"\n [attr.aria-describedby]=\"saveUnavailableReason() ? ids.saveReason : null\"\n [pTooltip]=\"saveUnavailableReason() ?? ''\" [tooltipDisabled]=\"!saveUnavailableReason()\" tooltipPosition=\"top\" tooltipEvent=\"both\"\n (click)=\"openConfirm()\"></button>\n @if (saveUnavailableReason()) {\n <span [id]=\"ids.saveReason\" class=\"sfs-sr-only\">{{ saveUnavailableReason() }}</span>\n }\n }\n </div>\n }\n }\n }\n }\n</div>\n\n<!-- Siempre montada: anuncia el resultado de cada simulaci\u00F3n (la de arriba se destruye mientras carga). -->\n<div class=\"sfs-sr-only\" role=\"status\" aria-live=\"polite\">{{ liveMessage() }}</div>\n\n<!-- Un valor de la comparaci\u00F3n, en su formato -->\n<ng-template #valueTpl let-value let-kind=\"kind\">\n @if (value === null || value === undefined || value === '') { \u2014 }\n @else {\n @switch (kind) {\n @case ('money') { {{ value | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }} }\n @case ('rate') { {{ value | number: '1.0-4' : locale }} % M.V. }\n @case ('term') { {{ value }} cuotas }\n @default { {{ value }} }\n }\n }\n</ng-template>\n\n<!-- Confirmaci\u00F3n: cambia l\u00EDnea, monto, plazo y cargos de la solicitud -->\n<p-dialog header=\"Guardar condiciones\" [visible]=\"confirmVisible()\" (visibleChange)=\"confirmVisible.set($event)\" (onHide)=\"restoreConfirmFocus()\"\n [modal]=\"true\" [draggable]=\"false\" [closable]=\"!saving()\" [style]=\"{ width: '32rem', maxWidth: '95vw' }\">\n @if (confirmVisible() && line(); as l) {\n <p class=\"sfs-no-top\">\n Se guardar\u00E1n la l\u00EDnea <strong>{{ l.lineName || l.line }}</strong>,\n un monto de <strong>{{ l.amount | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</strong>\n a <strong>{{ l.term }} cuotas</strong> con una tasa de <strong>{{ l.rate | number: '1.0-4' : locale }} % M.V.</strong> y una cuota de <strong>{{ l.installment | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</strong>,\n con un giro al cliente de <strong>{{ l.transfer | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</strong>.\n </p>\n @if (!l.viable) {\n <p-message severity=\"warn\" text=\"La l\u00EDnea no es viable con la capacidad de pago de la solicitud.\"></p-message>\n }\n }\n <ng-template #footer>\n <p-button label=\"Cancelar\" severity=\"secondary\" [text]=\"true\" [disabled]=\"saving()\" (onClick)=\"confirmVisible.set(false)\"></p-button>\n <p-button label=\"Guardar condiciones\" icon=\"pi pi-save\" [loading]=\"saving()\" (onClick)=\"confirmSave()\"></p-button>\n </ng-template>\n</p-dialog>\n", styles: [".sfs-title{margin:0;font-size:1.125rem;font-weight:600}.sfs-subtitle{margin:0;font-size:1rem;font-weight:600}.sfs-muted{color:var(--p-text-muted-color)}.sfs-section-title{display:flex;align-items:center;gap:.5rem;margin:0 0 .75rem;font-size:1rem;font-weight:600}.sfs-section-title i{color:var(--primary-color, var(--p-primary-color))}.sfs-inline{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem}.sfs-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:.5rem;margin-bottom:.75rem}.sfs-break{overflow-wrap:anywhere}.sfs-nowrap{white-space:nowrap}.sfs-right{text-align:right}.sfs-strong{font-weight:600}.sfs-tag-gap{margin-left:.5rem}.sfs-stack{display:flex;flex-direction:column;gap:1rem}.sfs-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.sfs-summary{display:grid;grid-template-columns:minmax(8rem,max-content) 1fr;gap:.25rem 1rem;margin:0}.sfs-summary dt{color:var(--p-text-muted-color)}.sfs-summary dd{margin:0;text-align:right;font-variant-numeric:tabular-nums}@media (max-width: 575px){:host ::ng-deep .sfs-stack-table .p-datatable-table-container{overflow:visible!important}:host ::ng-deep .sfs-stack-table table,:host ::ng-deep .sfs-stack-table tbody{display:block;width:100%}:host ::ng-deep .sfs-stack-table thead{display:block!important;position:absolute!important;width:1px!important;height:1px!important;overflow:hidden!important;clip-path:inset(50%);white-space:nowrap}:host ::ng-deep .sfs-stack-table tbody tr{display:flex;flex-direction:column;margin-bottom:.5rem;padding:.5rem .75rem;border:1px solid var(--p-content-border-color);border-radius:var(--p-content-border-radius, 6px)}:host ::ng-deep .sfs-stack-table tbody td{display:flex;align-items:center;justify-content:flex-end;gap:.375rem;padding:.3rem 0;border:0;text-align:right}:host ::ng-deep .sfs-stack-table tbody td[data-label]:before{content:attr(data-label);margin-right:auto;padding-right:1rem;color:var(--p-text-muted-color);text-align:left}:host ::ng-deep .sfs-stack-table tbody td.sfs-stack-title{order:-1;display:block;font-weight:600;text-align:left}:host ::ng-deep .sfs-stack-table tfoot,:host ::ng-deep .sfs-stack-table .sfs-stack-hide{display:none}}\n", ".sfs-control{display:flex;flex-direction:column;gap:.25rem;min-width:0}.sfs-control--check{flex-direction:row;align-items:center;gap:.5rem;align-self:end;min-height:2.75rem}.sfs-capacity-grid{display:grid;grid-template-columns:minmax(0,1fr);gap:.75rem}@media (min-width: 576px){.sfs-capacity-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}.sfs-conditions{display:grid;grid-template-columns:minmax(0,1fr);gap:.75rem;align-items:end}@media (min-width: 576px){.sfs-conditions{grid-template-columns:repeat(2,minmax(0,1fr))}.sfs-conditions__line{grid-column:1 / -1}}@media (min-width: 992px){.sfs-conditions{grid-template-columns:minmax(0,2fr) minmax(0,1fr) minmax(0,1fr) max-content}.sfs-conditions__line{grid-column:auto}}.sfs-conditions__rate{justify-content:flex-end;min-height:2.5rem;padding-bottom:.5rem}.sfs-metrics{display:grid;grid-template-columns:repeat(auto-fill,minmax(9.5rem,1fr));gap:.5rem 1rem;margin:0}.sfs-metrics dt{font-size:.8125rem;color:var(--p-text-muted-color)}.sfs-metrics dd{margin:0;font-variant-numeric:tabular-nums}.sfs-no-gap{margin-top:-.75rem}.sfs-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:.5rem}.sfs-list{margin:0;padding-left:1rem}.sfs-gap-top{margin-top:.5rem}.sfs-gap-bottom{margin-bottom:.5rem}.sfs-no-top{margin-top:0}.sfs-tag-before{margin-right:.5rem}:host ::ng-deep .sfs-charge-input{width:6.5rem;padding-block:.25rem;text-align:right}:host ::ng-deep .sfs-unavailable.p-button{opacity:var(--p-disabled-opacity);cursor:default}:host ::ng-deep .sfs-unavailable.p-button:hover,:host ::ng-deep .sfs-unavailable.p-button:active{background:var(--button-color, var(--p-button-primary-background));border-color:var(--button-color, var(--p-button-primary-border-color))}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i1.DecimalPipe, name: "number" }, { kind: "pipe", type: i1.CurrencyPipe, name: "currency" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i3.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain", "fluid", "label", "icon", "buttonProps"] }, { kind: "component", type: i3.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: CheckboxModule }, { kind: "component", type: i4$1.Checkbox, selector: "p-checkbox, p-checkBox, p-check-box", inputs: ["value", "name", "disabled", "binary", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "style", "inputStyle", "styleClass", "inputClass", "indeterminate", "size", "formControl", "checkboxIcon", "readonly", "required", "autofocus", "trueValue", "falseValue", "variant"], outputs: ["onChange", "onFocus", "onBlur"] }, { kind: "ngmodule", type: DialogModule }, { kind: "component", type: i5$1.Dialog, selector: "p-dialog", inputs: ["header", "draggable", "resizable", "positionLeft", "positionTop", "contentStyle", "contentStyleClass", "modal", "closeOnEscape", "dismissableMask", "rtl", "closable", "responsive", "appendTo", "breakpoints", "styleClass", "maskStyleClass", "maskStyle", "showHeader", "breakpoint", "blockScroll", "autoZIndex", "baseZIndex", "minX", "minY", "focusOnShow", "maximizable", "keepInViewport", "focusTrap", "transitionOptions", "closeIcon", "closeAriaLabel", "closeTabindex", "minimizeIcon", "maximizeIcon", "closeButtonProps", "maximizeButtonProps", "visible", "style", "position", "role", "content", "contentTemplate", "footerTemplate", "closeIconTemplate", "maximizeIconTemplate", "minimizeIconTemplate", "headlessTemplate"], outputs: ["onShow", "onHide", "visibleChange", "onResizeInit", "onResizeEnd", "onDragEnd", "onMaximize"] }, { kind: "ngmodule", type: InputNumberModule }, { kind: "component", type: i6$1.InputNumber, selector: "p-inputNumber, p-inputnumber, p-input-number", inputs: ["showButtons", "format", "buttonLayout", "inputId", "styleClass", "style", "placeholder", "size", "maxlength", "tabindex", "title", "ariaLabelledBy", "ariaDescribedBy", "ariaLabel", "ariaRequired", "name", "required", "autocomplete", "min", "max", "incrementButtonClass", "decrementButtonClass", "incrementButtonIcon", "decrementButtonIcon", "readonly", "step", "allowEmpty", "locale", "localeMatcher", "mode", "currency", "currencyDisplay", "useGrouping", "variant", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "inputStyle", "inputStyleClass", "showClear", "autofocus", "disabled", "fluid"], outputs: ["onInput", "onFocus", "onBlur", "onKeyDown", "onClear"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i4.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant"], outputs: ["onClose"] }, { kind: "ngmodule", type: SelectModule }, { kind: "component", type: i8.Select, selector: "p-select", inputs: ["id", "scrollHeight", "filter", "name", "style", "panelStyle", "styleClass", "panelStyleClass", "readonly", "required", "editable", "appendTo", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "variant", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "autoDisplayFirst", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "size", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "maxlength", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "fluid", "disabled", "itemSize", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "filterValue", "options"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i5.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "style", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "ngmodule", type: TableModule }, { kind: "component", type: i6.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorStyleClass", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showJumpToPageInput", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "selectionPageOnly", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowSelectable", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "scrollDirection", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "virtualScrollDelay", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "autoLayout", "exportFunction", "exportHeader", "stateKey", "stateStorage", "editMode", "groupRowsBy", "size", "showGridlines", "stripedRows", "groupRowsByOrder", "responsiveLayout", "breakpoint", "paginatorLocale", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "virtualRowHeight", "selectAll"], outputs: ["contextMenuSelectionChange", "selectAllChange", "selectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { kind: "ngmodule", type: TagModule }, { kind: "component", type: i7.Tag, selector: "p-tag", inputs: ["style", "styleClass", "severity", "value", "icon", "rounded"] }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i12.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }] });
1329
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: LineSimulatorComponent, isStandalone: true, selector: "lib-line-simulator", inputs: { capacity: { classPropertyName: "capacity", publicName: "capacity", isSignal: true, isRequired: true, transformFunction: null }, capacityEditable: { classPropertyName: "capacityEditable", publicName: "capacityEditable", isSignal: true, isRequired: false, transformFunction: null }, simulation: { classPropertyName: "simulation", publicName: "simulation", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, errorMessage: { classPropertyName: "errorMessage", publicName: "errorMessage", isSignal: true, isRequired: false, transformFunction: null }, saved: { classPropertyName: "saved", publicName: "saved", isSignal: true, isRequired: false, transformFunction: null }, canEdit: { classPropertyName: "canEdit", publicName: "canEdit", isSignal: true, isRequired: false, transformFunction: null }, editableCharges: { classPropertyName: "editableCharges", publicName: "editableCharges", isSignal: true, isRequired: false, transformFunction: null }, canEditRate: { classPropertyName: "canEditRate", publicName: "canEditRate", isSignal: true, isRequired: false, transformFunction: null }, showSave: { classPropertyName: "showSave", publicName: "showSave", isSignal: true, isRequired: false, transformFunction: null }, saveBlockedReason: { classPropertyName: "saveBlockedReason", publicName: "saveBlockedReason", isSignal: true, isRequired: false, transformFunction: null }, saving: { classPropertyName: "saving", publicName: "saving", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { simulate: "simulate", save: "save", retry: "retry", lineChange: "lineChange", unsavedChange: "unsavedChange" }, ngImport: i0, template: "<div class=\"sfs-stack\">\n <!-- Capacidad de pago -->\n <section [attr.aria-labelledby]=\"ids.capacityTitle\">\n <h3 [id]=\"ids.capacityTitle\" class=\"sfs-subtitle sfs-gap-bottom\">Capacidad de pago</h3>\n @if (capacityEditable()) {\n <div class=\"sfs-capacity-grid\">\n @for (field of capacityFields; track field.key) {\n <div class=\"sfs-control\">\n <label [for]=\"ids.capacity + field.key\">{{ field.label }}</label>\n <p-inputnumber [inputId]=\"ids.capacity + field.key\" [ngModel]=\"currentCapacity()[field.key]\" (ngModelChange)=\"setCapacity(field.key, $event)\"\n mode=\"currency\" currency=\"COP\" [locale]=\"locale\" [minFractionDigits]=\"0\" [maxFractionDigits]=\"0\" [min]=\"0\" [fluid]=\"true\"></p-inputnumber>\n </div>\n }\n <div class=\"sfs-control sfs-control--check\">\n <p-checkbox [inputId]=\"ids.garnishment\" [binary]=\"true\" [ngModel]=\"currentCapacity().hasGarnishment\" (ngModelChange)=\"setGarnishment($event)\"></p-checkbox>\n <label [for]=\"ids.garnishment\">Tiene embargo</label>\n </div>\n </div>\n }\n <!-- Indicadores en grilla: varios por fila en escritorio, para que la capacidad no ocupe media pantalla. -->\n @if (!capacityEditable() || simulation()) {\n <dl class=\"sfs-metrics\" [class.sfs-gap-top]=\"capacityEditable()\">\n @if (!capacityEditable()) {\n <div><dt>Ingresos</dt><dd>{{ capacity().income | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Descuentos de ley</dt><dd>{{ capacity().legalDeductions | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Otras afiliaciones</dt><dd>{{ capacity().otherAffiliations | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Otros descuentos</dt><dd>{{ capacity().otherDeductions | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Compras de cartera</dt><dd>{{ capacity().purchasesValue | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Embargo</dt><dd>{{ capacity().hasGarnishment ? 'S\u00ED' : 'No' }}</dd></div>\n }\n @if (simulation(); as s) {\n <div><dt>Disponible n\u00F3mina</dt><dd class=\"sfs-strong\">{{ maxInstallment() | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n @if (!installmentEditable()) {\n <div><dt>Valor cuota</dt><dd class=\"sfs-strong\">{{ currentInstallment() | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n }\n <div><dt>Tope de monto</dt><dd>{{ s.capacity.maxAmount != null ? (s.capacity.maxAmount | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale) : '\u2014' }}</dd></div>\n }\n </dl>\n }\n <!-- La cuota la digita la persona: el simulador calcula con ella el m\u00E1ximo a financiar. No puede superar el\n disponible n\u00F3mina (incluye el aporte). -->\n @if (installmentEditable()) {\n <div class=\"sfs-control sfs-installment sfs-gap-top\">\n <label [for]=\"ids.installment\">Valor cuota</label>\n <p-inputnumber [inputId]=\"ids.installment\" [ngModel]=\"currentInstallment()\" (ngModelChange)=\"setInstallment($event)\"\n mode=\"currency\" currency=\"COP\" [locale]=\"locale\" [minFractionDigits]=\"0\" [maxFractionDigits]=\"0\" [min]=\"0\" [fluid]=\"true\"\n [ariaDescribedBy]=\"installmentError() ? ids.installmentError : undefined\"\n [inputStyleClass]=\"installmentError() ? 'ng-invalid ng-dirty' : ''\"></p-inputnumber>\n @if (installmentError(); as error) {\n <small [id]=\"ids.installmentError\" class=\"sfs-field-error\"><i class=\"pi pi-exclamation-circle\" aria-hidden=\"true\"></i> {{ error }}\n M\u00E1ximo {{ maxInstallment() | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}.</small>\n } @else {\n <small class=\"sfs-muted\">Hasta el disponible n\u00F3mina. Al recalcular, el monto sale de esta cuota.</small>\n }\n @if (maxInstallment() !== null && currentInstallment() !== maxInstallment()) {\n <div>\n <p-button label=\"Usar el disponible n\u00F3mina\" icon=\"pi pi-replay\" [text]=\"true\" size=\"small\" severity=\"secondary\"\n (onClick)=\"useMaxInstallment()\"></p-button>\n </div>\n }\n </div>\n }\n </section>\n\n @switch (state()) {\n @case ('loading') {\n <div class=\"sfs-stack\" aria-busy=\"true\">\n <p-skeleton height=\"2.5rem\"></p-skeleton>\n <p-skeleton height=\"12rem\"></p-skeleton>\n </div>\n }\n @case ('error') {\n <p-message severity=\"error\">\n <div class=\"sfs-inline\">\n <span>{{ errorMessage() || 'No se pudo simular la solicitud.' }}</span>\n <p-button label=\"Reintentar\" icon=\"pi pi-refresh\" [text]=\"true\" (onClick)=\"retrySimulation()\"></p-button>\n </div>\n </p-message>\n @if (capacityEditable() && pendingChanges()) {\n <div class=\"sfs-actions\">\n <p-button label=\"Recalcular\" icon=\"pi pi-calculator\" severity=\"secondary\" [text]=\"true\" [disabled]=\"hasNegativeInput()\" (onClick)=\"recalculate()\"></p-button>\n </div>\n }\n }\n @case ('idle') {\n @if (capacityEditable()) {\n <div class=\"sfs-actions\">\n <p-button label=\"Simular\" icon=\"pi pi-calculator\" [disabled]=\"hasNegativeInput()\" (onClick)=\"recalculate()\"></p-button>\n </div>\n } @else {\n <p class=\"sfs-muted sfs-no-top\">Todav\u00EDa no hay una simulaci\u00F3n para esta solicitud.</p>\n }\n }\n @case ('ready') {\n @if (simulation()?.warnings?.length) {\n <p-message severity=\"warn\">\n <ul class=\"sfs-list\">\n @for (w of simulation()?.warnings ?? []; track $index) { <li>{{ w }}</li> }\n </ul>\n </p-message>\n }\n\n @if (!lineOptions().length) {\n <p-message severity=\"info\" text=\"El simulador no devolvi\u00F3 l\u00EDneas para esta solicitud. Revise la pagadur\u00EDa, el producto y la capacidad de pago.\"></p-message>\n }\n\n <!-- L\u00EDnea, plazo, monto y tasa en una sola fila en escritorio. p-select pone el inputId en un span: el nombre\n accesible va por ariaLabelledBy. -->\n <div class=\"sfs-conditions\">\n <div class=\"sfs-control sfs-conditions__line\">\n <label [id]=\"ids.lineLabel\" [for]=\"ids.line\" class=\"sfs-strong\">L\u00EDnea</label>\n <p-select [inputId]=\"ids.line\" [ariaLabelledBy]=\"ids.lineLabel\" [options]=\"lineOptions()\" optionLabel=\"label\" optionValue=\"value\" optionDisabled=\"disabled\"\n [ngModel]=\"selectedLine()\" (ngModelChange)=\"chooseLine($event)\" placeholder=\"Seleccione una l\u00EDnea\" [fluid]=\"true\"></p-select>\n </div>\n @if (line(); as l) {\n @if (!l.error) {\n <div class=\"sfs-control\">\n <label [for]=\"ids.term\">Plazo (cuotas)</label>\n <p-inputnumber [inputId]=\"ids.term\" [ngModel]=\"termInput()\" (ngModelChange)=\"termInput.set($event)\"\n [min]=\"simulation()?.minTerm ?? 1\" [max]=\"simulation()?.maxTerm ?? 600\" [useGrouping]=\"false\"\n [disabled]=\"!canEdit()\" [fluid]=\"true\"></p-inputnumber>\n </div>\n <div class=\"sfs-control\">\n <label [for]=\"ids.amount\">Monto</label>\n <p-inputnumber [inputId]=\"ids.amount\" [ngModel]=\"amountInput()\" (ngModelChange)=\"amountInput.set($event)\"\n mode=\"currency\" currency=\"COP\" [locale]=\"locale\" [minFractionDigits]=\"0\" [maxFractionDigits]=\"0\" [min]=\"0\"\n [disabled]=\"!canEdit()\" [fluid]=\"true\"></p-inputnumber>\n </div>\n @if (rateEditable()) {\n <div class=\"sfs-control\">\n <label [id]=\"ids.rateLabel\" [for]=\"ids.rate\">Tasa</label>\n <p-select [inputId]=\"ids.rate\" [ariaLabelledBy]=\"ids.rateLabel\" [options]=\"rateOptions()\" optionLabel=\"label\" optionValue=\"value\"\n [ngModel]=\"currentRate()\" (ngModelChange)=\"rateInput.set($event)\" [fluid]=\"true\" appendTo=\"body\"></p-select>\n </div>\n } @else {\n <div class=\"sfs-control sfs-conditions__rate\">\n <span>Tasa</span>\n <span class=\"sfs-strong\">{{ l.rate | number: '1.0-4' : locale }} % M.V.</span>\n </div>\n }\n }\n }\n </div>\n @if (saved()?.line && saved()?.line !== selectedLine()) {\n <small class=\"sfs-muted sfs-no-gap\">La l\u00EDnea guardada es {{ savedLineName() }}. Al guardar se cambia por la elegida.</small>\n }\n\n @if (line(); as l) {\n @if (l.error) {\n <p-message severity=\"error\" text=\"Esta l\u00EDnea no se pudo simular. Elija otra o intente m\u00E1s tarde.\"></p-message>\n } @else {\n <!-- Cargos de la l\u00EDnea: plegados, porque casi nunca se tocan. Al desplegarlos, los del cr\u00E9dito (se descuentan\n del desembolso o van al capital) y los de la cuota, cada uno en su columna. -->\n <section [attr.aria-labelledby]=\"ids.chargesTitle\">\n <div class=\"sfs-head\">\n <h3 [id]=\"ids.chargesTitle\" class=\"sfs-subtitle\">Cargos</h3>\n <!-- pButton y no p-button: el componente no deja poner aria-expanded en su <button>. -->\n <button pButton type=\"button\" severity=\"secondary\" [text]=\"true\" size=\"small\"\n [label]=\"(chargesOpen() ? 'Ocultar cargos' : 'Ver cargos') + (editedChargesCount() ? ' (' + editedChargesCount() + ' cambiados)' : '')\"\n [icon]=\"chargesOpen() ? 'pi pi-chevron-up' : 'pi pi-chevron-down'\" iconPos=\"right\"\n [attr.aria-expanded]=\"chargesOpen()\" [attr.aria-controls]=\"ids.charges\"\n (click)=\"chargesOpen.set(!chargesOpen())\"></button>\n </div>\n @if (chargesOpen()) {\n <div [id]=\"ids.charges\" class=\"sfs-charges\">\n <div>\n <h4 class=\"sfs-charges__title\">Del cr\u00E9dito</h4>\n <p-table [value]=\"creditChargeRows()\" size=\"small\" [scrollable]=\"true\" dataKey=\"name\" styleClass=\"sfs-stack-table\">\n <ng-template #header>\n <tr>\n <th>Cargo</th>\n <th class=\"sfs-right\">Guardado</th>\n <th class=\"sfs-right\">Configurado</th>\n <th class=\"sfs-right\">Valor</th>\n </tr>\n </ng-template>\n <ng-template #body let-row>\n <tr>\n <td class=\"sfs-stack-title\">{{ row.label }}</td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Guardado\">\n @if (row.savedInput === null) { \u2014 }\n @else { {{ row.percentage ? (row.savedInput | number: '1.0-4' : locale) + ' %' : (row.savedInput | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale) }} }\n </td>\n <td class=\"sfs-right\" data-label=\"Configurado\">\n @if (row.editable) {\n <label [for]=\"row.id\" class=\"sfs-sr-only\">{{ row.label }}</label>\n <p-inputnumber [inputId]=\"row.id\" [ngModel]=\"chargeInputs()[row.name]\" (ngModelChange)=\"setChargeInput(row.name, $event)\"\n [min]=\"0\" [minFractionDigits]=\"0\" [maxFractionDigits]=\"row.percentage ? 4 : 0\" [locale]=\"locale\"\n [suffix]=\"row.percentage ? ' %' : ''\" [prefix]=\"row.percentage ? '' : '$ '\" inputStyleClass=\"sfs-charge-input\"></p-inputnumber>\n } @else {\n {{ row.percentage ? (row.simulatedInput | number: '1.0-4' : locale) + ' %' : (row.simulatedInput | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale) }}\n }\n </td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Valor\">{{ row.value | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</td>\n </tr>\n </ng-template>\n <ng-template #emptymessage>\n <tr><td colspan=\"4\">La l\u00EDnea no tiene cargos del cr\u00E9dito.</td></tr>\n </ng-template>\n </p-table>\n </div>\n <div>\n <h4 class=\"sfs-charges__title\">De la cuota</h4>\n <p-table [value]=\"installmentChargeRows()\" size=\"small\" [scrollable]=\"true\" dataKey=\"name\" styleClass=\"sfs-stack-table\">\n <ng-template #header>\n <tr>\n <th>Cargo</th>\n <th class=\"sfs-right\">Guardado</th>\n <th class=\"sfs-right\">Configurado</th>\n <th class=\"sfs-right\">Valor</th>\n </tr>\n </ng-template>\n <ng-template #body let-row>\n <tr>\n <td class=\"sfs-stack-title\">{{ row.label }}</td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Guardado\">\n @if (row.savedInput === null) { \u2014 }\n @else { {{ row.percentage ? (row.savedInput | number: '1.0-4' : locale) + ' %' : (row.savedInput | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale) }} }\n </td>\n <td class=\"sfs-right\" data-label=\"Configurado\">\n @if (row.editable) {\n <label [for]=\"row.id\" class=\"sfs-sr-only\">{{ row.label }}</label>\n <p-inputnumber [inputId]=\"row.id\" [ngModel]=\"chargeInputs()[row.name]\" (ngModelChange)=\"setChargeInput(row.name, $event)\"\n [min]=\"0\" [minFractionDigits]=\"0\" [maxFractionDigits]=\"row.percentage ? 4 : 0\" [locale]=\"locale\"\n [suffix]=\"row.percentage ? ' %' : ''\" [prefix]=\"row.percentage ? '' : '$ '\" inputStyleClass=\"sfs-charge-input\"></p-inputnumber>\n } @else {\n {{ row.percentage ? (row.simulatedInput | number: '1.0-4' : locale) + ' %' : (row.simulatedInput | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale) }}\n }\n </td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Valor\">{{ row.value | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</td>\n </tr>\n </ng-template>\n <ng-template #emptymessage>\n <tr><td colspan=\"4\">La l\u00EDnea no tiene cargos en la cuota.</td></tr>\n </ng-template>\n </p-table>\n </div>\n </div>\n @if (zeroChargesCount()) {\n <!-- Los cargos en cero (sin guardado, sin configurado y sin valor) ocupan espacio y no cambian nada. -->\n <div class=\"sfs-no-gap\">\n <p-button [label]=\"showZeroCharges() ? 'Ocultar los cargos en cero' : 'Ver ' + zeroChargesCount() + (zeroChargesCount() === 1 ? ' cargo en cero' : ' cargos en cero')\"\n [icon]=\"showZeroCharges() ? 'pi pi-eye-slash' : 'pi pi-eye'\" [text]=\"true\" size=\"small\" severity=\"secondary\"\n [ariaLabel]=\"showZeroCharges() ? 'Ocultar los cargos en cero' : 'Ver los cargos en cero'\"\n (onClick)=\"showZeroCharges.set(!showZeroCharges())\"></p-button>\n </div>\n }\n }\n </section>\n\n <!-- Resultado frente a lo guardado -->\n <section [attr.aria-labelledby]=\"ids.resultTitle\">\n <div class=\"sfs-head\">\n <h3 [id]=\"ids.resultTitle\" class=\"sfs-subtitle\">Resultado</h3>\n <p-tag [value]=\"l.viable ? 'Viable' : 'No viable'\" [severity]=\"l.viable ? 'success' : 'warn'\"></p-tag>\n </div>\n @if (summary(); as sm) {\n <dl class=\"sfs-summary\">\n <div><dt>M\u00E1ximo a financiar</dt><dd class=\"sfs-strong\">{{ sm.maxAmount | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Monto</dt><dd>{{ sm.amount | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Descuentos del cr\u00E9dito</dt><dd>{{ sm.creditDiscounts | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Desembolso</dt><dd>{{ sm.disbursement | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Compras de cartera</dt><dd>{{ sm.purchases !== null ? (sm.purchases | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale) : '\u2014' }}</dd></div>\n <div><dt>Sanear</dt><dd>{{ sm.cleanUp !== null ? (sm.cleanUp | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale) : '\u2014' }}</dd></div>\n <!-- Neto a girar resaltado: con el color de \u00E9xito o de error del tema y, adem\u00E1s, un icono y el texto. -->\n <div class=\"sfs-net\" [class.sfs-net--negative]=\"sm.net < 0\">\n <dt>Neto a girar</dt>\n <dd>\n <i [class]=\"sm.net < 0 ? 'pi pi-exclamation-triangle' : 'pi pi-check-circle'\" aria-hidden=\"true\"></i>\n {{ sm.net | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}\n @if (sm.net < 0) { <span class=\"sfs-net__note\">Negativo: no alcanza para las compras de cartera.</span> }\n </dd>\n </div>\n </dl>\n }\n <p-table [value]=\"comparison()\" size=\"small\" [scrollable]=\"true\" dataKey=\"label\" styleClass=\"sfs-stack-table\">\n <ng-template #header>\n <tr><th>Concepto</th><th class=\"sfs-right\">Guardado</th><th class=\"sfs-right\">Simulaci\u00F3n</th></tr>\n </ng-template>\n <ng-template #body let-row>\n <tr>\n <td class=\"sfs-stack-title\">{{ row.label }}</td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Guardado\">\n <ng-container *ngTemplateOutlet=\"valueTpl; context: { $implicit: row.saved, kind: row.kind }\"></ng-container>\n </td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Simulaci\u00F3n\">\n @if (row.changed) { <span class=\"sfs-tag-before\"><p-tag value=\"Cambia\" severity=\"warn\"></p-tag></span> }\n <span [class.sfs-strong]=\"row.changed\">\n <ng-container *ngTemplateOutlet=\"valueTpl; context: { $implicit: row.simulated, kind: row.kind }\"></ng-container>\n </span>\n </td>\n </tr>\n </ng-template>\n </p-table>\n @if (!l.viable && l.viabilityReasons.length) {\n <ul class=\"sfs-list sfs-gap-top\">\n @for (reason of l.viabilityReasons; track $index) { <li>{{ reason }}</li> }\n </ul>\n }\n </section>\n\n <!-- Acciones -->\n <div class=\"sfs-actions\">\n @if (canEdit() || capacityEditable()) {\n <p-button label=\"Recalcular\" icon=\"pi pi-calculator\" severity=\"secondary\" [text]=\"true\"\n [disabled]=\"!pendingChanges() || hasNegativeInput()\" (onClick)=\"recalculate()\"></p-button>\n }\n @if (showSave()) {\n <!-- pButton y no p-button: sin poder guardar el bot\u00F3n queda aria-disabled (no disabled) para que el\n motivo se vea con Tab y con el mouse; openConfirm() corta el clic cuando hay motivo. -->\n <button pButton type=\"button\" label=\"Guardar condiciones\" aria-label=\"Guardar condiciones\"\n [icon]=\"saveUnavailableReason() ? 'pi pi-lock' : 'pi pi-save'\"\n [class.sfs-unavailable]=\"!!saveUnavailableReason()\"\n [attr.aria-disabled]=\"saveUnavailableReason() ? 'true' : null\"\n [attr.aria-describedby]=\"saveUnavailableReason() ? ids.saveReason : null\"\n [pTooltip]=\"saveUnavailableReason() ?? ''\" [tooltipDisabled]=\"!saveUnavailableReason()\" tooltipPosition=\"top\" tooltipEvent=\"both\"\n (click)=\"openConfirm()\"></button>\n @if (saveUnavailableReason()) {\n <span [id]=\"ids.saveReason\" class=\"sfs-sr-only\">{{ saveUnavailableReason() }}</span>\n }\n }\n </div>\n }\n }\n }\n }\n</div>\n\n<!-- Siempre montada: anuncia el resultado de cada simulaci\u00F3n (la de arriba se destruye mientras carga). -->\n<div class=\"sfs-sr-only\" role=\"status\" aria-live=\"polite\">{{ liveMessage() }}</div>\n\n<!-- Un valor de la comparaci\u00F3n, en su formato -->\n<ng-template #valueTpl let-value let-kind=\"kind\">\n @if (value === null || value === undefined || value === '') { \u2014 }\n @else {\n @switch (kind) {\n @case ('money') { {{ value | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }} }\n @case ('rate') { {{ value | number: '1.0-4' : locale }} % M.V. }\n @case ('term') { {{ value }} cuotas }\n @default { {{ value }} }\n }\n }\n</ng-template>\n\n<!-- Confirmaci\u00F3n: cambia l\u00EDnea, monto, plazo y cargos de la solicitud -->\n<p-dialog header=\"Guardar condiciones\" [visible]=\"confirmVisible()\" (visibleChange)=\"confirmVisible.set($event)\" (onHide)=\"restoreConfirmFocus()\"\n [modal]=\"true\" [draggable]=\"false\" [closable]=\"!saving()\" [style]=\"{ width: '32rem', maxWidth: '95vw' }\">\n @if (confirmVisible() && line(); as l) {\n <p class=\"sfs-no-top\">\n Se guardar\u00E1n la l\u00EDnea <strong>{{ l.lineName || l.line }}</strong>,\n un monto de <strong>{{ l.amount | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</strong>\n a <strong>{{ l.term }} cuotas</strong> con una tasa de <strong>{{ l.rate | number: '1.0-4' : locale }} % M.V.</strong> y una cuota de <strong>{{ l.installment | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</strong>,\n con un giro al cliente de <strong>{{ l.transfer | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</strong>.\n </p>\n @if (!l.viable) {\n <p-message severity=\"warn\" text=\"La l\u00EDnea no es viable con la capacidad de pago de la solicitud.\"></p-message>\n }\n }\n <ng-template #footer>\n <p-button label=\"Cancelar\" severity=\"secondary\" [text]=\"true\" [disabled]=\"saving()\" (onClick)=\"confirmVisible.set(false)\"></p-button>\n <p-button label=\"Guardar condiciones\" icon=\"pi pi-save\" [loading]=\"saving()\" (onClick)=\"confirmSave()\"></p-button>\n </ng-template>\n</p-dialog>\n", styles: [".sfs-title{margin:0;font-size:1.125rem;font-weight:600}.sfs-subtitle{margin:0;font-size:1rem;font-weight:600}.sfs-muted{color:var(--p-text-muted-color)}.sfs-section-title{display:flex;align-items:center;gap:.5rem;margin:0 0 .75rem;font-size:1rem;font-weight:600}.sfs-section-title i{color:var(--primary-color, var(--p-primary-color))}.sfs-inline{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem}.sfs-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:.5rem;margin-bottom:.75rem}.sfs-break{overflow-wrap:anywhere}.sfs-nowrap{white-space:nowrap}.sfs-right{text-align:right}.sfs-strong{font-weight:600}.sfs-tag-gap{margin-left:.5rem}.sfs-stack{display:flex;flex-direction:column;gap:1rem}.sfs-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.sfs-summary{display:grid;grid-template-columns:minmax(8rem,max-content) 1fr;gap:.25rem 1rem;margin:0}.sfs-summary dt{color:var(--p-text-muted-color)}.sfs-summary dd{margin:0;text-align:right;font-variant-numeric:tabular-nums}@media (max-width: 575px){:host ::ng-deep .sfs-stack-table .p-datatable-table-container{overflow:visible!important}:host ::ng-deep .sfs-stack-table table,:host ::ng-deep .sfs-stack-table tbody{display:block;width:100%}:host ::ng-deep .sfs-stack-table thead{display:block!important;position:absolute!important;width:1px!important;height:1px!important;overflow:hidden!important;clip-path:inset(50%);white-space:nowrap}:host ::ng-deep .sfs-stack-table tbody tr{display:flex;flex-direction:column;margin-bottom:.5rem;padding:.5rem .75rem;border:1px solid var(--p-content-border-color);border-radius:var(--p-content-border-radius, 6px)}:host ::ng-deep .sfs-stack-table tbody td{display:flex;align-items:center;justify-content:flex-end;gap:.375rem;padding:.3rem 0;border:0;text-align:right}:host ::ng-deep .sfs-stack-table tbody td[data-label]:before{content:attr(data-label);margin-right:auto;padding-right:1rem;color:var(--p-text-muted-color);text-align:left}:host ::ng-deep .sfs-stack-table tbody td.sfs-stack-title{order:-1;display:block;font-weight:600;text-align:left}:host ::ng-deep .sfs-stack-table tfoot,:host ::ng-deep .sfs-stack-table .sfs-stack-hide{display:none}}\n", ".sfs-control{display:flex;flex-direction:column;gap:.25rem;min-width:0}.sfs-control--check{flex-direction:row;align-items:center;gap:.5rem;align-self:end;min-height:2.75rem}.sfs-capacity-grid{display:grid;grid-template-columns:minmax(0,1fr);gap:.75rem}@media (min-width: 576px){.sfs-capacity-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}.sfs-conditions{display:grid;grid-template-columns:minmax(0,1fr);gap:.75rem;align-items:end}@media (min-width: 576px){.sfs-conditions{grid-template-columns:repeat(2,minmax(0,1fr))}.sfs-conditions__line{grid-column:1 / -1}}@media (min-width: 992px){.sfs-conditions{grid-template-columns:minmax(0,2fr) minmax(0,1fr) minmax(0,1fr) minmax(9rem,1fr)}.sfs-conditions__line{grid-column:auto}}.sfs-conditions__rate{justify-content:flex-end;min-height:2.5rem;padding-bottom:.5rem}.sfs-metrics{display:grid;grid-template-columns:repeat(auto-fill,minmax(9.5rem,1fr));gap:.5rem 1rem;margin:0}.sfs-metrics dt{font-size:.8125rem;color:var(--p-text-muted-color)}.sfs-metrics dd{margin:0;font-variant-numeric:tabular-nums}.sfs-no-gap{margin-top:-.75rem}.sfs-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:.5rem}.sfs-list{margin:0;padding-left:1rem}.sfs-gap-top{margin-top:.5rem}.sfs-gap-bottom{margin-bottom:.5rem}.sfs-no-top{margin-top:0}.sfs-tag-before{margin-right:.5rem}:host ::ng-deep .sfs-charge-input{width:6.5rem;padding-block:.25rem;text-align:right}:host ::ng-deep .sfs-unavailable.p-button{opacity:var(--p-disabled-opacity);cursor:default}:host ::ng-deep .sfs-unavailable.p-button:hover,:host ::ng-deep .sfs-unavailable.p-button:active{background:var(--button-color, var(--p-button-primary-background));border-color:var(--button-color, var(--p-button-primary-border-color))}.sfs-installment{max-width:20rem}.sfs-field-error{color:var(--p-message-error-simple-color, var(--p-text-color))}.sfs-charges{display:grid;grid-template-columns:minmax(0,1fr);gap:1rem}@media (min-width: 992px){.sfs-charges{grid-template-columns:repeat(2,minmax(0,1fr))}}.sfs-charges__title{margin:0 0 .5rem;font-size:.875rem;font-weight:600;color:var(--p-text-muted-color)}.sfs-summary{display:grid;grid-template-columns:repeat(auto-fill,minmax(10rem,1fr));gap:.5rem 1rem;margin:0 0 1rem}.sfs-summary dt{font-size:.8125rem;color:var(--p-text-muted-color)}.sfs-summary dd{margin:0}.sfs-net{grid-column:1 / -1;padding:.5rem .75rem;border:1px solid var(--p-message-success-border-color, var(--p-content-border-color));border-radius:var(--p-content-border-radius, 6px);background:var(--p-message-success-background, var(--p-content-background));color:var(--p-message-success-color, var(--p-text-color))}.sfs-net dt{color:inherit;font-weight:600}.sfs-net dd{font-size:1.25rem;font-weight:700}.sfs-net--negative{border-color:var(--p-message-error-border-color, var(--p-content-border-color));background:var(--p-message-error-background, var(--p-content-background));color:var(--p-message-error-color, var(--p-text-color))}.sfs-net__note{display:block;font-size:.8125rem;font-weight:400}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i1$1.DecimalPipe, name: "number" }, { kind: "pipe", type: i1$1.CurrencyPipe, name: "currency" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i2.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain", "fluid", "label", "icon", "buttonProps"] }, { kind: "component", type: i2.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: CheckboxModule }, { kind: "component", type: i3.Checkbox, selector: "p-checkbox, p-checkBox, p-check-box", inputs: ["value", "name", "disabled", "binary", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "style", "inputStyle", "styleClass", "inputClass", "indeterminate", "size", "formControl", "checkboxIcon", "readonly", "required", "autofocus", "trueValue", "falseValue", "variant"], outputs: ["onChange", "onFocus", "onBlur"] }, { kind: "ngmodule", type: DialogModule }, { kind: "component", type: i5.Dialog, selector: "p-dialog", inputs: ["header", "draggable", "resizable", "positionLeft", "positionTop", "contentStyle", "contentStyleClass", "modal", "closeOnEscape", "dismissableMask", "rtl", "closable", "responsive", "appendTo", "breakpoints", "styleClass", "maskStyleClass", "maskStyle", "showHeader", "breakpoint", "blockScroll", "autoZIndex", "baseZIndex", "minX", "minY", "focusOnShow", "maximizable", "keepInViewport", "focusTrap", "transitionOptions", "closeIcon", "closeAriaLabel", "closeTabindex", "minimizeIcon", "maximizeIcon", "closeButtonProps", "maximizeButtonProps", "visible", "style", "position", "role", "content", "contentTemplate", "footerTemplate", "closeIconTemplate", "maximizeIconTemplate", "minimizeIconTemplate", "headlessTemplate"], outputs: ["onShow", "onHide", "visibleChange", "onResizeInit", "onResizeEnd", "onDragEnd", "onMaximize"] }, { kind: "ngmodule", type: InputNumberModule }, { kind: "component", type: i6$2.InputNumber, selector: "p-inputNumber, p-inputnumber, p-input-number", inputs: ["showButtons", "format", "buttonLayout", "inputId", "styleClass", "style", "placeholder", "size", "maxlength", "tabindex", "title", "ariaLabelledBy", "ariaDescribedBy", "ariaLabel", "ariaRequired", "name", "required", "autocomplete", "min", "max", "incrementButtonClass", "decrementButtonClass", "incrementButtonIcon", "decrementButtonIcon", "readonly", "step", "allowEmpty", "locale", "localeMatcher", "mode", "currency", "currencyDisplay", "useGrouping", "variant", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "inputStyle", "inputStyleClass", "showClear", "autofocus", "disabled", "fluid"], outputs: ["onInput", "onFocus", "onBlur", "onKeyDown", "onClear"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i7.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant"], outputs: ["onClose"] }, { kind: "ngmodule", type: SelectModule }, { kind: "component", type: i8.Select, selector: "p-select", inputs: ["id", "scrollHeight", "filter", "name", "style", "panelStyle", "styleClass", "panelStyleClass", "readonly", "required", "editable", "appendTo", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "variant", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "autoDisplayFirst", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "size", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "maxlength", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "fluid", "disabled", "itemSize", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "filterValue", "options"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i5$1.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "style", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "ngmodule", type: TableModule }, { kind: "component", type: i6$1.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorStyleClass", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showJumpToPageInput", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "selectionPageOnly", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowSelectable", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "scrollDirection", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "virtualScrollDelay", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "autoLayout", "exportFunction", "exportHeader", "stateKey", "stateStorage", "editMode", "groupRowsBy", "size", "showGridlines", "stripedRows", "groupRowsByOrder", "responsiveLayout", "breakpoint", "paginatorLocale", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "virtualRowHeight", "selectAll"], outputs: ["contextMenuSelectionChange", "selectAllChange", "selectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { kind: "ngmodule", type: TagModule }, { kind: "component", type: i7$1.Tag, selector: "p-tag", inputs: ["style", "styleClass", "severity", "value", "icon", "rounded"] }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i8$1.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }] });
647
1330
  }
648
1331
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: LineSimulatorComponent, decorators: [{
649
1332
  type: Component,
@@ -660,8 +1343,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
660
1343
  TableModule,
661
1344
  TagModule,
662
1345
  TooltipModule
663
- ], template: "<div class=\"sfs-stack\">\n <!-- Capacidad de pago -->\n <section [attr.aria-labelledby]=\"ids.capacityTitle\">\n <h3 [id]=\"ids.capacityTitle\" class=\"sfs-subtitle sfs-gap-bottom\">Capacidad de pago</h3>\n @if (capacityEditable()) {\n <div class=\"sfs-capacity-grid\">\n @for (field of capacityFields; track field.key) {\n <div class=\"sfs-control\">\n <label [for]=\"ids.capacity + field.key\">{{ field.label }}</label>\n <p-inputnumber [inputId]=\"ids.capacity + field.key\" [ngModel]=\"currentCapacity()[field.key]\" (ngModelChange)=\"setCapacity(field.key, $event)\"\n mode=\"currency\" currency=\"COP\" [locale]=\"locale\" [minFractionDigits]=\"0\" [maxFractionDigits]=\"0\" [min]=\"0\" [fluid]=\"true\"></p-inputnumber>\n </div>\n }\n <div class=\"sfs-control sfs-control--check\">\n <p-checkbox [inputId]=\"ids.garnishment\" [binary]=\"true\" [ngModel]=\"currentCapacity().hasGarnishment\" (ngModelChange)=\"setGarnishment($event)\"></p-checkbox>\n <label [for]=\"ids.garnishment\">Tiene embargo</label>\n </div>\n </div>\n }\n <!-- Indicadores en grilla: varios por fila en escritorio, para que la capacidad no ocupe media pantalla. -->\n @if (!capacityEditable() || simulation()) {\n <dl class=\"sfs-metrics\" [class.sfs-gap-top]=\"capacityEditable()\">\n @if (!capacityEditable()) {\n <div><dt>Ingresos</dt><dd>{{ capacity().income | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Descuentos de ley</dt><dd>{{ capacity().legalDeductions | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Otras afiliaciones</dt><dd>{{ capacity().otherAffiliations | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Otros descuentos</dt><dd>{{ capacity().otherDeductions | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Compras de cartera</dt><dd>{{ capacity().purchasesValue | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Embargo</dt><dd>{{ capacity().hasGarnishment ? 'S\u00ED' : 'No' }}</dd></div>\n }\n @if (simulation(); as s) {\n <div><dt>Cuota disponible</dt><dd class=\"sfs-strong\">{{ s.capacity.availableInstallment | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Monto m\u00E1ximo</dt><dd class=\"sfs-strong\">{{ s.capacity.maxAmount != null ? (s.capacity.maxAmount | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale) : '\u2014' }}</dd></div>\n }\n </dl>\n }\n </section>\n\n @switch (state()) {\n @case ('loading') {\n <div class=\"sfs-stack\" aria-busy=\"true\">\n <p-skeleton height=\"2.5rem\"></p-skeleton>\n <p-skeleton height=\"12rem\"></p-skeleton>\n </div>\n }\n @case ('error') {\n <p-message severity=\"error\">\n <div class=\"sfs-inline\">\n <span>{{ errorMessage() || 'No se pudo simular la solicitud.' }}</span>\n <p-button label=\"Reintentar\" icon=\"pi pi-refresh\" [text]=\"true\" (onClick)=\"retrySimulation()\"></p-button>\n </div>\n </p-message>\n @if (capacityEditable() && pendingChanges()) {\n <div class=\"sfs-actions\">\n <p-button label=\"Recalcular\" icon=\"pi pi-calculator\" severity=\"secondary\" [text]=\"true\" [disabled]=\"hasNegativeInput()\" (onClick)=\"recalculate()\"></p-button>\n </div>\n }\n }\n @case ('idle') {\n @if (capacityEditable()) {\n <div class=\"sfs-actions\">\n <p-button label=\"Simular\" icon=\"pi pi-calculator\" [disabled]=\"hasNegativeInput()\" (onClick)=\"recalculate()\"></p-button>\n </div>\n } @else {\n <p class=\"sfs-muted sfs-no-top\">Todav\u00EDa no hay una simulaci\u00F3n para esta solicitud.</p>\n }\n }\n @case ('ready') {\n @if (simulation()?.warnings?.length) {\n <p-message severity=\"warn\">\n <ul class=\"sfs-list\">\n @for (w of simulation()?.warnings ?? []; track $index) { <li>{{ w }}</li> }\n </ul>\n </p-message>\n }\n\n @if (!lineOptions().length) {\n <p-message severity=\"info\" text=\"El simulador no devolvi\u00F3 l\u00EDneas para esta solicitud. Revise la pagadur\u00EDa, el producto y la capacidad de pago.\"></p-message>\n }\n\n <!-- L\u00EDnea, plazo, monto y tasa en una sola fila en escritorio. p-select pone el inputId en un span: el nombre\n accesible va por ariaLabelledBy. -->\n <div class=\"sfs-conditions\">\n <div class=\"sfs-control sfs-conditions__line\">\n <label [id]=\"ids.lineLabel\" [for]=\"ids.line\" class=\"sfs-strong\">L\u00EDnea</label>\n <p-select [inputId]=\"ids.line\" [ariaLabelledBy]=\"ids.lineLabel\" [options]=\"lineOptions()\" optionLabel=\"label\" optionValue=\"value\" optionDisabled=\"disabled\"\n [ngModel]=\"selectedLine()\" (ngModelChange)=\"chooseLine($event)\" placeholder=\"Seleccione una l\u00EDnea\" [fluid]=\"true\"></p-select>\n </div>\n @if (line(); as l) {\n @if (!l.error) {\n <div class=\"sfs-control\">\n <label [for]=\"ids.term\">Plazo (cuotas)</label>\n <p-inputnumber [inputId]=\"ids.term\" [ngModel]=\"termInput()\" (ngModelChange)=\"termInput.set($event)\"\n [min]=\"simulation()?.minTerm ?? 1\" [max]=\"simulation()?.maxTerm ?? 600\" [useGrouping]=\"false\"\n [disabled]=\"!canEdit()\" [fluid]=\"true\"></p-inputnumber>\n </div>\n <div class=\"sfs-control\">\n <label [for]=\"ids.amount\">Monto</label>\n <p-inputnumber [inputId]=\"ids.amount\" [ngModel]=\"amountInput()\" (ngModelChange)=\"amountInput.set($event)\"\n mode=\"currency\" currency=\"COP\" [locale]=\"locale\" [minFractionDigits]=\"0\" [maxFractionDigits]=\"0\" [min]=\"0\"\n [disabled]=\"!canEdit()\" [fluid]=\"true\"></p-inputnumber>\n </div>\n <div class=\"sfs-control sfs-conditions__rate\">\n <span>Tasa</span>\n <span class=\"sfs-strong\">{{ l.rate | number: '1.0-4' : locale }} % M.V.</span>\n </div>\n }\n }\n </div>\n @if (saved()?.line && saved()?.line !== selectedLine()) {\n <small class=\"sfs-muted sfs-no-gap\">La l\u00EDnea guardada es {{ savedLineName() }}. Al guardar se cambia por la elegida.</small>\n }\n\n @if (line(); as l) {\n @if (l.error) {\n <p-message severity=\"error\" text=\"Esta l\u00EDnea no se pudo simular. Elija otra o intente m\u00E1s tarde.\"></p-message>\n } @else {\n <!-- Cargos de la l\u00EDnea, con lo guardado al lado -->\n <p-table [value]=\"visibleChargeRows()\" size=\"small\" [scrollable]=\"true\" dataKey=\"name\" styleClass=\"sfs-stack-table\">\n <ng-template #header>\n <tr>\n <th>Cargo</th>\n <th>Tipo</th>\n <th class=\"sfs-right\">Guardado</th>\n <th class=\"sfs-right\">Configurado</th>\n <th class=\"sfs-right\">Valor</th>\n </tr>\n </ng-template>\n <ng-template #body let-row>\n <tr>\n <td class=\"sfs-stack-title\">{{ row.label }}</td>\n <td data-label=\"Tipo\">{{ chargeTypeLabel(row.type) }}</td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Guardado\">\n @if (row.savedInput === null) { \u2014 }\n @else { {{ row.percentage ? (row.savedInput | number: '1.0-4' : locale) + ' %' : (row.savedInput | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale) }} }\n </td>\n <td class=\"sfs-right\" data-label=\"Configurado\">\n @if (row.editable) {\n <label [for]=\"row.id\" class=\"sfs-sr-only\">{{ row.label }}</label>\n <p-inputnumber [inputId]=\"row.id\" [ngModel]=\"chargeInputs()[row.name]\" (ngModelChange)=\"setChargeInput(row.name, $event)\"\n [min]=\"0\" [minFractionDigits]=\"0\" [maxFractionDigits]=\"row.percentage ? 4 : 0\" [locale]=\"locale\"\n [suffix]=\"row.percentage ? ' %' : ''\" [prefix]=\"row.percentage ? '' : '$ '\" inputStyleClass=\"sfs-charge-input\"></p-inputnumber>\n } @else {\n {{ row.percentage ? (row.simulatedInput | number: '1.0-4' : locale) + ' %' : (row.simulatedInput | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale) }}\n }\n </td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Valor\">{{ row.value | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</td>\n </tr>\n </ng-template>\n <ng-template #emptymessage>\n <tr><td colspan=\"5\">La l\u00EDnea no tiene cargos.</td></tr>\n </ng-template>\n </p-table>\n @if (zeroChargesCount()) {\n <!-- Los cargos en cero (sin guardado, sin configurado y sin valor) ocupan espacio y no cambian nada. -->\n <div class=\"sfs-no-gap\">\n <p-button [label]=\"showZeroCharges() ? 'Ocultar los cargos en cero' : 'Ver ' + zeroChargesCount() + (zeroChargesCount() === 1 ? ' cargo en cero' : ' cargos en cero')\"\n [icon]=\"showZeroCharges() ? 'pi pi-eye-slash' : 'pi pi-eye'\" [text]=\"true\" size=\"small\" severity=\"secondary\"\n [ariaLabel]=\"showZeroCharges() ? 'Ocultar los cargos en cero' : 'Ver los cargos en cero'\"\n (onClick)=\"showZeroCharges.set(!showZeroCharges())\"></p-button>\n </div>\n }\n\n <!-- Resultado frente a lo guardado -->\n <section [attr.aria-labelledby]=\"ids.resultTitle\">\n <div class=\"sfs-head\">\n <h3 [id]=\"ids.resultTitle\" class=\"sfs-subtitle\">Resultado</h3>\n <p-tag [value]=\"l.viable ? 'Viable' : 'No viable'\" [severity]=\"l.viable ? 'success' : 'warn'\"></p-tag>\n </div>\n <p-table [value]=\"comparison()\" size=\"small\" [scrollable]=\"true\" dataKey=\"label\" styleClass=\"sfs-stack-table\">\n <ng-template #header>\n <tr><th>Concepto</th><th class=\"sfs-right\">Guardado</th><th class=\"sfs-right\">Simulaci\u00F3n</th></tr>\n </ng-template>\n <ng-template #body let-row>\n <tr>\n <td class=\"sfs-stack-title\">{{ row.label }}</td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Guardado\">\n <ng-container *ngTemplateOutlet=\"valueTpl; context: { $implicit: row.saved, kind: row.kind }\"></ng-container>\n </td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Simulaci\u00F3n\">\n @if (row.changed) { <span class=\"sfs-tag-before\"><p-tag value=\"Cambia\" severity=\"warn\"></p-tag></span> }\n <span [class.sfs-strong]=\"row.changed\">\n <ng-container *ngTemplateOutlet=\"valueTpl; context: { $implicit: row.simulated, kind: row.kind }\"></ng-container>\n </span>\n </td>\n </tr>\n </ng-template>\n </p-table>\n @if (!l.viable && l.viabilityReasons.length) {\n <ul class=\"sfs-list sfs-gap-top\">\n @for (reason of l.viabilityReasons; track $index) { <li>{{ reason }}</li> }\n </ul>\n }\n </section>\n\n <!-- Acciones -->\n <div class=\"sfs-actions\">\n @if (canEdit() || capacityEditable()) {\n <p-button label=\"Recalcular\" icon=\"pi pi-calculator\" severity=\"secondary\" [text]=\"true\"\n [disabled]=\"!pendingChanges() || hasNegativeInput()\" (onClick)=\"recalculate()\"></p-button>\n }\n @if (showSave()) {\n <!-- pButton y no p-button: sin poder guardar el bot\u00F3n queda aria-disabled (no disabled) para que el\n motivo se vea con Tab y con el mouse; openConfirm() corta el clic cuando hay motivo. -->\n <button pButton type=\"button\" label=\"Guardar condiciones\" aria-label=\"Guardar condiciones\"\n [icon]=\"saveUnavailableReason() ? 'pi pi-lock' : 'pi pi-save'\"\n [class.sfs-unavailable]=\"!!saveUnavailableReason()\"\n [attr.aria-disabled]=\"saveUnavailableReason() ? 'true' : null\"\n [attr.aria-describedby]=\"saveUnavailableReason() ? ids.saveReason : null\"\n [pTooltip]=\"saveUnavailableReason() ?? ''\" [tooltipDisabled]=\"!saveUnavailableReason()\" tooltipPosition=\"top\" tooltipEvent=\"both\"\n (click)=\"openConfirm()\"></button>\n @if (saveUnavailableReason()) {\n <span [id]=\"ids.saveReason\" class=\"sfs-sr-only\">{{ saveUnavailableReason() }}</span>\n }\n }\n </div>\n }\n }\n }\n }\n</div>\n\n<!-- Siempre montada: anuncia el resultado de cada simulaci\u00F3n (la de arriba se destruye mientras carga). -->\n<div class=\"sfs-sr-only\" role=\"status\" aria-live=\"polite\">{{ liveMessage() }}</div>\n\n<!-- Un valor de la comparaci\u00F3n, en su formato -->\n<ng-template #valueTpl let-value let-kind=\"kind\">\n @if (value === null || value === undefined || value === '') { \u2014 }\n @else {\n @switch (kind) {\n @case ('money') { {{ value | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }} }\n @case ('rate') { {{ value | number: '1.0-4' : locale }} % M.V. }\n @case ('term') { {{ value }} cuotas }\n @default { {{ value }} }\n }\n }\n</ng-template>\n\n<!-- Confirmaci\u00F3n: cambia l\u00EDnea, monto, plazo y cargos de la solicitud -->\n<p-dialog header=\"Guardar condiciones\" [visible]=\"confirmVisible()\" (visibleChange)=\"confirmVisible.set($event)\" (onHide)=\"restoreConfirmFocus()\"\n [modal]=\"true\" [draggable]=\"false\" [closable]=\"!saving()\" [style]=\"{ width: '32rem', maxWidth: '95vw' }\">\n @if (confirmVisible() && line(); as l) {\n <p class=\"sfs-no-top\">\n Se guardar\u00E1n la l\u00EDnea <strong>{{ l.lineName || l.line }}</strong>,\n un monto de <strong>{{ l.amount | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</strong>\n a <strong>{{ l.term }} cuotas</strong> con una tasa de <strong>{{ l.rate | number: '1.0-4' : locale }} % M.V.</strong> y una cuota de <strong>{{ l.installment | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</strong>,\n con un giro al cliente de <strong>{{ l.transfer | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</strong>.\n </p>\n @if (!l.viable) {\n <p-message severity=\"warn\" text=\"La l\u00EDnea no es viable con la capacidad de pago de la solicitud.\"></p-message>\n }\n }\n <ng-template #footer>\n <p-button label=\"Cancelar\" severity=\"secondary\" [text]=\"true\" [disabled]=\"saving()\" (onClick)=\"confirmVisible.set(false)\"></p-button>\n <p-button label=\"Guardar condiciones\" icon=\"pi pi-save\" [loading]=\"saving()\" (onClick)=\"confirmSave()\"></p-button>\n </ng-template>\n</p-dialog>\n", styles: [".sfs-title{margin:0;font-size:1.125rem;font-weight:600}.sfs-subtitle{margin:0;font-size:1rem;font-weight:600}.sfs-muted{color:var(--p-text-muted-color)}.sfs-section-title{display:flex;align-items:center;gap:.5rem;margin:0 0 .75rem;font-size:1rem;font-weight:600}.sfs-section-title i{color:var(--primary-color, var(--p-primary-color))}.sfs-inline{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem}.sfs-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:.5rem;margin-bottom:.75rem}.sfs-break{overflow-wrap:anywhere}.sfs-nowrap{white-space:nowrap}.sfs-right{text-align:right}.sfs-strong{font-weight:600}.sfs-tag-gap{margin-left:.5rem}.sfs-stack{display:flex;flex-direction:column;gap:1rem}.sfs-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.sfs-summary{display:grid;grid-template-columns:minmax(8rem,max-content) 1fr;gap:.25rem 1rem;margin:0}.sfs-summary dt{color:var(--p-text-muted-color)}.sfs-summary dd{margin:0;text-align:right;font-variant-numeric:tabular-nums}@media (max-width: 575px){:host ::ng-deep .sfs-stack-table .p-datatable-table-container{overflow:visible!important}:host ::ng-deep .sfs-stack-table table,:host ::ng-deep .sfs-stack-table tbody{display:block;width:100%}:host ::ng-deep .sfs-stack-table thead{display:block!important;position:absolute!important;width:1px!important;height:1px!important;overflow:hidden!important;clip-path:inset(50%);white-space:nowrap}:host ::ng-deep .sfs-stack-table tbody tr{display:flex;flex-direction:column;margin-bottom:.5rem;padding:.5rem .75rem;border:1px solid var(--p-content-border-color);border-radius:var(--p-content-border-radius, 6px)}:host ::ng-deep .sfs-stack-table tbody td{display:flex;align-items:center;justify-content:flex-end;gap:.375rem;padding:.3rem 0;border:0;text-align:right}:host ::ng-deep .sfs-stack-table tbody td[data-label]:before{content:attr(data-label);margin-right:auto;padding-right:1rem;color:var(--p-text-muted-color);text-align:left}:host ::ng-deep .sfs-stack-table tbody td.sfs-stack-title{order:-1;display:block;font-weight:600;text-align:left}:host ::ng-deep .sfs-stack-table tfoot,:host ::ng-deep .sfs-stack-table .sfs-stack-hide{display:none}}\n", ".sfs-control{display:flex;flex-direction:column;gap:.25rem;min-width:0}.sfs-control--check{flex-direction:row;align-items:center;gap:.5rem;align-self:end;min-height:2.75rem}.sfs-capacity-grid{display:grid;grid-template-columns:minmax(0,1fr);gap:.75rem}@media (min-width: 576px){.sfs-capacity-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}.sfs-conditions{display:grid;grid-template-columns:minmax(0,1fr);gap:.75rem;align-items:end}@media (min-width: 576px){.sfs-conditions{grid-template-columns:repeat(2,minmax(0,1fr))}.sfs-conditions__line{grid-column:1 / -1}}@media (min-width: 992px){.sfs-conditions{grid-template-columns:minmax(0,2fr) minmax(0,1fr) minmax(0,1fr) max-content}.sfs-conditions__line{grid-column:auto}}.sfs-conditions__rate{justify-content:flex-end;min-height:2.5rem;padding-bottom:.5rem}.sfs-metrics{display:grid;grid-template-columns:repeat(auto-fill,minmax(9.5rem,1fr));gap:.5rem 1rem;margin:0}.sfs-metrics dt{font-size:.8125rem;color:var(--p-text-muted-color)}.sfs-metrics dd{margin:0;font-variant-numeric:tabular-nums}.sfs-no-gap{margin-top:-.75rem}.sfs-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:.5rem}.sfs-list{margin:0;padding-left:1rem}.sfs-gap-top{margin-top:.5rem}.sfs-gap-bottom{margin-bottom:.5rem}.sfs-no-top{margin-top:0}.sfs-tag-before{margin-right:.5rem}:host ::ng-deep .sfs-charge-input{width:6.5rem;padding-block:.25rem;text-align:right}:host ::ng-deep .sfs-unavailable.p-button{opacity:var(--p-disabled-opacity);cursor:default}:host ::ng-deep .sfs-unavailable.p-button:hover,:host ::ng-deep .sfs-unavailable.p-button:active{background:var(--button-color, var(--p-button-primary-background));border-color:var(--button-color, var(--p-button-primary-border-color))}\n"] }]
1346
+ ], template: "<div class=\"sfs-stack\">\n <!-- Capacidad de pago -->\n <section [attr.aria-labelledby]=\"ids.capacityTitle\">\n <h3 [id]=\"ids.capacityTitle\" class=\"sfs-subtitle sfs-gap-bottom\">Capacidad de pago</h3>\n @if (capacityEditable()) {\n <div class=\"sfs-capacity-grid\">\n @for (field of capacityFields; track field.key) {\n <div class=\"sfs-control\">\n <label [for]=\"ids.capacity + field.key\">{{ field.label }}</label>\n <p-inputnumber [inputId]=\"ids.capacity + field.key\" [ngModel]=\"currentCapacity()[field.key]\" (ngModelChange)=\"setCapacity(field.key, $event)\"\n mode=\"currency\" currency=\"COP\" [locale]=\"locale\" [minFractionDigits]=\"0\" [maxFractionDigits]=\"0\" [min]=\"0\" [fluid]=\"true\"></p-inputnumber>\n </div>\n }\n <div class=\"sfs-control sfs-control--check\">\n <p-checkbox [inputId]=\"ids.garnishment\" [binary]=\"true\" [ngModel]=\"currentCapacity().hasGarnishment\" (ngModelChange)=\"setGarnishment($event)\"></p-checkbox>\n <label [for]=\"ids.garnishment\">Tiene embargo</label>\n </div>\n </div>\n }\n <!-- Indicadores en grilla: varios por fila en escritorio, para que la capacidad no ocupe media pantalla. -->\n @if (!capacityEditable() || simulation()) {\n <dl class=\"sfs-metrics\" [class.sfs-gap-top]=\"capacityEditable()\">\n @if (!capacityEditable()) {\n <div><dt>Ingresos</dt><dd>{{ capacity().income | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Descuentos de ley</dt><dd>{{ capacity().legalDeductions | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Otras afiliaciones</dt><dd>{{ capacity().otherAffiliations | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Otros descuentos</dt><dd>{{ capacity().otherDeductions | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Compras de cartera</dt><dd>{{ capacity().purchasesValue | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Embargo</dt><dd>{{ capacity().hasGarnishment ? 'S\u00ED' : 'No' }}</dd></div>\n }\n @if (simulation(); as s) {\n <div><dt>Disponible n\u00F3mina</dt><dd class=\"sfs-strong\">{{ maxInstallment() | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n @if (!installmentEditable()) {\n <div><dt>Valor cuota</dt><dd class=\"sfs-strong\">{{ currentInstallment() | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n }\n <div><dt>Tope de monto</dt><dd>{{ s.capacity.maxAmount != null ? (s.capacity.maxAmount | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale) : '\u2014' }}</dd></div>\n }\n </dl>\n }\n <!-- La cuota la digita la persona: el simulador calcula con ella el m\u00E1ximo a financiar. No puede superar el\n disponible n\u00F3mina (incluye el aporte). -->\n @if (installmentEditable()) {\n <div class=\"sfs-control sfs-installment sfs-gap-top\">\n <label [for]=\"ids.installment\">Valor cuota</label>\n <p-inputnumber [inputId]=\"ids.installment\" [ngModel]=\"currentInstallment()\" (ngModelChange)=\"setInstallment($event)\"\n mode=\"currency\" currency=\"COP\" [locale]=\"locale\" [minFractionDigits]=\"0\" [maxFractionDigits]=\"0\" [min]=\"0\" [fluid]=\"true\"\n [ariaDescribedBy]=\"installmentError() ? ids.installmentError : undefined\"\n [inputStyleClass]=\"installmentError() ? 'ng-invalid ng-dirty' : ''\"></p-inputnumber>\n @if (installmentError(); as error) {\n <small [id]=\"ids.installmentError\" class=\"sfs-field-error\"><i class=\"pi pi-exclamation-circle\" aria-hidden=\"true\"></i> {{ error }}\n M\u00E1ximo {{ maxInstallment() | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}.</small>\n } @else {\n <small class=\"sfs-muted\">Hasta el disponible n\u00F3mina. Al recalcular, el monto sale de esta cuota.</small>\n }\n @if (maxInstallment() !== null && currentInstallment() !== maxInstallment()) {\n <div>\n <p-button label=\"Usar el disponible n\u00F3mina\" icon=\"pi pi-replay\" [text]=\"true\" size=\"small\" severity=\"secondary\"\n (onClick)=\"useMaxInstallment()\"></p-button>\n </div>\n }\n </div>\n }\n </section>\n\n @switch (state()) {\n @case ('loading') {\n <div class=\"sfs-stack\" aria-busy=\"true\">\n <p-skeleton height=\"2.5rem\"></p-skeleton>\n <p-skeleton height=\"12rem\"></p-skeleton>\n </div>\n }\n @case ('error') {\n <p-message severity=\"error\">\n <div class=\"sfs-inline\">\n <span>{{ errorMessage() || 'No se pudo simular la solicitud.' }}</span>\n <p-button label=\"Reintentar\" icon=\"pi pi-refresh\" [text]=\"true\" (onClick)=\"retrySimulation()\"></p-button>\n </div>\n </p-message>\n @if (capacityEditable() && pendingChanges()) {\n <div class=\"sfs-actions\">\n <p-button label=\"Recalcular\" icon=\"pi pi-calculator\" severity=\"secondary\" [text]=\"true\" [disabled]=\"hasNegativeInput()\" (onClick)=\"recalculate()\"></p-button>\n </div>\n }\n }\n @case ('idle') {\n @if (capacityEditable()) {\n <div class=\"sfs-actions\">\n <p-button label=\"Simular\" icon=\"pi pi-calculator\" [disabled]=\"hasNegativeInput()\" (onClick)=\"recalculate()\"></p-button>\n </div>\n } @else {\n <p class=\"sfs-muted sfs-no-top\">Todav\u00EDa no hay una simulaci\u00F3n para esta solicitud.</p>\n }\n }\n @case ('ready') {\n @if (simulation()?.warnings?.length) {\n <p-message severity=\"warn\">\n <ul class=\"sfs-list\">\n @for (w of simulation()?.warnings ?? []; track $index) { <li>{{ w }}</li> }\n </ul>\n </p-message>\n }\n\n @if (!lineOptions().length) {\n <p-message severity=\"info\" text=\"El simulador no devolvi\u00F3 l\u00EDneas para esta solicitud. Revise la pagadur\u00EDa, el producto y la capacidad de pago.\"></p-message>\n }\n\n <!-- L\u00EDnea, plazo, monto y tasa en una sola fila en escritorio. p-select pone el inputId en un span: el nombre\n accesible va por ariaLabelledBy. -->\n <div class=\"sfs-conditions\">\n <div class=\"sfs-control sfs-conditions__line\">\n <label [id]=\"ids.lineLabel\" [for]=\"ids.line\" class=\"sfs-strong\">L\u00EDnea</label>\n <p-select [inputId]=\"ids.line\" [ariaLabelledBy]=\"ids.lineLabel\" [options]=\"lineOptions()\" optionLabel=\"label\" optionValue=\"value\" optionDisabled=\"disabled\"\n [ngModel]=\"selectedLine()\" (ngModelChange)=\"chooseLine($event)\" placeholder=\"Seleccione una l\u00EDnea\" [fluid]=\"true\"></p-select>\n </div>\n @if (line(); as l) {\n @if (!l.error) {\n <div class=\"sfs-control\">\n <label [for]=\"ids.term\">Plazo (cuotas)</label>\n <p-inputnumber [inputId]=\"ids.term\" [ngModel]=\"termInput()\" (ngModelChange)=\"termInput.set($event)\"\n [min]=\"simulation()?.minTerm ?? 1\" [max]=\"simulation()?.maxTerm ?? 600\" [useGrouping]=\"false\"\n [disabled]=\"!canEdit()\" [fluid]=\"true\"></p-inputnumber>\n </div>\n <div class=\"sfs-control\">\n <label [for]=\"ids.amount\">Monto</label>\n <p-inputnumber [inputId]=\"ids.amount\" [ngModel]=\"amountInput()\" (ngModelChange)=\"amountInput.set($event)\"\n mode=\"currency\" currency=\"COP\" [locale]=\"locale\" [minFractionDigits]=\"0\" [maxFractionDigits]=\"0\" [min]=\"0\"\n [disabled]=\"!canEdit()\" [fluid]=\"true\"></p-inputnumber>\n </div>\n @if (rateEditable()) {\n <div class=\"sfs-control\">\n <label [id]=\"ids.rateLabel\" [for]=\"ids.rate\">Tasa</label>\n <p-select [inputId]=\"ids.rate\" [ariaLabelledBy]=\"ids.rateLabel\" [options]=\"rateOptions()\" optionLabel=\"label\" optionValue=\"value\"\n [ngModel]=\"currentRate()\" (ngModelChange)=\"rateInput.set($event)\" [fluid]=\"true\" appendTo=\"body\"></p-select>\n </div>\n } @else {\n <div class=\"sfs-control sfs-conditions__rate\">\n <span>Tasa</span>\n <span class=\"sfs-strong\">{{ l.rate | number: '1.0-4' : locale }} % M.V.</span>\n </div>\n }\n }\n }\n </div>\n @if (saved()?.line && saved()?.line !== selectedLine()) {\n <small class=\"sfs-muted sfs-no-gap\">La l\u00EDnea guardada es {{ savedLineName() }}. Al guardar se cambia por la elegida.</small>\n }\n\n @if (line(); as l) {\n @if (l.error) {\n <p-message severity=\"error\" text=\"Esta l\u00EDnea no se pudo simular. Elija otra o intente m\u00E1s tarde.\"></p-message>\n } @else {\n <!-- Cargos de la l\u00EDnea: plegados, porque casi nunca se tocan. Al desplegarlos, los del cr\u00E9dito (se descuentan\n del desembolso o van al capital) y los de la cuota, cada uno en su columna. -->\n <section [attr.aria-labelledby]=\"ids.chargesTitle\">\n <div class=\"sfs-head\">\n <h3 [id]=\"ids.chargesTitle\" class=\"sfs-subtitle\">Cargos</h3>\n <!-- pButton y no p-button: el componente no deja poner aria-expanded en su <button>. -->\n <button pButton type=\"button\" severity=\"secondary\" [text]=\"true\" size=\"small\"\n [label]=\"(chargesOpen() ? 'Ocultar cargos' : 'Ver cargos') + (editedChargesCount() ? ' (' + editedChargesCount() + ' cambiados)' : '')\"\n [icon]=\"chargesOpen() ? 'pi pi-chevron-up' : 'pi pi-chevron-down'\" iconPos=\"right\"\n [attr.aria-expanded]=\"chargesOpen()\" [attr.aria-controls]=\"ids.charges\"\n (click)=\"chargesOpen.set(!chargesOpen())\"></button>\n </div>\n @if (chargesOpen()) {\n <div [id]=\"ids.charges\" class=\"sfs-charges\">\n <div>\n <h4 class=\"sfs-charges__title\">Del cr\u00E9dito</h4>\n <p-table [value]=\"creditChargeRows()\" size=\"small\" [scrollable]=\"true\" dataKey=\"name\" styleClass=\"sfs-stack-table\">\n <ng-template #header>\n <tr>\n <th>Cargo</th>\n <th class=\"sfs-right\">Guardado</th>\n <th class=\"sfs-right\">Configurado</th>\n <th class=\"sfs-right\">Valor</th>\n </tr>\n </ng-template>\n <ng-template #body let-row>\n <tr>\n <td class=\"sfs-stack-title\">{{ row.label }}</td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Guardado\">\n @if (row.savedInput === null) { \u2014 }\n @else { {{ row.percentage ? (row.savedInput | number: '1.0-4' : locale) + ' %' : (row.savedInput | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale) }} }\n </td>\n <td class=\"sfs-right\" data-label=\"Configurado\">\n @if (row.editable) {\n <label [for]=\"row.id\" class=\"sfs-sr-only\">{{ row.label }}</label>\n <p-inputnumber [inputId]=\"row.id\" [ngModel]=\"chargeInputs()[row.name]\" (ngModelChange)=\"setChargeInput(row.name, $event)\"\n [min]=\"0\" [minFractionDigits]=\"0\" [maxFractionDigits]=\"row.percentage ? 4 : 0\" [locale]=\"locale\"\n [suffix]=\"row.percentage ? ' %' : ''\" [prefix]=\"row.percentage ? '' : '$ '\" inputStyleClass=\"sfs-charge-input\"></p-inputnumber>\n } @else {\n {{ row.percentage ? (row.simulatedInput | number: '1.0-4' : locale) + ' %' : (row.simulatedInput | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale) }}\n }\n </td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Valor\">{{ row.value | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</td>\n </tr>\n </ng-template>\n <ng-template #emptymessage>\n <tr><td colspan=\"4\">La l\u00EDnea no tiene cargos del cr\u00E9dito.</td></tr>\n </ng-template>\n </p-table>\n </div>\n <div>\n <h4 class=\"sfs-charges__title\">De la cuota</h4>\n <p-table [value]=\"installmentChargeRows()\" size=\"small\" [scrollable]=\"true\" dataKey=\"name\" styleClass=\"sfs-stack-table\">\n <ng-template #header>\n <tr>\n <th>Cargo</th>\n <th class=\"sfs-right\">Guardado</th>\n <th class=\"sfs-right\">Configurado</th>\n <th class=\"sfs-right\">Valor</th>\n </tr>\n </ng-template>\n <ng-template #body let-row>\n <tr>\n <td class=\"sfs-stack-title\">{{ row.label }}</td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Guardado\">\n @if (row.savedInput === null) { \u2014 }\n @else { {{ row.percentage ? (row.savedInput | number: '1.0-4' : locale) + ' %' : (row.savedInput | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale) }} }\n </td>\n <td class=\"sfs-right\" data-label=\"Configurado\">\n @if (row.editable) {\n <label [for]=\"row.id\" class=\"sfs-sr-only\">{{ row.label }}</label>\n <p-inputnumber [inputId]=\"row.id\" [ngModel]=\"chargeInputs()[row.name]\" (ngModelChange)=\"setChargeInput(row.name, $event)\"\n [min]=\"0\" [minFractionDigits]=\"0\" [maxFractionDigits]=\"row.percentage ? 4 : 0\" [locale]=\"locale\"\n [suffix]=\"row.percentage ? ' %' : ''\" [prefix]=\"row.percentage ? '' : '$ '\" inputStyleClass=\"sfs-charge-input\"></p-inputnumber>\n } @else {\n {{ row.percentage ? (row.simulatedInput | number: '1.0-4' : locale) + ' %' : (row.simulatedInput | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale) }}\n }\n </td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Valor\">{{ row.value | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</td>\n </tr>\n </ng-template>\n <ng-template #emptymessage>\n <tr><td colspan=\"4\">La l\u00EDnea no tiene cargos en la cuota.</td></tr>\n </ng-template>\n </p-table>\n </div>\n </div>\n @if (zeroChargesCount()) {\n <!-- Los cargos en cero (sin guardado, sin configurado y sin valor) ocupan espacio y no cambian nada. -->\n <div class=\"sfs-no-gap\">\n <p-button [label]=\"showZeroCharges() ? 'Ocultar los cargos en cero' : 'Ver ' + zeroChargesCount() + (zeroChargesCount() === 1 ? ' cargo en cero' : ' cargos en cero')\"\n [icon]=\"showZeroCharges() ? 'pi pi-eye-slash' : 'pi pi-eye'\" [text]=\"true\" size=\"small\" severity=\"secondary\"\n [ariaLabel]=\"showZeroCharges() ? 'Ocultar los cargos en cero' : 'Ver los cargos en cero'\"\n (onClick)=\"showZeroCharges.set(!showZeroCharges())\"></p-button>\n </div>\n }\n }\n </section>\n\n <!-- Resultado frente a lo guardado -->\n <section [attr.aria-labelledby]=\"ids.resultTitle\">\n <div class=\"sfs-head\">\n <h3 [id]=\"ids.resultTitle\" class=\"sfs-subtitle\">Resultado</h3>\n <p-tag [value]=\"l.viable ? 'Viable' : 'No viable'\" [severity]=\"l.viable ? 'success' : 'warn'\"></p-tag>\n </div>\n @if (summary(); as sm) {\n <dl class=\"sfs-summary\">\n <div><dt>M\u00E1ximo a financiar</dt><dd class=\"sfs-strong\">{{ sm.maxAmount | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Monto</dt><dd>{{ sm.amount | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Descuentos del cr\u00E9dito</dt><dd>{{ sm.creditDiscounts | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Desembolso</dt><dd>{{ sm.disbursement | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Compras de cartera</dt><dd>{{ sm.purchases !== null ? (sm.purchases | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale) : '\u2014' }}</dd></div>\n <div><dt>Sanear</dt><dd>{{ sm.cleanUp !== null ? (sm.cleanUp | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale) : '\u2014' }}</dd></div>\n <!-- Neto a girar resaltado: con el color de \u00E9xito o de error del tema y, adem\u00E1s, un icono y el texto. -->\n <div class=\"sfs-net\" [class.sfs-net--negative]=\"sm.net < 0\">\n <dt>Neto a girar</dt>\n <dd>\n <i [class]=\"sm.net < 0 ? 'pi pi-exclamation-triangle' : 'pi pi-check-circle'\" aria-hidden=\"true\"></i>\n {{ sm.net | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}\n @if (sm.net < 0) { <span class=\"sfs-net__note\">Negativo: no alcanza para las compras de cartera.</span> }\n </dd>\n </div>\n </dl>\n }\n <p-table [value]=\"comparison()\" size=\"small\" [scrollable]=\"true\" dataKey=\"label\" styleClass=\"sfs-stack-table\">\n <ng-template #header>\n <tr><th>Concepto</th><th class=\"sfs-right\">Guardado</th><th class=\"sfs-right\">Simulaci\u00F3n</th></tr>\n </ng-template>\n <ng-template #body let-row>\n <tr>\n <td class=\"sfs-stack-title\">{{ row.label }}</td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Guardado\">\n <ng-container *ngTemplateOutlet=\"valueTpl; context: { $implicit: row.saved, kind: row.kind }\"></ng-container>\n </td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Simulaci\u00F3n\">\n @if (row.changed) { <span class=\"sfs-tag-before\"><p-tag value=\"Cambia\" severity=\"warn\"></p-tag></span> }\n <span [class.sfs-strong]=\"row.changed\">\n <ng-container *ngTemplateOutlet=\"valueTpl; context: { $implicit: row.simulated, kind: row.kind }\"></ng-container>\n </span>\n </td>\n </tr>\n </ng-template>\n </p-table>\n @if (!l.viable && l.viabilityReasons.length) {\n <ul class=\"sfs-list sfs-gap-top\">\n @for (reason of l.viabilityReasons; track $index) { <li>{{ reason }}</li> }\n </ul>\n }\n </section>\n\n <!-- Acciones -->\n <div class=\"sfs-actions\">\n @if (canEdit() || capacityEditable()) {\n <p-button label=\"Recalcular\" icon=\"pi pi-calculator\" severity=\"secondary\" [text]=\"true\"\n [disabled]=\"!pendingChanges() || hasNegativeInput()\" (onClick)=\"recalculate()\"></p-button>\n }\n @if (showSave()) {\n <!-- pButton y no p-button: sin poder guardar el bot\u00F3n queda aria-disabled (no disabled) para que el\n motivo se vea con Tab y con el mouse; openConfirm() corta el clic cuando hay motivo. -->\n <button pButton type=\"button\" label=\"Guardar condiciones\" aria-label=\"Guardar condiciones\"\n [icon]=\"saveUnavailableReason() ? 'pi pi-lock' : 'pi pi-save'\"\n [class.sfs-unavailable]=\"!!saveUnavailableReason()\"\n [attr.aria-disabled]=\"saveUnavailableReason() ? 'true' : null\"\n [attr.aria-describedby]=\"saveUnavailableReason() ? ids.saveReason : null\"\n [pTooltip]=\"saveUnavailableReason() ?? ''\" [tooltipDisabled]=\"!saveUnavailableReason()\" tooltipPosition=\"top\" tooltipEvent=\"both\"\n (click)=\"openConfirm()\"></button>\n @if (saveUnavailableReason()) {\n <span [id]=\"ids.saveReason\" class=\"sfs-sr-only\">{{ saveUnavailableReason() }}</span>\n }\n }\n </div>\n }\n }\n }\n }\n</div>\n\n<!-- Siempre montada: anuncia el resultado de cada simulaci\u00F3n (la de arriba se destruye mientras carga). -->\n<div class=\"sfs-sr-only\" role=\"status\" aria-live=\"polite\">{{ liveMessage() }}</div>\n\n<!-- Un valor de la comparaci\u00F3n, en su formato -->\n<ng-template #valueTpl let-value let-kind=\"kind\">\n @if (value === null || value === undefined || value === '') { \u2014 }\n @else {\n @switch (kind) {\n @case ('money') { {{ value | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }} }\n @case ('rate') { {{ value | number: '1.0-4' : locale }} % M.V. }\n @case ('term') { {{ value }} cuotas }\n @default { {{ value }} }\n }\n }\n</ng-template>\n\n<!-- Confirmaci\u00F3n: cambia l\u00EDnea, monto, plazo y cargos de la solicitud -->\n<p-dialog header=\"Guardar condiciones\" [visible]=\"confirmVisible()\" (visibleChange)=\"confirmVisible.set($event)\" (onHide)=\"restoreConfirmFocus()\"\n [modal]=\"true\" [draggable]=\"false\" [closable]=\"!saving()\" [style]=\"{ width: '32rem', maxWidth: '95vw' }\">\n @if (confirmVisible() && line(); as l) {\n <p class=\"sfs-no-top\">\n Se guardar\u00E1n la l\u00EDnea <strong>{{ l.lineName || l.line }}</strong>,\n un monto de <strong>{{ l.amount | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</strong>\n a <strong>{{ l.term }} cuotas</strong> con una tasa de <strong>{{ l.rate | number: '1.0-4' : locale }} % M.V.</strong> y una cuota de <strong>{{ l.installment | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</strong>,\n con un giro al cliente de <strong>{{ l.transfer | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</strong>.\n </p>\n @if (!l.viable) {\n <p-message severity=\"warn\" text=\"La l\u00EDnea no es viable con la capacidad de pago de la solicitud.\"></p-message>\n }\n }\n <ng-template #footer>\n <p-button label=\"Cancelar\" severity=\"secondary\" [text]=\"true\" [disabled]=\"saving()\" (onClick)=\"confirmVisible.set(false)\"></p-button>\n <p-button label=\"Guardar condiciones\" icon=\"pi pi-save\" [loading]=\"saving()\" (onClick)=\"confirmSave()\"></p-button>\n </ng-template>\n</p-dialog>\n", styles: [".sfs-title{margin:0;font-size:1.125rem;font-weight:600}.sfs-subtitle{margin:0;font-size:1rem;font-weight:600}.sfs-muted{color:var(--p-text-muted-color)}.sfs-section-title{display:flex;align-items:center;gap:.5rem;margin:0 0 .75rem;font-size:1rem;font-weight:600}.sfs-section-title i{color:var(--primary-color, var(--p-primary-color))}.sfs-inline{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem}.sfs-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:.5rem;margin-bottom:.75rem}.sfs-break{overflow-wrap:anywhere}.sfs-nowrap{white-space:nowrap}.sfs-right{text-align:right}.sfs-strong{font-weight:600}.sfs-tag-gap{margin-left:.5rem}.sfs-stack{display:flex;flex-direction:column;gap:1rem}.sfs-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.sfs-summary{display:grid;grid-template-columns:minmax(8rem,max-content) 1fr;gap:.25rem 1rem;margin:0}.sfs-summary dt{color:var(--p-text-muted-color)}.sfs-summary dd{margin:0;text-align:right;font-variant-numeric:tabular-nums}@media (max-width: 575px){:host ::ng-deep .sfs-stack-table .p-datatable-table-container{overflow:visible!important}:host ::ng-deep .sfs-stack-table table,:host ::ng-deep .sfs-stack-table tbody{display:block;width:100%}:host ::ng-deep .sfs-stack-table thead{display:block!important;position:absolute!important;width:1px!important;height:1px!important;overflow:hidden!important;clip-path:inset(50%);white-space:nowrap}:host ::ng-deep .sfs-stack-table tbody tr{display:flex;flex-direction:column;margin-bottom:.5rem;padding:.5rem .75rem;border:1px solid var(--p-content-border-color);border-radius:var(--p-content-border-radius, 6px)}:host ::ng-deep .sfs-stack-table tbody td{display:flex;align-items:center;justify-content:flex-end;gap:.375rem;padding:.3rem 0;border:0;text-align:right}:host ::ng-deep .sfs-stack-table tbody td[data-label]:before{content:attr(data-label);margin-right:auto;padding-right:1rem;color:var(--p-text-muted-color);text-align:left}:host ::ng-deep .sfs-stack-table tbody td.sfs-stack-title{order:-1;display:block;font-weight:600;text-align:left}:host ::ng-deep .sfs-stack-table tfoot,:host ::ng-deep .sfs-stack-table .sfs-stack-hide{display:none}}\n", ".sfs-control{display:flex;flex-direction:column;gap:.25rem;min-width:0}.sfs-control--check{flex-direction:row;align-items:center;gap:.5rem;align-self:end;min-height:2.75rem}.sfs-capacity-grid{display:grid;grid-template-columns:minmax(0,1fr);gap:.75rem}@media (min-width: 576px){.sfs-capacity-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}.sfs-conditions{display:grid;grid-template-columns:minmax(0,1fr);gap:.75rem;align-items:end}@media (min-width: 576px){.sfs-conditions{grid-template-columns:repeat(2,minmax(0,1fr))}.sfs-conditions__line{grid-column:1 / -1}}@media (min-width: 992px){.sfs-conditions{grid-template-columns:minmax(0,2fr) minmax(0,1fr) minmax(0,1fr) minmax(9rem,1fr)}.sfs-conditions__line{grid-column:auto}}.sfs-conditions__rate{justify-content:flex-end;min-height:2.5rem;padding-bottom:.5rem}.sfs-metrics{display:grid;grid-template-columns:repeat(auto-fill,minmax(9.5rem,1fr));gap:.5rem 1rem;margin:0}.sfs-metrics dt{font-size:.8125rem;color:var(--p-text-muted-color)}.sfs-metrics dd{margin:0;font-variant-numeric:tabular-nums}.sfs-no-gap{margin-top:-.75rem}.sfs-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:.5rem}.sfs-list{margin:0;padding-left:1rem}.sfs-gap-top{margin-top:.5rem}.sfs-gap-bottom{margin-bottom:.5rem}.sfs-no-top{margin-top:0}.sfs-tag-before{margin-right:.5rem}:host ::ng-deep .sfs-charge-input{width:6.5rem;padding-block:.25rem;text-align:right}:host ::ng-deep .sfs-unavailable.p-button{opacity:var(--p-disabled-opacity);cursor:default}:host ::ng-deep .sfs-unavailable.p-button:hover,:host ::ng-deep .sfs-unavailable.p-button:active{background:var(--button-color, var(--p-button-primary-background));border-color:var(--button-color, var(--p-button-primary-border-color))}.sfs-installment{max-width:20rem}.sfs-field-error{color:var(--p-message-error-simple-color, var(--p-text-color))}.sfs-charges{display:grid;grid-template-columns:minmax(0,1fr);gap:1rem}@media (min-width: 992px){.sfs-charges{grid-template-columns:repeat(2,minmax(0,1fr))}}.sfs-charges__title{margin:0 0 .5rem;font-size:.875rem;font-weight:600;color:var(--p-text-muted-color)}.sfs-summary{display:grid;grid-template-columns:repeat(auto-fill,minmax(10rem,1fr));gap:.5rem 1rem;margin:0 0 1rem}.sfs-summary dt{font-size:.8125rem;color:var(--p-text-muted-color)}.sfs-summary dd{margin:0}.sfs-net{grid-column:1 / -1;padding:.5rem .75rem;border:1px solid var(--p-message-success-border-color, var(--p-content-border-color));border-radius:var(--p-content-border-radius, 6px);background:var(--p-message-success-background, var(--p-content-background));color:var(--p-message-success-color, var(--p-text-color))}.sfs-net dt{color:inherit;font-weight:600}.sfs-net dd{font-size:1.25rem;font-weight:700}.sfs-net--negative{border-color:var(--p-message-error-border-color, var(--p-content-border-color));background:var(--p-message-error-background, var(--p-content-background));color:var(--p-message-error-color, var(--p-text-color))}.sfs-net__note{display:block;font-size:.8125rem;font-weight:400}\n"] }]
664
1347
  }], ctorParameters: () => [] });
1348
+ /** Una tasa con coma decimal y hasta 4 decimales, como se lee en es-CO. */
1349
+ function formatRate(rate) {
1350
+ return rate.toLocaleString('es-CO', { minimumFractionDigits: 2, maximumFractionDigits: 4 });
1351
+ }
665
1352
  /** Un valor configurado del core (fracción o pesos) en la unidad de la pantalla (% o pesos). */
666
1353
  function toScreenUnit(value, percentage) {
667
1354
  return percentage ? round(value * 100, 4) : value;
@@ -718,7 +1405,7 @@ class DebtBuyoutsComponent {
718
1405
  return [row.Entidad, row.NumeroObligacion].filter((part) => !!part?.toString().trim()).join(' ') || `compra ${row.IdPrstmsCC}`;
719
1406
  }
720
1407
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: DebtBuyoutsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
721
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: DebtBuyoutsComponent, isStandalone: true, selector: "lib-debt-buyouts", inputs: { loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, buyouts: { classPropertyName: "buyouts", publicName: "buyouts", isSignal: true, isRequired: false, transformFunction: null }, simulatedValue: { classPropertyName: "simulatedValue", publicName: "simulatedValue", isSignal: true, isRequired: false, transformFunction: null }, canEdit: { classPropertyName: "canEdit", publicName: "canEdit", isSignal: true, isRequired: false, transformFunction: null }, saving: { classPropertyName: "saving", publicName: "saving", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { retry: "retry", mark: "mark" }, ngImport: i0, template: "<p-card>\n <div class=\"sfs-head\">\n <h2 class=\"sfs-title\">Compras de cartera</h2>\n @if (!loading() && !failed() && rows().length) {\n <span class=\"sfs-muted\">\n {{ toBuy().length }} de {{ rows().length }} {{ rows().length === 1 ? 'obligaci\u00F3n' : 'obligaciones' }} para comprar\n @if (toBuy().length) { \u00B7 <strong>{{ totalToBuy() | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</strong> }\n </span>\n }\n </div>\n\n @if (loading()) {\n <div class=\"sfs-stack\" aria-busy=\"true\">\n <p-skeleton height=\"2.5rem\"></p-skeleton>\n <p-skeleton height=\"8rem\"></p-skeleton>\n </div>\n } @else if (failed()) {\n <p-message severity=\"error\">\n <div class=\"sfs-inline\">\n <span>No se pudieron leer las compras de cartera de la solicitud.</span>\n <p-button label=\"Reintentar\" icon=\"pi pi-refresh\" [text]=\"true\" (onClick)=\"retry.emit()\"></p-button>\n </div>\n </p-message>\n } @else {\n <div class=\"sfs-stack\" [attr.aria-busy]=\"saving() ? 'true' : null\">\n @if (canEdit() && rows().length) {\n <p class=\"sfs-muted\" style=\"margin: 0\">Al marcar \"Comprar\" el valor de compras de cartera del simulador pasa a ser la suma de los saldos marcados y la solicitud se vuelve a simular.</p>\n }\n @if (mismatch()) {\n <p-message severity=\"warn\">\n Las obligaciones marcadas para comprar suman {{ totalToBuy() | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }},\n pero la solicitud se simula con compras de cartera por {{ simulatedValue() | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}.\n </p-message>\n }\n\n <p-table [value]=\"rows()\" styleClass=\"p-datatable-sm sfs-stack-table\" [scrollable]=\"true\" dataKey=\"IdPrstmsCC\">\n <ng-template #header>\n <tr>\n <th>Comprar</th>\n <th>Desprendible</th>\n <th>Entidad</th>\n <th>Obligaci\u00F3n</th>\n <th>Origen</th>\n <th>Estado</th>\n <th>Vence</th>\n <th class=\"sfs-right\">Cuota</th>\n <th class=\"sfs-right\">Saldo</th>\n <th class=\"sfs-right\">Mora</th>\n </tr>\n </ng-template>\n <ng-template #body let-row>\n <tr>\n <td data-label=\"Comprar\">\n @if (canEdit()) {\n <p-checkbox [binary]=\"true\" [ngModel]=\"row.Comprar\" [disabled]=\"saving()\"\n [ariaLabel]=\"'Comprar ' + rowName(row)\" (onChange)=\"markBuy(row, $event.checked)\"></p-checkbox>\n } @else {\n <p-tag [value]=\"row.Comprar ? 'Comprar' : 'No comprar'\" [severity]=\"row.Comprar ? 'success' : 'secondary'\"></p-tag>\n }\n </td>\n <td data-label=\"Desprendible\">\n @if (canEdit()) {\n <p-checkbox [binary]=\"true\" [ngModel]=\"row.Desprendible\" [disabled]=\"saving()\"\n [ariaLabel]=\"rowName(row) + ' aparece en el desprendible'\" (onChange)=\"markPayslip(row, $event.checked)\"></p-checkbox>\n } @else {\n {{ row.Desprendible ? 'S\u00ED' : 'No' }}\n }\n </td>\n <td class=\"sfs-stack-title\">\n {{ row.Entidad || '\u2014' }}\n @if (row.NitEntidad) { <br /><small class=\"sfs-muted\">NIT {{ row.NitEntidad }}</small> }\n </td>\n <td data-label=\"Obligaci\u00F3n\">{{ row.NumeroObligacion || '\u2014' }}</td>\n <td data-label=\"Origen\">\n {{ row.Buro || '\u2014' }}\n @if (row.Sector) { <br /><small class=\"sfs-muted\">{{ row.Sector }}</small> }\n </td>\n <td data-label=\"Estado\">{{ row.EstadoObligacion || '\u2014' }}</td>\n <td class=\"sfs-nowrap\" data-label=\"Vence\">{{ row.FechaVencimiento || '\u2014' }}</td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Cuota\">{{ row.ValorCuota | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Saldo\">{{ row.SaldoActual | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Mora\">{{ row.SaldoMora | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</td>\n </tr>\n </ng-template>\n <ng-template #footer>\n @if (rows().length) {\n <tr class=\"sfs-stack-hide\">\n <td colspan=\"7\" class=\"sfs-strong\">Total para comprar</td>\n <td class=\"sfs-right sfs-nowrap sfs-strong\">{{ installmentsToBuy() | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</td>\n <td class=\"sfs-right sfs-nowrap sfs-strong\">{{ totalToBuy() | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</td>\n <td></td>\n </tr>\n }\n </ng-template>\n <ng-template #emptymessage>\n <tr><td colspan=\"10\">La solicitud no tiene compras de cartera registradas.</td></tr>\n </ng-template>\n </p-table>\n </div>\n }\n</p-card>\n", styles: [".sfs-title{margin:0;font-size:1.125rem;font-weight:600}.sfs-subtitle{margin:0;font-size:1rem;font-weight:600}.sfs-muted{color:var(--p-text-muted-color)}.sfs-section-title{display:flex;align-items:center;gap:.5rem;margin:0 0 .75rem;font-size:1rem;font-weight:600}.sfs-section-title i{color:var(--primary-color, var(--p-primary-color))}.sfs-inline{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem}.sfs-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:.5rem;margin-bottom:.75rem}.sfs-break{overflow-wrap:anywhere}.sfs-nowrap{white-space:nowrap}.sfs-right{text-align:right}.sfs-strong{font-weight:600}.sfs-tag-gap{margin-left:.5rem}.sfs-stack{display:flex;flex-direction:column;gap:1rem}.sfs-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.sfs-summary{display:grid;grid-template-columns:minmax(8rem,max-content) 1fr;gap:.25rem 1rem;margin:0}.sfs-summary dt{color:var(--p-text-muted-color)}.sfs-summary dd{margin:0;text-align:right;font-variant-numeric:tabular-nums}@media (max-width: 575px){:host ::ng-deep .sfs-stack-table .p-datatable-table-container{overflow:visible!important}:host ::ng-deep .sfs-stack-table table,:host ::ng-deep .sfs-stack-table tbody{display:block;width:100%}:host ::ng-deep .sfs-stack-table thead{display:block!important;position:absolute!important;width:1px!important;height:1px!important;overflow:hidden!important;clip-path:inset(50%);white-space:nowrap}:host ::ng-deep .sfs-stack-table tbody tr{display:flex;flex-direction:column;margin-bottom:.5rem;padding:.5rem .75rem;border:1px solid var(--p-content-border-color);border-radius:var(--p-content-border-radius, 6px)}:host ::ng-deep .sfs-stack-table tbody td{display:flex;align-items:center;justify-content:flex-end;gap:.375rem;padding:.3rem 0;border:0;text-align:right}:host ::ng-deep .sfs-stack-table tbody td[data-label]:before{content:attr(data-label);margin-right:auto;padding-right:1rem;color:var(--p-text-muted-color);text-align:left}:host ::ng-deep .sfs-stack-table tbody td.sfs-stack-title{order:-1;display:block;font-weight:600;text-align:left}:host ::ng-deep .sfs-stack-table tfoot,:host ::ng-deep .sfs-stack-table .sfs-stack-hide{display:none}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: i1.CurrencyPipe, name: "currency" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i3.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: CardModule }, { kind: "component", type: i3$1.Card, selector: "p-card", inputs: ["header", "subheader", "style", "styleClass"] }, { kind: "ngmodule", type: CheckboxModule }, { kind: "component", type: i4$1.Checkbox, selector: "p-checkbox, p-checkBox, p-check-box", inputs: ["value", "name", "disabled", "binary", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "style", "inputStyle", "styleClass", "inputClass", "indeterminate", "size", "formControl", "checkboxIcon", "readonly", "required", "autofocus", "trueValue", "falseValue", "variant"], outputs: ["onChange", "onFocus", "onBlur"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i4.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant"], outputs: ["onClose"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i5.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "style", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "ngmodule", type: TableModule }, { kind: "component", type: i6.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorStyleClass", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showJumpToPageInput", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "selectionPageOnly", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowSelectable", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "scrollDirection", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "virtualScrollDelay", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "autoLayout", "exportFunction", "exportHeader", "stateKey", "stateStorage", "editMode", "groupRowsBy", "size", "showGridlines", "stripedRows", "groupRowsByOrder", "responsiveLayout", "breakpoint", "paginatorLocale", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "virtualRowHeight", "selectAll"], outputs: ["contextMenuSelectionChange", "selectAllChange", "selectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { kind: "ngmodule", type: TagModule }, { kind: "component", type: i7.Tag, selector: "p-tag", inputs: ["style", "styleClass", "severity", "value", "icon", "rounded"] }] });
1408
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: DebtBuyoutsComponent, isStandalone: true, selector: "lib-debt-buyouts", inputs: { loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, buyouts: { classPropertyName: "buyouts", publicName: "buyouts", isSignal: true, isRequired: false, transformFunction: null }, simulatedValue: { classPropertyName: "simulatedValue", publicName: "simulatedValue", isSignal: true, isRequired: false, transformFunction: null }, canEdit: { classPropertyName: "canEdit", publicName: "canEdit", isSignal: true, isRequired: false, transformFunction: null }, saving: { classPropertyName: "saving", publicName: "saving", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { retry: "retry", mark: "mark" }, ngImport: i0, template: "<p-card>\n <div class=\"sfs-head\">\n <h2 class=\"sfs-title\">Compras de cartera</h2>\n @if (!loading() && !failed() && rows().length) {\n <span class=\"sfs-muted\">\n {{ toBuy().length }} de {{ rows().length }} {{ rows().length === 1 ? 'obligaci\u00F3n' : 'obligaciones' }} para comprar\n @if (toBuy().length) { \u00B7 <strong>{{ totalToBuy() | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</strong> }\n </span>\n }\n </div>\n\n @if (loading()) {\n <div class=\"sfs-stack\" aria-busy=\"true\">\n <p-skeleton height=\"2.5rem\"></p-skeleton>\n <p-skeleton height=\"8rem\"></p-skeleton>\n </div>\n } @else if (failed()) {\n <p-message severity=\"error\">\n <div class=\"sfs-inline\">\n <span>No se pudieron leer las compras de cartera de la solicitud.</span>\n <p-button label=\"Reintentar\" icon=\"pi pi-refresh\" [text]=\"true\" (onClick)=\"retry.emit()\"></p-button>\n </div>\n </p-message>\n } @else {\n <div class=\"sfs-stack\" [attr.aria-busy]=\"saving() ? 'true' : null\">\n @if (canEdit() && rows().length) {\n <p class=\"sfs-muted\" style=\"margin: 0\">Al marcar \"Comprar\" el valor de compras de cartera del simulador pasa a ser la suma de los saldos marcados y la solicitud se vuelve a simular.</p>\n }\n @if (mismatch()) {\n <p-message severity=\"warn\">\n Las obligaciones marcadas para comprar suman {{ totalToBuy() | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }},\n pero la solicitud se simula con compras de cartera por {{ simulatedValue() | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}.\n </p-message>\n }\n\n <p-table [value]=\"rows()\" styleClass=\"p-datatable-sm sfs-stack-table\" [scrollable]=\"true\" dataKey=\"IdPrstmsCC\">\n <ng-template #header>\n <tr>\n <th>Comprar</th>\n <th>Desprendible</th>\n <th>Entidad</th>\n <th>Obligaci\u00F3n</th>\n <th>Origen</th>\n <th>Estado</th>\n <th>Vence</th>\n <th class=\"sfs-right\">Cuota</th>\n <th class=\"sfs-right\">Saldo</th>\n <th class=\"sfs-right\">Mora</th>\n </tr>\n </ng-template>\n <ng-template #body let-row>\n <tr>\n <td data-label=\"Comprar\">\n @if (canEdit()) {\n <p-checkbox [binary]=\"true\" [ngModel]=\"row.Comprar\" [disabled]=\"saving()\"\n [ariaLabel]=\"'Comprar ' + rowName(row)\" (onChange)=\"markBuy(row, $event.checked)\"></p-checkbox>\n } @else {\n <p-tag [value]=\"row.Comprar ? 'Comprar' : 'No comprar'\" [severity]=\"row.Comprar ? 'success' : 'secondary'\"></p-tag>\n }\n </td>\n <td data-label=\"Desprendible\">\n @if (canEdit()) {\n <p-checkbox [binary]=\"true\" [ngModel]=\"row.Desprendible\" [disabled]=\"saving()\"\n [ariaLabel]=\"rowName(row) + ' aparece en el desprendible'\" (onChange)=\"markPayslip(row, $event.checked)\"></p-checkbox>\n } @else {\n {{ row.Desprendible ? 'S\u00ED' : 'No' }}\n }\n </td>\n <td class=\"sfs-stack-title\">\n {{ row.Entidad || '\u2014' }}\n @if (row.NitEntidad) { <br /><small class=\"sfs-muted\">NIT {{ row.NitEntidad }}</small> }\n </td>\n <td data-label=\"Obligaci\u00F3n\">{{ row.NumeroObligacion || '\u2014' }}</td>\n <td data-label=\"Origen\">\n {{ row.Buro || '\u2014' }}\n @if (row.Sector) { <br /><small class=\"sfs-muted\">{{ row.Sector }}</small> }\n </td>\n <td data-label=\"Estado\">{{ row.EstadoObligacion || '\u2014' }}</td>\n <td class=\"sfs-nowrap\" data-label=\"Vence\">{{ row.FechaVencimiento || '\u2014' }}</td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Cuota\">{{ row.ValorCuota | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Saldo\">{{ row.SaldoActual | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Mora\">{{ row.SaldoMora | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</td>\n </tr>\n </ng-template>\n <ng-template #footer>\n @if (rows().length) {\n <tr class=\"sfs-stack-hide\">\n <td colspan=\"7\" class=\"sfs-strong\">Total para comprar</td>\n <td class=\"sfs-right sfs-nowrap sfs-strong\">{{ installmentsToBuy() | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</td>\n <td class=\"sfs-right sfs-nowrap sfs-strong\">{{ totalToBuy() | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</td>\n <td></td>\n </tr>\n }\n </ng-template>\n <ng-template #emptymessage>\n <tr><td colspan=\"10\">La solicitud no tiene compras de cartera registradas.</td></tr>\n </ng-template>\n </p-table>\n </div>\n }\n</p-card>\n", styles: [".sfs-title{margin:0;font-size:1.125rem;font-weight:600}.sfs-subtitle{margin:0;font-size:1rem;font-weight:600}.sfs-muted{color:var(--p-text-muted-color)}.sfs-section-title{display:flex;align-items:center;gap:.5rem;margin:0 0 .75rem;font-size:1rem;font-weight:600}.sfs-section-title i{color:var(--primary-color, var(--p-primary-color))}.sfs-inline{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem}.sfs-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:.5rem;margin-bottom:.75rem}.sfs-break{overflow-wrap:anywhere}.sfs-nowrap{white-space:nowrap}.sfs-right{text-align:right}.sfs-strong{font-weight:600}.sfs-tag-gap{margin-left:.5rem}.sfs-stack{display:flex;flex-direction:column;gap:1rem}.sfs-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.sfs-summary{display:grid;grid-template-columns:minmax(8rem,max-content) 1fr;gap:.25rem 1rem;margin:0}.sfs-summary dt{color:var(--p-text-muted-color)}.sfs-summary dd{margin:0;text-align:right;font-variant-numeric:tabular-nums}@media (max-width: 575px){:host ::ng-deep .sfs-stack-table .p-datatable-table-container{overflow:visible!important}:host ::ng-deep .sfs-stack-table table,:host ::ng-deep .sfs-stack-table tbody{display:block;width:100%}:host ::ng-deep .sfs-stack-table thead{display:block!important;position:absolute!important;width:1px!important;height:1px!important;overflow:hidden!important;clip-path:inset(50%);white-space:nowrap}:host ::ng-deep .sfs-stack-table tbody tr{display:flex;flex-direction:column;margin-bottom:.5rem;padding:.5rem .75rem;border:1px solid var(--p-content-border-color);border-radius:var(--p-content-border-radius, 6px)}:host ::ng-deep .sfs-stack-table tbody td{display:flex;align-items:center;justify-content:flex-end;gap:.375rem;padding:.3rem 0;border:0;text-align:right}:host ::ng-deep .sfs-stack-table tbody td[data-label]:before{content:attr(data-label);margin-right:auto;padding-right:1rem;color:var(--p-text-muted-color);text-align:left}:host ::ng-deep .sfs-stack-table tbody td.sfs-stack-title{order:-1;display:block;font-weight:600;text-align:left}:host ::ng-deep .sfs-stack-table tfoot,:host ::ng-deep .sfs-stack-table .sfs-stack-hide{display:none}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: i1$1.CurrencyPipe, name: "currency" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i2.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: CardModule }, { kind: "component", type: i3$1.Card, selector: "p-card", inputs: ["header", "subheader", "style", "styleClass"] }, { kind: "ngmodule", type: CheckboxModule }, { kind: "component", type: i3.Checkbox, selector: "p-checkbox, p-checkBox, p-check-box", inputs: ["value", "name", "disabled", "binary", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "style", "inputStyle", "styleClass", "inputClass", "indeterminate", "size", "formControl", "checkboxIcon", "readonly", "required", "autofocus", "trueValue", "falseValue", "variant"], outputs: ["onChange", "onFocus", "onBlur"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i7.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant"], outputs: ["onClose"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i5$1.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "style", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "ngmodule", type: TableModule }, { kind: "component", type: i6$1.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorStyleClass", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showJumpToPageInput", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "selectionPageOnly", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowSelectable", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "scrollDirection", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "virtualScrollDelay", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "autoLayout", "exportFunction", "exportHeader", "stateKey", "stateStorage", "editMode", "groupRowsBy", "size", "showGridlines", "stripedRows", "groupRowsByOrder", "responsiveLayout", "breakpoint", "paginatorLocale", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "virtualRowHeight", "selectAll"], outputs: ["contextMenuSelectionChange", "selectAllChange", "selectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { kind: "ngmodule", type: TagModule }, { kind: "component", type: i7$1.Tag, selector: "p-tag", inputs: ["style", "styleClass", "severity", "value", "icon", "rounded"] }] });
722
1409
  }
723
1410
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: DebtBuyoutsComponent, decorators: [{
724
1411
  type: Component,
@@ -733,5 +1420,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
733
1420
  * Generated bundle index. Do not edit.
734
1421
  */
735
1422
 
736
- export { APPLICATION_PERSON_SERVICE, ApplicationPersonComponent, DebtBuyoutsComponent, LineSimulatorComponent };
1423
+ export { APPLICATION_PERSON_SERVICE, ApplicationPersonComponent, DebtBuyoutsComponent, LineSimulatorComponent, PersonEditDialogComponent };
737
1424
  //# sourceMappingURL=sfinges-sf-solicitud.mjs.map