feat: enhance employee leave report generation by adding gestor information retrieval and improving filtering capabilities across components

This commit is contained in:
2025-11-29 20:21:40 -03:00
parent e9e7c654ee
commit f059a0c688
4 changed files with 1495 additions and 332 deletions

View File

@@ -2697,7 +2697,7 @@
</div> </div>
</div> </div>
{/if} {/if}
</main> </main>
<!-- Modal de Erro --> <!-- Modal de Erro -->
<ErrorModal <ErrorModal

View File

@@ -90,14 +90,33 @@ export const listarTodas = query({
.first(); .first();
let time = null; let time = null;
let gestor = null;
if (membroTime) { if (membroTime) {
time = await ctx.db.get(membroTime.timeId); time = await ctx.db.get(membroTime.timeId);
// Buscar gestor do time
if (time?.gestorId) {
const gestorUsuario = await ctx.db.get(time.gestorId);
if (gestorUsuario) {
// Buscar funcionário do gestor para obter o nome
const gestorFuncionario = await ctx.db
.query("funcionarios")
.withIndex("by_usuario", (q) => q.eq("usuarioId", time.gestorId))
.first();
if (gestorFuncionario) {
gestor = {
_id: gestorUsuario._id,
nome: gestorFuncionario.nome,
};
}
}
}
} }
return { return {
...ferias, ...ferias,
funcionario, funcionario,
time, time,
gestor,
}; };
}) })
); );