<script setup lang="ts">
import BackButton from '@/components/button/BackButton.vue';
import AdminLayout from '@/layouts/AdminLayout.vue';
import type { CategoryOption } from '@/types/product';
import { Head } from '@inertiajs/vue3';
import ProductForm from './form/ProductForm.vue';
import { index, store } from '@/routes/admin/master/products';

defineProps<{
    categories: CategoryOption[];
}>();
</script>

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

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

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

        <ProductForm
            :submit-url="store.url()"
            method="post"
            submit-label="Simpan"
            :categories="categories"
        />
    </AdminLayout>
</template>
