feat(material): retest material

This commit is contained in:
riefive
2025-09-19 16:08:42 +07:00
parent 70378a69e9
commit 8aa6d3b6f8
4 changed files with 30 additions and 23 deletions

No files matched your search

+12 -7
View File
@@ -5,12 +5,12 @@ import type { MaterialFormData } from '~/schemas/material'
// helpers
import { toTypedSchema } from '@vee-validate/zod'
import { useForm } from 'vee-validate'
import Alert from '~/components/pub/ui/alert/Alert.vue'
// components
interface Props {
schema: z.ZodSchema<any>
uoms: any[]
items: any[]
}
const isLoading = ref(false)
@@ -26,7 +26,6 @@ const { handleSubmit, defineField, errors } = useForm({
code: '',
name: '',
uom_code: '',
item_id: '',
stock: 0,
} as Partial<MaterialFormData>,
})
@@ -34,14 +33,12 @@ const { handleSubmit, defineField, errors } = useForm({
const [code, codeAttrs] = defineField('code')
const [name, nameAttrs] = defineField('name')
const [uom, uomAttrs] = defineField('uom_code')
const [item, itemAttrs] = defineField('item_id')
const [stock, stockAttrs] = defineField('stock')
const resetForm = () => {
code.value = ''
name.value = ''
uom.value = ''
item.value = ''
stock.value = 0
}
@@ -61,7 +58,7 @@ function onCancelForm() {
</script>
<template>
<form class="grid gap-2" @submit="handleSubmit(onSubmitForm)">
<form id="form-equipment" class="grid gap-2">
<div class="grid gap-2">
<label for="code">Kode</label>
<Input
@@ -120,8 +117,16 @@ function onCancelForm() {
</div>
<div class="my-2 flex justify-end gap-2 py-2">
<Button variant="secondary" class="w-[120px]" @click="onCancelForm"> Kembali </Button>
<Button type="submit" class="w-[120px]">
<Loader2 v-if="isLoading" class="mr-2 h-4 w-4 animate-spin" />
<Button
type="button"
class="w-[120px]"
@click="
() => {
handleSubmit(onSubmitForm)()
}
"
>
<!-- <Loader2 v-if="isLoading" class="mr-2 h-4 w-4 animate-spin" /> -->
Simpan
</Button>
</div>