Initial commit - SaveTheMoment Atlas Basis-Setup
This commit is contained in:
52
app/dashboard/bookings/[id]/page.tsx
Normal file
52
app/dashboard/bookings/[id]/page.tsx
Normal file
@@ -0,0 +1,52 @@
|
||||
import { getServerSession } from 'next-auth';
|
||||
import { authOptions } from '@/lib/auth';
|
||||
import { prisma } from '@/lib/prisma';
|
||||
import { redirect } from 'next/navigation';
|
||||
import BookingDetail from '@/components/BookingDetail';
|
||||
import DashboardSidebar from '@/components/DashboardSidebar';
|
||||
|
||||
export default async function BookingDetailPage({ params }: { params: { id: string } }) {
|
||||
const session = await getServerSession(authOptions);
|
||||
|
||||
if (!session) {
|
||||
redirect('/login');
|
||||
}
|
||||
|
||||
const booking = await prisma.booking.findUnique({
|
||||
where: { id: params.id },
|
||||
include: {
|
||||
location: true,
|
||||
photobox: true,
|
||||
tour: {
|
||||
include: {
|
||||
driver: true,
|
||||
},
|
||||
},
|
||||
bookingEquipment: {
|
||||
include: {
|
||||
equipment: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
if (!booking) {
|
||||
redirect('/dashboard/bookings');
|
||||
}
|
||||
|
||||
const emails = await prisma.email.findMany({
|
||||
where: { bookingId: booking.id },
|
||||
orderBy: { receivedAt: 'desc' },
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-gradient-to-br from-gray-900 via-gray-800 to-gray-900">
|
||||
<div className="flex">
|
||||
<DashboardSidebar user={session?.user} />
|
||||
<main className="flex-1 p-8">
|
||||
<BookingDetail booking={booking} emails={emails} user={session?.user} />
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
30
app/dashboard/bookings/new/page.tsx
Normal file
30
app/dashboard/bookings/new/page.tsx
Normal file
@@ -0,0 +1,30 @@
|
||||
import { getServerSession } from 'next-auth';
|
||||
import { authOptions } from '@/lib/auth';
|
||||
import { prisma } from '@/lib/prisma';
|
||||
import NewBookingForm from '@/components/NewBookingForm';
|
||||
import DashboardSidebar from '@/components/DashboardSidebar';
|
||||
|
||||
export default async function NewBookingPage() {
|
||||
const session = await getServerSession(authOptions);
|
||||
|
||||
const locations = await prisma.location.findMany({
|
||||
where: { active: true },
|
||||
include: {
|
||||
photoboxes: {
|
||||
where: { active: true },
|
||||
},
|
||||
},
|
||||
orderBy: { name: 'asc' },
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-gradient-to-br from-gray-900 via-gray-800 to-gray-900">
|
||||
<div className="flex">
|
||||
<DashboardSidebar user={session?.user} />
|
||||
<main className="flex-1 p-8">
|
||||
<NewBookingForm locations={locations} user={session?.user} />
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
39
app/dashboard/bookings/page.tsx
Normal file
39
app/dashboard/bookings/page.tsx
Normal file
@@ -0,0 +1,39 @@
|
||||
import { getServerSession } from 'next-auth';
|
||||
import { authOptions } from '@/lib/auth';
|
||||
import { prisma } from '@/lib/prisma';
|
||||
import BookingsTable from '@/components/BookingsTable';
|
||||
import DashboardSidebar from '@/components/DashboardSidebar';
|
||||
|
||||
export default async function BookingsPage() {
|
||||
const session = await getServerSession(authOptions);
|
||||
|
||||
const bookings = await prisma.booking.findMany({
|
||||
include: {
|
||||
location: true,
|
||||
photobox: true,
|
||||
},
|
||||
orderBy: {
|
||||
createdAt: 'desc',
|
||||
},
|
||||
});
|
||||
|
||||
const locations = await prisma.location.findMany({
|
||||
where: { active: true },
|
||||
orderBy: { name: 'asc' },
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-gradient-to-br from-gray-900 via-gray-800 to-gray-900">
|
||||
<div className="flex">
|
||||
<DashboardSidebar user={session?.user} />
|
||||
<main className="flex-1 p-8">
|
||||
<BookingsTable
|
||||
bookings={bookings}
|
||||
locations={locations}
|
||||
user={session?.user}
|
||||
/>
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user