diff --git a/apps/web/src/lib/components/ErrorModal.svelte b/apps/web/src/lib/components/ErrorModal.svelte index c7de436..8367d76 100644 --- a/apps/web/src/lib/components/ErrorModal.svelte +++ b/apps/web/src/lib/components/ErrorModal.svelte @@ -23,38 +23,41 @@ details.match(/^\d+\./); // Começa com número (lista numerada) }); - let modalRef: HTMLDialogElement; - function handleClose() { open = false; onClose(); } - - $effect(() => { - if (open && modalRef) { - modalRef.showModal(); - } else if (!open && modalRef) { - modalRef.close(); - } - }); {#if open} - e.target === e.currentTarget && handleClose()} + + {/if} + + diff --git a/apps/web/src/lib/components/ponto/RegistroPonto.svelte b/apps/web/src/lib/components/ponto/RegistroPonto.svelte index b6c3432..c084e8c 100644 --- a/apps/web/src/lib/components/ponto/RegistroPonto.svelte +++ b/apps/web/src/lib/components/ponto/RegistroPonto.svelte @@ -13,7 +13,7 @@ getTipoRegistroLabel, getProximoTipoRegistro } from '$lib/utils/ponto'; - import { LogIn, LogOut, Clock, CheckCircle2, XCircle, TrendingUp, TrendingDown, Printer } from 'lucide-svelte'; + import { LogIn, LogOut, Clock, CheckCircle2, XCircle, TrendingUp, TrendingDown, Printer, Camera } from 'lucide-svelte'; import type { Id } from '@sgse-app/backend/convex/_generated/dataModel'; import jsPDF from 'jspdf'; import logoGovPE from '$lib/assets/logo_governo_PE.png'; @@ -64,6 +64,7 @@ let justificativa = $state(''); let mostrandoModalConfirmacao = $state(false); let dataHoraAtual = $state<{ data: string; hora: string } | null>(null); + let aguardandoProcessamento = $state(false); const registrosHoje = $derived(registrosHojeQuery?.data || []); const config = $derived(configQuery?.data); @@ -312,6 +313,7 @@ }, 1000); } catch (error) { console.error('Erro ao registrar ponto:', error); + aguardandoProcessamento = false; let mensagemErro = 'Erro desconhecido ao registrar ponto'; let detalhesErro = 'Tente novamente em alguns instantes.'; @@ -389,6 +391,7 @@ } finally { registrando = false; coletandoInfo = false; + aguardandoProcessamento = false; } } @@ -514,6 +517,7 @@ function confirmarRegistro() { mostrandoModalConfirmacao = false; + aguardandoProcessamento = true; registrarPonto(); } @@ -753,25 +757,7 @@ return !registrando && !coletandoInfo && config !== undefined && !estaDispensado && temFuncionarioAssociado; }); - // Referência para o modal - let modalRef: HTMLDivElement | null = $state(null); - - // Efeito para garantir que o modal fique visível quando abrir - $effect(() => { - if (mostrandoWebcam && modalRef) { - // Aguardar um frame para garantir que o DOM foi atualizado - setTimeout(() => { - if (modalRef) { - modalRef.scrollIntoView({ behavior: 'smooth', block: 'center' }); - // Também garantir que o modal-box esteja visível - const modalBox = modalRef.querySelector('.modal-box'); - if (modalBox) { - (modalBox as HTMLElement).scrollIntoView({ behavior: 'smooth', block: 'center' }); - } - } - }, 100); - } - }); + // Os modais agora são centralizados automaticamente via CSS (fixed inset-0 flex items-center justify-center) // Solicitar permissões automaticamente ao montar o componente onMount(async () => { @@ -922,71 +908,95 @@ {/if} - -
-
-

Registrar Ponto

-
- + +
+
+ +
+
+ +
+

Registrar Ponto

-
- {#if sucesso} -
- - {sucesso} -
- {/if} -
-

Próximo registro: {tipoLabel}

+ +
+
+
+
- -
- - -
- - + {:else if !temFuncionarioAssociado} + + Funcionário Não Associado + {:else if estaDispensado} + + Registro Indisponível + {:else if proximoTipo === 'entrada' || proximoTipo === 'retorno_almoco'} + + Registrar Entrada + {:else} + + Registrar Saída + {/if} + + + +
+ + +
+ + + {#if sucesso} +
+ + {sucesso} +
+ {/if} + + +
+
+
+ {#if proximoTipo === 'entrada' || proximoTipo === 'retorno_almoco'} + + {:else} + + {/if} +
+
+

Próximo Registro

+

{tipoLabel}

+
+
@@ -1320,49 +1330,111 @@ {#if mostrandoWebcam}