fix/permisos-custom-broker (#486)
permisos marcaba error de permisos aunque si los tuviera, solo era visual y mal consulta de roles Reviewed-on: ADUANASOFT/anexo76#486 Co-authored-by: hreyes <hreyes@aduanasoft.com.mx> Co-committed-by: hreyes <hreyes@aduanasoft.com.mx>
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
import { Button } from '$lib/components/ui/button';
|
||||
import { Input } from '$lib/components/ui/input';
|
||||
import { Label } from '$lib/components/ui/label';
|
||||
import { Plus, RefreshCw, Building2, MapPin, Mail, Phone, FileText, Hash } from 'lucide-svelte';
|
||||
import { Plus, RefreshCw, Building2, MapPin, Mail, Phone, FileText, Hash, LoaderCircle } from 'lucide-svelte';
|
||||
import * as Tabs from '$lib/components/ui/tabs';
|
||||
import { toast } from 'svelte-sonner';
|
||||
import { companyStore } from '$lib/stores/company.svelte';
|
||||
@@ -14,7 +14,7 @@
|
||||
import { page } from '$app/stores';
|
||||
import { useShortcuts } from '$lib/hooks/use-shortcuts';
|
||||
import { obtenerAtajosListaAgentes } from '$lib/config/shortcuts/dashboard/customs_brokers/list';
|
||||
import { currentUser } from '$lib/auth';
|
||||
import { currentUser, permissionsHydrated } from '$lib/auth';
|
||||
import {
|
||||
canViewCustomsBrokers,
|
||||
canCreateCustomsBrokers,
|
||||
@@ -236,7 +236,14 @@
|
||||
const brokerColumns = createBrokerColumns(handleActionSuccess);
|
||||
</script>
|
||||
|
||||
{#if !canViewBrokerList}
|
||||
{#if !$permissionsHydrated}
|
||||
<div
|
||||
class="flex h-[calc(100svh-4rem)] flex-col items-center justify-center gap-3 p-6 text-muted-foreground group-has-data-[collapsible=icon]/sidebar-wrapper:h-[calc(100svh-3rem)]"
|
||||
>
|
||||
<LoaderCircle class="h-8 w-8 animate-spin text-primary" />
|
||||
<p class="text-sm">Verificando permisos…</p>
|
||||
</div>
|
||||
{:else if !canViewBrokerList}
|
||||
<div
|
||||
class="flex h-[calc(100svh-4rem)] flex-col p-6 group-has-data-[collapsible=icon]/sidebar-wrapper:h-[calc(100svh-3rem)]"
|
||||
>
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
import { Input } from '$lib/components/ui/input';
|
||||
import { page } from '$app/stores';
|
||||
import { browser } from '$app/environment';
|
||||
import { RefreshCw, Plus } from 'lucide-svelte';
|
||||
import { RefreshCw, Plus, LoaderCircle } from 'lucide-svelte';
|
||||
import { useShortcuts } from '$lib/hooks/use-shortcuts';
|
||||
import type { PageData } from './$types';
|
||||
import { currentUser } from '$lib/auth';
|
||||
import { currentUser, permissionsHydrated } from '$lib/auth';
|
||||
import { userHasCustomsSectionsRefAction } from '$lib/permissions/reference-data/customs-sections-ref-permissions';
|
||||
import ErrorState from '$lib/components/dashboard/common/error-state.svelte';
|
||||
|
||||
@@ -124,7 +124,12 @@
|
||||
<div
|
||||
class="flex h-[calc(100svh-4rem)] flex-col gap-6 overflow-hidden p-6 group-has-data-[collapsible=icon]/sidebar-wrapper:h-[calc(100svh-3rem)]"
|
||||
>
|
||||
{#if !canView || isError}
|
||||
{#if !$permissionsHydrated}
|
||||
<div class="flex flex-1 flex-col items-center justify-center gap-3 text-muted-foreground">
|
||||
<LoaderCircle class="h-8 w-8 animate-spin text-primary" />
|
||||
<p class="text-sm">Verificando permisos…</p>
|
||||
</div>
|
||||
{:else if !canView || isError}
|
||||
<ErrorState
|
||||
status={!canView ? 403 : status}
|
||||
error={!canView ? "ref_customs_sections.view" : (error || "")}
|
||||
|
||||
Reference in New Issue
Block a user