Initial commit: Wedding Hall Automation System with Next.js, Supabase, and Modern UI

This commit is contained in:
2025-12-03 21:29:53 +03:00
commit ee68deb4ce
70 changed files with 13038 additions and 0 deletions

View File

@@ -0,0 +1,108 @@
import { createClient } from "@/lib/supabase/server"
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from "@/components/ui/table"
import { Button } from "@/components/ui/button"
import { Plus, Calendar as CalendarIcon } from "lucide-react"
import Link from "next/link"
import { format } from "date-fns"
import { tr } from "date-fns/locale"
import { Badge } from "@/components/ui/badge"
export default async function ReservationsPage() {
const supabase = await createClient()
const { data: reservations } = await supabase
.from('reservations')
.select(`
id,
start_time,
end_time,
status,
halls (name),
customers (full_name),
packages (name, price)
`)
.order('start_time', { ascending: true })
const getStatusBadge = (status: string) => {
switch (status) {
case 'confirmed': return <Badge className="bg-green-600">Onaylandı</Badge>
case 'pending': return <Badge variant="secondary">Bekliyor</Badge>
case 'cancelled': return <Badge variant="destructive">İptal</Badge>
case 'completed': return <Badge variant="outline">Tamamlandı</Badge>
default: return <Badge>{status}</Badge>
}
}
return (
<div className="space-y-4">
<div className="flex items-center justify-between">
<h2 className="text-3xl font-bold tracking-tight">Rezervasyonlar</h2>
<div className="space-x-2">
<Link href="/dashboard/calendar">
<Button variant="outline">
<CalendarIcon className="mr-2 h-4 w-4" /> Takvim Görünümü
</Button>
</Link>
<Link href="/dashboard/reservations/new">
<Button>
<Plus className="mr-2 h-4 w-4" /> Yeni Rezervasyon
</Button>
</Link>
</div>
</div>
<div className="rounded-md border">
<Table>
<TableHeader>
<TableRow>
<TableHead>Tarih</TableHead>
<TableHead>Saat</TableHead>
<TableHead>Salon</TableHead>
<TableHead>Müşteri</TableHead>
<TableHead>Paket</TableHead>
<TableHead>Durum</TableHead>
<TableHead className="text-right">İşlemler</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{reservations?.length === 0 ? (
<TableRow>
<TableCell colSpan={7} className="text-center h-24 text-muted-foreground">
Henüz rezervasyon yok.
</TableCell>
</TableRow>
) : (
reservations?.map((res) => (
<TableRow key={res.id}>
<TableCell className="font-medium">
{format(new Date(res.start_time), 'd MMMM yyyy', { locale: tr })}
</TableCell>
<TableCell>
{format(new Date(res.start_time), 'HH:mm')} - {format(new Date(res.end_time), 'HH:mm')}
</TableCell>
<TableCell>{res.halls?.name}</TableCell>
<TableCell>{res.customers?.full_name}</TableCell>
<TableCell>
{res.packages?.name}
{res.packages?.price && <span className="text-xs text-muted-foreground block">{res.packages.price}</span>}
</TableCell>
<TableCell>{getStatusBadge(res.status || 'pending')}</TableCell>
<TableCell className="text-right">
<Button variant="ghost" size="sm">Detay</Button>
</TableCell>
</TableRow>
))
)}
</TableBody>
</Table>
</div>
</div>
)
}