<script setup lang="ts">
import { Head } from '@inertiajs/vue3';
import BackButton from '@/components/button/BackButton.vue';
import AdminLayout from '@/layouts/AdminLayout.vue';
import { index, store } from '@/routes/admin/manage/restocks';
import type {
    RestockCartItem,
    RestockProductCatalogItem,
} from '@/types/restock';
import RestockPosForm from './form/RestockPosForm.vue';

defineProps<{
    productCatalog: RestockProductCatalogItem[];
    draftItems: RestockCartItem[];
}>();
</script>

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

    <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 Restock
                </h2>
            </div>

            <BackButton :href="index.url()" />
        </div>

        <RestockPosForm
            :product-catalog="productCatalog"
            :draft-items="draftItems"
            :submit-url="store.url()"
            method="post"
            submit-label="Simpan"
        />
    </AdminLayout>
</template>
