diff --git a/app/components/app/patient/preview.vue b/app/components/app/patient/preview.vue index 1c5d822a..e94cb395 100644 --- a/app/components/app/patient/preview.vue +++ b/app/components/app/patient/preview.vue @@ -217,13 +217,13 @@ function onNavigate(type: ClickType) { {{ educationOptions.find((item) => item.code === relative.education_code)?.label || '-' }} - + diff --git a/app/components/content/patient/list.vue b/app/components/content/patient/list.vue index 8f6788c0..d8a6a27f 100644 --- a/app/components/content/patient/list.vue +++ b/app/components/content/patient/list.vue @@ -6,7 +6,7 @@ import { Calendar, Hospital, UserCheck, UsersRound } from 'lucide-vue-next' import RecordConfirmation from '~/components/pub/my-ui/confirmation/record-confirmation.vue' import { ActionEvents } from '~/components/pub/my-ui/data/types' -import Header from '~/components/pub/my-ui/nav-header/prep.vue' +import Header from '~/components/pub/my-ui/nav-header/header.vue' import SummaryCard from '~/components/pub/my-ui/summary-card/summary-card.vue' import { usePaginatedList } from '~/composables/usePaginatedList' @@ -46,6 +46,7 @@ const headerPrep: HeaderPrep = { label: 'Tambah', onClick: () => navigateTo('/client/patient/add'), }, + refSearchNav: refSearchNav, } // Disable dulu, ayahab kalo diminta diff --git a/app/handlers/_handler.ts b/app/handlers/_handler.ts index 01a191b8..0bcf2bca 100644 --- a/app/handlers/_handler.ts +++ b/app/handlers/_handler.ts @@ -165,16 +165,20 @@ export function genCrudHandler(crud: { refresh: () => void, reset: () => void, toast: ToastFn, - ) { + ): Promise { isProcessing.value = true + + let successResponse: any = null + await handleAsyncAction<[number | string, any], any>({ action: crud.update, args: [id, values], toast, successMessage: 'Data berhasil diubah', errorMessage: 'Gagal mengubah data', - onSuccess: () => { + onSuccess: (result) => { isFormEntryDialogOpen.value = false + successResponse = result if (refresh) refresh() }, onFinally: (isSuccess: boolean) => { @@ -182,6 +186,8 @@ export function genCrudHandler(crud: { isProcessing.value = false }, }) + + return successResponse } async function handleActionRemove(id: number | string, refresh: () => void, toast: ToastFn) { diff --git a/app/services/patient.service.ts b/app/services/patient.service.ts index 6a7742c3..3d23d0d8 100644 --- a/app/services/patient.service.ts +++ b/app/services/patient.service.ts @@ -13,6 +13,11 @@ export async function getPatients(params: any = null) { searchParams.append(key, params[key]) } } + if (params.search) { + url += `/search/${params.search}` + searchParams.delete('search') + } + const queryString = searchParams.toString() if (queryString) url += `?${queryString}` } @@ -42,7 +47,8 @@ export async function getPatientDetail(id: number) { export async function getPatientByIdentifier(search: string) { try { - const urlPath = search.length === 16 ? `by-resident-identity/search=${encodeURIComponent(search)}` : `/search/${search}` + const urlPath = + search.length === 16 ? `by-resident-identity/search=${encodeURIComponent(search)}` : `/search/${search}` const url = `${mainUrl}/${urlPath}` const resp = await xfetch(url, 'GET') const result: any = {}