@sfinges/sf-solicitud 0.3.0 → 0.4.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,11 +1,11 @@
1
1
  import * as i0 from '@angular/core';
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';
2
+ import { InjectionToken, inject, DestroyRef, Injector, input, output, signal, computed, afterNextRender, Component, effect, untracked, ElementRef } from '@angular/core';
3
+ import * as i1 from '@angular/common';
4
4
  import { registerLocaleData, CommonModule } from '@angular/common';
5
5
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
6
- import * as i2 from 'primeng/button';
6
+ import * as i3 from 'primeng/button';
7
7
  import { ButtonModule } from 'primeng/button';
8
- import * as i3$1 from 'primeng/card';
8
+ import * as i3$2 from 'primeng/card';
9
9
  import { CardModule } from 'primeng/card';
10
10
  import * as i7 from 'primeng/message';
11
11
  import { MessageModule } from 'primeng/message';
@@ -17,9 +17,9 @@ import * as i7$1 from 'primeng/tag';
17
17
  import { TagModule } from 'primeng/tag';
18
18
  import * as i8$1 from 'primeng/tooltip';
19
19
  import { TooltipModule } from 'primeng/tooltip';
20
- import * as i1 from '@angular/forms';
20
+ import * as i2 from '@angular/forms';
21
21
  import { FormGroup, FormControl, Validators, ReactiveFormsModule, FormsModule } from '@angular/forms';
22
- import * as i3 from 'primeng/checkbox';
22
+ import * as i3$1 from 'primeng/checkbox';
23
23
  import { CheckboxModule } from 'primeng/checkbox';
24
24
  import * as i4 from 'primeng/datepicker';
25
25
  import { DatePickerModule } from 'primeng/datepicker';
@@ -32,6 +32,11 @@ import { SelectModule } from 'primeng/select';
32
32
  import localeEsCO from '@angular/common/locales/es-CO';
33
33
  import * as i6$2 from 'primeng/inputnumber';
34
34
  import { InputNumberModule } from 'primeng/inputnumber';
35
+ import { DomSanitizer } from '@angular/platform-browser';
36
+ import * as i11 from 'primeng/tabs';
37
+ import { TabsModule } from 'primeng/tabs';
38
+ import * as i13 from 'primeng/textarea';
39
+ import { TextareaModule } from 'primeng/textarea';
35
40
 
36
41
  /**
37
42
  * Modelos de una solicitud de crédito como los pintan los componentes de sf-solicitud. Los hosts los arman con lo que
@@ -93,7 +98,7 @@ function contactValue(type) {
93
98
  function text(value) {
94
99
  return value == null ? '' : String(value).trim();
95
100
  }
96
- let nextId$2 = 0;
101
+ let nextId$3 = 0;
97
102
  /**
98
103
  * El diálogo de edición de `lib-application-person`. Arma el formulario de lo que se edita, valida en cada campo y
99
104
  * guarda por el puerto. No se cierra mientras guarda. Al terminar emite `saved` con `saved` o `uncertain`: en los dos
@@ -116,7 +121,7 @@ class PersonEditDialogComponent {
116
121
  closed = output();
117
122
  /** Volver a pedir las listas que fallaron. */
118
123
  retryOptions = output();
119
- id = `sfs-edit-${++nextId$2}`;
124
+ id = `sfs-edit-${++nextId$3}`;
120
125
  visible = signal(true);
121
126
  saving = signal(false);
122
127
  /** Por qué no se guardó (un 4xx), para mostrarlo arriba de los botones. */
@@ -457,7 +462,7 @@ class PersonEditDialogComponent {
457
462
  afterNextRender(() => document.getElementById(elementId)?.focus(), { injector: this.injector });
458
463
  }
459
464
  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"] }] });
465
+ 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: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "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: CheckboxModule }, { kind: "component", type: i3$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: 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
466
  }
462
467
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: PersonEditDialogComponent, decorators: [{
463
468
  type: Component,
@@ -542,7 +547,7 @@ const IDENTITY = {
542
547
  rejected: { label: 'Identidad rechazada', short: 'Rechazada', severity: 'danger', icon: 'pi pi-times-circle' },
543
548
  none: { label: 'Identidad sin validar', short: 'Sin validar', severity: 'secondary', icon: 'pi pi-question-circle' }
544
549
  };
545
- let nextId$1 = 0;
550
+ let nextId$2 = 0;
546
551
  /**
547
552
  * Titular de la solicitud: arriba lo básico (lo que trae la solicitud) y, al expandir, la persona completa, sus
548
553
  * cuentas y las demás personas. La persona y las cuentas se piden por el puerto `APPLICATION_PERSON_SERVICE` solo al
@@ -565,7 +570,7 @@ class ApplicationPersonComponent {
565
570
  */
566
571
  personUpdated = output();
567
572
  locale = LOCALE;
568
- ids = { more: `sfs-person-more-${++nextId$1}`, prefix: `sfs-person-${nextId$1}` };
573
+ ids = { more: `sfs-person-more-${++nextId$2}`, prefix: `sfs-person-${nextId$2}` };
569
574
  hasAccounts = typeof this.gateway.getAccounts === 'function';
570
575
  holder = computed(() => {
571
576
  const parties = this.parties() ?? [];
@@ -787,7 +792,7 @@ class ApplicationPersonComponent {
787
792
  return holder ? `${holder.documentType ?? ''}|${holder.documentNumber}` : null;
788
793
  }
789
794
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: ApplicationPersonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
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"] }] });
795
+ 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.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$2.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"] }] });
791
796
  }
792
797
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: ApplicationPersonComponent, decorators: [{
793
798
  type: Component,
@@ -803,7 +808,7 @@ const CAPACITY_FIELDS = [
803
808
  { key: 'otherDeductions', label: 'Otros descuentos' },
804
809
  { key: 'purchasesValue', label: 'Compras de cartera' }
805
810
  ];
806
- let nextId = 0;
811
+ let nextId$1 = 0;
807
812
  /**
808
813
  * Simulador comercial por línea de una solicitud. Solo pinta: el host simula y guarda con su API cuando el componente
809
814
  * se lo pide (`simulate`, `save`, `retry`) y le devuelve el resultado por `simulation`, `state` y `saving`.
@@ -854,7 +859,7 @@ class LineSimulatorComponent {
854
859
  locale = LOCALE;
855
860
  capacityFields = CAPACITY_FIELDS;
856
861
  ids = (() => {
857
- const n = ++nextId;
862
+ const n = ++nextId$1;
858
863
  return {
859
864
  line: `sfs-sim-line-${n}`,
860
865
  lineLabel: `sfs-sim-line-label-${n}`,
@@ -1326,7 +1331,7 @@ class LineSimulatorComponent {
1326
1331
  return type === 'ADMIN' ? 'Crédito' : 'Cuota';
1327
1332
  }
1328
1333
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: LineSimulatorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
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"] }] });
1334
+ 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 <!-- Resultado: a la izquierda lo guardado frente a lo simulado; a la derecha, en columna, lo que se gira. Los\n cargos se despliegan desde \"Descuentos del cr\u00E9dito\", que es lo que suman. -->\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 <div class=\"sfs-result\">\n <div class=\"sfs-result__table\">\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 </div>\n @if (summary(); as sm) {\n <dl class=\"sfs-summary\" [attr.aria-label]=\"'Giro de la l\u00EDnea'\">\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>\n <dt>\n <!-- pButton y no p-button: el componente no deja poner aria-expanded en su <button>.\n Sin aria-label: el texto visible es el nombre (con cu\u00E1ntos cargos cambiaron) y\n aria-expanded dice si los cargos est\u00E1n abiertos. -->\n <button pButton type=\"button\" class=\"sfs-link-button\" [text]=\"true\" size=\"small\"\n [label]=\"'Descuentos del cr\u00E9dito' + (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 </dt>\n <dd>{{ sm.creditDiscounts | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd>\n </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: en rojo (color de error del tema) si es negativo, con icono y texto; si no, en el color del texto. -->\n <div class=\"sfs-net\" [class.sfs-net--negative]=\"sm.net < 0\">\n <dt>Neto a girar</dt>\n <dd>\n @if (sm.net < 0) { <i class=\"pi pi-exclamation-triangle\" 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 </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 @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-result{display:grid;grid-template-columns:minmax(0,1fr);gap:1rem;align-items:start}@media (min-width: 992px){.sfs-result{grid-template-columns:minmax(0,3fr) minmax(14rem,2fr)}}.sfs-result+.sfs-charges{margin-top:1rem}.sfs-summary{display:flex;flex-direction:column;gap:.375rem;margin:0;padding:.75rem;border:1px solid var(--p-content-border-color);border-radius:var(--p-content-border-radius, 6px)}.sfs-summary>div{display:flex;align-items:center;justify-content:space-between;gap:.75rem}.sfs-summary dt{font-size:.875rem;color:var(--p-text-muted-color)}.sfs-summary dd{margin:0;text-align:right;white-space:nowrap}:host ::ng-deep .sfs-link-button.p-button{padding:0;font-size:.875rem}.sfs-net{flex-wrap:wrap;margin-top:.25rem;padding-top:.5rem;border-top:1px solid var(--p-content-border-color)}.sfs-net dt{color:var(--p-text-color);font-weight:600}.sfs-net dd{font-size:1.25rem;font-weight:700;color:var(--p-text-color)}.sfs-net--negative dt,.sfs-net--negative dd{color:var(--p-message-error-color)}.sfs-net__note{display:block;font-size:.8125rem;font-weight:400;white-space:normal}\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: i3$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.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"] }] });
1330
1335
  }
1331
1336
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: LineSimulatorComponent, decorators: [{
1332
1337
  type: Component,
@@ -1343,7 +1348,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
1343
1348
  TableModule,
1344
1349
  TagModule,
1345
1350
  TooltipModule
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"] }]
1351
+ ], 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 <!-- Resultado: a la izquierda lo guardado frente a lo simulado; a la derecha, en columna, lo que se gira. Los\n cargos se despliegan desde \"Descuentos del cr\u00E9dito\", que es lo que suman. -->\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 <div class=\"sfs-result\">\n <div class=\"sfs-result__table\">\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 </div>\n @if (summary(); as sm) {\n <dl class=\"sfs-summary\" [attr.aria-label]=\"'Giro de la l\u00EDnea'\">\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>\n <dt>\n <!-- pButton y no p-button: el componente no deja poner aria-expanded en su <button>.\n Sin aria-label: el texto visible es el nombre (con cu\u00E1ntos cargos cambiaron) y\n aria-expanded dice si los cargos est\u00E1n abiertos. -->\n <button pButton type=\"button\" class=\"sfs-link-button\" [text]=\"true\" size=\"small\"\n [label]=\"'Descuentos del cr\u00E9dito' + (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 </dt>\n <dd>{{ sm.creditDiscounts | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd>\n </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: en rojo (color de error del tema) si es negativo, con icono y texto; si no, en el color del texto. -->\n <div class=\"sfs-net\" [class.sfs-net--negative]=\"sm.net < 0\">\n <dt>Neto a girar</dt>\n <dd>\n @if (sm.net < 0) { <i class=\"pi pi-exclamation-triangle\" 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 </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 @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-result{display:grid;grid-template-columns:minmax(0,1fr);gap:1rem;align-items:start}@media (min-width: 992px){.sfs-result{grid-template-columns:minmax(0,3fr) minmax(14rem,2fr)}}.sfs-result+.sfs-charges{margin-top:1rem}.sfs-summary{display:flex;flex-direction:column;gap:.375rem;margin:0;padding:.75rem;border:1px solid var(--p-content-border-color);border-radius:var(--p-content-border-radius, 6px)}.sfs-summary>div{display:flex;align-items:center;justify-content:space-between;gap:.75rem}.sfs-summary dt{font-size:.875rem;color:var(--p-text-muted-color)}.sfs-summary dd{margin:0;text-align:right;white-space:nowrap}:host ::ng-deep .sfs-link-button.p-button{padding:0;font-size:.875rem}.sfs-net{flex-wrap:wrap;margin-top:.25rem;padding-top:.5rem;border-top:1px solid var(--p-content-border-color)}.sfs-net dt{color:var(--p-text-color);font-weight:600}.sfs-net dd{font-size:1.25rem;font-weight:700;color:var(--p-text-color)}.sfs-net--negative dt,.sfs-net--negative dd{color:var(--p-message-error-color)}.sfs-net__note{display:block;font-size:.8125rem;font-weight:400;white-space:normal}\n"] }]
1347
1352
  }], ctorParameters: () => [] });
1348
1353
  /** Una tasa con coma decimal y hasta 4 decimales, como se lee en es-CO. */
1349
1354
  function formatRate(rate) {
@@ -1357,11 +1362,18 @@ function sameCapacity(a, b) {
1357
1362
  return a.age === b.age && a.hasGarnishment === b.hasGarnishment && CAPACITY_FIELDS.every((f) => a[f.key] === b[f.key]);
1358
1363
  }
1359
1364
 
1365
+ /** Largo de las columnas de PRSTMSCC: lo que pase de ahí el backend lo rechaza. */
1366
+ const DEBT_BUYOUT_LIMITS = { entity: 300, entityId: 20, obligationNumber: 30, observations: 100 };
1367
+ let nextId = 0;
1360
1368
  /**
1361
- * Compras de cartera de la solicitud (buró, digitadas y retanqueos). Las totaliza y avisa si lo marcado para comprar no
1362
- * cuadra con el valor con que se simula. Con `canEdit`, cada una tiene los checks "Comprar" y "Desprendible" (como en
1363
- * WE9TF): un clic emite `mark` y el host guarda; mientras guarda (`saving`) los checks no se pueden tocar. El check
1364
- * muestra lo que llega en `buyouts`: si el host no lo guarda, vuelve a pasar la lista y el check vuelve a su valor.
1369
+ * Compras de cartera de la solicitud (buró, digitadas y retanqueos), como en el detalle de obligación de WE9TF: una
1370
+ * tarjeta por obligación (compra o saneamiento, girada o por girar, con o sin certificado) y, al abrir una, sus datos
1371
+ * para corregirlos y sus documentos al lado (certificado de deuda y desprendibles del titular). Con `canEdit` también se
1372
+ * agregan compras nuevas.
1373
+ *
1374
+ * La librería no guarda: emite `save` y el host guarda y llama `done`. Mientras el host guarda (`saving`), nada se
1375
+ * puede tocar. Una compra ya girada solo deja cambiar sus observaciones. Los documentos los pide al puerto
1376
+ * `APPLICATION_PERSON_SERVICE` (`getDebtBuyoutDocuments`), solo al abrir una compra.
1365
1377
  */
1366
1378
  class DebtBuyoutsComponent {
1367
1379
  /** El host todavía las está leyendo. Mientras tanto `buyouts` no se mira. */
@@ -1370,47 +1382,510 @@ class DebtBuyoutsComponent {
1370
1382
  buyouts = input(null);
1371
1383
  /** Valor de compras de cartera con que se simula. */
1372
1384
  simulatedValue = input(0);
1373
- /** La persona puede marcar qué se compra y qué está en el desprendible. */
1385
+ /** La persona puede corregir y agregar compras. */
1374
1386
  canEdit = input(false);
1375
- /** El host está guardando una marca: los checks esperan. */
1387
+ /**
1388
+ * Sin `canEdit`, deja cambiar solo las observaciones (por ejemplo, la solicitud ya tiene crédito: las notas no cambian
1389
+ * lo que se simula ni lo que se gira). No deja agregar compras.
1390
+ */
1391
+ canEditObservations = input(false);
1392
+ /** Por qué no se puede editar (por ejemplo, la solicitud ya tiene crédito). Se muestra en el detalle sin `canEdit`. */
1393
+ readonlyReason = input(null);
1394
+ /** El host está guardando algo de la solicitud: el formulario espera. */
1376
1395
  saving = input(false);
1396
+ /** Número de la solicitud: con él se piden los documentos de una compra. Sin él no se muestran. */
1397
+ applicationId = input(null);
1377
1398
  /** Pide al host volver a leer las compras. */
1378
1399
  retry = output();
1379
- /** La persona marcó o desmarcó un check de una compra. */
1380
- mark = output();
1400
+ /** La persona guardó una compra (nueva con `id` 0). El host guarda, pasa la lista nueva y llama `done`. */
1401
+ save = output();
1402
+ /**
1403
+ * Si hay algo escrito sin guardar en el detalle abierto. Cambia cada vez que eso cambia: el host lo suma a su aviso
1404
+ * de salir de la pantalla (las rutas y el cierre de la pestaña no pasan por esta tarjeta). Si el host quita la
1405
+ * tarjeta de la pantalla, vuelve a false por su cuenta: un output no se emite al destruirse.
1406
+ */
1407
+ dirtyChange = output();
1408
+ gateway = inject(APPLICATION_PERSON_SERVICE, { optional: true });
1409
+ sanitizer = inject(DomSanitizer);
1410
+ host = inject(ElementRef);
1411
+ injector = inject(Injector);
1381
1412
  locale = LOCALE;
1413
+ limits = DEBT_BUYOUT_LIMITS;
1414
+ id = `sfs-cc-${++nextId}`;
1382
1415
  rows = computed(() => (this.buyouts() ?? []).map((row) => ({ ...row, FechaVencimiento: toIsoDate(row.FechaVencimiento) })));
1383
1416
  failed = computed(() => !Array.isArray(this.buyouts()));
1384
1417
  toBuy = computed(() => this.rows().filter((row) => row.Comprar));
1385
1418
  totalToBuy = computed(() => this.toBuy().reduce((sum, row) => sum + (Number(row.SaldoActual) || 0), 0));
1386
- installmentsToBuy = computed(() => this.toBuy().reduce((sum, row) => sum + (Number(row.ValorCuota) || 0), 0));
1387
1419
  /**
1388
1420
  * Lo marcado para comprar no es lo que se simula (diferencia de al menos un peso), incluido el caso de no tener
1389
1421
  * nada marcado y simular con compras.
1390
1422
  */
1391
1423
  mismatch = computed(() => this.rows().length > 0 && Math.abs(this.totalToBuy() - (this.simulatedValue() || 0)) >= 1);
1424
+ /** La compra abierta: su `IdPrstmsCC`, 0 si es una nueva, null si no hay ninguna abierta. */
1425
+ selectedId = signal(null);
1426
+ creating = computed(() => this.selectedId() === 0);
1427
+ selected = computed(() => {
1428
+ const id = this.selectedId();
1429
+ return id ? (this.rows().find((row) => row.IdPrstmsCC === id) ?? null) : null;
1430
+ });
1431
+ /** Ya girada, o solo se permiten notas: los datos son de solo lectura y solo se cambian las observaciones. */
1432
+ locked = computed(() => !!this.selected()?.Girado || (!this.canEdit() && this.canEditObservations()));
1433
+ /** Se puede guardar algo de la compra abierta: todo, o al menos las observaciones. */
1434
+ canSave = computed(() => this.canEdit() || (this.canEditObservations() && !this.creating()));
1435
+ draft = signal(emptyDraft());
1436
+ /** Se intentó guardar: desde ahí los errores de los campos se muestran. */
1437
+ submitted = signal(false);
1438
+ /** Esta pantalla mandó a guardar y espera la respuesta del host. */
1439
+ pending = signal(false);
1440
+ /**
1441
+ * Un guardado que terminó y espera la lista nueva del host: la lista que había al guardar (para reconocer la nueva
1442
+ * aunque el host la pase después de `done`), en un alta los ids que ya existían, y el detalle que lo mandó.
1443
+ */
1444
+ awaiting = signal(null);
1445
+ /**
1446
+ * Mientras llega la lista nueva el formulario sigue esperando: si no, entre `done` y la lista se podría repetir el
1447
+ * guardado (y un alta repetida crea la compra dos veces).
1448
+ */
1449
+ busy = computed(() => this.saving() || this.pending() || this.awaiting() !== null);
1450
+ /** Hay algo escrito sin guardar en el detalle abierto. */
1451
+ dirty = computed(() => {
1452
+ if (this.selectedId() === null || !this.canSave())
1453
+ return false;
1454
+ return this.creating() ? JSON.stringify(this.draft()) !== JSON.stringify(emptyDraft()) : this.change() !== null;
1455
+ });
1456
+ /** Lo que la persona quiso hacer (cerrar, abrir otra compra) con cambios sin guardar: espera a que confirme descartarlos. */
1457
+ leaving = signal(null);
1458
+ canShowDocuments = computed(() => !!this.gateway?.getDebtBuyoutDocuments && !!this.applicationId());
1459
+ documents = signal({ status: 'idle' });
1460
+ documentsTab = signal('certificates');
1461
+ readyDocuments = computed(() => {
1462
+ const state = this.documents();
1463
+ return state.status === 'ready' ? state.documents : null;
1464
+ });
1465
+ openDocument = signal(null);
1466
+ viewerUrl = computed(() => {
1467
+ const url = this.openDocument()?.url;
1468
+ // Solo https: la URL la arma el host, pero un iframe con javascript:, data: o http no debe salir nunca.
1469
+ return url && isHttps(url) ? this.sanitizer.bypassSecurityTrustResourceUrl(url) : null;
1470
+ });
1471
+ /** Errores por campo; se muestran después de intentar guardar. */
1472
+ errors = computed(() => {
1473
+ const draft = this.draft();
1474
+ const row = this.selected();
1475
+ const errors = {};
1476
+ // En una nueva son obligatorios; en una existente no se pueden vaciar si ya tenían valor.
1477
+ if (!draft.entity.trim() && (this.creating() || !!row?.Entidad?.trim()))
1478
+ errors.entity = 'Escriba el nombre de la entidad.';
1479
+ if (!draft.obligationNumber.trim() && (this.creating() || !!row?.NumeroObligacion?.trim()))
1480
+ errors.obligationNumber = 'Escriba el número de la obligación.';
1481
+ // El contrato no borra la fecha (lo que no llega no se toca): si la compra tenía una, no se puede dejar vacía.
1482
+ if (!this.creating() && !this.locked() && !draft.dueDate && !!row?.FechaVencimiento && !!toDate(row.FechaVencimiento))
1483
+ errors.dueDate = 'Elija la fecha de vencimiento: no se puede dejar vacía.';
1484
+ if (draft.observations.trim().length > DEBT_BUYOUT_LIMITS.observations)
1485
+ errors.observations = `Las observaciones no pueden pasar de ${DEBT_BUYOUT_LIMITS.observations} caracteres.`;
1486
+ return errors;
1487
+ });
1488
+ /** Lo que cambió frente a la compra abierta (en una nueva, todo lo escrito). Null si no cambió nada. */
1489
+ change = computed(() => {
1490
+ if (this.selectedId() === null)
1491
+ return null;
1492
+ const draft = this.draft();
1493
+ const row = this.selected();
1494
+ const observations = draft.observations.trim();
1495
+ if (!row) {
1496
+ const created = {
1497
+ id: 0,
1498
+ buy: draft.buy,
1499
+ payslip: draft.payslip,
1500
+ entity: draft.entity.trim(),
1501
+ obligationNumber: draft.obligationNumber.trim()
1502
+ };
1503
+ if (draft.entityId.trim())
1504
+ created.entityId = draft.entityId.trim();
1505
+ if (draft.installment !== null)
1506
+ created.installment = draft.installment;
1507
+ if (draft.balance !== null)
1508
+ created.balance = draft.balance;
1509
+ if (draft.arrears !== null)
1510
+ created.arrears = draft.arrears;
1511
+ if (draft.dueDate)
1512
+ created.dueDate = fromDate(draft.dueDate);
1513
+ if (observations)
1514
+ created.observations = observations;
1515
+ return created;
1516
+ }
1517
+ const original = toDraft(row);
1518
+ const change = { id: row.IdPrstmsCC };
1519
+ if (observations !== original.observations)
1520
+ change.observations = observations;
1521
+ if (!this.locked()) {
1522
+ if (draft.buy !== original.buy)
1523
+ change.buy = draft.buy;
1524
+ if (draft.payslip !== original.payslip)
1525
+ change.payslip = draft.payslip;
1526
+ if (draft.entity.trim() !== original.entity)
1527
+ change.entity = draft.entity.trim();
1528
+ if (draft.entityId.trim() !== original.entityId)
1529
+ change.entityId = draft.entityId.trim();
1530
+ if (draft.obligationNumber.trim() !== original.obligationNumber)
1531
+ change.obligationNumber = draft.obligationNumber.trim();
1532
+ // Un valor que se deja vacío es 0, como se muestra una compra que no lo tiene.
1533
+ const installment = draft.installment ?? 0;
1534
+ const balance = draft.balance ?? 0;
1535
+ const arrears = draft.arrears ?? 0;
1536
+ if (installment !== original.installment)
1537
+ change.installment = installment;
1538
+ if (balance !== original.balance)
1539
+ change.balance = balance;
1540
+ if (arrears !== original.arrears)
1541
+ change.arrears = arrears;
1542
+ const dueDate = draft.dueDate ? fromDate(draft.dueDate) : null;
1543
+ if (dueDate && dueDate !== row.FechaVencimiento)
1544
+ change.dueDate = dueDate;
1545
+ }
1546
+ return Object.keys(change).length > 1 ? change : null;
1547
+ });
1548
+ /** Cambia cada vez que se abre o se cierra un detalle: una respuesta de guardado solo toca el detalle que la pidió. */
1549
+ session = 0;
1550
+ documentsSubscription;
1392
1551
  constructor() {
1393
1552
  ensureLocale();
1553
+ inject(DestroyRef).onDestroy(() => this.documentsSubscription?.unsubscribe());
1554
+ // Cuando el host pasa la lista nueva: abrir la compra recién creada, recargar lo guardado o cerrar una que ya no está.
1555
+ effect(() => {
1556
+ this.rows();
1557
+ untracked(() => this.sync());
1558
+ });
1559
+ // p-datepicker no deja pasar aria-invalid ni aria-describedby a su campo: se ponen a mano cuando cambia el error.
1560
+ effect(() => {
1561
+ const invalid = !!this.showError('dueDate');
1562
+ if (this.selectedId() === null)
1563
+ return;
1564
+ afterNextRender(() => {
1565
+ const field = this.host.nativeElement.querySelector(`#${CSS.escape(`${this.id}-dueDate`)}`);
1566
+ if (!field)
1567
+ return;
1568
+ if (invalid) {
1569
+ field.setAttribute('aria-invalid', 'true');
1570
+ field.setAttribute('aria-describedby', `${this.id}-dueDate-err`);
1571
+ }
1572
+ else {
1573
+ field.removeAttribute('aria-invalid');
1574
+ field.removeAttribute('aria-describedby');
1575
+ }
1576
+ }, { injector: this.injector });
1577
+ });
1578
+ // Solo cuando cambia: el host no recibe un false repetido al abrir otra compra sin escribir nada.
1579
+ let lastDirty = false;
1580
+ effect(() => {
1581
+ const dirty = this.dirty();
1582
+ if (dirty === lastDirty)
1583
+ return;
1584
+ lastDirty = dirty;
1585
+ untracked(() => this.dirtyChange.emit(dirty));
1586
+ });
1587
+ }
1588
+ /** Abre una compra: su formulario y sus documentos. Pulsar la que está abierta la cierra. */
1589
+ toggle(row) {
1590
+ if (this.selectedId() === row.IdPrstmsCC)
1591
+ this.leave(() => this.close());
1592
+ else
1593
+ this.leave(() => this.open(row, true));
1594
+ }
1595
+ startCreate() {
1596
+ if (!this.canEdit() || this.busy())
1597
+ return;
1598
+ this.leave(() => this.create());
1599
+ }
1600
+ /** El botón de cerrar el detalle. */
1601
+ requestClose() {
1602
+ this.leave(() => this.close());
1603
+ }
1604
+ /** La persona confirmó descartar lo escrito: se hace lo que había pedido. */
1605
+ confirmLeave() {
1606
+ const action = this.leaving();
1607
+ this.leaving.set(null);
1608
+ action?.();
1609
+ }
1610
+ /** Se arrepintió: sigue editando, con el foco de vuelta en el formulario. */
1611
+ cancelLeave() {
1612
+ this.leaving.set(null);
1613
+ this.focusAfterRender(`${this.id}-detail-title`);
1614
+ }
1615
+ /**
1616
+ * Hace `action`, o pide confirmar antes si se perdería algo escrito. Lo que esta pantalla ya mandó a guardar no se
1617
+ * pierde; si el host guarda otra cosa de la solicitud (`saving`), lo escrito aquí sigue sin guardar y se pregunta.
1618
+ */
1619
+ leave(action) {
1620
+ if (!this.dirty() || this.pending() || this.awaiting() !== null) {
1621
+ action();
1622
+ return;
1623
+ }
1624
+ this.leaving.set(action);
1625
+ this.focusAfterRender(`${this.id}-leave-stay`);
1626
+ }
1627
+ create() {
1628
+ this.moved();
1629
+ this.selectedId.set(0);
1630
+ this.draft.set(emptyDraft());
1631
+ this.submitted.set(false);
1632
+ this.loadDocuments(null);
1633
+ this.focusAfterRender(`${this.id}-entity`);
1634
+ }
1635
+ /** Cierra el detalle y devuelve el foco a lo que lo abrió (la tarjeta o "Agregar compra"). */
1636
+ close(focus = true) {
1637
+ const id = this.selectedId();
1638
+ this.moved();
1639
+ this.selectedId.set(null);
1640
+ this.submitted.set(false);
1641
+ this.loadDocuments(null);
1642
+ if (focus && id !== null)
1643
+ this.focusAfterRender(id === 0 ? `${this.id}-add` : this.cardId(id));
1644
+ }
1645
+ patch(changes) {
1646
+ this.draft.update((draft) => ({ ...draft, ...changes }));
1647
+ }
1648
+ showError(field) {
1649
+ return this.submitted() ? (this.errors()[field] ?? null) : null;
1650
+ }
1651
+ submit() {
1652
+ if (!this.canSave() || this.busy())
1653
+ return;
1654
+ this.leaving.set(null);
1655
+ this.submitted.set(true);
1656
+ const errors = this.errors();
1657
+ const firstInvalid = ['entity', 'obligationNumber', 'dueDate', 'observations'].find((field) => errors[field]);
1658
+ if (firstInvalid) {
1659
+ this.focusAfterRender(`${this.id}-${firstInvalid}`);
1660
+ return;
1661
+ }
1662
+ const change = this.change();
1663
+ if (!change)
1664
+ return;
1665
+ const list = this.buyouts();
1666
+ const creating = change.id === 0;
1667
+ const idsBefore = creating ? new Set(this.rows().map((row) => row.IdPrstmsCC)) : null;
1668
+ const session = this.session;
1669
+ let answered = false;
1670
+ this.pending.set(true);
1671
+ this.save.emit({
1672
+ change,
1673
+ done: (result) => {
1674
+ if (answered)
1675
+ return;
1676
+ answered = true;
1677
+ this.pending.set(false);
1678
+ // La persona ya cerró ese detalle o abrió otra compra: la respuesta no toca lo que está mirando.
1679
+ if (result === 'refused' || session !== this.session)
1680
+ return;
1681
+ this.submitted.set(false);
1682
+ if (creating && result === 'unknown') {
1683
+ // Pudo haberse creado: se cierra el alta para no invitar a repetirla; la lista que relee el host lo dirá.
1684
+ // El foco vuelve a "Agregar compra": el formulario que lo tenía desaparece.
1685
+ this.close();
1686
+ return;
1687
+ }
1688
+ this.awaiting.set({ list, idsBefore, session });
1689
+ // El host pudo pasar la lista nueva antes de llamar done: se revisa ya, sin esperar otro cambio.
1690
+ this.sync();
1691
+ }
1692
+ });
1693
+ }
1694
+ /** Descarta lo escrito y vuelve a lo guardado. */
1695
+ reset() {
1696
+ const row = this.selected();
1697
+ this.draft.set(row ? toDraft(row) : emptyDraft());
1698
+ this.submitted.set(false);
1699
+ this.leaving.set(null);
1700
+ }
1701
+ selectTab(tab) {
1702
+ const value = tab === 'payslips' ? 'payslips' : 'certificates';
1703
+ this.documentsTab.set(value);
1704
+ const documents = this.readyDocuments();
1705
+ this.openDocument.set(documents ? (this.filesOf(documents, value)[0] ?? null) : null);
1706
+ }
1707
+ retryDocuments() {
1708
+ this.loadDocuments(this.selectedId());
1394
1709
  }
1395
- markBuy(row, buy) {
1396
- if (this.canEdit() && !this.saving())
1397
- this.mark.emit({ id: row.IdPrstmsCC, buy });
1710
+ filesOf(documents, tab) {
1711
+ return tab === 'certificates' ? documents.certificates : documents.payslips;
1398
1712
  }
1399
- markPayslip(row, payslip) {
1400
- if (this.canEdit() && !this.saving())
1401
- this.mark.emit({ id: row.IdPrstmsCC, payslip });
1713
+ /** Cómo se muestra: PDF en el visor, imagen como imagen; lo demás solo se abre en otra pestaña. */
1714
+ viewerKind(document) {
1715
+ const name = `${document.name} ${(document.url ?? '').split('?')[0]}`.toLowerCase();
1716
+ if (/\.pdf(\s|$)/.test(name))
1717
+ return 'pdf';
1718
+ if (/\.(png|jpe?g|gif|webp)(\s|$)/.test(name))
1719
+ return 'image';
1720
+ return 'none';
1721
+ }
1722
+ /** Solo https: ni el visor ni el enlace para abrirlo salen con otra dirección. */
1723
+ canOpen(document) {
1724
+ return !!document.url && isHttps(document.url);
1725
+ }
1726
+ /** La fecha de carga como yyyy-MM-dd: el backend la manda como dd/MM/yyyy o ISO, y el DatePipe falla con la primera. */
1727
+ fileDate(document) {
1728
+ return toIsoDate(document.date)?.slice(0, 10) ?? null;
1729
+ }
1730
+ cardId(id) {
1731
+ return `${this.id}-card-${id}`;
1732
+ }
1733
+ /** Compra (aparece en el desprendible) o saneamiento (no aparece). */
1734
+ kind(row) {
1735
+ return row.Desprendible ? 'Compra' : 'Saneamiento';
1402
1736
  }
1403
1737
  /** Nombre de la obligación para el lector de pantalla: la entidad y el número. */
1404
1738
  rowName(row) {
1405
1739
  return [row.Entidad, row.NumeroObligacion].filter((part) => !!part?.toString().trim()).join(' ') || `compra ${row.IdPrstmsCC}`;
1406
1740
  }
1741
+ sync() {
1742
+ const rows = this.rows();
1743
+ const awaiting = this.awaiting();
1744
+ // Solo cuenta una lista distinta de la que había al guardar: la de antes traería los datos viejos.
1745
+ if (awaiting && this.buyouts() !== awaiting.list) {
1746
+ this.awaiting.set(null);
1747
+ if (awaiting.idsBefore) {
1748
+ const created = rows.find((row) => !awaiting.idsBefore.has(row.IdPrstmsCC));
1749
+ if (created)
1750
+ this.open(created, false);
1751
+ else
1752
+ this.close();
1753
+ return;
1754
+ }
1755
+ const saved = this.selected();
1756
+ if (saved)
1757
+ this.draft.set(toDraft(saved));
1758
+ }
1759
+ const id = this.selectedId();
1760
+ // La compra ya no está (la lista se volvió a leer): se cierra el detalle.
1761
+ if (id && !rows.some((item) => item.IdPrstmsCC === id))
1762
+ this.close(false);
1763
+ }
1764
+ /** Se abre o se cierra un detalle: lo que esperaba el anterior ya no aplica. */
1765
+ moved() {
1766
+ this.session++;
1767
+ this.awaiting.set(null);
1768
+ this.leaving.set(null);
1769
+ }
1770
+ open(row, focus) {
1771
+ this.moved();
1772
+ this.selectedId.set(row.IdPrstmsCC);
1773
+ this.draft.set(toDraft(row));
1774
+ this.submitted.set(false);
1775
+ this.loadDocuments(row.IdPrstmsCC);
1776
+ if (focus)
1777
+ this.focusAfterRender(`${this.id}-detail-title`);
1778
+ }
1779
+ /** Pide los documentos de la compra abierta y cancela lo que estuviera pidiendo de otra. */
1780
+ loadDocuments(id) {
1781
+ this.documentsSubscription?.unsubscribe();
1782
+ this.documentsSubscription = undefined;
1783
+ this.openDocument.set(null);
1784
+ const applicationId = this.applicationId();
1785
+ const gateway = this.gateway;
1786
+ if (!id || !applicationId || !gateway?.getDebtBuyoutDocuments) {
1787
+ this.documents.set({ status: 'idle' });
1788
+ return;
1789
+ }
1790
+ this.documents.set({ status: 'loading' });
1791
+ this.documentsSubscription = gateway.getDebtBuyoutDocuments(applicationId, id).subscribe({
1792
+ next: (documents) => {
1793
+ this.documents.set({
1794
+ status: 'ready',
1795
+ documents: {
1796
+ available: documents?.available !== false,
1797
+ certificates: documents?.certificates ?? [],
1798
+ payslips: documents?.payslips ?? []
1799
+ }
1800
+ });
1801
+ const ready = this.readyDocuments();
1802
+ // Sin certificado, se abre de una vez el desprendible para no mostrar una pestaña vacía.
1803
+ this.selectTab(ready && !ready.certificates.length && ready.payslips.length ? 'payslips' : 'certificates');
1804
+ },
1805
+ error: () => this.documents.set({ status: 'error' })
1806
+ });
1807
+ }
1808
+ focusAfterRender(elementId) {
1809
+ afterNextRender(() => {
1810
+ const target = this.host.nativeElement.querySelector(`#${CSS.escape(elementId)}`);
1811
+ // Algunos controles de PrimeNG ponen el id en el contenedor: se enfoca el control de adentro.
1812
+ const focusable = target?.matches('input, textarea, button, [tabindex]') ? target : target?.querySelector('input, textarea, button');
1813
+ focusable?.focus();
1814
+ }, { injector: this.injector });
1815
+ }
1407
1816
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: DebtBuyoutsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
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"] }] });
1817
+ 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 }, canEditObservations: { classPropertyName: "canEditObservations", publicName: "canEditObservations", isSignal: true, isRequired: false, transformFunction: null }, readonlyReason: { classPropertyName: "readonlyReason", publicName: "readonlyReason", isSignal: true, isRequired: false, transformFunction: null }, saving: { classPropertyName: "saving", publicName: "saving", isSignal: true, isRequired: false, transformFunction: null }, applicationId: { classPropertyName: "applicationId", publicName: "applicationId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { retry: "retry", save: "save", dirtyChange: "dirtyChange" }, ngImport: i0, template: "<p-card>\n <div class=\"sfs-head\">\n <h2 class=\"sfs-title\">Compras de cartera</h2>\n <div class=\"sfs-inline\">\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 @if (canEdit() && !loading() && !failed()) {\n <p-button [id]=\"id + '-add'\" label=\"Agregar compra\" icon=\"pi pi-plus\" severity=\"secondary\" [text]=\"true\"\n [disabled]=\"busy() || creating()\" (onClick)=\"startCreate()\"></p-button>\n }\n </div>\n </div>\n\n @if (loading()) {\n <div class=\"sfs-cc-cards\" aria-busy=\"true\">\n <p-skeleton height=\"7.5rem\"></p-skeleton>\n <p-skeleton height=\"7.5rem\"></p-skeleton>\n <p-skeleton height=\"7.5rem\"></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\">\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 @if (rows().length) {\n <ul class=\"sfs-cc-cards\" role=\"list\" aria-label=\"Obligaciones de la solicitud\">\n @for (row of rows(); track row.IdPrstmsCC) {\n <li>\n <button type=\"button\" class=\"sfs-cc-card\" [id]=\"cardId(row.IdPrstmsCC)\" [class.sfs-cc-card--open]=\"selectedId() === row.IdPrstmsCC\"\n [attr.aria-expanded]=\"selectedId() === row.IdPrstmsCC\" [attr.aria-controls]=\"selectedId() === row.IdPrstmsCC ? id + '-detail' : null\"\n (click)=\"toggle(row)\">\n <span class=\"sfs-cc-card-top\">\n <p-tag [value]=\"kind(row)\" [severity]=\"row.Desprendible ? 'info' : 'secondary'\"></p-tag>\n <span class=\"sfs-muted sfs-cc-small\">N.\u00BA {{ row.IdPrstmsCC }}</span>\n </span>\n <span class=\"sfs-strong sfs-break\">{{ row.Entidad || 'Sin entidad' }}</span>\n <span class=\"sfs-muted sfs-cc-small\">Obligaci\u00F3n {{ row.NumeroObligacion || '\u2014' }}</span>\n <span class=\"sfs-cc-amount\">{{ row.SaldoActual | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</span>\n <span class=\"sfs-cc-tags\">\n @if (!row.Comprar) {\n <p-tag value=\"No se compra\" severity=\"secondary\"></p-tag>\n } @else if (row.Girado) {\n <p-tag value=\"Girado\" severity=\"success\" icon=\"pi pi-check\"></p-tag>\n } @else {\n <p-tag value=\"Por girar\" severity=\"warn\" icon=\"pi pi-clock\"></p-tag>\n }\n <span class=\"sfs-cc-small\" [class.sfs-muted]=\"!row.ConCertificado\">\n <i class=\"pi\" [class.pi-file-check]=\"row.ConCertificado\" [class.pi-file]=\"!row.ConCertificado\" aria-hidden=\"true\"></i>\n {{ row.ConCertificado ? 'Certificado' : 'Sin certificado' }}\n </span>\n </span>\n @if (row.Paso) {\n <span class=\"sfs-muted sfs-cc-small\">{{ row.Paso }}</span>\n }\n </button>\n </li>\n }\n </ul>\n } @else if (!creating()) {\n <p class=\"sfs-muted sfs-cc-empty\">\n La solicitud no tiene compras de cartera registradas.\n @if (canEdit()) { Use \"Agregar compra\" para registrar una obligaci\u00F3n a comprar o sanear. }\n </p>\n }\n\n @if (selectedId() !== null) {\n <section [id]=\"id + '-detail'\" class=\"sfs-cc-detail\" [attr.aria-labelledby]=\"id + '-detail-title'\" [attr.aria-busy]=\"busy() ? 'true' : null\">\n <div class=\"sfs-head sfs-cc-detail-head\">\n <h3 [id]=\"id + '-detail-title'\" class=\"sfs-subtitle\" tabindex=\"-1\">\n @if (selected(); as row) {\n Compra de cartera \u00B7 N.\u00BA {{ row.IdPrstmsCC }}\n } @else {\n Nueva compra de cartera\n }\n </h3>\n <p-button icon=\"pi pi-times\" [text]=\"true\" [rounded]=\"true\" severity=\"secondary\" ariaLabel=\"Cerrar el detalle de la compra\" (onClick)=\"requestClose()\"></p-button>\n </div>\n\n @if (leaving()) {\n <p-message severity=\"warn\" class=\"sfs-cc-leave\">\n <div class=\"sfs-inline\">\n <span>Hay cambios sin guardar en esta compra. Si contin\u00FAa, se pierden.</span>\n <p-button [id]=\"id + '-leave-stay'\" label=\"Seguir editando\" severity=\"secondary\" [text]=\"true\" (onClick)=\"cancelLeave()\"></p-button>\n <p-button label=\"Descartar cambios\" severity=\"danger\" [text]=\"true\" (onClick)=\"confirmLeave()\"></p-button>\n </div>\n </p-message>\n }\n\n <div class=\"sfs-cc-detail-body\" [class.sfs-cc-detail-body--docs]=\"canShowDocuments() && !creating()\">\n <form class=\"sfs-stack\" (ngSubmit)=\"submit()\" novalidate>\n @if (!canEdit() && readonlyReason()) {\n <p-message severity=\"info\" icon=\"pi pi-lock\">{{ readonlyReason() }}</p-message>\n } @else if (selected()?.Girado) {\n <p-message severity=\"info\" icon=\"pi pi-lock\">La obligaci\u00F3n ya se gir\u00F3: sus datos son de solo lectura, salvo las observaciones.</p-message>\n }\n\n <fieldset class=\"sfs-cc-fieldset\">\n <legend class=\"sfs-cc-legend\">Datos de la obligaci\u00F3n</legend>\n <div class=\"sfs-cc-grid\">\n <div class=\"sfs-cc-field sfs-cc-field--wide\">\n <label [for]=\"id + '-entity'\">Entidad @if (creating()) { <span class=\"sfs-muted\" aria-hidden=\"true\">*</span> }</label>\n <input pInputText [id]=\"id + '-entity'\" name=\"entity\" autocomplete=\"off\" [maxlength]=\"limits.entity\"\n [attr.aria-required]=\"creating() ? 'true' : null\" [disabled]=\"!canEdit() || locked() || busy()\"\n [attr.aria-invalid]=\"showError('entity') ? 'true' : null\" [attr.aria-describedby]=\"showError('entity') ? id + '-entity-err' : null\"\n [ngModel]=\"draft().entity\" (ngModelChange)=\"patch({ entity: $event })\" />\n @if (showError('entity'); as error) {\n <small [id]=\"id + '-entity-err'\" class=\"sfs-cc-err\"><i class=\"pi pi-exclamation-circle\" aria-hidden=\"true\"></i>{{ error }}</small>\n }\n </div>\n <div class=\"sfs-cc-field\">\n <label [for]=\"id + '-entityId'\">NIT de la entidad</label>\n <input pInputText [id]=\"id + '-entityId'\" name=\"entityId\" autocomplete=\"off\" inputmode=\"numeric\" [maxlength]=\"limits.entityId\"\n [disabled]=\"!canEdit() || locked() || busy()\" [ngModel]=\"draft().entityId\" (ngModelChange)=\"patch({ entityId: $event })\" />\n </div>\n <div class=\"sfs-cc-field\">\n <label [for]=\"id + '-obligationNumber'\">N.\u00BA de obligaci\u00F3n @if (creating()) { <span class=\"sfs-muted\" aria-hidden=\"true\">*</span> }</label>\n <input pInputText [id]=\"id + '-obligationNumber'\" name=\"obligationNumber\" autocomplete=\"off\" [maxlength]=\"limits.obligationNumber\"\n [attr.aria-required]=\"creating() ? 'true' : null\" [disabled]=\"!canEdit() || locked() || busy()\"\n [attr.aria-invalid]=\"showError('obligationNumber') ? 'true' : null\"\n [attr.aria-describedby]=\"showError('obligationNumber') ? id + '-obligationNumber-err' : null\"\n [ngModel]=\"draft().obligationNumber\" (ngModelChange)=\"patch({ obligationNumber: $event })\" />\n @if (showError('obligationNumber'); as error) {\n <small [id]=\"id + '-obligationNumber-err'\" class=\"sfs-cc-err\"><i class=\"pi pi-exclamation-circle\" aria-hidden=\"true\"></i>{{ error }}</small>\n }\n </div>\n </div>\n </fieldset>\n\n <fieldset class=\"sfs-cc-fieldset\">\n <legend class=\"sfs-cc-legend\">Valores</legend>\n <div class=\"sfs-cc-grid\">\n <div class=\"sfs-cc-field\">\n <label [for]=\"id + '-installment'\">Valor cuota</label>\n <p-inputnumber [inputId]=\"id + '-installment'\" name=\"installment\" mode=\"currency\" currency=\"COP\" locale=\"es-CO\" [maxFractionDigits]=\"0\" [min]=\"0\"\n [disabled]=\"!canEdit() || locked() || busy()\" [ngModel]=\"draft().installment\" (ngModelChange)=\"patch({ installment: $event })\"></p-inputnumber>\n </div>\n <div class=\"sfs-cc-field\">\n <label [for]=\"id + '-balance'\">Valor total a girar</label>\n <p-inputnumber [inputId]=\"id + '-balance'\" name=\"balance\" mode=\"currency\" currency=\"COP\" locale=\"es-CO\" [maxFractionDigits]=\"0\" [min]=\"0\"\n [disabled]=\"!canEdit() || locked() || busy()\" [ngModel]=\"draft().balance\" (ngModelChange)=\"patch({ balance: $event })\"></p-inputnumber>\n </div>\n <div class=\"sfs-cc-field\">\n <label [for]=\"id + '-arrears'\">Saldo en mora</label>\n <p-inputnumber [inputId]=\"id + '-arrears'\" name=\"arrears\" mode=\"currency\" currency=\"COP\" locale=\"es-CO\" [maxFractionDigits]=\"0\" [min]=\"0\"\n [disabled]=\"!canEdit() || locked() || busy()\" [ngModel]=\"draft().arrears\" (ngModelChange)=\"patch({ arrears: $event })\"></p-inputnumber>\n </div>\n <div class=\"sfs-cc-field\">\n <label [for]=\"id + '-dueDate'\">Fecha de vencimiento</label>\n <p-datepicker [inputId]=\"id + '-dueDate'\" name=\"dueDate\" dateFormat=\"yy-mm-dd\" [showIcon]=\"true\" appendTo=\"body\"\n [disabled]=\"!canEdit() || locked() || busy()\" [ngModel]=\"draft().dueDate\" (ngModelChange)=\"patch({ dueDate: $event })\"></p-datepicker>\n @if (showError('dueDate'); as error) {\n <small [id]=\"id + '-dueDate-err'\" class=\"sfs-cc-err\"><i class=\"pi pi-exclamation-circle\" aria-hidden=\"true\"></i>{{ error }}</small>\n }\n </div>\n </div>\n </fieldset>\n\n <fieldset class=\"sfs-cc-fieldset\">\n <legend class=\"sfs-cc-legend\">Clasificaci\u00F3n</legend>\n <div class=\"sfs-cc-checks\">\n <div class=\"sfs-cc-check\">\n <p-checkbox [inputId]=\"id + '-payslip'\" name=\"payslip\" [binary]=\"true\" [disabled]=\"!canEdit() || locked() || busy()\"\n [ngModel]=\"draft().payslip\" (ngModelChange)=\"patch({ payslip: $event })\"></p-checkbox>\n <label [for]=\"id + '-payslip'\">Aparece en el desprendible\n <small class=\"sfs-muted\">Si aparece, es una compra; si no, un saneamiento.</small></label>\n </div>\n <div class=\"sfs-cc-check\">\n <p-checkbox [inputId]=\"id + '-buy'\" name=\"buy\" [binary]=\"true\" [disabled]=\"!canEdit() || locked() || busy()\"\n [ngModel]=\"draft().buy\" (ngModelChange)=\"patch({ buy: $event })\"></p-checkbox>\n <label [for]=\"id + '-buy'\">Comprar\n <small class=\"sfs-muted\">Se gira a la entidad y suma a las compras de cartera del simulador.</small></label>\n </div>\n </div>\n </fieldset>\n\n <div class=\"sfs-cc-field\">\n <label [for]=\"id + '-observations'\">Observaciones</label>\n <textarea pTextarea [id]=\"id + '-observations'\" name=\"observations\" rows=\"2\" [maxlength]=\"limits.observations\" [disabled]=\"!canSave() || busy()\"\n [attr.aria-invalid]=\"showError('observations') ? 'true' : null\"\n [attr.aria-describedby]=\"(showError('observations') ? id + '-observations-err ' : '') + id + '-observations-count'\"\n [ngModel]=\"draft().observations\" (ngModelChange)=\"patch({ observations: $event })\"></textarea>\n <small [id]=\"id + '-observations-count'\" class=\"sfs-muted\">{{ draft().observations.length }} de {{ limits.observations }} caracteres</small>\n @if (showError('observations'); as error) {\n <small [id]=\"id + '-observations-err'\" class=\"sfs-cc-err\"><i class=\"pi pi-exclamation-circle\" aria-hidden=\"true\"></i>{{ error }}</small>\n }\n </div>\n\n @if (selected(); as row) {\n <dl class=\"sfs-summary sfs-cc-small\">\n <dt>Origen</dt>\n <dd>{{ row.Buro || '\u2014' }}@if (row.Sector) { \u00B7 {{ row.Sector }} }</dd>\n <dt>Estado de la obligaci\u00F3n</dt>\n <dd>{{ row.EstadoObligacion || '\u2014' }}</dd>\n <dt>Paso</dt>\n <dd>{{ row.Paso || '\u2014' }}</dd>\n </dl>\n }\n\n @if (canSave()) {\n <div class=\"sfs-inline sfs-cc-actions\">\n <p-button type=\"button\" label=\"Descartar cambios\" severity=\"secondary\" [text]=\"true\" [disabled]=\"busy() || (!creating() && !change())\"\n (onClick)=\"reset()\"></p-button>\n <p-button type=\"submit\" [label]=\"creating() ? 'Agregar compra' : 'Guardar cambios'\" icon=\"pi pi-check\" [loading]=\"pending()\"\n [disabled]=\"busy() || (!creating() && !change())\"></p-button>\n </div>\n }\n </form>\n\n @if (canShowDocuments() && !creating()) {\n <div class=\"sfs-cc-docs\" role=\"region\" [attr.aria-labelledby]=\"id + '-docs-title'\">\n <h4 [id]=\"id + '-docs-title'\" class=\"sfs-cc-legend\">Documentos</h4>\n @switch (documents().status) {\n @case ('loading') {\n <div class=\"sfs-stack\" aria-busy=\"true\">\n <p-skeleton height=\"2.5rem\"></p-skeleton>\n <p-skeleton height=\"20rem\"></p-skeleton>\n </div>\n }\n @case ('error') {\n <p-message severity=\"error\">\n <div class=\"sfs-inline\">\n <span>No se pudieron leer los documentos de la compra.</span>\n <p-button label=\"Reintentar\" icon=\"pi pi-refresh\" [text]=\"true\" (onClick)=\"retryDocuments()\"></p-button>\n </div>\n </p-message>\n }\n @case ('ready') {\n @if (readyDocuments(); as docs) {\n @if (!docs.available) {\n <p class=\"sfs-muted\">Los documentos de las compras de cartera no est\u00E1n disponibles para este negocio.</p>\n } @else {\n <!-- Cada pesta\u00F1a con su panel: los archivos de esa carpeta y el visor del abierto. -->\n <p-tabs [value]=\"documentsTab()\" (valueChange)=\"selectTab($event)\">\n <p-tablist>\n <p-tab value=\"certificates\">Certificado ({{ docs.certificates.length }})</p-tab>\n <p-tab value=\"payslips\">Desprendible de n\u00F3mina ({{ docs.payslips.length }})</p-tab>\n </p-tablist>\n <p-tabpanels>\n <p-tabpanel value=\"certificates\">\n @if (documentsTab() === 'certificates') {\n <ng-container *ngTemplateOutlet=\"filesTpl; context: { $implicit: docs.certificates, empty: 'La compra no tiene certificado de deuda cargado.' }\"></ng-container>\n }\n </p-tabpanel>\n <p-tabpanel value=\"payslips\">\n @if (documentsTab() === 'payslips') {\n <ng-container *ngTemplateOutlet=\"filesTpl; context: { $implicit: docs.payslips, empty: 'El titular no tiene desprendibles de n\u00F3mina cargados.' }\"></ng-container>\n }\n </p-tabpanel>\n </p-tabpanels>\n </p-tabs>\n }\n }\n }\n }\n </div>\n }\n </div>\n </section>\n }\n </div>\n }\n</p-card>\n\n<!-- Los archivos de una pesta\u00F1a: la lista (si hay m\u00E1s de uno), el abierto y su visor. -->\n<ng-template #filesTpl let-files let-empty=\"empty\">\n @if (!files.length) {\n <p class=\"sfs-muted sfs-cc-empty\">{{ empty }}</p>\n } @else {\n <div class=\"sfs-cc-docs\">\n @if (files.length > 1) {\n <ul class=\"sfs-cc-files\" role=\"list\" aria-label=\"Archivos\">\n @for (file of files; track $index) {\n <li>\n <button pButton type=\"button\" [label]=\"file.name\" icon=\"pi pi-file\" size=\"small\" [text]=\"openDocument() !== file\"\n [severity]=\"openDocument() === file ? undefined : 'secondary'\" [attr.aria-pressed]=\"openDocument() === file\"\n (click)=\"openDocument.set(file)\"></button>\n </li>\n }\n </ul>\n }\n @if (openDocument(); as file) {\n <div class=\"sfs-inline sfs-cc-file-head\">\n <span class=\"sfs-strong sfs-break\">{{ file.name }}</span>\n @if (fileDate(file); as date) { <span class=\"sfs-muted sfs-cc-small\">{{ date }}</span> }\n @if (canOpen(file)) {\n <a pButton [href]=\"file.url\" target=\"_blank\" rel=\"noopener noreferrer\" icon=\"pi pi-external-link\" label=\"Abrir en otra pesta\u00F1a\"\n [text]=\"true\" size=\"small\" severity=\"secondary\"></a>\n }\n </div>\n @if (viewerUrl(); as url) {\n @switch (viewerKind(file)) {\n @case ('pdf') { <iframe class=\"sfs-cc-viewer\" [src]=\"url\" [title]=\"file.name\"></iframe> }\n @case ('image') { <img class=\"sfs-cc-viewer sfs-cc-viewer--img\" [src]=\"file.url\" [alt]=\"file.name\" /> }\n @default { <p class=\"sfs-muted sfs-cc-empty\">Este archivo no se puede ver aqu\u00ED: \u00E1bralo en otra pesta\u00F1a.</p> }\n }\n } @else if (!file.url) {\n <p class=\"sfs-muted sfs-cc-empty\">No se encontr\u00F3 este archivo en el gestor documental: revise la carpeta en Documentos.</p>\n } @else {\n <p class=\"sfs-muted sfs-cc-empty\">Este archivo no se puede abrir: su direcci\u00F3n no es segura (no es https).</p>\n }\n }\n </div>\n }\n</ng-template>\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-cc-cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,15rem),1fr));gap:.75rem;margin:0;padding:0;list-style:none}.sfs-cc-card{display:flex;flex-direction:column;align-items:flex-start;gap:.35rem;width:100%;height:100%;min-height:2.75rem;padding:.75rem;border:1px solid var(--p-content-border-color);border-radius:var(--p-content-border-radius, 6px);background:var(--p-content-background);color:var(--p-text-color);font:inherit;text-align:left;cursor:pointer}.sfs-cc-card:hover{border-color:var(--p-primary-color)}.sfs-cc-card:focus-visible{outline:2px solid var(--p-primary-color);outline-offset:2px}.sfs-cc-card--open{border-color:var(--p-primary-color);box-shadow:inset 0 0 0 1px var(--p-primary-color)}.sfs-cc-card-top{display:flex;align-items:center;justify-content:space-between;gap:.5rem;width:100%}.sfs-cc-amount{font-size:1.125rem;font-weight:600;font-variant-numeric:tabular-nums}.sfs-cc-tags{display:flex;flex-wrap:wrap;align-items:center;gap:.5rem}.sfs-cc-small{font-size:.875rem}.sfs-cc-empty{margin:0}.sfs-cc-detail{padding-top:1rem;border-top:1px solid var(--p-content-border-color)}.sfs-cc-detail-head h3:focus{outline:none}.sfs-cc-detail-head h3:focus-visible{outline:2px solid var(--p-primary-color);outline-offset:2px}.sfs-cc-detail-body{display:grid;grid-template-columns:minmax(0,1fr);gap:1.5rem}@media (min-width: 1200px){.sfs-cc-detail-body--docs{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}}.sfs-cc-fieldset{min-width:0;margin:0;padding:0;border:0}.sfs-cc-legend{margin:0 0 .75rem;padding:0;color:var(--p-text-muted-color);font-size:.8125rem;font-weight:600;letter-spacing:.04em;text-transform:uppercase}.sfs-cc-grid{display:grid;grid-template-columns:minmax(0,1fr);gap:1rem}@media (min-width: 576px){.sfs-cc-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.sfs-cc-field--wide{grid-column:1 / -1}}.sfs-cc-field{display:flex;flex-direction:column;gap:.35rem;min-width:0}.sfs-cc-field>label{font-size:.875rem;font-weight:600}.sfs-cc-field input,.sfs-cc-field textarea,.sfs-cc-field ::ng-deep .p-inputnumber,.sfs-cc-field ::ng-deep .p-datepicker{width:100%}.sfs-cc-checks{display:flex;flex-direction:column;gap:.75rem}.sfs-cc-check{display:flex;align-items:flex-start;gap:.5rem;min-height:2.75rem}.sfs-cc-check label{display:flex;flex-direction:column;gap:.15rem;font-weight:600}.sfs-cc-check label small{font-weight:400}.sfs-cc-err{display:flex;align-items:flex-start;gap:.35rem;color:var(--p-message-error-simple-color, var(--p-text-color))}.sfs-cc-actions{justify-content:flex-end}.sfs-cc-docs{display:flex;flex-direction:column;gap:.75rem;min-width:0}.sfs-cc-files{display:flex;flex-wrap:wrap;gap:.25rem;margin:0;padding:0;list-style:none}.sfs-cc-file-head{justify-content:space-between}.sfs-cc-viewer{width:100%;height:32rem;max-height:70vh;border:1px solid var(--p-content-border-color);border-radius:var(--p-content-border-radius, 6px);background:var(--p-content-background)}.sfs-cc-viewer--img{height:auto;object-fit:contain}.sfs-cc-leave{display:block;margin-bottom:1rem}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i1.CurrencyPipe, name: "currency" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { 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$2.Card, selector: "p-card", inputs: ["header", "subheader", "style", "styleClass"] }, { kind: "ngmodule", type: CheckboxModule }, { kind: "component", type: i3$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: 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: 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: 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: SkeletonModule }, { kind: "component", type: i5$1.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "style", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "ngmodule", type: TabsModule }, { kind: "component", type: i11.Tabs, selector: "p-tabs", inputs: ["value", "scrollable", "lazy", "selectOnFocus", "showNavigators", "tabindex"], outputs: ["valueChange"] }, { kind: "component", type: i11.TabPanels, selector: "p-tabpanels" }, { kind: "component", type: i11.TabPanel, selector: "p-tabpanel", inputs: ["value"], outputs: ["valueChange"] }, { kind: "component", type: i11.TabList, selector: "p-tablist" }, { kind: "component", type: i11.Tab, selector: "p-tab", inputs: ["value", "disabled"], outputs: ["valueChange"] }, { kind: "ngmodule", type: TagModule }, { kind: "component", type: i7$1.Tag, selector: "p-tag", inputs: ["style", "styleClass", "severity", "value", "icon", "rounded"] }, { kind: "ngmodule", type: TextareaModule }, { kind: "directive", type: i13.Textarea, selector: "[pTextarea], [pInputTextarea]", inputs: ["autoResize", "variant", "fluid", "pSize"], outputs: ["onResize"] }] });
1409
1818
  }
1410
1819
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: DebtBuyoutsComponent, decorators: [{
1411
1820
  type: Component,
1412
- args: [{ selector: 'lib-debt-buyouts', imports: [CommonModule, FormsModule, ButtonModule, CardModule, CheckboxModule, MessageModule, SkeletonModule, TableModule, TagModule], 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"] }]
1821
+ args: [{ selector: 'lib-debt-buyouts', imports: [
1822
+ CommonModule,
1823
+ FormsModule,
1824
+ ButtonModule,
1825
+ CardModule,
1826
+ CheckboxModule,
1827
+ DatePickerModule,
1828
+ InputNumberModule,
1829
+ InputTextModule,
1830
+ MessageModule,
1831
+ SkeletonModule,
1832
+ TabsModule,
1833
+ TagModule,
1834
+ TextareaModule
1835
+ ], template: "<p-card>\n <div class=\"sfs-head\">\n <h2 class=\"sfs-title\">Compras de cartera</h2>\n <div class=\"sfs-inline\">\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 @if (canEdit() && !loading() && !failed()) {\n <p-button [id]=\"id + '-add'\" label=\"Agregar compra\" icon=\"pi pi-plus\" severity=\"secondary\" [text]=\"true\"\n [disabled]=\"busy() || creating()\" (onClick)=\"startCreate()\"></p-button>\n }\n </div>\n </div>\n\n @if (loading()) {\n <div class=\"sfs-cc-cards\" aria-busy=\"true\">\n <p-skeleton height=\"7.5rem\"></p-skeleton>\n <p-skeleton height=\"7.5rem\"></p-skeleton>\n <p-skeleton height=\"7.5rem\"></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\">\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 @if (rows().length) {\n <ul class=\"sfs-cc-cards\" role=\"list\" aria-label=\"Obligaciones de la solicitud\">\n @for (row of rows(); track row.IdPrstmsCC) {\n <li>\n <button type=\"button\" class=\"sfs-cc-card\" [id]=\"cardId(row.IdPrstmsCC)\" [class.sfs-cc-card--open]=\"selectedId() === row.IdPrstmsCC\"\n [attr.aria-expanded]=\"selectedId() === row.IdPrstmsCC\" [attr.aria-controls]=\"selectedId() === row.IdPrstmsCC ? id + '-detail' : null\"\n (click)=\"toggle(row)\">\n <span class=\"sfs-cc-card-top\">\n <p-tag [value]=\"kind(row)\" [severity]=\"row.Desprendible ? 'info' : 'secondary'\"></p-tag>\n <span class=\"sfs-muted sfs-cc-small\">N.\u00BA {{ row.IdPrstmsCC }}</span>\n </span>\n <span class=\"sfs-strong sfs-break\">{{ row.Entidad || 'Sin entidad' }}</span>\n <span class=\"sfs-muted sfs-cc-small\">Obligaci\u00F3n {{ row.NumeroObligacion || '\u2014' }}</span>\n <span class=\"sfs-cc-amount\">{{ row.SaldoActual | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</span>\n <span class=\"sfs-cc-tags\">\n @if (!row.Comprar) {\n <p-tag value=\"No se compra\" severity=\"secondary\"></p-tag>\n } @else if (row.Girado) {\n <p-tag value=\"Girado\" severity=\"success\" icon=\"pi pi-check\"></p-tag>\n } @else {\n <p-tag value=\"Por girar\" severity=\"warn\" icon=\"pi pi-clock\"></p-tag>\n }\n <span class=\"sfs-cc-small\" [class.sfs-muted]=\"!row.ConCertificado\">\n <i class=\"pi\" [class.pi-file-check]=\"row.ConCertificado\" [class.pi-file]=\"!row.ConCertificado\" aria-hidden=\"true\"></i>\n {{ row.ConCertificado ? 'Certificado' : 'Sin certificado' }}\n </span>\n </span>\n @if (row.Paso) {\n <span class=\"sfs-muted sfs-cc-small\">{{ row.Paso }}</span>\n }\n </button>\n </li>\n }\n </ul>\n } @else if (!creating()) {\n <p class=\"sfs-muted sfs-cc-empty\">\n La solicitud no tiene compras de cartera registradas.\n @if (canEdit()) { Use \"Agregar compra\" para registrar una obligaci\u00F3n a comprar o sanear. }\n </p>\n }\n\n @if (selectedId() !== null) {\n <section [id]=\"id + '-detail'\" class=\"sfs-cc-detail\" [attr.aria-labelledby]=\"id + '-detail-title'\" [attr.aria-busy]=\"busy() ? 'true' : null\">\n <div class=\"sfs-head sfs-cc-detail-head\">\n <h3 [id]=\"id + '-detail-title'\" class=\"sfs-subtitle\" tabindex=\"-1\">\n @if (selected(); as row) {\n Compra de cartera \u00B7 N.\u00BA {{ row.IdPrstmsCC }}\n } @else {\n Nueva compra de cartera\n }\n </h3>\n <p-button icon=\"pi pi-times\" [text]=\"true\" [rounded]=\"true\" severity=\"secondary\" ariaLabel=\"Cerrar el detalle de la compra\" (onClick)=\"requestClose()\"></p-button>\n </div>\n\n @if (leaving()) {\n <p-message severity=\"warn\" class=\"sfs-cc-leave\">\n <div class=\"sfs-inline\">\n <span>Hay cambios sin guardar en esta compra. Si contin\u00FAa, se pierden.</span>\n <p-button [id]=\"id + '-leave-stay'\" label=\"Seguir editando\" severity=\"secondary\" [text]=\"true\" (onClick)=\"cancelLeave()\"></p-button>\n <p-button label=\"Descartar cambios\" severity=\"danger\" [text]=\"true\" (onClick)=\"confirmLeave()\"></p-button>\n </div>\n </p-message>\n }\n\n <div class=\"sfs-cc-detail-body\" [class.sfs-cc-detail-body--docs]=\"canShowDocuments() && !creating()\">\n <form class=\"sfs-stack\" (ngSubmit)=\"submit()\" novalidate>\n @if (!canEdit() && readonlyReason()) {\n <p-message severity=\"info\" icon=\"pi pi-lock\">{{ readonlyReason() }}</p-message>\n } @else if (selected()?.Girado) {\n <p-message severity=\"info\" icon=\"pi pi-lock\">La obligaci\u00F3n ya se gir\u00F3: sus datos son de solo lectura, salvo las observaciones.</p-message>\n }\n\n <fieldset class=\"sfs-cc-fieldset\">\n <legend class=\"sfs-cc-legend\">Datos de la obligaci\u00F3n</legend>\n <div class=\"sfs-cc-grid\">\n <div class=\"sfs-cc-field sfs-cc-field--wide\">\n <label [for]=\"id + '-entity'\">Entidad @if (creating()) { <span class=\"sfs-muted\" aria-hidden=\"true\">*</span> }</label>\n <input pInputText [id]=\"id + '-entity'\" name=\"entity\" autocomplete=\"off\" [maxlength]=\"limits.entity\"\n [attr.aria-required]=\"creating() ? 'true' : null\" [disabled]=\"!canEdit() || locked() || busy()\"\n [attr.aria-invalid]=\"showError('entity') ? 'true' : null\" [attr.aria-describedby]=\"showError('entity') ? id + '-entity-err' : null\"\n [ngModel]=\"draft().entity\" (ngModelChange)=\"patch({ entity: $event })\" />\n @if (showError('entity'); as error) {\n <small [id]=\"id + '-entity-err'\" class=\"sfs-cc-err\"><i class=\"pi pi-exclamation-circle\" aria-hidden=\"true\"></i>{{ error }}</small>\n }\n </div>\n <div class=\"sfs-cc-field\">\n <label [for]=\"id + '-entityId'\">NIT de la entidad</label>\n <input pInputText [id]=\"id + '-entityId'\" name=\"entityId\" autocomplete=\"off\" inputmode=\"numeric\" [maxlength]=\"limits.entityId\"\n [disabled]=\"!canEdit() || locked() || busy()\" [ngModel]=\"draft().entityId\" (ngModelChange)=\"patch({ entityId: $event })\" />\n </div>\n <div class=\"sfs-cc-field\">\n <label [for]=\"id + '-obligationNumber'\">N.\u00BA de obligaci\u00F3n @if (creating()) { <span class=\"sfs-muted\" aria-hidden=\"true\">*</span> }</label>\n <input pInputText [id]=\"id + '-obligationNumber'\" name=\"obligationNumber\" autocomplete=\"off\" [maxlength]=\"limits.obligationNumber\"\n [attr.aria-required]=\"creating() ? 'true' : null\" [disabled]=\"!canEdit() || locked() || busy()\"\n [attr.aria-invalid]=\"showError('obligationNumber') ? 'true' : null\"\n [attr.aria-describedby]=\"showError('obligationNumber') ? id + '-obligationNumber-err' : null\"\n [ngModel]=\"draft().obligationNumber\" (ngModelChange)=\"patch({ obligationNumber: $event })\" />\n @if (showError('obligationNumber'); as error) {\n <small [id]=\"id + '-obligationNumber-err'\" class=\"sfs-cc-err\"><i class=\"pi pi-exclamation-circle\" aria-hidden=\"true\"></i>{{ error }}</small>\n }\n </div>\n </div>\n </fieldset>\n\n <fieldset class=\"sfs-cc-fieldset\">\n <legend class=\"sfs-cc-legend\">Valores</legend>\n <div class=\"sfs-cc-grid\">\n <div class=\"sfs-cc-field\">\n <label [for]=\"id + '-installment'\">Valor cuota</label>\n <p-inputnumber [inputId]=\"id + '-installment'\" name=\"installment\" mode=\"currency\" currency=\"COP\" locale=\"es-CO\" [maxFractionDigits]=\"0\" [min]=\"0\"\n [disabled]=\"!canEdit() || locked() || busy()\" [ngModel]=\"draft().installment\" (ngModelChange)=\"patch({ installment: $event })\"></p-inputnumber>\n </div>\n <div class=\"sfs-cc-field\">\n <label [for]=\"id + '-balance'\">Valor total a girar</label>\n <p-inputnumber [inputId]=\"id + '-balance'\" name=\"balance\" mode=\"currency\" currency=\"COP\" locale=\"es-CO\" [maxFractionDigits]=\"0\" [min]=\"0\"\n [disabled]=\"!canEdit() || locked() || busy()\" [ngModel]=\"draft().balance\" (ngModelChange)=\"patch({ balance: $event })\"></p-inputnumber>\n </div>\n <div class=\"sfs-cc-field\">\n <label [for]=\"id + '-arrears'\">Saldo en mora</label>\n <p-inputnumber [inputId]=\"id + '-arrears'\" name=\"arrears\" mode=\"currency\" currency=\"COP\" locale=\"es-CO\" [maxFractionDigits]=\"0\" [min]=\"0\"\n [disabled]=\"!canEdit() || locked() || busy()\" [ngModel]=\"draft().arrears\" (ngModelChange)=\"patch({ arrears: $event })\"></p-inputnumber>\n </div>\n <div class=\"sfs-cc-field\">\n <label [for]=\"id + '-dueDate'\">Fecha de vencimiento</label>\n <p-datepicker [inputId]=\"id + '-dueDate'\" name=\"dueDate\" dateFormat=\"yy-mm-dd\" [showIcon]=\"true\" appendTo=\"body\"\n [disabled]=\"!canEdit() || locked() || busy()\" [ngModel]=\"draft().dueDate\" (ngModelChange)=\"patch({ dueDate: $event })\"></p-datepicker>\n @if (showError('dueDate'); as error) {\n <small [id]=\"id + '-dueDate-err'\" class=\"sfs-cc-err\"><i class=\"pi pi-exclamation-circle\" aria-hidden=\"true\"></i>{{ error }}</small>\n }\n </div>\n </div>\n </fieldset>\n\n <fieldset class=\"sfs-cc-fieldset\">\n <legend class=\"sfs-cc-legend\">Clasificaci\u00F3n</legend>\n <div class=\"sfs-cc-checks\">\n <div class=\"sfs-cc-check\">\n <p-checkbox [inputId]=\"id + '-payslip'\" name=\"payslip\" [binary]=\"true\" [disabled]=\"!canEdit() || locked() || busy()\"\n [ngModel]=\"draft().payslip\" (ngModelChange)=\"patch({ payslip: $event })\"></p-checkbox>\n <label [for]=\"id + '-payslip'\">Aparece en el desprendible\n <small class=\"sfs-muted\">Si aparece, es una compra; si no, un saneamiento.</small></label>\n </div>\n <div class=\"sfs-cc-check\">\n <p-checkbox [inputId]=\"id + '-buy'\" name=\"buy\" [binary]=\"true\" [disabled]=\"!canEdit() || locked() || busy()\"\n [ngModel]=\"draft().buy\" (ngModelChange)=\"patch({ buy: $event })\"></p-checkbox>\n <label [for]=\"id + '-buy'\">Comprar\n <small class=\"sfs-muted\">Se gira a la entidad y suma a las compras de cartera del simulador.</small></label>\n </div>\n </div>\n </fieldset>\n\n <div class=\"sfs-cc-field\">\n <label [for]=\"id + '-observations'\">Observaciones</label>\n <textarea pTextarea [id]=\"id + '-observations'\" name=\"observations\" rows=\"2\" [maxlength]=\"limits.observations\" [disabled]=\"!canSave() || busy()\"\n [attr.aria-invalid]=\"showError('observations') ? 'true' : null\"\n [attr.aria-describedby]=\"(showError('observations') ? id + '-observations-err ' : '') + id + '-observations-count'\"\n [ngModel]=\"draft().observations\" (ngModelChange)=\"patch({ observations: $event })\"></textarea>\n <small [id]=\"id + '-observations-count'\" class=\"sfs-muted\">{{ draft().observations.length }} de {{ limits.observations }} caracteres</small>\n @if (showError('observations'); as error) {\n <small [id]=\"id + '-observations-err'\" class=\"sfs-cc-err\"><i class=\"pi pi-exclamation-circle\" aria-hidden=\"true\"></i>{{ error }}</small>\n }\n </div>\n\n @if (selected(); as row) {\n <dl class=\"sfs-summary sfs-cc-small\">\n <dt>Origen</dt>\n <dd>{{ row.Buro || '\u2014' }}@if (row.Sector) { \u00B7 {{ row.Sector }} }</dd>\n <dt>Estado de la obligaci\u00F3n</dt>\n <dd>{{ row.EstadoObligacion || '\u2014' }}</dd>\n <dt>Paso</dt>\n <dd>{{ row.Paso || '\u2014' }}</dd>\n </dl>\n }\n\n @if (canSave()) {\n <div class=\"sfs-inline sfs-cc-actions\">\n <p-button type=\"button\" label=\"Descartar cambios\" severity=\"secondary\" [text]=\"true\" [disabled]=\"busy() || (!creating() && !change())\"\n (onClick)=\"reset()\"></p-button>\n <p-button type=\"submit\" [label]=\"creating() ? 'Agregar compra' : 'Guardar cambios'\" icon=\"pi pi-check\" [loading]=\"pending()\"\n [disabled]=\"busy() || (!creating() && !change())\"></p-button>\n </div>\n }\n </form>\n\n @if (canShowDocuments() && !creating()) {\n <div class=\"sfs-cc-docs\" role=\"region\" [attr.aria-labelledby]=\"id + '-docs-title'\">\n <h4 [id]=\"id + '-docs-title'\" class=\"sfs-cc-legend\">Documentos</h4>\n @switch (documents().status) {\n @case ('loading') {\n <div class=\"sfs-stack\" aria-busy=\"true\">\n <p-skeleton height=\"2.5rem\"></p-skeleton>\n <p-skeleton height=\"20rem\"></p-skeleton>\n </div>\n }\n @case ('error') {\n <p-message severity=\"error\">\n <div class=\"sfs-inline\">\n <span>No se pudieron leer los documentos de la compra.</span>\n <p-button label=\"Reintentar\" icon=\"pi pi-refresh\" [text]=\"true\" (onClick)=\"retryDocuments()\"></p-button>\n </div>\n </p-message>\n }\n @case ('ready') {\n @if (readyDocuments(); as docs) {\n @if (!docs.available) {\n <p class=\"sfs-muted\">Los documentos de las compras de cartera no est\u00E1n disponibles para este negocio.</p>\n } @else {\n <!-- Cada pesta\u00F1a con su panel: los archivos de esa carpeta y el visor del abierto. -->\n <p-tabs [value]=\"documentsTab()\" (valueChange)=\"selectTab($event)\">\n <p-tablist>\n <p-tab value=\"certificates\">Certificado ({{ docs.certificates.length }})</p-tab>\n <p-tab value=\"payslips\">Desprendible de n\u00F3mina ({{ docs.payslips.length }})</p-tab>\n </p-tablist>\n <p-tabpanels>\n <p-tabpanel value=\"certificates\">\n @if (documentsTab() === 'certificates') {\n <ng-container *ngTemplateOutlet=\"filesTpl; context: { $implicit: docs.certificates, empty: 'La compra no tiene certificado de deuda cargado.' }\"></ng-container>\n }\n </p-tabpanel>\n <p-tabpanel value=\"payslips\">\n @if (documentsTab() === 'payslips') {\n <ng-container *ngTemplateOutlet=\"filesTpl; context: { $implicit: docs.payslips, empty: 'El titular no tiene desprendibles de n\u00F3mina cargados.' }\"></ng-container>\n }\n </p-tabpanel>\n </p-tabpanels>\n </p-tabs>\n }\n }\n }\n }\n </div>\n }\n </div>\n </section>\n }\n </div>\n }\n</p-card>\n\n<!-- Los archivos de una pesta\u00F1a: la lista (si hay m\u00E1s de uno), el abierto y su visor. -->\n<ng-template #filesTpl let-files let-empty=\"empty\">\n @if (!files.length) {\n <p class=\"sfs-muted sfs-cc-empty\">{{ empty }}</p>\n } @else {\n <div class=\"sfs-cc-docs\">\n @if (files.length > 1) {\n <ul class=\"sfs-cc-files\" role=\"list\" aria-label=\"Archivos\">\n @for (file of files; track $index) {\n <li>\n <button pButton type=\"button\" [label]=\"file.name\" icon=\"pi pi-file\" size=\"small\" [text]=\"openDocument() !== file\"\n [severity]=\"openDocument() === file ? undefined : 'secondary'\" [attr.aria-pressed]=\"openDocument() === file\"\n (click)=\"openDocument.set(file)\"></button>\n </li>\n }\n </ul>\n }\n @if (openDocument(); as file) {\n <div class=\"sfs-inline sfs-cc-file-head\">\n <span class=\"sfs-strong sfs-break\">{{ file.name }}</span>\n @if (fileDate(file); as date) { <span class=\"sfs-muted sfs-cc-small\">{{ date }}</span> }\n @if (canOpen(file)) {\n <a pButton [href]=\"file.url\" target=\"_blank\" rel=\"noopener noreferrer\" icon=\"pi pi-external-link\" label=\"Abrir en otra pesta\u00F1a\"\n [text]=\"true\" size=\"small\" severity=\"secondary\"></a>\n }\n </div>\n @if (viewerUrl(); as url) {\n @switch (viewerKind(file)) {\n @case ('pdf') { <iframe class=\"sfs-cc-viewer\" [src]=\"url\" [title]=\"file.name\"></iframe> }\n @case ('image') { <img class=\"sfs-cc-viewer sfs-cc-viewer--img\" [src]=\"file.url\" [alt]=\"file.name\" /> }\n @default { <p class=\"sfs-muted sfs-cc-empty\">Este archivo no se puede ver aqu\u00ED: \u00E1bralo en otra pesta\u00F1a.</p> }\n }\n } @else if (!file.url) {\n <p class=\"sfs-muted sfs-cc-empty\">No se encontr\u00F3 este archivo en el gestor documental: revise la carpeta en Documentos.</p>\n } @else {\n <p class=\"sfs-muted sfs-cc-empty\">Este archivo no se puede abrir: su direcci\u00F3n no es segura (no es https).</p>\n }\n }\n </div>\n }\n</ng-template>\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-cc-cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,15rem),1fr));gap:.75rem;margin:0;padding:0;list-style:none}.sfs-cc-card{display:flex;flex-direction:column;align-items:flex-start;gap:.35rem;width:100%;height:100%;min-height:2.75rem;padding:.75rem;border:1px solid var(--p-content-border-color);border-radius:var(--p-content-border-radius, 6px);background:var(--p-content-background);color:var(--p-text-color);font:inherit;text-align:left;cursor:pointer}.sfs-cc-card:hover{border-color:var(--p-primary-color)}.sfs-cc-card:focus-visible{outline:2px solid var(--p-primary-color);outline-offset:2px}.sfs-cc-card--open{border-color:var(--p-primary-color);box-shadow:inset 0 0 0 1px var(--p-primary-color)}.sfs-cc-card-top{display:flex;align-items:center;justify-content:space-between;gap:.5rem;width:100%}.sfs-cc-amount{font-size:1.125rem;font-weight:600;font-variant-numeric:tabular-nums}.sfs-cc-tags{display:flex;flex-wrap:wrap;align-items:center;gap:.5rem}.sfs-cc-small{font-size:.875rem}.sfs-cc-empty{margin:0}.sfs-cc-detail{padding-top:1rem;border-top:1px solid var(--p-content-border-color)}.sfs-cc-detail-head h3:focus{outline:none}.sfs-cc-detail-head h3:focus-visible{outline:2px solid var(--p-primary-color);outline-offset:2px}.sfs-cc-detail-body{display:grid;grid-template-columns:minmax(0,1fr);gap:1.5rem}@media (min-width: 1200px){.sfs-cc-detail-body--docs{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}}.sfs-cc-fieldset{min-width:0;margin:0;padding:0;border:0}.sfs-cc-legend{margin:0 0 .75rem;padding:0;color:var(--p-text-muted-color);font-size:.8125rem;font-weight:600;letter-spacing:.04em;text-transform:uppercase}.sfs-cc-grid{display:grid;grid-template-columns:minmax(0,1fr);gap:1rem}@media (min-width: 576px){.sfs-cc-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.sfs-cc-field--wide{grid-column:1 / -1}}.sfs-cc-field{display:flex;flex-direction:column;gap:.35rem;min-width:0}.sfs-cc-field>label{font-size:.875rem;font-weight:600}.sfs-cc-field input,.sfs-cc-field textarea,.sfs-cc-field ::ng-deep .p-inputnumber,.sfs-cc-field ::ng-deep .p-datepicker{width:100%}.sfs-cc-checks{display:flex;flex-direction:column;gap:.75rem}.sfs-cc-check{display:flex;align-items:flex-start;gap:.5rem;min-height:2.75rem}.sfs-cc-check label{display:flex;flex-direction:column;gap:.15rem;font-weight:600}.sfs-cc-check label small{font-weight:400}.sfs-cc-err{display:flex;align-items:flex-start;gap:.35rem;color:var(--p-message-error-simple-color, var(--p-text-color))}.sfs-cc-actions{justify-content:flex-end}.sfs-cc-docs{display:flex;flex-direction:column;gap:.75rem;min-width:0}.sfs-cc-files{display:flex;flex-wrap:wrap;gap:.25rem;margin:0;padding:0;list-style:none}.sfs-cc-file-head{justify-content:space-between}.sfs-cc-viewer{width:100%;height:32rem;max-height:70vh;border:1px solid var(--p-content-border-color);border-radius:var(--p-content-border-radius, 6px);background:var(--p-content-background)}.sfs-cc-viewer--img{height:auto;object-fit:contain}.sfs-cc-leave{display:block;margin-bottom:1rem}\n"] }]
1413
1836
  }], ctorParameters: () => [] });
1837
+ function isHttps(url) {
1838
+ try {
1839
+ return new URL(url).protocol === 'https:';
1840
+ }
1841
+ catch {
1842
+ return false;
1843
+ }
1844
+ }
1845
+ function emptyDraft() {
1846
+ return {
1847
+ entity: '',
1848
+ entityId: '',
1849
+ obligationNumber: '',
1850
+ installment: null,
1851
+ balance: null,
1852
+ arrears: null,
1853
+ dueDate: null,
1854
+ payslip: true,
1855
+ buy: true,
1856
+ observations: ''
1857
+ };
1858
+ }
1859
+ function toDraft(row) {
1860
+ return {
1861
+ entity: row.Entidad?.trim() ?? '',
1862
+ entityId: row.NitEntidad?.trim() ?? '',
1863
+ obligationNumber: row.NumeroObligacion?.trim() ?? '',
1864
+ installment: wholePesos(row.ValorCuota),
1865
+ balance: wholePesos(row.SaldoActual),
1866
+ arrears: wholePesos(row.SaldoMora),
1867
+ dueDate: toDate(toIsoDate(row.FechaVencimiento)),
1868
+ payslip: !!row.Desprendible,
1869
+ buy: !!row.Comprar,
1870
+ observations: row.Observaciones?.trim() ?? ''
1871
+ };
1872
+ }
1873
+ /**
1874
+ * Un valor de la compra en pesos enteros, como lo muestra y lo deja su campo (sin decimales). Si el formulario partiera
1875
+ * del valor con centavos, pasar por el campo ya contaría como un cambio y se guardaría redondeado sin que nadie lo pidiera.
1876
+ */
1877
+ function wholePesos(value) {
1878
+ return Math.round(Number(value) || 0);
1879
+ }
1880
+ /** yyyy-MM-dd a fecha local (sin pasar por UTC, que corre el día). */
1881
+ function toDate(value) {
1882
+ const match = value ? /^(\d{4})-(\d{2})-(\d{2})$/.exec(value) : null;
1883
+ return match ? new Date(Number(match[1]), Number(match[2]) - 1, Number(match[3])) : null;
1884
+ }
1885
+ function fromDate(value) {
1886
+ const pad = (part) => part.toString().padStart(2, '0');
1887
+ return `${value.getFullYear()}-${pad(value.getMonth() + 1)}-${pad(value.getDate())}`;
1888
+ }
1414
1889
 
1415
1890
  /*
1416
1891
  * API pública de @sfinges/sf-solicitud
@@ -1420,5 +1895,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
1420
1895
  * Generated bundle index. Do not edit.
1421
1896
  */
1422
1897
 
1423
- export { APPLICATION_PERSON_SERVICE, ApplicationPersonComponent, DebtBuyoutsComponent, LineSimulatorComponent, PersonEditDialogComponent };
1898
+ export { APPLICATION_PERSON_SERVICE, ApplicationPersonComponent, DEBT_BUYOUT_LIMITS, DebtBuyoutsComponent, LineSimulatorComponent, PersonEditDialogComponent };
1424
1899
  //# sourceMappingURL=sfinges-sf-solicitud.mjs.map