From 38809bec2b515e040101a232581be38db6ef936a Mon Sep 17 00:00:00 2001 From: Yusron alamsyah Date: Fri, 6 Mar 2026 13:44:10 +0700 Subject: [PATCH] fix : review modal update --- components/pendaftaran/FilterSortMenu.vue | 2 +- components/pendaftaran/MedisPasienV2.vue | 563 ++++++++----------- components/pendaftaran/ModalUpdateStatus.vue | 366 ++++++------ 3 files changed, 451 insertions(+), 480 deletions(-) diff --git a/components/pendaftaran/FilterSortMenu.vue b/components/pendaftaran/FilterSortMenu.vue index 65cd18c..84bbe01 100644 --- a/components/pendaftaran/FilterSortMenu.vue +++ b/components/pendaftaran/FilterSortMenu.vue @@ -83,7 +83,7 @@ const resetFilters = () => { color="primary" prepend-icon="mdi-filter-variant" > - Filter & Sort + Filter & Urutkan -import api from '@/services/api'; +import api from '@/services/api'; import type { Props } from '~/types/common'; import type { DiagnosisItem, TindakanItem, DiagnosisApiData, TindakanApiData } from '~/types/pendaftaran'; import { Icon } from '@iconify/vue'; @@ -34,7 +34,7 @@ const searchDiagnosis = async (search: string) => { loadingDiagnosis.value = true; diagnosisSearchPerformed.value = false; - + try { const response = await api.get('/reference/diagnosa', { params: { @@ -71,8 +71,7 @@ const handleDiagnosisSearchInput = (value: string) => { const diagnosisOptions = computed(() => { return diagnosisList.value.map(d => ({ title: d.select, - value: d.kodeicd, - diagnosa: d.keterangan + value: d.select })); }); @@ -99,7 +98,7 @@ const searchTindakan = async (search: string) => { loadingTindakan.value = true; tindakanSearchPerformed.value = false; - + try { const response = await api.get('/reference/tindakan', { params: { @@ -136,8 +135,7 @@ const handleTindakanSearchInput = (value: string) => { const tindakanOptions = computed(() => { return tindakanList.value.map(t => ({ title: t.select, - value: t.kode, - tindakan: t.keterangan + value: t.select })); }); @@ -170,13 +168,13 @@ const editDiagnosis = (index: number) => { const saveDiagnosis = () => { if (!diagnosisForm.value.kodeDiagnosa.trim() || !diagnosisForm.value.diagnosa.trim()) return; - + if (editingDiagnosisIndex.value !== null) { diagnosisItems.value[editingDiagnosisIndex.value] = { ...diagnosisForm.value }; } else { diagnosisItems.value.push({ ...diagnosisForm.value }); } - + resetDiagnosisForm(); diagnosisFormExpanded.value = false; }; @@ -191,10 +189,18 @@ const deleteDiagnosis = (index: number) => { }; // Auto-fill diagnosis when code is selected -const handleKodeDiagnosaChange = (kode: string) => { - const found = diagnosisList.value.find(d => d.kodeicd === kode); - if (found) { - diagnosisForm.value.diagnosa = found.keterangan; +const handleKodeDiagnosaChange = (selectValue: string) => { + if (!selectValue) { + diagnosisForm.value.kodeDiagnosa = ''; + diagnosisForm.value.diagnosa = ''; + return; + } + + // Parse the select value format: "A04 | Other bacterial intestinal infections" + const parts = selectValue.split('|').map(p => p.trim()); + if (parts.length >= 2) { + diagnosisForm.value.kodeDiagnosa = parts[0]; + diagnosisForm.value.diagnosa = parts.slice(1).join('|').trim(); } }; @@ -219,13 +225,13 @@ const editTindakan = (index: number) => { const saveTindakan = () => { if (!tindakanForm.value.kodeTindakan.trim() || !tindakanForm.value.tindakan.trim()) return; - + if (editingTindakanIndex.value !== null) { tindakanItems.value[editingTindakanIndex.value] = { ...tindakanForm.value }; } else { tindakanItems.value.push({ ...tindakanForm.value }); } - + resetTindakanForm(); tindakanFormExpanded.value = false; }; @@ -240,10 +246,18 @@ const deleteTindakan = (index: number) => { }; // Auto-fill tindakan when code is selected -const handleKodeTindakanChange = (kode: string) => { - const found = tindakanList.value.find(t => t.kode === kode); - if (found) { - tindakanForm.value.tindakan = found.keterangan; +const handleKodeTindakanChange = (selectValue: string) => { + if (!selectValue) { + tindakanForm.value.kodeTindakan = ''; + tindakanForm.value.tindakan = ''; + return; + } + + // Parse the select value format: "CODE | Description" + const parts = selectValue.split('|').map(p => p.trim()); + if (parts.length >= 2) { + tindakanForm.value.kodeTindakan = parts[0]; + tindakanForm.value.tindakan = parts.slice(1).join('|').trim(); } }; @@ -284,304 +298,215 @@ defineExpose({ diff --git a/components/pendaftaran/ModalUpdateStatus.vue b/components/pendaftaran/ModalUpdateStatus.vue index 88b75a1..47aac61 100644 --- a/components/pendaftaran/ModalUpdateStatus.vue +++ b/components/pendaftaran/ModalUpdateStatus.vue @@ -166,7 +166,7 @@ watch(() => props.modelValue, (isOpen) => {