mantenimento-app 2.4.2 → 2.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app.js +10 -0
- package/backend/calculate-model.js +4 -2
- package/frontend/public/app.js +10 -0
- package/frontend/public/index.html +1 -1
- package/package.json +1 -1
package/app.js
CHANGED
|
@@ -281,6 +281,8 @@ const defaultExpenseItems = [
|
|
|
281
281
|
firstHomeBoxNote: "Dichiara se esiste un mutuo sulla prima casa dei coniugi ceduta a uno dei due: il modello considera il trasferimento implicito quando la casa e assegnata al collocatario.",
|
|
282
282
|
firstHomeMortgageEnabledLabel: "Mutuo su prima casa dei coniugi",
|
|
283
283
|
firstHomeMortgageEnabledHint: "Attiva per includere il mutuo della prima casa ceduta nei benefici compensativi.",
|
|
284
|
+
firstHomeLocativeValueLabel: "Casa (valore locativo) ({currency})",
|
|
285
|
+
firstHomeLocativeValueHint: "Valore locativo mensile della casa assegnata, usato per valorizzare il beneficio economico implicito.",
|
|
284
286
|
firstHomeMortgageAmountLabel: "Rata mutuo mensile ({currency})",
|
|
285
287
|
firstHomeMortgageAmountHint: "Importo mensile complessivo della rata del mutuo prima casa.",
|
|
286
288
|
firstHomeAssignedToLabel: "Casa assegnata a",
|
|
@@ -641,6 +643,8 @@ const defaultExpenseItems = [
|
|
|
641
643
|
firstHomeBoxNote: "Declare whether there is a mortgage on the spouses' primary home assigned to one spouse: the model counts the implicit transfer when the home is assigned to the custodial parent.",
|
|
642
644
|
firstHomeMortgageEnabledLabel: "Mortgage on spouses' primary home",
|
|
643
645
|
firstHomeMortgageEnabledHint: "Enable to include the assigned primary-home mortgage in compensative benefits.",
|
|
646
|
+
firstHomeLocativeValueLabel: "Home (rental value) ({currency})",
|
|
647
|
+
firstHomeLocativeValueHint: "Monthly rental value of the assigned home, used to value the implicit economic benefit.",
|
|
644
648
|
firstHomeMortgageAmountLabel: "Monthly mortgage payment ({currency})",
|
|
645
649
|
firstHomeMortgageAmountHint: "Total monthly amount of the primary-home mortgage payment.",
|
|
646
650
|
firstHomeAssignedToLabel: "Home assigned to",
|
|
@@ -1215,6 +1219,8 @@ const defaultExpenseItems = [
|
|
|
1215
1219
|
const firstHomeBoxNote = document.getElementById("firstHomeBoxNote");
|
|
1216
1220
|
const lblPrimaCasaMutuoEnabled = document.getElementById("lblPrimaCasaMutuoEnabled");
|
|
1217
1221
|
const hintPrimaCasaMutuoEnabled = document.getElementById("hintPrimaCasaMutuoEnabled");
|
|
1222
|
+
const lblPrimaCasaValoreLocativo = document.getElementById("lblPrimaCasaValoreLocativo");
|
|
1223
|
+
const hintPrimaCasaValoreLocativo = document.getElementById("hintPrimaCasaValoreLocativo");
|
|
1218
1224
|
const lblPrimaCasaMutuoImporto = document.getElementById("lblPrimaCasaMutuoImporto");
|
|
1219
1225
|
const hintPrimaCasaMutuoImporto = document.getElementById("hintPrimaCasaMutuoImporto");
|
|
1220
1226
|
const lblPrimaCasaAssegnataA = document.getElementById("lblPrimaCasaAssegnataA");
|
|
@@ -1278,6 +1284,8 @@ const defaultExpenseItems = [
|
|
|
1278
1284
|
if (firstHomeBoxNote) firstHomeBoxNote.textContent = tr("firstHomeBoxNote");
|
|
1279
1285
|
if (lblPrimaCasaMutuoEnabled) lblPrimaCasaMutuoEnabled.textContent = tr("firstHomeMortgageEnabledLabel");
|
|
1280
1286
|
if (hintPrimaCasaMutuoEnabled) hintPrimaCasaMutuoEnabled.title = tr("firstHomeMortgageEnabledHint");
|
|
1287
|
+
if (lblPrimaCasaValoreLocativo) lblPrimaCasaValoreLocativo.textContent = msg("firstHomeLocativeValueLabel", { currency: currentCurrency });
|
|
1288
|
+
if (hintPrimaCasaValoreLocativo) hintPrimaCasaValoreLocativo.title = tr("firstHomeLocativeValueHint");
|
|
1281
1289
|
if (lblPrimaCasaMutuoImporto) lblPrimaCasaMutuoImporto.textContent = msg("firstHomeMortgageAmountLabel", { currency: currentCurrency });
|
|
1282
1290
|
if (hintPrimaCasaMutuoImporto) hintPrimaCasaMutuoImporto.title = tr("firstHomeMortgageAmountHint");
|
|
1283
1291
|
if (lblPrimaCasaAssegnataA) lblPrimaCasaAssegnataA.textContent = tr("firstHomeAssignedToLabel");
|
|
@@ -3599,6 +3607,7 @@ const defaultExpenseItems = [
|
|
|
3599
3607
|
aFam1: num("assegnoFam1"),
|
|
3600
3608
|
aFam2: num("assegnoFam2"),
|
|
3601
3609
|
primaCasaMutuoEnabled: firstHome.enabled ? 1 : 0,
|
|
3610
|
+
primaCasaValoreLocativo: num("primaCasaValoreLocativo"),
|
|
3602
3611
|
primaCasaMutuoImporto: firstHome.amount,
|
|
3603
3612
|
primaCasaAssegnataA: firstHome.assignedTo,
|
|
3604
3613
|
primaCasaMutuoPerc1: firstHome.share1,
|
|
@@ -6028,6 +6037,7 @@ ${scenarioLab.length ? `
|
|
|
6028
6037
|
assegnoPagato2: num("assegnoPagato2"),
|
|
6029
6038
|
assegnoFam2: num("assegnoFam2"),
|
|
6030
6039
|
primaCasaMutuoEnabled: document.getElementById("primaCasaMutuoEnabled")?.checked ? 1 : 0,
|
|
6040
|
+
primaCasaValoreLocativo: num("primaCasaValoreLocativo"),
|
|
6031
6041
|
primaCasaMutuoImporto: num("primaCasaMutuoImporto"),
|
|
6032
6042
|
primaCasaAssegnataA: String(document.getElementById("primaCasaAssegnataA")?.value || ""),
|
|
6033
6043
|
primaCasaMutuoPerc1: num("primaCasaMutuoPerc1"),
|
|
@@ -33,6 +33,7 @@ function calculateModel(input) {
|
|
|
33
33
|
const aFam1 = toNumber(input.aFam1);
|
|
34
34
|
const aFam2 = toNumber(input.aFam2);
|
|
35
35
|
const primaCasaMutuoEnabled = toNumber(input.primaCasaMutuoEnabled) > 0;
|
|
36
|
+
const primaCasaValoreLocativo = Math.max(0, toNumber(input.primaCasaValoreLocativo));
|
|
36
37
|
const primaCasaMutuoImporto = Math.max(0, toNumber(input.primaCasaMutuoImporto));
|
|
37
38
|
const primaCasaAssegnataA = String(input.primaCasaAssegnataA || '');
|
|
38
39
|
const rawMutuoPerc1 = input.primaCasaMutuoPerc1 === undefined ? 50 : input.primaCasaMutuoPerc1;
|
|
@@ -121,13 +122,14 @@ function calculateModel(input) {
|
|
|
121
122
|
if (aFam2 > 0.005) compensativeBenefits.push({ type: 'family', to: 2, amount: aFam2 });
|
|
122
123
|
if (primaCasaTransfer1to2 > 0.005) compensativeBenefits.push({ type: 'primary-home-mortgage', from: 1, to: 2, amount: primaCasaTransfer1to2 });
|
|
123
124
|
if (primaCasaTransfer2to1 > 0.005) compensativeBenefits.push({ type: 'primary-home-mortgage', from: 2, to: 1, amount: primaCasaTransfer2to1 });
|
|
125
|
+
if (primaCasaValoreLocativo > 0.005 && assigned !== '') compensativeBenefits.push({ type: 'primary-home-assignment', to: Number(assigned), amount: primaCasaValoreLocativo });
|
|
124
126
|
|
|
125
127
|
const post1 = disp1 - assegnoDa1a2 + assegnoDa2a1;
|
|
126
128
|
const post2 = disp2 - assegnoDa2a1 + assegnoDa1a2;
|
|
127
129
|
|
|
128
130
|
// Separation cost analysis (only active when speseConvivenza > 0)
|
|
129
131
|
const speseConvivenza = Math.max(0, toNumber(input.speseConvivenza));
|
|
130
|
-
const housingIdx = new Set([0, 1,
|
|
132
|
+
const housingIdx = new Set([0, 1, 6]); // Affitto, utenze, condominio
|
|
131
133
|
const housingUtility1 = c1Spese.reduce((acc, n, idx) => acc + (housingIdx.has(idx) ? toNumber(n) : 0), 0) + quotaMutuoSpese1;
|
|
132
134
|
const housingUtility2 = c2Spese.reduce((acc, n, idx) => acc + (housingIdx.has(idx) ? toNumber(n) : 0), 0) + quotaMutuoSpese2;
|
|
133
135
|
const housingUtilityNonColl = collocatario === 1 ? housingUtility2 : housingUtility1;
|
|
@@ -161,7 +163,7 @@ function calculateModel(input) {
|
|
|
161
163
|
quotaDiretta1, quotaDiretta2,
|
|
162
164
|
saldo1, saldo2,
|
|
163
165
|
assegnoBaseDa1a2, assegnoBaseDa2a1,
|
|
164
|
-
primaCasaMutuoEnabled, primaCasaMutuoImporto,
|
|
166
|
+
primaCasaMutuoEnabled, primaCasaValoreLocativo, primaCasaMutuoImporto,
|
|
165
167
|
primaCasaAssegnataA: assigned,
|
|
166
168
|
primaCasaMutuoPerc1, primaCasaMutuoPerc2,
|
|
167
169
|
primaCasaConsidered, primaCasaTransfer1to2, primaCasaTransfer2to1,
|
package/frontend/public/app.js
CHANGED
|
@@ -281,6 +281,8 @@ const defaultExpenseItems = [
|
|
|
281
281
|
firstHomeBoxNote: "Dichiara se esiste un mutuo sulla prima casa dei coniugi ceduta a uno dei due: il modello considera il trasferimento implicito quando la casa e assegnata al collocatario.",
|
|
282
282
|
firstHomeMortgageEnabledLabel: "Mutuo su prima casa dei coniugi",
|
|
283
283
|
firstHomeMortgageEnabledHint: "Attiva per includere il mutuo della prima casa ceduta nei benefici compensativi.",
|
|
284
|
+
firstHomeLocativeValueLabel: "Casa (valore locativo) ({currency})",
|
|
285
|
+
firstHomeLocativeValueHint: "Valore locativo mensile della casa assegnata, usato per valorizzare il beneficio economico implicito.",
|
|
284
286
|
firstHomeMortgageAmountLabel: "Rata mutuo mensile ({currency})",
|
|
285
287
|
firstHomeMortgageAmountHint: "Importo mensile complessivo della rata del mutuo prima casa.",
|
|
286
288
|
firstHomeAssignedToLabel: "Casa assegnata a",
|
|
@@ -641,6 +643,8 @@ const defaultExpenseItems = [
|
|
|
641
643
|
firstHomeBoxNote: "Declare whether there is a mortgage on the spouses' primary home assigned to one spouse: the model counts the implicit transfer when the home is assigned to the custodial parent.",
|
|
642
644
|
firstHomeMortgageEnabledLabel: "Mortgage on spouses' primary home",
|
|
643
645
|
firstHomeMortgageEnabledHint: "Enable to include the assigned primary-home mortgage in compensative benefits.",
|
|
646
|
+
firstHomeLocativeValueLabel: "Home (rental value) ({currency})",
|
|
647
|
+
firstHomeLocativeValueHint: "Monthly rental value of the assigned home, used to value the implicit economic benefit.",
|
|
644
648
|
firstHomeMortgageAmountLabel: "Monthly mortgage payment ({currency})",
|
|
645
649
|
firstHomeMortgageAmountHint: "Total monthly amount of the primary-home mortgage payment.",
|
|
646
650
|
firstHomeAssignedToLabel: "Home assigned to",
|
|
@@ -1215,6 +1219,8 @@ const defaultExpenseItems = [
|
|
|
1215
1219
|
const firstHomeBoxNote = document.getElementById("firstHomeBoxNote");
|
|
1216
1220
|
const lblPrimaCasaMutuoEnabled = document.getElementById("lblPrimaCasaMutuoEnabled");
|
|
1217
1221
|
const hintPrimaCasaMutuoEnabled = document.getElementById("hintPrimaCasaMutuoEnabled");
|
|
1222
|
+
const lblPrimaCasaValoreLocativo = document.getElementById("lblPrimaCasaValoreLocativo");
|
|
1223
|
+
const hintPrimaCasaValoreLocativo = document.getElementById("hintPrimaCasaValoreLocativo");
|
|
1218
1224
|
const lblPrimaCasaMutuoImporto = document.getElementById("lblPrimaCasaMutuoImporto");
|
|
1219
1225
|
const hintPrimaCasaMutuoImporto = document.getElementById("hintPrimaCasaMutuoImporto");
|
|
1220
1226
|
const lblPrimaCasaAssegnataA = document.getElementById("lblPrimaCasaAssegnataA");
|
|
@@ -1278,6 +1284,8 @@ const defaultExpenseItems = [
|
|
|
1278
1284
|
if (firstHomeBoxNote) firstHomeBoxNote.textContent = tr("firstHomeBoxNote");
|
|
1279
1285
|
if (lblPrimaCasaMutuoEnabled) lblPrimaCasaMutuoEnabled.textContent = tr("firstHomeMortgageEnabledLabel");
|
|
1280
1286
|
if (hintPrimaCasaMutuoEnabled) hintPrimaCasaMutuoEnabled.title = tr("firstHomeMortgageEnabledHint");
|
|
1287
|
+
if (lblPrimaCasaValoreLocativo) lblPrimaCasaValoreLocativo.textContent = msg("firstHomeLocativeValueLabel", { currency: currentCurrency });
|
|
1288
|
+
if (hintPrimaCasaValoreLocativo) hintPrimaCasaValoreLocativo.title = tr("firstHomeLocativeValueHint");
|
|
1281
1289
|
if (lblPrimaCasaMutuoImporto) lblPrimaCasaMutuoImporto.textContent = msg("firstHomeMortgageAmountLabel", { currency: currentCurrency });
|
|
1282
1290
|
if (hintPrimaCasaMutuoImporto) hintPrimaCasaMutuoImporto.title = tr("firstHomeMortgageAmountHint");
|
|
1283
1291
|
if (lblPrimaCasaAssegnataA) lblPrimaCasaAssegnataA.textContent = tr("firstHomeAssignedToLabel");
|
|
@@ -3599,6 +3607,7 @@ const defaultExpenseItems = [
|
|
|
3599
3607
|
aFam1: num("assegnoFam1"),
|
|
3600
3608
|
aFam2: num("assegnoFam2"),
|
|
3601
3609
|
primaCasaMutuoEnabled: firstHome.enabled ? 1 : 0,
|
|
3610
|
+
primaCasaValoreLocativo: num("primaCasaValoreLocativo"),
|
|
3602
3611
|
primaCasaMutuoImporto: firstHome.amount,
|
|
3603
3612
|
primaCasaAssegnataA: firstHome.assignedTo,
|
|
3604
3613
|
primaCasaMutuoPerc1: firstHome.share1,
|
|
@@ -6028,6 +6037,7 @@ ${scenarioLab.length ? `
|
|
|
6028
6037
|
assegnoPagato2: num("assegnoPagato2"),
|
|
6029
6038
|
assegnoFam2: num("assegnoFam2"),
|
|
6030
6039
|
primaCasaMutuoEnabled: document.getElementById("primaCasaMutuoEnabled")?.checked ? 1 : 0,
|
|
6040
|
+
primaCasaValoreLocativo: num("primaCasaValoreLocativo"),
|
|
6031
6041
|
primaCasaMutuoImporto: num("primaCasaMutuoImporto"),
|
|
6032
6042
|
primaCasaAssegnataA: String(document.getElementById("primaCasaAssegnataA")?.value || ""),
|
|
6033
6043
|
primaCasaMutuoPerc1: num("primaCasaMutuoPerc1"),
|