feat(sep): refactor schema

This commit is contained in:
riefive
2025-10-21 14:56:42 +07:00
parent 539b70b4b7
commit 437d1f3fc7
4 changed files with 53 additions and 37 deletions
+18 -19
View File
@@ -26,6 +26,7 @@ const props = defineProps<{
doctors: any[]
diagnoses: any[]
facilities: any[]
supportCodes: any[]
patient?: PatientEntity | null | undefined
values?: any
}>()
@@ -43,12 +44,6 @@ const admissionTypes = [
{ value: '2', label: 'Rujukan' },
]
const items = [
{ value: 'item-1', label: 'Item 1' },
{ value: 'item-2', label: 'Item 2' },
{ value: 'item-3', label: 'Item 3' },
]
// Validation schema (moved to shared file)
const { handleSubmit, errors, defineField, meta } = useForm<IntegrationBpjsFormData>({
validationSchema: toTypedSchema(IntegrationBpjsSchema),
@@ -69,8 +64,10 @@ const [attendingDoctor, attendingDoctorAttrs] = defineField('attendingDoctor')
const [initialDiagnosis, initialDiagnosisAttrs] = defineField('initialDiagnosis')
const [cob, cobAttrs] = defineField('cob')
const [cataract, cataractAttrs] = defineField('cataract')
const [clinicExcecutive, clinicExcecutiveAttrs] = defineField('clinicExcecutive')
const [procedureType, procedureTypeAttrs] = defineField('procedureType')
const [supportCode, supportCodeAttrs] = defineField('supportCode')
const [note, noteAttrs] = defineField('note')
// Submit handler
const onSubmit = handleSubmit((values) => {
@@ -313,23 +310,23 @@ watch(props, (value) => {
</Label>
<Field :errMessage="errors.cob">
<RadioGroup
v-model="cob"
v-model="clinicExcecutive"
v-bind="clinicExcecutiveAttrs"
class="flex items-center gap-2"
v-bind="cobAttrs"
>
<div class="flex items-center space-x-2">
<RadioGroupItem
value="yes"
id="cob-yes"
id="clinicExcecutive-yes"
/>
<Label for="cob-yes">Ya</Label>
<Label for="clinicExcecutive-yes">Ya</Label>
</div>
<div class="flex items-center space-x-2">
<RadioGroupItem
value="no"
id="cob-no"
id="clinicExcecutive-no"
/>
<Label for="cob-no">Tidak</Label>
<Label for="clinicExcecutive-no">Tidak</Label>
</div>
</RadioGroup>
</Field>
@@ -350,7 +347,7 @@ watch(props, (value) => {
placeholder="Pilih DPJP"
search-placeholder="Cari DPJP"
empty-message="Item tidak ditemukan"
@update:searchText="emit('fetch', { menu: 'attendingDoctor', value: $event })"
@update:searchText="emit('fetch', { menu: 'attendingDoctor', value: $event })"
/>
</Field>
</Cell>
@@ -379,7 +376,7 @@ watch(props, (value) => {
<Block
labelSize="thin"
class="!pt-0"
:colCount="1"
:colCount="2"
:cellFlex="false"
>
<Cell>
@@ -387,6 +384,8 @@ watch(props, (value) => {
<Field>
<Textarea
id="note"
v-model="note"
v-bind="noteAttrs"
class="h-[200px] w-full border-gray-400 bg-white"
placeholder="Masukkan catatan opsional"
:disabled="isLoading || isReadonly"
@@ -402,8 +401,8 @@ watch(props, (value) => {
<Field :errMessage="errors.cob">
<RadioGroup
v-model="cob"
class="flex items-center gap-2"
v-bind="cobAttrs"
class="flex items-center gap-2"
>
<div class="flex items-center space-x-2">
<RadioGroupItem
@@ -431,8 +430,8 @@ watch(props, (value) => {
<Field :errMessage="errors.cataract">
<RadioGroup
v-model="cataract"
class="flex items-center gap-2"
v-bind="cataractAttrs"
class="flex items-center gap-2"
>
<div class="flex items-center space-x-2">
<RadioGroupItem
@@ -465,14 +464,14 @@ watch(props, (value) => {
>
<div class="flex items-center space-x-2">
<RadioGroupItem
value="procedure-one"
value="0"
id="procedure-one"
/>
<Label for="procedure-one">Prosedur tidak berkelanjutan</Label>
</div>
<div class="flex items-center space-x-2">
<RadioGroupItem
value="procedure-two"
value="1"
id="procedure-two"
/>
<Label for="procedure-two">Prosedur dan terapi berkelanjutan</Label>
@@ -499,7 +498,7 @@ watch(props, (value) => {
icon-name="i-lucide-chevron-down"
v-model="supportCode"
v-bind="supportCodeAttrs"
:items="items"
:items="supportCodes"
:disabled="isLoading || isReadonly"
placeholder="Pilih Kode Penunjang"
/>