54 lines
2.0 KiB
TypeScript
54 lines
2.0 KiB
TypeScript
import DashboardLayout from "@/components/DashboardLayout"
|
|
import { prisma } from "@/lib/prisma"
|
|
import Link from "next/link"
|
|
|
|
export default async function TeamsPage() {
|
|
const teams = await prisma.team.findMany({
|
|
include: { shiftManager: true },
|
|
orderBy: { name: "asc" }
|
|
})
|
|
|
|
return (
|
|
<DashboardLayout requiredRole="admin">
|
|
<div>
|
|
<div className="flex justify-between items-center mb-6">
|
|
<h1 className="text-3xl font-bold text-gray-800">Teams</h1>
|
|
<Link
|
|
href="/admin/teams/create"
|
|
className="bg-blue-600 text-white px-6 py-2 rounded-lg hover:bg-blue-700 transition-colors"
|
|
>
|
|
+ Create Team
|
|
</Link>
|
|
</div>
|
|
|
|
<div className="bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden">
|
|
<table className="w-full">
|
|
<thead className="bg-gray-50 border-b border-gray-200">
|
|
<tr>
|
|
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Team Name</th>
|
|
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Shift Manager</th>
|
|
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Actions</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody className="divide-y divide-gray-200">
|
|
{teams.map((team) => (
|
|
<tr key={team.id}>
|
|
<td className="px-6 py-4 text-sm text-gray-900">{team.name}</td>
|
|
<td className="px-6 py-4 text-sm text-gray-600">
|
|
{team.shiftManager.firstName} {team.shiftManager.surname}
|
|
</td>
|
|
<td className="px-6 py-4 text-sm">
|
|
<Link href={`/admin/teams/${team.id}`} className="text-blue-600 hover:underline">
|
|
Edit
|
|
</Link>
|
|
</td>
|
|
</tr>
|
|
))}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</DashboardLayout>
|
|
)
|
|
}
|