feat: update payment handling and remove unused code in entry forms

This commit is contained in:
riefive
2025-12-03 12:05:23 +07:00
parent 42bb79554f
commit 6a27c1f346
3 changed files with 21 additions and 58 deletions
+18 -57
View File
@@ -36,7 +36,7 @@ const props = defineProps<{
selectedDoctor: Doctor
// subSpecialist?: any[]
// specialists?: TreeItem[]
// paymentMethods: PaymentMethodCode[]
payments?: any[]
participantGroups?: any[]
seps: any[]
patient?: PatientEntity | null | undefined
@@ -91,7 +91,7 @@ const mode = props.mode !== undefined ? props.mode : 'add'
// SEP validation state from props
const isSepValid = computed(() => props.isSepValid || false)
const isCheckingSep = computed(() => props.isCheckingSep || false)
const isJKNPayment = computed(() => paymentMethodCode.value === 'jkn')
const isInsurancePayment = computed(() => ['insurance', 'jkn'].includes(paymentMethodCode.value))
const debouncedSepNumber = refDebounced(sepNumber, 500)
const debouncedCardNumber = refDebounced(cardNumber, 500)
const unitFullName = ref('') // Unit, specialist, subspecialist
@@ -105,34 +105,6 @@ if (mode === 'add') {
registerDate.value = `${year}-${month}-${day}`
}
// const doctorOpts = computed(() => {
// const defaultOption = [{ label: 'Pilih', value: '' }]
// const doctors = props.doctors || []
// return [...defaultOption, ...doctors]
// })
// watch(doctorCode, (newValue) => {
// // doctor.value = props.doctors?.find(doc => doc.code === newValue)
// unitFullName.value = doctor.value?.subspecialist?.name ??
// doctor.value?.specialist?.name ??
// doctor.value?.unit?.name ??
// 'tidak diketahui'
// model.value!.responsible_doctor_code = doctor.value?.code
// // const unitName = selectedDoctor?.specialist?.name || ''
// // emit('event', 'unit-changed', unitName)
// })
// Watch specialist/subspecialist selection to fetch doctors
// watch(subSpecialistCode, async (newValue) => {
// if (newValue) {
// console.log('SubSpecialist changed:', newValue)
// // Reset doctor selection
// doctorCode.value = ''
// // Emit fetch event to parent
// emit('fetch', { subSpecialistCode: newValue })
// }
// })
watch(() => props.selectedDoctor, (doctor) => {
unitFullName.value = doctor.subspecialist?.name ??
doctor.specialist?.name ??
@@ -144,14 +116,6 @@ watch(() => props.selectedDoctor, (doctor) => {
},
)
watch(debouncedSepNumber, (newValue) => {
emit('event', 'sep-number-changed', newValue)
})
watch(debouncedCardNumber, (newValue) => {
emit('event', 'member-changed', newValue)
})
// Sync props to form fields
watch(
() => props.objects,
@@ -200,9 +164,13 @@ watch(
},
)
// async function onFetchChildren(parentId: string): Promise<void> {
// console.log('onFetchChildren', parentId)
// }
watch(debouncedSepNumber, (newValue) => {
emit('event', 'sep-number-changed', newValue)
})
watch(debouncedCardNumber, (newValue) => {
emit('event', 'member-changed', newValue)
})
function onAddSep() {
const formValues = {
@@ -373,24 +341,10 @@ defineExpose({
<span class="text-red-500">*</span>
</DE.Label>
<DE.Field :errMessage="errors.unit_code">
<Input :value="unitFullName"/>
<!-- <TreeSelect
id="subSpecialistCode"
v-model="subSpecialistCode"
v-bind="subSpecialistCodeAttrs"
:data="specialists || []"
:on-fetch-children="onFetchChildren"
/> -->
<Input :value="unitFullName" :disabled="true"/>
</DE.Field>
</DE.Cell>
</DE.Block>
<DE.Block
labelSize="thin"
class="!pt-0"
:colCount="3"
:cellFlex="false"
>
<DE.Cell>
<DE.Label height="compact">
Tanggal Daftar
@@ -405,7 +359,14 @@ defineExpose({
/>
</DE.Field>
</DE.Cell>
</DE.Block>
<DE.Block
labelSize="thin"
class="!pt-0"
:colCount="3"
:cellFlex="false"
>
<DE.Cell>
<DE.Label height="compact">
Jenis Pembayaran
@@ -425,7 +386,7 @@ defineExpose({
</DE.Block>
<!-- BPJS Fields (conditional) -->
<template v-if="isJKNPayment">
<template v-if="isInsurancePayment">
<DE.Block
labelSize="thin"
class="!pt-0"
+2 -1
View File
@@ -112,6 +112,7 @@ const isLoading = props.isLoading !== undefined ? props.isLoading : false
const isReadonly = props.isReadonly !== undefined ? props.isReadonly : false
const isService = ref(props.isService || false)
const isShowPatient = ref(props.isShowPatient || false)
const isShowSpecialist = ref(false)
const isDateReload = ref(false)
// Debounced search for bpjsNumber and nationalId
@@ -593,7 +594,7 @@ onMounted(() => {
</Field>
</Cell>
<Cell v-if="!isReadonly">
<Cell v-if="!isReadonly && isShowSpecialist">
<Label height="compact">
Spesialis / Subspesialis
<span class="text-red-500">*</span>
+1
View File
@@ -22,6 +22,7 @@ export function create(data: any) {
}
} else {
url = pathOld
delete payload.encounterId
}
return base.create(url, payload, name)
}