diff --git a/app/components/content/specialist/list.vue b/app/components/content/specialist/list.vue
index d1c3bb21..b6d7048a 100644
--- a/app/components/content/specialist/list.vue
+++ b/app/components/content/specialist/list.vue
@@ -13,7 +13,6 @@ import { toast } from '~/components/pub/ui/toast'
// Types
import { ActionEvents, type HeaderPrep } from '~/components/pub/custom-ui/data/types'
import { SpecialistSchema, type SpecialistFormData } from '~/schemas/specialist.schema'
-import type { Unit } from '~/models/unit'
// Handlers
import {
@@ -29,12 +28,11 @@ import {
handleActionRemove,
handleCancelForm,
} from '~/handlers/specialist.handler'
+import { units, getUnitList } from '~/handlers/_shared.handler'
// Services
import { getSpecialists, getSpecialistDetail } from '~/services/specialist.service'
-import { getUnits } from '~/services/unit.service'
-const units = ref<{ value: string; label: string }[]>([])
const title = ref('')
const {
@@ -93,14 +91,6 @@ const getCurrentSpecialistDetail = async (id: number | string) => {
}
}
-const getUnitList = async () => {
- const result = await getUnits()
- if (result.success) {
- const currentUnits = result.body?.data || []
- units.value = currentUnits.map((item: Unit) => ({ value: item.id ? Number(item.id) : item.code, label: item.name }))
- }
-}
-
// Watch for row actions when recId or recAction changes
watch([recId, recAction], () => {
switch (recAction.value) {
diff --git a/app/components/content/subspecialist/list.vue b/app/components/content/subspecialist/list.vue
index ad38241f..ec8520fd 100644
--- a/app/components/content/subspecialist/list.vue
+++ b/app/components/content/subspecialist/list.vue
@@ -13,7 +13,6 @@ import { toast } from '~/components/pub/ui/toast'
// Types
import { ActionEvents, type HeaderPrep } from '~/components/pub/custom-ui/data/types'
import { SubspecialistSchema, type SubspecialistFormData } from '~/schemas/subspecialist.schema'
-import type { Specialist } from '~/models/specialist'
// Handlers
import {
@@ -29,12 +28,11 @@ import {
handleActionRemove,
handleCancelForm,
} from '~/handlers/subspecialist.handler'
+import { specialists, getSpecialistsList } from '~/handlers/_shared.handler'
// Services
import { getSubspecialists, getSubspecialistDetail } from '~/services/subspecialist.service'
-import { getSpecialists } from '~/services/specialist.service'
-const specialists = ref<{ value: string; label: string }[]>([])
const title = ref('')
const {
@@ -93,17 +91,6 @@ const getCurrentSubSpecialistDetail = async (id: number | string) => {
}
}
-const getSpecialistsList = async () => {
- const result = await getSpecialists()
- if (result.success) {
- const currentSpecialists = result.body?.data || []
- specialists.value = currentSpecialists.map((item: Specialist) => ({
- value: item.id ? Number(item.id) : item.code,
- label: item.name,
- }))
- }
-}
-
// Watch for row actions when recId or recAction changes
watch([recId, recAction], () => {
switch (recAction.value) {
diff --git a/app/components/content/unit/list.vue b/app/components/content/unit/list.vue
index 3dcd184d..0ecde4c5 100644
--- a/app/components/content/unit/list.vue
+++ b/app/components/content/unit/list.vue
@@ -28,6 +28,7 @@ import {
handleActionRemove,
handleCancelForm,
} from '~/handlers/unit.handler'
+import { installations, getInstallationList } from '~/handlers/_shared.handler'
// Services
import { getUnits, getUnitDetail } from '~/services/unit.service'
@@ -110,6 +111,7 @@ watch([recId, recAction], () => {
})
onMounted(async () => {
+ await getInstallationList()
await getUnitList()
})
@@ -127,6 +129,7 @@ onMounted(async () => {