import {Order} from '@prisma/client'
import Link from 'next/link'

import {getAllOrders} from '@/actions/admin/order'
import AdminPermission from '@/components/(protected)/admin/auth/permission'
import {dump} from '@/lib/utils'

export default async function AdminOrderPage() {
	const orders = await getAllOrders()

	return (
		<div>
			<AdminPermission />
			{orders.map((order: Order) => (
				<div
					key={order.id}
					className='flex items-center justify-start gap-x-9 gap-y-6'
				>
					<div>{order.orderNo}</div>
					<div>
						{order.firstName} {order.surname}
					</div>
					<div>{order.phone}</div>
					<div>{order.email}</div>
					<div>{order.notes}</div>
				</div>
			))}
		</div>
	)
}
