diff --git a/app/components/app/sep/entry-form.vue b/app/components/app/sep/entry-form.vue index c7b7c778..90d0afe7 100644 --- a/app/components/app/sep/entry-form.vue +++ b/app/components/app/sep/entry-form.vue @@ -3,19 +3,31 @@ import { toTypedSchema } from '@vee-validate/zod' import { useForm } from 'vee-validate' import { IntegrationBpjsSchema, type IntegrationBpjsFormData } from '~/schemas/integration-bpjs.schema' -// components +// components (use doc-entry block pattern) +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 { Button } from '~/components/pub/ui/button' import { Input } from '~/components/pub/ui/input' -import { Label } from '~/components/pub/ui/label' import Select from '~/components/pub/ui/select/Select.vue' import { RadioGroup, RadioGroupItem } from '~/components/pub/ui/radio-group' import { Textarea } from '~/components/pub/ui/textarea' import DatepickerSingle from '~/components/pub/my-ui/datepicker/datepicker-single.vue' +const props = defineProps<{ + isLoading?: boolean + isReadonly?: boolean + values?: any +}>() + const emit = defineEmits<{ (e: 'event', value: any): void }>() +const isLoading = props.isLoading !== undefined ? props.isLoading : false +const isReadonly = props.isReadonly !== undefined ? props.isReadonly : false + const items = [ { value: 'item-1', label: 'Item 1' }, { value: 'item-2', label: 'Item 2' }, @@ -23,27 +35,27 @@ const items = [ ] // Validation schema (moved to shared file) -const { handleSubmit, errors, defineField } = useForm({ +const { handleSubmit, errors, defineField, meta } = useForm({ validationSchema: toTypedSchema(IntegrationBpjsSchema), }) -// Bind fields -const [tanggalSep] = defineField('tanggalSep') -const [jalur] = defineField('jalur') -const [noBpjs] = defineField('noBpjs') -const [noKtp] = defineField('noKtp') -const [noRm] = defineField('noRm') -const [namaPasien] = defineField('namaPasien') -const [noTelp] = defineField('noTelp') -const [noSuratKontrol] = defineField('noSuratKontrol') -const [tglSuratKontrol] = defineField('tglSuratKontrol') -const [klinikTujuan] = defineField('klinikTujuan') -const [dpjp] = defineField('dpjp') -const [diagnosaAwal] = defineField('diagnosaAwal') -const [cob] = defineField('cob') -const [katarak] = defineField('katarak') -const [jenisProsedur] = defineField('jenisProsedur') -const [kodePenunjang] = defineField('kodePenunjang') +// Bind fields and extract attrs for consistent Field pattern +const [tanggalSep, tanggalSepAttrs] = defineField('tanggalSep') +const [jalur, jalurAttrs] = defineField('jalur') +const [noBpjs, noBpjsAttrs] = defineField('noBpjs') +const [noKtp, noKtpAttrs] = defineField('noKtp') +const [noRm, noRmAttrs] = defineField('noRm') +const [namaPasien, namaPasienAttrs] = defineField('namaPasien') +const [noTelp, noTelpAttrs] = defineField('noTelp') +const [noSuratKontrol, noSuratKontrolAttrs] = defineField('noSuratKontrol') +const [tglSuratKontrol, tglSuratKontrolAttrs] = defineField('tglSuratKontrol') +const [klinikTujuan, klinikTujuanAttrs] = defineField('klinikTujuan') +const [dpjp, dpjpAttrs] = defineField('dpjp') +const [diagnosaAwal, diagnosaAwalAttrs] = defineField('diagnosaAwal') +const [cob, cobAttrs] = defineField('cob') +const [katarak, katarakAttrs] = defineField('katarak') +const [jenisProsedur, jenisProsedurAttrs] = defineField('jenisProsedur') +const [kodePenunjang, kodePenunjangAttrs] = defineField('kodePenunjang') // Submit handler const onSubmit = handleSubmit((values) => { @@ -53,20 +65,47 @@ const onSubmit = handleSubmit((values) => {