// types import type { MedicineGroup } from '~/models/medicine-group' import type { MedicineMethod } from '~/models/medicine-method' import type { Uom } from '~/models/uom' // services import { getMedicineGroups } from '~/services/medicine-group.service' import { getMedicineMethods } from '~/services/medicine-method.service' import { getUoms } from '~/services/uom.service' import { getEncounters } from '~/services/encounter.service' // variables export const medicineGroups = ref<{ value: string; label: string }[]>([]) export const medicineMethods = ref<{ value: string; label: string }[]>([]) export const uoms = ref<{ value: string; label: string }[]>([]) export const encounterClasses = ref<{ value: string; label: string }[]>([]) export const getMedicineGroupList = async () => { const result = await getMedicineGroups() if (result.success) { const currentMedicineGroups = result.body?.data || [] medicineGroups.value = currentMedicineGroups.map((medicineGroup: MedicineGroup) => ({ value: medicineGroup.code, label: medicineGroup.name, })) } } export const getMedicineMethodList = async () => { const result = await getMedicineMethods() if (result.success) { const currentMedicineMethods = result.body?.data || [] medicineMethods.value = currentMedicineMethods.map((medicineMethod: MedicineMethod) => ({ value: medicineMethod.code, label: medicineMethod.name, })) } } export const getUomList = async () => { const result = await getUoms() if (result.success) { const currentUoms = result.body?.data || [] uoms.value = currentUoms.map((uom: Uom) => ({ value: uom.code || uom.erp_id, label: uom.name })) } } export const getEncounterClassList = async () => { const result = await getEncounters() if (result.success) { const currentValues = result.body?.data || [] encounterClasses.value = currentValues.map((item: any) => ({ value: item.code || item.id, label: item.name })) } }