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>>(
|
const periodosDetalhados = $derived<Array<PeriodoDetalhado>>(
|
||||||
solicitacoesAprovadas
|
solicitacoesAprovadas
|
||||||
.map((periodo) => ({
|
.map((periodo) => ({
|
||||||
feriasId: periodo._id,
|
feriasId: periodo._id,
|
||||||
funcionarioId: periodo.funcionarioId,
|
funcionarioId: periodo.funcionarioId,
|
||||||
anoReferencia: periodo.anoReferencia,
|
anoReferencia: periodo.anoReferencia,
|
||||||
funcionarioNome: periodo.funcionario?.nome ?? 'Funcionário não encontrado',
|
funcionarioNome: periodo.funcionario?.nome ?? 'Funcionário não encontrado',
|
||||||
matricula: periodo.funcionario?.matricula ?? null,
|
matricula: periodo.funcionario?.matricula ?? null,
|
||||||
timeNome: periodo.time?.nome ?? null,
|
gestorNome: periodo.gestor?.nome ?? null,
|
||||||
timeCor: periodo.time?.cor ?? null,
|
timeCor: periodo.time?.cor ?? null,
|
||||||
status: periodo.status,
|
status: periodo.status,
|
||||||
dataInicio: periodo.dataInicio,
|
dataInicio: periodo.dataInicio,
|
||||||
@@ -1134,7 +1134,7 @@
|
|||||||
const dadosTabela: string[][] = periodosSelecionados.map((periodo) => [
|
const dadosTabela: string[][] = periodosSelecionados.map((periodo) => [
|
||||||
periodo.funcionarioNome,
|
periodo.funcionarioNome,
|
||||||
periodo.matricula ?? 'S/N',
|
periodo.matricula ?? 'S/N',
|
||||||
periodo.timeNome ?? 'Sem time',
|
periodo.gestorNome ?? 'Sem gestor',
|
||||||
periodo.anoReferencia.toString(),
|
periodo.anoReferencia.toString(),
|
||||||
formatarData(periodo.dataInicio),
|
formatarData(periodo.dataInicio),
|
||||||
formatarData(periodo.dataFim),
|
formatarData(periodo.dataFim),
|
||||||
@@ -1146,7 +1146,7 @@
|
|||||||
if (dadosTabela.length > 0) {
|
if (dadosTabela.length > 0) {
|
||||||
autoTable(doc, {
|
autoTable(doc, {
|
||||||
startY: yPosition,
|
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,
|
body: dadosTabela,
|
||||||
theme: 'striped',
|
theme: 'striped',
|
||||||
headStyles: {
|
headStyles: {
|
||||||
@@ -1159,7 +1159,7 @@
|
|||||||
columnStyles: {
|
columnStyles: {
|
||||||
0: { cellWidth: 40, fontSize: 7 }, // Funcionário
|
0: { cellWidth: 40, fontSize: 7 }, // Funcionário
|
||||||
1: { cellWidth: 20, fontSize: 7 }, // Matrícula
|
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.
|
3: { cellWidth: 15, fontSize: 7 }, // Ano Ref.
|
||||||
4: { cellWidth: 22, fontSize: 7 }, // Início
|
4: { cellWidth: 22, fontSize: 7 }, // Início
|
||||||
5: { cellWidth: 22, fontSize: 7 }, // Fim
|
5: { cellWidth: 22, fontSize: 7 }, // Fim
|
||||||
@@ -1218,7 +1218,7 @@
|
|||||||
const dados: Array<Record<string, string | number>> = periodosSelecionados.map((periodo) => ({
|
const dados: Array<Record<string, string | number>> = periodosSelecionados.map((periodo) => ({
|
||||||
'Funcionário': periodo.funcionarioNome,
|
'Funcionário': periodo.funcionarioNome,
|
||||||
'Matrícula': periodo.matricula ?? 'S/N',
|
'Matrícula': periodo.matricula ?? 'S/N',
|
||||||
'Time': periodo.timeNome ?? 'Sem time',
|
'Gestor': periodo.gestorNome ?? 'Sem gestor',
|
||||||
'Ano Ref.': periodo.anoReferencia,
|
'Ano Ref.': periodo.anoReferencia,
|
||||||
'Data Início': formatarData(periodo.dataInicio),
|
'Data Início': formatarData(periodo.dataInicio),
|
||||||
'Data Fim': formatarData(periodo.dataFim),
|
'Data Fim': formatarData(periodo.dataFim),
|
||||||
@@ -1495,7 +1495,7 @@
|
|||||||
<td>${index + 1}</td>
|
<td>${index + 1}</td>
|
||||||
<td>${periodo.funcionarioNome}</td>
|
<td>${periodo.funcionarioNome}</td>
|
||||||
<td>${periodo.matricula ?? 'S/N'}</td>
|
<td>${periodo.matricula ?? 'S/N'}</td>
|
||||||
<td>${periodo.timeNome ?? 'Sem time'}</td>
|
<td>${periodo.gestorNome ?? 'Sem gestor'}</td>
|
||||||
<td>${periodo.anoReferencia}</td>
|
<td>${periodo.anoReferencia}</td>
|
||||||
<td>${formatarData(periodo.dataInicio)}</td>
|
<td>${formatarData(periodo.dataInicio)}</td>
|
||||||
<td>${formatarData(periodo.dataFim)}</td>
|
<td>${formatarData(periodo.dataFim)}</td>
|
||||||
@@ -1603,7 +1603,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th>#</th>
|
<th>#</th>
|
||||||
<th>Funcionário</th>
|
<th>Funcionário</th>
|
||||||
<th>Matrícula</th>
|
<th>Matrícula</th>
|
||||||
<th>Gestor</th>
|
<th>Gestor</th>
|
||||||
<th>Ano Ref.</th>
|
<th>Ano Ref.</th>
|
||||||
<th>Início</th>
|
<th>Início</th>
|
||||||
@@ -2688,10 +2688,18 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<div class="flex items-center gap-3">
|
<div class="flex items-center gap-3">
|
||||||
<div class="avatar placeholder">
|
<div class="avatar placeholder">
|
||||||
<div class="bg-primary text-primary-content w-10 rounded-full">
|
<div class="bg-primary text-primary-content w-10 h-10 rounded-full flex items-center justify-center overflow-hidden">
|
||||||
<span class="text-xs"
|
{#if periodo.funcionario && 'fotoPerfilUrl' in periodo.funcionario && periodo.funcionario.fotoPerfilUrl}
|
||||||
>{periodo.funcionario?.nome.substring(0, 2).toUpperCase()}</span
|
<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}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -80,6 +80,15 @@ export const listarTodas = query({
|
|||||||
todasFerias.map(async (ferias) => {
|
todasFerias.map(async (ferias) => {
|
||||||
const funcionario = await ctx.db.get(ferias.funcionarioId);
|
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
|
// Buscar time do funcionário
|
||||||
const membroTime = await ctx.db
|
const membroTime = await ctx.db
|
||||||
.query("timesMembros")
|
.query("timesMembros")
|
||||||
@@ -114,7 +123,10 @@ export const listarTodas = query({
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
...ferias,
|
...ferias,
|
||||||
funcionario,
|
funcionario: funcionario ? {
|
||||||
|
...funcionario,
|
||||||
|
fotoPerfilUrl,
|
||||||
|
} : null,
|
||||||
time,
|
time,
|
||||||
gestor,
|
gestor,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user