<script setup lang="ts">
import { Head, Link } from '@inertiajs/vue3';
import { ArrowLeft } from '@lucide/vue';
import OrderPosForm from '@/components/admin/manage/orders/OrderPosForm.vue';
import { Button } from '@/components/ui/button';
import AdminLayout from '@/layouts/AdminLayout.vue';
import type { EnumOption, OrderCartItem, OrderCatalogItem, SelectOption } from '@/types/order';

defineProps<{
    customers: SelectOption[];
    catalog: OrderCatalogItem[];
    channels: EnumOption[];
    storePriceTypes: EnumOption[];
    draftItems: OrderCartItem[];
}>();
</script>

<template>
    <Head title="Tambah Pesanan" />

    <AdminLayout>
        <div class="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
            <div class="space-y-1">
                <h2 class="text-2xl font-bold tracking-tight">
                    Tambah Pesanan
                </h2>
            </div>

            <Button variant="outline" as-child class="shrink-0 self-start sm:self-center">
                <Link href="/admin/manage/orders">
                    <ArrowLeft class="size-4" />
                    Kembali
                </Link>
            </Button>
        </div>

        <OrderPosForm
            :customers="customers"
            :catalog="catalog"
            :channels="channels"
            :store-price-types="storePriceTypes"
            :draft-items="draftItems"
            submit-url="/admin/manage/orders"
            method="post"
            submit-label="Simpan"
        />
    </AdminLayout>
</template>
