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