Files
ExecuBoard/app/reviews/page.tsx
2025-08-01 00:55:05 +08:00

622 lines
34 KiB
TypeScript

"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 { Calendar, Clock, User, Star, Plus, Edit, CheckCircle, AlertTriangle } from "lucide-react"
// Mock reviews data
const reviewsData = [
{
id: 1,
reviewee: "陳雅雯",
reviewer: "執行長",
type: "quarterly",
scheduledDate: "2024-02-15",
status: "scheduled",
priority: "high",
department: "業務部",
position: "業務副總",
lastReview: "2023-11-15",
overallRating: null,
color: "red",
},
{
id: 2,
reviewee: "王志明",
reviewer: "執行長",
type: "one_on_one",
scheduledDate: "2024-02-18",
status: "in_progress",
priority: "medium",
department: "技術部",
position: "技術長",
lastReview: "2024-01-18",
overallRating: null,
color: "yellow",
},
{
id: 3,
reviewee: "李美玲",
reviewer: "執行長",
type: "annual",
scheduledDate: "2024-02-20",
status: "completed",
priority: "high",
department: "行銷部",
position: "行銷長",
lastReview: "2023-02-20",
overallRating: 4,
color: "green",
},
{
id: 4,
reviewee: "張建國",
reviewer: "執行長",
type: "goal_setting",
scheduledDate: "2024-02-25",
status: "scheduled",
priority: "medium",
department: "研發部",
position: "研發總監",
lastReview: "2023-12-25",
overallRating: null,
color: "blue",
},
]
const reviewQuestions = [
{ id: 1, question: "您如何評價本季度的整體表現?", type: "rating", category: "績效", required: true },
{ id: 2, question: "本期間您的主要成就是什麼?", type: "text", category: "績效", required: true },
{ id: 3, question: "您面臨了哪些挑戰,如何克服?", type: "text", category: "挑戰", required: false },
{ id: 4, question: "您如何有效領導團隊?", type: "rating", category: "領導力", required: true },
{ id: 5, question: "下一季度的目標是什麼?", type: "text", category: "目標", required: true },
]
const statusColors = {
scheduled: { bg: "bg-blue-100", text: "text-blue-800", border: "border-blue-300" },
in_progress: { bg: "bg-yellow-100", text: "text-yellow-800", border: "border-yellow-300" },
completed: { bg: "bg-green-100", text: "text-green-800", border: "border-green-300" },
cancelled: { bg: "bg-red-100", text: "text-red-800", border: "border-red-300" },
}
const typeColors = {
quarterly: { bg: "bg-purple-100", text: "text-purple-800" },
annual: { bg: "bg-indigo-100", text: "text-indigo-800" },
one_on_one: { bg: "bg-emerald-100", text: "text-emerald-800" },
goal_setting: { bg: "bg-orange-100", text: "text-orange-800" },
}
export default function ReviewsPage() {
const [activeTab, setActiveTab] = useState("overview")
const [isScheduleDialogOpen, setIsScheduleDialogOpen] = useState(false)
const [isReviewDialogOpen, setIsReviewDialogOpen] = useState(false)
const [selectedReview, setSelectedReview] = useState<any>(null)
const handleStartReview = (review: any) => {
setSelectedReview(review)
setIsReviewDialogOpen(true)
}
const reviewStats = {
total: reviewsData.length,
scheduled: reviewsData.filter((r) => r.status === "scheduled").length,
inProgress: reviewsData.filter((r) => r.status === "in_progress").length,
completed: reviewsData.filter((r) => r.status === "completed").length,
overdue: reviewsData.filter((r) => new Date(r.scheduledDate) < new Date() && r.status === "scheduled").length,
}
return (
<div className="min-h-screen bg-gradient-to-br from-slate-50 via-indigo-50 to-purple-50 p-3 sm:p-6">
<div className="max-w-7xl mx-auto space-y-4 sm:space-y-6">
{/* Header */}
<div className="flex flex-col space-y-4 sm:flex-row sm:items-center sm:justify-between sm:space-y-0">
<div className="flex flex-col sm:flex-row sm:items-center space-y-2 sm:space-y-0 sm:space-x-4">
<img
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA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Zqu+hT3ZKZFS9NGRggOQfO9v0X4ARQq9vjfJI8JrKLZtLuuhXkdKWkUdoljBzH5nr8KFwl8d4GJAIYOrEvw6CyN1MuxqxZni8HXj11vIgeMSPIWa4xFUnvg+XNpSWQo/mZ6hhzLqgnm0GSyFq8UWVy2vE246WfjrFL7W0Z/eT6fZH0f5OOJNfn75hZuUI1qGeIxLn31ojvtFq9xd2mRPfKmOR/WdkeLXjEokmYp4y9LEGlyu4YlMtdcxXH89Tt/QWN/TMEgGtZNmySrjpLgs/VGnbeH9GPnM7o1kq51rneCe0bc07pO+TNcb0wyLkd3Pbt7/DHdJOtfT9LjZ9uP/diR7+/PWtZ8PhFN8gtRFf4Yyq5SQnZa2CKNasrmQ+n5kYsyBlHahf4G9dOPZzbqQ+n7Eb3553gEReBOCq85V4xJZrNMNBxdddNFFF1100f+GWqT5I7dgvf5f+07K708mR+wt1f8G+1Yrtpzy3pCEGk/Cd+bQdSNfKMlbECPfmUL/sqOLfi+5EFNGDUP+e86PpbilkhE8Zc6KEjSGcMoluZopnEobxbwpcq411hr+g9Xqb0iVM8c5b5lfu6jR+cKp48C/hFDoSOF65hQpJK9gV0nd8G2v8VuXAP4rFPQtdHDbFe9DiI5lKuIbSEnLyU2SQsILanWTq4xiyMakcvTWw0VfTILUJsk8+uuD4T8kU6hANKTc+OJURqriTWL6m/mrUq4UxStolSkCiSWK4IHUkGzlRaZQ9ZmRInciX2bqJVTFPgkiqTiuCnLVrdkpXGeDhHorTla2U6jmZXwIz76v9aKvIlOyJz+v/+e8uOddjCWRr8f7KrPHrpZS6XrzH1wm6WNhCtg5fNmpVxBvCM7yP/IO0yy+oG/vWFUyRPyfX8rCC5r4CkuXecsxfWDs8t+yueqiiy666KKLLrrooosu+r/Qv5Veut0DM30cAAAAAElFTkSuQmCC"
alt="公司 Logo"
className="h-10 w-auto sm:h-12 md:hidden"
/>
<div>
<h1 className="text-xl sm:text-2xl lg:text-3xl font-bold bg-gradient-to-r from-indigo-600 to-purple-600 bg-clip-text text-transparent">
</h1>
<p className="text-sm sm:text-base text-gray-600 mt-1"></p>
</div>
</div>
<div className="flex space-x-2">
<Button
variant="outline"
className="bg-white/80 backdrop-blur-sm"
onClick={() => setIsScheduleDialogOpen(true)}
>
<Calendar className="h-4 w-4 mr-2" />
</Button>
<Button className="bg-gradient-to-r from-indigo-500 to-purple-500 hover:from-indigo-600 hover:to-purple-600 text-white shadow-lg">
<Plus className="h-4 w-4 mr-2" />
</Button>
</div>
</div>
{/* Stats Cards */}
<div className="grid grid-cols-2 sm:grid-cols-5 gap-3 sm:gap-4">
<Card className="shadow-lg bg-gradient-to-br from-blue-50 to-cyan-100 border-0">
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
<CardTitle className="text-sm font-medium text-blue-700"></CardTitle>
<Calendar className="h-4 w-4 text-blue-600" />
</CardHeader>
<CardContent>
<div className="text-2xl font-bold text-blue-800">{reviewStats.total}</div>
</CardContent>
</Card>
<Card className="shadow-lg bg-gradient-to-br from-yellow-50 to-orange-100 border-0">
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
<CardTitle className="text-sm font-medium text-yellow-700"></CardTitle>
<Clock className="h-4 w-4 text-yellow-600" />
</CardHeader>
<CardContent>
<div className="text-2xl font-bold text-yellow-800">{reviewStats.scheduled}</div>
</CardContent>
</Card>
<Card className="shadow-lg bg-gradient-to-br from-orange-50 to-amber-100 border-0">
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
<CardTitle className="text-sm font-medium text-orange-700"></CardTitle>
<User className="h-4 w-4 text-orange-600" />
</CardHeader>
<CardContent>
<div className="text-2xl font-bold text-orange-800">{reviewStats.inProgress}</div>
</CardContent>
</Card>
<Card className="shadow-lg bg-gradient-to-br from-green-50 to-emerald-100 border-0">
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
<CardTitle className="text-sm font-medium text-green-700"></CardTitle>
<CheckCircle className="h-4 w-4 text-green-600" />
</CardHeader>
<CardContent>
<div className="text-2xl font-bold text-green-800">{reviewStats.completed}</div>
</CardContent>
</Card>
<Card className="shadow-lg bg-gradient-to-br from-red-50 to-pink-100 border-0">
<CardHeader className="flex flex-row items-center justify-between space-y-0 pb-2">
<CardTitle className="text-sm font-medium text-red-700"></CardTitle>
<AlertTriangle className="h-4 w-4 text-red-600" />
</CardHeader>
<CardContent>
<div className="text-2xl font-bold text-red-800">{reviewStats.overdue}</div>
</CardContent>
</Card>
</div>
{/* Main Content */}
<Card className="shadow-lg bg-white/80 backdrop-blur-sm">
<CardHeader>
<CardTitle className="text-lg font-bold bg-gradient-to-r from-gray-800 to-gray-600 bg-clip-text text-transparent">
</CardTitle>
<CardDescription></CardDescription>
</CardHeader>
<CardContent>
<Tabs value={activeTab} onValueChange={setActiveTab}>
<TabsList className="grid w-full grid-cols-3">
<TabsTrigger value="overview"></TabsTrigger>
<TabsTrigger value="schedule"></TabsTrigger>
<TabsTrigger value="history"></TabsTrigger>
</TabsList>
{/* Overview Tab */}
<TabsContent value="overview" className="space-y-4">
<div className="grid gap-4">
{reviewsData.map((review) => (
<Card
key={review.id}
className={`shadow-md hover:shadow-lg transition-all duration-200 border-l-4 ${
review.priority === "high"
? "border-red-400 bg-gradient-to-r from-red-50 to-pink-50"
: review.priority === "medium"
? "border-yellow-400 bg-gradient-to-r from-yellow-50 to-amber-50"
: "border-green-400 bg-gradient-to-r from-green-50 to-emerald-50"
}`}
>
<CardContent className="p-6">
<div className="flex flex-col sm:flex-row sm:items-center sm:justify-between space-y-4 sm:space-y-0">
<div className="flex items-center space-x-4">
<Avatar className="h-12 w-12 ring-2 ring-white shadow-md">
<AvatarFallback
className={`${
review.priority === "high"
? "bg-gradient-to-br from-red-400 to-pink-500"
: review.priority === "medium"
? "bg-gradient-to-br from-yellow-400 to-amber-500"
: "bg-gradient-to-br from-green-400 to-emerald-500"
} text-white`}
>
{review.reviewee.charAt(0)}
</AvatarFallback>
</Avatar>
<div>
<h3 className="font-semibold text-gray-900">{review.reviewee}</h3>
<p className="text-sm text-gray-600">{review.position}</p>
<p className="text-xs text-gray-500">{review.department}</p>
</div>
</div>
<div className="flex flex-col sm:items-end space-y-2">
<div className="flex items-center space-x-2">
<Badge
className={`${
typeColors[review.type as keyof typeof typeColors]?.bg
} ${typeColors[review.type as keyof typeof typeColors]?.text} border-0`}
>
{review.type === "quarterly"
? "季度審查"
: review.type === "annual"
? "年度審查"
: review.type === "one_on_one"
? "一對一"
: "目標設定"}
</Badge>
<Badge
className={`${
statusColors[review.status as keyof typeof statusColors]?.bg
} ${statusColors[review.status as keyof typeof statusColors]?.text} border-0`}
>
{review.status === "scheduled"
? "待審查"
: review.status === "in_progress"
? "進行中"
: review.status === "completed"
? "已完成"
: "已取消"}
</Badge>
</div>
<div className="flex items-center space-x-4 text-sm text-gray-600">
<span>: {review.scheduledDate}</span>
<span>: {review.reviewer}</span>
</div>
{review.overallRating && (
<div className="flex items-center space-x-1">
{[...Array(5)].map((_, i) => (
<Star
key={i}
className={`h-4 w-4 ${
i < review.overallRating ? "text-yellow-400 fill-current" : "text-gray-300"
}`}
/>
))}
<span className="text-sm text-gray-600 ml-2">{review.overallRating}/5</span>
</div>
)}
</div>
<div className="flex items-center space-x-2">
{review.status === "scheduled" && (
<Button
onClick={() => handleStartReview(review)}
className="bg-gradient-to-r from-blue-500 to-indigo-500 hover:from-blue-600 hover:to-indigo-600 text-white"
>
</Button>
)}
{review.status === "in_progress" && (
<Button
onClick={() => handleStartReview(review)}
className="bg-gradient-to-r from-orange-500 to-amber-500 hover:from-orange-600 hover:to-amber-600 text-white"
>
</Button>
)}
{review.status === "completed" && (
<Button variant="outline" className="bg-white/80">
</Button>
)}
<Button variant="ghost" size="sm">
<Edit className="h-4 w-4" />
</Button>
</div>
</div>
</CardContent>
</Card>
))}
</div>
</TabsContent>
{/* Schedule Tab */}
<TabsContent value="schedule" className="space-y-4">
<Table>
<TableHeader>
<TableRow>
<TableHead></TableHead>
<TableHead></TableHead>
<TableHead></TableHead>
<TableHead></TableHead>
<TableHead></TableHead>
<TableHead></TableHead>
</TableRow>
</TableHeader>
<TableBody>
{reviewsData.map((review) => (
<TableRow key={review.id}>
<TableCell>
<div className="flex items-center space-x-3">
<Avatar className="h-8 w-8">
<AvatarFallback className="bg-gradient-to-br from-blue-400 to-purple-500 text-white">
{review.reviewee.charAt(0)}
</AvatarFallback>
</Avatar>
<div>
<div className="font-medium">{review.reviewee}</div>
<div className="text-sm text-gray-500">{review.position}</div>
</div>
</div>
</TableCell>
<TableCell>
<Badge
className={`${
typeColors[review.type as keyof typeof typeColors]?.bg
} ${typeColors[review.type as keyof typeof typeColors]?.text} border-0`}
>
{review.type === "quarterly"
? "季度審查"
: review.type === "annual"
? "年度審查"
: review.type === "one_on_one"
? "一對一"
: "目標設定"}
</Badge>
</TableCell>
<TableCell className="text-sm">{review.scheduledDate}</TableCell>
<TableCell>
<Badge
className={`${
statusColors[review.status as keyof typeof statusColors]?.bg
} ${statusColors[review.status as keyof typeof statusColors]?.text} border-0`}
>
{review.status === "scheduled"
? "待審查"
: review.status === "in_progress"
? "進行中"
: review.status === "completed"
? "已完成"
: "已取消"}
</Badge>
</TableCell>
<TableCell>
<Badge
variant={
review.priority === "high"
? "destructive"
: review.priority === "medium"
? "secondary"
: "default"
}
>
{review.priority === "high" ? "高" : review.priority === "medium" ? "中" : "低"}
</Badge>
</TableCell>
<TableCell>
<div className="flex items-center space-x-2">
<Button variant="ghost" size="sm">
<Edit className="h-4 w-4" />
</Button>
<Button variant="ghost" size="sm">
<Calendar className="h-4 w-4" />
</Button>
</div>
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</TabsContent>
{/* History Tab */}
<TabsContent value="history" className="space-y-4">
<div className="space-y-4">
{reviewsData
.filter((r) => r.status === "completed")
.map((review) => (
<Card key={review.id} className="shadow-md">
<CardContent className="p-6">
<div className="flex items-center justify-between">
<div className="flex items-center space-x-4">
<Avatar className="h-10 w-10">
<AvatarFallback className="bg-gradient-to-br from-green-400 to-emerald-500 text-white">
{review.reviewee.charAt(0)}
</AvatarFallback>
</Avatar>
<div>
<h3 className="font-semibold">{review.reviewee}</h3>
<p className="text-sm text-gray-600">{review.position}</p>
</div>
</div>
<div className="flex items-center space-x-4">
{review.overallRating && (
<div className="flex items-center space-x-1">
{[...Array(5)].map((_, i) => (
<Star
key={i}
className={`h-4 w-4 ${
i < review.overallRating ? "text-yellow-400 fill-current" : "text-gray-300"
}`}
/>
))}
</div>
)}
<Badge className="bg-green-100 text-green-800 border-0"></Badge>
<span className="text-sm text-gray-500">{review.scheduledDate}</span>
</div>
</div>
</CardContent>
</Card>
))}
</div>
</TabsContent>
</Tabs>
</CardContent>
</Card>
{/* Schedule Review Dialog */}
<Dialog open={isScheduleDialogOpen} onOpenChange={setIsScheduleDialogOpen}>
<DialogContent className="max-w-md">
<DialogHeader>
<DialogTitle className="bg-gradient-to-r from-indigo-600 to-purple-600 bg-clip-text text-transparent">
</DialogTitle>
<DialogDescription></DialogDescription>
</DialogHeader>
<div className="space-y-4">
<div>
<Label htmlFor="reviewee"></Label>
<Select>
<SelectTrigger>
<SelectValue placeholder="選擇受審者" />
</SelectTrigger>
<SelectContent>
<SelectItem value="chen"> - </SelectItem>
<SelectItem value="wang"> - </SelectItem>
<SelectItem value="li"> - </SelectItem>
<SelectItem value="zhang"> - </SelectItem>
</SelectContent>
</Select>
</div>
<div>
<Label htmlFor="reviewType"></Label>
<Select>
<SelectTrigger>
<SelectValue placeholder="選擇審查類型" />
</SelectTrigger>
<SelectContent>
<SelectItem value="quarterly"></SelectItem>
<SelectItem value="annual"></SelectItem>
<SelectItem value="one_on_one"></SelectItem>
<SelectItem value="goal_setting"></SelectItem>
</SelectContent>
</Select>
</div>
<div>
<Label htmlFor="scheduledDate"></Label>
<Input id="scheduledDate" type="date" />
</div>
<div>
<Label htmlFor="priority"></Label>
<Select>
<SelectTrigger>
<SelectValue placeholder="選擇優先級" />
</SelectTrigger>
<SelectContent>
<SelectItem value="high"></SelectItem>
<SelectItem value="medium"></SelectItem>
<SelectItem value="low"></SelectItem>
</SelectContent>
</Select>
</div>
<div>
<Label htmlFor="notes"></Label>
<Textarea id="notes" placeholder="審查重點或特殊說明..." />
</div>
</div>
<DialogFooter>
<Button className="bg-gradient-to-r from-green-500 to-emerald-500 hover:from-green-600 hover:to-emerald-600 text-white">
</Button>
</DialogFooter>
</DialogContent>
</Dialog>
{/* Review Dialog */}
<Dialog open={isReviewDialogOpen} onOpenChange={setIsReviewDialogOpen}>
<DialogContent className="max-w-2xl max-h-[80vh] overflow-y-auto">
<DialogHeader>
<DialogTitle className="bg-gradient-to-r from-indigo-600 to-purple-600 bg-clip-text text-transparent">
- {selectedReview?.reviewee}
</DialogTitle>
<DialogDescription>
{selectedReview?.type === "quarterly"
? "季度績效審查"
: selectedReview?.type === "annual"
? "年度績效審查"
: selectedReview?.type === "one_on_one"
? "一對一面談"
: "目標設定會議"}
</DialogDescription>
</DialogHeader>
<div className="space-y-6">
{reviewQuestions.map((question, index) => (
<div key={question.id} className="space-y-3">
<div className="flex items-start space-x-2">
<Badge variant="outline" className="mt-1">
{index + 1}
</Badge>
<div className="flex-1">
<div className="flex items-center space-x-2 mb-2">
<Label className="text-base font-medium">{question.question}</Label>
{question.required && (
<Badge variant="destructive" className="text-xs">
</Badge>
)}
<Badge variant="outline" className="text-xs">
{question.category}
</Badge>
</div>
{question.type === "rating" ? (
<div className="flex items-center space-x-2">
{[1, 2, 3, 4, 5].map((rating) => (
<button key={rating} className="p-1 hover:bg-gray-100 rounded" type="button">
<Star className="h-6 w-6 text-gray-300 hover:text-yellow-400" />
</button>
))}
<span className="text-sm text-gray-500 ml-2"></span>
</div>
) : (
<Textarea placeholder="請輸入回答..." className="min-h-[100px]" />
)}
</div>
</div>
</div>
))}
<div className="border-t pt-4">
<Label className="text-base font-medium"></Label>
<div className="flex items-center space-x-2 mt-2">
{[1, 2, 3, 4, 5].map((rating) => (
<button key={rating} className="p-1 hover:bg-gray-100 rounded" type="button">
<Star className="h-8 w-8 text-gray-300 hover:text-yellow-400" />
</button>
))}
</div>
</div>
<div>
<Label htmlFor="summary"></Label>
<Textarea id="summary" placeholder="請輸入審查總結和建議..." className="min-h-[120px]" />
</div>
</div>
<DialogFooter className="flex space-x-2">
<Button variant="outline">稿</Button>
<Button className="bg-gradient-to-r from-green-500 to-emerald-500 hover:from-green-600 hover:to-emerald-600 text-white">
</Button>
</DialogFooter>
</DialogContent>
</Dialog>
</div>
</div>
)
}