feat(medicine-method): refactor + integrate
This commit is contained in:
@@ -6,10 +6,10 @@ import Field from '~/components/pub/custom-ui/doc-entry/field.vue'
|
||||
import Label from '~/components/pub/custom-ui/doc-entry/label.vue'
|
||||
|
||||
// Types
|
||||
import type z from 'zod'
|
||||
import type { MaterialFormData } from '~/schemas/material.schema'
|
||||
|
||||
// Helpers
|
||||
import type z from 'zod'
|
||||
import { useForm } from 'vee-validate'
|
||||
import { toTypedSchema } from '@vee-validate/zod'
|
||||
|
||||
|
||||
@@ -1,14 +1,20 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import type z from 'zod'
|
||||
import { useForm } from 'vee-validate'
|
||||
import { toTypedSchema } from '@vee-validate/zod'
|
||||
// Components
|
||||
import Block from '~/components/pub/custom-ui/doc-entry/block.vue'
|
||||
import Cell from '~/components/pub/custom-ui/doc-entry/cell.vue'
|
||||
import Field from '~/components/pub/custom-ui/doc-entry/field.vue'
|
||||
import Label from '~/components/pub/custom-ui/doc-entry/label.vue'
|
||||
import Button from '~/components/pub/ui/button/Button.vue'
|
||||
|
||||
// Types
|
||||
import type { MedicineBaseFormData } from '~/schemas/medicine.schema'
|
||||
|
||||
// Helpers
|
||||
import type z from 'zod'
|
||||
import { useForm } from 'vee-validate'
|
||||
import { toTypedSchema } from '@vee-validate/zod'
|
||||
|
||||
interface Props {
|
||||
schema?: z.ZodSchema<any>
|
||||
values?: any
|
||||
@@ -20,7 +26,7 @@ const props = defineProps<Props>()
|
||||
const isLoading = props.isLoading !== undefined ? props.isLoading : false
|
||||
const isReadonly = props.isReadonly !== undefined ? props.isReadonly : false
|
||||
const emit = defineEmits<{
|
||||
submit: [values: any, resetForm: () => void]
|
||||
submit: [values: MedicineBaseFormData, resetForm: () => void]
|
||||
cancel: [resetForm: () => void]
|
||||
}>()
|
||||
|
||||
@@ -64,13 +70,13 @@ function onCancelForm() {
|
||||
<Cell>
|
||||
<Label height="">Kode</Label>
|
||||
<Field :errMessage="errors.code">
|
||||
<input id="code" v-model="code" v-bind="codeAttrs" :disabled="isLoading || isReadonly" class="input input-bordered w-full" />
|
||||
<Input id="code" v-model="code" v-bind="codeAttrs" :disabled="isLoading || isReadonly" />
|
||||
</Field>
|
||||
</Cell>
|
||||
<Cell>
|
||||
<Label height="compact">Nama</Label>
|
||||
<Field :errMessage="errors.name">
|
||||
<input id="name" v-model="name" v-bind="nameAttrs" :disabled="isLoading || isReadonly" class="input input-bordered w-full" />
|
||||
<Input id="name" v-model="name" v-bind="nameAttrs" :disabled="isLoading || isReadonly" />
|
||||
</Field>
|
||||
</Cell>
|
||||
</Block>
|
||||
|
||||
@@ -5,14 +5,14 @@ import Cell from '~/components/pub/custom-ui/doc-entry/cell.vue'
|
||||
import Field from '~/components/pub/custom-ui/doc-entry/field.vue'
|
||||
import Label from '~/components/pub/custom-ui/doc-entry/label.vue'
|
||||
|
||||
// Types
|
||||
import type { DeviceFormData } from '~/schemas/device.schema'
|
||||
|
||||
// Helpers
|
||||
import type z from 'zod'
|
||||
import { toTypedSchema } from '@vee-validate/zod'
|
||||
import { useForm } from 'vee-validate'
|
||||
|
||||
// Types
|
||||
import type z from 'zod'
|
||||
import type { DeviceFormData } from '~/schemas/device.schema'
|
||||
|
||||
interface Props {
|
||||
schema: z.ZodSchema<any>
|
||||
uoms: any[]
|
||||
|
||||
Reference in New Issue
Block a user