feat: add area chart for upcoming employee leave data, visualizing monthly vacation counts and enhancing dashboard insights
This commit is contained in:
@@ -82,8 +82,11 @@ export const listarTodas = query({
|
||||
|
||||
// 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 (funcionario) {
|
||||
const usuario = await ctx.db
|
||||
.query("usuarios")
|
||||
.withIndex("by_funcionarioId", (q) => q.eq("funcionarioId", funcionario._id))
|
||||
.first();
|
||||
if (usuario?.fotoPerfil) {
|
||||
fotoPerfilUrl = await ctx.storage.getUrl(usuario.fotoPerfil);
|
||||
}
|
||||
@@ -98,19 +101,16 @@ export const listarTodas = query({
|
||||
.filter((q) => q.eq(q.field("ativo"), true))
|
||||
.first();
|
||||
|
||||
let time = null;
|
||||
let gestor = null;
|
||||
let time: Doc<"times"> | null = null;
|
||||
let gestor: { _id: Id<"usuarios">; nome: string } | null = null;
|
||||
if (membroTime) {
|
||||
time = await ctx.db.get(membroTime.timeId);
|
||||
// Buscar gestor do time
|
||||
if (time?.gestorId) {
|
||||
const gestorUsuario = await ctx.db.get(time.gestorId);
|
||||
if (gestorUsuario) {
|
||||
if (gestorUsuario?.funcionarioId) {
|
||||
// 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();
|
||||
const gestorFuncionario = await ctx.db.get(gestorUsuario.funcionarioId);
|
||||
if (gestorFuncionario) {
|
||||
gestor = {
|
||||
_id: gestorUsuario._id,
|
||||
|
||||
Reference in New Issue
Block a user