From 990d80e16dfa4f87761c89c2f30f54d253bd381c Mon Sep 17 00:00:00 2001 From: admin Date: Fri, 22 May 2026 12:27:07 +0700 Subject: [PATCH] =?UTF-8?q?690522:1227=20=E0=B8=9B=E0=B8=A3=E0=B8=B1?= =?UTF-8?q?=E0=B8=9A=E0=B8=9B=E0=B8=A3=E0=B8=B8=E0=B8=87=20Admin=20Panl=20?= =?UTF-8?q?#01?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/app/(admin)/admin/page.tsx | 135 +++++++++++++++--------- frontend/components/admin/sidebar.tsx | 146 +++++++++++++++++--------- 2 files changed, 179 insertions(+), 102 deletions(-) diff --git a/frontend/app/(admin)/admin/page.tsx b/frontend/app/(admin)/admin/page.tsx index 60325fb5..fb3b766c 100644 --- a/frontend/app/(admin)/admin/page.tsx +++ b/frontend/app/(admin)/admin/page.tsx @@ -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() {

Admin Dashboard

-

System overview and quick access to administrative functions.

+

ภาพรวมระบบและเมนูลัดสำหรับงานบริหารจัดการ

{stats.map((stat) => ( - {stat.title} - +
+ {stat.title} +

{stat.subtitle}

+
+
+ +
{stat.loading ? ( @@ -100,7 +129,7 @@ export default function AdminPage() { )} {stat.href && ( - View details + ดูรายละเอียด )} @@ -109,21 +138,25 @@ export default function AdminPage() {
-

Quick Access

+

เมนูหลัก

+

เลือกกลุ่มงานที่ต้องการจัดการ

- {quickLinks.map((link) => ( - - - - - - {link.title} + {groups.map((group) => ( + + + + + + + {group.label} + {group.sublabel} + -

{link.description}

-
diff --git a/frontend/components/admin/sidebar.tsx b/frontend/components/admin/sidebar.tsx index b5fc83af..cf0754f9 100644 --- a/frontend/components/admin/sidebar.tsx +++ b/frontend/components/admin/sidebar.tsx @@ -4,66 +4,90 @@ import Link from 'next/link'; import { usePathname } from 'next/navigation'; import { useState } from 'react'; import { cn } from '@/lib/utils'; -import { Settings, Activity, Shield, FileStack, ChevronDown, ChevronRight, Database, Brain } from 'lucide-react'; +import { + Settings, + Activity, + Shield, + ChevronDown, + ChevronRight, + Brain, + FolderOpen, + BookOpen, + Ruler, +} from 'lucide-react'; + +interface MenuChild { + href: string; + label: string; +} interface MenuItem { href?: string; label: string; + sublabel?: string; icon: React.ComponentType<{ className?: string }>; - children?: { href: string; label: string }[]; + children?: MenuChild[]; } export const menuItems: MenuItem[] = [ { - label: 'Access Control', + label: 'ผู้ใช้งาน & การเข้าถึง', + sublabel: 'Identity & Access', icon: Shield, children: [ - { href: '/admin/access-control/users', label: 'Users' }, - { href: '/admin/access-control/roles', label: 'Roles' }, - { href: '/admin/access-control/organizations', label: 'Organizations' }, + { href: '/admin/access-control/users', label: 'ผู้ใช้งาน' }, + { href: '/admin/access-control/roles', label: 'บทบาท & สิทธิ์' }, + { href: '/admin/access-control/organizations', label: 'องค์กร' }, ], }, { - label: 'Document Control', - icon: FileStack, + label: 'ตั้งค่าโครงการ', + sublabel: 'Project Setup', + icon: FolderOpen, children: [ - { href: '/admin/doc-control/projects', label: 'Projects' }, - { href: '/admin/doc-control/contracts', label: 'Contracts' }, - { href: '/admin/doc-control/numbering', label: 'Numbering' }, - { href: '/admin/doc-control/reference', label: 'Reference Data' }, - { href: '/admin/doc-control/workflows', label: 'Workflows' }, + { href: '/admin/doc-control/projects', label: 'โครงการ' }, + { href: '/admin/doc-control/contracts', label: 'สัญญา' }, + { href: '/admin/doc-control/numbering', label: 'รูปแบบเลขที่' }, + { href: '/admin/doc-control/workflows', label: 'เวิร์กโฟลว์' }, ], }, { - label: 'Drawing Master', - icon: FileStack, // Or another icon + label: 'ข้อมูลอ้างอิง', + sublabel: 'Reference Data', + icon: BookOpen, children: [ - { href: '/admin/doc-control/drawings/contract/volumes', label: 'Contract: Volumes' }, - { href: '/admin/doc-control/drawings/contract/categories', label: 'Contract: Categories' }, - { href: '/admin/doc-control/drawings/contract/sub-categories', label: 'Contract: Sub-categories' }, - { href: '/admin/doc-control/drawings/shop/main-categories', label: 'Shop: Main Categories' }, - { href: '/admin/doc-control/drawings/shop/sub-categories', label: 'Shop: Sub-categories' }, + { href: '/admin/doc-control/reference/disciplines', label: 'สาขาวิชาชีพ' }, + { href: '/admin/doc-control/reference/rfa-types', label: 'ประเภท RFA' }, + { href: '/admin/doc-control/reference/correspondence-types', label: 'ประเภทหนังสือ' }, + { href: '/admin/doc-control/reference/tags', label: 'แท็ก' }, ], }, { - label: 'Monitoring', + label: 'ข้อมูลแบบ Drawing', + sublabel: 'Drawing Master', + icon: Ruler, + children: [ + { href: '/admin/doc-control/drawings/contract/volumes', label: 'สัญญา: Volume' }, + { href: '/admin/doc-control/drawings/contract/categories', label: 'สัญญา: หมวดหมู่' }, + { href: '/admin/doc-control/drawings/contract/sub-categories', label: 'สัญญา: หมวดหมู่ย่อย' }, + { href: '/admin/doc-control/drawings/shop/main-categories', label: 'Shop: หมวดหมู่หลัก' }, + { href: '/admin/doc-control/drawings/shop/sub-categories', label: 'Shop: หมวดหมู่ย่อย' }, + ], + }, + { + label: 'การปฏิบัติการ', + sublabel: 'Operations', icon: Activity, children: [ - { href: '/admin/monitoring/audit-logs', label: 'Audit Logs' }, - { href: '/admin/monitoring/system-logs/numbering', label: 'System Logs' }, - { href: '/admin/monitoring/sessions', label: 'Active Sessions' }, - ], - }, - { - label: 'Migration', - icon: Database, - children: [ - { href: '/admin/migration', label: 'Review Queue' }, - { href: '/admin/migration/errors', label: 'Error Logs' }, + { href: '/admin/monitoring/audit-logs', label: 'บันทึกการตรวจสอบ' }, + { href: '/admin/monitoring/system-logs/numbering', label: 'บันทึกระบบ' }, + { href: '/admin/monitoring/sessions', label: 'เซสชันที่ใช้งาน' }, + { href: '/admin/migration', label: 'คิวนำเข้าข้อมูล' }, + { href: '/admin/migration/errors', label: 'บันทึกข้อผิดพลาด' }, ], }, { href: '/admin/ai', label: 'AI Console', icon: Brain }, - { href: '/admin/settings', label: 'Settings', icon: Settings }, + { href: '/admin/settings', label: 'ตั้งค่าระบบ', sublabel: 'Settings', icon: Settings }, ]; export function AdminSidebar() { @@ -100,21 +124,26 @@ export function AdminSidebar() { {isExpanded && ( -
+
{item.children.map((child) => { const isActive = pathname === child.href; return ( @@ -145,14 +174,19 @@ export function AdminSidebar() { key={item.href} href={item.href!} className={cn( - 'flex items-center gap-3 px-3 py-2 rounded-lg transition-colors text-sm font-medium', + 'flex items-center gap-3 px-3 py-2 rounded-lg transition-colors', isActive ? 'bg-primary text-primary-foreground shadow-sm' : 'text-muted-foreground hover:bg-muted hover:text-foreground' )} > - - {item.label} + + + {item.label} + {item.sublabel && ( + {item.sublabel} + )} + ); })} @@ -212,21 +246,26 @@ export function AdminMobileSidebar() { {isExpanded && ( -
+
{item.children.map((child) => { const isActive = pathname === child.href; return ( @@ -258,14 +297,19 @@ export function AdminMobileSidebar() { href={item.href!} onClick={() => setOpen(false)} className={cn( - 'flex items-center gap-3 px-3 py-2 rounded-lg transition-colors text-sm font-medium', + 'flex items-center gap-3 px-3 py-2 rounded-lg transition-colors', isActive ? 'bg-primary text-primary-foreground shadow-sm' : 'text-muted-foreground hover:bg-muted hover:text-foreground' )} > - - {item.label} + + + {item.label} + {item.sublabel && ( + {item.sublabel} + )} + ); })}