feat: multi-tenant SaaS implementation - admin interface, tenant isolation, and UI updates
This commit is contained in:
@@ -12,7 +12,8 @@ const props = defineProps({
|
||||
|
||||
const page = usePage();
|
||||
const user = computed(() => page.props.auth.user);
|
||||
const layout = computed(() => user.value?.role === 'admin' ? AdminLayout : AuthenticatedLayout);
|
||||
const isAdmin = computed(() => ['admin', 'super_admin'].includes(user.value?.role));
|
||||
const layout = computed(() => isAdmin.value ? AdminLayout : AuthenticatedLayout);
|
||||
|
||||
const getStatusColor = (status) => {
|
||||
const colors = {
|
||||
@@ -30,12 +31,20 @@ const getStatusColor = (status) => {
|
||||
|
||||
<component :is="layout">
|
||||
<template #header>
|
||||
<h2 class="text-xl font-semibold leading-tight capitalize">
|
||||
Tableau de bord {{ user.role }}
|
||||
</h2>
|
||||
<div class="flex items-center gap-3">
|
||||
<h2 class="text-xl font-semibold leading-tight capitalize">
|
||||
Tableau de bord
|
||||
</h2>
|
||||
<span v-if="user.role === 'super_admin'" class="bg-gradient-to-r from-red-600 to-orange-500 text-white px-3 py-1 rounded-full text-[10px] font-black tracking-widest uppercase shadow-sm">
|
||||
GOD MODE
|
||||
</span>
|
||||
<span v-else-if="user.tenant" class="bg-indigo-100 text-indigo-700 dark:bg-indigo-900/50 dark:text-indigo-400 border border-indigo-200 dark:border-indigo-800 px-3 py-1 rounded-full text-[10px] font-black tracking-widest uppercase">
|
||||
Structure : {{ user.tenant.name }}
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div v-if="user.role === 'admin'" class="p-8 space-y-8">
|
||||
<div v-if="isAdmin" class="p-8 space-y-8">
|
||||
<!-- KPI Cards -->
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
|
||||
<div class="bg-white dark:bg-slate-800 p-6 rounded-3xl shadow-sm border border-slate-200 dark:border-slate-700 hover:shadow-xl transition-all duration-300">
|
||||
|
||||
Reference in New Issue
Block a user