feat(material): retest material
This commit is contained in:
No files matched your search
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user