feat: add employee profile picture retrieval to leave report, updating gestor information and table headers for improved clarity
This commit is contained in:
@@ -277,14 +277,14 @@
|
||||
);
|
||||
|
||||
const periodosDetalhados = $derived<Array<PeriodoDetalhado>>(
|
||||
solicitacoesAprovadas
|
||||
solicitacoesAprovadas
|
||||
.map((periodo) => ({
|
||||
feriasId: periodo._id,
|
||||
funcionarioId: periodo.funcionarioId,
|
||||
anoReferencia: periodo.anoReferencia,
|
||||
funcionarioNome: periodo.funcionario?.nome ?? 'Funcionário não encontrado',
|
||||
matricula: periodo.funcionario?.matricula ?? null,
|
||||
timeNome: periodo.time?.nome ?? null,
|
||||
gestorNome: periodo.gestor?.nome ?? null,
|
||||
timeCor: periodo.time?.cor ?? null,
|
||||
status: periodo.status,
|
||||
dataInicio: periodo.dataInicio,
|
||||
@@ -1134,7 +1134,7 @@
|
||||
const dadosTabela: string[][] = periodosSelecionados.map((periodo) => [
|
||||
periodo.funcionarioNome,
|
||||
periodo.matricula ?? 'S/N',
|
||||
periodo.timeNome ?? 'Sem time',
|
||||
periodo.gestorNome ?? 'Sem gestor',
|
||||
periodo.anoReferencia.toString(),
|
||||
formatarData(periodo.dataInicio),
|
||||
formatarData(periodo.dataFim),
|
||||
@@ -1146,7 +1146,7 @@
|
||||
if (dadosTabela.length > 0) {
|
||||
autoTable(doc, {
|
||||
startY: yPosition,
|
||||
head: [['Funcionário', 'Matrícula', 'Time', 'Ano Ref.', 'Início', 'Fim', 'Dias', 'Status']],
|
||||
head: [['Funcionário', 'Matrícula', 'Gestor', 'Ano Ref.', 'Início', 'Fim', 'Dias', 'Status']],
|
||||
body: dadosTabela,
|
||||
theme: 'striped',
|
||||
headStyles: {
|
||||
@@ -1159,7 +1159,7 @@
|
||||
columnStyles: {
|
||||
0: { cellWidth: 40, fontSize: 7 }, // Funcionário
|
||||
1: { cellWidth: 20, fontSize: 7 }, // Matrícula
|
||||
2: { cellWidth: 25, fontSize: 7 }, // Time
|
||||
2: { cellWidth: 25, fontSize: 7 }, // Gestor
|
||||
3: { cellWidth: 15, fontSize: 7 }, // Ano Ref.
|
||||
4: { cellWidth: 22, fontSize: 7 }, // Início
|
||||
5: { cellWidth: 22, fontSize: 7 }, // Fim
|
||||
@@ -1218,7 +1218,7 @@
|
||||
const dados: Array<Record<string, string | number>> = periodosSelecionados.map((periodo) => ({
|
||||
'Funcionário': periodo.funcionarioNome,
|
||||
'Matrícula': periodo.matricula ?? 'S/N',
|
||||
'Time': periodo.timeNome ?? 'Sem time',
|
||||
'Gestor': periodo.gestorNome ?? 'Sem gestor',
|
||||
'Ano Ref.': periodo.anoReferencia,
|
||||
'Data Início': formatarData(periodo.dataInicio),
|
||||
'Data Fim': formatarData(periodo.dataFim),
|
||||
@@ -1495,7 +1495,7 @@
|
||||
<td>${index + 1}</td>
|
||||
<td>${periodo.funcionarioNome}</td>
|
||||
<td>${periodo.matricula ?? 'S/N'}</td>
|
||||
<td>${periodo.timeNome ?? 'Sem time'}</td>
|
||||
<td>${periodo.gestorNome ?? 'Sem gestor'}</td>
|
||||
<td>${periodo.anoReferencia}</td>
|
||||
<td>${formatarData(periodo.dataInicio)}</td>
|
||||
<td>${formatarData(periodo.dataFim)}</td>
|
||||
@@ -1603,7 +1603,7 @@
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Funcionário</th>
|
||||
<th>Matrícula</th>
|
||||
<th>Matrícula</th>
|
||||
<th>Gestor</th>
|
||||
<th>Ano Ref.</th>
|
||||
<th>Início</th>
|
||||
@@ -2688,10 +2688,18 @@
|
||||
<tr>
|
||||
<td>
|
||||
<div class="flex items-center gap-3">
|
||||
<div class="avatar placeholder">
|
||||
<div class="bg-primary text-primary-content w-10 rounded-full">
|
||||
<span class="text-xs"
|
||||
>{periodo.funcionario?.nome.substring(0, 2).toUpperCase()}</span
|
||||
<div class="avatar placeholder">
|
||||
<div class="bg-primary text-primary-content w-10 h-10 rounded-full flex items-center justify-center overflow-hidden">
|
||||
{#if periodo.funcionario && 'fotoPerfilUrl' in periodo.funcionario && periodo.funcionario.fotoPerfilUrl}
|
||||
<img
|
||||
src={periodo.funcionario.fotoPerfilUrl}
|
||||
alt={`Foto de perfil de ${periodo.funcionario?.nome || 'Usuário'}`}
|
||||
class="h-full w-full object-cover"
|
||||
/>
|
||||
{:else}
|
||||
<span class="text-xs"
|
||||
>{periodo.funcionario?.nome?.substring(0, 2).toUpperCase() || '??'}</span
|
||||
>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -80,6 +80,15 @@ export const listarTodas = query({
|
||||
todasFerias.map(async (ferias) => {
|
||||
const funcionario = await ctx.db.get(ferias.funcionarioId);
|
||||
|
||||
// Buscar usuário do funcionário para obter fotoPerfilUrl
|
||||
let fotoPerfilUrl: string | null = null;
|
||||
if (funcionario?.usuarioId) {
|
||||
const usuario = await ctx.db.get(funcionario.usuarioId);
|
||||
if (usuario?.fotoPerfil) {
|
||||
fotoPerfilUrl = await ctx.storage.getUrl(usuario.fotoPerfil);
|
||||
}
|
||||
}
|
||||
|
||||
// Buscar time do funcionário
|
||||
const membroTime = await ctx.db
|
||||
.query("timesMembros")
|
||||
@@ -114,7 +123,10 @@ export const listarTodas = query({
|
||||
|
||||
return {
|
||||
...ferias,
|
||||
funcionario,
|
||||
funcionario: funcionario ? {
|
||||
...funcionario,
|
||||
fotoPerfilUrl,
|
||||
} : null,
|
||||
time,
|
||||
gestor,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user