feat(cemo): modify schema
This commit is contained in:
@@ -4,22 +4,18 @@ import Block from '~/components/pub/my-ui/doc-entry/block.vue'
|
||||
import Cell from '~/components/pub/my-ui/doc-entry/cell.vue'
|
||||
import Field from '~/components/pub/my-ui/doc-entry/field.vue'
|
||||
import Label from '~/components/pub/my-ui/doc-entry/label.vue'
|
||||
import Input from '~/components/pub/ui/input/Input.vue'
|
||||
import Button from '~/components/pub/ui/button/Button.vue'
|
||||
import Combobox from '~/components/pub/my-ui/combobox/combobox.vue'
|
||||
import Input from '~/components/pub/ui/input/Input.vue'
|
||||
import DatepickerSingle from '~/components/pub/my-ui/datepicker/datepicker-single.vue'
|
||||
|
||||
// Types
|
||||
import type { Ref } from 'vue'
|
||||
import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
|
||||
|
||||
// Helpers
|
||||
import type z from 'zod'
|
||||
import { useForm } from 'vee-validate'
|
||||
import { toTypedSchema } from '@vee-validate/zod'
|
||||
import { cemotherapySchema } from "~/schemas/cemotherapy.schema"
|
||||
|
||||
interface Props {
|
||||
schema: z.ZodSchema<any>
|
||||
values?: any
|
||||
isLoading?: boolean
|
||||
isReadonly?: boolean
|
||||
@@ -41,7 +37,7 @@ const emit = defineEmits<{
|
||||
}>()
|
||||
|
||||
const { defineField, errors, meta } = useForm({
|
||||
validationSchema: toTypedSchema(props.schema),
|
||||
validationSchema: toTypedSchema(cemotherapySchema),
|
||||
initialValues: {
|
||||
namaPasien: '',
|
||||
tanggalLahir: '',
|
||||
@@ -74,12 +70,12 @@ const [dokterKRJ, dokterKRJAttrs] = defineField('dokterKRJ')
|
||||
|
||||
// Set initial values if provided
|
||||
if (props.values) {
|
||||
Object.entries(props.values).forEach(([key, value]) => {
|
||||
if (value !== undefined) {
|
||||
const field = defineField(key)[0]
|
||||
field.value = value
|
||||
}
|
||||
})
|
||||
// Object.entries(props.values).forEach(([key, value]) => {
|
||||
// if (value !== undefined) {
|
||||
// const field = defineField(key)[0]
|
||||
// field.value = value
|
||||
// }
|
||||
// })
|
||||
}
|
||||
|
||||
const resetForm = () => {
|
||||
@@ -268,7 +264,7 @@ function onCancelForm() {
|
||||
<Label height="compact">Dokter Ruang Tindakan</Label>
|
||||
<Field :errMessage="errors.dokterKRJ">
|
||||
<Combobox
|
||||
id="doktor"
|
||||
id="doctor"
|
||||
v-model="dokterKRJ"
|
||||
v-bind="dokterKRJAttrs"
|
||||
:items="items"
|
||||
|
||||
Reference in New Issue
Block a user