- Replaced references to "Solicitar Acesso" with "Abrir Chamado" across the application for consistency in terminology. - Updated routing logic to reflect the new ticket management flow, ensuring that the dashboard and sidebar components point to the correct paths. - Removed the obsolete "Solicitar Acesso" page, streamlining the user experience and reducing unnecessary navigation options. - Enhanced backend schema to support new ticket functionalities, including ticket creation and management.
65 lines
2.7 KiB
Svelte
65 lines
2.7 KiB
Svelte
<script lang="ts">
|
|
import { page } from '$app/state';
|
|
import ActionGuard from '$lib/components/ActionGuard.svelte';
|
|
import { Toaster } from 'svelte-sonner';
|
|
import PushNotificationManager from '$lib/components/PushNotificationManager.svelte';
|
|
const { children } = $props();
|
|
|
|
// Resolver recurso/ação a partir da rota
|
|
const routeAction = $derived.by(() => {
|
|
const p = page.url.pathname;
|
|
if (p === '/' || p === '/abrir-chamado') return null;
|
|
|
|
// Funcionários
|
|
if (p.startsWith('/recursos-humanos/funcionarios')) {
|
|
if (p.includes('/cadastro')) return { recurso: 'funcionarios', acao: 'criar' };
|
|
if (p.includes('/excluir')) return { recurso: 'funcionarios', acao: 'excluir' };
|
|
if (p.includes('/editar') || p.includes('/funcionarioId'))
|
|
return { recurso: 'funcionarios', acao: 'editar' };
|
|
return { recurso: 'funcionarios', acao: 'listar' };
|
|
}
|
|
|
|
// Símbolos
|
|
if (p.startsWith('/recursos-humanos/simbolos')) {
|
|
if (p.includes('/cadastro')) return { recurso: 'simbolos', acao: 'criar' };
|
|
if (p.includes('/excluir')) return { recurso: 'simbolos', acao: 'excluir' };
|
|
if (p.includes('/editar') || p.includes('/simboloId'))
|
|
return { recurso: 'simbolos', acao: 'editar' };
|
|
return { recurso: 'simbolos', acao: 'listar' };
|
|
}
|
|
|
|
// Outras áreas (uso genérico: ver)
|
|
if (p.startsWith('/financeiro')) return { recurso: 'financeiro', acao: 'ver' };
|
|
if (p.startsWith('/controladoria')) return { recurso: 'controladoria', acao: 'ver' };
|
|
if (p.startsWith('/licitacoes')) return { recurso: 'licitacoes', acao: 'ver' };
|
|
if (p.startsWith('/compras')) return { recurso: 'compras', acao: 'ver' };
|
|
if (p.startsWith('/juridico')) return { recurso: 'juridico', acao: 'ver' };
|
|
if (p.startsWith('/comunicacao')) return { recurso: 'comunicacao', acao: 'ver' };
|
|
if (p.startsWith('/programas-esportivos'))
|
|
return { recurso: 'programas_esportivos', acao: 'ver' };
|
|
if (p.startsWith('/secretaria-executiva'))
|
|
return { recurso: 'secretaria_executiva', acao: 'ver' };
|
|
if (p.startsWith('/gestao-pessoas')) return { recurso: 'gestao_pessoas', acao: 'ver' };
|
|
|
|
return null;
|
|
});
|
|
</script>
|
|
|
|
{#if routeAction}
|
|
<ActionGuard recurso={routeAction.recurso} acao={routeAction.acao}>
|
|
<main id="container-central" class="w-full max-w-none px-3 py-4 lg:px-4">
|
|
{@render children()}
|
|
</main>
|
|
</ActionGuard>
|
|
{:else}
|
|
<main id="container-central" class="w-full max-w-none px-3 py-4 lg:px-4">
|
|
{@render children()}
|
|
</main>
|
|
{/if}
|
|
|
|
<!-- Toast Notifications (Sonner) -->
|
|
<Toaster position="top-right" richColors closeButton expand={true} />
|
|
|
|
<!-- Push Notification Manager (registra subscription automaticamente) -->
|
|
<PushNotificationManager />
|