"use client" import { useState } from "react" import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card" import { Badge } from "@/components/ui/badge" import { Button } from "@/components/ui/button" import { Input } from "@/components/ui/input" import { Label } from "@/components/ui/label" import { Textarea } from "@/components/ui/textarea" import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select" import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs" import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from "@/components/ui/dialog" import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table" import { Avatar, AvatarFallback } from "@/components/ui/avatar" import { Switch } from "@/components/ui/switch" import { Users, Settings, Target, MessageSquare, Plus, Edit, Trash2, Shield, Database, Bell } from "lucide-react" // Mock data with colors const users = [ { id: 1, name: "陳雅雯", email: "sarah.chen@company.com", role: "executive", status: "active", lastLogin: "2024-02-10", department: "業務部", position: "業務副總", color: "emerald", }, { id: 2, name: "王志明", email: "mike.wang@company.com", role: "manager", status: "active", lastLogin: "2024-02-09", department: "技術部", position: "技術長", color: "blue", }, { id: 3, name: "李美玲", email: "lisa.lee@company.com", role: "executive", status: "inactive", lastLogin: "2024-01-28", department: "行銷部", position: "行銷長", color: "purple", }, { id: 4, name: "張建國", email: "john.chang@company.com", role: "manager", status: "active", lastLogin: "2024-02-08", department: "研發部", position: "研發總監", color: "orange", }, ] const kpiTemplates = [ { id: 1, name: "營收成長率", category: "財務", defaultWeight: 30, isActive: true, usageCount: 15, color: "emerald" }, { id: 2, name: "團隊滿意度", category: "團隊", defaultWeight: 25, isActive: true, usageCount: 12, color: "blue" }, { id: 3, name: "市場佔有率", category: "營運", defaultWeight: 20, isActive: true, usageCount: 8, color: "purple" }, { id: 4, name: "創新指數", category: "創新", defaultWeight: 25, isActive: false, usageCount: 3, color: "orange" }, { id: 5, name: "客戶滿意度", category: "營運", defaultWeight: 20, isActive: true, usageCount: 10, color: "cyan" }, { id: 6, name: "成本控制率", category: "財務", defaultWeight: 15, isActive: true, usageCount: 6, color: "red" }, ] const questionTemplates = [ { id: 1, question: "您如何評價本季度的整體表現?", type: "評分", category: "績效", isRequired: true, color: "blue" }, { id: 2, question: "本期間您的主要成就是什麼?", type: "文字", category: "績效", isRequired: true, color: "emerald" }, { id: 3, question: "您面臨了哪些挑戰,如何克服?", type: "文字", category: "挑戰", isRequired: false, color: "yellow", }, { id: 4, question: "您如何有效領導團隊?", type: "評分", category: "領導力", isRequired: true, color: "purple" }, { id: 5, question: "下一季度的目標是什麼?", type: "文字", category: "目標", isRequired: true, color: "orange" }, ] const systemSettings = [ { id: 1, name: "自動提醒", description: "自動發送審查提醒通知", enabled: true, category: "通知" }, { id: 2, name: "郵件通知", description: "透過郵件發送系統通知", enabled: true, category: "通知" }, { id: 3, name: "資料備份", description: "每日自動備份系統資料", enabled: true, category: "安全" }, { id: 4, name: "雙重驗證", description: "要求使用者啟用雙重驗證", enabled: false, category: "安全" }, { id: 5, name: "審計日誌", description: "記錄所有系統操作日誌", enabled: true, category: "安全" }, ] export default function AdminPanel() { const [activeTab, setActiveTab] = useState("users") const [isDialogOpen, setIsDialogOpen] = useState(false) const [dialogType, setDialogType] = useState("") const handleOpenDialog = (type: string) => { setDialogType(type) setIsDialogOpen(true) } const adminStats = { totalUsers: users.length, activeUsers: users.filter((u) => u.status === "active").length, totalKPIs: kpiTemplates.length, activeKPIs: kpiTemplates.filter((k) => k.isActive).length, totalQuestions: questionTemplates.length, requiredQuestions: questionTemplates.filter((q) => q.isRequired).length, } return (
用戶、模板與系統設定管理
{question.question}
{setting.description}