feat(specialist): add unit info to specialist detail view
- Extend getDetail function to accept optional params - Include unit data when fetching specialist details - Display unit code alongside name in detail view
This commit is contained in:
No files matched your search
@@ -29,7 +29,9 @@ defineProps<{
|
|||||||
<template>
|
<template>
|
||||||
<DetailRow label="Kode">{{ specialist.code || '-' }}</DetailRow>
|
<DetailRow label="Kode">{{ specialist.code || '-' }}</DetailRow>
|
||||||
<DetailRow label="Nama">{{ specialist.name || '-' }}</DetailRow>
|
<DetailRow label="Nama">{{ specialist.name || '-' }}</DetailRow>
|
||||||
<DetailRow label="Unit">{{ specialist.unit?.name || '-' }}</DetailRow>
|
<DetailRow label="Unit">
|
||||||
|
{{ [specialist.unit?.code, specialist.unit?.name].filter(Boolean).join(' / ') || '-' }}
|
||||||
|
</DetailRow>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
@@ -117,7 +117,9 @@ const headerPrep: HeaderPrep = {
|
|||||||
// #region Lifecycle Hooks
|
// #region Lifecycle Hooks
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
try {
|
try {
|
||||||
const result = await getDetailSpecialist(props.specialistId)
|
const result = await getDetailSpecialist(props.specialistId, {
|
||||||
|
includes: 'unit',
|
||||||
|
})
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
specialist.value = result.body.data || {}
|
specialist.value = result.body.data || {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ export function getList(params: any = null) {
|
|||||||
return base.getList(path, params, name)
|
return base.getList(path, params, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getDetail(id: number | string) {
|
export function getDetail(id: number | string, params?: any) {
|
||||||
return base.getDetail(path, id, name)
|
return base.getDetail(path, id, name, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function update(id: number | string, data: any) {
|
export function update(id: number | string, data: any) {
|
||||||
|
|||||||
Reference in New Issue
Block a user