28 lines
825 B
TypeScript
28 lines
825 B
TypeScript
import { redirect } from "next/navigation";
|
|
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
|
import { prisma } from "@/lib/prisma";
|
|
import { EventForm } from "../event-form";
|
|
|
|
export default async function CreateEventPage() {
|
|
const { session, permissions } = await getAdminContext();
|
|
if (!canAccess(permissions, PERMS.EVENTS_EDIT, session.user.rank)) {
|
|
redirect("/admin/events");
|
|
}
|
|
|
|
const eventTypes = await prisma.websiteEventType.findMany({
|
|
where: { isActive: 1 },
|
|
orderBy: { name: "asc" },
|
|
});
|
|
|
|
return (
|
|
<div className="space-y-6">
|
|
<div>
|
|
<h1 className="text-3xl font-bold tracking-tight">Create Event</h1>
|
|
<p className="text-muted-foreground">Schedule a new hotel event</p>
|
|
</div>
|
|
|
|
<EventForm eventTypes={eventTypes} />
|
|
</div>
|
|
);
|
|
}
|