From 539b70b4b78093877389e0f9dcf019b6a79e5021 Mon Sep 17 00:00:00 2001 From: riefive Date: Tue, 21 Oct 2025 14:12:26 +0700 Subject: [PATCH] feat(sep): adjust combobox filter --- app/components/app/sep/entry-form.vue | 6 +++++- app/components/content/sep/entry.vue | 19 +++++++++++++++++-- .../pub/my-ui/combobox/combobox.vue | 10 ++++++---- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/app/components/app/sep/entry-form.vue b/app/components/app/sep/entry-form.vue index 978dc4f0..b336eaf1 100644 --- a/app/components/app/sep/entry-form.vue +++ b/app/components/app/sep/entry-form.vue @@ -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) => { { placeholder="Pilih Klinik" search-placeholder="Cari Klinik" empty-message="Item tidak ditemukan" + @update:searchText="emit('fetch', { menu: 'destinationClinic', value: $event })" /> @@ -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 })" /> @@ -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 })" /> diff --git a/app/components/content/sep/entry.vue b/app/components/content/sep/entry.vue index 2d683c68..cc8bba0d 100644 --- a/app/components/content/sep/entry.vue +++ b/app/components/content/sep/entry.vue @@ -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" /> { }) 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 || '' + } + " /> {{ emptyMessage || 'Item tidak ditemukan.' }}