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:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user