adjust form submit,list, and detail
refactor(patient-preview): comment out unused occupation field in patient preview fix(handler): return success response from update operation in crud handler fix search patient add handle del search char for ease use
This commit is contained in:
@@ -217,13 +217,13 @@ function onNavigate(type: ClickType) {
|
|||||||
<DetailRow label="Pendidikan">
|
<DetailRow label="Pendidikan">
|
||||||
{{ educationOptions.find((item) => item.code === relative.education_code)?.label || '-' }}
|
{{ educationOptions.find((item) => item.code === relative.education_code)?.label || '-' }}
|
||||||
</DetailRow>
|
</DetailRow>
|
||||||
<DetailRow label="Pekerjaan">
|
<!-- <DetailRow label="Pekerjaan">
|
||||||
{{
|
{{
|
||||||
occupationOptions.find((item) => item.code === relative.occupation_code)?.label ||
|
occupationOptions.find((item) => item.code === relative.occupation_code)?.label ||
|
||||||
relative.occupation_name ||
|
relative.occupation_name ||
|
||||||
'-'
|
'-'
|
||||||
}}
|
}}
|
||||||
</DetailRow>
|
</DetailRow> -->
|
||||||
<!-- <DetailRow label="Alamat">{{ relative.address || '-' }}</DetailRow> -->
|
<!-- <DetailRow label="Alamat">{{ relative.address || '-' }}</DetailRow> -->
|
||||||
<!-- <DetailRow label="Nomor HP">{{ relative.phoneNumber || '-' }}</DetailRow> -->
|
<!-- <DetailRow label="Nomor HP">{{ relative.phoneNumber || '-' }}</DetailRow> -->
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -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 RecordConfirmation from '~/components/pub/my-ui/confirmation/record-confirmation.vue'
|
||||||
import { ActionEvents } from '~/components/pub/my-ui/data/types'
|
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 SummaryCard from '~/components/pub/my-ui/summary-card/summary-card.vue'
|
||||||
import { usePaginatedList } from '~/composables/usePaginatedList'
|
import { usePaginatedList } from '~/composables/usePaginatedList'
|
||||||
|
|
||||||
@@ -46,6 +46,7 @@ const headerPrep: HeaderPrep = {
|
|||||||
label: 'Tambah',
|
label: 'Tambah',
|
||||||
onClick: () => navigateTo('/client/patient/add'),
|
onClick: () => navigateTo('/client/patient/add'),
|
||||||
},
|
},
|
||||||
|
refSearchNav: refSearchNav,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable dulu, ayahab kalo diminta
|
// Disable dulu, ayahab kalo diminta
|
||||||
|
|||||||
@@ -165,16 +165,20 @@ export function genCrudHandler<T = any>(crud: {
|
|||||||
refresh: () => void,
|
refresh: () => void,
|
||||||
reset: () => void,
|
reset: () => void,
|
||||||
toast: ToastFn,
|
toast: ToastFn,
|
||||||
) {
|
): Promise<any | null> {
|
||||||
isProcessing.value = true
|
isProcessing.value = true
|
||||||
|
|
||||||
|
let successResponse: any = null
|
||||||
|
|
||||||
await handleAsyncAction<[number | string, any], any>({
|
await handleAsyncAction<[number | string, any], any>({
|
||||||
action: crud.update,
|
action: crud.update,
|
||||||
args: [id, values],
|
args: [id, values],
|
||||||
toast,
|
toast,
|
||||||
successMessage: 'Data berhasil diubah',
|
successMessage: 'Data berhasil diubah',
|
||||||
errorMessage: 'Gagal mengubah data',
|
errorMessage: 'Gagal mengubah data',
|
||||||
onSuccess: () => {
|
onSuccess: (result) => {
|
||||||
isFormEntryDialogOpen.value = false
|
isFormEntryDialogOpen.value = false
|
||||||
|
successResponse = result
|
||||||
if (refresh) refresh()
|
if (refresh) refresh()
|
||||||
},
|
},
|
||||||
onFinally: (isSuccess: boolean) => {
|
onFinally: (isSuccess: boolean) => {
|
||||||
@@ -182,6 +186,8 @@ export function genCrudHandler<T = any>(crud: {
|
|||||||
isProcessing.value = false
|
isProcessing.value = false
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
return successResponse
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleActionRemove(id: number | string, refresh: () => void, toast: ToastFn) {
|
async function handleActionRemove(id: number | string, refresh: () => void, toast: ToastFn) {
|
||||||
|
|||||||
@@ -13,6 +13,11 @@ export async function getPatients(params: any = null) {
|
|||||||
searchParams.append(key, params[key])
|
searchParams.append(key, params[key])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (params.search) {
|
||||||
|
url += `/search/${params.search}`
|
||||||
|
searchParams.delete('search')
|
||||||
|
}
|
||||||
|
|
||||||
const queryString = searchParams.toString()
|
const queryString = searchParams.toString()
|
||||||
if (queryString) url += `?${queryString}`
|
if (queryString) url += `?${queryString}`
|
||||||
}
|
}
|
||||||
@@ -42,7 +47,8 @@ export async function getPatientDetail(id: number) {
|
|||||||
|
|
||||||
export async function getPatientByIdentifier(search: string) {
|
export async function getPatientByIdentifier(search: string) {
|
||||||
try {
|
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 url = `${mainUrl}/${urlPath}`
|
||||||
const resp = await xfetch(url, 'GET')
|
const resp = await xfetch(url, 'GET')
|
||||||
const result: any = {}
|
const result: any = {}
|
||||||
|
|||||||
Reference in New Issue
Block a user