feat: add functionality to manage employee status during point registration, preventing point logging for employees on vacation or leave; enhance UI alerts to inform users of their current status

This commit is contained in:
2025-12-09 15:06:36 -03:00
parent 248d7cd623
commit 73da995109
4 changed files with 119 additions and 20 deletions

View File

@@ -551,12 +551,21 @@ export const registrarPonto = mutation({
throw new Error('Usuário não possui funcionário associado');
}
// Verificar se funcionário está ativo
// Verificar se funcionário existe
const funcionario = await ctx.db.get(usuario.funcionarioId);
if (!funcionario) {
throw new Error('Funcionário não encontrado');
}
// Bloquear registro de ponto para funcionários em férias ou licença
if (funcionario.statusFerias === 'em_ferias') {
throw new Error('Não é possível registrar ponto: funcionário está em férias.');
}
if (funcionario.statusFerias === 'em_licenca') {
throw new Error('Não é possível registrar ponto: funcionário está em licença.');
}
// Obter configuração de ponto
const config = await ctx.db
.query('configuracaoPonto')