fe-prescription-56: wip

This commit is contained in:
Andrian Roshandy
2025-10-24 12:38:02 +07:00
parent 729474a2a0
commit 0c9f9deb7e
6 changed files with 108 additions and 77 deletions
@@ -1,13 +1,19 @@
<script setup lang="ts"> <script setup lang="ts">
import type { PrescriptionItem } from '~/models/prescription-item';
import { config } from './list-entry.cfg' import { config } from './list-entry.cfg'
defineProps<{ defineProps<{
data: any[] data: PrescriptionItem[]
}>() }>()
const emit = defineEmits<{
submit: [mode: string]
}>()
</script> </script>
<template> <template>
<PubMyUiDataTable <PubMyUiDataTable class="border mb-3 2xl:mb-4"
v-bind="config" v-bind="config"
:rows="data" :rows="data"
/> />
+36 -35
View File
@@ -1,18 +1,18 @@
<script setup lang="ts"> <script setup lang="ts">
import * as DE from '~/components/pub/my-ui/doc-entry'; import * as DE from '~/components/pub/my-ui/doc-entry';
import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type' import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
import type { Prescription } from '~/models/prescription';
import PrescriptionItem from '~/components/app/prescription-item/list-entry.vue';
interface Props { interface Props {
data: any[] data: Prescription[]
paginationMeta: PaginationMeta paginationMeta: PaginationMeta
} }
defineProps<Props>() defineProps<Props>()
</script> </script>
<template> <template>
{{ data.length }} <div v-if="data.length == 0" class="p-10 text-center">
<div class="p-10 text-center">
<div class="mb-4 xl:mb-5">Belum Ada Data</div> <div class="mb-4 xl:mb-5">Belum Ada Data</div>
<div> <div>
<Button> <Button>
@@ -21,35 +21,36 @@ defineProps<Props>()
</Button> </Button>
</div> </div>
</div> </div>
<Separator class="my-5" /> <template v-for="item in data">
<div> <div class="max-w-[1000px]">
<DE.Block mode="preview" :colCount=3> <DE.Block mode="preview" :col-count=5>
<DE.Cell> <DE.Cell :col-span="2">
<DE.Label>DPJP</DE.Label> <DE.Label class="font-semibold">Tgl Order</DE.Label>
<DE.Field> <DE.Field>
<Input /> {{ item.issuedAt }}
</DE.Field> </DE.Field>
</DE.Cell> </DE.Cell>
<DE.Cell /> <DE.Cell></DE.Cell>
<DE.Cell> <DE.Cell :col-span="2">
<DE.Label>Tgl Order</DE.Label> <DE.Label class="font-semibold">DPJP</DE.Label>
<DE.Field> <DE.Field>
<Input /> </DE.Field>
</DE.Field> </DE.Cell>
</DE.Cell> <DE.Cell :col-span="2">
<DE.Cell> <DE.Label class="font-semibold">Status</DE.Label>
<DE.Label>DPJP</DE.Label> <DE.Field>
<DE.Field> {{ item.status_code }}
<Input /> </DE.Field>
</DE.Field> </DE.Cell>
</DE.Cell> <DE.Cell></DE.Cell>
<DE.Cell /> <DE.Cell :col-span="2">
<DE.Cell> <DE.Label class="font-semibold">PPDS</DE.Label>
<DE.Label>Status</DE.Label> <DE.Field>
<DE.Field> </DE.Field>
<Input /> </DE.Cell>
</DE.Field> </DE.Block>
</DE.Cell> </div>
</DE.Block> <PrescriptionItem :data="item.items || []" @click="console.log('click')" />
</div> <Separator class="my-10" />
</template>
</template> </template>
+2 -2
View File
@@ -15,7 +15,7 @@ import Status from '~/components/app/encounter/status.vue'
import AssesmentFunctionList from '~/components/content/assesment-function/list.vue' import AssesmentFunctionList from '~/components/content/assesment-function/list.vue'
import EarlyMedicalAssesmentList from '~/components/content/soapi/entry.vue' import EarlyMedicalAssesmentList from '~/components/content/soapi/entry.vue'
// import AssesmentFunctionList from '~/components/content/assesment-function/list.vue' // import AssesmentFunctionList from '~/components/content/assesment-function/list.vue'
import PrescriptionList from '~/components/content/prescription/list.vue' import Prescription from '~/components/content/prescription/main.vue'
import EarlyMedicalRehabList from '~/components/content/soapi/entry.vue' import EarlyMedicalRehabList from '~/components/content/soapi/entry.vue'
import Consultation from '~/components/content/consultation/list.vue' import Consultation from '~/components/content/consultation/list.vue'
@@ -48,7 +48,7 @@ const tabs: TabItem[] = [
{ value: 'education-assessment', label: 'Asesmen Kebutuhan Edukasi' }, { value: 'education-assessment', label: 'Asesmen Kebutuhan Edukasi' },
{ value: 'consent', label: 'General Consent' }, { value: 'consent', label: 'General Consent' },
{ value: 'patient-note', label: 'CPRJ' }, { value: 'patient-note', label: 'CPRJ' },
{ value: 'prescription', label: 'Order Obat', component: PrescriptionList }, { value: 'prescription', label: 'Order Obat', component: Prescription, props: { encounter_id: data.id } },
{ value: 'device', label: 'Order Alkes' }, { value: 'device', label: 'Order Alkes' },
{ value: 'mcu-radiology', label: 'Order Radiologi' }, { value: 'mcu-radiology', label: 'Order Radiologi' },
{ value: 'mcu-lab-pc', label: 'Order Lab PK' }, { value: 'mcu-lab-pc', label: 'Order Lab PK' },
@@ -0,0 +1,37 @@
<script setup lang="ts">
import Nav from '~/components/pub/my-ui/nav-footer/ba-su.vue'
import Header from '~/components/pub/my-ui/nav-header/prep.vue'
import { useQueryCRUDMode } from '~/composables/useQueryCRUD'
import ItemListEntry from '~/components/app/device-order-item/list-entry.vue'
import type { HeaderPrep } from '~/components/pub/my-ui/data/types'
const { backToList } = useQueryCRUDMode()
const headerPrep: HeaderPrep = {
title: 'Tambah Order Alkes',
icon: 'i-lucide-box',
}
function navClick(type: 'cancel' | 'submit') {
if (type === 'cancel') {
backToList()
}
}
</script>
<template>
<Header
:prep="headerPrep"
:ref-search-nav="headerPrep.refSearchNav"
class="mb-4 xl:mb-5"
/>
<ItemListEntry />
<Separator class="my-5" />
<div class="w-full flex justify-center">
<Nav @click="navClick" />
</div>
</template>
+9 -38
View File
@@ -1,18 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
// Components
import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
import Header from '~/components/pub/my-ui/nav-header/prep.vue' import Header from '~/components/pub/my-ui/nav-header/prep.vue'
import RecordConfirmation from '~/components/pub/my-ui/confirmation/record-confirmation.vue'
import List from '~/components/app/prescription/list-entry.vue'
// Helpers
import { usePaginatedList } from '~/composables/usePaginatedList' import { usePaginatedList } from '~/composables/usePaginatedList'
import { toast } from '~/components/pub/ui/toast' import { toast } from '~/components/pub/ui/toast'
// Types
import { ActionEvents, type HeaderPrep } from '~/components/pub/my-ui/data/types' import { ActionEvents, type HeaderPrep } from '~/components/pub/my-ui/data/types'
import { PrescriptionSchema, type PrescriptionFormData } from '~/schemas/prescription.schema'
import type { Unit } from '~/models/unit'
// Handlers // Handlers
import { import {
@@ -20,23 +12,24 @@ import {
recAction, recAction,
recItem, recItem,
isReadonly, isReadonly,
isProcessing,
isFormEntryDialogOpen, isFormEntryDialogOpen,
isRecordConfirmationOpen, isRecordConfirmationOpen,
handleActionSave, handleActionSave,
handleActionEdit,
handleActionRemove,
handleCancelForm,
} from '~/handlers/prescription.handler' } from '~/handlers/prescription.handler'
// Services // Services
import { getList, getDetail } from '~/services/prescription.service' import { getList, getDetail } from '~/services/prescription.service'
import List from '~/components/app/prescription/list.vue'
import type { Prescription } from '~/models/prescription'
// import { getList as getUnitList } from '~/services/unit.service' // previously uses getList // import { getList as getUnitList } from '~/services/unit.service' // previously uses getList
// import { getValueLabelList } from '~/services/unit.service' // import { getValueLabelList } from '~/services/unit.service'
const props = defineProps<{
encounter_id: number
}>()
const route = useRoute() const route = useRoute()
let units = ref<{ value: string; label: string }[]>([])
const title = ref('') const title = ref('')
const plainEid = route.params.id const plainEid = route.params.id
@@ -50,7 +43,7 @@ const {
handlePageChange, handlePageChange,
handleSearch, handleSearch,
fetchData: getMyList, fetchData: getMyList,
} = usePaginatedList({ } = usePaginatedList<Prescription>({
fetchFn: async ({ page, search }) => { fetchFn: async ({ page, search }) => {
const result = await getList({ const result = await getList({
search, search,
@@ -102,17 +95,6 @@ const getMyDetail = async (id: number | string) => {
} }
} }
// const getUnits = async () => {
// const result = await getUnitList()
// if (result.success) {
// const currentMedicineGroups = result.body?.data || []
// units.value = currentMedicineGroups.map((item: Unit) => ({
// value: item.code,
// label: item.name,
// }))
// }
// }
// Watch for row actions when recId or recAction changes // Watch for row actions when recId or recAction changes
watch([recId, recAction], () => { watch([recId, recAction], () => {
switch (recAction.value) { switch (recAction.value) {
@@ -142,22 +124,11 @@ watch([isFormEntryDialogOpen], () => {
}) })
onMounted(async () => { onMounted(async () => {
// await getMyList()
// units.value = await getValueLabelList()
}) })
</script> </script>
<template> <template>
<Header :prep="{ ...headerPrep }" :ref-search-nav="refSearchNav" /> <Header :prep="{ ...headerPrep }" />
<AppPrescriptionList v-if="!isLoading.dataListLoading" /> <List v-if="!isLoading.dataListLoading" :data="data" :pagination-meta="paginationMeta" />
<AppPrescriptionEntry />
<PrescriptionItemListEntry :data=[] />
<div>
<Button>
Tambah
</Button>
</div>
</template> </template>
@@ -0,0 +1,16 @@
<script setup lang="ts">
//
import List from './list.vue'
import Entry from './entry.vue'
const props = defineProps<{
encounter_id: number
}>()
const { mode } = useQueryMode()
</script>
<template>
<List v-if="mode === 'list'" :encounter_id="encounter_id" />
<Entry v-else />
</template>