690522:1227 ปรับปรุง Admin Panl #01
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
import { useOrganizations } from '@/hooks/use-master-data';
|
||||
import { useUsers } from '@/hooks/use-users';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { Users, Building2, FileText, Settings, Shield, Activity, ArrowRight, FileStack } from 'lucide-react';
|
||||
import { Users, Building2, Activity, ArrowRight, Shield, FolderOpen, BookOpen, Ruler, Brain } from 'lucide-react';
|
||||
import Link from 'next/link';
|
||||
import { Skeleton } from '@/components/ui/skeleton';
|
||||
import { Button } from '@/components/ui/button';
|
||||
@@ -14,67 +14,91 @@ export default function AdminPage() {
|
||||
|
||||
const stats = [
|
||||
{
|
||||
title: 'Total Users',
|
||||
title: 'ผู้ใช้งานทั้งหมด',
|
||||
subtitle: 'Total Users',
|
||||
value: users?.length || 0,
|
||||
icon: Users,
|
||||
loading: usersLoading,
|
||||
href: '/admin/access-control/users',
|
||||
color: 'text-blue-600',
|
||||
bg: 'bg-blue-50 dark:bg-blue-950/30',
|
||||
},
|
||||
{
|
||||
title: 'Organizations',
|
||||
title: 'องค์กร',
|
||||
subtitle: 'Organizations',
|
||||
value: organizations?.length || 0,
|
||||
icon: Building2,
|
||||
loading: orgsLoading,
|
||||
href: '/admin/access-control/organizations',
|
||||
color: 'text-green-600',
|
||||
color: 'text-emerald-600',
|
||||
bg: 'bg-emerald-50 dark:bg-emerald-950/30',
|
||||
},
|
||||
{
|
||||
title: 'System Logs',
|
||||
value: 'View',
|
||||
title: 'บันทึกการปฏิบัติการ',
|
||||
subtitle: 'Operations Log',
|
||||
value: 'ดูทั้งหมด',
|
||||
icon: Activity,
|
||||
loading: false,
|
||||
href: '/admin/monitoring/system-logs',
|
||||
href: '/admin/monitoring/audit-logs',
|
||||
color: 'text-orange-600',
|
||||
bg: 'bg-orange-50 dark:bg-orange-950/30',
|
||||
},
|
||||
];
|
||||
|
||||
const quickLinks = [
|
||||
const groups = [
|
||||
{
|
||||
title: 'User Management',
|
||||
description: 'Manage system users, roles, and permissions',
|
||||
label: 'ผู้ใช้งาน & การเข้าถึง',
|
||||
sublabel: 'Identity & Access',
|
||||
href: '/admin/access-control/users',
|
||||
icon: Users,
|
||||
},
|
||||
{
|
||||
title: 'Organizations',
|
||||
description: 'Manage project organizations and companies',
|
||||
href: '/admin/access-control/organizations',
|
||||
icon: Building2,
|
||||
},
|
||||
{
|
||||
title: 'Workflow Config',
|
||||
description: 'Configure document approval workflows',
|
||||
href: '/admin/doc-control/workflows',
|
||||
icon: FileText,
|
||||
},
|
||||
{
|
||||
title: 'Security & RBAC',
|
||||
description: 'Configure roles, permissions, and security settings',
|
||||
href: '/admin/access-control/roles',
|
||||
icon: Shield,
|
||||
color: 'text-blue-600',
|
||||
hoverBorder: 'hover:border-l-blue-500',
|
||||
description: 'จัดการผู้ใช้, บทบาท, สิทธิ์ และองค์กรในระบบ',
|
||||
},
|
||||
{
|
||||
title: 'Numbering System',
|
||||
description: 'Setup document numbering templates',
|
||||
href: '/admin/doc-control/numbering',
|
||||
icon: Settings,
|
||||
label: 'ตั้งค่าโครงการ',
|
||||
sublabel: 'Project Setup',
|
||||
href: '/admin/doc-control/projects',
|
||||
icon: FolderOpen,
|
||||
color: 'text-violet-600',
|
||||
hoverBorder: 'hover:border-l-violet-500',
|
||||
description: 'โครงการ, สัญญา, รูปแบบเลขที่เอกสาร และ Workflow',
|
||||
},
|
||||
{
|
||||
title: 'Drawing Master Data',
|
||||
description: 'Manage drawing categories, volumes, and classifications',
|
||||
href: '/admin/doc-control/drawings',
|
||||
icon: FileStack,
|
||||
label: 'ข้อมูลอ้างอิง',
|
||||
sublabel: 'Reference Data',
|
||||
href: '/admin/doc-control/reference/disciplines',
|
||||
icon: BookOpen,
|
||||
color: 'text-teal-600',
|
||||
hoverBorder: 'hover:border-l-teal-500',
|
||||
description: 'สาขาวิชาชีพ, ประเภท RFA, ประเภทหนังสือ และแท็ก',
|
||||
},
|
||||
{
|
||||
label: 'ข้อมูลแบบ Drawing',
|
||||
sublabel: 'Drawing Master',
|
||||
href: '/admin/doc-control/drawings/contract/volumes',
|
||||
icon: Ruler,
|
||||
color: 'text-amber-600',
|
||||
hoverBorder: 'hover:border-l-amber-500',
|
||||
description: 'Volume, หมวดหมู่ และหมวดหมู่ย่อย สำหรับ Contract & Shop Drawing',
|
||||
},
|
||||
{
|
||||
label: 'การปฏิบัติการ',
|
||||
sublabel: 'Operations',
|
||||
href: '/admin/monitoring/audit-logs',
|
||||
icon: Activity,
|
||||
color: 'text-rose-600',
|
||||
hoverBorder: 'hover:border-l-rose-500',
|
||||
description: 'Audit Log, System Log, Active Sessions และ Migration Queue',
|
||||
},
|
||||
{
|
||||
label: 'AI Console',
|
||||
sublabel: 'AI Intelligence',
|
||||
href: '/admin/ai',
|
||||
icon: Brain,
|
||||
color: 'text-purple-600',
|
||||
hoverBorder: 'hover:border-l-purple-500',
|
||||
description: 'ตรวจสอบ AI Queue, Analytics และ Threshold Recalibration',
|
||||
},
|
||||
];
|
||||
|
||||
@@ -82,15 +106,20 @@ export default function AdminPage() {
|
||||
<div className="space-y-8 p-8">
|
||||
<div>
|
||||
<h1 className="text-3xl font-bold tracking-tight">Admin Dashboard</h1>
|
||||
<p className="text-muted-foreground mt-2">System overview and quick access to administrative functions.</p>
|
||||
<p className="text-muted-foreground mt-1">ภาพรวมระบบและเมนูลัดสำหรับงานบริหารจัดการ</p>
|
||||
</div>
|
||||
|
||||
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-3">
|
||||
{stats.map((stat) => (
|
||||
<Card key={stat.title} className="hover:shadow-md transition-shadow">
|
||||
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
|
||||
<CardTitle className="text-sm font-medium">{stat.title}</CardTitle>
|
||||
<stat.icon className={`h-4 w-4 ${stat.color}`} />
|
||||
<div>
|
||||
<CardTitle className="text-sm font-medium">{stat.title}</CardTitle>
|
||||
<p className="text-xs text-muted-foreground">{stat.subtitle}</p>
|
||||
</div>
|
||||
<div className={`p-2 rounded-lg ${stat.bg}`}>
|
||||
<stat.icon className={`h-4 w-4 ${stat.color}`} />
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
{stat.loading ? (
|
||||
@@ -100,7 +129,7 @@ export default function AdminPage() {
|
||||
)}
|
||||
{stat.href && (
|
||||
<Link href={stat.href} className="text-xs text-muted-foreground hover:underline mt-1 inline-block">
|
||||
View details
|
||||
ดูรายละเอียด
|
||||
</Link>
|
||||
)}
|
||||
</CardContent>
|
||||
@@ -109,21 +138,25 @@ export default function AdminPage() {
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h2 className="text-xl font-semibold mb-4">Quick Access</h2>
|
||||
<h2 className="text-xl font-semibold mb-1">เมนูหลัก</h2>
|
||||
<p className="text-sm text-muted-foreground mb-4">เลือกกลุ่มงานที่ต้องการจัดการ</p>
|
||||
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-3">
|
||||
{quickLinks.map((link) => (
|
||||
<Link key={link.href} href={link.href}>
|
||||
<Card className="h-full hover:bg-muted/50 transition-colors cursor-pointer border-l-4 border-l-transparent hover:border-l-primary">
|
||||
<CardHeader>
|
||||
<CardTitle className="flex items-center text-lg">
|
||||
<link.icon className="mr-2 h-5 w-5 text-primary" />
|
||||
{link.title}
|
||||
{groups.map((group) => (
|
||||
<Link key={group.href} href={group.href}>
|
||||
<Card className={`h-full hover:bg-muted/50 transition-colors cursor-pointer border-l-4 border-l-transparent ${group.hoverBorder}`}>
|
||||
<CardHeader className="pb-2">
|
||||
<CardTitle className="flex items-center gap-2">
|
||||
<group.icon className={`h-5 w-5 ${group.color}`} />
|
||||
<span className="flex flex-col">
|
||||
<span className="text-base font-semibold leading-tight">{group.label}</span>
|
||||
<span className="text-xs font-normal text-muted-foreground leading-tight">{group.sublabel}</span>
|
||||
</span>
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<p className="text-sm text-muted-foreground">{link.description}</p>
|
||||
<Button variant="ghost" className="mt-4 p-0 h-auto font-normal text-primary hover:no-underline group">
|
||||
Go to module <ArrowRight className="ml-1 h-3 w-3 group-hover:translate-x-1 transition-transform" />
|
||||
<p className="text-sm text-muted-foreground">{group.description}</p>
|
||||
<Button variant="ghost" className="mt-3 p-0 h-auto font-normal text-primary hover:no-underline group/btn">
|
||||
เข้าสู่เมนู <ArrowRight className="ml-1 h-3 w-3 group-hover/btn:translate-x-1 transition-transform" />
|
||||
</Button>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
Reference in New Issue
Block a user