61 lines
1.9 KiB
Vue
61 lines
1.9 KiB
Vue
<script setup lang="ts">
|
|
import { Head, Link } from '@inertiajs/vue3';
|
|
import { ArrowLeft } from '@lucide/vue';
|
|
import { ref } from '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';
|
|
|
|
const props = defineProps<{
|
|
customers: SelectOption[];
|
|
marketings: SelectOption[];
|
|
catalog: OrderCatalogItem[];
|
|
channels: EnumOption[];
|
|
storePriceTypes: EnumOption[];
|
|
paymentTypes: EnumOption[];
|
|
draftItems: OrderCartItem[];
|
|
}>();
|
|
|
|
const customers = ref([...props.customers]);
|
|
|
|
function onCustomerCreated(customer: { id: number; name: string }) {
|
|
customers.value.push({ value: customer.id, label: customer.name });
|
|
}
|
|
</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"
|
|
:marketings="marketings"
|
|
:catalog="catalog"
|
|
:channels="channels"
|
|
:store-price-types="storePriceTypes"
|
|
:payment-types="paymentTypes"
|
|
:draft-items="draftItems"
|
|
submit-url="/admin/manage/orders"
|
|
method="post"
|
|
submit-label="Simpan"
|
|
@customer-created="onCustomerCreated"
|
|
/>
|
|
</AdminLayout>
|
|
</template>
|