fix: (agenda) descricao melhorada para titulo das colunas da listagem dos eventos
This commit is contained in:
parent
1b55707f90
commit
5b0783f36b
2 changed files with 74 additions and 46 deletions
|
|
@ -408,40 +408,40 @@ export const EventTable: React.FC<EventTableProps> = ({
|
||||||
{/* Novas colunas de gestão de equipe */}
|
{/* Novas colunas de gestão de equipe */}
|
||||||
{(userRole === UserRole.BUSINESS_OWNER || userRole === UserRole.SUPERADMIN) && (
|
{(userRole === UserRole.BUSINESS_OWNER || userRole === UserRole.SUPERADMIN) && (
|
||||||
<>
|
<>
|
||||||
<th className="px-3 py-3 text-center text-xs font-semibold text-gray-600 uppercase tracking-wider">
|
<th className="px-3 py-3 text-center text-xs font-semibold text-gray-600 uppercase tracking-wider" title="Quantidade de Formandos">
|
||||||
QTD Form.
|
QTD Form.
|
||||||
</th>
|
</th>
|
||||||
<th className="px-3 py-3 text-center text-xs font-semibold text-gray-600 uppercase tracking-wider">
|
<th className="px-3 py-3 text-center text-xs font-semibold text-gray-600 uppercase tracking-wider" title="Quantidade de Fotógrafos">
|
||||||
Fotóg.
|
Fotóg.
|
||||||
</th>
|
</th>
|
||||||
<th className="px-3 py-3 text-center text-xs font-semibold text-gray-600 uppercase tracking-wider">
|
<th className="px-3 py-3 text-center text-xs font-semibold text-gray-600 uppercase tracking-wider" title="Quantidade de Recepcionistas">
|
||||||
Recep.
|
Recep.
|
||||||
</th>
|
</th>
|
||||||
<th className="px-3 py-3 text-center text-xs font-semibold text-gray-600 uppercase tracking-wider">
|
<th className="px-3 py-3 text-center text-xs font-semibold text-gray-600 uppercase tracking-wider" title="Quantidade de Cinegrafistas">
|
||||||
Cine.
|
Cine.
|
||||||
</th>
|
</th>
|
||||||
<th className="px-3 py-3 text-center text-xs font-semibold text-gray-600 uppercase tracking-wider">
|
<th className="px-3 py-3 text-center text-xs font-semibold text-gray-600 uppercase tracking-wider" title="Quantidade de Estúdios">
|
||||||
Estúd.
|
Estúd.
|
||||||
</th>
|
</th>
|
||||||
<th className="px-3 py-3 text-center text-xs font-semibold text-gray-600 uppercase tracking-wider">
|
<th className="px-3 py-3 text-center text-xs font-semibold text-gray-600 uppercase tracking-wider" title="Pontos de Foto">
|
||||||
Pts. Foto
|
Pts. Foto
|
||||||
</th>
|
</th>
|
||||||
<th className="px-3 py-3 text-center text-xs font-semibold text-gray-600 uppercase tracking-wider">
|
<th className="px-3 py-3 text-center text-xs font-semibold text-gray-600 uppercase tracking-wider" title="Pontos Decorados">
|
||||||
Pts. Dec.
|
Pts. Dec.
|
||||||
</th>
|
</th>
|
||||||
<th className="px-3 py-3 text-center text-xs font-semibold text-gray-600 uppercase tracking-wider">
|
<th className="px-3 py-3 text-center text-xs font-semibold text-gray-600 uppercase tracking-wider" title="Pontos de LED">
|
||||||
Pts. LED
|
Pts. LED
|
||||||
</th>
|
</th>
|
||||||
<th className="px-3 py-3 text-center text-xs font-semibold text-gray-600 uppercase tracking-wider">
|
<th className="px-3 py-3 text-center text-xs font-semibold text-gray-600 uppercase tracking-wider" title="Profissionais Confirmados?">
|
||||||
Prof. OK?
|
Prof. OK?
|
||||||
</th>
|
</th>
|
||||||
<th className="px-3 py-3 text-center text-xs font-semibold text-gray-600 uppercase tracking-wider">
|
<th className="px-3 py-3 text-center text-xs font-semibold text-gray-600 uppercase tracking-wider" title="Fotógrafos Faltantes/Pendentes">
|
||||||
Fot. Falt.
|
Fot. Falt.
|
||||||
</th>
|
</th>
|
||||||
<th className="px-3 py-3 text-center text-xs font-semibold text-gray-600 uppercase tracking-wider">
|
<th className="px-3 py-3 text-center text-xs font-semibold text-gray-600 uppercase tracking-wider" title="Recepcionistas Faltantes/Pendentes">
|
||||||
Rec. Falt.
|
Rec. Falt.
|
||||||
</th>
|
</th>
|
||||||
<th className="px-3 py-3 text-center text-xs font-semibold text-gray-600 uppercase tracking-wider">
|
<th className="px-3 py-3 text-center text-xs font-semibold text-gray-600 uppercase tracking-wider" title="Cinegrafistas Faltantes/Pendentes">
|
||||||
Cin. Falt.
|
Cin. Falt.
|
||||||
</th>
|
</th>
|
||||||
</>
|
</>
|
||||||
|
|
|
||||||
|
|
@ -440,11 +440,16 @@ const Finance: React.FC = () => {
|
||||||
anoFormatura: data.ano_formatura_label || "",
|
anoFormatura: data.ano_formatura_label || "",
|
||||||
fot: data.fot,
|
fot: data.fot,
|
||||||
}));
|
}));
|
||||||
|
// Update the search query state too
|
||||||
|
setFotQuery(String(data.fot));
|
||||||
setFotFound(true);
|
setFotFound(true);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("Error fetching FOT details for edit:", 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
|
// Fetch professional functions if professional name is present
|
||||||
|
|
@ -608,41 +613,64 @@ const Finance: React.FC = () => {
|
||||||
<tbody className="divide-y relative">
|
<tbody className="divide-y relative">
|
||||||
{sortedTransactions.map((t, index) => {
|
{sortedTransactions.map((t, index) => {
|
||||||
const isNewFot = index > 0 && t.fot !== sortedTransactions[index - 1].fot;
|
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 (
|
return (
|
||||||
<tr key={t.id}
|
<React.Fragment key={t.id}>
|
||||||
className={`hover:bg-gray-50 cursor-pointer ${isNewFot ? "border-t-[3px] border-gray-400" : ""}`}
|
<tr
|
||||||
onClick={() => handleEdit(t)}
|
className={`hover:bg-gray-50 cursor-pointer ${isNewFot ? "border-t-[3px] border-gray-400" : ""}`}
|
||||||
>
|
onClick={() => handleEdit(t)}
|
||||||
<td className="px-3 py-2 font-bold">{t.fot || "?"}</td>
|
>
|
||||||
<td className="px-3 py-2">{t.data}</td>
|
<td className="px-3 py-2 font-bold">{t.fot || "?"}</td>
|
||||||
<td className="px-3 py-2">{t.tipoEvento}</td>
|
<td className="px-3 py-2">{t.data}</td>
|
||||||
<td className="px-3 py-2">{t.tipoServico}</td>
|
<td className="px-3 py-2">{t.tipoEvento}</td>
|
||||||
<td className="px-3 py-2">{t.nome}</td>
|
<td className="px-3 py-2">{t.tipoServico}</td>
|
||||||
<td className="px-3 py-2">{t.whatsapp}</td>
|
<td className="px-3 py-2">{t.nome}</td>
|
||||||
<td className="px-3 py-2">{t.cpf}</td>
|
<td className="px-3 py-2">{t.whatsapp}</td>
|
||||||
<td className="px-3 py-2">{t.tabelaFree}</td>
|
<td className="px-3 py-2">{t.cpf}</td>
|
||||||
<td className="px-3 py-2 text-right">{t.valorFree?.toFixed(2)}</td>
|
<td className="px-3 py-2">{t.tabelaFree}</td>
|
||||||
<td className="px-3 py-2 text-right">{t.valorExtra?.toFixed(2)}</td>
|
<td className="px-3 py-2 text-right">{t.valorFree?.toFixed(2)}</td>
|
||||||
<td className="px-3 py-2 max-w-[150px] truncate" title={t.descricaoExtra}>{t.descricaoExtra}</td>
|
<td className="px-3 py-2 text-right">{t.valorExtra?.toFixed(2)}</td>
|
||||||
<td className="px-3 py-2 text-right font-bold text-green-700">{t.totalPagar?.toFixed(2)}</td>
|
<td className="px-3 py-2 max-w-[150px] truncate" title={t.descricaoExtra}>{t.descricaoExtra}</td>
|
||||||
<td className="px-3 py-2">
|
<td className="px-3 py-2 text-right font-bold text-green-700">{t.totalPagar?.toFixed(2)}</td>
|
||||||
{(() => {
|
<td className="px-3 py-2">
|
||||||
try {
|
{(() => {
|
||||||
if (!t.dataPgto) return "-";
|
try {
|
||||||
const d = new Date(t.dataPgto);
|
if (!t.dataPgto) return "-";
|
||||||
if (isNaN(d.getTime())) return "-";
|
const d = new Date(t.dataPgto);
|
||||||
return d.toLocaleDateString("pt-BR", {timeZone: "UTC"});
|
if (isNaN(d.getTime())) return "-";
|
||||||
} catch (e) {
|
return d.toLocaleDateString("pt-BR", {timeZone: "UTC"});
|
||||||
return "-";
|
} catch (e) {
|
||||||
}
|
return "-";
|
||||||
})()}
|
}
|
||||||
</td>
|
})()}
|
||||||
<td className="px-3 py-2 text-center">
|
</td>
|
||||||
{t.pgtoOk
|
<td className="px-3 py-2 text-center">
|
||||||
? <span className="bg-green-100 text-green-800 px-2 py-0.5 rounded-full text-[10px]">Sim</span>
|
{t.pgtoOk
|
||||||
: <span className="bg-red-100 text-red-800 px-2 py-0.5 rounded-full text-[10px]">Não</span>}
|
? <span className="bg-green-100 text-green-800 px-2 py-0.5 rounded-full text-[10px]">Sim</span>
|
||||||
</td>
|
: <span className="bg-red-100 text-red-800 px-2 py-0.5 rounded-full text-[10px]">Não</span>}
|
||||||
</tr>
|
</td>
|
||||||
|
</tr>
|
||||||
|
{showSummary && (
|
||||||
|
<tr className="bg-gray-100 font-bold text-gray-800 border-b-2 border-gray-300">
|
||||||
|
<td colSpan={11} className="px-3 py-2 text-right uppercase text-[10px] tracking-wide text-gray-500">
|
||||||
|
Total FOT {t.fot}:
|
||||||
|
</td>
|
||||||
|
<td className="px-3 py-2 text-right text-brand-gold">
|
||||||
|
{/* Calculate sum for this group */}
|
||||||
|
{sortedTransactions
|
||||||
|
.filter(tr => tr.fot === t.fot)
|
||||||
|
.reduce((sum, curr) => sum + (curr.totalPagar || 0), 0)
|
||||||
|
.toFixed(2)}
|
||||||
|
</td>
|
||||||
|
<td colSpan={2}></td>
|
||||||
|
</tr>
|
||||||
|
)}
|
||||||
|
</React.Fragment>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue