@sfinges/sf-solicitud 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -827,6 +827,11 @@ class LineSimulatorComponent {
|
|
|
827
827
|
canEdit = input(false);
|
|
828
828
|
/** Cargos cuyo valor configurado puede cambiar (por nombre, sin importar mayúsculas). */
|
|
829
829
|
editableCharges = input([]);
|
|
830
|
+
/**
|
|
831
|
+
* Puede elegir otra tasa entre las del producto (`simulation.allowedRates`) y la de la línea. Lo decide el host con
|
|
832
|
+
* el perfil (en TFB, la opción API / LOANS / RATE); el back lo vuelve a revisar.
|
|
833
|
+
*/
|
|
834
|
+
canEditRate = input(false);
|
|
830
835
|
/**
|
|
831
836
|
* Muestra "Guardar condiciones". Va en false si el perfil nunca puede guardar (se oculta, no se deshabilita) o si
|
|
832
837
|
* el formulario guarda por su cuenta y escucha `lineChange`.
|
|
@@ -860,13 +865,27 @@ class LineSimulatorComponent {
|
|
|
860
865
|
garnishment: `sfs-sim-garnishment-${n}`,
|
|
861
866
|
capacityTitle: `sfs-sim-capacity-title-${n}`,
|
|
862
867
|
resultTitle: `sfs-sim-result-title-${n}`,
|
|
863
|
-
saveReason: `sfs-sim-save-reason-${n}
|
|
868
|
+
saveReason: `sfs-sim-save-reason-${n}`,
|
|
869
|
+
installment: `sfs-sim-installment-${n}`,
|
|
870
|
+
installmentError: `sfs-sim-installment-error-${n}`,
|
|
871
|
+
rate: `sfs-sim-rate-${n}`,
|
|
872
|
+
rateLabel: `sfs-sim-rate-label-${n}`,
|
|
873
|
+
charges: `sfs-sim-charges-${n}`,
|
|
874
|
+
chargesTitle: `sfs-sim-charges-title-${n}`
|
|
864
875
|
};
|
|
865
876
|
})();
|
|
866
877
|
selectedLine = signal(null);
|
|
867
878
|
termInput = signal(null);
|
|
868
879
|
amountInput = signal(null);
|
|
869
880
|
chargeInputs = signal({});
|
|
881
|
+
/** La cuota que digitó la persona; null mientras no la toque (se ve el disponible nómina). */
|
|
882
|
+
installmentInput = signal(null);
|
|
883
|
+
/** La cuota con que se simuló lo que se ve; null si fue por capacidad. */
|
|
884
|
+
simulatedInstallment = signal(null);
|
|
885
|
+
/** La tasa elegida para la línea; se reinicia al elegir otra línea. */
|
|
886
|
+
rateInput = signal(null);
|
|
887
|
+
/** Los cargos se despliegan a pedido: la mayoría de las veces no se tocan. */
|
|
888
|
+
chargesOpen = signal(false);
|
|
870
889
|
/** La capacidad editada; null mientras no se toque. */
|
|
871
890
|
capacityInput = signal(null);
|
|
872
891
|
confirmVisible = signal(false);
|
|
@@ -881,6 +900,47 @@ class LineSimulatorComponent {
|
|
|
881
900
|
/** Contra qué se mide si la capacidad cambió: la que se simuló. */
|
|
882
901
|
referenceCapacity = computed(() => this.simulatedCapacity() ?? this.capacity());
|
|
883
902
|
currentCapacity = computed(() => this.capacityInput() ?? this.referenceCapacity());
|
|
903
|
+
/** Disponible nómina: la cuota total más alta (capacidad más aporte). Null mientras no hay simulación. */
|
|
904
|
+
maxInstallment = computed(() => {
|
|
905
|
+
const c = this.simulation()?.capacity;
|
|
906
|
+
if (!c)
|
|
907
|
+
return null;
|
|
908
|
+
return c.maxInstallment ?? c.payrollCapacity + (c.contribution ?? 0);
|
|
909
|
+
});
|
|
910
|
+
/** La cuota que se ve: la digitada, o la cuota total de la línea simulada. */
|
|
911
|
+
currentInstallment = computed(() => this.installmentInput() ?? this.line()?.installment ?? null);
|
|
912
|
+
/**
|
|
913
|
+
* La cuota se digita solo si el host la soporta: lo dice al mandar el disponible nómina (`capacity.maxInstallment`).
|
|
914
|
+
* Un host que no la manda (forms-ui, por ahora) ve lo de antes.
|
|
915
|
+
*/
|
|
916
|
+
installmentEditable = computed(() => this.simulation()?.capacity?.maxInstallment != null && (this.canEdit() || this.capacityEditable()));
|
|
917
|
+
/** La tasa se elige con el permiso de la tasa y el de editar la solicitud en su estado. */
|
|
918
|
+
rateEditable = computed(() => this.canEditRate() && this.canEdit());
|
|
919
|
+
/** Por qué la cuota no sirve; null si sirve. */
|
|
920
|
+
installmentError = computed(() => {
|
|
921
|
+
const value = this.installmentInput();
|
|
922
|
+
if (value === null)
|
|
923
|
+
return null;
|
|
924
|
+
if (value <= 0)
|
|
925
|
+
return 'La cuota tiene que ser mayor que cero.';
|
|
926
|
+
const max = this.maxInstallment();
|
|
927
|
+
if (max !== null && value > max)
|
|
928
|
+
return 'La cuota no puede superar el disponible nómina.';
|
|
929
|
+
return null;
|
|
930
|
+
});
|
|
931
|
+
/** Las tasas que se pueden elegir para la línea: las del producto y la suya, de menor a mayor. */
|
|
932
|
+
rateOptions = computed(() => {
|
|
933
|
+
const line = this.line();
|
|
934
|
+
if (!line)
|
|
935
|
+
return [];
|
|
936
|
+
const lineRate = line.lineRate ?? line.rate;
|
|
937
|
+
const rates = new Set([...(this.simulation()?.allowedRates ?? []), lineRate, line.rate].map((r) => round(r, 4)));
|
|
938
|
+
return [...rates]
|
|
939
|
+
.sort((a, b) => a - b)
|
|
940
|
+
.map((rate) => ({ value: rate, label: `${formatRate(rate)} % M.V.${sameValue(rate, lineRate) ? ' (de la línea)' : ''}` }));
|
|
941
|
+
});
|
|
942
|
+
/** La tasa que se ve: la elegida o la simulada. */
|
|
943
|
+
currentRate = computed(() => this.rateInput() ?? this.line()?.rate ?? null);
|
|
884
944
|
lineOptions = computed(() => (this.simulation()?.lines ?? []).map((line) => ({
|
|
885
945
|
value: line.line,
|
|
886
946
|
label: line.lineName || `Línea ${line.line}`,
|
|
@@ -934,6 +994,12 @@ class LineSimulatorComponent {
|
|
|
934
994
|
const zero = this.zeroChargeNames();
|
|
935
995
|
return this.showZeroCharges() || !zero.size ? this.chargeRows() : this.chargeRows().filter((row) => !zero.has(row.name));
|
|
936
996
|
});
|
|
997
|
+
/** Cargos del crédito (se descuentan del desembolso o se suman al capital). */
|
|
998
|
+
creditChargeRows = computed(() => this.visibleChargeRows().filter((row) => row.type === 'ADMIN'));
|
|
999
|
+
/** Cargos que van en la cuota (seguro, aporte…). */
|
|
1000
|
+
installmentChargeRows = computed(() => this.visibleChargeRows().filter((row) => row.type === 'CUOTA'));
|
|
1001
|
+
/** Cuántos cargos se cambiaron sin recalcular: se dice en el botón aunque estén plegados. */
|
|
1002
|
+
editedChargesCount = computed(() => Object.keys(this.editedCharges()).length);
|
|
937
1003
|
/** Cargos editados que difieren de lo que calculó el simulador, en la unidad del core (fracción o pesos). */
|
|
938
1004
|
editedCharges = computed(() => {
|
|
939
1005
|
const inputs = this.chargeInputs();
|
|
@@ -959,11 +1025,38 @@ class LineSimulatorComponent {
|
|
|
959
1025
|
return false;
|
|
960
1026
|
return ((this.termInput() ?? line.term) !== line.term ||
|
|
961
1027
|
(this.amountInput() ?? line.amount) !== line.amount ||
|
|
1028
|
+
!sameValue(this.currentRate() ?? line.rate, line.rate) ||
|
|
1029
|
+
this.installmentChanged() ||
|
|
962
1030
|
Object.keys(this.editedCharges()).length > 0);
|
|
963
1031
|
});
|
|
1032
|
+
/** La cuota digitada no es con la que se simuló. */
|
|
1033
|
+
installmentChanged = computed(() => {
|
|
1034
|
+
const typed = this.installmentInput();
|
|
1035
|
+
if (typed === null)
|
|
1036
|
+
return false;
|
|
1037
|
+
return !sameValue(typed, this.simulatedInstallment() ?? this.line()?.installment ?? typed);
|
|
1038
|
+
});
|
|
1039
|
+
/** Algo digitado no sirve: no se recalcula ni se guarda. */
|
|
964
1040
|
hasNegativeInput = computed(() => (this.amountInput() ?? 0) < 0 ||
|
|
1041
|
+
!!this.installmentError() ||
|
|
965
1042
|
Object.values(this.chargeInputs()).some((v) => v !== null && v !== undefined && v < 0) ||
|
|
966
1043
|
CAPACITY_FIELDS.some((f) => this.currentCapacity()[f.key] < 0));
|
|
1044
|
+
/** El resumen de lo que se gira: máximo a financiar, descuentos, desembolso, compras, sanear y neto a girar. */
|
|
1045
|
+
summary = computed(() => {
|
|
1046
|
+
const l = this.line();
|
|
1047
|
+
if (!l)
|
|
1048
|
+
return null;
|
|
1049
|
+
const s = this.simulation();
|
|
1050
|
+
return {
|
|
1051
|
+
maxAmount: l.defaultAmount,
|
|
1052
|
+
amount: l.amount,
|
|
1053
|
+
creditDiscounts: l.administrativeCharges,
|
|
1054
|
+
disbursement: l.disbursement,
|
|
1055
|
+
purchases: s?.purchasesInPayslip ?? null,
|
|
1056
|
+
cleanUp: s?.purchasesToCleanUp ?? null,
|
|
1057
|
+
net: l.transfer
|
|
1058
|
+
};
|
|
1059
|
+
});
|
|
967
1060
|
/** Por qué no se puede guardar ahora, para mostrarlo junto al botón; null si se puede. */
|
|
968
1061
|
saveUnavailableReason = computed(() => {
|
|
969
1062
|
const blocked = this.saveBlockedReason();
|
|
@@ -1002,10 +1095,7 @@ class LineSimulatorComponent {
|
|
|
1002
1095
|
row('Plazo', 'term', hasSaved ? s.term : null, l.term),
|
|
1003
1096
|
row('Tasa', 'rate', hasSaved ? s.rate : null, l.rate),
|
|
1004
1097
|
row('Cuota total', 'money', hasSaved ? s.totalInstallment : null, l.installment),
|
|
1005
|
-
row('Seguro', 'money', null, l.insurance)
|
|
1006
|
-
row('Cargos administrativos', 'money', null, l.administrativeCharges),
|
|
1007
|
-
row('Desembolso', 'money', null, l.disbursement),
|
|
1008
|
-
row('Giro al cliente', 'money', null, l.transfer)
|
|
1098
|
+
row('Seguro', 'money', null, l.insurance)
|
|
1009
1099
|
];
|
|
1010
1100
|
});
|
|
1011
1101
|
/**
|
|
@@ -1024,6 +1114,7 @@ class LineSimulatorComponent {
|
|
|
1024
1114
|
return (l.line !== s.line ||
|
|
1025
1115
|
l.term !== s.term ||
|
|
1026
1116
|
!sameValue(l.amount, s.amount) ||
|
|
1117
|
+
!sameValue(l.rate, s.rate) ||
|
|
1027
1118
|
this.chargeRows().some((row) => row.savedInput !== null && !sameValue(row.savedInput, row.simulatedInput)));
|
|
1028
1119
|
});
|
|
1029
1120
|
/** Lo que se anuncia al lector de pantalla cuando cambia la simulación (región siempre montada). */
|
|
@@ -1059,6 +1150,9 @@ class LineSimulatorComponent {
|
|
|
1059
1150
|
const requested = this.pendingRequest;
|
|
1060
1151
|
this.pendingRequest = null;
|
|
1061
1152
|
if (requested) {
|
|
1153
|
+
this.simulatedInstallment.set(requested.installment ?? null);
|
|
1154
|
+
if (this.installmentInput() !== null && sameValue(this.installmentInput(), requested.installment ?? NaN))
|
|
1155
|
+
this.installmentInput.set(null);
|
|
1062
1156
|
this.simulatedCapacity.set(requested.capacity);
|
|
1063
1157
|
if (this.capacityInput() && sameCapacity(this.capacityInput(), requested.capacity))
|
|
1064
1158
|
this.capacityInput.set(null);
|
|
@@ -1068,6 +1162,8 @@ class LineSimulatorComponent {
|
|
|
1068
1162
|
this.lastRequest = null;
|
|
1069
1163
|
this.capacityInput.set(null);
|
|
1070
1164
|
this.simulatedCapacity.set(null);
|
|
1165
|
+
this.installmentInput.set(null);
|
|
1166
|
+
this.simulatedInstallment.set(null);
|
|
1071
1167
|
}
|
|
1072
1168
|
const keep = requested ? simulation.lines.find((l) => l.line === this.selectedLine()) : undefined;
|
|
1073
1169
|
const saved = simulation.lines.find((l) => l.line === this.saved()?.line);
|
|
@@ -1127,6 +1223,7 @@ class LineSimulatorComponent {
|
|
|
1127
1223
|
const line = this.simulation()?.lines.find((l) => l.line === code);
|
|
1128
1224
|
this.termInput.set(line?.term ?? null);
|
|
1129
1225
|
this.amountInput.set(line?.amount ?? null);
|
|
1226
|
+
this.rateInput.set(line?.rate ?? null);
|
|
1130
1227
|
const inputs = {};
|
|
1131
1228
|
for (const row of this.chargeRows())
|
|
1132
1229
|
inputs[row.name] = row.simulatedInput;
|
|
@@ -1148,23 +1245,42 @@ class LineSimulatorComponent {
|
|
|
1148
1245
|
const line = this.line();
|
|
1149
1246
|
this.touched.set(true);
|
|
1150
1247
|
const edited = this.editedCharges();
|
|
1248
|
+
const installment = this.installmentInput() ?? this.simulatedInstallment();
|
|
1249
|
+
// Con una cuota nueva el monto sale de ella (máximo a financiar): el monto anterior no se manda como pedido.
|
|
1250
|
+
const amount = this.installmentChanged() && (this.amountInput() ?? line?.amount) === line?.amount ? null : (this.amountInput() ?? line?.amount ?? null);
|
|
1151
1251
|
const lines = line
|
|
1152
1252
|
? [
|
|
1153
1253
|
{
|
|
1154
1254
|
line: line.line,
|
|
1155
1255
|
term: this.termInput() ?? line.term,
|
|
1156
|
-
amount
|
|
1256
|
+
amount,
|
|
1157
1257
|
defaultTerm: line.defaultTerm ?? null,
|
|
1158
1258
|
defaultAmount: line.defaultAmount,
|
|
1159
|
-
editedCharges: Object.keys(edited).length ? edited : null
|
|
1259
|
+
editedCharges: Object.keys(edited).length ? edited : null,
|
|
1260
|
+
rate: this.chosenRate()
|
|
1160
1261
|
}
|
|
1161
1262
|
]
|
|
1162
1263
|
: [];
|
|
1163
|
-
const request = { capacity: this.currentCapacity(), lines };
|
|
1264
|
+
const request = { capacity: this.currentCapacity(), lines, installment: installment ?? null };
|
|
1164
1265
|
this.pendingRequest = request;
|
|
1165
1266
|
this.lastRequest = request;
|
|
1166
1267
|
this.simulate.emit(request);
|
|
1167
1268
|
}
|
|
1269
|
+
/** La tasa elegida, solo si es otra que la de la línea (el back exige el permiso cuando llega una). */
|
|
1270
|
+
chosenRate() {
|
|
1271
|
+
const line = this.line();
|
|
1272
|
+
const rate = this.currentRate();
|
|
1273
|
+
if (!line || rate === null)
|
|
1274
|
+
return null;
|
|
1275
|
+
return sameValue(rate, line.lineRate ?? line.rate) ? null : rate;
|
|
1276
|
+
}
|
|
1277
|
+
setInstallment(value) {
|
|
1278
|
+
this.installmentInput.set(value);
|
|
1279
|
+
}
|
|
1280
|
+
/** Vuelve a la cuota más alta: el disponible nómina. */
|
|
1281
|
+
useMaxInstallment() {
|
|
1282
|
+
this.installmentInput.set(this.maxInstallment());
|
|
1283
|
+
}
|
|
1168
1284
|
retrySimulation() {
|
|
1169
1285
|
if (this.lastRequest)
|
|
1170
1286
|
this.pendingRequest = this.lastRequest;
|
|
@@ -1200,6 +1316,9 @@ class LineSimulatorComponent {
|
|
|
1200
1316
|
term: line.term,
|
|
1201
1317
|
amount: line.amount,
|
|
1202
1318
|
editedCharges: Object.keys(editedCharges).length ? editedCharges : null,
|
|
1319
|
+
// Solo cuando se usan: un host que no los conoce recibe lo mismo que antes.
|
|
1320
|
+
...(sameValue(line.rate, line.lineRate ?? line.rate) ? {} : { rate: line.rate }),
|
|
1321
|
+
...(this.simulatedInstallment() !== null ? { installment: this.simulatedInstallment() } : {}),
|
|
1203
1322
|
...(this.capacityEditable() ? { capacity: this.referenceCapacity() } : {})
|
|
1204
1323
|
});
|
|
1205
1324
|
}
|
|
@@ -1207,7 +1326,7 @@ class LineSimulatorComponent {
|
|
|
1207
1326
|
return type === 'ADMIN' ? 'Crédito' : 'Cuota';
|
|
1208
1327
|
}
|
|
1209
1328
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: LineSimulatorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1210
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: LineSimulatorComponent, isStandalone: true, selector: "lib-line-simulator", inputs: { capacity: { classPropertyName: "capacity", publicName: "capacity", isSignal: true, isRequired: true, transformFunction: null }, capacityEditable: { classPropertyName: "capacityEditable", publicName: "capacityEditable", isSignal: true, isRequired: false, transformFunction: null }, simulation: { classPropertyName: "simulation", publicName: "simulation", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, errorMessage: { classPropertyName: "errorMessage", publicName: "errorMessage", isSignal: true, isRequired: false, transformFunction: null }, saved: { classPropertyName: "saved", publicName: "saved", isSignal: true, isRequired: false, transformFunction: null }, canEdit: { classPropertyName: "canEdit", publicName: "canEdit", isSignal: true, isRequired: false, transformFunction: null }, editableCharges: { classPropertyName: "editableCharges", publicName: "editableCharges", isSignal: true, isRequired: false, transformFunction: null }, showSave: { classPropertyName: "showSave", publicName: "showSave", isSignal: true, isRequired: false, transformFunction: null }, saveBlockedReason: { classPropertyName: "saveBlockedReason", publicName: "saveBlockedReason", isSignal: true, isRequired: false, transformFunction: null }, saving: { classPropertyName: "saving", publicName: "saving", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { simulate: "simulate", save: "save", retry: "retry", lineChange: "lineChange", unsavedChange: "unsavedChange" }, ngImport: i0, template: "<div class=\"sfs-stack\">\n <!-- Capacidad de pago -->\n <section [attr.aria-labelledby]=\"ids.capacityTitle\">\n <h3 [id]=\"ids.capacityTitle\" class=\"sfs-subtitle sfs-gap-bottom\">Capacidad de pago</h3>\n @if (capacityEditable()) {\n <div class=\"sfs-capacity-grid\">\n @for (field of capacityFields; track field.key) {\n <div class=\"sfs-control\">\n <label [for]=\"ids.capacity + field.key\">{{ field.label }}</label>\n <p-inputnumber [inputId]=\"ids.capacity + field.key\" [ngModel]=\"currentCapacity()[field.key]\" (ngModelChange)=\"setCapacity(field.key, $event)\"\n mode=\"currency\" currency=\"COP\" [locale]=\"locale\" [minFractionDigits]=\"0\" [maxFractionDigits]=\"0\" [min]=\"0\" [fluid]=\"true\"></p-inputnumber>\n </div>\n }\n <div class=\"sfs-control sfs-control--check\">\n <p-checkbox [inputId]=\"ids.garnishment\" [binary]=\"true\" [ngModel]=\"currentCapacity().hasGarnishment\" (ngModelChange)=\"setGarnishment($event)\"></p-checkbox>\n <label [for]=\"ids.garnishment\">Tiene embargo</label>\n </div>\n </div>\n }\n <!-- Indicadores en grilla: varios por fila en escritorio, para que la capacidad no ocupe media pantalla. -->\n @if (!capacityEditable() || simulation()) {\n <dl class=\"sfs-metrics\" [class.sfs-gap-top]=\"capacityEditable()\">\n @if (!capacityEditable()) {\n <div><dt>Ingresos</dt><dd>{{ capacity().income | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Descuentos de ley</dt><dd>{{ capacity().legalDeductions | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Otras afiliaciones</dt><dd>{{ capacity().otherAffiliations | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Otros descuentos</dt><dd>{{ capacity().otherDeductions | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Compras de cartera</dt><dd>{{ capacity().purchasesValue | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Embargo</dt><dd>{{ capacity().hasGarnishment ? 'S\u00ED' : 'No' }}</dd></div>\n }\n @if (simulation(); as s) {\n <div><dt>Cuota disponible</dt><dd class=\"sfs-strong\">{{ s.capacity.availableInstallment | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Monto m\u00E1ximo</dt><dd class=\"sfs-strong\">{{ s.capacity.maxAmount != null ? (s.capacity.maxAmount | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale) : '\u2014' }}</dd></div>\n }\n </dl>\n }\n </section>\n\n @switch (state()) {\n @case ('loading') {\n <div class=\"sfs-stack\" aria-busy=\"true\">\n <p-skeleton height=\"2.5rem\"></p-skeleton>\n <p-skeleton height=\"12rem\"></p-skeleton>\n </div>\n }\n @case ('error') {\n <p-message severity=\"error\">\n <div class=\"sfs-inline\">\n <span>{{ errorMessage() || 'No se pudo simular la solicitud.' }}</span>\n <p-button label=\"Reintentar\" icon=\"pi pi-refresh\" [text]=\"true\" (onClick)=\"retrySimulation()\"></p-button>\n </div>\n </p-message>\n @if (capacityEditable() && pendingChanges()) {\n <div class=\"sfs-actions\">\n <p-button label=\"Recalcular\" icon=\"pi pi-calculator\" severity=\"secondary\" [text]=\"true\" [disabled]=\"hasNegativeInput()\" (onClick)=\"recalculate()\"></p-button>\n </div>\n }\n }\n @case ('idle') {\n @if (capacityEditable()) {\n <div class=\"sfs-actions\">\n <p-button label=\"Simular\" icon=\"pi pi-calculator\" [disabled]=\"hasNegativeInput()\" (onClick)=\"recalculate()\"></p-button>\n </div>\n } @else {\n <p class=\"sfs-muted sfs-no-top\">Todav\u00EDa no hay una simulaci\u00F3n para esta solicitud.</p>\n }\n }\n @case ('ready') {\n @if (simulation()?.warnings?.length) {\n <p-message severity=\"warn\">\n <ul class=\"sfs-list\">\n @for (w of simulation()?.warnings ?? []; track $index) { <li>{{ w }}</li> }\n </ul>\n </p-message>\n }\n\n @if (!lineOptions().length) {\n <p-message severity=\"info\" text=\"El simulador no devolvi\u00F3 l\u00EDneas para esta solicitud. Revise la pagadur\u00EDa, el producto y la capacidad de pago.\"></p-message>\n }\n\n <!-- L\u00EDnea, plazo, monto y tasa en una sola fila en escritorio. p-select pone el inputId en un span: el nombre\n accesible va por ariaLabelledBy. -->\n <div class=\"sfs-conditions\">\n <div class=\"sfs-control sfs-conditions__line\">\n <label [id]=\"ids.lineLabel\" [for]=\"ids.line\" class=\"sfs-strong\">L\u00EDnea</label>\n <p-select [inputId]=\"ids.line\" [ariaLabelledBy]=\"ids.lineLabel\" [options]=\"lineOptions()\" optionLabel=\"label\" optionValue=\"value\" optionDisabled=\"disabled\"\n [ngModel]=\"selectedLine()\" (ngModelChange)=\"chooseLine($event)\" placeholder=\"Seleccione una l\u00EDnea\" [fluid]=\"true\"></p-select>\n </div>\n @if (line(); as l) {\n @if (!l.error) {\n <div class=\"sfs-control\">\n <label [for]=\"ids.term\">Plazo (cuotas)</label>\n <p-inputnumber [inputId]=\"ids.term\" [ngModel]=\"termInput()\" (ngModelChange)=\"termInput.set($event)\"\n [min]=\"simulation()?.minTerm ?? 1\" [max]=\"simulation()?.maxTerm ?? 600\" [useGrouping]=\"false\"\n [disabled]=\"!canEdit()\" [fluid]=\"true\"></p-inputnumber>\n </div>\n <div class=\"sfs-control\">\n <label [for]=\"ids.amount\">Monto</label>\n <p-inputnumber [inputId]=\"ids.amount\" [ngModel]=\"amountInput()\" (ngModelChange)=\"amountInput.set($event)\"\n mode=\"currency\" currency=\"COP\" [locale]=\"locale\" [minFractionDigits]=\"0\" [maxFractionDigits]=\"0\" [min]=\"0\"\n [disabled]=\"!canEdit()\" [fluid]=\"true\"></p-inputnumber>\n </div>\n <div class=\"sfs-control sfs-conditions__rate\">\n <span>Tasa</span>\n <span class=\"sfs-strong\">{{ l.rate | number: '1.0-4' : locale }} % M.V.</span>\n </div>\n }\n }\n </div>\n @if (saved()?.line && saved()?.line !== selectedLine()) {\n <small class=\"sfs-muted sfs-no-gap\">La l\u00EDnea guardada es {{ savedLineName() }}. Al guardar se cambia por la elegida.</small>\n }\n\n @if (line(); as l) {\n @if (l.error) {\n <p-message severity=\"error\" text=\"Esta l\u00EDnea no se pudo simular. Elija otra o intente m\u00E1s tarde.\"></p-message>\n } @else {\n <!-- Cargos de la l\u00EDnea, con lo guardado al lado -->\n <p-table [value]=\"visibleChargeRows()\" size=\"small\" [scrollable]=\"true\" dataKey=\"name\" styleClass=\"sfs-stack-table\">\n <ng-template #header>\n <tr>\n <th>Cargo</th>\n <th>Tipo</th>\n <th class=\"sfs-right\">Guardado</th>\n <th class=\"sfs-right\">Configurado</th>\n <th class=\"sfs-right\">Valor</th>\n </tr>\n </ng-template>\n <ng-template #body let-row>\n <tr>\n <td class=\"sfs-stack-title\">{{ row.label }}</td>\n <td data-label=\"Tipo\">{{ chargeTypeLabel(row.type) }}</td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Guardado\">\n @if (row.savedInput === null) { \u2014 }\n @else { {{ row.percentage ? (row.savedInput | number: '1.0-4' : locale) + ' %' : (row.savedInput | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale) }} }\n </td>\n <td class=\"sfs-right\" data-label=\"Configurado\">\n @if (row.editable) {\n <label [for]=\"row.id\" class=\"sfs-sr-only\">{{ row.label }}</label>\n <p-inputnumber [inputId]=\"row.id\" [ngModel]=\"chargeInputs()[row.name]\" (ngModelChange)=\"setChargeInput(row.name, $event)\"\n [min]=\"0\" [minFractionDigits]=\"0\" [maxFractionDigits]=\"row.percentage ? 4 : 0\" [locale]=\"locale\"\n [suffix]=\"row.percentage ? ' %' : ''\" [prefix]=\"row.percentage ? '' : '$ '\" inputStyleClass=\"sfs-charge-input\"></p-inputnumber>\n } @else {\n {{ row.percentage ? (row.simulatedInput | number: '1.0-4' : locale) + ' %' : (row.simulatedInput | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale) }}\n }\n </td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Valor\">{{ row.value | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</td>\n </tr>\n </ng-template>\n <ng-template #emptymessage>\n <tr><td colspan=\"5\">La l\u00EDnea no tiene cargos.</td></tr>\n </ng-template>\n </p-table>\n @if (zeroChargesCount()) {\n <!-- Los cargos en cero (sin guardado, sin configurado y sin valor) ocupan espacio y no cambian nada. -->\n <div class=\"sfs-no-gap\">\n <p-button [label]=\"showZeroCharges() ? 'Ocultar los cargos en cero' : 'Ver ' + zeroChargesCount() + (zeroChargesCount() === 1 ? ' cargo en cero' : ' cargos en cero')\"\n [icon]=\"showZeroCharges() ? 'pi pi-eye-slash' : 'pi pi-eye'\" [text]=\"true\" size=\"small\" severity=\"secondary\"\n [ariaLabel]=\"showZeroCharges() ? 'Ocultar los cargos en cero' : 'Ver los cargos en cero'\"\n (onClick)=\"showZeroCharges.set(!showZeroCharges())\"></p-button>\n </div>\n }\n\n <!-- Resultado frente a lo guardado -->\n <section [attr.aria-labelledby]=\"ids.resultTitle\">\n <div class=\"sfs-head\">\n <h3 [id]=\"ids.resultTitle\" class=\"sfs-subtitle\">Resultado</h3>\n <p-tag [value]=\"l.viable ? 'Viable' : 'No viable'\" [severity]=\"l.viable ? 'success' : 'warn'\"></p-tag>\n </div>\n <p-table [value]=\"comparison()\" size=\"small\" [scrollable]=\"true\" dataKey=\"label\" styleClass=\"sfs-stack-table\">\n <ng-template #header>\n <tr><th>Concepto</th><th class=\"sfs-right\">Guardado</th><th class=\"sfs-right\">Simulaci\u00F3n</th></tr>\n </ng-template>\n <ng-template #body let-row>\n <tr>\n <td class=\"sfs-stack-title\">{{ row.label }}</td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Guardado\">\n <ng-container *ngTemplateOutlet=\"valueTpl; context: { $implicit: row.saved, kind: row.kind }\"></ng-container>\n </td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Simulaci\u00F3n\">\n @if (row.changed) { <span class=\"sfs-tag-before\"><p-tag value=\"Cambia\" severity=\"warn\"></p-tag></span> }\n <span [class.sfs-strong]=\"row.changed\">\n <ng-container *ngTemplateOutlet=\"valueTpl; context: { $implicit: row.simulated, kind: row.kind }\"></ng-container>\n </span>\n </td>\n </tr>\n </ng-template>\n </p-table>\n @if (!l.viable && l.viabilityReasons.length) {\n <ul class=\"sfs-list sfs-gap-top\">\n @for (reason of l.viabilityReasons; track $index) { <li>{{ reason }}</li> }\n </ul>\n }\n </section>\n\n <!-- Acciones -->\n <div class=\"sfs-actions\">\n @if (canEdit() || capacityEditable()) {\n <p-button label=\"Recalcular\" icon=\"pi pi-calculator\" severity=\"secondary\" [text]=\"true\"\n [disabled]=\"!pendingChanges() || hasNegativeInput()\" (onClick)=\"recalculate()\"></p-button>\n }\n @if (showSave()) {\n <!-- pButton y no p-button: sin poder guardar el bot\u00F3n queda aria-disabled (no disabled) para que el\n motivo se vea con Tab y con el mouse; openConfirm() corta el clic cuando hay motivo. -->\n <button pButton type=\"button\" label=\"Guardar condiciones\" aria-label=\"Guardar condiciones\"\n [icon]=\"saveUnavailableReason() ? 'pi pi-lock' : 'pi pi-save'\"\n [class.sfs-unavailable]=\"!!saveUnavailableReason()\"\n [attr.aria-disabled]=\"saveUnavailableReason() ? 'true' : null\"\n [attr.aria-describedby]=\"saveUnavailableReason() ? ids.saveReason : null\"\n [pTooltip]=\"saveUnavailableReason() ?? ''\" [tooltipDisabled]=\"!saveUnavailableReason()\" tooltipPosition=\"top\" tooltipEvent=\"both\"\n (click)=\"openConfirm()\"></button>\n @if (saveUnavailableReason()) {\n <span [id]=\"ids.saveReason\" class=\"sfs-sr-only\">{{ saveUnavailableReason() }}</span>\n }\n }\n </div>\n }\n }\n }\n }\n</div>\n\n<!-- Siempre montada: anuncia el resultado de cada simulaci\u00F3n (la de arriba se destruye mientras carga). -->\n<div class=\"sfs-sr-only\" role=\"status\" aria-live=\"polite\">{{ liveMessage() }}</div>\n\n<!-- Un valor de la comparaci\u00F3n, en su formato -->\n<ng-template #valueTpl let-value let-kind=\"kind\">\n @if (value === null || value === undefined || value === '') { \u2014 }\n @else {\n @switch (kind) {\n @case ('money') { {{ value | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }} }\n @case ('rate') { {{ value | number: '1.0-4' : locale }} % M.V. }\n @case ('term') { {{ value }} cuotas }\n @default { {{ value }} }\n }\n }\n</ng-template>\n\n<!-- Confirmaci\u00F3n: cambia l\u00EDnea, monto, plazo y cargos de la solicitud -->\n<p-dialog header=\"Guardar condiciones\" [visible]=\"confirmVisible()\" (visibleChange)=\"confirmVisible.set($event)\" (onHide)=\"restoreConfirmFocus()\"\n [modal]=\"true\" [draggable]=\"false\" [closable]=\"!saving()\" [style]=\"{ width: '32rem', maxWidth: '95vw' }\">\n @if (confirmVisible() && line(); as l) {\n <p class=\"sfs-no-top\">\n Se guardar\u00E1n la l\u00EDnea <strong>{{ l.lineName || l.line }}</strong>,\n un monto de <strong>{{ l.amount | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</strong>\n a <strong>{{ l.term }} cuotas</strong> con una tasa de <strong>{{ l.rate | number: '1.0-4' : locale }} % M.V.</strong> y una cuota de <strong>{{ l.installment | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</strong>,\n con un giro al cliente de <strong>{{ l.transfer | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</strong>.\n </p>\n @if (!l.viable) {\n <p-message severity=\"warn\" text=\"La l\u00EDnea no es viable con la capacidad de pago de la solicitud.\"></p-message>\n }\n }\n <ng-template #footer>\n <p-button label=\"Cancelar\" severity=\"secondary\" [text]=\"true\" [disabled]=\"saving()\" (onClick)=\"confirmVisible.set(false)\"></p-button>\n <p-button label=\"Guardar condiciones\" icon=\"pi pi-save\" [loading]=\"saving()\" (onClick)=\"confirmSave()\"></p-button>\n </ng-template>\n</p-dialog>\n", styles: [".sfs-title{margin:0;font-size:1.125rem;font-weight:600}.sfs-subtitle{margin:0;font-size:1rem;font-weight:600}.sfs-muted{color:var(--p-text-muted-color)}.sfs-section-title{display:flex;align-items:center;gap:.5rem;margin:0 0 .75rem;font-size:1rem;font-weight:600}.sfs-section-title i{color:var(--primary-color, var(--p-primary-color))}.sfs-inline{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem}.sfs-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:.5rem;margin-bottom:.75rem}.sfs-break{overflow-wrap:anywhere}.sfs-nowrap{white-space:nowrap}.sfs-right{text-align:right}.sfs-strong{font-weight:600}.sfs-tag-gap{margin-left:.5rem}.sfs-stack{display:flex;flex-direction:column;gap:1rem}.sfs-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.sfs-summary{display:grid;grid-template-columns:minmax(8rem,max-content) 1fr;gap:.25rem 1rem;margin:0}.sfs-summary dt{color:var(--p-text-muted-color)}.sfs-summary dd{margin:0;text-align:right;font-variant-numeric:tabular-nums}@media (max-width: 575px){:host ::ng-deep .sfs-stack-table .p-datatable-table-container{overflow:visible!important}:host ::ng-deep .sfs-stack-table table,:host ::ng-deep .sfs-stack-table tbody{display:block;width:100%}:host ::ng-deep .sfs-stack-table thead{display:block!important;position:absolute!important;width:1px!important;height:1px!important;overflow:hidden!important;clip-path:inset(50%);white-space:nowrap}:host ::ng-deep .sfs-stack-table tbody tr{display:flex;flex-direction:column;margin-bottom:.5rem;padding:.5rem .75rem;border:1px solid var(--p-content-border-color);border-radius:var(--p-content-border-radius, 6px)}:host ::ng-deep .sfs-stack-table tbody td{display:flex;align-items:center;justify-content:flex-end;gap:.375rem;padding:.3rem 0;border:0;text-align:right}:host ::ng-deep .sfs-stack-table tbody td[data-label]:before{content:attr(data-label);margin-right:auto;padding-right:1rem;color:var(--p-text-muted-color);text-align:left}:host ::ng-deep .sfs-stack-table tbody td.sfs-stack-title{order:-1;display:block;font-weight:600;text-align:left}:host ::ng-deep .sfs-stack-table tfoot,:host ::ng-deep .sfs-stack-table .sfs-stack-hide{display:none}}\n", ".sfs-control{display:flex;flex-direction:column;gap:.25rem;min-width:0}.sfs-control--check{flex-direction:row;align-items:center;gap:.5rem;align-self:end;min-height:2.75rem}.sfs-capacity-grid{display:grid;grid-template-columns:minmax(0,1fr);gap:.75rem}@media (min-width: 576px){.sfs-capacity-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}.sfs-conditions{display:grid;grid-template-columns:minmax(0,1fr);gap:.75rem;align-items:end}@media (min-width: 576px){.sfs-conditions{grid-template-columns:repeat(2,minmax(0,1fr))}.sfs-conditions__line{grid-column:1 / -1}}@media (min-width: 992px){.sfs-conditions{grid-template-columns:minmax(0,2fr) minmax(0,1fr) minmax(0,1fr) max-content}.sfs-conditions__line{grid-column:auto}}.sfs-conditions__rate{justify-content:flex-end;min-height:2.5rem;padding-bottom:.5rem}.sfs-metrics{display:grid;grid-template-columns:repeat(auto-fill,minmax(9.5rem,1fr));gap:.5rem 1rem;margin:0}.sfs-metrics dt{font-size:.8125rem;color:var(--p-text-muted-color)}.sfs-metrics dd{margin:0;font-variant-numeric:tabular-nums}.sfs-no-gap{margin-top:-.75rem}.sfs-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:.5rem}.sfs-list{margin:0;padding-left:1rem}.sfs-gap-top{margin-top:.5rem}.sfs-gap-bottom{margin-bottom:.5rem}.sfs-no-top{margin-top:0}.sfs-tag-before{margin-right:.5rem}:host ::ng-deep .sfs-charge-input{width:6.5rem;padding-block:.25rem;text-align:right}:host ::ng-deep .sfs-unavailable.p-button{opacity:var(--p-disabled-opacity);cursor:default}:host ::ng-deep .sfs-unavailable.p-button:hover,:host ::ng-deep .sfs-unavailable.p-button:active{background:var(--button-color, var(--p-button-primary-background));border-color:var(--button-color, var(--p-button-primary-border-color))}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i1$1.DecimalPipe, name: "number" }, { kind: "pipe", type: i1$1.CurrencyPipe, name: "currency" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i2.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain", "fluid", "label", "icon", "buttonProps"] }, { kind: "component", type: i2.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: CheckboxModule }, { kind: "component", type: i3.Checkbox, selector: "p-checkbox, p-checkBox, p-check-box", inputs: ["value", "name", "disabled", "binary", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "style", "inputStyle", "styleClass", "inputClass", "indeterminate", "size", "formControl", "checkboxIcon", "readonly", "required", "autofocus", "trueValue", "falseValue", "variant"], outputs: ["onChange", "onFocus", "onBlur"] }, { kind: "ngmodule", type: DialogModule }, { kind: "component", type: i5.Dialog, selector: "p-dialog", inputs: ["header", "draggable", "resizable", "positionLeft", "positionTop", "contentStyle", "contentStyleClass", "modal", "closeOnEscape", "dismissableMask", "rtl", "closable", "responsive", "appendTo", "breakpoints", "styleClass", "maskStyleClass", "maskStyle", "showHeader", "breakpoint", "blockScroll", "autoZIndex", "baseZIndex", "minX", "minY", "focusOnShow", "maximizable", "keepInViewport", "focusTrap", "transitionOptions", "closeIcon", "closeAriaLabel", "closeTabindex", "minimizeIcon", "maximizeIcon", "closeButtonProps", "maximizeButtonProps", "visible", "style", "position", "role", "content", "contentTemplate", "footerTemplate", "closeIconTemplate", "maximizeIconTemplate", "minimizeIconTemplate", "headlessTemplate"], outputs: ["onShow", "onHide", "visibleChange", "onResizeInit", "onResizeEnd", "onDragEnd", "onMaximize"] }, { kind: "ngmodule", type: InputNumberModule }, { kind: "component", type: i6$2.InputNumber, selector: "p-inputNumber, p-inputnumber, p-input-number", inputs: ["showButtons", "format", "buttonLayout", "inputId", "styleClass", "style", "placeholder", "size", "maxlength", "tabindex", "title", "ariaLabelledBy", "ariaDescribedBy", "ariaLabel", "ariaRequired", "name", "required", "autocomplete", "min", "max", "incrementButtonClass", "decrementButtonClass", "incrementButtonIcon", "decrementButtonIcon", "readonly", "step", "allowEmpty", "locale", "localeMatcher", "mode", "currency", "currencyDisplay", "useGrouping", "variant", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "inputStyle", "inputStyleClass", "showClear", "autofocus", "disabled", "fluid"], outputs: ["onInput", "onFocus", "onBlur", "onKeyDown", "onClear"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i7.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant"], outputs: ["onClose"] }, { kind: "ngmodule", type: SelectModule }, { kind: "component", type: i8.Select, selector: "p-select", inputs: ["id", "scrollHeight", "filter", "name", "style", "panelStyle", "styleClass", "panelStyleClass", "readonly", "required", "editable", "appendTo", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "variant", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "autoDisplayFirst", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "size", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "maxlength", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "fluid", "disabled", "itemSize", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "filterValue", "options"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i5$1.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "style", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "ngmodule", type: TableModule }, { kind: "component", type: i6$1.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorStyleClass", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showJumpToPageInput", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "selectionPageOnly", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowSelectable", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "scrollDirection", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "virtualScrollDelay", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "autoLayout", "exportFunction", "exportHeader", "stateKey", "stateStorage", "editMode", "groupRowsBy", "size", "showGridlines", "stripedRows", "groupRowsByOrder", "responsiveLayout", "breakpoint", "paginatorLocale", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "virtualRowHeight", "selectAll"], outputs: ["contextMenuSelectionChange", "selectAllChange", "selectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { kind: "ngmodule", type: TagModule }, { kind: "component", type: i7$1.Tag, selector: "p-tag", inputs: ["style", "styleClass", "severity", "value", "icon", "rounded"] }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i8$1.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }] });
|
|
1329
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.17", type: LineSimulatorComponent, isStandalone: true, selector: "lib-line-simulator", inputs: { capacity: { classPropertyName: "capacity", publicName: "capacity", isSignal: true, isRequired: true, transformFunction: null }, capacityEditable: { classPropertyName: "capacityEditable", publicName: "capacityEditable", isSignal: true, isRequired: false, transformFunction: null }, simulation: { classPropertyName: "simulation", publicName: "simulation", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, errorMessage: { classPropertyName: "errorMessage", publicName: "errorMessage", isSignal: true, isRequired: false, transformFunction: null }, saved: { classPropertyName: "saved", publicName: "saved", isSignal: true, isRequired: false, transformFunction: null }, canEdit: { classPropertyName: "canEdit", publicName: "canEdit", isSignal: true, isRequired: false, transformFunction: null }, editableCharges: { classPropertyName: "editableCharges", publicName: "editableCharges", isSignal: true, isRequired: false, transformFunction: null }, canEditRate: { classPropertyName: "canEditRate", publicName: "canEditRate", isSignal: true, isRequired: false, transformFunction: null }, showSave: { classPropertyName: "showSave", publicName: "showSave", isSignal: true, isRequired: false, transformFunction: null }, saveBlockedReason: { classPropertyName: "saveBlockedReason", publicName: "saveBlockedReason", isSignal: true, isRequired: false, transformFunction: null }, saving: { classPropertyName: "saving", publicName: "saving", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { simulate: "simulate", save: "save", retry: "retry", lineChange: "lineChange", unsavedChange: "unsavedChange" }, ngImport: i0, template: "<div class=\"sfs-stack\">\n <!-- Capacidad de pago -->\n <section [attr.aria-labelledby]=\"ids.capacityTitle\">\n <h3 [id]=\"ids.capacityTitle\" class=\"sfs-subtitle sfs-gap-bottom\">Capacidad de pago</h3>\n @if (capacityEditable()) {\n <div class=\"sfs-capacity-grid\">\n @for (field of capacityFields; track field.key) {\n <div class=\"sfs-control\">\n <label [for]=\"ids.capacity + field.key\">{{ field.label }}</label>\n <p-inputnumber [inputId]=\"ids.capacity + field.key\" [ngModel]=\"currentCapacity()[field.key]\" (ngModelChange)=\"setCapacity(field.key, $event)\"\n mode=\"currency\" currency=\"COP\" [locale]=\"locale\" [minFractionDigits]=\"0\" [maxFractionDigits]=\"0\" [min]=\"0\" [fluid]=\"true\"></p-inputnumber>\n </div>\n }\n <div class=\"sfs-control sfs-control--check\">\n <p-checkbox [inputId]=\"ids.garnishment\" [binary]=\"true\" [ngModel]=\"currentCapacity().hasGarnishment\" (ngModelChange)=\"setGarnishment($event)\"></p-checkbox>\n <label [for]=\"ids.garnishment\">Tiene embargo</label>\n </div>\n </div>\n }\n <!-- Indicadores en grilla: varios por fila en escritorio, para que la capacidad no ocupe media pantalla. -->\n @if (!capacityEditable() || simulation()) {\n <dl class=\"sfs-metrics\" [class.sfs-gap-top]=\"capacityEditable()\">\n @if (!capacityEditable()) {\n <div><dt>Ingresos</dt><dd>{{ capacity().income | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Descuentos de ley</dt><dd>{{ capacity().legalDeductions | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Otras afiliaciones</dt><dd>{{ capacity().otherAffiliations | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Otros descuentos</dt><dd>{{ capacity().otherDeductions | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Compras de cartera</dt><dd>{{ capacity().purchasesValue | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Embargo</dt><dd>{{ capacity().hasGarnishment ? 'S\u00ED' : 'No' }}</dd></div>\n }\n @if (simulation(); as s) {\n <div><dt>Disponible n\u00F3mina</dt><dd class=\"sfs-strong\">{{ maxInstallment() | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n @if (!installmentEditable()) {\n <div><dt>Valor cuota</dt><dd class=\"sfs-strong\">{{ currentInstallment() | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n }\n <div><dt>Tope de monto</dt><dd>{{ s.capacity.maxAmount != null ? (s.capacity.maxAmount | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale) : '\u2014' }}</dd></div>\n }\n </dl>\n }\n <!-- La cuota la digita la persona: el simulador calcula con ella el m\u00E1ximo a financiar. No puede superar el\n disponible n\u00F3mina (incluye el aporte). -->\n @if (installmentEditable()) {\n <div class=\"sfs-control sfs-installment sfs-gap-top\">\n <label [for]=\"ids.installment\">Valor cuota</label>\n <p-inputnumber [inputId]=\"ids.installment\" [ngModel]=\"currentInstallment()\" (ngModelChange)=\"setInstallment($event)\"\n mode=\"currency\" currency=\"COP\" [locale]=\"locale\" [minFractionDigits]=\"0\" [maxFractionDigits]=\"0\" [min]=\"0\" [fluid]=\"true\"\n [ariaDescribedBy]=\"installmentError() ? ids.installmentError : undefined\"\n [inputStyleClass]=\"installmentError() ? 'ng-invalid ng-dirty' : ''\"></p-inputnumber>\n @if (installmentError(); as error) {\n <small [id]=\"ids.installmentError\" class=\"sfs-field-error\"><i class=\"pi pi-exclamation-circle\" aria-hidden=\"true\"></i> {{ error }}\n M\u00E1ximo {{ maxInstallment() | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}.</small>\n } @else {\n <small class=\"sfs-muted\">Hasta el disponible n\u00F3mina. Al recalcular, el monto sale de esta cuota.</small>\n }\n @if (maxInstallment() !== null && currentInstallment() !== maxInstallment()) {\n <div>\n <p-button label=\"Usar el disponible n\u00F3mina\" icon=\"pi pi-replay\" [text]=\"true\" size=\"small\" severity=\"secondary\"\n (onClick)=\"useMaxInstallment()\"></p-button>\n </div>\n }\n </div>\n }\n </section>\n\n @switch (state()) {\n @case ('loading') {\n <div class=\"sfs-stack\" aria-busy=\"true\">\n <p-skeleton height=\"2.5rem\"></p-skeleton>\n <p-skeleton height=\"12rem\"></p-skeleton>\n </div>\n }\n @case ('error') {\n <p-message severity=\"error\">\n <div class=\"sfs-inline\">\n <span>{{ errorMessage() || 'No se pudo simular la solicitud.' }}</span>\n <p-button label=\"Reintentar\" icon=\"pi pi-refresh\" [text]=\"true\" (onClick)=\"retrySimulation()\"></p-button>\n </div>\n </p-message>\n @if (capacityEditable() && pendingChanges()) {\n <div class=\"sfs-actions\">\n <p-button label=\"Recalcular\" icon=\"pi pi-calculator\" severity=\"secondary\" [text]=\"true\" [disabled]=\"hasNegativeInput()\" (onClick)=\"recalculate()\"></p-button>\n </div>\n }\n }\n @case ('idle') {\n @if (capacityEditable()) {\n <div class=\"sfs-actions\">\n <p-button label=\"Simular\" icon=\"pi pi-calculator\" [disabled]=\"hasNegativeInput()\" (onClick)=\"recalculate()\"></p-button>\n </div>\n } @else {\n <p class=\"sfs-muted sfs-no-top\">Todav\u00EDa no hay una simulaci\u00F3n para esta solicitud.</p>\n }\n }\n @case ('ready') {\n @if (simulation()?.warnings?.length) {\n <p-message severity=\"warn\">\n <ul class=\"sfs-list\">\n @for (w of simulation()?.warnings ?? []; track $index) { <li>{{ w }}</li> }\n </ul>\n </p-message>\n }\n\n @if (!lineOptions().length) {\n <p-message severity=\"info\" text=\"El simulador no devolvi\u00F3 l\u00EDneas para esta solicitud. Revise la pagadur\u00EDa, el producto y la capacidad de pago.\"></p-message>\n }\n\n <!-- L\u00EDnea, plazo, monto y tasa en una sola fila en escritorio. p-select pone el inputId en un span: el nombre\n accesible va por ariaLabelledBy. -->\n <div class=\"sfs-conditions\">\n <div class=\"sfs-control sfs-conditions__line\">\n <label [id]=\"ids.lineLabel\" [for]=\"ids.line\" class=\"sfs-strong\">L\u00EDnea</label>\n <p-select [inputId]=\"ids.line\" [ariaLabelledBy]=\"ids.lineLabel\" [options]=\"lineOptions()\" optionLabel=\"label\" optionValue=\"value\" optionDisabled=\"disabled\"\n [ngModel]=\"selectedLine()\" (ngModelChange)=\"chooseLine($event)\" placeholder=\"Seleccione una l\u00EDnea\" [fluid]=\"true\"></p-select>\n </div>\n @if (line(); as l) {\n @if (!l.error) {\n <div class=\"sfs-control\">\n <label [for]=\"ids.term\">Plazo (cuotas)</label>\n <p-inputnumber [inputId]=\"ids.term\" [ngModel]=\"termInput()\" (ngModelChange)=\"termInput.set($event)\"\n [min]=\"simulation()?.minTerm ?? 1\" [max]=\"simulation()?.maxTerm ?? 600\" [useGrouping]=\"false\"\n [disabled]=\"!canEdit()\" [fluid]=\"true\"></p-inputnumber>\n </div>\n <div class=\"sfs-control\">\n <label [for]=\"ids.amount\">Monto</label>\n <p-inputnumber [inputId]=\"ids.amount\" [ngModel]=\"amountInput()\" (ngModelChange)=\"amountInput.set($event)\"\n mode=\"currency\" currency=\"COP\" [locale]=\"locale\" [minFractionDigits]=\"0\" [maxFractionDigits]=\"0\" [min]=\"0\"\n [disabled]=\"!canEdit()\" [fluid]=\"true\"></p-inputnumber>\n </div>\n @if (rateEditable()) {\n <div class=\"sfs-control\">\n <label [id]=\"ids.rateLabel\" [for]=\"ids.rate\">Tasa</label>\n <p-select [inputId]=\"ids.rate\" [ariaLabelledBy]=\"ids.rateLabel\" [options]=\"rateOptions()\" optionLabel=\"label\" optionValue=\"value\"\n [ngModel]=\"currentRate()\" (ngModelChange)=\"rateInput.set($event)\" [fluid]=\"true\" appendTo=\"body\"></p-select>\n </div>\n } @else {\n <div class=\"sfs-control sfs-conditions__rate\">\n <span>Tasa</span>\n <span class=\"sfs-strong\">{{ l.rate | number: '1.0-4' : locale }} % M.V.</span>\n </div>\n }\n }\n }\n </div>\n @if (saved()?.line && saved()?.line !== selectedLine()) {\n <small class=\"sfs-muted sfs-no-gap\">La l\u00EDnea guardada es {{ savedLineName() }}. Al guardar se cambia por la elegida.</small>\n }\n\n @if (line(); as l) {\n @if (l.error) {\n <p-message severity=\"error\" text=\"Esta l\u00EDnea no se pudo simular. Elija otra o intente m\u00E1s tarde.\"></p-message>\n } @else {\n <!-- Cargos de la l\u00EDnea: plegados, porque casi nunca se tocan. Al desplegarlos, los del cr\u00E9dito (se descuentan\n del desembolso o van al capital) y los de la cuota, cada uno en su columna. -->\n <section [attr.aria-labelledby]=\"ids.chargesTitle\">\n <div class=\"sfs-head\">\n <h3 [id]=\"ids.chargesTitle\" class=\"sfs-subtitle\">Cargos</h3>\n <!-- pButton y no p-button: el componente no deja poner aria-expanded en su <button>. -->\n <button pButton type=\"button\" severity=\"secondary\" [text]=\"true\" size=\"small\"\n [label]=\"(chargesOpen() ? 'Ocultar cargos' : 'Ver cargos') + (editedChargesCount() ? ' (' + editedChargesCount() + ' cambiados)' : '')\"\n [icon]=\"chargesOpen() ? 'pi pi-chevron-up' : 'pi pi-chevron-down'\" iconPos=\"right\"\n [attr.aria-expanded]=\"chargesOpen()\" [attr.aria-controls]=\"ids.charges\"\n (click)=\"chargesOpen.set(!chargesOpen())\"></button>\n </div>\n @if (chargesOpen()) {\n <div [id]=\"ids.charges\" class=\"sfs-charges\">\n <div>\n <h4 class=\"sfs-charges__title\">Del cr\u00E9dito</h4>\n <p-table [value]=\"creditChargeRows()\" size=\"small\" [scrollable]=\"true\" dataKey=\"name\" styleClass=\"sfs-stack-table\">\n <ng-template #header>\n <tr>\n <th>Cargo</th>\n <th class=\"sfs-right\">Guardado</th>\n <th class=\"sfs-right\">Configurado</th>\n <th class=\"sfs-right\">Valor</th>\n </tr>\n </ng-template>\n <ng-template #body let-row>\n <tr>\n <td class=\"sfs-stack-title\">{{ row.label }}</td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Guardado\">\n @if (row.savedInput === null) { \u2014 }\n @else { {{ row.percentage ? (row.savedInput | number: '1.0-4' : locale) + ' %' : (row.savedInput | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale) }} }\n </td>\n <td class=\"sfs-right\" data-label=\"Configurado\">\n @if (row.editable) {\n <label [for]=\"row.id\" class=\"sfs-sr-only\">{{ row.label }}</label>\n <p-inputnumber [inputId]=\"row.id\" [ngModel]=\"chargeInputs()[row.name]\" (ngModelChange)=\"setChargeInput(row.name, $event)\"\n [min]=\"0\" [minFractionDigits]=\"0\" [maxFractionDigits]=\"row.percentage ? 4 : 0\" [locale]=\"locale\"\n [suffix]=\"row.percentage ? ' %' : ''\" [prefix]=\"row.percentage ? '' : '$ '\" inputStyleClass=\"sfs-charge-input\"></p-inputnumber>\n } @else {\n {{ row.percentage ? (row.simulatedInput | number: '1.0-4' : locale) + ' %' : (row.simulatedInput | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale) }}\n }\n </td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Valor\">{{ row.value | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</td>\n </tr>\n </ng-template>\n <ng-template #emptymessage>\n <tr><td colspan=\"4\">La l\u00EDnea no tiene cargos del cr\u00E9dito.</td></tr>\n </ng-template>\n </p-table>\n </div>\n <div>\n <h4 class=\"sfs-charges__title\">De la cuota</h4>\n <p-table [value]=\"installmentChargeRows()\" size=\"small\" [scrollable]=\"true\" dataKey=\"name\" styleClass=\"sfs-stack-table\">\n <ng-template #header>\n <tr>\n <th>Cargo</th>\n <th class=\"sfs-right\">Guardado</th>\n <th class=\"sfs-right\">Configurado</th>\n <th class=\"sfs-right\">Valor</th>\n </tr>\n </ng-template>\n <ng-template #body let-row>\n <tr>\n <td class=\"sfs-stack-title\">{{ row.label }}</td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Guardado\">\n @if (row.savedInput === null) { \u2014 }\n @else { {{ row.percentage ? (row.savedInput | number: '1.0-4' : locale) + ' %' : (row.savedInput | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale) }} }\n </td>\n <td class=\"sfs-right\" data-label=\"Configurado\">\n @if (row.editable) {\n <label [for]=\"row.id\" class=\"sfs-sr-only\">{{ row.label }}</label>\n <p-inputnumber [inputId]=\"row.id\" [ngModel]=\"chargeInputs()[row.name]\" (ngModelChange)=\"setChargeInput(row.name, $event)\"\n [min]=\"0\" [minFractionDigits]=\"0\" [maxFractionDigits]=\"row.percentage ? 4 : 0\" [locale]=\"locale\"\n [suffix]=\"row.percentage ? ' %' : ''\" [prefix]=\"row.percentage ? '' : '$ '\" inputStyleClass=\"sfs-charge-input\"></p-inputnumber>\n } @else {\n {{ row.percentage ? (row.simulatedInput | number: '1.0-4' : locale) + ' %' : (row.simulatedInput | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale) }}\n }\n </td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Valor\">{{ row.value | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</td>\n </tr>\n </ng-template>\n <ng-template #emptymessage>\n <tr><td colspan=\"4\">La l\u00EDnea no tiene cargos en la cuota.</td></tr>\n </ng-template>\n </p-table>\n </div>\n </div>\n @if (zeroChargesCount()) {\n <!-- Los cargos en cero (sin guardado, sin configurado y sin valor) ocupan espacio y no cambian nada. -->\n <div class=\"sfs-no-gap\">\n <p-button [label]=\"showZeroCharges() ? 'Ocultar los cargos en cero' : 'Ver ' + zeroChargesCount() + (zeroChargesCount() === 1 ? ' cargo en cero' : ' cargos en cero')\"\n [icon]=\"showZeroCharges() ? 'pi pi-eye-slash' : 'pi pi-eye'\" [text]=\"true\" size=\"small\" severity=\"secondary\"\n [ariaLabel]=\"showZeroCharges() ? 'Ocultar los cargos en cero' : 'Ver los cargos en cero'\"\n (onClick)=\"showZeroCharges.set(!showZeroCharges())\"></p-button>\n </div>\n }\n }\n </section>\n\n <!-- Resultado frente a lo guardado -->\n <section [attr.aria-labelledby]=\"ids.resultTitle\">\n <div class=\"sfs-head\">\n <h3 [id]=\"ids.resultTitle\" class=\"sfs-subtitle\">Resultado</h3>\n <p-tag [value]=\"l.viable ? 'Viable' : 'No viable'\" [severity]=\"l.viable ? 'success' : 'warn'\"></p-tag>\n </div>\n @if (summary(); as sm) {\n <dl class=\"sfs-summary\">\n <div><dt>M\u00E1ximo a financiar</dt><dd class=\"sfs-strong\">{{ sm.maxAmount | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Monto</dt><dd>{{ sm.amount | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Descuentos del cr\u00E9dito</dt><dd>{{ sm.creditDiscounts | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Desembolso</dt><dd>{{ sm.disbursement | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Compras de cartera</dt><dd>{{ sm.purchases !== null ? (sm.purchases | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale) : '\u2014' }}</dd></div>\n <div><dt>Sanear</dt><dd>{{ sm.cleanUp !== null ? (sm.cleanUp | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale) : '\u2014' }}</dd></div>\n <!-- Neto a girar resaltado: con el color de \u00E9xito o de error del tema y, adem\u00E1s, un icono y el texto. -->\n <div class=\"sfs-net\" [class.sfs-net--negative]=\"sm.net < 0\">\n <dt>Neto a girar</dt>\n <dd>\n <i [class]=\"sm.net < 0 ? 'pi pi-exclamation-triangle' : 'pi pi-check-circle'\" aria-hidden=\"true\"></i>\n {{ sm.net | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}\n @if (sm.net < 0) { <span class=\"sfs-net__note\">Negativo: no alcanza para las compras de cartera.</span> }\n </dd>\n </div>\n </dl>\n }\n <p-table [value]=\"comparison()\" size=\"small\" [scrollable]=\"true\" dataKey=\"label\" styleClass=\"sfs-stack-table\">\n <ng-template #header>\n <tr><th>Concepto</th><th class=\"sfs-right\">Guardado</th><th class=\"sfs-right\">Simulaci\u00F3n</th></tr>\n </ng-template>\n <ng-template #body let-row>\n <tr>\n <td class=\"sfs-stack-title\">{{ row.label }}</td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Guardado\">\n <ng-container *ngTemplateOutlet=\"valueTpl; context: { $implicit: row.saved, kind: row.kind }\"></ng-container>\n </td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Simulaci\u00F3n\">\n @if (row.changed) { <span class=\"sfs-tag-before\"><p-tag value=\"Cambia\" severity=\"warn\"></p-tag></span> }\n <span [class.sfs-strong]=\"row.changed\">\n <ng-container *ngTemplateOutlet=\"valueTpl; context: { $implicit: row.simulated, kind: row.kind }\"></ng-container>\n </span>\n </td>\n </tr>\n </ng-template>\n </p-table>\n @if (!l.viable && l.viabilityReasons.length) {\n <ul class=\"sfs-list sfs-gap-top\">\n @for (reason of l.viabilityReasons; track $index) { <li>{{ reason }}</li> }\n </ul>\n }\n </section>\n\n <!-- Acciones -->\n <div class=\"sfs-actions\">\n @if (canEdit() || capacityEditable()) {\n <p-button label=\"Recalcular\" icon=\"pi pi-calculator\" severity=\"secondary\" [text]=\"true\"\n [disabled]=\"!pendingChanges() || hasNegativeInput()\" (onClick)=\"recalculate()\"></p-button>\n }\n @if (showSave()) {\n <!-- pButton y no p-button: sin poder guardar el bot\u00F3n queda aria-disabled (no disabled) para que el\n motivo se vea con Tab y con el mouse; openConfirm() corta el clic cuando hay motivo. -->\n <button pButton type=\"button\" label=\"Guardar condiciones\" aria-label=\"Guardar condiciones\"\n [icon]=\"saveUnavailableReason() ? 'pi pi-lock' : 'pi pi-save'\"\n [class.sfs-unavailable]=\"!!saveUnavailableReason()\"\n [attr.aria-disabled]=\"saveUnavailableReason() ? 'true' : null\"\n [attr.aria-describedby]=\"saveUnavailableReason() ? ids.saveReason : null\"\n [pTooltip]=\"saveUnavailableReason() ?? ''\" [tooltipDisabled]=\"!saveUnavailableReason()\" tooltipPosition=\"top\" tooltipEvent=\"both\"\n (click)=\"openConfirm()\"></button>\n @if (saveUnavailableReason()) {\n <span [id]=\"ids.saveReason\" class=\"sfs-sr-only\">{{ saveUnavailableReason() }}</span>\n }\n }\n </div>\n }\n }\n }\n }\n</div>\n\n<!-- Siempre montada: anuncia el resultado de cada simulaci\u00F3n (la de arriba se destruye mientras carga). -->\n<div class=\"sfs-sr-only\" role=\"status\" aria-live=\"polite\">{{ liveMessage() }}</div>\n\n<!-- Un valor de la comparaci\u00F3n, en su formato -->\n<ng-template #valueTpl let-value let-kind=\"kind\">\n @if (value === null || value === undefined || value === '') { \u2014 }\n @else {\n @switch (kind) {\n @case ('money') { {{ value | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }} }\n @case ('rate') { {{ value | number: '1.0-4' : locale }} % M.V. }\n @case ('term') { {{ value }} cuotas }\n @default { {{ value }} }\n }\n }\n</ng-template>\n\n<!-- Confirmaci\u00F3n: cambia l\u00EDnea, monto, plazo y cargos de la solicitud -->\n<p-dialog header=\"Guardar condiciones\" [visible]=\"confirmVisible()\" (visibleChange)=\"confirmVisible.set($event)\" (onHide)=\"restoreConfirmFocus()\"\n [modal]=\"true\" [draggable]=\"false\" [closable]=\"!saving()\" [style]=\"{ width: '32rem', maxWidth: '95vw' }\">\n @if (confirmVisible() && line(); as l) {\n <p class=\"sfs-no-top\">\n Se guardar\u00E1n la l\u00EDnea <strong>{{ l.lineName || l.line }}</strong>,\n un monto de <strong>{{ l.amount | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</strong>\n a <strong>{{ l.term }} cuotas</strong> con una tasa de <strong>{{ l.rate | number: '1.0-4' : locale }} % M.V.</strong> y una cuota de <strong>{{ l.installment | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</strong>,\n con un giro al cliente de <strong>{{ l.transfer | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</strong>.\n </p>\n @if (!l.viable) {\n <p-message severity=\"warn\" text=\"La l\u00EDnea no es viable con la capacidad de pago de la solicitud.\"></p-message>\n }\n }\n <ng-template #footer>\n <p-button label=\"Cancelar\" severity=\"secondary\" [text]=\"true\" [disabled]=\"saving()\" (onClick)=\"confirmVisible.set(false)\"></p-button>\n <p-button label=\"Guardar condiciones\" icon=\"pi pi-save\" [loading]=\"saving()\" (onClick)=\"confirmSave()\"></p-button>\n </ng-template>\n</p-dialog>\n", styles: [".sfs-title{margin:0;font-size:1.125rem;font-weight:600}.sfs-subtitle{margin:0;font-size:1rem;font-weight:600}.sfs-muted{color:var(--p-text-muted-color)}.sfs-section-title{display:flex;align-items:center;gap:.5rem;margin:0 0 .75rem;font-size:1rem;font-weight:600}.sfs-section-title i{color:var(--primary-color, var(--p-primary-color))}.sfs-inline{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem}.sfs-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:.5rem;margin-bottom:.75rem}.sfs-break{overflow-wrap:anywhere}.sfs-nowrap{white-space:nowrap}.sfs-right{text-align:right}.sfs-strong{font-weight:600}.sfs-tag-gap{margin-left:.5rem}.sfs-stack{display:flex;flex-direction:column;gap:1rem}.sfs-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.sfs-summary{display:grid;grid-template-columns:minmax(8rem,max-content) 1fr;gap:.25rem 1rem;margin:0}.sfs-summary dt{color:var(--p-text-muted-color)}.sfs-summary dd{margin:0;text-align:right;font-variant-numeric:tabular-nums}@media (max-width: 575px){:host ::ng-deep .sfs-stack-table .p-datatable-table-container{overflow:visible!important}:host ::ng-deep .sfs-stack-table table,:host ::ng-deep .sfs-stack-table tbody{display:block;width:100%}:host ::ng-deep .sfs-stack-table thead{display:block!important;position:absolute!important;width:1px!important;height:1px!important;overflow:hidden!important;clip-path:inset(50%);white-space:nowrap}:host ::ng-deep .sfs-stack-table tbody tr{display:flex;flex-direction:column;margin-bottom:.5rem;padding:.5rem .75rem;border:1px solid var(--p-content-border-color);border-radius:var(--p-content-border-radius, 6px)}:host ::ng-deep .sfs-stack-table tbody td{display:flex;align-items:center;justify-content:flex-end;gap:.375rem;padding:.3rem 0;border:0;text-align:right}:host ::ng-deep .sfs-stack-table tbody td[data-label]:before{content:attr(data-label);margin-right:auto;padding-right:1rem;color:var(--p-text-muted-color);text-align:left}:host ::ng-deep .sfs-stack-table tbody td.sfs-stack-title{order:-1;display:block;font-weight:600;text-align:left}:host ::ng-deep .sfs-stack-table tfoot,:host ::ng-deep .sfs-stack-table .sfs-stack-hide{display:none}}\n", ".sfs-control{display:flex;flex-direction:column;gap:.25rem;min-width:0}.sfs-control--check{flex-direction:row;align-items:center;gap:.5rem;align-self:end;min-height:2.75rem}.sfs-capacity-grid{display:grid;grid-template-columns:minmax(0,1fr);gap:.75rem}@media (min-width: 576px){.sfs-capacity-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}.sfs-conditions{display:grid;grid-template-columns:minmax(0,1fr);gap:.75rem;align-items:end}@media (min-width: 576px){.sfs-conditions{grid-template-columns:repeat(2,minmax(0,1fr))}.sfs-conditions__line{grid-column:1 / -1}}@media (min-width: 992px){.sfs-conditions{grid-template-columns:minmax(0,2fr) minmax(0,1fr) minmax(0,1fr) minmax(9rem,1fr)}.sfs-conditions__line{grid-column:auto}}.sfs-conditions__rate{justify-content:flex-end;min-height:2.5rem;padding-bottom:.5rem}.sfs-metrics{display:grid;grid-template-columns:repeat(auto-fill,minmax(9.5rem,1fr));gap:.5rem 1rem;margin:0}.sfs-metrics dt{font-size:.8125rem;color:var(--p-text-muted-color)}.sfs-metrics dd{margin:0;font-variant-numeric:tabular-nums}.sfs-no-gap{margin-top:-.75rem}.sfs-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:.5rem}.sfs-list{margin:0;padding-left:1rem}.sfs-gap-top{margin-top:.5rem}.sfs-gap-bottom{margin-bottom:.5rem}.sfs-no-top{margin-top:0}.sfs-tag-before{margin-right:.5rem}:host ::ng-deep .sfs-charge-input{width:6.5rem;padding-block:.25rem;text-align:right}:host ::ng-deep .sfs-unavailable.p-button{opacity:var(--p-disabled-opacity);cursor:default}:host ::ng-deep .sfs-unavailable.p-button:hover,:host ::ng-deep .sfs-unavailable.p-button:active{background:var(--button-color, var(--p-button-primary-background));border-color:var(--button-color, var(--p-button-primary-border-color))}.sfs-installment{max-width:20rem}.sfs-field-error{color:var(--p-message-error-simple-color, var(--p-text-color))}.sfs-charges{display:grid;grid-template-columns:minmax(0,1fr);gap:1rem}@media (min-width: 992px){.sfs-charges{grid-template-columns:repeat(2,minmax(0,1fr))}}.sfs-charges__title{margin:0 0 .5rem;font-size:.875rem;font-weight:600;color:var(--p-text-muted-color)}.sfs-summary{display:grid;grid-template-columns:repeat(auto-fill,minmax(10rem,1fr));gap:.5rem 1rem;margin:0 0 1rem}.sfs-summary dt{font-size:.8125rem;color:var(--p-text-muted-color)}.sfs-summary dd{margin:0}.sfs-net{grid-column:1 / -1;padding:.5rem .75rem;border:1px solid var(--p-message-success-border-color, var(--p-content-border-color));border-radius:var(--p-content-border-radius, 6px);background:var(--p-message-success-background, var(--p-content-background));color:var(--p-message-success-color, var(--p-text-color))}.sfs-net dt{color:inherit;font-weight:600}.sfs-net dd{font-size:1.25rem;font-weight:700}.sfs-net--negative{border-color:var(--p-message-error-border-color, var(--p-content-border-color));background:var(--p-message-error-background, var(--p-content-background));color:var(--p-message-error-color, var(--p-text-color))}.sfs-net__note{display:block;font-size:.8125rem;font-weight:400}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: i1$1.DecimalPipe, name: "number" }, { kind: "pipe", type: i1$1.CurrencyPipe, name: "currency" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "directive", type: i2.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "loading", "severity", "raised", "rounded", "text", "outlined", "size", "plain", "fluid", "label", "icon", "buttonProps"] }, { kind: "component", type: i2.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: CheckboxModule }, { kind: "component", type: i3.Checkbox, selector: "p-checkbox, p-checkBox, p-check-box", inputs: ["value", "name", "disabled", "binary", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "style", "inputStyle", "styleClass", "inputClass", "indeterminate", "size", "formControl", "checkboxIcon", "readonly", "required", "autofocus", "trueValue", "falseValue", "variant"], outputs: ["onChange", "onFocus", "onBlur"] }, { kind: "ngmodule", type: DialogModule }, { kind: "component", type: i5.Dialog, selector: "p-dialog", inputs: ["header", "draggable", "resizable", "positionLeft", "positionTop", "contentStyle", "contentStyleClass", "modal", "closeOnEscape", "dismissableMask", "rtl", "closable", "responsive", "appendTo", "breakpoints", "styleClass", "maskStyleClass", "maskStyle", "showHeader", "breakpoint", "blockScroll", "autoZIndex", "baseZIndex", "minX", "minY", "focusOnShow", "maximizable", "keepInViewport", "focusTrap", "transitionOptions", "closeIcon", "closeAriaLabel", "closeTabindex", "minimizeIcon", "maximizeIcon", "closeButtonProps", "maximizeButtonProps", "visible", "style", "position", "role", "content", "contentTemplate", "footerTemplate", "closeIconTemplate", "maximizeIconTemplate", "minimizeIconTemplate", "headlessTemplate"], outputs: ["onShow", "onHide", "visibleChange", "onResizeInit", "onResizeEnd", "onDragEnd", "onMaximize"] }, { kind: "ngmodule", type: InputNumberModule }, { kind: "component", type: i6$2.InputNumber, selector: "p-inputNumber, p-inputnumber, p-input-number", inputs: ["showButtons", "format", "buttonLayout", "inputId", "styleClass", "style", "placeholder", "size", "maxlength", "tabindex", "title", "ariaLabelledBy", "ariaDescribedBy", "ariaLabel", "ariaRequired", "name", "required", "autocomplete", "min", "max", "incrementButtonClass", "decrementButtonClass", "incrementButtonIcon", "decrementButtonIcon", "readonly", "step", "allowEmpty", "locale", "localeMatcher", "mode", "currency", "currencyDisplay", "useGrouping", "variant", "minFractionDigits", "maxFractionDigits", "prefix", "suffix", "inputStyle", "inputStyleClass", "showClear", "autofocus", "disabled", "fluid"], outputs: ["onInput", "onFocus", "onBlur", "onKeyDown", "onClear"] }, { kind: "ngmodule", type: MessageModule }, { kind: "component", type: i7.Message, selector: "p-message", inputs: ["severity", "text", "escape", "style", "styleClass", "closable", "icon", "closeIcon", "life", "showTransitionOptions", "hideTransitionOptions", "size", "variant"], outputs: ["onClose"] }, { kind: "ngmodule", type: SelectModule }, { kind: "component", type: i8.Select, selector: "p-select", inputs: ["id", "scrollHeight", "filter", "name", "style", "panelStyle", "styleClass", "panelStyleClass", "readonly", "required", "editable", "appendTo", "tabindex", "placeholder", "loadingIcon", "filterPlaceholder", "filterLocale", "variant", "inputId", "dataKey", "filterBy", "filterFields", "autofocus", "resetFilterOnHide", "checkmark", "dropdownIcon", "loading", "optionLabel", "optionValue", "optionDisabled", "optionGroupLabel", "optionGroupChildren", "autoDisplayFirst", "group", "showClear", "emptyFilterMessage", "emptyMessage", "lazy", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "size", "overlayOptions", "ariaFilterLabel", "ariaLabel", "ariaLabelledBy", "filterMatchMode", "maxlength", "tooltip", "tooltipPosition", "tooltipPositionStyle", "tooltipStyleClass", "focusOnHover", "selectOnFocus", "autoOptionFocus", "autofocusFilter", "fluid", "disabled", "itemSize", "autoZIndex", "baseZIndex", "showTransitionOptions", "hideTransitionOptions", "filterValue", "options"], outputs: ["onChange", "onFilter", "onFocus", "onBlur", "onClick", "onShow", "onHide", "onClear", "onLazyLoad"] }, { kind: "ngmodule", type: SkeletonModule }, { kind: "component", type: i5$1.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "style", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "ngmodule", type: TableModule }, { kind: "component", type: i6$1.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorStyleClass", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showJumpToPageInput", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "selectionPageOnly", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowSelectable", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "scrollDirection", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "virtualScrollDelay", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "autoLayout", "exportFunction", "exportHeader", "stateKey", "stateStorage", "editMode", "groupRowsBy", "size", "showGridlines", "stripedRows", "groupRowsByOrder", "responsiveLayout", "breakpoint", "paginatorLocale", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "virtualRowHeight", "selectAll"], outputs: ["contextMenuSelectionChange", "selectAllChange", "selectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { kind: "ngmodule", type: TagModule }, { kind: "component", type: i7$1.Tag, selector: "p-tag", inputs: ["style", "styleClass", "severity", "value", "icon", "rounded"] }, { kind: "ngmodule", type: TooltipModule }, { kind: "directive", type: i8$1.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "autoHide", "fitContent", "hideOnEscape", "pTooltip", "tooltipDisabled", "tooltipOptions"] }] });
|
|
1211
1330
|
}
|
|
1212
1331
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: LineSimulatorComponent, decorators: [{
|
|
1213
1332
|
type: Component,
|
|
@@ -1224,8 +1343,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
|
|
|
1224
1343
|
TableModule,
|
|
1225
1344
|
TagModule,
|
|
1226
1345
|
TooltipModule
|
|
1227
|
-
], template: "<div class=\"sfs-stack\">\n <!-- Capacidad de pago -->\n <section [attr.aria-labelledby]=\"ids.capacityTitle\">\n <h3 [id]=\"ids.capacityTitle\" class=\"sfs-subtitle sfs-gap-bottom\">Capacidad de pago</h3>\n @if (capacityEditable()) {\n <div class=\"sfs-capacity-grid\">\n @for (field of capacityFields; track field.key) {\n <div class=\"sfs-control\">\n <label [for]=\"ids.capacity + field.key\">{{ field.label }}</label>\n <p-inputnumber [inputId]=\"ids.capacity + field.key\" [ngModel]=\"currentCapacity()[field.key]\" (ngModelChange)=\"setCapacity(field.key, $event)\"\n mode=\"currency\" currency=\"COP\" [locale]=\"locale\" [minFractionDigits]=\"0\" [maxFractionDigits]=\"0\" [min]=\"0\" [fluid]=\"true\"></p-inputnumber>\n </div>\n }\n <div class=\"sfs-control sfs-control--check\">\n <p-checkbox [inputId]=\"ids.garnishment\" [binary]=\"true\" [ngModel]=\"currentCapacity().hasGarnishment\" (ngModelChange)=\"setGarnishment($event)\"></p-checkbox>\n <label [for]=\"ids.garnishment\">Tiene embargo</label>\n </div>\n </div>\n }\n <!-- Indicadores en grilla: varios por fila en escritorio, para que la capacidad no ocupe media pantalla. -->\n @if (!capacityEditable() || simulation()) {\n <dl class=\"sfs-metrics\" [class.sfs-gap-top]=\"capacityEditable()\">\n @if (!capacityEditable()) {\n <div><dt>Ingresos</dt><dd>{{ capacity().income | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Descuentos de ley</dt><dd>{{ capacity().legalDeductions | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Otras afiliaciones</dt><dd>{{ capacity().otherAffiliations | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Otros descuentos</dt><dd>{{ capacity().otherDeductions | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Compras de cartera</dt><dd>{{ capacity().purchasesValue | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Embargo</dt><dd>{{ capacity().hasGarnishment ? 'S\u00ED' : 'No' }}</dd></div>\n }\n @if (simulation(); as s) {\n <div><dt>Cuota disponible</dt><dd class=\"sfs-strong\">{{ s.capacity.availableInstallment | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Monto m\u00E1ximo</dt><dd class=\"sfs-strong\">{{ s.capacity.maxAmount != null ? (s.capacity.maxAmount | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale) : '\u2014' }}</dd></div>\n }\n </dl>\n }\n </section>\n\n @switch (state()) {\n @case ('loading') {\n <div class=\"sfs-stack\" aria-busy=\"true\">\n <p-skeleton height=\"2.5rem\"></p-skeleton>\n <p-skeleton height=\"12rem\"></p-skeleton>\n </div>\n }\n @case ('error') {\n <p-message severity=\"error\">\n <div class=\"sfs-inline\">\n <span>{{ errorMessage() || 'No se pudo simular la solicitud.' }}</span>\n <p-button label=\"Reintentar\" icon=\"pi pi-refresh\" [text]=\"true\" (onClick)=\"retrySimulation()\"></p-button>\n </div>\n </p-message>\n @if (capacityEditable() && pendingChanges()) {\n <div class=\"sfs-actions\">\n <p-button label=\"Recalcular\" icon=\"pi pi-calculator\" severity=\"secondary\" [text]=\"true\" [disabled]=\"hasNegativeInput()\" (onClick)=\"recalculate()\"></p-button>\n </div>\n }\n }\n @case ('idle') {\n @if (capacityEditable()) {\n <div class=\"sfs-actions\">\n <p-button label=\"Simular\" icon=\"pi pi-calculator\" [disabled]=\"hasNegativeInput()\" (onClick)=\"recalculate()\"></p-button>\n </div>\n } @else {\n <p class=\"sfs-muted sfs-no-top\">Todav\u00EDa no hay una simulaci\u00F3n para esta solicitud.</p>\n }\n }\n @case ('ready') {\n @if (simulation()?.warnings?.length) {\n <p-message severity=\"warn\">\n <ul class=\"sfs-list\">\n @for (w of simulation()?.warnings ?? []; track $index) { <li>{{ w }}</li> }\n </ul>\n </p-message>\n }\n\n @if (!lineOptions().length) {\n <p-message severity=\"info\" text=\"El simulador no devolvi\u00F3 l\u00EDneas para esta solicitud. Revise la pagadur\u00EDa, el producto y la capacidad de pago.\"></p-message>\n }\n\n <!-- L\u00EDnea, plazo, monto y tasa en una sola fila en escritorio. p-select pone el inputId en un span: el nombre\n accesible va por ariaLabelledBy. -->\n <div class=\"sfs-conditions\">\n <div class=\"sfs-control sfs-conditions__line\">\n <label [id]=\"ids.lineLabel\" [for]=\"ids.line\" class=\"sfs-strong\">L\u00EDnea</label>\n <p-select [inputId]=\"ids.line\" [ariaLabelledBy]=\"ids.lineLabel\" [options]=\"lineOptions()\" optionLabel=\"label\" optionValue=\"value\" optionDisabled=\"disabled\"\n [ngModel]=\"selectedLine()\" (ngModelChange)=\"chooseLine($event)\" placeholder=\"Seleccione una l\u00EDnea\" [fluid]=\"true\"></p-select>\n </div>\n @if (line(); as l) {\n @if (!l.error) {\n <div class=\"sfs-control\">\n <label [for]=\"ids.term\">Plazo (cuotas)</label>\n <p-inputnumber [inputId]=\"ids.term\" [ngModel]=\"termInput()\" (ngModelChange)=\"termInput.set($event)\"\n [min]=\"simulation()?.minTerm ?? 1\" [max]=\"simulation()?.maxTerm ?? 600\" [useGrouping]=\"false\"\n [disabled]=\"!canEdit()\" [fluid]=\"true\"></p-inputnumber>\n </div>\n <div class=\"sfs-control\">\n <label [for]=\"ids.amount\">Monto</label>\n <p-inputnumber [inputId]=\"ids.amount\" [ngModel]=\"amountInput()\" (ngModelChange)=\"amountInput.set($event)\"\n mode=\"currency\" currency=\"COP\" [locale]=\"locale\" [minFractionDigits]=\"0\" [maxFractionDigits]=\"0\" [min]=\"0\"\n [disabled]=\"!canEdit()\" [fluid]=\"true\"></p-inputnumber>\n </div>\n <div class=\"sfs-control sfs-conditions__rate\">\n <span>Tasa</span>\n <span class=\"sfs-strong\">{{ l.rate | number: '1.0-4' : locale }} % M.V.</span>\n </div>\n }\n }\n </div>\n @if (saved()?.line && saved()?.line !== selectedLine()) {\n <small class=\"sfs-muted sfs-no-gap\">La l\u00EDnea guardada es {{ savedLineName() }}. Al guardar se cambia por la elegida.</small>\n }\n\n @if (line(); as l) {\n @if (l.error) {\n <p-message severity=\"error\" text=\"Esta l\u00EDnea no se pudo simular. Elija otra o intente m\u00E1s tarde.\"></p-message>\n } @else {\n <!-- Cargos de la l\u00EDnea, con lo guardado al lado -->\n <p-table [value]=\"visibleChargeRows()\" size=\"small\" [scrollable]=\"true\" dataKey=\"name\" styleClass=\"sfs-stack-table\">\n <ng-template #header>\n <tr>\n <th>Cargo</th>\n <th>Tipo</th>\n <th class=\"sfs-right\">Guardado</th>\n <th class=\"sfs-right\">Configurado</th>\n <th class=\"sfs-right\">Valor</th>\n </tr>\n </ng-template>\n <ng-template #body let-row>\n <tr>\n <td class=\"sfs-stack-title\">{{ row.label }}</td>\n <td data-label=\"Tipo\">{{ chargeTypeLabel(row.type) }}</td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Guardado\">\n @if (row.savedInput === null) { \u2014 }\n @else { {{ row.percentage ? (row.savedInput | number: '1.0-4' : locale) + ' %' : (row.savedInput | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale) }} }\n </td>\n <td class=\"sfs-right\" data-label=\"Configurado\">\n @if (row.editable) {\n <label [for]=\"row.id\" class=\"sfs-sr-only\">{{ row.label }}</label>\n <p-inputnumber [inputId]=\"row.id\" [ngModel]=\"chargeInputs()[row.name]\" (ngModelChange)=\"setChargeInput(row.name, $event)\"\n [min]=\"0\" [minFractionDigits]=\"0\" [maxFractionDigits]=\"row.percentage ? 4 : 0\" [locale]=\"locale\"\n [suffix]=\"row.percentage ? ' %' : ''\" [prefix]=\"row.percentage ? '' : '$ '\" inputStyleClass=\"sfs-charge-input\"></p-inputnumber>\n } @else {\n {{ row.percentage ? (row.simulatedInput | number: '1.0-4' : locale) + ' %' : (row.simulatedInput | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale) }}\n }\n </td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Valor\">{{ row.value | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</td>\n </tr>\n </ng-template>\n <ng-template #emptymessage>\n <tr><td colspan=\"5\">La l\u00EDnea no tiene cargos.</td></tr>\n </ng-template>\n </p-table>\n @if (zeroChargesCount()) {\n <!-- Los cargos en cero (sin guardado, sin configurado y sin valor) ocupan espacio y no cambian nada. -->\n <div class=\"sfs-no-gap\">\n <p-button [label]=\"showZeroCharges() ? 'Ocultar los cargos en cero' : 'Ver ' + zeroChargesCount() + (zeroChargesCount() === 1 ? ' cargo en cero' : ' cargos en cero')\"\n [icon]=\"showZeroCharges() ? 'pi pi-eye-slash' : 'pi pi-eye'\" [text]=\"true\" size=\"small\" severity=\"secondary\"\n [ariaLabel]=\"showZeroCharges() ? 'Ocultar los cargos en cero' : 'Ver los cargos en cero'\"\n (onClick)=\"showZeroCharges.set(!showZeroCharges())\"></p-button>\n </div>\n }\n\n <!-- Resultado frente a lo guardado -->\n <section [attr.aria-labelledby]=\"ids.resultTitle\">\n <div class=\"sfs-head\">\n <h3 [id]=\"ids.resultTitle\" class=\"sfs-subtitle\">Resultado</h3>\n <p-tag [value]=\"l.viable ? 'Viable' : 'No viable'\" [severity]=\"l.viable ? 'success' : 'warn'\"></p-tag>\n </div>\n <p-table [value]=\"comparison()\" size=\"small\" [scrollable]=\"true\" dataKey=\"label\" styleClass=\"sfs-stack-table\">\n <ng-template #header>\n <tr><th>Concepto</th><th class=\"sfs-right\">Guardado</th><th class=\"sfs-right\">Simulaci\u00F3n</th></tr>\n </ng-template>\n <ng-template #body let-row>\n <tr>\n <td class=\"sfs-stack-title\">{{ row.label }}</td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Guardado\">\n <ng-container *ngTemplateOutlet=\"valueTpl; context: { $implicit: row.saved, kind: row.kind }\"></ng-container>\n </td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Simulaci\u00F3n\">\n @if (row.changed) { <span class=\"sfs-tag-before\"><p-tag value=\"Cambia\" severity=\"warn\"></p-tag></span> }\n <span [class.sfs-strong]=\"row.changed\">\n <ng-container *ngTemplateOutlet=\"valueTpl; context: { $implicit: row.simulated, kind: row.kind }\"></ng-container>\n </span>\n </td>\n </tr>\n </ng-template>\n </p-table>\n @if (!l.viable && l.viabilityReasons.length) {\n <ul class=\"sfs-list sfs-gap-top\">\n @for (reason of l.viabilityReasons; track $index) { <li>{{ reason }}</li> }\n </ul>\n }\n </section>\n\n <!-- Acciones -->\n <div class=\"sfs-actions\">\n @if (canEdit() || capacityEditable()) {\n <p-button label=\"Recalcular\" icon=\"pi pi-calculator\" severity=\"secondary\" [text]=\"true\"\n [disabled]=\"!pendingChanges() || hasNegativeInput()\" (onClick)=\"recalculate()\"></p-button>\n }\n @if (showSave()) {\n <!-- pButton y no p-button: sin poder guardar el bot\u00F3n queda aria-disabled (no disabled) para que el\n motivo se vea con Tab y con el mouse; openConfirm() corta el clic cuando hay motivo. -->\n <button pButton type=\"button\" label=\"Guardar condiciones\" aria-label=\"Guardar condiciones\"\n [icon]=\"saveUnavailableReason() ? 'pi pi-lock' : 'pi pi-save'\"\n [class.sfs-unavailable]=\"!!saveUnavailableReason()\"\n [attr.aria-disabled]=\"saveUnavailableReason() ? 'true' : null\"\n [attr.aria-describedby]=\"saveUnavailableReason() ? ids.saveReason : null\"\n [pTooltip]=\"saveUnavailableReason() ?? ''\" [tooltipDisabled]=\"!saveUnavailableReason()\" tooltipPosition=\"top\" tooltipEvent=\"both\"\n (click)=\"openConfirm()\"></button>\n @if (saveUnavailableReason()) {\n <span [id]=\"ids.saveReason\" class=\"sfs-sr-only\">{{ saveUnavailableReason() }}</span>\n }\n }\n </div>\n }\n }\n }\n }\n</div>\n\n<!-- Siempre montada: anuncia el resultado de cada simulaci\u00F3n (la de arriba se destruye mientras carga). -->\n<div class=\"sfs-sr-only\" role=\"status\" aria-live=\"polite\">{{ liveMessage() }}</div>\n\n<!-- Un valor de la comparaci\u00F3n, en su formato -->\n<ng-template #valueTpl let-value let-kind=\"kind\">\n @if (value === null || value === undefined || value === '') { \u2014 }\n @else {\n @switch (kind) {\n @case ('money') { {{ value | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }} }\n @case ('rate') { {{ value | number: '1.0-4' : locale }} % M.V. }\n @case ('term') { {{ value }} cuotas }\n @default { {{ value }} }\n }\n }\n</ng-template>\n\n<!-- Confirmaci\u00F3n: cambia l\u00EDnea, monto, plazo y cargos de la solicitud -->\n<p-dialog header=\"Guardar condiciones\" [visible]=\"confirmVisible()\" (visibleChange)=\"confirmVisible.set($event)\" (onHide)=\"restoreConfirmFocus()\"\n [modal]=\"true\" [draggable]=\"false\" [closable]=\"!saving()\" [style]=\"{ width: '32rem', maxWidth: '95vw' }\">\n @if (confirmVisible() && line(); as l) {\n <p class=\"sfs-no-top\">\n Se guardar\u00E1n la l\u00EDnea <strong>{{ l.lineName || l.line }}</strong>,\n un monto de <strong>{{ l.amount | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</strong>\n a <strong>{{ l.term }} cuotas</strong> con una tasa de <strong>{{ l.rate | number: '1.0-4' : locale }} % M.V.</strong> y una cuota de <strong>{{ l.installment | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</strong>,\n con un giro al cliente de <strong>{{ l.transfer | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</strong>.\n </p>\n @if (!l.viable) {\n <p-message severity=\"warn\" text=\"La l\u00EDnea no es viable con la capacidad de pago de la solicitud.\"></p-message>\n }\n }\n <ng-template #footer>\n <p-button label=\"Cancelar\" severity=\"secondary\" [text]=\"true\" [disabled]=\"saving()\" (onClick)=\"confirmVisible.set(false)\"></p-button>\n <p-button label=\"Guardar condiciones\" icon=\"pi pi-save\" [loading]=\"saving()\" (onClick)=\"confirmSave()\"></p-button>\n </ng-template>\n</p-dialog>\n", styles: [".sfs-title{margin:0;font-size:1.125rem;font-weight:600}.sfs-subtitle{margin:0;font-size:1rem;font-weight:600}.sfs-muted{color:var(--p-text-muted-color)}.sfs-section-title{display:flex;align-items:center;gap:.5rem;margin:0 0 .75rem;font-size:1rem;font-weight:600}.sfs-section-title i{color:var(--primary-color, var(--p-primary-color))}.sfs-inline{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem}.sfs-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:.5rem;margin-bottom:.75rem}.sfs-break{overflow-wrap:anywhere}.sfs-nowrap{white-space:nowrap}.sfs-right{text-align:right}.sfs-strong{font-weight:600}.sfs-tag-gap{margin-left:.5rem}.sfs-stack{display:flex;flex-direction:column;gap:1rem}.sfs-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.sfs-summary{display:grid;grid-template-columns:minmax(8rem,max-content) 1fr;gap:.25rem 1rem;margin:0}.sfs-summary dt{color:var(--p-text-muted-color)}.sfs-summary dd{margin:0;text-align:right;font-variant-numeric:tabular-nums}@media (max-width: 575px){:host ::ng-deep .sfs-stack-table .p-datatable-table-container{overflow:visible!important}:host ::ng-deep .sfs-stack-table table,:host ::ng-deep .sfs-stack-table tbody{display:block;width:100%}:host ::ng-deep .sfs-stack-table thead{display:block!important;position:absolute!important;width:1px!important;height:1px!important;overflow:hidden!important;clip-path:inset(50%);white-space:nowrap}:host ::ng-deep .sfs-stack-table tbody tr{display:flex;flex-direction:column;margin-bottom:.5rem;padding:.5rem .75rem;border:1px solid var(--p-content-border-color);border-radius:var(--p-content-border-radius, 6px)}:host ::ng-deep .sfs-stack-table tbody td{display:flex;align-items:center;justify-content:flex-end;gap:.375rem;padding:.3rem 0;border:0;text-align:right}:host ::ng-deep .sfs-stack-table tbody td[data-label]:before{content:attr(data-label);margin-right:auto;padding-right:1rem;color:var(--p-text-muted-color);text-align:left}:host ::ng-deep .sfs-stack-table tbody td.sfs-stack-title{order:-1;display:block;font-weight:600;text-align:left}:host ::ng-deep .sfs-stack-table tfoot,:host ::ng-deep .sfs-stack-table .sfs-stack-hide{display:none}}\n", ".sfs-control{display:flex;flex-direction:column;gap:.25rem;min-width:0}.sfs-control--check{flex-direction:row;align-items:center;gap:.5rem;align-self:end;min-height:2.75rem}.sfs-capacity-grid{display:grid;grid-template-columns:minmax(0,1fr);gap:.75rem}@media (min-width: 576px){.sfs-capacity-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}.sfs-conditions{display:grid;grid-template-columns:minmax(0,1fr);gap:.75rem;align-items:end}@media (min-width: 576px){.sfs-conditions{grid-template-columns:repeat(2,minmax(0,1fr))}.sfs-conditions__line{grid-column:1 / -1}}@media (min-width: 992px){.sfs-conditions{grid-template-columns:minmax(0,2fr) minmax(0,1fr) minmax(0,1fr) max-content}.sfs-conditions__line{grid-column:auto}}.sfs-conditions__rate{justify-content:flex-end;min-height:2.5rem;padding-bottom:.5rem}.sfs-metrics{display:grid;grid-template-columns:repeat(auto-fill,minmax(9.5rem,1fr));gap:.5rem 1rem;margin:0}.sfs-metrics dt{font-size:.8125rem;color:var(--p-text-muted-color)}.sfs-metrics dd{margin:0;font-variant-numeric:tabular-nums}.sfs-no-gap{margin-top:-.75rem}.sfs-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:.5rem}.sfs-list{margin:0;padding-left:1rem}.sfs-gap-top{margin-top:.5rem}.sfs-gap-bottom{margin-bottom:.5rem}.sfs-no-top{margin-top:0}.sfs-tag-before{margin-right:.5rem}:host ::ng-deep .sfs-charge-input{width:6.5rem;padding-block:.25rem;text-align:right}:host ::ng-deep .sfs-unavailable.p-button{opacity:var(--p-disabled-opacity);cursor:default}:host ::ng-deep .sfs-unavailable.p-button:hover,:host ::ng-deep .sfs-unavailable.p-button:active{background:var(--button-color, var(--p-button-primary-background));border-color:var(--button-color, var(--p-button-primary-border-color))}\n"] }]
|
|
1346
|
+
], template: "<div class=\"sfs-stack\">\n <!-- Capacidad de pago -->\n <section [attr.aria-labelledby]=\"ids.capacityTitle\">\n <h3 [id]=\"ids.capacityTitle\" class=\"sfs-subtitle sfs-gap-bottom\">Capacidad de pago</h3>\n @if (capacityEditable()) {\n <div class=\"sfs-capacity-grid\">\n @for (field of capacityFields; track field.key) {\n <div class=\"sfs-control\">\n <label [for]=\"ids.capacity + field.key\">{{ field.label }}</label>\n <p-inputnumber [inputId]=\"ids.capacity + field.key\" [ngModel]=\"currentCapacity()[field.key]\" (ngModelChange)=\"setCapacity(field.key, $event)\"\n mode=\"currency\" currency=\"COP\" [locale]=\"locale\" [minFractionDigits]=\"0\" [maxFractionDigits]=\"0\" [min]=\"0\" [fluid]=\"true\"></p-inputnumber>\n </div>\n }\n <div class=\"sfs-control sfs-control--check\">\n <p-checkbox [inputId]=\"ids.garnishment\" [binary]=\"true\" [ngModel]=\"currentCapacity().hasGarnishment\" (ngModelChange)=\"setGarnishment($event)\"></p-checkbox>\n <label [for]=\"ids.garnishment\">Tiene embargo</label>\n </div>\n </div>\n }\n <!-- Indicadores en grilla: varios por fila en escritorio, para que la capacidad no ocupe media pantalla. -->\n @if (!capacityEditable() || simulation()) {\n <dl class=\"sfs-metrics\" [class.sfs-gap-top]=\"capacityEditable()\">\n @if (!capacityEditable()) {\n <div><dt>Ingresos</dt><dd>{{ capacity().income | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Descuentos de ley</dt><dd>{{ capacity().legalDeductions | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Otras afiliaciones</dt><dd>{{ capacity().otherAffiliations | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Otros descuentos</dt><dd>{{ capacity().otherDeductions | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Compras de cartera</dt><dd>{{ capacity().purchasesValue | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Embargo</dt><dd>{{ capacity().hasGarnishment ? 'S\u00ED' : 'No' }}</dd></div>\n }\n @if (simulation(); as s) {\n <div><dt>Disponible n\u00F3mina</dt><dd class=\"sfs-strong\">{{ maxInstallment() | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n @if (!installmentEditable()) {\n <div><dt>Valor cuota</dt><dd class=\"sfs-strong\">{{ currentInstallment() | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n }\n <div><dt>Tope de monto</dt><dd>{{ s.capacity.maxAmount != null ? (s.capacity.maxAmount | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale) : '\u2014' }}</dd></div>\n }\n </dl>\n }\n <!-- La cuota la digita la persona: el simulador calcula con ella el m\u00E1ximo a financiar. No puede superar el\n disponible n\u00F3mina (incluye el aporte). -->\n @if (installmentEditable()) {\n <div class=\"sfs-control sfs-installment sfs-gap-top\">\n <label [for]=\"ids.installment\">Valor cuota</label>\n <p-inputnumber [inputId]=\"ids.installment\" [ngModel]=\"currentInstallment()\" (ngModelChange)=\"setInstallment($event)\"\n mode=\"currency\" currency=\"COP\" [locale]=\"locale\" [minFractionDigits]=\"0\" [maxFractionDigits]=\"0\" [min]=\"0\" [fluid]=\"true\"\n [ariaDescribedBy]=\"installmentError() ? ids.installmentError : undefined\"\n [inputStyleClass]=\"installmentError() ? 'ng-invalid ng-dirty' : ''\"></p-inputnumber>\n @if (installmentError(); as error) {\n <small [id]=\"ids.installmentError\" class=\"sfs-field-error\"><i class=\"pi pi-exclamation-circle\" aria-hidden=\"true\"></i> {{ error }}\n M\u00E1ximo {{ maxInstallment() | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}.</small>\n } @else {\n <small class=\"sfs-muted\">Hasta el disponible n\u00F3mina. Al recalcular, el monto sale de esta cuota.</small>\n }\n @if (maxInstallment() !== null && currentInstallment() !== maxInstallment()) {\n <div>\n <p-button label=\"Usar el disponible n\u00F3mina\" icon=\"pi pi-replay\" [text]=\"true\" size=\"small\" severity=\"secondary\"\n (onClick)=\"useMaxInstallment()\"></p-button>\n </div>\n }\n </div>\n }\n </section>\n\n @switch (state()) {\n @case ('loading') {\n <div class=\"sfs-stack\" aria-busy=\"true\">\n <p-skeleton height=\"2.5rem\"></p-skeleton>\n <p-skeleton height=\"12rem\"></p-skeleton>\n </div>\n }\n @case ('error') {\n <p-message severity=\"error\">\n <div class=\"sfs-inline\">\n <span>{{ errorMessage() || 'No se pudo simular la solicitud.' }}</span>\n <p-button label=\"Reintentar\" icon=\"pi pi-refresh\" [text]=\"true\" (onClick)=\"retrySimulation()\"></p-button>\n </div>\n </p-message>\n @if (capacityEditable() && pendingChanges()) {\n <div class=\"sfs-actions\">\n <p-button label=\"Recalcular\" icon=\"pi pi-calculator\" severity=\"secondary\" [text]=\"true\" [disabled]=\"hasNegativeInput()\" (onClick)=\"recalculate()\"></p-button>\n </div>\n }\n }\n @case ('idle') {\n @if (capacityEditable()) {\n <div class=\"sfs-actions\">\n <p-button label=\"Simular\" icon=\"pi pi-calculator\" [disabled]=\"hasNegativeInput()\" (onClick)=\"recalculate()\"></p-button>\n </div>\n } @else {\n <p class=\"sfs-muted sfs-no-top\">Todav\u00EDa no hay una simulaci\u00F3n para esta solicitud.</p>\n }\n }\n @case ('ready') {\n @if (simulation()?.warnings?.length) {\n <p-message severity=\"warn\">\n <ul class=\"sfs-list\">\n @for (w of simulation()?.warnings ?? []; track $index) { <li>{{ w }}</li> }\n </ul>\n </p-message>\n }\n\n @if (!lineOptions().length) {\n <p-message severity=\"info\" text=\"El simulador no devolvi\u00F3 l\u00EDneas para esta solicitud. Revise la pagadur\u00EDa, el producto y la capacidad de pago.\"></p-message>\n }\n\n <!-- L\u00EDnea, plazo, monto y tasa en una sola fila en escritorio. p-select pone el inputId en un span: el nombre\n accesible va por ariaLabelledBy. -->\n <div class=\"sfs-conditions\">\n <div class=\"sfs-control sfs-conditions__line\">\n <label [id]=\"ids.lineLabel\" [for]=\"ids.line\" class=\"sfs-strong\">L\u00EDnea</label>\n <p-select [inputId]=\"ids.line\" [ariaLabelledBy]=\"ids.lineLabel\" [options]=\"lineOptions()\" optionLabel=\"label\" optionValue=\"value\" optionDisabled=\"disabled\"\n [ngModel]=\"selectedLine()\" (ngModelChange)=\"chooseLine($event)\" placeholder=\"Seleccione una l\u00EDnea\" [fluid]=\"true\"></p-select>\n </div>\n @if (line(); as l) {\n @if (!l.error) {\n <div class=\"sfs-control\">\n <label [for]=\"ids.term\">Plazo (cuotas)</label>\n <p-inputnumber [inputId]=\"ids.term\" [ngModel]=\"termInput()\" (ngModelChange)=\"termInput.set($event)\"\n [min]=\"simulation()?.minTerm ?? 1\" [max]=\"simulation()?.maxTerm ?? 600\" [useGrouping]=\"false\"\n [disabled]=\"!canEdit()\" [fluid]=\"true\"></p-inputnumber>\n </div>\n <div class=\"sfs-control\">\n <label [for]=\"ids.amount\">Monto</label>\n <p-inputnumber [inputId]=\"ids.amount\" [ngModel]=\"amountInput()\" (ngModelChange)=\"amountInput.set($event)\"\n mode=\"currency\" currency=\"COP\" [locale]=\"locale\" [minFractionDigits]=\"0\" [maxFractionDigits]=\"0\" [min]=\"0\"\n [disabled]=\"!canEdit()\" [fluid]=\"true\"></p-inputnumber>\n </div>\n @if (rateEditable()) {\n <div class=\"sfs-control\">\n <label [id]=\"ids.rateLabel\" [for]=\"ids.rate\">Tasa</label>\n <p-select [inputId]=\"ids.rate\" [ariaLabelledBy]=\"ids.rateLabel\" [options]=\"rateOptions()\" optionLabel=\"label\" optionValue=\"value\"\n [ngModel]=\"currentRate()\" (ngModelChange)=\"rateInput.set($event)\" [fluid]=\"true\" appendTo=\"body\"></p-select>\n </div>\n } @else {\n <div class=\"sfs-control sfs-conditions__rate\">\n <span>Tasa</span>\n <span class=\"sfs-strong\">{{ l.rate | number: '1.0-4' : locale }} % M.V.</span>\n </div>\n }\n }\n }\n </div>\n @if (saved()?.line && saved()?.line !== selectedLine()) {\n <small class=\"sfs-muted sfs-no-gap\">La l\u00EDnea guardada es {{ savedLineName() }}. Al guardar se cambia por la elegida.</small>\n }\n\n @if (line(); as l) {\n @if (l.error) {\n <p-message severity=\"error\" text=\"Esta l\u00EDnea no se pudo simular. Elija otra o intente m\u00E1s tarde.\"></p-message>\n } @else {\n <!-- Cargos de la l\u00EDnea: plegados, porque casi nunca se tocan. Al desplegarlos, los del cr\u00E9dito (se descuentan\n del desembolso o van al capital) y los de la cuota, cada uno en su columna. -->\n <section [attr.aria-labelledby]=\"ids.chargesTitle\">\n <div class=\"sfs-head\">\n <h3 [id]=\"ids.chargesTitle\" class=\"sfs-subtitle\">Cargos</h3>\n <!-- pButton y no p-button: el componente no deja poner aria-expanded en su <button>. -->\n <button pButton type=\"button\" severity=\"secondary\" [text]=\"true\" size=\"small\"\n [label]=\"(chargesOpen() ? 'Ocultar cargos' : 'Ver cargos') + (editedChargesCount() ? ' (' + editedChargesCount() + ' cambiados)' : '')\"\n [icon]=\"chargesOpen() ? 'pi pi-chevron-up' : 'pi pi-chevron-down'\" iconPos=\"right\"\n [attr.aria-expanded]=\"chargesOpen()\" [attr.aria-controls]=\"ids.charges\"\n (click)=\"chargesOpen.set(!chargesOpen())\"></button>\n </div>\n @if (chargesOpen()) {\n <div [id]=\"ids.charges\" class=\"sfs-charges\">\n <div>\n <h4 class=\"sfs-charges__title\">Del cr\u00E9dito</h4>\n <p-table [value]=\"creditChargeRows()\" size=\"small\" [scrollable]=\"true\" dataKey=\"name\" styleClass=\"sfs-stack-table\">\n <ng-template #header>\n <tr>\n <th>Cargo</th>\n <th class=\"sfs-right\">Guardado</th>\n <th class=\"sfs-right\">Configurado</th>\n <th class=\"sfs-right\">Valor</th>\n </tr>\n </ng-template>\n <ng-template #body let-row>\n <tr>\n <td class=\"sfs-stack-title\">{{ row.label }}</td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Guardado\">\n @if (row.savedInput === null) { \u2014 }\n @else { {{ row.percentage ? (row.savedInput | number: '1.0-4' : locale) + ' %' : (row.savedInput | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale) }} }\n </td>\n <td class=\"sfs-right\" data-label=\"Configurado\">\n @if (row.editable) {\n <label [for]=\"row.id\" class=\"sfs-sr-only\">{{ row.label }}</label>\n <p-inputnumber [inputId]=\"row.id\" [ngModel]=\"chargeInputs()[row.name]\" (ngModelChange)=\"setChargeInput(row.name, $event)\"\n [min]=\"0\" [minFractionDigits]=\"0\" [maxFractionDigits]=\"row.percentage ? 4 : 0\" [locale]=\"locale\"\n [suffix]=\"row.percentage ? ' %' : ''\" [prefix]=\"row.percentage ? '' : '$ '\" inputStyleClass=\"sfs-charge-input\"></p-inputnumber>\n } @else {\n {{ row.percentage ? (row.simulatedInput | number: '1.0-4' : locale) + ' %' : (row.simulatedInput | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale) }}\n }\n </td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Valor\">{{ row.value | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</td>\n </tr>\n </ng-template>\n <ng-template #emptymessage>\n <tr><td colspan=\"4\">La l\u00EDnea no tiene cargos del cr\u00E9dito.</td></tr>\n </ng-template>\n </p-table>\n </div>\n <div>\n <h4 class=\"sfs-charges__title\">De la cuota</h4>\n <p-table [value]=\"installmentChargeRows()\" size=\"small\" [scrollable]=\"true\" dataKey=\"name\" styleClass=\"sfs-stack-table\">\n <ng-template #header>\n <tr>\n <th>Cargo</th>\n <th class=\"sfs-right\">Guardado</th>\n <th class=\"sfs-right\">Configurado</th>\n <th class=\"sfs-right\">Valor</th>\n </tr>\n </ng-template>\n <ng-template #body let-row>\n <tr>\n <td class=\"sfs-stack-title\">{{ row.label }}</td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Guardado\">\n @if (row.savedInput === null) { \u2014 }\n @else { {{ row.percentage ? (row.savedInput | number: '1.0-4' : locale) + ' %' : (row.savedInput | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale) }} }\n </td>\n <td class=\"sfs-right\" data-label=\"Configurado\">\n @if (row.editable) {\n <label [for]=\"row.id\" class=\"sfs-sr-only\">{{ row.label }}</label>\n <p-inputnumber [inputId]=\"row.id\" [ngModel]=\"chargeInputs()[row.name]\" (ngModelChange)=\"setChargeInput(row.name, $event)\"\n [min]=\"0\" [minFractionDigits]=\"0\" [maxFractionDigits]=\"row.percentage ? 4 : 0\" [locale]=\"locale\"\n [suffix]=\"row.percentage ? ' %' : ''\" [prefix]=\"row.percentage ? '' : '$ '\" inputStyleClass=\"sfs-charge-input\"></p-inputnumber>\n } @else {\n {{ row.percentage ? (row.simulatedInput | number: '1.0-4' : locale) + ' %' : (row.simulatedInput | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale) }}\n }\n </td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Valor\">{{ row.value | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</td>\n </tr>\n </ng-template>\n <ng-template #emptymessage>\n <tr><td colspan=\"4\">La l\u00EDnea no tiene cargos en la cuota.</td></tr>\n </ng-template>\n </p-table>\n </div>\n </div>\n @if (zeroChargesCount()) {\n <!-- Los cargos en cero (sin guardado, sin configurado y sin valor) ocupan espacio y no cambian nada. -->\n <div class=\"sfs-no-gap\">\n <p-button [label]=\"showZeroCharges() ? 'Ocultar los cargos en cero' : 'Ver ' + zeroChargesCount() + (zeroChargesCount() === 1 ? ' cargo en cero' : ' cargos en cero')\"\n [icon]=\"showZeroCharges() ? 'pi pi-eye-slash' : 'pi pi-eye'\" [text]=\"true\" size=\"small\" severity=\"secondary\"\n [ariaLabel]=\"showZeroCharges() ? 'Ocultar los cargos en cero' : 'Ver los cargos en cero'\"\n (onClick)=\"showZeroCharges.set(!showZeroCharges())\"></p-button>\n </div>\n }\n }\n </section>\n\n <!-- Resultado frente a lo guardado -->\n <section [attr.aria-labelledby]=\"ids.resultTitle\">\n <div class=\"sfs-head\">\n <h3 [id]=\"ids.resultTitle\" class=\"sfs-subtitle\">Resultado</h3>\n <p-tag [value]=\"l.viable ? 'Viable' : 'No viable'\" [severity]=\"l.viable ? 'success' : 'warn'\"></p-tag>\n </div>\n @if (summary(); as sm) {\n <dl class=\"sfs-summary\">\n <div><dt>M\u00E1ximo a financiar</dt><dd class=\"sfs-strong\">{{ sm.maxAmount | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Monto</dt><dd>{{ sm.amount | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Descuentos del cr\u00E9dito</dt><dd>{{ sm.creditDiscounts | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Desembolso</dt><dd>{{ sm.disbursement | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</dd></div>\n <div><dt>Compras de cartera</dt><dd>{{ sm.purchases !== null ? (sm.purchases | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale) : '\u2014' }}</dd></div>\n <div><dt>Sanear</dt><dd>{{ sm.cleanUp !== null ? (sm.cleanUp | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale) : '\u2014' }}</dd></div>\n <!-- Neto a girar resaltado: con el color de \u00E9xito o de error del tema y, adem\u00E1s, un icono y el texto. -->\n <div class=\"sfs-net\" [class.sfs-net--negative]=\"sm.net < 0\">\n <dt>Neto a girar</dt>\n <dd>\n <i [class]=\"sm.net < 0 ? 'pi pi-exclamation-triangle' : 'pi pi-check-circle'\" aria-hidden=\"true\"></i>\n {{ sm.net | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}\n @if (sm.net < 0) { <span class=\"sfs-net__note\">Negativo: no alcanza para las compras de cartera.</span> }\n </dd>\n </div>\n </dl>\n }\n <p-table [value]=\"comparison()\" size=\"small\" [scrollable]=\"true\" dataKey=\"label\" styleClass=\"sfs-stack-table\">\n <ng-template #header>\n <tr><th>Concepto</th><th class=\"sfs-right\">Guardado</th><th class=\"sfs-right\">Simulaci\u00F3n</th></tr>\n </ng-template>\n <ng-template #body let-row>\n <tr>\n <td class=\"sfs-stack-title\">{{ row.label }}</td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Guardado\">\n <ng-container *ngTemplateOutlet=\"valueTpl; context: { $implicit: row.saved, kind: row.kind }\"></ng-container>\n </td>\n <td class=\"sfs-right sfs-nowrap\" data-label=\"Simulaci\u00F3n\">\n @if (row.changed) { <span class=\"sfs-tag-before\"><p-tag value=\"Cambia\" severity=\"warn\"></p-tag></span> }\n <span [class.sfs-strong]=\"row.changed\">\n <ng-container *ngTemplateOutlet=\"valueTpl; context: { $implicit: row.simulated, kind: row.kind }\"></ng-container>\n </span>\n </td>\n </tr>\n </ng-template>\n </p-table>\n @if (!l.viable && l.viabilityReasons.length) {\n <ul class=\"sfs-list sfs-gap-top\">\n @for (reason of l.viabilityReasons; track $index) { <li>{{ reason }}</li> }\n </ul>\n }\n </section>\n\n <!-- Acciones -->\n <div class=\"sfs-actions\">\n @if (canEdit() || capacityEditable()) {\n <p-button label=\"Recalcular\" icon=\"pi pi-calculator\" severity=\"secondary\" [text]=\"true\"\n [disabled]=\"!pendingChanges() || hasNegativeInput()\" (onClick)=\"recalculate()\"></p-button>\n }\n @if (showSave()) {\n <!-- pButton y no p-button: sin poder guardar el bot\u00F3n queda aria-disabled (no disabled) para que el\n motivo se vea con Tab y con el mouse; openConfirm() corta el clic cuando hay motivo. -->\n <button pButton type=\"button\" label=\"Guardar condiciones\" aria-label=\"Guardar condiciones\"\n [icon]=\"saveUnavailableReason() ? 'pi pi-lock' : 'pi pi-save'\"\n [class.sfs-unavailable]=\"!!saveUnavailableReason()\"\n [attr.aria-disabled]=\"saveUnavailableReason() ? 'true' : null\"\n [attr.aria-describedby]=\"saveUnavailableReason() ? ids.saveReason : null\"\n [pTooltip]=\"saveUnavailableReason() ?? ''\" [tooltipDisabled]=\"!saveUnavailableReason()\" tooltipPosition=\"top\" tooltipEvent=\"both\"\n (click)=\"openConfirm()\"></button>\n @if (saveUnavailableReason()) {\n <span [id]=\"ids.saveReason\" class=\"sfs-sr-only\">{{ saveUnavailableReason() }}</span>\n }\n }\n </div>\n }\n }\n }\n }\n</div>\n\n<!-- Siempre montada: anuncia el resultado de cada simulaci\u00F3n (la de arriba se destruye mientras carga). -->\n<div class=\"sfs-sr-only\" role=\"status\" aria-live=\"polite\">{{ liveMessage() }}</div>\n\n<!-- Un valor de la comparaci\u00F3n, en su formato -->\n<ng-template #valueTpl let-value let-kind=\"kind\">\n @if (value === null || value === undefined || value === '') { \u2014 }\n @else {\n @switch (kind) {\n @case ('money') { {{ value | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }} }\n @case ('rate') { {{ value | number: '1.0-4' : locale }} % M.V. }\n @case ('term') { {{ value }} cuotas }\n @default { {{ value }} }\n }\n }\n</ng-template>\n\n<!-- Confirmaci\u00F3n: cambia l\u00EDnea, monto, plazo y cargos de la solicitud -->\n<p-dialog header=\"Guardar condiciones\" [visible]=\"confirmVisible()\" (visibleChange)=\"confirmVisible.set($event)\" (onHide)=\"restoreConfirmFocus()\"\n [modal]=\"true\" [draggable]=\"false\" [closable]=\"!saving()\" [style]=\"{ width: '32rem', maxWidth: '95vw' }\">\n @if (confirmVisible() && line(); as l) {\n <p class=\"sfs-no-top\">\n Se guardar\u00E1n la l\u00EDnea <strong>{{ l.lineName || l.line }}</strong>,\n un monto de <strong>{{ l.amount | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</strong>\n a <strong>{{ l.term }} cuotas</strong> con una tasa de <strong>{{ l.rate | number: '1.0-4' : locale }} % M.V.</strong> y una cuota de <strong>{{ l.installment | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</strong>,\n con un giro al cliente de <strong>{{ l.transfer | currency: 'COP' : 'symbol-narrow' : '1.0-0' : locale }}</strong>.\n </p>\n @if (!l.viable) {\n <p-message severity=\"warn\" text=\"La l\u00EDnea no es viable con la capacidad de pago de la solicitud.\"></p-message>\n }\n }\n <ng-template #footer>\n <p-button label=\"Cancelar\" severity=\"secondary\" [text]=\"true\" [disabled]=\"saving()\" (onClick)=\"confirmVisible.set(false)\"></p-button>\n <p-button label=\"Guardar condiciones\" icon=\"pi pi-save\" [loading]=\"saving()\" (onClick)=\"confirmSave()\"></p-button>\n </ng-template>\n</p-dialog>\n", styles: [".sfs-title{margin:0;font-size:1.125rem;font-weight:600}.sfs-subtitle{margin:0;font-size:1rem;font-weight:600}.sfs-muted{color:var(--p-text-muted-color)}.sfs-section-title{display:flex;align-items:center;gap:.5rem;margin:0 0 .75rem;font-size:1rem;font-weight:600}.sfs-section-title i{color:var(--primary-color, var(--p-primary-color))}.sfs-inline{display:flex;flex-wrap:wrap;align-items:center;gap:.75rem}.sfs-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:.5rem;margin-bottom:.75rem}.sfs-break{overflow-wrap:anywhere}.sfs-nowrap{white-space:nowrap}.sfs-right{text-align:right}.sfs-strong{font-weight:600}.sfs-tag-gap{margin-left:.5rem}.sfs-stack{display:flex;flex-direction:column;gap:1rem}.sfs-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.sfs-summary{display:grid;grid-template-columns:minmax(8rem,max-content) 1fr;gap:.25rem 1rem;margin:0}.sfs-summary dt{color:var(--p-text-muted-color)}.sfs-summary dd{margin:0;text-align:right;font-variant-numeric:tabular-nums}@media (max-width: 575px){:host ::ng-deep .sfs-stack-table .p-datatable-table-container{overflow:visible!important}:host ::ng-deep .sfs-stack-table table,:host ::ng-deep .sfs-stack-table tbody{display:block;width:100%}:host ::ng-deep .sfs-stack-table thead{display:block!important;position:absolute!important;width:1px!important;height:1px!important;overflow:hidden!important;clip-path:inset(50%);white-space:nowrap}:host ::ng-deep .sfs-stack-table tbody tr{display:flex;flex-direction:column;margin-bottom:.5rem;padding:.5rem .75rem;border:1px solid var(--p-content-border-color);border-radius:var(--p-content-border-radius, 6px)}:host ::ng-deep .sfs-stack-table tbody td{display:flex;align-items:center;justify-content:flex-end;gap:.375rem;padding:.3rem 0;border:0;text-align:right}:host ::ng-deep .sfs-stack-table tbody td[data-label]:before{content:attr(data-label);margin-right:auto;padding-right:1rem;color:var(--p-text-muted-color);text-align:left}:host ::ng-deep .sfs-stack-table tbody td.sfs-stack-title{order:-1;display:block;font-weight:600;text-align:left}:host ::ng-deep .sfs-stack-table tfoot,:host ::ng-deep .sfs-stack-table .sfs-stack-hide{display:none}}\n", ".sfs-control{display:flex;flex-direction:column;gap:.25rem;min-width:0}.sfs-control--check{flex-direction:row;align-items:center;gap:.5rem;align-self:end;min-height:2.75rem}.sfs-capacity-grid{display:grid;grid-template-columns:minmax(0,1fr);gap:.75rem}@media (min-width: 576px){.sfs-capacity-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}.sfs-conditions{display:grid;grid-template-columns:minmax(0,1fr);gap:.75rem;align-items:end}@media (min-width: 576px){.sfs-conditions{grid-template-columns:repeat(2,minmax(0,1fr))}.sfs-conditions__line{grid-column:1 / -1}}@media (min-width: 992px){.sfs-conditions{grid-template-columns:minmax(0,2fr) minmax(0,1fr) minmax(0,1fr) minmax(9rem,1fr)}.sfs-conditions__line{grid-column:auto}}.sfs-conditions__rate{justify-content:flex-end;min-height:2.5rem;padding-bottom:.5rem}.sfs-metrics{display:grid;grid-template-columns:repeat(auto-fill,minmax(9.5rem,1fr));gap:.5rem 1rem;margin:0}.sfs-metrics dt{font-size:.8125rem;color:var(--p-text-muted-color)}.sfs-metrics dd{margin:0;font-variant-numeric:tabular-nums}.sfs-no-gap{margin-top:-.75rem}.sfs-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:.5rem}.sfs-list{margin:0;padding-left:1rem}.sfs-gap-top{margin-top:.5rem}.sfs-gap-bottom{margin-bottom:.5rem}.sfs-no-top{margin-top:0}.sfs-tag-before{margin-right:.5rem}:host ::ng-deep .sfs-charge-input{width:6.5rem;padding-block:.25rem;text-align:right}:host ::ng-deep .sfs-unavailable.p-button{opacity:var(--p-disabled-opacity);cursor:default}:host ::ng-deep .sfs-unavailable.p-button:hover,:host ::ng-deep .sfs-unavailable.p-button:active{background:var(--button-color, var(--p-button-primary-background));border-color:var(--button-color, var(--p-button-primary-border-color))}.sfs-installment{max-width:20rem}.sfs-field-error{color:var(--p-message-error-simple-color, var(--p-text-color))}.sfs-charges{display:grid;grid-template-columns:minmax(0,1fr);gap:1rem}@media (min-width: 992px){.sfs-charges{grid-template-columns:repeat(2,minmax(0,1fr))}}.sfs-charges__title{margin:0 0 .5rem;font-size:.875rem;font-weight:600;color:var(--p-text-muted-color)}.sfs-summary{display:grid;grid-template-columns:repeat(auto-fill,minmax(10rem,1fr));gap:.5rem 1rem;margin:0 0 1rem}.sfs-summary dt{font-size:.8125rem;color:var(--p-text-muted-color)}.sfs-summary dd{margin:0}.sfs-net{grid-column:1 / -1;padding:.5rem .75rem;border:1px solid var(--p-message-success-border-color, var(--p-content-border-color));border-radius:var(--p-content-border-radius, 6px);background:var(--p-message-success-background, var(--p-content-background));color:var(--p-message-success-color, var(--p-text-color))}.sfs-net dt{color:inherit;font-weight:600}.sfs-net dd{font-size:1.25rem;font-weight:700}.sfs-net--negative{border-color:var(--p-message-error-border-color, var(--p-content-border-color));background:var(--p-message-error-background, var(--p-content-background));color:var(--p-message-error-color, var(--p-text-color))}.sfs-net__note{display:block;font-size:.8125rem;font-weight:400}\n"] }]
|
|
1228
1347
|
}], ctorParameters: () => [] });
|
|
1348
|
+
/** Una tasa con coma decimal y hasta 4 decimales, como se lee en es-CO. */
|
|
1349
|
+
function formatRate(rate) {
|
|
1350
|
+
return rate.toLocaleString('es-CO', { minimumFractionDigits: 2, maximumFractionDigits: 4 });
|
|
1351
|
+
}
|
|
1229
1352
|
/** Un valor configurado del core (fracción o pesos) en la unidad de la pantalla (% o pesos). */
|
|
1230
1353
|
function toScreenUnit(value, percentage) {
|
|
1231
1354
|
return percentage ? round(value * 100, 4) : value;
|