From 5b0783f36b2457c7eb2b540a152e43e9fe0e213b Mon Sep 17 00:00:00 2001 From: NANDO9322 Date: Fri, 16 Jan 2026 18:37:00 -0300 Subject: [PATCH] fix: (agenda) descricao melhorada para titulo das colunas da listagem dos eventos --- frontend/components/EventTable.tsx | 24 ++++---- frontend/pages/Finance.tsx | 96 +++++++++++++++++++----------- 2 files changed, 74 insertions(+), 46 deletions(-) diff --git a/frontend/components/EventTable.tsx b/frontend/components/EventTable.tsx index 7624685..e530175 100644 --- a/frontend/components/EventTable.tsx +++ b/frontend/components/EventTable.tsx @@ -408,40 +408,40 @@ export const EventTable: React.FC = ({ {/* Novas colunas de gestão de equipe */} {(userRole === UserRole.BUSINESS_OWNER || userRole === UserRole.SUPERADMIN) && ( <> - + QTD Form. - + Fotóg. - + Recep. - + Cine. - + Estúd. - + Pts. Foto - + Pts. Dec. - + Pts. LED - + Prof. OK? - + Fot. Falt. - + Rec. Falt. - + Cin. Falt. diff --git a/frontend/pages/Finance.tsx b/frontend/pages/Finance.tsx index 0fcada6..bcf8d56 100644 --- a/frontend/pages/Finance.tsx +++ b/frontend/pages/Finance.tsx @@ -440,11 +440,16 @@ const Finance: React.FC = () => { anoFormatura: data.ano_formatura_label || "", fot: data.fot, })); + // Update the search query state too + setFotQuery(String(data.fot)); setFotFound(true); } } catch (err) { console.error("Error fetching FOT details for edit:", err); } + } else if (t.fot) { + // Fallback if no ID but we have the number + setFotQuery(String(t.fot)); } // Fetch professional functions if professional name is present @@ -608,41 +613,64 @@ const Finance: React.FC = () => { {sortedTransactions.map((t, index) => { const isNewFot = index > 0 && t.fot !== sortedTransactions[index - 1].fot; + + // Check if this is the last item of the group (or list) to show summary + const isLastOfGroup = index === sortedTransactions.length - 1 || t.fot !== sortedTransactions[index + 1].fot; + // Only show summary if sorted by default (which groups by FOT) or explicitly sorted by FOT + const showSummary = isLastOfGroup && (!sortConfig || sortConfig.key === 'fot'); + return ( - handleEdit(t)} - > - {t.fot || "?"} - {t.data} - {t.tipoEvento} - {t.tipoServico} - {t.nome} - {t.whatsapp} - {t.cpf} - {t.tabelaFree} - {t.valorFree?.toFixed(2)} - {t.valorExtra?.toFixed(2)} - {t.descricaoExtra} - {t.totalPagar?.toFixed(2)} - - {(() => { - try { - if (!t.dataPgto) return "-"; - const d = new Date(t.dataPgto); - if (isNaN(d.getTime())) return "-"; - return d.toLocaleDateString("pt-BR", {timeZone: "UTC"}); - } catch (e) { - return "-"; - } - })()} - - - {t.pgtoOk - ? Sim - : Não} - - + + handleEdit(t)} + > + {t.fot || "?"} + {t.data} + {t.tipoEvento} + {t.tipoServico} + {t.nome} + {t.whatsapp} + {t.cpf} + {t.tabelaFree} + {t.valorFree?.toFixed(2)} + {t.valorExtra?.toFixed(2)} + {t.descricaoExtra} + {t.totalPagar?.toFixed(2)} + + {(() => { + try { + if (!t.dataPgto) return "-"; + const d = new Date(t.dataPgto); + if (isNaN(d.getTime())) return "-"; + return d.toLocaleDateString("pt-BR", {timeZone: "UTC"}); + } catch (e) { + return "-"; + } + })()} + + + {t.pgtoOk + ? Sim + : Não} + + + {showSummary && ( + + + Total FOT {t.fot}: + + + {/* Calculate sum for this group */} + {sortedTransactions + .filter(tr => tr.fot === t.fot) + .reduce((sum, curr) => sum + (curr.totalPagar || 0), 0) + .toFixed(2)} + + + + )} + ); })}