feat (device): update entry form of device

This commit is contained in:
riefive
2025-09-03 15:47:07 +07:00
parent 06a26c8b07
commit 0435371e1c
+3 -5
View File
@@ -7,19 +7,17 @@ const data = ref({
code: '',
name: '',
type: '',
stock: 0,
})
const schema = z.object({
code: z.string().min(1, 'Code must be at least 1 characters long'),
name: z.string().min(1, 'Name must be at least 1 characters long'),
type: z.string(),
stock: z.preprocess((val) => Number(val), z.number({ invalid_type_error: 'Stok harus berupa angka' })),
})
function onClick(type: string) {
if (type === 'cancel') {
navigateTo('/tools-equipment-src/material')
navigateTo('/tools-equipment-src/device')
} else if (type === 'draft') {
// do something
} else if (type === 'submit') {
@@ -55,9 +53,9 @@ function onClick(type: string) {
<template>
<div class="mb-5 border-b border-b-slate-300 pb-3 text-lg xl:text-xl">
<Icon name="i-lucide-paint-bucket" class="me-2" />
<span class="font-semibold">Tambah</span> BMHP
<span class="font-semibold">Tambah</span> Alat Kesehatan
</div>
<AppMaterialEntryForm v-model="data" :errors="errors" />
<AppDeviceEntryForm v-model="data" :errors="errors" />
<div class="my-2 flex justify-end py-2">
<Action @click="onClick" />
</div>