From 4cd74cd5004370c4830c215fa27e547f49aa1df4 Mon Sep 17 00:00:00 2001 From: BFLOWS Date: Sat, 18 Apr 2026 18:58:44 +0200 Subject: [PATCH] fix(dashboard-benef): allinea RendicontazioniMie al pattern grafico Gepafin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit La pagina 'Le mie rendicontazioni' usava div con style inline (border, padding, background white) e classi inventate/flex wrapper custom che ignoravano il sistema CSS di Gepafin (appPage, appPageSection, appPageSection__withBorder, __list, __listItem, __pMeta, __actions) usato ovunque altrove (Dashboard, Bandi, Domande). Risultato: card piena larghezza schermo, tipografia incoerente, spaziature al 100% invece di contenute dentro il pattern standard. Riscritta usando esclusivamente le classi di /assets/scss/components/appPage.scss: - appPage + appPage__pageHeader (wrapper + header con bordo sinistro colorato) - appPage__spacer per distacco - wrapper esterno appPageSection (ora le card sono contenute dentro la sezione) - ogni application-card e' un appPageSection__withBorder (bordo 1px + radius 6 + padding 17px gia stilati) con .row interno flex + .rowContent - metriche cap/approvato/disponibile/tranches usano appPageSection__pMeta (2 span, il secondo a sinistra/destra) invece di flex custom - lista tranches usa ul.appPageSection__list + li.appPageSection__listItem.row che ha gia padding 15px + border-bottom gestiti dallo scss - icone + tag in appPageSection__iconActions - bottoni nuova-tranche in appPageSection__actions con justify-content:flex-end - empty state in appPageSection__withBorder centrato - colori CSS variables (var(--primary-color), var(--text-color-secondary), var(--green-700), var(--button-secondary-borderColor)) — niente colori inline Nessuna modifica alla logica (load, openStartDialog, confirmStart, nav). Dialog 'Avvia nuova tranche' invariato (gia era OK con appForm__field). --- .../pages/RendicontazioniMie.js | 169 ++++++++++-------- 1 file changed, 99 insertions(+), 70 deletions(-) diff --git a/src/modules/rendicontazione/pages/RendicontazioniMie.js b/src/modules/rendicontazione/pages/RendicontazioniMie.js index 804cf49..25475fb 100644 --- a/src/modules/rendicontazione/pages/RendicontazioniMie.js +++ b/src/modules/rendicontazione/pages/RendicontazioniMie.js @@ -31,7 +31,7 @@ const RendicontazioniMie = () => { const toast = useRef(null); const [apps, setApps] = useState([]); const [loading, setLoading] = useState(true); - const [startDialog, setStartDialog] = useState(null); // { application_id, max_tranches, next_seq, show_copy_ula } + const [startDialog, setStartDialog] = useState(null); const [startForm, setStartForm] = useState({ period_label: '', copy_ula: true }); const [starting, setStarting] = useState(false); @@ -58,30 +58,39 @@ const RendicontazioniMie = () => { call_name: app.call_name, max_tranches: app.max_tranches, next_seq: nextSeq, - show_copy_ula: nextSeq > 1, max_remission_next: app.max_remission_next_tranche, + show_copy_ula: nextSeq > 1, }); - setStartForm({ period_label: '', copy_ula: nextSeq > 1 }); + setStartForm({ period_label: '', copy_ula: true }); }; const confirmStart = () => { if (!startDialog) return; setStarting(true); - RendicontazioneService.startPractice( - startDialog.application_id, + RendicontazioneService.startPractice(startDialog.application_id, (resp) => { setStarting(false); setStartDialog(null); - toast.current?.show({ severity: 'success', summary: resp?.message || __('Tranche avviata', 'gepafin') }); - navigate(`/rendicontazioni/${resp.data.id}`); + toast.current?.show({ + severity: 'success', + summary: __('Tranche avviata', 'gepafin'), + detail: resp?.message + }); + const newId = resp?.data?.id; + if (newId) navigate(`/rendicontazioni/${newId}`); + else load(); }, (err) => { setStarting(false); - toast.current?.show({ severity: 'error', summary: __('Avvio fallito', 'gepafin'), detail: err?.detail }); + toast.current?.show({ + severity: 'error', + summary: __('Avvio fallito', 'gepafin'), + detail: err?.detail || err?.message + }); }, { - period_label: startForm.period_label?.trim() || null, - copy_ula_from_previous: startForm.copy_ula, + period_label: startForm.period_label || null, + copy_ula_from_previous: startDialog.show_copy_ula ? startForm.copy_ula : false, } ); }; @@ -93,79 +102,92 @@ const RendicontazioniMie = () => { const blockReason = app.start_blocked_reason; return ( -
- {/* HEADER CARD */} -
-
-

+
+ {/* HEADER: bando + erogato */} +
+
+

{app.call_name || `Bando #${app.call_id}`} -

-
+

+

{app.company_name || ''} · {__('Domanda', 'gepafin')} #{app.application_id} -

+

-
{__('Finanziamento erogato','gepafin')}
-
{fmtEur(app.amount_erogato)}
+
+ {__('Finanziamento erogato','gepafin')} +
+
{fmtEur(app.amount_erogato)}
- {/* CAP INFO */} -
-
-
{__('Cap remissione totale', 'gepafin')}
- {fmtEur(app.max_remission_global)} -
-
-
{__('Già approvato', 'gepafin')}
- 0 ? '#22543d' : 'inherit' }}>{fmtEur(app.already_approved_sum)} -
-
-
{__('Disponibile prossima tranche', 'gepafin')}
- {fmtEur(app.max_remission_next_tranche)} -
-
-
{__('Tranches', 'gepafin')}
- {app.tranches?.length || 0} / {app.max_tranches} -
+ {/* METRICHE cap/approvato/disponibile/tranches in griglia 4 colonne */} +
+

+ {__('Cap remissione totale', 'gepafin')} + {fmtEur(app.max_remission_global)} +

+

+ {__('Già approvato', 'gepafin')} + 0 ? 'var(--green-700)' : 'inherit' }}> + {fmtEur(app.already_approved_sum)} + +

+

+ {__('Disponibile prossima tranche', 'gepafin')} + + {fmtEur(app.max_remission_next_tranche)} + +

+

+ {__('Tranches', 'gepafin')} + {app.tranches?.length || 0} / {app.max_tranches} +

- {/* TRANCHES LIST */} + {/* LISTA TRANCHES */} {hasTranches && ( -
+
    {app.tranches.map((t) => { const tag = STATUS_TAGS[t.status] || { severity: 'secondary', label: t.status }; const isEditable = t.status === 'DRAFT'; return ( -
    -
    - T{t.sequence_number} +
  • +
    +
    + T{t.sequence_number} +
    +
    +
    + {t.period_label || ( + + {__('nessun periodo indicato','gepafin')} + + )} +
    +
    + {t.invoice_count || 0} {__('fatture','gepafin')} · {t.ula_count || 0} {__('dipendenti','gepafin')} · {t.document_count || 0} {__('doc','gepafin')} +
    +
    -
    -
    {t.period_label || {__('nessun periodo indicato','gepafin')}}
    - - {t.invoice_count || 0} {__('fatture','gepafin')} · {t.ula_count || 0} {__('dipendenti','gepafin')} · {t.document_count || 0} {__('doc','gepafin')} - +
    + +
    - -
    +
  • ); })} -
    +
)} - {/* BOTTONE NUOVA TRANCHE */} -
+ {/* AZIONI: nuova tranche */} +
{!canStart && blockReason && ( - - + + {blockReason} )} @@ -190,26 +212,33 @@ const RendicontazioniMie = () => {

{__('Le mie rendicontazioni', 'gepafin')}

-

{__('Per ogni pratica finanziata puoi avviare la rendicontazione delle spese e il calcolo della remissione del debito. I bandi che prevedono piu tranches permettono rendicontazioni multi-fase.', 'gepafin')}

+

{__('Per ogni pratica finanziata puoi avviare la rendicontazione delle spese e il calcolo della remissione del debito. I bandi che prevedono più tranches permettono rendicontazioni multi-fase.', 'gepafin')}

- {loading && } + {loading && ( +
+ +
+ )} {!loading && apps.length === 0 && ( -
+

{__('Non ci sono rendicontazioni disponibili al momento.', 'gepafin')}

- + {__('Le rendicontazioni diventano disponibili dopo la firma del contratto e quando l\'ente ha pubblicato lo schema di rendicontazione per il bando.', 'gepafin')}
)} - {!loading && apps.length > 0 && apps.map(renderApplicationCard)} + {!loading && apps.length > 0 && ( +
+ {apps.map(renderApplicationCard)} +
+ )} - {/* START DIALOG */} !starting && setStartDialog(null)} @@ -240,7 +269,7 @@ const RendicontazioniMie = () => { onChange={(e) => setStartForm(f => ({ ...f, period_label: e.target.value }))} placeholder={__('es. "I trimestre 2021", "Stato avanzamento II"', 'gepafin')} disabled={starting} /> - + {__('Descrizione libera per identificare la tranche. Apparirà sul verbale.', 'gepafin')}
@@ -255,7 +284,7 @@ const RendicontazioniMie = () => { {__('Copia i dipendenti ULA dalla tranche precedente', 'gepafin')}
- + {__('Se attivo, i dipendenti censiti nella tranche precedente saranno precaricati. Potrai modificarli o rimuoverli prima di inviare.', 'gepafin')}