feat/prescription-56: wip
This commit is contained in:
@@ -7,7 +7,7 @@ defineProps<{
|
|||||||
}>()
|
}>()
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
submit: [mode: string]
|
add: [mode: 'mix' | 'non-mix']
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@@ -17,22 +17,14 @@ const emit = defineEmits<{
|
|||||||
v-bind="config"
|
v-bind="config"
|
||||||
:rows="data"
|
:rows="data"
|
||||||
/>
|
/>
|
||||||
<div class="flex">
|
<div class="-mx-1 [&_button]:mx-1">
|
||||||
<div class="me-auto">
|
<Button @click="emit('add', 'mix')">
|
||||||
<Button class="me-2">
|
<Icon name="i-lucide-plus" />
|
||||||
<Icon name="i-lucide-plus" class="align-middle" />
|
Tambah Racikan
|
||||||
Tambah Racikan
|
</Button>
|
||||||
</Button>
|
<Button @click="emit('add', 'non-mix')">
|
||||||
<Button>
|
<Icon name="i-lucide-plus" />
|
||||||
<Icon name="i-lucide-plus" class="align-middle" />
|
Tambah Non Racikan
|
||||||
Tambah Non-Racikan
|
</Button>
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<Button variant="secondary">
|
|
||||||
<Icon name="i-lucide-x" class="align-middle" />
|
|
||||||
Batal
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,24 +1,66 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import * as DE from '~/components/pub/my-ui/doc-entry'
|
import { LucidePlus } from 'lucide-vue-next';
|
||||||
|
|
||||||
|
import * as DE from '~/components/pub/my-ui/doc-entry'
|
||||||
|
import Separator from '~/components/pub/ui/separator/Separator.vue';
|
||||||
|
import * as Table from '~/components/pub/ui/table'
|
||||||
|
import Nav from '~/components/pub/my-ui/nav-footer/cl-sa.vue'
|
||||||
|
|
||||||
|
|
||||||
|
import { genBase } from '~/models/_base';
|
||||||
|
import { genMedicine } from '~/models/medicine';
|
||||||
|
import type { MedicinemixItem } from '~/models/medicinemix-item';
|
||||||
|
import type { PrescriptionItem } from '~/models/prescription-item';
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
data: PrescriptionItem
|
||||||
|
items: MedicinemixItem[]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
type ClickType = 'close' | 'save'
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
close: [],
|
||||||
|
save: [data: PrescriptionItem, items: MedicinemixItem[]],
|
||||||
|
}>()
|
||||||
|
|
||||||
|
function navClick(type: ClickType) {
|
||||||
|
if (type === 'close') {
|
||||||
|
emit('close')
|
||||||
|
} else if (type === 'save') {
|
||||||
|
emit('save', props.data, props.items)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function addItem() {
|
||||||
|
props.items.push({
|
||||||
|
...genBase(),
|
||||||
|
medicineMix_id: 0,
|
||||||
|
medicine_id: 0,
|
||||||
|
medicine: genMedicine(),
|
||||||
|
dose: 0,
|
||||||
|
uom_code: '',
|
||||||
|
})
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<DE.Block :colCount="5" :cellFlex="false">
|
<DE.Block :colCount="5" :cellFlex="false">
|
||||||
<DE.Cell :colSpan="5">
|
<DE.Cell :colSpan="5">
|
||||||
<DE.Label>Nama</DE.Label>
|
<DE.Label>Nama</DE.Label>
|
||||||
<DE.Field><Input /></DE.Field>
|
<DE.Field><Input :value="data.medicineMix?.name" /></DE.Field>
|
||||||
</DE.Cell>
|
</DE.Cell>
|
||||||
<DE.Cell>
|
<DE.Cell>
|
||||||
<DE.Label>Frequensi</DE.Label>
|
<DE.Label>Frequensi</DE.Label>
|
||||||
<DE.Field><Input /></DE.Field>
|
<DE.Field><Input v-model="data.frequency" /></DE.Field>
|
||||||
</DE.Cell>
|
</DE.Cell>
|
||||||
<DE.Cell>
|
<DE.Cell>
|
||||||
<DE.Label>Dosis</DE.Label>
|
<DE.Label>Dosis</DE.Label>
|
||||||
<DE.Field><Input /></DE.Field>
|
<DE.Field><Input v-model="data.dose" /></DE.Field>
|
||||||
</DE.Cell>
|
</DE.Cell>
|
||||||
<DE.Cell>
|
<DE.Cell>
|
||||||
<DE.Label>Sediaan</DE.Label>
|
<DE.Label>Sediaan</DE.Label>
|
||||||
<DE.Field><Input /></DE.Field>
|
<DE.Field><Input :value="data.medicineMix?.uom_code" /></DE.Field>
|
||||||
</DE.Cell>
|
</DE.Cell>
|
||||||
<DE.Cell>
|
<DE.Cell>
|
||||||
<DE.Label>Total</DE.Label>
|
<DE.Label>Total</DE.Label>
|
||||||
@@ -29,4 +71,43 @@
|
|||||||
<DE.Field><Input /></DE.Field>
|
<DE.Field><Input /></DE.Field>
|
||||||
</DE.Cell>
|
</DE.Cell>
|
||||||
</DE.Block>
|
</DE.Block>
|
||||||
|
<div class="text-sm 2xl:text-base font-semibold !mb-3">Daftar Obat</div>
|
||||||
|
<Table.Table class="border mb-3 2xl:mb-4">
|
||||||
|
<Table.TableHeader class="[&_th]:h-8 [&_th]:2xl:h-9">
|
||||||
|
<Table.TableRow>
|
||||||
|
<Table.TableHead>Nama</Table.TableHead>
|
||||||
|
<Table.TableHead class="w-24">Dosis</Table.TableHead>
|
||||||
|
<Table.TableHead class="w-24">Satuan</Table.TableHead>
|
||||||
|
<Table.TableHead class="w-20">..</Table.TableHead>
|
||||||
|
</Table.TableRow>
|
||||||
|
</Table.TableHeader>
|
||||||
|
<Table.TableBody class="[&_td]:p-0.6">
|
||||||
|
<Table.TableRow v-if="items.length > 0" v-for="item in items">
|
||||||
|
<Table.TableCell>
|
||||||
|
<Input v-model="item.medicine.name" />
|
||||||
|
</Table.TableCell>
|
||||||
|
<Table.TableCell>
|
||||||
|
<Input v-model="item.dose" />
|
||||||
|
</Table.TableCell>
|
||||||
|
<Table.TableCell>
|
||||||
|
<Input />
|
||||||
|
</Table.TableCell>
|
||||||
|
</Table.TableRow>
|
||||||
|
<Table.TableRow v-else>
|
||||||
|
<Table.TableCell colspan="4" class="!p-5 text-center">
|
||||||
|
Belum ada data
|
||||||
|
</Table.TableCell>
|
||||||
|
</Table.TableRow>
|
||||||
|
</Table.TableBody>
|
||||||
|
</Table.Table>
|
||||||
|
<div>
|
||||||
|
<Button @click="addItem">
|
||||||
|
<LucidePlus />
|
||||||
|
Tambah
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
<Separator class="my-5" />
|
||||||
|
<div class="flex justify-center">
|
||||||
|
<Nav @click="navClick" />
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -0,0 +1,90 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import * as DE from '~/components/pub/my-ui/doc-entry'
|
||||||
|
import Separator from '~/components/pub/ui/separator/Separator.vue'
|
||||||
|
import Nav from '~/components/pub/my-ui/nav-footer/cl-sa.vue'
|
||||||
|
|
||||||
|
import { bigTimeUnitCodes } from '~/lib/constants'
|
||||||
|
|
||||||
|
import type { PrescriptionItem } from '~/models/prescription-item'
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
data: PrescriptionItem
|
||||||
|
}>()
|
||||||
|
|
||||||
|
type ClickType = 'close' | 'save'
|
||||||
|
type Item = {
|
||||||
|
value: string
|
||||||
|
label: string
|
||||||
|
}
|
||||||
|
|
||||||
|
const bigTimeUnitCodeItems: Item[] = []
|
||||||
|
|
||||||
|
if(!props.data.intervalUnit_code) {
|
||||||
|
props.data.intervalUnit_code = 'day'
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.keys(bigTimeUnitCodes).forEach((key) => {
|
||||||
|
bigTimeUnitCodeItems.push({
|
||||||
|
value: key,
|
||||||
|
label: bigTimeUnitCodes[key] || '',
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
close: [],
|
||||||
|
save: [data: PrescriptionItem],
|
||||||
|
}>()
|
||||||
|
|
||||||
|
function navClick(type: ClickType) {
|
||||||
|
if (type === 'close') {
|
||||||
|
emit('close')
|
||||||
|
} else if (type === 'save') {
|
||||||
|
emit('save', props.data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<DE.Block :colCount="5" :cellFlex="false">
|
||||||
|
<DE.Cell :colSpan="5">
|
||||||
|
<DE.Label>Nama</DE.Label>
|
||||||
|
<DE.Field><Input :value="data.medicineMix?.name" /></DE.Field>
|
||||||
|
</DE.Cell>
|
||||||
|
<DE.Cell>
|
||||||
|
<DE.Label>Frequensi</DE.Label>
|
||||||
|
<DE.Field><Input type="number" v-model.number="data.frequency" /></DE.Field>
|
||||||
|
</DE.Cell>
|
||||||
|
<DE.Cell>
|
||||||
|
<DE.Label>Dosis</DE.Label>
|
||||||
|
<DE.Field><Input type="number" v-model.number="data.dose" /></DE.Field>
|
||||||
|
</DE.Cell>
|
||||||
|
<DE.Cell>
|
||||||
|
<DE.Label>Sediaan</DE.Label>
|
||||||
|
<DE.Field><Input :value="data.medicineMix?.uom_code" readonly /></DE.Field>
|
||||||
|
</DE.Cell>
|
||||||
|
<DE.Cell>
|
||||||
|
<DE.Label>Interval</DE.Label>
|
||||||
|
<DE.Field>
|
||||||
|
<Select
|
||||||
|
v-model="data.intervalUnit_code"
|
||||||
|
:items="bigTimeUnitCodeItems"
|
||||||
|
/>
|
||||||
|
</DE.Field>
|
||||||
|
</DE.Cell>
|
||||||
|
<DE.Cell>
|
||||||
|
<DE.Label>Total</DE.Label>
|
||||||
|
<DE.Field>
|
||||||
|
<Input v-model="data.quantity" />
|
||||||
|
</DE.Field>
|
||||||
|
</DE.Cell>
|
||||||
|
<DE.Cell :colSpan="5">
|
||||||
|
<DE.Label>Cara Pakai</DE.Label>
|
||||||
|
<DE.Field><Input /></DE.Field>
|
||||||
|
</DE.Cell>
|
||||||
|
</DE.Block>
|
||||||
|
<Separator class="my-5" />
|
||||||
|
<div class="flex justify-center">
|
||||||
|
<Nav @click="navClick" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|||||||
@@ -1,14 +1,33 @@
|
|||||||
<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 Nav from '~/components/pub/my-ui/nav-footer/ca-ed-su.vue'
|
||||||
|
|
||||||
import type { Prescription } from '~/models/prescription';
|
import type { Prescription } from '~/models/prescription';
|
||||||
import PrescriptionItem from '~/components/app/prescription-item/list-entry.vue';
|
import PrescriptionItem from '~/components/app/prescription-item/list.vue';
|
||||||
|
import { add } from 'date-fns';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
data: Prescription[]
|
data: Prescription[]
|
||||||
paginationMeta: PaginationMeta
|
paginationMeta: PaginationMeta
|
||||||
}
|
}
|
||||||
defineProps<Props>()
|
const props = defineProps<Props>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
cancel: [data: any]
|
||||||
|
edit: [data: any],
|
||||||
|
submit: [data: any]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
function navClick(type: 'cancel' | 'edit' | 'submit', data: Prescription): void {
|
||||||
|
if (type === 'cancel') {
|
||||||
|
emit('cancel', data)
|
||||||
|
} else if (type === 'edit') {
|
||||||
|
emit('edit', data)
|
||||||
|
} else if (type === 'submit') {
|
||||||
|
emit('submit', data)
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -21,36 +40,33 @@ defineProps<Props>()
|
|||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<template v-for="item in data">
|
<template v-for="item, idx in data">
|
||||||
<div class="max-w-[1000px]">
|
<div :class="'text-sm 2xl:text-base font-semibold ' + (item.status_code == 'new' ? 'mb-2' : 'mb-2')">
|
||||||
<DE.Block mode="preview" :col-count=5>
|
Order #{{ data.length - idx }} - {{ item.issuedAt?.substring(0, 10) || item.createdAt?.substring(0, 10) }} - {{ item.status_code }}
|
||||||
<DE.Cell :col-span="2">
|
|
||||||
<DE.Label class="font-semibold">Tgl Order</DE.Label>
|
|
||||||
<DE.Field>
|
|
||||||
{{ item.issuedAt }}
|
|
||||||
</DE.Field>
|
|
||||||
</DE.Cell>
|
|
||||||
<DE.Cell></DE.Cell>
|
|
||||||
<DE.Cell :col-span="2">
|
|
||||||
<DE.Label class="font-semibold">DPJP</DE.Label>
|
|
||||||
<DE.Field>
|
|
||||||
</DE.Field>
|
|
||||||
</DE.Cell>
|
|
||||||
<DE.Cell :col-span="2">
|
|
||||||
<DE.Label class="font-semibold">Status</DE.Label>
|
|
||||||
<DE.Field>
|
|
||||||
{{ item.status_code }}
|
|
||||||
</DE.Field>
|
|
||||||
</DE.Cell>
|
|
||||||
<DE.Cell></DE.Cell>
|
|
||||||
<DE.Cell :col-span="2">
|
|
||||||
<DE.Label class="font-semibold">PPDS</DE.Label>
|
|
||||||
<DE.Field>
|
|
||||||
</DE.Field>
|
|
||||||
</DE.Cell>
|
|
||||||
</DE.Block>
|
|
||||||
</div>
|
</div>
|
||||||
<PrescriptionItem :data="item.items || []" @click="console.log('click')" />
|
<DE.Block mode="preview" :col-count="7" class="!mb-3">
|
||||||
<Separator class="my-10" />
|
<DE.Cell :col-span="3">
|
||||||
|
<DE.Label :class="'font-semibold ' + (item.status_code == 'new' ? 'pt-2' : '')">DPJP</DE.Label>
|
||||||
|
<DE.Field :class="item.status_code == 'new' ? 'pt-2' : ''">
|
||||||
|
{{ item.doctor?.employee?.person?.name || '-' }}
|
||||||
|
</DE.Field>
|
||||||
|
</DE.Cell>
|
||||||
|
<DE.Cell :col-span="3">
|
||||||
|
<DE.Label :class="'font-semibold ' + (item.status_code == 'new' ? 'pt-2' : '')">PPDS</DE.Label>
|
||||||
|
<DE.Field :class="item.status_code == 'new' ? 'pt-2' : ''">
|
||||||
|
...........
|
||||||
|
</DE.Field>
|
||||||
|
</DE.Cell>
|
||||||
|
<div class="flex justify-end" >
|
||||||
|
<Nav
|
||||||
|
v-if="item.status_code == 'new'"
|
||||||
|
:small-mode="true"
|
||||||
|
:default-class="'flex gap-1'"
|
||||||
|
@click="(type) => { navClick(type, item) }"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</DE.Block>
|
||||||
|
<PrescriptionItem :data="item.items || []" @click="console.log('click')" class="mb-10" />
|
||||||
|
<!-- <div v-if="idx < data.length - 1" class="my-8 -mx-4 border-t border-t-slate-300" /> -->
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,24 +1,87 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import Nav from '~/components/pub/my-ui/nav-footer/ba-su.vue'
|
import Nav from '~/components/pub/my-ui/nav-footer/ba-de-su.vue'
|
||||||
import Header from '~/components/pub/my-ui/nav-header/prep.vue'
|
import Header from '~/components/pub/my-ui/nav-header/prep.vue'
|
||||||
|
import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
|
||||||
|
|
||||||
import { useQueryCRUDMode } from '~/composables/useQueryCRUD'
|
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'
|
import type { HeaderPrep } from '~/components/pub/my-ui/data/types'
|
||||||
|
|
||||||
|
import { getDetail } from '~/services/prescription.service'
|
||||||
|
import Detail from '~/components/app/prescription/detail.vue'
|
||||||
|
import { getList as getPrescriptionItemList } from '~/services/prescription-item.service'
|
||||||
|
import ItemListEntry from '~/components/app/prescription-item/list-entry.vue'
|
||||||
|
import { type PrescriptionItem } from '~/models/prescription-item'
|
||||||
|
|
||||||
|
import MixItemEntry from '~/components/app/prescription-item/mix-entry.vue'
|
||||||
|
import { create } from '~/services/prescription-item.service';
|
||||||
|
|
||||||
|
import NonMixItemEntry from '~/components/app/prescription-item/non-mix-entry.vue'
|
||||||
|
|
||||||
|
import {
|
||||||
|
recItem,
|
||||||
|
} from '~/handlers/prescription-item.handler'
|
||||||
|
|
||||||
|
// props
|
||||||
|
const props = defineProps<{
|
||||||
|
encounter_id: number
|
||||||
|
}>()
|
||||||
|
|
||||||
|
// declaration & flows
|
||||||
|
// const route = useRoute()
|
||||||
|
const { getQueryParam } = useQueryParam()
|
||||||
|
const id = getQueryParam('id')
|
||||||
|
const dataRes = await getDetail(
|
||||||
|
typeof id === 'string' ? parseInt(id) : 0,
|
||||||
|
{ includes: 'encounter,doctor,doctor-employee,doctor-employee-person' }
|
||||||
|
)
|
||||||
|
const data = dataRes.body?.data || null
|
||||||
|
const items = ref(data?.items || [])
|
||||||
|
|
||||||
|
const {
|
||||||
|
data: prescriptionItems,
|
||||||
|
fetchData: getMyList,
|
||||||
|
} = usePaginatedList<PrescriptionItem> ({
|
||||||
|
fetchFn: async ({ page, search }) => {
|
||||||
|
const result = await getPrescriptionItemList({ 'prescription-id': id, search, page })
|
||||||
|
if (result.success) {
|
||||||
|
data.value = result.body.data
|
||||||
|
}
|
||||||
|
return { success: result.success || false, body: result.body || {} }
|
||||||
|
},
|
||||||
|
entityName: 'prescription-item',
|
||||||
|
})
|
||||||
|
|
||||||
const { backToList } = useQueryCRUDMode()
|
const { backToList } = useQueryCRUDMode()
|
||||||
|
|
||||||
const headerPrep: HeaderPrep = {
|
const headerPrep: HeaderPrep = {
|
||||||
title: 'Tambah Order Alkes',
|
title: 'Tambah Order Obat / Resep',
|
||||||
icon: 'i-lucide-box',
|
icon: 'i-lucide-box',
|
||||||
}
|
}
|
||||||
|
|
||||||
function navClick(type: 'cancel' | 'submit') {
|
const mixDialogOpen = ref(false)
|
||||||
if (type === 'cancel') {
|
const nonMixDialogOpen = ref(false)
|
||||||
backToList()
|
|
||||||
}
|
function navClick(type: 'back' | 'delete' | 'draft' | 'submit') {
|
||||||
|
if (type === 'back') {
|
||||||
|
backToList()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function addItem(mode: 'mix' | 'non-mix') {
|
||||||
|
if (mode === 'mix') {
|
||||||
|
mixDialogOpen.value = true
|
||||||
|
} else if (mode === 'non-mix') {
|
||||||
|
nonMixDialogOpen.value = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveMix() {
|
||||||
|
create({data})
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveNonMix(data: PrescriptionItem) {
|
||||||
|
create({data})
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
@@ -28,10 +91,42 @@ const headerPrep: HeaderPrep = {
|
|||||||
class="mb-4 xl:mb-5"
|
class="mb-4 xl:mb-5"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<ItemListEntry />
|
<Detail :data="data" />
|
||||||
|
|
||||||
|
<ItemListEntry
|
||||||
|
:data="prescriptionItems"
|
||||||
|
@add="addItem"/>
|
||||||
<Separator class="my-5" />
|
<Separator class="my-5" />
|
||||||
|
|
||||||
<div class="w-full flex justify-center">
|
<div class="w-full flex justify-center">
|
||||||
<Nav @click="navClick" />
|
<Nav @click="navClick" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<Dialog
|
||||||
|
v-model:open="mixDialogOpen"
|
||||||
|
:title="recItem?.id ? 'Edit Racikan' : 'Tambah Racikan'"
|
||||||
|
size="xl"
|
||||||
|
prevent-outside
|
||||||
|
>
|
||||||
|
<MixItemEntry
|
||||||
|
:data="data"
|
||||||
|
:items="items"
|
||||||
|
@close="mixDialogOpen = false"
|
||||||
|
@save="saveMix"
|
||||||
|
/>
|
||||||
|
</Dialog>
|
||||||
|
|
||||||
|
<Dialog
|
||||||
|
v-model:open="nonMixDialogOpen"
|
||||||
|
:title="recItem?.id ? 'Edit Non Racikan' : 'Tambah Non Racikan'"
|
||||||
|
size="xl"
|
||||||
|
prevent-outside
|
||||||
|
>
|
||||||
|
<NonMixItemEntry
|
||||||
|
:data="data"
|
||||||
|
:items="items"
|
||||||
|
@close="mixDialogOpen = false"
|
||||||
|
@save="saveNonMix"
|
||||||
|
/>
|
||||||
|
</Dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import Header from '~/components/pub/my-ui/nav-header/prep.vue'
|
|
||||||
|
|
||||||
import { usePaginatedList } from '~/composables/usePaginatedList'
|
import { usePaginatedList } from '~/composables/usePaginatedList'
|
||||||
import { toast } from '~/components/pub/ui/toast'
|
|
||||||
|
|
||||||
|
import { toast } from '~/components/pub/ui/toast'
|
||||||
import { ActionEvents, type HeaderPrep } from '~/components/pub/my-ui/data/types'
|
import { ActionEvents, type HeaderPrep } from '~/components/pub/my-ui/data/types'
|
||||||
|
import Header from '~/components/pub/my-ui/nav-header/prep.vue'
|
||||||
|
import RecordConfirmation from '~/components/pub/my-ui/confirmation/record-confirmation.vue'
|
||||||
|
|
||||||
// Handlers
|
// Handlers
|
||||||
import {
|
import {
|
||||||
@@ -14,6 +14,7 @@ import {
|
|||||||
isReadonly,
|
isReadonly,
|
||||||
isFormEntryDialogOpen,
|
isFormEntryDialogOpen,
|
||||||
isRecordConfirmationOpen,
|
isRecordConfirmationOpen,
|
||||||
|
handleActionRemove,
|
||||||
handleActionSave,
|
handleActionSave,
|
||||||
} from '~/handlers/prescription.handler'
|
} from '~/handlers/prescription.handler'
|
||||||
|
|
||||||
@@ -21,14 +22,13 @@ import {
|
|||||||
import { getList, getDetail } from '~/services/prescription.service'
|
import { getList, getDetail } from '~/services/prescription.service'
|
||||||
import List from '~/components/app/prescription/list.vue'
|
import List from '~/components/app/prescription/list.vue'
|
||||||
import type { Prescription } from '~/models/prescription'
|
import type { Prescription } from '~/models/prescription'
|
||||||
// import { getList as getUnitList } from '~/services/unit.service' // previously uses getList
|
|
||||||
// import { getValueLabelList } from '~/services/unit.service'
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
encounter_id: number
|
encounter_id: number
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
const { setQueryParams } = useQueryParam()
|
||||||
|
|
||||||
const title = ref('')
|
const title = ref('')
|
||||||
|
|
||||||
@@ -40,15 +40,14 @@ const {
|
|||||||
isLoading,
|
isLoading,
|
||||||
paginationMeta,
|
paginationMeta,
|
||||||
searchInput,
|
searchInput,
|
||||||
handlePageChange,
|
|
||||||
handleSearch,
|
|
||||||
fetchData: getMyList,
|
fetchData: getMyList,
|
||||||
} = usePaginatedList<Prescription>({
|
} = usePaginatedList<Prescription>({
|
||||||
fetchFn: async ({ page, search }) => {
|
fetchFn: async ({ page, search }) => {
|
||||||
const result = await getList({
|
const result = await getList({
|
||||||
search,
|
search,
|
||||||
page,
|
page,
|
||||||
'encounter-id': encounter_id
|
'encounter-id': encounter_id,
|
||||||
|
includes: 'doctor,doctor-employee,doctor-employee-person',
|
||||||
})
|
})
|
||||||
return { success: result.success || false, body: result.body || {} }
|
return { success: result.success || false, body: result.body || {} }
|
||||||
},
|
},
|
||||||
@@ -109,26 +108,59 @@ watch([recId, recAction], () => {
|
|||||||
isReadonly.value = false
|
isReadonly.value = false
|
||||||
break
|
break
|
||||||
case ActionEvents.showConfirmDelete:
|
case ActionEvents.showConfirmDelete:
|
||||||
isRecordConfirmationOpen.value = true
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
watch([isFormEntryDialogOpen], () => {
|
watch([isFormEntryDialogOpen], async () => {
|
||||||
if (isFormEntryDialogOpen.value) {
|
if (isFormEntryDialogOpen.value) {
|
||||||
isFormEntryDialogOpen.value = false;
|
isFormEntryDialogOpen.value = false;
|
||||||
handleActionSave({
|
const saveResp = await handleActionSave({ encounter_id }, getMyList, () =>{}, toast)
|
||||||
encounter_id,
|
if (saveResp.success) {
|
||||||
}, getMyList, () =>{}, toast)
|
setQueryParams({
|
||||||
|
'mode': 'entry',
|
||||||
|
'id': saveResp.body?.data?.id.toString()
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
onMounted(async () => {
|
function cancel(data: Prescription) {
|
||||||
})
|
recId.value = data.id
|
||||||
|
recItem.value = data
|
||||||
|
isRecordConfirmationOpen.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
function edit(data: Prescription) {
|
||||||
|
setQueryParams({
|
||||||
|
'mode': 'entry',
|
||||||
|
'id': data.id.toString()
|
||||||
|
})
|
||||||
|
recItem.value = data
|
||||||
|
}
|
||||||
|
|
||||||
|
function submit(data: Prescription) {
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Header :prep="{ ...headerPrep }" />
|
<Header :prep="{ ...headerPrep }" />
|
||||||
|
<List
|
||||||
|
v-if="!isLoading.dataListLoading"
|
||||||
|
:data="data"
|
||||||
|
:pagination-meta="paginationMeta"
|
||||||
|
@cancel="cancel"
|
||||||
|
@edit="edit"
|
||||||
|
@submit="submit"
|
||||||
|
/>
|
||||||
|
|
||||||
<List v-if="!isLoading.dataListLoading" :data="data" :pagination-meta="paginationMeta" />
|
<RecordConfirmation
|
||||||
|
v-model:open="isRecordConfirmationOpen"
|
||||||
|
action="delete"
|
||||||
|
:record="recItem"
|
||||||
|
@confirm="() => handleActionRemove(recId, getMyList, toast)"
|
||||||
|
@cancel=""
|
||||||
|
>
|
||||||
|
</RecordConfirmation>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ const props = defineProps<{
|
|||||||
encounter_id: number
|
encounter_id: number
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const { mode } = useQueryMode()
|
const { mode } = useQueryCRUDMode()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<List v-if="mode === 'list'" :encounter_id="encounter_id" />
|
<List v-if="mode === 'list'" :encounter_id="encounter_id" />
|
||||||
<Entry v-else />
|
<Entry v-else :encounter_id="encounter_id" />
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
|
import { type Base, genBase } from "./_base";
|
||||||
import { type Encounter, genEncounter } from "./encounter";
|
import { type Encounter, genEncounter } from "./encounter";
|
||||||
import { type Doctor, genDoctor } from "./doctor";
|
import { type Doctor, genDoctor } from "./doctor";
|
||||||
import { type PrescriptionItem } from "./prescription-item";
|
import { type PrescriptionItem } from "./prescription-item";
|
||||||
import type { SpecialistIntern } from "./specialist-intern";
|
import type { SpecialistIntern } from "./specialist-intern";
|
||||||
|
|
||||||
export interface Prescription {
|
export interface Prescription extends Base {
|
||||||
id: number
|
|
||||||
encounter_id: number
|
encounter_id: number
|
||||||
encounter: Encounter
|
encounter: Encounter
|
||||||
doctor_id: number
|
doctor_id: number
|
||||||
@@ -44,7 +44,7 @@ export interface DeleteDto {
|
|||||||
|
|
||||||
export function genPresciption(): Prescription {
|
export function genPresciption(): Prescription {
|
||||||
return {
|
return {
|
||||||
id: 0,
|
...genBase(),
|
||||||
encounter_id: 0,
|
encounter_id: 0,
|
||||||
encounter: genEncounter(),
|
encounter: genEncounter(),
|
||||||
doctor_id: 0,
|
doctor_id: 0,
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import * as base from './_crud-base'
|
import * as base from './_crud-base'
|
||||||
|
|
||||||
const path = '/api/v1/prescription'
|
const path = '/api/v1/prescription'
|
||||||
|
const name = 'prescription'
|
||||||
|
|
||||||
export function create(data: any) {
|
export function create(data: any) {
|
||||||
return base.create(path, data)
|
return base.create(path, data)
|
||||||
@@ -10,8 +11,8 @@ export function getList(params: any = null) {
|
|||||||
return base.getList(path, params)
|
return base.getList(path, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getDetail(id: number | string) {
|
export function getDetail(id: number | string, params?: any) {
|
||||||
return base.getDetail(path, id)
|
return base.getDetail(path, id, name, params)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function update(id: number | string, data: any) {
|
export function update(id: number | string, data: any) {
|
||||||
|
|||||||
Reference in New Issue
Block a user