mantenimento-app 2.2.1 → 2.2.3

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 CHANGED
@@ -387,6 +387,8 @@ const defaultExpenseItems = [
387
387
  sepCostLossSpouse: "Impatto stimato su {spouse}",
388
388
  sepCostInlineHint: "Duplicazione mensile stimata: {amount}",
389
389
  sepCostWarning: "Inserisci le spese mensili in convivenza nel campo sopra per attivare questa analisi.",
390
+ sepCostCurrentTotal: "Totale spese attuali dopo separazione: {amount}",
391
+ sepCostUseCurrentTotalBtn: "Usa il totale spese attuale",
390
392
  footerVisitorsTotal: "Visitatori totali",
391
393
  footerVisitorsActive: "Visitatori attivi",
392
394
  footerLoggedUsers: "Utenti loggati",
@@ -726,6 +728,8 @@ const defaultExpenseItems = [
726
728
  sepCostLossSpouse: "Estimated impact on {spouse}",
727
729
  sepCostInlineHint: "Estimated monthly duplication: {amount}",
728
730
  sepCostWarning: "Enter the cohabiting monthly expenses above to activate this analysis.",
731
+ sepCostCurrentTotal: "Current total expenses after separation: {amount}",
732
+ sepCostUseCurrentTotalBtn: "Use current total expenses",
729
733
  footerVisitorsTotal: "Total visitors",
730
734
  footerVisitorsActive: "Active visitors",
731
735
  footerLoggedUsers: "Logged users",
@@ -4603,7 +4607,27 @@ const defaultExpenseItems = [
4603
4607
  }
4604
4608
 
4605
4609
  if (!m.speseConvivenza || m.speseConvivenza <= 0) {
4606
- panel.innerHTML = `<div class="sep-cost-warning">${escapeHtml(tr("sepCostWarning"))}</div>`;
4610
+ panel.innerHTML = `
4611
+ <div class="sep-cost-panel">
4612
+ <h3 class="sep-cost-title">${escapeHtml(tr("sepCostPanelTitle"))}</h3>
4613
+ <div class="sep-cost-warning">
4614
+ <div>${escapeHtml(tr("sepCostWarning"))}</div>
4615
+ <div class="sep-cost-warning-meta">${escapeHtml(msg("sepCostCurrentTotal", { amount: eur(m.speseTot) }))}</div>
4616
+ <button type="button" class="btn-secondary sep-cost-fill-btn">${escapeHtml(tr("sepCostUseCurrentTotalBtn"))}</button>
4617
+ </div>
4618
+ </div>
4619
+ `;
4620
+ const fillBtn = panel.querySelector(".sep-cost-fill-btn");
4621
+ if (fillBtn) {
4622
+ fillBtn.addEventListener("click", () => {
4623
+ const input = document.getElementById("speseConvivenza");
4624
+ if (!input) return;
4625
+ const suggested = Math.max(0, Math.round(Number(m.speseTot || 0)));
4626
+ input.value = String(suggested);
4627
+ input.focus();
4628
+ renderAll();
4629
+ });
4630
+ }
4607
4631
  return;
4608
4632
  }
4609
4633
 
@@ -4723,6 +4747,21 @@ const defaultExpenseItems = [
4723
4747
  };
4724
4748
  const pdfCalHtml = buildPdfCalendarHtml();
4725
4749
  const compBenefits = getCompensativeBenefitRows(m, c1Name, c2Name);
4750
+ const compBenefitsRowsHtml = compBenefits.length
4751
+ ? compBenefits.map((row) => `<tr><td>${escapeHtml(row.label)}</td><td class="num">${eur(row.amount)}</td></tr>`).join("")
4752
+ : `<tr><td colspan="2">${tr("pdfCompBenefitsNone")}</td></tr>`;
4753
+ const primaryHomeAssignedLabel = m.primaCasaAssegnataA === "1"
4754
+ ? c1NameEsc
4755
+ : m.primaCasaAssegnataA === "2"
4756
+ ? c2NameEsc
4757
+ : tr("pdfPrimaryHomeNotDeclared");
4758
+ const primaryHomeSummaryRows = m.primaCasaMutuoEnabled
4759
+ ? `
4760
+ <tr><td>${tr("pdfPrimaryHomeAssignedTo")}</td><td>${primaryHomeAssignedLabel}</td></tr>
4761
+ <tr><td>${tr("pdfPrimaryHomeMonthlyAmount")}</td><td>${eur(m.primaCasaMutuoImporto || 0)}</td></tr>
4762
+ <tr><td>${tr("pdfPrimaryHomeSplit")}</td><td>${c1NameEsc} ${(m.primaCasaMutuoPerc1 || 0).toFixed(0)}% · ${c2NameEsc} ${(m.primaCasaMutuoPerc2 || 0).toFixed(0)}%</td></tr>
4763
+ <tr><td>${tr("pdfPrimaryHomeAppliedOnlyColl")}</td><td>${m.primaCasaConsidered ? "OK" : tr("pdfPrimaryHomeNotDeclared")}</td></tr>`
4764
+ : `<tr><td>${tr("pdfPrimaryHomeMortgage")}</td><td>${tr("pdfPrimaryHomeNotDeclared")}</td></tr>`;
4726
4765
 
4727
4766
  let explainResultHtml = `<div class="pdf-explain-result-empty">${tr("calcNoTransferSuggested")}</div>`;
4728
4767
  if (m.assegnoDa1a2 > 0.005) {
@@ -387,6 +387,8 @@ const defaultExpenseItems = [
387
387
  sepCostLossSpouse: "Impatto stimato su {spouse}",
388
388
  sepCostInlineHint: "Duplicazione mensile stimata: {amount}",
389
389
  sepCostWarning: "Inserisci le spese mensili in convivenza nel campo sopra per attivare questa analisi.",
390
+ sepCostCurrentTotal: "Totale spese attuali dopo separazione: {amount}",
391
+ sepCostUseCurrentTotalBtn: "Usa il totale spese attuale",
390
392
  footerVisitorsTotal: "Visitatori totali",
391
393
  footerVisitorsActive: "Visitatori attivi",
392
394
  footerLoggedUsers: "Utenti loggati",
@@ -726,6 +728,8 @@ const defaultExpenseItems = [
726
728
  sepCostLossSpouse: "Estimated impact on {spouse}",
727
729
  sepCostInlineHint: "Estimated monthly duplication: {amount}",
728
730
  sepCostWarning: "Enter the cohabiting monthly expenses above to activate this analysis.",
731
+ sepCostCurrentTotal: "Current total expenses after separation: {amount}",
732
+ sepCostUseCurrentTotalBtn: "Use current total expenses",
729
733
  footerVisitorsTotal: "Total visitors",
730
734
  footerVisitorsActive: "Active visitors",
731
735
  footerLoggedUsers: "Logged users",
@@ -4603,7 +4607,27 @@ const defaultExpenseItems = [
4603
4607
  }
4604
4608
 
4605
4609
  if (!m.speseConvivenza || m.speseConvivenza <= 0) {
4606
- panel.innerHTML = `<div class="sep-cost-warning">${escapeHtml(tr("sepCostWarning"))}</div>`;
4610
+ panel.innerHTML = `
4611
+ <div class="sep-cost-panel">
4612
+ <h3 class="sep-cost-title">${escapeHtml(tr("sepCostPanelTitle"))}</h3>
4613
+ <div class="sep-cost-warning">
4614
+ <div>${escapeHtml(tr("sepCostWarning"))}</div>
4615
+ <div class="sep-cost-warning-meta">${escapeHtml(msg("sepCostCurrentTotal", { amount: eur(m.speseTot) }))}</div>
4616
+ <button type="button" class="btn-secondary sep-cost-fill-btn">${escapeHtml(tr("sepCostUseCurrentTotalBtn"))}</button>
4617
+ </div>
4618
+ </div>
4619
+ `;
4620
+ const fillBtn = panel.querySelector(".sep-cost-fill-btn");
4621
+ if (fillBtn) {
4622
+ fillBtn.addEventListener("click", () => {
4623
+ const input = document.getElementById("speseConvivenza");
4624
+ if (!input) return;
4625
+ const suggested = Math.max(0, Math.round(Number(m.speseTot || 0)));
4626
+ input.value = String(suggested);
4627
+ input.focus();
4628
+ renderAll();
4629
+ });
4630
+ }
4607
4631
  return;
4608
4632
  }
4609
4633
 
@@ -4723,6 +4747,21 @@ const defaultExpenseItems = [
4723
4747
  };
4724
4748
  const pdfCalHtml = buildPdfCalendarHtml();
4725
4749
  const compBenefits = getCompensativeBenefitRows(m, c1Name, c2Name);
4750
+ const compBenefitsRowsHtml = compBenefits.length
4751
+ ? compBenefits.map((row) => `<tr><td>${escapeHtml(row.label)}</td><td class="num">${eur(row.amount)}</td></tr>`).join("")
4752
+ : `<tr><td colspan="2">${tr("pdfCompBenefitsNone")}</td></tr>`;
4753
+ const primaryHomeAssignedLabel = m.primaCasaAssegnataA === "1"
4754
+ ? c1NameEsc
4755
+ : m.primaCasaAssegnataA === "2"
4756
+ ? c2NameEsc
4757
+ : tr("pdfPrimaryHomeNotDeclared");
4758
+ const primaryHomeSummaryRows = m.primaCasaMutuoEnabled
4759
+ ? `
4760
+ <tr><td>${tr("pdfPrimaryHomeAssignedTo")}</td><td>${primaryHomeAssignedLabel}</td></tr>
4761
+ <tr><td>${tr("pdfPrimaryHomeMonthlyAmount")}</td><td>${eur(m.primaCasaMutuoImporto || 0)}</td></tr>
4762
+ <tr><td>${tr("pdfPrimaryHomeSplit")}</td><td>${c1NameEsc} ${(m.primaCasaMutuoPerc1 || 0).toFixed(0)}% · ${c2NameEsc} ${(m.primaCasaMutuoPerc2 || 0).toFixed(0)}%</td></tr>
4763
+ <tr><td>${tr("pdfPrimaryHomeAppliedOnlyColl")}</td><td>${m.primaCasaConsidered ? "OK" : tr("pdfPrimaryHomeNotDeclared")}</td></tr>`
4764
+ : `<tr><td>${tr("pdfPrimaryHomeMortgage")}</td><td>${tr("pdfPrimaryHomeNotDeclared")}</td></tr>`;
4726
4765
 
4727
4766
  let explainResultHtml = `<div class="pdf-explain-result-empty">${tr("calcNoTransferSuggested")}</div>`;
4728
4767
  if (m.assegnoDa1a2 > 0.005) {
@@ -599,7 +599,7 @@
599
599
  <script src="supabase.min.js"></script>
600
600
  <script src="fabric.min.js"></script>
601
601
  <script src="html2pdf.bundle.min.js"></script>
602
- <script src="app.js?v=2.2.1"></script>
602
+ <script src="app.js?v=2.2.3"></script>
603
603
  </body>
604
604
  </html>
605
605
 
@@ -1832,6 +1832,19 @@
1832
1832
  padding: 10px 12px;
1833
1833
  }
1834
1834
 
1835
+ .sep-cost-warning-meta {
1836
+ margin-top: 6px;
1837
+ font-size: 0.8rem;
1838
+ color: #6f4c13;
1839
+ font-weight: 700;
1840
+ }
1841
+
1842
+ .sep-cost-fill-btn {
1843
+ margin-top: 8px;
1844
+ width: fit-content;
1845
+ max-width: 100%;
1846
+ }
1847
+
1835
1848
  .sep-cost-panel {
1836
1849
  margin-top: 10px;
1837
1850
  border-radius: 14px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mantenimento-app",
3
- "version": "2.2.1",
3
+ "version": "2.2.3",
4
4
  "description": "Frontend + backend architecture for the mantenimento calculator",
5
5
  "type": "commonjs",
6
6
  "main": "backend/calculate-model.js",