feat(cemo): modify schema

This commit is contained in:
riefive
2025-10-31 13:09:59 +07:00
parent 45cc019ec1
commit 7119f67402
2 changed files with 83 additions and 14 deletions
+10 -14
View File
@@ -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"