@sfinges/sf-solicitud 0.4.0 → 0.6.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
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';
3
+ import * as i1$1 from '@angular/common';
4
4
  import { registerLocaleData, CommonModule } from '@angular/common';
5
5
  import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
6
6
  import * as i3 from 'primeng/button';
7
7
  import { ButtonModule } from 'primeng/button';
8
- import * as i3$2 from 'primeng/card';
8
+ import * as i3$1 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,11 +17,11 @@ 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 i2 from '@angular/forms';
20
+ import * as i1 from '@angular/forms';
21
21
  import { FormGroup, FormControl, Validators, ReactiveFormsModule, FormsModule } from '@angular/forms';
22
- import * as i3$1 from 'primeng/checkbox';
22
+ import * as i4 from 'primeng/checkbox';
23
23
  import { CheckboxModule } from 'primeng/checkbox';
24
- import * as i4 from 'primeng/datepicker';
24
+ import * as i4$1 from 'primeng/datepicker';
25
25
  import { DatePickerModule } from 'primeng/datepicker';
26
26
  import * as i5 from 'primeng/dialog';
27
27
  import { DialogModule } from 'primeng/dialog';
@@ -33,9 +33,9 @@ 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
35
  import { DomSanitizer } from '@angular/platform-browser';
36
- import * as i11 from 'primeng/tabs';
36
+ import * as i12 from 'primeng/tabs';
37
37
  import { TabsModule } from 'primeng/tabs';
38
- import * as i13 from 'primeng/textarea';
38
+ import * as i14 from 'primeng/textarea';
39
39
  import { TextareaModule } from 'primeng/textarea';
40
40
 
41
41
  /**
@@ -98,7 +98,7 @@ function contactValue(type) {
98
98
  function text(value) {
99
99
  return value == null ? '' : String(value).trim();
100
100
  }
101
- let nextId$3 = 0;
101
+ let nextId$4 = 0;
102
102
  /**
103
103
  * El diálogo de edición de `lib-application-person`. Arma el formulario de lo que se edita, valida en cada campo y
104
104
  * guarda por el puerto. No se cierra mientras guarda. Al terminar emite `saved` con `saved` o `uncertain`: en los dos
@@ -121,7 +121,7 @@ class PersonEditDialogComponent {
121
121
  closed = output();
122
122
  /** Volver a pedir las listas que fallaron. */
123
123
  retryOptions = output();
124
- id = `sfs-edit-${++nextId$3}`;
124
+ id = `sfs-edit-${++nextId$4}`;
125
125
  visible = signal(true);
126
126
  saving = signal(false);
127
127
  /** Por qué no se guardó (un 4xx), para mostrarlo arriba de los botones. */
@@ -462,7 +462,7 @@ class PersonEditDialogComponent {
462
462
  afterNextRender(() => document.getElementById(elementId)?.focus(), { injector: this.injector });
463
463
  }
464
464
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: PersonEditDialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
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"] }] });
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: 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: i3.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: CheckboxModule }, { kind: "component", type: i4.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$1.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"] }] });
466
466
  }
467
467
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: PersonEditDialogComponent, decorators: [{
468
468
  type: Component,
@@ -547,7 +547,7 @@ const IDENTITY = {
547
547
  rejected: { label: 'Identidad rechazada', short: 'Rechazada', severity: 'danger', icon: 'pi pi-times-circle' },
548
548
  none: { label: 'Identidad sin validar', short: 'Sin validar', severity: 'secondary', icon: 'pi pi-question-circle' }
549
549
  };
550
- let nextId$2 = 0;
550
+ let nextId$3 = 0;
551
551
  /**
552
552
  * Titular de la solicitud: arriba lo básico (lo que trae la solicitud) y, al expandir, la persona completa, sus
553
553
  * cuentas y las demás personas. La persona y las cuentas se piden por el puerto `APPLICATION_PERSON_SERVICE` solo al
@@ -570,7 +570,7 @@ class ApplicationPersonComponent {
570
570
  */
571
571
  personUpdated = output();
572
572
  locale = LOCALE;
573
- ids = { more: `sfs-person-more-${++nextId$2}`, prefix: `sfs-person-${nextId$2}` };
573
+ ids = { more: `sfs-person-more-${++nextId$3}`, prefix: `sfs-person-${nextId$3}` };
574
574
  hasAccounts = typeof this.gateway.getAccounts === 'function';
575
575
  holder = computed(() => {
576
576
  const parties = this.parties() ?? [];
@@ -792,7 +792,7 @@ class ApplicationPersonComponent {
792
792
  return holder ? `${holder.documentType ?? ''}|${holder.documentNumber}` : null;
793
793
  }
794
794
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: ApplicationPersonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
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"] }] });
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$1.DecimalPipe, name: "number" }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i3.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain", "fluid", "label", "icon", "buttonProps"] }, { kind: "component", type: i3.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: CardModule }, { kind: "component", type: i3$1.Card, selector: "p-card", inputs: ["header", "subheader", "style", "styleClass"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: 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"] }] });
796
796
  }
797
797
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: ApplicationPersonComponent, decorators: [{
798
798
  type: Component,
@@ -808,7 +808,7 @@ const CAPACITY_FIELDS = [
808
808
  { key: 'otherDeductions', label: 'Otros descuentos' },
809
809
  { key: 'purchasesValue', label: 'Compras de cartera' }
810
810
  ];
811
- let nextId$1 = 0;
811
+ let nextId$2 = 0;
812
812
  /**
813
813
  * Simulador comercial por línea de una solicitud. Solo pinta: el host simula y guarda con su API cuando el componente
814
814
  * se lo pide (`simulate`, `save`, `retry`) y le devuelve el resultado por `simulation`, `state` y `saving`.
@@ -822,7 +822,17 @@ class LineSimulatorComponent {
822
822
  capacity = input.required();
823
823
  /** La persona puede editar la capacidad de pago (formulario de radicación); si no, es de solo lectura. */
824
824
  capacityEditable = input(false);
825
+ /**
826
+ * Con `capacityEditable`, los valores que no se corrigen aquí porque salen de otra parte (en la Fábrica, las compras de
827
+ * cartera salen de las que se marcan para comprar). Se muestran, pero no se pueden cambiar.
828
+ */
829
+ lockedCapacityFields = input([]);
825
830
  simulation = input(null);
831
+ /**
832
+ * Cómo se reparten hoy las compras de cartera que se compran (en el desprendible y por sanear), si el host lo sabe sin
833
+ * volver a simular (al marcar el desprendible, el total no cambia). Manda sobre el de `simulation`.
834
+ */
835
+ purchasesBreakdown = input(null);
826
836
  state = input('idle');
827
837
  /** Mensaje para la persona cuando `state` es `error`. */
828
838
  errorMessage = input(null);
@@ -859,7 +869,7 @@ class LineSimulatorComponent {
859
869
  locale = LOCALE;
860
870
  capacityFields = CAPACITY_FIELDS;
861
871
  ids = (() => {
862
- const n = ++nextId$1;
872
+ const n = ++nextId$2;
863
873
  return {
864
874
  line: `sfs-sim-line-${n}`,
865
875
  lineLabel: `sfs-sim-line-label-${n}`,
@@ -1057,8 +1067,8 @@ class LineSimulatorComponent {
1057
1067
  amount: l.amount,
1058
1068
  creditDiscounts: l.administrativeCharges,
1059
1069
  disbursement: l.disbursement,
1060
- purchases: s?.purchasesInPayslip ?? null,
1061
- cleanUp: s?.purchasesToCleanUp ?? null,
1070
+ purchases: this.purchasesBreakdown()?.purchasesInPayslip ?? s?.purchasesInPayslip ?? null,
1071
+ cleanUp: this.purchasesBreakdown()?.purchasesToCleanUp ?? s?.purchasesToCleanUp ?? null,
1062
1072
  net: l.transfer
1063
1073
  };
1064
1074
  });
@@ -1238,8 +1248,13 @@ class LineSimulatorComponent {
1238
1248
  this.chargeInputs.update((current) => ({ ...current, [name]: value }));
1239
1249
  }
1240
1250
  setCapacity(field, value) {
1251
+ if (this.isLocked(field))
1252
+ return;
1241
1253
  this.capacityInput.set({ ...this.currentCapacity(), [field]: value ?? 0 });
1242
1254
  }
1255
+ isLocked(field) {
1256
+ return this.lockedCapacityFields().includes(field);
1257
+ }
1243
1258
  setGarnishment(value) {
1244
1259
  this.capacityInput.set({ ...this.currentCapacity(), hasGarnishment: value });
1245
1260
  }
@@ -1331,7 +1346,7 @@ class LineSimulatorComponent {
1331
1346
  return type === 'ADMIN' ? 'Crédito' : 'Cuota';
1332
1347
  }
1333
1348
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: LineSimulatorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
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"] }] });
1349
+ 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 }, lockedCapacityFields: { classPropertyName: "lockedCapacityFields", publicName: "lockedCapacityFields", isSignal: true, isRequired: false, transformFunction: null }, simulation: { classPropertyName: "simulation", publicName: "simulation", isSignal: true, isRequired: false, transformFunction: null }, purchasesBreakdown: { classPropertyName: "purchasesBreakdown", publicName: "purchasesBreakdown", 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\"\n [disabled]=\"isLocked(field.key)\" [ariaDescribedBy]=\"isLocked(field.key) ? ids.capacity + field.key + '-locked' : undefined\"></p-inputnumber>\n @if (isLocked(field.key)) {\n <small [id]=\"ids.capacity + field.key + '-locked'\" class=\"sfs-muted\">\n {{ field.key === 'purchasesValue' ? 'Sale de las compras de cartera marcadas.' : 'No se corrige aqu\u00ED.' }}\n </small>\n }\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$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: i3.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain", "fluid", "label", "icon", "buttonProps"] }, { kind: "component", type: i3.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: CheckboxModule }, { kind: "component", type: i4.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"] }] });
1335
1350
  }
1336
1351
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: LineSimulatorComponent, decorators: [{
1337
1352
  type: Component,
@@ -1348,7 +1363,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
1348
1363
  TableModule,
1349
1364
  TagModule,
1350
1365
  TooltipModule
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"] }]
1366
+ ], 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\"\n [disabled]=\"isLocked(field.key)\" [ariaDescribedBy]=\"isLocked(field.key) ? ids.capacity + field.key + '-locked' : undefined\"></p-inputnumber>\n @if (isLocked(field.key)) {\n <small [id]=\"ids.capacity + field.key + '-locked'\" class=\"sfs-muted\">\n {{ field.key === 'purchasesValue' ? 'Sale de las compras de cartera marcadas.' : 'No se corrige aqu\u00ED.' }}\n </small>\n }\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"] }]
1352
1367
  }], ctorParameters: () => [] });
1353
1368
  /** Una tasa con coma decimal y hasta 4 decimales, como se lee en es-CO. */
1354
1369
  function formatRate(rate) {
@@ -1364,7 +1379,9 @@ function sameCapacity(a, b) {
1364
1379
 
1365
1380
  /** Largo de las columnas de PRSTMSCC: lo que pase de ahí el backend lo rechaza. */
1366
1381
  const DEBT_BUYOUT_LIMITS = { entity: 300, entityId: 20, obligationNumber: 30, observations: 100 };
1367
- let nextId = 0;
1382
+ /** Lo que se puede subir como comprobante: lo que se ve en el visor (PDF o imagen), hasta 10 MB. */
1383
+ const DEBT_BUYOUT_UPLOAD = { maxBytes: 10 * 1024 * 1024, extensions: ['.pdf', '.png', '.jpg', '.jpeg'] };
1384
+ let nextId$1 = 0;
1368
1385
  /**
1369
1386
  * Compras de cartera de la solicitud (buró, digitadas y retanqueos), como en el detalle de obligación de WE9TF: una
1370
1387
  * tarjeta por obligación (compra o saneamiento, girada o por girar, con o sin certificado) y, al abrir una, sus datos
@@ -1411,11 +1428,31 @@ class DebtBuyoutsComponent {
1411
1428
  injector = inject(Injector);
1412
1429
  locale = LOCALE;
1413
1430
  limits = DEBT_BUYOUT_LIMITS;
1414
- id = `sfs-cc-${++nextId}`;
1415
- rows = computed(() => (this.buyouts() ?? []).map((row) => ({ ...row, FechaVencimiento: toIsoDate(row.FechaVencimiento) })));
1431
+ id = `sfs-cc-${++nextId$1}`;
1432
+ /** Sube cuando un check no se guardó: las filas se vuelven a crear y el check vuelve a lo que de verdad quedó. */
1433
+ repaint = signal(0);
1434
+ /** Compras a las que se les subió un certificado aquí: la tabla lo dice sin esperar a que el host relea. */
1435
+ certified = signal(new Set());
1436
+ rows = computed(() => {
1437
+ this.repaint();
1438
+ const certified = this.certified();
1439
+ return (this.buyouts() ?? []).map((row) => ({
1440
+ ...row,
1441
+ FechaVencimiento: toIsoDate(row.FechaVencimiento),
1442
+ ConCertificado: !!row.ConCertificado || certified.has(row.IdPrstmsCC)
1443
+ }));
1444
+ });
1445
+ /** El comprobante que se está subiendo (la pestaña), el error de la última subida y el aviso para el lector. */
1446
+ uploading = signal(null);
1447
+ uploadError = signal(null);
1448
+ uploadNotice = signal('');
1449
+ uploadAccept = DEBT_BUYOUT_UPLOAD.extensions.join(',');
1416
1450
  failed = computed(() => !Array.isArray(this.buyouts()));
1417
1451
  toBuy = computed(() => this.rows().filter((row) => row.Comprar));
1418
1452
  totalToBuy = computed(() => this.toBuy().reduce((sum, row) => sum + (Number(row.SaldoActual) || 0), 0));
1453
+ installmentsToBuy = computed(() => this.toBuy().reduce((sum, row) => sum + (Number(row.ValorCuota) || 0), 0));
1454
+ /** La compra cuyo check se está guardando: mientras tanto no se marca otra. */
1455
+ marking = signal(null);
1419
1456
  /**
1420
1457
  * Lo marcado para comprar no es lo que se simula (diferencia de al menos un peso), incluido el caso de no tener
1421
1458
  * nada marcado y simular con compras.
@@ -1446,7 +1483,7 @@ class DebtBuyoutsComponent {
1446
1483
  * Mientras llega la lista nueva el formulario sigue esperando: si no, entre `done` y la lista se podría repetir el
1447
1484
  * guardado (y un alta repetida crea la compra dos veces).
1448
1485
  */
1449
- busy = computed(() => this.saving() || this.pending() || this.awaiting() !== null);
1486
+ busy = computed(() => this.saving() || this.pending() || this.awaiting() !== null || this.marking() !== null);
1450
1487
  /** Hay algo escrito sin guardar en el detalle abierto. */
1451
1488
  dirty = computed(() => {
1452
1489
  if (this.selectedId() === null || !this.canSave())
@@ -1514,7 +1551,7 @@ class DebtBuyoutsComponent {
1514
1551
  created.observations = observations;
1515
1552
  return created;
1516
1553
  }
1517
- const original = toDraft(row);
1554
+ const original = toDraft$1(row);
1518
1555
  const change = { id: row.IdPrstmsCC };
1519
1556
  if (observations !== original.observations)
1520
1557
  change.observations = observations;
@@ -1548,9 +1585,14 @@ class DebtBuyoutsComponent {
1548
1585
  /** Cambia cada vez que se abre o se cierra un detalle: una respuesta de guardado solo toca el detalle que la pidió. */
1549
1586
  session = 0;
1550
1587
  documentsSubscription;
1588
+ uploadSubscription;
1589
+ destroyRef = inject(DestroyRef);
1551
1590
  constructor() {
1552
1591
  ensureLocale();
1553
- inject(DestroyRef).onDestroy(() => this.documentsSubscription?.unsubscribe());
1592
+ this.destroyRef.onDestroy(() => {
1593
+ this.documentsSubscription?.unsubscribe();
1594
+ this.uploadSubscription?.unsubscribe();
1595
+ });
1554
1596
  // Cuando el host pasa la lista nueva: abrir la compra recién creada, recargar lo guardado o cerrar una que ya no está.
1555
1597
  effect(() => {
1556
1598
  this.rows();
@@ -1575,6 +1617,11 @@ class DebtBuyoutsComponent {
1575
1617
  }
1576
1618
  }, { injector: this.injector });
1577
1619
  });
1620
+ // Los certificados subidos aquí son de esta solicitud: si el host pasa otra, se olvidan.
1621
+ effect(() => {
1622
+ this.applicationId();
1623
+ untracked(() => this.certified.set(new Set()));
1624
+ });
1578
1625
  // Solo cuando cambia: el host no recibe un false repetido al abrir otra compra sin escribir nada.
1579
1626
  let lastDirty = false;
1580
1627
  effect(() => {
@@ -1585,6 +1632,43 @@ class DebtBuyoutsComponent {
1585
1632
  untracked(() => this.dirtyChange.emit(dirty));
1586
1633
  });
1587
1634
  }
1635
+ /**
1636
+ * El check de una fila se puede tocar: con permiso, sin otro guardado en curso, si no está girada (el backend la
1637
+ * rechaza) y si su detalle no está abierto (ahí se marca en el formulario, para no pisar lo que se está escribiendo).
1638
+ */
1639
+ canMark(row) {
1640
+ return this.canEdit() && !this.markBlockedReason(row) && !this.busy();
1641
+ }
1642
+ /** Por qué el check de una fila no se puede tocar (un check deshabilitado no recibe foco: el motivo va en la celda). */
1643
+ markBlockedReason(row) {
1644
+ if (row.Girado)
1645
+ return 'Girada: no se cambia';
1646
+ if (this.selectedId() === row.IdPrstmsCC)
1647
+ return 'Se marca en su detalle';
1648
+ return null;
1649
+ }
1650
+ /**
1651
+ * Un check de la tabla: guarda al momento, como siempre. Si el host no lo guarda, la lista se vuelve a pintar para
1652
+ * que el check vuelva a lo que de verdad quedó.
1653
+ */
1654
+ quickMark(row, change) {
1655
+ if (!this.canMark(row))
1656
+ return;
1657
+ this.marking.set(row.IdPrstmsCC);
1658
+ let answered = false;
1659
+ this.save.emit({
1660
+ change: { id: row.IdPrstmsCC, ...change },
1661
+ done: (result) => {
1662
+ if (answered)
1663
+ return;
1664
+ answered = true;
1665
+ this.marking.set(null);
1666
+ // Con un rechazo o sin respuesta clara el check pudo no quedar: se repinta con lo que traiga la lista.
1667
+ if (result !== 'saved')
1668
+ this.repaint.update((value) => value + 1);
1669
+ }
1670
+ });
1671
+ }
1588
1672
  /** Abre una compra: su formulario y sus documentos. Pulsar la que está abierta la cierra. */
1589
1673
  toggle(row) {
1590
1674
  if (this.selectedId() === row.IdPrstmsCC)
@@ -1694,7 +1778,7 @@ class DebtBuyoutsComponent {
1694
1778
  /** Descarta lo escrito y vuelve a lo guardado. */
1695
1779
  reset() {
1696
1780
  const row = this.selected();
1697
- this.draft.set(row ? toDraft(row) : emptyDraft());
1781
+ this.draft.set(row ? toDraft$1(row) : emptyDraft());
1698
1782
  this.submitted.set(false);
1699
1783
  this.leaving.set(null);
1700
1784
  }
@@ -1730,10 +1814,6 @@ class DebtBuyoutsComponent {
1730
1814
  cardId(id) {
1731
1815
  return `${this.id}-card-${id}`;
1732
1816
  }
1733
- /** Compra (aparece en el desprendible) o saneamiento (no aparece). */
1734
- kind(row) {
1735
- return row.Desprendible ? 'Compra' : 'Saneamiento';
1736
- }
1737
1817
  /** Nombre de la obligación para el lector de pantalla: la entidad y el número. */
1738
1818
  rowName(row) {
1739
1819
  return [row.Entidad, row.NumeroObligacion].filter((part) => !!part?.toString().trim()).join(' ') || `compra ${row.IdPrstmsCC}`;
@@ -1754,7 +1834,7 @@ class DebtBuyoutsComponent {
1754
1834
  }
1755
1835
  const saved = this.selected();
1756
1836
  if (saved)
1757
- this.draft.set(toDraft(saved));
1837
+ this.draft.set(toDraft$1(saved));
1758
1838
  }
1759
1839
  const id = this.selectedId();
1760
1840
  // La compra ya no está (la lista se volvió a leer): se cierra el detalle.
@@ -1770,17 +1850,88 @@ class DebtBuyoutsComponent {
1770
1850
  open(row, focus) {
1771
1851
  this.moved();
1772
1852
  this.selectedId.set(row.IdPrstmsCC);
1773
- this.draft.set(toDraft(row));
1853
+ this.draft.set(toDraft$1(row));
1774
1854
  this.submitted.set(false);
1775
1855
  this.loadDocuments(row.IdPrstmsCC);
1776
1856
  if (focus)
1777
1857
  this.focusAfterRender(`${this.id}-detail-title`);
1778
1858
  }
1779
- /** Pide los documentos de la compra abierta y cancela lo que estuviera pidiendo de otra. */
1780
- loadDocuments(id) {
1859
+ /** Se puede subir ese comprobante a la compra abierta: el puerto lo permite y la persona puede guardar algo de ella. */
1860
+ canUpload(tab) {
1861
+ const gateway = this.gateway;
1862
+ if (!gateway || !this.selected() || !this.canSave())
1863
+ return false;
1864
+ return tab === 'certificates' ? !!gateway.uploadDebtBuyoutCertificate : !!gateway.uploadDebtBuyoutPayslip;
1865
+ }
1866
+ /** El archivo que se eligió para esa pestaña: se revisa aquí y se sube por el puerto. */
1867
+ upload(tab, input) {
1868
+ const file = input.files?.[0] ?? null;
1869
+ // Se limpia para poder volver a elegir el mismo archivo después de un error.
1870
+ input.value = '';
1871
+ const id = this.selectedId();
1872
+ const applicationId = this.applicationId();
1873
+ const gateway = this.gateway;
1874
+ if (!file || !id || !applicationId || !gateway || !this.canUpload(tab) || this.uploading() !== null)
1875
+ return;
1876
+ this.uploadError.set(null);
1877
+ this.uploadNotice.set('');
1878
+ const extension = file.name.includes('.') ? file.name.slice(file.name.lastIndexOf('.')).toLowerCase() : '';
1879
+ if (!DEBT_BUYOUT_UPLOAD.extensions.includes(extension)) {
1880
+ this.uploadError.set('El archivo tiene que ser un PDF o una imagen (PNG o JPG).');
1881
+ return;
1882
+ }
1883
+ if (!file.size) {
1884
+ this.uploadError.set('El archivo está vacío.');
1885
+ return;
1886
+ }
1887
+ if (file.size > DEBT_BUYOUT_UPLOAD.maxBytes) {
1888
+ this.uploadError.set('El archivo pasa de 10 MB.');
1889
+ return;
1890
+ }
1891
+ const call = tab === 'certificates' ? gateway.uploadDebtBuyoutCertificate(applicationId, id, file) : gateway.uploadDebtBuyoutPayslip(applicationId, id, file);
1892
+ const what = tab === 'certificates' ? 'el certificado' : 'el desprendible';
1893
+ this.uploading.set(tab);
1894
+ this.uploadSubscription = call.subscribe({
1895
+ next: () => {
1896
+ this.uploading.set(null);
1897
+ if (tab === 'certificates')
1898
+ this.certified.update((ids) => new Set(ids).add(id));
1899
+ // Si la persona ya abrió otra compra, el aviso y la recarga no son de lo que está viendo.
1900
+ if (this.selectedId() !== id)
1901
+ return;
1902
+ this.uploadNotice.set(`Se cargó ${what}.`);
1903
+ this.loadDocuments(id, tab);
1904
+ // La relectura desmonta el botón: el foco vuelve a él cuando reaparece.
1905
+ this.focusWhenReady(`${this.id}-upload-${tab}`);
1906
+ },
1907
+ error: (error) => {
1908
+ this.uploading.set(null);
1909
+ if (this.selectedId() !== id)
1910
+ return;
1911
+ const { status, message } = (error ?? {});
1912
+ if (typeof status === 'number' && status >= 400 && status < 500) {
1913
+ this.uploadError.set(typeof message === 'string' && message.trim() ? message : `No se pudo cargar ${what}.`);
1914
+ return;
1915
+ }
1916
+ // Sin respuesta clara pudo haber quedado: se releen los documentos antes de dejar subirlo otra vez.
1917
+ this.uploadError.set(`No se pudo confirmar si se cargó ${what}. Revise los documentos antes de volver a subirlo.`);
1918
+ this.loadDocuments(id, tab);
1919
+ this.focusWhenReady(`${this.id}-upload-${tab}`);
1920
+ }
1921
+ });
1922
+ }
1923
+ /**
1924
+ * Pide los documentos de la compra abierta y cancela lo que estuviera pidiendo de otra. Con `keepTab` (después de
1925
+ * subir un comprobante) se queda en esa pestaña y conserva los avisos de la subida.
1926
+ */
1927
+ loadDocuments(id, keepTab) {
1781
1928
  this.documentsSubscription?.unsubscribe();
1782
1929
  this.documentsSubscription = undefined;
1783
1930
  this.openDocument.set(null);
1931
+ if (!keepTab) {
1932
+ this.uploadError.set(null);
1933
+ this.uploadNotice.set('');
1934
+ }
1784
1935
  const applicationId = this.applicationId();
1785
1936
  const gateway = this.gateway;
1786
1937
  if (!id || !applicationId || !gateway?.getDebtBuyoutDocuments) {
@@ -1800,11 +1951,21 @@ class DebtBuyoutsComponent {
1800
1951
  });
1801
1952
  const ready = this.readyDocuments();
1802
1953
  // 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');
1954
+ this.selectTab(keepTab ?? (ready && !ready.certificates.length && ready.payslips.length ? 'payslips' : 'certificates'));
1804
1955
  },
1805
1956
  error: () => this.documents.set({ status: 'error' })
1806
1957
  });
1807
1958
  }
1959
+ /** Enfoca ese elemento cuando aparezca (después de una carga), sin esperar más de unos segundos. */
1960
+ focusWhenReady(elementId, attempts = 40) {
1961
+ const target = this.host.nativeElement.querySelector(`#${CSS.escape(elementId)}`);
1962
+ if (target) {
1963
+ target.focus();
1964
+ return;
1965
+ }
1966
+ if (attempts > 0 && this.documents().status !== 'error')
1967
+ setTimeout(() => this.focusWhenReady(elementId, attempts - 1), 100);
1968
+ }
1808
1969
  focusAfterRender(elementId) {
1809
1970
  afterNextRender(() => {
1810
1971
  const target = this.host.nativeElement.querySelector(`#${CSS.escape(elementId)}`);
@@ -1814,7 +1975,7 @@ class DebtBuyoutsComponent {
1814
1975
  }, { injector: this.injector });
1815
1976
  }
1816
1977
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: DebtBuyoutsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
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"] }] });
1978
+ 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-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\">\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 <!-- La tabla de siempre: los checks marcan al momento; \"Detalle\" abre la compra con sus datos y documentos. -->\n <p-table [value]=\"rows()\" styleClass=\"p-datatable-sm sfs-stack-table\" [scrollable]=\"true\" dataKey=\"IdPrstmsCC\"\n [attr.aria-busy]=\"marking() !== null ? 'true' : null\">\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>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 <th><span class=\"sfs-sr-only\">Detalle</span></th>\n </tr>\n </ng-template>\n <ng-template #body let-row>\n <tr [class.sfs-cc-row--open]=\"selectedId() === row.IdPrstmsCC\">\n <td data-label=\"Comprar\">\n @if (canEdit()) {\n <p-checkbox [binary]=\"true\" [ngModel]=\"row.Comprar\" [disabled]=\"!canMark(row)\" [ariaLabel]=\"'Comprar ' + rowName(row)\"\n (onChange)=\"quickMark(row, { buy: $event.checked })\"></p-checkbox>\n @if (markBlockedReason(row); as reason) { <br /><small class=\"sfs-muted\">{{ reason }}</small> }\n } @else {\n {{ row.Comprar ? 'S\u00ED' : 'No' }}\n }\n </td>\n <td data-label=\"Desprendible\">\n @if (canEdit()) {\n <p-checkbox [binary]=\"true\" [ngModel]=\"row.Desprendible\" [disabled]=\"!canMark(row)\"\n [ariaLabel]=\"rowName(row) + ' aparece en el desprendible'\" (onChange)=\"quickMark(row, { payslip: $event.checked })\"></p-checkbox>\n } @else {\n {{ row.Desprendible ? 'S\u00ED' : 'No' }}\n }\n </td>\n <td class=\"sfs-stack-title\">\n {{ row.Entidad || 'Sin entidad' }}\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=\"Estado\">\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 <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 </small>\n </span>\n @if (row.Paso) { <br /><small class=\"sfs-muted\">{{ row.Paso }}</small> }\n </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 <td data-label=\"Detalle\">\n <button pButton type=\"button\" [id]=\"cardId(row.IdPrstmsCC)\" label=\"Detalle\" size=\"small\" severity=\"secondary\"\n [icon]=\"selectedId() === row.IdPrstmsCC ? 'pi pi-chevron-up' : 'pi pi-chevron-down'\" [outlined]=\"selectedId() !== row.IdPrstmsCC\"\n [attr.aria-label]=\"'Detalle de ' + rowName(row)\" [attr.aria-expanded]=\"selectedId() === row.IdPrstmsCC\"\n [attr.aria-controls]=\"selectedId() === row.IdPrstmsCC ? id + '-detail' : null\" (click)=\"toggle(row)\"></button>\n </td>\n </tr>\n </ng-template>\n <ng-template #footer>\n <tr class=\"sfs-stack-hide\">\n <td colspan=\"6\" 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 colspan=\"2\"></td>\n </tr>\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 } @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 <!-- Fuera de lo que se vuelve a cargar: la regi\u00F3n ya est\u00E1 montada cuando llega el aviso. -->\n <span class=\"sfs-sr-only\" aria-live=\"polite\">{{ uploadNotice() }}</span>\n @if (uploadNotice(); as notice) {\n <p-message severity=\"success\" icon=\"pi pi-check\" class=\"sfs-cc-upload-msg\">{{ notice }}</p-message>\n }\n @if (uploadError(); as error) {\n <p-message severity=\"error\" icon=\"pi pi-exclamation-circle\" class=\"sfs-cc-upload-msg\">{{ error }}</p-message>\n }\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, tab: '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, tab: '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\" let-tab=\"tab\">\n <!-- Subir un comprobante a esta pesta\u00F1a: el bot\u00F3n abre el selector de archivos (el input queda oculto). -->\n @if (canUpload(tab)) {\n <div class=\"sfs-inline sfs-cc-upload\">\n <input #picker type=\"file\" class=\"sfs-sr-only\" tabindex=\"-1\" aria-hidden=\"true\" [accept]=\"uploadAccept\" (change)=\"upload(tab, picker)\" />\n <button pButton type=\"button\" [id]=\"id + '-upload-' + tab\" size=\"small\" icon=\"pi pi-upload\" [label]=\"tab === 'certificates' ? 'Subir certificado' : 'Subir desprendible'\"\n [loading]=\"uploading() === tab\" [disabled]=\"uploading() !== null\" (click)=\"picker.click()\"></button>\n <small class=\"sfs-muted\">PDF o imagen (PNG o JPG), hasta 10 MB.</small>\n </div>\n }\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", ":host ::ng-deep .sfs-cc-row--open>td:first-child{box-shadow:inset 3px 0 0 var(--p-primary-color)}.sfs-cc-upload,.sfs-cc-upload-msg{display:flex;margin-bottom:.75rem}.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$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i1$1.CurrencyPipe, name: "currency" }, { kind: "ngmodule", type: FormsModule }, { 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.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i1.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$1.Card, selector: "p-card", inputs: ["header", "subheader", "style", "styleClass"] }, { kind: "ngmodule", type: CheckboxModule }, { kind: "component", type: i4.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$1.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: 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: TabsModule }, { kind: "component", type: i12.Tabs, selector: "p-tabs", inputs: ["value", "scrollable", "lazy", "selectOnFocus", "showNavigators", "tabindex"], outputs: ["valueChange"] }, { kind: "component", type: i12.TabPanels, selector: "p-tabpanels" }, { kind: "component", type: i12.TabPanel, selector: "p-tabpanel", inputs: ["value"], outputs: ["valueChange"] }, { kind: "component", type: i12.TabList, selector: "p-tablist" }, { kind: "component", type: i12.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: i14.Textarea, selector: "[pTextarea], [pInputTextarea]", inputs: ["autoResize", "variant", "fluid", "pSize"], outputs: ["onResize"] }] });
1818
1979
  }
1819
1980
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: DebtBuyoutsComponent, decorators: [{
1820
1981
  type: Component,
@@ -1829,10 +1990,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
1829
1990
  InputTextModule,
1830
1991
  MessageModule,
1831
1992
  SkeletonModule,
1993
+ TableModule,
1832
1994
  TabsModule,
1833
1995
  TagModule,
1834
1996
  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"] }]
1997
+ ], 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-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\">\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 <!-- La tabla de siempre: los checks marcan al momento; \"Detalle\" abre la compra con sus datos y documentos. -->\n <p-table [value]=\"rows()\" styleClass=\"p-datatable-sm sfs-stack-table\" [scrollable]=\"true\" dataKey=\"IdPrstmsCC\"\n [attr.aria-busy]=\"marking() !== null ? 'true' : null\">\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>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 <th><span class=\"sfs-sr-only\">Detalle</span></th>\n </tr>\n </ng-template>\n <ng-template #body let-row>\n <tr [class.sfs-cc-row--open]=\"selectedId() === row.IdPrstmsCC\">\n <td data-label=\"Comprar\">\n @if (canEdit()) {\n <p-checkbox [binary]=\"true\" [ngModel]=\"row.Comprar\" [disabled]=\"!canMark(row)\" [ariaLabel]=\"'Comprar ' + rowName(row)\"\n (onChange)=\"quickMark(row, { buy: $event.checked })\"></p-checkbox>\n @if (markBlockedReason(row); as reason) { <br /><small class=\"sfs-muted\">{{ reason }}</small> }\n } @else {\n {{ row.Comprar ? 'S\u00ED' : 'No' }}\n }\n </td>\n <td data-label=\"Desprendible\">\n @if (canEdit()) {\n <p-checkbox [binary]=\"true\" [ngModel]=\"row.Desprendible\" [disabled]=\"!canMark(row)\"\n [ariaLabel]=\"rowName(row) + ' aparece en el desprendible'\" (onChange)=\"quickMark(row, { payslip: $event.checked })\"></p-checkbox>\n } @else {\n {{ row.Desprendible ? 'S\u00ED' : 'No' }}\n }\n </td>\n <td class=\"sfs-stack-title\">\n {{ row.Entidad || 'Sin entidad' }}\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=\"Estado\">\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 <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 </small>\n </span>\n @if (row.Paso) { <br /><small class=\"sfs-muted\">{{ row.Paso }}</small> }\n </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 <td data-label=\"Detalle\">\n <button pButton type=\"button\" [id]=\"cardId(row.IdPrstmsCC)\" label=\"Detalle\" size=\"small\" severity=\"secondary\"\n [icon]=\"selectedId() === row.IdPrstmsCC ? 'pi pi-chevron-up' : 'pi pi-chevron-down'\" [outlined]=\"selectedId() !== row.IdPrstmsCC\"\n [attr.aria-label]=\"'Detalle de ' + rowName(row)\" [attr.aria-expanded]=\"selectedId() === row.IdPrstmsCC\"\n [attr.aria-controls]=\"selectedId() === row.IdPrstmsCC ? id + '-detail' : null\" (click)=\"toggle(row)\"></button>\n </td>\n </tr>\n </ng-template>\n <ng-template #footer>\n <tr class=\"sfs-stack-hide\">\n <td colspan=\"6\" 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 colspan=\"2\"></td>\n </tr>\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 } @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 <!-- Fuera de lo que se vuelve a cargar: la regi\u00F3n ya est\u00E1 montada cuando llega el aviso. -->\n <span class=\"sfs-sr-only\" aria-live=\"polite\">{{ uploadNotice() }}</span>\n @if (uploadNotice(); as notice) {\n <p-message severity=\"success\" icon=\"pi pi-check\" class=\"sfs-cc-upload-msg\">{{ notice }}</p-message>\n }\n @if (uploadError(); as error) {\n <p-message severity=\"error\" icon=\"pi pi-exclamation-circle\" class=\"sfs-cc-upload-msg\">{{ error }}</p-message>\n }\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, tab: '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, tab: '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\" let-tab=\"tab\">\n <!-- Subir un comprobante a esta pesta\u00F1a: el bot\u00F3n abre el selector de archivos (el input queda oculto). -->\n @if (canUpload(tab)) {\n <div class=\"sfs-inline sfs-cc-upload\">\n <input #picker type=\"file\" class=\"sfs-sr-only\" tabindex=\"-1\" aria-hidden=\"true\" [accept]=\"uploadAccept\" (change)=\"upload(tab, picker)\" />\n <button pButton type=\"button\" [id]=\"id + '-upload-' + tab\" size=\"small\" icon=\"pi pi-upload\" [label]=\"tab === 'certificates' ? 'Subir certificado' : 'Subir desprendible'\"\n [loading]=\"uploading() === tab\" [disabled]=\"uploading() !== null\" (click)=\"picker.click()\"></button>\n <small class=\"sfs-muted\">PDF o imagen (PNG o JPG), hasta 10 MB.</small>\n </div>\n }\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", ":host ::ng-deep .sfs-cc-row--open>td:first-child{box-shadow:inset 3px 0 0 var(--p-primary-color)}.sfs-cc-upload,.sfs-cc-upload-msg{display:flex;margin-bottom:.75rem}.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"] }]
1836
1998
  }], ctorParameters: () => [] });
1837
1999
  function isHttps(url) {
1838
2000
  try {
@@ -1856,7 +2018,7 @@ function emptyDraft() {
1856
2018
  observations: ''
1857
2019
  };
1858
2020
  }
1859
- function toDraft(row) {
2021
+ function toDraft$1(row) {
1860
2022
  return {
1861
2023
  entity: row.Entidad?.trim() ?? '',
1862
2024
  entityId: row.NitEntidad?.trim() ?? '',
@@ -1887,6 +2049,196 @@ function fromDate(value) {
1887
2049
  return `${value.getFullYear()}-${pad(value.getMonth() + 1)}-${pad(value.getDate())}`;
1888
2050
  }
1889
2051
 
2052
+ /** Largo de lo que guarda una captura (el SP recibe varchar(150)). */
2053
+ const LEGAL_RISK_MAX_LENGTH = 150;
2054
+ /** Antigüedad del embargo: de 0 a 100 años, en meses. */
2055
+ const LEGAL_MAX_MONTHS = 1200;
2056
+ let nextId = 0;
2057
+ /**
2058
+ * Los datos legales de la solicitud: si posee embargo, de qué tipo y hace cuánto, si está en insolvencia y su riesgo
2059
+ * reputacional. Con `canEdit` se corrigen aquí; la librería no guarda: emite `save` con lo que cambió y el host guarda,
2060
+ * pasa los datos nuevos en `legal` y llama `done`. Sin permiso se muestran de solo lectura, con el motivo en
2061
+ * `readonlyReason`.
2062
+ */
2063
+ class ApplicationLegalComponent {
2064
+ /** Los datos guardados. `null` o `undefined` mientras el host los lee. */
2065
+ legal = input(null);
2066
+ canEdit = input(false);
2067
+ /** El host está guardando algo de la solicitud: el formulario espera. */
2068
+ saving = input(false);
2069
+ /** Por qué no se puede editar (sin `canEdit`). */
2070
+ readonlyReason = input(null);
2071
+ save = output();
2072
+ /** Si hay algo escrito sin guardar: el host lo suma a su aviso de salir de la pantalla. */
2073
+ dirtyChange = output();
2074
+ id = `sfs-legal-${++nextId}`;
2075
+ riskMax = LEGAL_RISK_MAX_LENGTH;
2076
+ maxMonths = LEGAL_MAX_MONTHS;
2077
+ draft = signal(null);
2078
+ pending = signal(false);
2079
+ submitted = signal(false);
2080
+ busy = computed(() => this.saving() || this.pending());
2081
+ /** Las opciones de tipo de embargo; si lo guardado no está entre ellas, se agrega para no perderlo. */
2082
+ typeOptions = computed(() => {
2083
+ const legal = this.legal();
2084
+ const options = [...(legal?.garnishmentTypes ?? [])];
2085
+ const saved = legal?.garnishmentType?.trim();
2086
+ if (saved && !options.some((o) => o.toLowerCase() === saved.toLowerCase()))
2087
+ options.push(saved);
2088
+ return options.map((value) => ({ value, label: value }));
2089
+ });
2090
+ errors = computed(() => {
2091
+ const draft = this.draft();
2092
+ const errors = {};
2093
+ if (!draft)
2094
+ return errors;
2095
+ const months = draft.garnishmentMonths;
2096
+ // Una captura no se borra: si ya tenía antigüedad, no se puede dejar vacía (0 si no tiene embargo).
2097
+ if (months === null && this.legal()?.garnishmentMonths != null)
2098
+ errors.months = 'Escriba la antigüedad en meses (0 si no aplica).';
2099
+ else if (months !== null && (!Number.isInteger(months) || months < 0 || months > LEGAL_MAX_MONTHS))
2100
+ errors.months = `La antigüedad va de 0 a ${LEGAL_MAX_MONTHS} meses.`;
2101
+ if (draft.reputationalRisk.trim().length > LEGAL_RISK_MAX_LENGTH)
2102
+ errors.risk = `El riesgo reputacional no puede pasar de ${LEGAL_RISK_MAX_LENGTH} caracteres.`;
2103
+ return errors;
2104
+ });
2105
+ /** Lo que cambió frente a lo guardado; null si nada. */
2106
+ changes = computed(() => {
2107
+ const draft = this.draft();
2108
+ const legal = this.legal();
2109
+ if (!draft || !legal)
2110
+ return null;
2111
+ const saved = toDraft(legal);
2112
+ const changes = {};
2113
+ if (draft.hasGarnishment !== saved.hasGarnishment)
2114
+ changes.hasGarnishment = draft.hasGarnishment;
2115
+ if (draft.garnishmentType && draft.garnishmentType !== saved.garnishmentType)
2116
+ changes.garnishmentType = draft.garnishmentType;
2117
+ if (draft.garnishmentMonths !== null && draft.garnishmentMonths !== saved.garnishmentMonths)
2118
+ changes.garnishmentMonths = draft.garnishmentMonths;
2119
+ if (draft.insolvency !== saved.insolvency)
2120
+ changes.insolvency = draft.insolvency;
2121
+ if (draft.reputationalRisk.trim() !== saved.reputationalRisk.trim())
2122
+ changes.reputationalRisk = draft.reputationalRisk.trim();
2123
+ return Object.keys(changes).length ? changes : null;
2124
+ });
2125
+ dirty = computed(() => this.canEdit() && this.changes() !== null);
2126
+ /**
2127
+ * Tras guardar, los datos que había al enviar: cuando el host pase otros (antes o después de `done`), el borrador se
2128
+ * rehace con ellos.
2129
+ */
2130
+ awaitingFrom = undefined;
2131
+ awaiting = false;
2132
+ /** Los datos sobre los que se armó el borrador: con ellos se sabe qué campos tocó la persona. */
2133
+ base = null;
2134
+ constructor() {
2135
+ effect(() => {
2136
+ const legal = this.legal();
2137
+ untracked(() => {
2138
+ const base = this.base;
2139
+ this.base = legal ?? null;
2140
+ if (!legal) {
2141
+ this.draft.set(null);
2142
+ return;
2143
+ }
2144
+ const draft = this.draft();
2145
+ if (!draft || !base || (this.awaiting && legal !== this.awaitingFrom)) {
2146
+ this.awaiting = false;
2147
+ this.draft.set(toDraft(legal));
2148
+ return;
2149
+ }
2150
+ // Una relectura del host trae lo que cambió afuera (el embargo se guarda también con las condiciones): cada
2151
+ // campo que la persona no tocó toma el valor nuevo; lo que sí escribió se queda.
2152
+ this.draft.set(rebase(draft, toDraft(base), toDraft(legal)));
2153
+ });
2154
+ });
2155
+ let lastDirty = false;
2156
+ effect(() => {
2157
+ const dirty = this.dirty();
2158
+ if (dirty === lastDirty)
2159
+ return;
2160
+ lastDirty = dirty;
2161
+ untracked(() => this.dirtyChange.emit(dirty));
2162
+ });
2163
+ }
2164
+ patch(changes) {
2165
+ const draft = this.draft();
2166
+ if (draft)
2167
+ this.draft.set({ ...draft, ...changes });
2168
+ }
2169
+ reset() {
2170
+ const legal = this.legal();
2171
+ if (legal)
2172
+ this.draft.set(toDraft(legal));
2173
+ this.submitted.set(false);
2174
+ }
2175
+ submit() {
2176
+ if (!this.canEdit() || this.busy())
2177
+ return;
2178
+ this.submitted.set(true);
2179
+ const errors = this.errors();
2180
+ if (errors.months || errors.risk) {
2181
+ const field = errors.months ? 'months' : 'risk';
2182
+ queueMicrotask(() => document.getElementById(`${this.id}-${field}`)?.focus());
2183
+ return;
2184
+ }
2185
+ const changes = this.changes();
2186
+ if (!changes)
2187
+ return;
2188
+ const before = this.legal();
2189
+ this.pending.set(true);
2190
+ let answered = false;
2191
+ this.save.emit({
2192
+ changes,
2193
+ done: (result) => {
2194
+ if (answered)
2195
+ return;
2196
+ answered = true;
2197
+ this.pending.set(false);
2198
+ if (result === 'refused')
2199
+ return;
2200
+ // Con 'saved' o 'unknown' el host pasa los datos que quedaron: el borrador se rehace con ellos.
2201
+ this.submitted.set(false);
2202
+ const legal = this.legal();
2203
+ if (legal && legal !== before)
2204
+ this.draft.set(toDraft(legal));
2205
+ else {
2206
+ this.awaitingFrom = before;
2207
+ this.awaiting = true;
2208
+ }
2209
+ }
2210
+ });
2211
+ }
2212
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: ApplicationLegalComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2213
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: ApplicationLegalComponent, isStandalone: true, selector: "lib-application-legal", inputs: { legal: { classPropertyName: "legal", publicName: "legal", 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 }, readonlyReason: { classPropertyName: "readonlyReason", publicName: "readonlyReason", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { save: "save", dirtyChange: "dirtyChange" }, ngImport: i0, template: "<p-card>\n <div class=\"sfs-head\">\n <h2 class=\"sfs-title\" [id]=\"id + '-title'\">Datos legales</h2>\n </div>\n\n @if (!legal()) {\n <div class=\"sfs-stack\" aria-busy=\"true\">\n <p-skeleton height=\"2.5rem\"></p-skeleton>\n <p-skeleton height=\"5rem\"></p-skeleton>\n </div>\n } @else if (!canEdit()) {\n <!-- Sin permiso: lo guardado, de solo lectura, y por qu\u00E9 no se puede cambiar. -->\n @if (readonlyReason()) {\n <p-message severity=\"info\" icon=\"pi pi-lock\" class=\"sfs-legal-msg\">{{ readonlyReason() }}</p-message>\n }\n @if (legal(); as l) {\n <dl class=\"sfs-legal-view\">\n <div><dt>Posee embargo</dt><dd>{{ l.hasGarnishment == null ? '\u2014' : l.hasGarnishment ? 'S\u00ED' : 'No' }}</dd></div>\n <div><dt>Tipo de embargo</dt><dd>{{ l.garnishmentType || '\u2014' }}</dd></div>\n <div><dt>Antig\u00FCedad del embargo</dt><dd>{{ l.garnishmentMonths != null ? l.garnishmentMonths + (l.garnishmentMonths === 1 ? ' mes' : ' meses') : '\u2014' }}</dd></div>\n <div><dt>Insolvencia</dt><dd>{{ l.insolvency == null ? '\u2014' : l.insolvency ? 'S\u00ED' : 'No' }}</dd></div>\n <div class=\"sfs-legal-wide\"><dt>Riesgo reputacional</dt><dd class=\"sfs-break\">{{ l.reputationalRisk || '\u2014' }}</dd></div>\n </dl>\n }\n } @else {\n @if (draft(); as d) {\n <form class=\"sfs-stack\" (ngSubmit)=\"submit()\" novalidate [attr.aria-labelledby]=\"id + '-title'\" [attr.aria-busy]=\"busy() ? 'true' : null\">\n <div class=\"sfs-legal-grid\">\n <div class=\"sfs-legal-check\">\n <p-checkbox [inputId]=\"id + '-garnishment'\" name=\"hasGarnishment\" [binary]=\"true\" [disabled]=\"busy()\"\n [ngModel]=\"d.hasGarnishment\" (ngModelChange)=\"patch({ hasGarnishment: $event })\"></p-checkbox>\n <label [for]=\"id + '-garnishment'\">Posee embargo</label>\n </div>\n <div class=\"sfs-legal-check\">\n <p-checkbox [inputId]=\"id + '-insolvency'\" name=\"insolvency\" [binary]=\"true\" [disabled]=\"busy()\"\n [ngModel]=\"d.insolvency\" (ngModelChange)=\"patch({ insolvency: $event })\"></p-checkbox>\n <label [for]=\"id + '-insolvency'\">Insolvencia</label>\n </div>\n <div class=\"sfs-legal-field\">\n <label [for]=\"id + '-type'\">Tipo de embargo</label>\n <p-select [inputId]=\"id + '-type'\" name=\"garnishmentType\" [options]=\"typeOptions()\" optionLabel=\"label\" optionValue=\"value\"\n placeholder=\"Seleccione el tipo\" [disabled]=\"busy()\" appendTo=\"body\" [fluid]=\"true\"\n [ngModel]=\"d.garnishmentType\" (ngModelChange)=\"patch({ garnishmentType: $event })\"></p-select>\n </div>\n <div class=\"sfs-legal-field\">\n <label [for]=\"id + '-months'\">Antig\u00FCedad del embargo (meses)</label>\n <p-inputnumber [inputId]=\"id + '-months'\" name=\"garnishmentMonths\" [min]=\"0\" [max]=\"maxMonths\" [maxFractionDigits]=\"0\" [useGrouping]=\"false\"\n [disabled]=\"busy()\" [fluid]=\"true\" [ariaDescribedBy]=\"submitted() && errors().months ? id + '-months-err' : undefined\"\n [ngModel]=\"d.garnishmentMonths\" (ngModelChange)=\"patch({ garnishmentMonths: $event })\"></p-inputnumber>\n @if (submitted() && errors().months; as error) {\n <small [id]=\"id + '-months-err'\" class=\"sfs-legal-err\"><i class=\"pi pi-exclamation-circle\" aria-hidden=\"true\"></i>{{ error }}</small>\n }\n </div>\n <div class=\"sfs-legal-field sfs-legal-wide\">\n <label [for]=\"id + '-risk'\">Riesgo reputacional</label>\n <textarea pTextarea [id]=\"id + '-risk'\" name=\"reputationalRisk\" rows=\"2\" [maxlength]=\"riskMax\" [disabled]=\"busy()\"\n [attr.aria-invalid]=\"submitted() && errors().risk ? 'true' : null\"\n [attr.aria-describedby]=\"(submitted() && errors().risk ? id + '-risk-err ' : '') + id + '-risk-count'\"\n [ngModel]=\"d.reputationalRisk\" (ngModelChange)=\"patch({ reputationalRisk: $event })\"></textarea>\n <small [id]=\"id + '-risk-count'\" class=\"sfs-muted\">{{ d.reputationalRisk.length }} de {{ riskMax }} caracteres. Vac\u00EDo se guarda como \"N/A\".</small>\n @if (submitted() && errors().risk; as error) {\n <small [id]=\"id + '-risk-err'\" class=\"sfs-legal-err\"><i class=\"pi pi-exclamation-circle\" aria-hidden=\"true\"></i>{{ error }}</small>\n }\n </div>\n </div>\n <div class=\"sfs-inline sfs-legal-actions\">\n <p-button type=\"button\" label=\"Descartar cambios\" severity=\"secondary\" [text]=\"true\" [disabled]=\"busy() || !changes()\" (onClick)=\"reset()\"></p-button>\n <p-button type=\"submit\" label=\"Guardar datos legales\" icon=\"pi pi-check\" [loading]=\"pending()\" [disabled]=\"saving() || !changes()\"></p-button>\n </div>\n </form>\n }\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-legal-grid,.sfs-legal-view{display:grid;grid-template-columns:minmax(0,1fr);gap:1rem;margin:0}@media (min-width: 576px){.sfs-legal-grid,.sfs-legal-view{grid-template-columns:repeat(2,minmax(0,1fr))}.sfs-legal-wide{grid-column:1 / -1}}.sfs-legal-view dt{color:var(--p-text-muted-color);font-size:.875rem}.sfs-legal-view dd{margin:.15rem 0 0}.sfs-legal-field{display:flex;flex-direction:column;gap:.35rem;min-width:0}.sfs-legal-field>label{font-size:.875rem;font-weight:600}.sfs-legal-field textarea{width:100%}.sfs-legal-check{display:flex;align-items:center;gap:.5rem;min-height:2.75rem}.sfs-legal-err{display:flex;align-items:flex-start;gap:.35rem;color:var(--p-message-error-simple-color, var(--p-text-color))}.sfs-legal-actions{justify-content:flex-end}.sfs-legal-msg{display:block;margin-bottom:1rem}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { 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.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i3.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: CardModule }, { kind: "component", type: i3$1.Card, selector: "p-card", inputs: ["header", "subheader", "style", "styleClass"] }, { kind: "ngmodule", type: CheckboxModule }, { kind: "component", type: i4.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: 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: TextareaModule }, { kind: "directive", type: i14.Textarea, selector: "[pTextarea], [pInputTextarea]", inputs: ["autoResize", "variant", "fluid", "pSize"], outputs: ["onResize"] }] });
2214
+ }
2215
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: ApplicationLegalComponent, decorators: [{
2216
+ type: Component,
2217
+ args: [{ selector: 'lib-application-legal', imports: [CommonModule, FormsModule, ButtonModule, CardModule, CheckboxModule, InputNumberModule, MessageModule, SelectModule, SkeletonModule, TextareaModule], template: "<p-card>\n <div class=\"sfs-head\">\n <h2 class=\"sfs-title\" [id]=\"id + '-title'\">Datos legales</h2>\n </div>\n\n @if (!legal()) {\n <div class=\"sfs-stack\" aria-busy=\"true\">\n <p-skeleton height=\"2.5rem\"></p-skeleton>\n <p-skeleton height=\"5rem\"></p-skeleton>\n </div>\n } @else if (!canEdit()) {\n <!-- Sin permiso: lo guardado, de solo lectura, y por qu\u00E9 no se puede cambiar. -->\n @if (readonlyReason()) {\n <p-message severity=\"info\" icon=\"pi pi-lock\" class=\"sfs-legal-msg\">{{ readonlyReason() }}</p-message>\n }\n @if (legal(); as l) {\n <dl class=\"sfs-legal-view\">\n <div><dt>Posee embargo</dt><dd>{{ l.hasGarnishment == null ? '\u2014' : l.hasGarnishment ? 'S\u00ED' : 'No' }}</dd></div>\n <div><dt>Tipo de embargo</dt><dd>{{ l.garnishmentType || '\u2014' }}</dd></div>\n <div><dt>Antig\u00FCedad del embargo</dt><dd>{{ l.garnishmentMonths != null ? l.garnishmentMonths + (l.garnishmentMonths === 1 ? ' mes' : ' meses') : '\u2014' }}</dd></div>\n <div><dt>Insolvencia</dt><dd>{{ l.insolvency == null ? '\u2014' : l.insolvency ? 'S\u00ED' : 'No' }}</dd></div>\n <div class=\"sfs-legal-wide\"><dt>Riesgo reputacional</dt><dd class=\"sfs-break\">{{ l.reputationalRisk || '\u2014' }}</dd></div>\n </dl>\n }\n } @else {\n @if (draft(); as d) {\n <form class=\"sfs-stack\" (ngSubmit)=\"submit()\" novalidate [attr.aria-labelledby]=\"id + '-title'\" [attr.aria-busy]=\"busy() ? 'true' : null\">\n <div class=\"sfs-legal-grid\">\n <div class=\"sfs-legal-check\">\n <p-checkbox [inputId]=\"id + '-garnishment'\" name=\"hasGarnishment\" [binary]=\"true\" [disabled]=\"busy()\"\n [ngModel]=\"d.hasGarnishment\" (ngModelChange)=\"patch({ hasGarnishment: $event })\"></p-checkbox>\n <label [for]=\"id + '-garnishment'\">Posee embargo</label>\n </div>\n <div class=\"sfs-legal-check\">\n <p-checkbox [inputId]=\"id + '-insolvency'\" name=\"insolvency\" [binary]=\"true\" [disabled]=\"busy()\"\n [ngModel]=\"d.insolvency\" (ngModelChange)=\"patch({ insolvency: $event })\"></p-checkbox>\n <label [for]=\"id + '-insolvency'\">Insolvencia</label>\n </div>\n <div class=\"sfs-legal-field\">\n <label [for]=\"id + '-type'\">Tipo de embargo</label>\n <p-select [inputId]=\"id + '-type'\" name=\"garnishmentType\" [options]=\"typeOptions()\" optionLabel=\"label\" optionValue=\"value\"\n placeholder=\"Seleccione el tipo\" [disabled]=\"busy()\" appendTo=\"body\" [fluid]=\"true\"\n [ngModel]=\"d.garnishmentType\" (ngModelChange)=\"patch({ garnishmentType: $event })\"></p-select>\n </div>\n <div class=\"sfs-legal-field\">\n <label [for]=\"id + '-months'\">Antig\u00FCedad del embargo (meses)</label>\n <p-inputnumber [inputId]=\"id + '-months'\" name=\"garnishmentMonths\" [min]=\"0\" [max]=\"maxMonths\" [maxFractionDigits]=\"0\" [useGrouping]=\"false\"\n [disabled]=\"busy()\" [fluid]=\"true\" [ariaDescribedBy]=\"submitted() && errors().months ? id + '-months-err' : undefined\"\n [ngModel]=\"d.garnishmentMonths\" (ngModelChange)=\"patch({ garnishmentMonths: $event })\"></p-inputnumber>\n @if (submitted() && errors().months; as error) {\n <small [id]=\"id + '-months-err'\" class=\"sfs-legal-err\"><i class=\"pi pi-exclamation-circle\" aria-hidden=\"true\"></i>{{ error }}</small>\n }\n </div>\n <div class=\"sfs-legal-field sfs-legal-wide\">\n <label [for]=\"id + '-risk'\">Riesgo reputacional</label>\n <textarea pTextarea [id]=\"id + '-risk'\" name=\"reputationalRisk\" rows=\"2\" [maxlength]=\"riskMax\" [disabled]=\"busy()\"\n [attr.aria-invalid]=\"submitted() && errors().risk ? 'true' : null\"\n [attr.aria-describedby]=\"(submitted() && errors().risk ? id + '-risk-err ' : '') + id + '-risk-count'\"\n [ngModel]=\"d.reputationalRisk\" (ngModelChange)=\"patch({ reputationalRisk: $event })\"></textarea>\n <small [id]=\"id + '-risk-count'\" class=\"sfs-muted\">{{ d.reputationalRisk.length }} de {{ riskMax }} caracteres. Vac\u00EDo se guarda como \"N/A\".</small>\n @if (submitted() && errors().risk; as error) {\n <small [id]=\"id + '-risk-err'\" class=\"sfs-legal-err\"><i class=\"pi pi-exclamation-circle\" aria-hidden=\"true\"></i>{{ error }}</small>\n }\n </div>\n </div>\n <div class=\"sfs-inline sfs-legal-actions\">\n <p-button type=\"button\" label=\"Descartar cambios\" severity=\"secondary\" [text]=\"true\" [disabled]=\"busy() || !changes()\" (onClick)=\"reset()\"></p-button>\n <p-button type=\"submit\" label=\"Guardar datos legales\" icon=\"pi pi-check\" [loading]=\"pending()\" [disabled]=\"saving() || !changes()\"></p-button>\n </div>\n </form>\n }\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-legal-grid,.sfs-legal-view{display:grid;grid-template-columns:minmax(0,1fr);gap:1rem;margin:0}@media (min-width: 576px){.sfs-legal-grid,.sfs-legal-view{grid-template-columns:repeat(2,minmax(0,1fr))}.sfs-legal-wide{grid-column:1 / -1}}.sfs-legal-view dt{color:var(--p-text-muted-color);font-size:.875rem}.sfs-legal-view dd{margin:.15rem 0 0}.sfs-legal-field{display:flex;flex-direction:column;gap:.35rem;min-width:0}.sfs-legal-field>label{font-size:.875rem;font-weight:600}.sfs-legal-field textarea{width:100%}.sfs-legal-check{display:flex;align-items:center;gap:.5rem;min-height:2.75rem}.sfs-legal-err{display:flex;align-items:flex-start;gap:.35rem;color:var(--p-message-error-simple-color, var(--p-text-color))}.sfs-legal-actions{justify-content:flex-end}.sfs-legal-msg{display:block;margin-bottom:1rem}\n"] }]
2218
+ }], ctorParameters: () => [] });
2219
+ function rebase(draft, before, after) {
2220
+ const keep = (key) => {
2221
+ const touched = key === 'reputationalRisk' ? draft.reputationalRisk.trim() !== before.reputationalRisk.trim() : draft[key] !== before[key];
2222
+ return touched ? draft[key] : after[key];
2223
+ };
2224
+ return {
2225
+ hasGarnishment: keep('hasGarnishment'),
2226
+ garnishmentType: keep('garnishmentType'),
2227
+ garnishmentMonths: keep('garnishmentMonths'),
2228
+ insolvency: keep('insolvency'),
2229
+ reputationalRisk: keep('reputationalRisk')
2230
+ };
2231
+ }
2232
+ function toDraft(legal) {
2233
+ return {
2234
+ hasGarnishment: !!legal.hasGarnishment,
2235
+ garnishmentType: legal.garnishmentType?.trim() || null,
2236
+ garnishmentMonths: legal.garnishmentMonths ?? null,
2237
+ insolvency: !!legal.insolvency,
2238
+ reputationalRisk: legal.reputationalRisk?.trim() ?? ''
2239
+ };
2240
+ }
2241
+
1890
2242
  /*
1891
2243
  * API pública de @sfinges/sf-solicitud
1892
2244
  */
@@ -1895,5 +2247,5 @@ function fromDate(value) {
1895
2247
  * Generated bundle index. Do not edit.
1896
2248
  */
1897
2249
 
1898
- export { APPLICATION_PERSON_SERVICE, ApplicationPersonComponent, DEBT_BUYOUT_LIMITS, DebtBuyoutsComponent, LineSimulatorComponent, PersonEditDialogComponent };
2250
+ export { APPLICATION_PERSON_SERVICE, ApplicationLegalComponent, ApplicationPersonComponent, DEBT_BUYOUT_LIMITS, DEBT_BUYOUT_UPLOAD, DebtBuyoutsComponent, LEGAL_MAX_MONTHS, LEGAL_RISK_MAX_LENGTH, LineSimulatorComponent, PersonEditDialogComponent };
1899
2251
  //# sourceMappingURL=sfinges-sf-solicitud.mjs.map