feat(sep): adjust combobox filter
This commit is contained in:
@@ -32,6 +32,7 @@ const props = defineProps<{
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'event', menu: string, value?: any): void
|
||||
(e: 'fetch', value?: any): void
|
||||
}>()
|
||||
|
||||
const isLoading = props.isLoading !== undefined ? props.isLoading : false
|
||||
@@ -292,7 +293,7 @@ watch(props, (value) => {
|
||||
</Label>
|
||||
<Field :errMessage="errors.destinationClinic">
|
||||
<Combobox
|
||||
id="attendingDoctor"
|
||||
id="destinationClinic"
|
||||
v-model="destinationClinic"
|
||||
v-bind="destinationClinicAttrs"
|
||||
:items="facilities"
|
||||
@@ -300,6 +301,7 @@ watch(props, (value) => {
|
||||
placeholder="Pilih Klinik"
|
||||
search-placeholder="Cari Klinik"
|
||||
empty-message="Item tidak ditemukan"
|
||||
@update:searchText="emit('fetch', { menu: 'destinationClinic', value: $event })"
|
||||
/>
|
||||
</Field>
|
||||
</Cell>
|
||||
@@ -348,6 +350,7 @@ watch(props, (value) => {
|
||||
placeholder="Pilih DPJP"
|
||||
search-placeholder="Cari DPJP"
|
||||
empty-message="Item tidak ditemukan"
|
||||
@update:searchText="emit('fetch', { menu: 'attendingDoctor', value: $event })"
|
||||
/>
|
||||
</Field>
|
||||
</Cell>
|
||||
@@ -367,6 +370,7 @@ watch(props, (value) => {
|
||||
placeholder="Pilih Diagnosa Awal"
|
||||
search-placeholder="Cari Diagnosa Awal"
|
||||
empty-message="Item tidak ditemukan"
|
||||
@update:searchText="emit('fetch', { menu: 'initialDiagnosis', value: $event })"
|
||||
/>
|
||||
</Field>
|
||||
</Cell>
|
||||
|
||||
@@ -236,14 +236,28 @@ function handleEvent(menu: string, value: string) {
|
||||
}
|
||||
}
|
||||
|
||||
async function handleFetch(params: any) {
|
||||
const menu = params.menu || ''
|
||||
const value = params.value || ''
|
||||
if (menu === 'initialDiagnosis') {
|
||||
diagnoses.value = await getDiagnoseLabelList({ diagnosa: value })
|
||||
}
|
||||
if (menu === 'attendingDoctor') {
|
||||
console.log('value:', value)
|
||||
}
|
||||
if (menu === 'destinationClinic') {
|
||||
facilities.value = await getHealthFacilityLabelList({ faskes: value, 'jenis-faskes': 1 })
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
diagnoses.value = await getDiagnoseLabelList({ diagnosa: 'paru' })
|
||||
facilities.value = await getHealthFacilityLabelList({ faskes: 'Puskesmas', 'jenis-faskes': 1 })
|
||||
doctors.value = await getDoctorLabelList({
|
||||
'jenis-pelayanan': 1,
|
||||
'tgl-pelayanan': new Date().toISOString().substring(0, 10),
|
||||
'kode-spesialis': 0,
|
||||
})
|
||||
facilities.value = await getHealthFacilityLabelList({ faskes: 'Puskesmas', 'jenis-faskes': 1 })
|
||||
diagnoses.value = await getDiagnoseLabelList({ diagnosa: 'paru' })
|
||||
getProvinceList().then((value) => {
|
||||
console.log('value:', value)
|
||||
})
|
||||
@@ -273,6 +287,7 @@ onMounted(async () => {
|
||||
:diagnoses="diagnoses"
|
||||
:facilities="facilities"
|
||||
:patient="selectedPatientObject"
|
||||
@fetch="handleFetch"
|
||||
@event="handleEvent"
|
||||
/>
|
||||
<AppSepTableSearchPatient
|
||||
|
||||
@@ -36,9 +36,7 @@ watch(props, () => {
|
||||
})
|
||||
|
||||
watch(debouncedSearchText, (newValue) => {
|
||||
if (newValue.length > 0) {
|
||||
emit('update:searchText', newValue)
|
||||
}
|
||||
emit('update:searchText', newValue)
|
||||
})
|
||||
|
||||
const searchableItems = computed(() => {
|
||||
@@ -113,7 +111,11 @@ function onSelect(item: Item) {
|
||||
class="h-9 border-0 border-b border-gray-200 bg-white text-black focus:ring-0 dark:border-gray-700 dark:bg-gray-800 dark:text-white"
|
||||
:placeholder="searchPlaceholder || 'Cari...'"
|
||||
:aria-label="`Cari ${displayText}`"
|
||||
:v-model="searchText"
|
||||
@input="
|
||||
(evt: any) => {
|
||||
searchText = evt?.target?.value || ''
|
||||
}
|
||||
"
|
||||
/>
|
||||
<CommandEmpty class="py-6 text-center text-sm text-gray-500 dark:text-gray-400">
|
||||
{{ emptyMessage || 'Item tidak ditemukan.' }}
|
||||
|
||||
Reference in New Issue
Block a user