feat(installation): add encounter list
This commit is contained in:
@@ -15,6 +15,7 @@ import { useForm } from 'vee-validate'
|
||||
|
||||
interface Props {
|
||||
schema: z.ZodSchema<any>
|
||||
encounterClasses: any[]
|
||||
values: any
|
||||
isLoading?: boolean
|
||||
isReadonly?: boolean
|
||||
|
||||
@@ -28,6 +28,7 @@ import {
|
||||
handleActionRemove,
|
||||
handleCancelForm,
|
||||
} from '~/handlers/installation.handler'
|
||||
import { encounterClasses, getEncounterClassList } from '~/handlers/_shared.handler'
|
||||
|
||||
// Services
|
||||
import { getInstallations, getInstallationDetail } from '~/services/installation.service'
|
||||
@@ -110,6 +111,7 @@ watch([recId, recAction], () => {
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
await getEncounterClassList();
|
||||
await getInstallationList()
|
||||
})
|
||||
</script>
|
||||
@@ -124,9 +126,15 @@ onMounted(async () => {
|
||||
/>
|
||||
<AppInstallationList :data="data" :pagination-meta="paginationMeta" @page-change="handlePageChange" />
|
||||
|
||||
<Dialog v-model:open="isFormEntryDialogOpen" :title="!!recItem ? title : 'Tambah Instalasi'" size="lg" prevent-outside>
|
||||
<Dialog
|
||||
v-model:open="isFormEntryDialogOpen"
|
||||
:title="!!recItem ? title : 'Tambah Instalasi'"
|
||||
size="lg"
|
||||
prevent-outside
|
||||
>
|
||||
<AppInstallationEntryForm
|
||||
:schema="InstallationSchema"
|
||||
:encounter-classes="encounterClasses"
|
||||
:values="recItem"
|
||||
:is-loading="isProcessing"
|
||||
:is-readonly="isReadonly"
|
||||
|
||||
@@ -31,16 +31,18 @@ import {
|
||||
handleActionRemove,
|
||||
handleCancelForm,
|
||||
} from '~/handlers/medicine.handler'
|
||||
import {
|
||||
medicineGroups,
|
||||
medicineMethods,
|
||||
uoms,
|
||||
getMedicineGroupList,
|
||||
getMedicineMethodList,
|
||||
getUomList,
|
||||
} from '~/handlers/_shared.handler'
|
||||
|
||||
// Services
|
||||
import { getMedicines, getMedicineDetail } from '~/services/medicine.service'
|
||||
import { getMedicineGroups } from '~/services/medicine-group.service'
|
||||
import { getMedicineMethods } from '~/services/medicine-method.service'
|
||||
import { getUoms } from '~/services/uom.service'
|
||||
|
||||
const medicineGroups = ref<{ value: string; label: string }[]>([])
|
||||
const medicineMethods = ref<{ value: string; label: string }[]>([])
|
||||
const uoms = ref<{ value: string; label: string }[]>([])
|
||||
const title = ref('')
|
||||
|
||||
const {
|
||||
@@ -99,36 +101,6 @@ const getCurrentMedicineDetail = async (id: number | string) => {
|
||||
}
|
||||
}
|
||||
|
||||
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,
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
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,
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
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 }))
|
||||
}
|
||||
}
|
||||
|
||||
watch([recId, recAction], () => {
|
||||
switch (recAction.value) {
|
||||
case ActionEvents.showDetail:
|
||||
|
||||
@@ -1,14 +1,42 @@
|
||||
// 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) {
|
||||
|
||||
Reference in New Issue
Block a user