feat: implement customizable point registration labels and GMT offset adjustment
- Added functionality to customize labels for point registration types (Entrada, Saída, etc.) in the configuration settings. - Introduced a GMT offset adjustment feature to account for time zone differences during point registration. - Updated the backend to ensure default values for custom labels and GMT offset are set correctly. - Enhanced the UI to allow users to input and save personalized names for each type of point registration. - Improved the point registration process to utilize the new configuration settings for displaying labels consistently across the application.
This commit is contained in:
@@ -11,6 +11,10 @@
|
||||
let horarioRetornoAlmoco = $state('13:00');
|
||||
let horarioSaida = $state('17:00');
|
||||
let toleranciaMinutos = $state(15);
|
||||
let nomeEntrada = $state('Entrada 1');
|
||||
let nomeSaidaAlmoco = $state('Saída 1');
|
||||
let nomeRetornoAlmoco = $state('Entrada 2');
|
||||
let nomeSaida = $state('Saída 2');
|
||||
let processando = $state(false);
|
||||
let mensagem = $state<{ tipo: 'success' | 'error'; texto: string } | null>(null);
|
||||
|
||||
@@ -21,6 +25,10 @@
|
||||
horarioRetornoAlmoco = configQuery.data.horarioRetornoAlmoco;
|
||||
horarioSaida = configQuery.data.horarioSaida;
|
||||
toleranciaMinutos = configQuery.data.toleranciaMinutos;
|
||||
nomeEntrada = configQuery.data.nomeEntrada || 'Entrada 1';
|
||||
nomeSaidaAlmoco = configQuery.data.nomeSaidaAlmoco || 'Saída 1';
|
||||
nomeRetornoAlmoco = configQuery.data.nomeRetornoAlmoco || 'Entrada 2';
|
||||
nomeSaida = configQuery.data.nomeSaida || 'Saída 2';
|
||||
}
|
||||
});
|
||||
|
||||
@@ -43,6 +51,12 @@
|
||||
return;
|
||||
}
|
||||
|
||||
// Validação dos nomes
|
||||
if (!nomeEntrada.trim() || !nomeSaidaAlmoco.trim() || !nomeRetornoAlmoco.trim() || !nomeSaida.trim()) {
|
||||
mostrarMensagem('error', 'Preencha todos os nomes dos registros');
|
||||
return;
|
||||
}
|
||||
|
||||
processando = true;
|
||||
try {
|
||||
await client.mutation(api.configuracaoPonto.salvarConfiguracao, {
|
||||
@@ -51,6 +65,10 @@
|
||||
horarioRetornoAlmoco,
|
||||
horarioSaida,
|
||||
toleranciaMinutos,
|
||||
nomeEntrada: nomeEntrada.trim(),
|
||||
nomeSaidaAlmoco: nomeSaidaAlmoco.trim(),
|
||||
nomeRetornoAlmoco: nomeRetornoAlmoco.trim(),
|
||||
nomeSaida: nomeSaida.trim(),
|
||||
});
|
||||
|
||||
mostrarMensagem('success', 'Configuração salva com sucesso!');
|
||||
@@ -170,6 +188,84 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<!-- Nomes Personalizados dos Registros -->
|
||||
<h2 class="card-title mb-4">Nomes dos Registros</h2>
|
||||
<p class="text-sm text-base-content/70 mb-4">
|
||||
Personalize os nomes exibidos para cada tipo de registro de ponto
|
||||
</p>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<!-- Nome Entrada -->
|
||||
<div class="form-control">
|
||||
<label class="label" for="nome-entrada">
|
||||
<span class="label-text font-medium">Nome do Registro de Entrada *</span>
|
||||
</label>
|
||||
<input
|
||||
id="nome-entrada"
|
||||
type="text"
|
||||
bind:value={nomeEntrada}
|
||||
placeholder="Ex: Entrada 1"
|
||||
class="input input-bordered"
|
||||
/>
|
||||
<div class="label">
|
||||
<span class="label-text-alt">Nome exibido para o primeiro registro do dia</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Nome Saída Almoço -->
|
||||
<div class="form-control">
|
||||
<label class="label" for="nome-saida-almoco">
|
||||
<span class="label-text font-medium">Nome do Registro de Saída para Almoço *</span>
|
||||
</label>
|
||||
<input
|
||||
id="nome-saida-almoco"
|
||||
type="text"
|
||||
bind:value={nomeSaidaAlmoco}
|
||||
placeholder="Ex: Saída 1"
|
||||
class="input input-bordered"
|
||||
/>
|
||||
<div class="label">
|
||||
<span class="label-text-alt">Nome exibido para a saída para almoço</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Nome Retorno Almoço -->
|
||||
<div class="form-control">
|
||||
<label class="label" for="nome-retorno-almoco">
|
||||
<span class="label-text font-medium">Nome do Registro de Retorno do Almoço *</span>
|
||||
</label>
|
||||
<input
|
||||
id="nome-retorno-almoco"
|
||||
type="text"
|
||||
bind:value={nomeRetornoAlmoco}
|
||||
placeholder="Ex: Entrada 2"
|
||||
class="input input-bordered"
|
||||
/>
|
||||
<div class="label">
|
||||
<span class="label-text-alt">Nome exibido para o retorno do almoço</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Nome Saída -->
|
||||
<div class="form-control">
|
||||
<label class="label" for="nome-saida">
|
||||
<span class="label-text font-medium">Nome do Registro de Saída *</span>
|
||||
</label>
|
||||
<input
|
||||
id="nome-saida"
|
||||
type="text"
|
||||
bind:value={nomeSaida}
|
||||
placeholder="Ex: Saída 2"
|
||||
class="input input-bordered"
|
||||
/>
|
||||
<div class="label">
|
||||
<span class="label-text-alt">Nome exibido para a saída final do dia</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Ações -->
|
||||
<div class="card-actions justify-end mt-6">
|
||||
<button
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
let portaNTP = $state(123);
|
||||
let usarServidorExterno = $state(false);
|
||||
let fallbackParaPC = $state(true);
|
||||
let gmtOffset = $state(0);
|
||||
let processando = $state(false);
|
||||
let testando = $state(false);
|
||||
let mensagem = $state<{ tipo: 'success' | 'error'; texto: string } | null>(null);
|
||||
@@ -20,6 +21,7 @@
|
||||
portaNTP = configQuery.data.portaNTP || 123;
|
||||
usarServidorExterno = configQuery.data.usarServidorExterno || false;
|
||||
fallbackParaPC = configQuery.data.fallbackParaPC !== undefined ? configQuery.data.fallbackParaPC : true;
|
||||
gmtOffset = configQuery.data.gmtOffset ?? 0;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -49,6 +51,7 @@
|
||||
portaNTP: usarServidorExterno ? portaNTP : undefined,
|
||||
usarServidorExterno,
|
||||
fallbackParaPC,
|
||||
gmtOffset,
|
||||
});
|
||||
|
||||
mostrarMensagem('success', 'Configuração salva com sucesso!');
|
||||
@@ -194,6 +197,35 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<!-- Ajuste de Fuso Horário (GMT) -->
|
||||
<h2 class="card-title mb-4">Ajuste de Fuso Horário (GMT)</h2>
|
||||
<p class="text-sm text-base-content/70 mb-4">
|
||||
Configure o fuso horário para ajustar o horário de registro. Use valores negativos para fusos a oeste de UTC e positivos para fusos a leste.
|
||||
</p>
|
||||
<div class="form-control">
|
||||
<label class="label" for="gmt-offset">
|
||||
<span class="label-text font-medium">GMT Offset (horas) *</span>
|
||||
</label>
|
||||
<select
|
||||
id="gmt-offset"
|
||||
bind:value={gmtOffset}
|
||||
class="select select-bordered"
|
||||
>
|
||||
{#each Array.from({ length: 49 }, (_, i) => i - 12) as offset}
|
||||
<option value={offset} selected={gmtOffset === offset}>
|
||||
GMT{offset >= 0 ? '+' : ''}{offset}{offset === -3 ? ' (Brasil - Brasília)' : offset === 0 ? ' (UTC)' : ''}
|
||||
</option>
|
||||
{/each}
|
||||
</select>
|
||||
<div class="label">
|
||||
<span class="label-text-alt"
|
||||
>Ajuste em horas em relação ao UTC. Exemplo: -3 para horário de Brasília (GMT-3)</span
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Ações -->
|
||||
<div class="card-actions justify-end mt-6 gap-3">
|
||||
{#if usarServidorExterno}
|
||||
|
||||
Reference in New Issue
Block a user