Merge pull request #162 from dikstub-rssa/fe-prescription-56
Fe prescription 56
This commit is contained in:
@@ -0,0 +1,50 @@
|
|||||||
|
import type {
|
||||||
|
Col,
|
||||||
|
KeyLabel,
|
||||||
|
RecComponent,
|
||||||
|
RecStrFuncComponent,
|
||||||
|
RecStrFuncUnknown,
|
||||||
|
Th,
|
||||||
|
} from '~/components/pub/my-ui/data/types'
|
||||||
|
import { defineAsyncComponent } from 'vue'
|
||||||
|
|
||||||
|
type SmallDetailDto = any
|
||||||
|
|
||||||
|
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue'))
|
||||||
|
|
||||||
|
export const cols: Col[] = [{}, {}, {}, {}, {}, {}, { width: 50 }]
|
||||||
|
|
||||||
|
export const header: Th[][] = [
|
||||||
|
[
|
||||||
|
{ label: 'Nama' },
|
||||||
|
{ label: "Dosis" },
|
||||||
|
{ label: 'Satuan' },
|
||||||
|
{ label: '' },
|
||||||
|
],
|
||||||
|
]
|
||||||
|
|
||||||
|
export const keys = ['name', 'dose', 'uom.name', 'action']
|
||||||
|
|
||||||
|
export const delKeyNames: KeyLabel[] = [
|
||||||
|
{ key: 'code', label: 'Kode' },
|
||||||
|
{ key: 'name', label: 'Nama' },
|
||||||
|
]
|
||||||
|
|
||||||
|
export const funcParsed: RecStrFuncUnknown = {
|
||||||
|
group: (rec: unknown): unknown => {
|
||||||
|
return (rec as SmallDetailDto).medicineGroup_code || '-'
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
export const funcComponent: RecStrFuncComponent = {
|
||||||
|
action: (rec: unknown, idx: number): RecComponent => {
|
||||||
|
const res: RecComponent = {
|
||||||
|
idx,
|
||||||
|
rec: rec as object,
|
||||||
|
component: action,
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
export const funcHtml: RecStrFuncUnknown = {}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
|
||||||
|
import PaginationView from '~/components/pub/my-ui/pagination/pagination-view.vue'
|
||||||
|
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-entry'
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
data: any[]
|
||||||
|
paginationMeta: PaginationMeta
|
||||||
|
}
|
||||||
|
|
||||||
|
defineProps<Props>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
pageChange: [page: number]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
function handlePageChange(page: number) {
|
||||||
|
emit('pageChange', page)
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="space-y-4">
|
||||||
|
<PubBaseDataTable
|
||||||
|
:rows="data"
|
||||||
|
:cols="cols"
|
||||||
|
:header="header"
|
||||||
|
:keys="keys"
|
||||||
|
:func-parsed="funcParsed"
|
||||||
|
:func-html="funcHtml"
|
||||||
|
:func-component="funcComponent"
|
||||||
|
/>
|
||||||
|
<PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -1,14 +1,30 @@
|
|||||||
<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<{
|
||||||
|
add: [mode: 'mix' | 'non-mix']
|
||||||
|
}>()
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<PubMyUiDataTable
|
<PubMyUiDataTable class="border mb-3 2xl:mb-4"
|
||||||
v-bind="config"
|
v-bind="config"
|
||||||
:rows="data"
|
:rows="data"
|
||||||
/>
|
/>
|
||||||
|
<div class="-mx-1 [&_button]:mx-1">
|
||||||
|
<Button @click="emit('add', 'mix')">
|
||||||
|
<Icon name="i-lucide-plus" />
|
||||||
|
Tambah Racikan
|
||||||
|
</Button>
|
||||||
|
<Button @click="emit('add', 'non-mix')">
|
||||||
|
<Icon name="i-lucide-plus" />
|
||||||
|
Tambah Non Racikan
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
import type { Config } from '~/components/pub/my-ui/data-table'
|
||||||
|
import { defineAsyncComponent } from 'vue'
|
||||||
|
|
||||||
|
type SmallDetailDto = any
|
||||||
|
|
||||||
|
export const config: Config = {
|
||||||
|
cols: [{}, {}, {}, {}, {}, {}],
|
||||||
|
|
||||||
|
headers: [
|
||||||
|
[
|
||||||
|
{ label: 'Nama' },
|
||||||
|
{ label: 'Bentuk' },
|
||||||
|
{ label: 'Freq' },
|
||||||
|
{ label: 'Dosis' },
|
||||||
|
{ label: 'Interval' },
|
||||||
|
{ label: 'Total' },
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
keys: ['name', 'uom_code', 'frequency', 'multiplier', 'interval', 'total'],
|
||||||
|
|
||||||
|
delKeyNames: [
|
||||||
|
{ key: 'code', label: 'Kode' },
|
||||||
|
{ key: 'name', label: 'Nama' },
|
||||||
|
],
|
||||||
|
|
||||||
|
parses: {
|
||||||
|
cateogry: (rec: unknown): unknown => {
|
||||||
|
return (rec as SmallDetailDto).medicineCategory?.name || '-'
|
||||||
|
},
|
||||||
|
group: (rec: unknown): unknown => {
|
||||||
|
return (rec as SmallDetailDto).medicineGroup?.name || '-'
|
||||||
|
},
|
||||||
|
method: (rec: unknown): unknown => {
|
||||||
|
return (rec as SmallDetailDto).medicineMethod?.name || '-'
|
||||||
|
},
|
||||||
|
unit: (rec: unknown): unknown => {
|
||||||
|
return (rec as SmallDetailDto).medicineUnit?.name || '-'
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import type { PrescriptionItem } from '~/models/prescription-item';
|
||||||
|
import { config } from './list.cfg'
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
data: PrescriptionItem[]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
tambah: [mode: string]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<PubMyUiDataTable class="border mb-2 2xl:mb-3"
|
||||||
|
v-bind="config"
|
||||||
|
:rows="data"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
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>
|
||||||
|
|
||||||
|
<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 v-model="data.frequency" /></DE.Field>
|
||||||
|
</DE.Cell>
|
||||||
|
<DE.Cell>
|
||||||
|
<DE.Label>Dosis</DE.Label>
|
||||||
|
<DE.Field><Input v-model="data.dose" /></DE.Field>
|
||||||
|
</DE.Cell>
|
||||||
|
<DE.Cell>
|
||||||
|
<DE.Label>Sediaan</DE.Label>
|
||||||
|
<DE.Field><Input :value="data.medicineMix?.uom_code" /></DE.Field>
|
||||||
|
</DE.Cell>
|
||||||
|
<DE.Cell>
|
||||||
|
<DE.Label>Total</DE.Label>
|
||||||
|
<DE.Field><Input /></DE.Field>
|
||||||
|
</DE.Cell>
|
||||||
|
<DE.Cell :colSpan="5">
|
||||||
|
<DE.Label>Cara Pakai</DE.Label>
|
||||||
|
<DE.Field><Input /></DE.Field>
|
||||||
|
</DE.Cell>
|
||||||
|
</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>
|
||||||
@@ -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>
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import * as DE from '~/components/pub/my-ui/doc-entry'
|
||||||
|
import type { Prescription } from '~/models/prescription'
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
data: Prescription
|
||||||
|
}>()
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="text-sm 2xl:text-base font-semibold mb-3">
|
||||||
|
Order {{ data.issuedAt?.substring(0, 10) || data.createdAt?.substring(0, 10) }} - {{ data.status_code }}
|
||||||
|
</div>
|
||||||
|
<div class="max-w-[1000px]">
|
||||||
|
<DE.Block mode="preview" :col-count=5 class="!mb-3">
|
||||||
|
<DE.Cell :col-span="2">
|
||||||
|
<DE.Label class="font-semibold">DPJP</DE.Label>
|
||||||
|
<DE.Field>
|
||||||
|
{{ data.doctor?.employee?.person?.name || '.........' }}
|
||||||
|
</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>
|
||||||
|
</template>
|
||||||
@@ -1,32 +1,36 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div class="md:grid md:grid-cols-2 font-semibold">
|
||||||
<PubMyUiDocEntryBlock mode="preview" :colCount=3>
|
<div class="md:pe-10">
|
||||||
<PubMyUiDocEntryCell>
|
<PubMyUiDocEntryBlock>
|
||||||
<PubMyUiDocEntryLabel>DPJP</PubMyUiDocEntryLabel>
|
<PubMyUiDocEntryCell>
|
||||||
<PubMyUiDocEntryField>
|
<PubMyUiDocEntryLabel>Tgl Order</PubMyUiDocEntryLabel>
|
||||||
<Input />
|
<PubMyUiDocEntryField>
|
||||||
</PubMyUiDocEntryField>
|
<Input />
|
||||||
</PubMyUiDocEntryCell>
|
</PubMyUiDocEntryField>
|
||||||
<PubMyUiDocEntryCell />
|
</PubMyUiDocEntryCell>
|
||||||
<PubMyUiDocEntryCell>
|
<PubMyUiDocEntryCell>
|
||||||
<PubMyUiDocEntryLabel>Tgl Order</PubMyUiDocEntryLabel>
|
<PubMyUiDocEntryLabel>Status</PubMyUiDocEntryLabel>
|
||||||
<PubMyUiDocEntryField>
|
<PubMyUiDocEntryField>
|
||||||
<Input />
|
<Input />
|
||||||
</PubMyUiDocEntryField>
|
</PubMyUiDocEntryField>
|
||||||
</PubMyUiDocEntryCell>
|
</PubMyUiDocEntryCell>
|
||||||
<PubMyUiDocEntryCell>
|
</PubMyUiDocEntryBlock>
|
||||||
<PubMyUiDocEntryLabel>DPJP</PubMyUiDocEntryLabel>
|
</div>
|
||||||
<PubMyUiDocEntryField>
|
<div class="md:ps-10">
|
||||||
<Input />
|
<PubMyUiDocEntryBlock>
|
||||||
</PubMyUiDocEntryField>
|
<PubMyUiDocEntryCell>
|
||||||
</PubMyUiDocEntryCell>
|
<PubMyUiDocEntryLabel position="dynamic">DPJP</PubMyUiDocEntryLabel>
|
||||||
<PubMyUiDocEntryCell />
|
<PubMyUiDocEntryField>
|
||||||
<PubMyUiDocEntryCell>
|
<Input />
|
||||||
<PubMyUiDocEntryLabel>Status</PubMyUiDocEntryLabel>
|
</PubMyUiDocEntryField>
|
||||||
<PubMyUiDocEntryField>
|
</PubMyUiDocEntryCell>
|
||||||
<Input />
|
<PubMyUiDocEntryCell>
|
||||||
</PubMyUiDocEntryField>
|
<PubMyUiDocEntryLabel position="dynamic">PPDS</PubMyUiDocEntryLabel>
|
||||||
</PubMyUiDocEntryCell>
|
<PubMyUiDocEntryField>
|
||||||
</PubMyUiDocEntryBlock>
|
<Input />
|
||||||
|
</PubMyUiDocEntryField>
|
||||||
|
</PubMyUiDocEntryCell>
|
||||||
|
</PubMyUiDocEntryBlock>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -0,0 +1,88 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
|
||||||
|
import type { Prescription } from '~/models/prescription'
|
||||||
|
|
||||||
|
import * as DE from '~/components/pub/my-ui/doc-entry';
|
||||||
|
import PrescriptionItemList from '~/components/app/prescription-item/list-entry.vue';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
data: Prescription[]
|
||||||
|
isLoading: boolean
|
||||||
|
paginationMeta?: PaginationMeta
|
||||||
|
}
|
||||||
|
|
||||||
|
defineProps<Props>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div v-if="isLoading" class="p-10 text-center">
|
||||||
|
Memuat data..
|
||||||
|
</div>
|
||||||
|
<div v-else-if="data && data.length == 0" class="p-10 text-center">
|
||||||
|
<div class="mb-4 xl:mb-5">Belum Ada Data</div>
|
||||||
|
<!-- <div>
|
||||||
|
<Button>
|
||||||
|
<Icon name="i-lucide-plus" class="me-2 align-middle" />
|
||||||
|
Tambah Order
|
||||||
|
</Button>
|
||||||
|
</div> -->
|
||||||
|
</div>
|
||||||
|
<div v-else v-for="(item, idx) in data">
|
||||||
|
<Separator class="my-5" />
|
||||||
|
<div class="md:grid md:grid-cols-2 font-semibold">
|
||||||
|
<div>
|
||||||
|
<DE.Block mode="preview">
|
||||||
|
<DE.Cell>
|
||||||
|
<DE.Label>Order #{{ data.length - idx }}</DE.Label>
|
||||||
|
<DE.Field>
|
||||||
|
2025-01-01
|
||||||
|
</DE.Field>
|
||||||
|
</DE.Cell>
|
||||||
|
<DE.Cell>
|
||||||
|
<DE.Label>Status</DE.Label>
|
||||||
|
<DE.Field>
|
||||||
|
{{ item.status_code }}
|
||||||
|
</DE.Field>
|
||||||
|
</DE.Cell>
|
||||||
|
</DE.Block>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<DE.Block mode="preview">
|
||||||
|
<DE.Cell>
|
||||||
|
<DE.Label>DPJP</DE.Label>
|
||||||
|
<DE.Field>
|
||||||
|
{{ item.doctor?.employee?.person.name }}
|
||||||
|
</DE.Field>
|
||||||
|
</DE.Cell>
|
||||||
|
<DE.Cell>
|
||||||
|
<DE.Label>PPDS</DE.Label>
|
||||||
|
<DE.Field>
|
||||||
|
{{ item.specialistIntern?.person.name }}
|
||||||
|
</DE.Field>
|
||||||
|
</DE.Cell>
|
||||||
|
</DE.Block>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<PrescriptionItemList :data="item.items || []" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- <Separator class="my-4 xl:my-5" />
|
||||||
|
<AppPrescriptionEntry />
|
||||||
|
<div class="flex content-center mb-3">
|
||||||
|
<div class="me-auto pt-2">
|
||||||
|
<div class="font-semibold md:text-sm xl:text-base">Daftar Obat</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<Button @click="addMedicine" class="me-2">
|
||||||
|
<Icon name="i-lucide-plus" />
|
||||||
|
Tambah Non Racikan
|
||||||
|
</Button>
|
||||||
|
<Button @click="addMedicineMix">
|
||||||
|
<Icon name="i-lucide-plus" />
|
||||||
|
Tambah Racikan
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<PrescriptionItemListEntry :data=[] /> -->
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
// import { Block, Cell } from '~/components/pub/my-ui/doc-entry/index'
|
||||||
|
// import Block from '~/components/pub/my-ui/doc-entry/block.vue'
|
||||||
|
// import Cell from '~/components/pub/my-ui/doc-entry/cell.vue'
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="p-10 text-center">
|
||||||
|
<div class="mb-4 xl:mb-5">Belum Ada Data</div>
|
||||||
|
<div>
|
||||||
|
<Button>
|
||||||
|
<Icon name="i-lucide-plus" class="me-2 align-middle" />
|
||||||
|
Tambah Order
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<Separator class="my-5" />
|
||||||
|
<div class="md:grid md:grid-cols-2 font-semibold">
|
||||||
|
<div>
|
||||||
|
<PubCustomUiDocEntryBlock mode="preview">
|
||||||
|
<PubCustomUiDocEntryCell>
|
||||||
|
<PubCustomUiDocEntryLabel>Order #1</PubCustomUiDocEntryLabel>
|
||||||
|
<PubCustomUiDocEntryColon />
|
||||||
|
<PubCustomUiDocEntryField>
|
||||||
|
2025-01-01
|
||||||
|
</PubCustomUiDocEntryField>
|
||||||
|
</PubCustomUiDocEntryCell>
|
||||||
|
<PubCustomUiDocEntryCell>
|
||||||
|
<PubCustomUiDocEntryLabel>Status</PubCustomUiDocEntryLabel>
|
||||||
|
<PubCustomUiDocEntryColon />
|
||||||
|
<PubCustomUiDocEntryField>
|
||||||
|
Status
|
||||||
|
</PubCustomUiDocEntryField>
|
||||||
|
</PubCustomUiDocEntryCell>
|
||||||
|
</PubCustomUiDocEntryBlock>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<PubCustomUiDocEntryBlock mode="preview">
|
||||||
|
<PubCustomUiDocEntryCell>
|
||||||
|
<PubCustomUiDocEntryLabel>DPJP</PubCustomUiDocEntryLabel>
|
||||||
|
<PubCustomUiDocEntryColon />
|
||||||
|
<PubCustomUiDocEntryField>
|
||||||
|
Nama Dokter
|
||||||
|
</PubCustomUiDocEntryField>
|
||||||
|
</PubCustomUiDocEntryCell>
|
||||||
|
<PubCustomUiDocEntryCell>
|
||||||
|
<PubCustomUiDocEntryLabel>PPDS</PubCustomUiDocEntryLabel>
|
||||||
|
<PubCustomUiDocEntryColon />
|
||||||
|
<PubCustomUiDocEntryField>
|
||||||
|
Nama PPDS
|
||||||
|
</PubCustomUiDocEntryField>
|
||||||
|
</PubCustomUiDocEntryCell>
|
||||||
|
</PubCustomUiDocEntryBlock>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -1,5 +1,37 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import * as DE from '~/components/pub/my-ui/doc-entry';
|
||||||
|
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 PrescriptionItem from '~/components/app/prescription-item/list.vue';
|
||||||
|
import { add } from 'date-fns';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
data: Prescription[]
|
||||||
|
paginationMeta: PaginationMeta
|
||||||
|
}
|
||||||
|
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>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="p-10 text-center">
|
<div v-if="data.length == 0" 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>
|
||||||
@@ -8,35 +40,33 @@
|
|||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Separator class="my-5" />
|
<template v-for="item, idx in data">
|
||||||
<div>
|
<div :class="'text-sm 2xl:text-base font-semibold ' + (item.status_code == 'new' ? 'mb-2' : 'mb-2')">
|
||||||
<PubMyUiDocEntryBlock mode="preview" :colCount=3>
|
Order #{{ data.length - idx }} - {{ item.issuedAt?.substring(0, 10) || item.createdAt?.substring(0, 10) }} - {{ item.status_code }}
|
||||||
<PubMyUiDocEntryCell>
|
</div>
|
||||||
<PubMyUiDocEntryLabel>DPJP</PubMyUiDocEntryLabel>
|
<DE.Block mode="preview" :col-count="7" class="!mb-3">
|
||||||
<PubMyUiDocEntryField>
|
<DE.Cell :col-span="3">
|
||||||
<Input />
|
<DE.Label :class="'font-semibold ' + (item.status_code == 'new' ? 'pt-2' : '')">DPJP</DE.Label>
|
||||||
</PubMyUiDocEntryField>
|
<DE.Field :class="item.status_code == 'new' ? 'pt-2' : ''">
|
||||||
</PubMyUiDocEntryCell>
|
{{ item.doctor?.employee?.person?.name || '-' }}
|
||||||
<PubMyUiDocEntryCell />
|
</DE.Field>
|
||||||
<PubMyUiDocEntryCell>
|
</DE.Cell>
|
||||||
<PubMyUiDocEntryLabel>Tgl Order</PubMyUiDocEntryLabel>
|
<DE.Cell :col-span="3">
|
||||||
<PubMyUiDocEntryField>
|
<DE.Label :class="'font-semibold ' + (item.status_code == 'new' ? 'pt-2' : '')">PPDS</DE.Label>
|
||||||
<Input />
|
<DE.Field :class="item.status_code == 'new' ? 'pt-2' : ''">
|
||||||
</PubMyUiDocEntryField>
|
...........
|
||||||
</PubMyUiDocEntryCell>
|
</DE.Field>
|
||||||
<PubMyUiDocEntryCell>
|
</DE.Cell>
|
||||||
<PubMyUiDocEntryLabel>DPJP</PubMyUiDocEntryLabel>
|
<div class="flex justify-end" >
|
||||||
<PubMyUiDocEntryField>
|
<Nav
|
||||||
<Input />
|
v-if="item.status_code == 'new'"
|
||||||
</PubMyUiDocEntryField>
|
:small-mode="true"
|
||||||
</PubMyUiDocEntryCell>
|
:default-class="'flex gap-1'"
|
||||||
<PubMyUiDocEntryCell />
|
@click="(type) => { navClick(type, item) }"
|
||||||
<PubMyUiDocEntryCell>
|
/>
|
||||||
<PubMyUiDocEntryLabel>Status</PubMyUiDocEntryLabel>
|
</div>
|
||||||
<PubMyUiDocEntryField>
|
</DE.Block>
|
||||||
<Input />
|
<PrescriptionItem :data="item.items || []" @click="console.log('click')" class="mb-10" />
|
||||||
</PubMyUiDocEntryField>
|
<!-- <div v-if="idx < data.length - 1" class="my-8 -mx-4 border-t border-t-slate-300" /> -->
|
||||||
</PubMyUiDocEntryCell>
|
</template>
|
||||||
</PubMyUiDocEntryBlock>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import Status from '~/components/content/encounter/status.vue'
|
|||||||
import AssesmentFunctionList from '~/components/content/soapi/entry.vue'
|
import AssesmentFunctionList from '~/components/content/soapi/entry.vue'
|
||||||
import EarlyMedicalAssesmentList from '~/components/content/soapi/entry.vue'
|
import EarlyMedicalAssesmentList from '~/components/content/soapi/entry.vue'
|
||||||
import EarlyMedicalRehabList from '~/components/content/soapi/entry.vue'
|
import EarlyMedicalRehabList from '~/components/content/soapi/entry.vue'
|
||||||
import PrescriptionList from '~/components/content/prescription/list.vue'
|
import Prescription from '~/components/content/prescription/main.vue'
|
||||||
import CpLabOrder from '~/components/content/cp-lab-order/main.vue'
|
import CpLabOrder from '~/components/content/cp-lab-order/main.vue'
|
||||||
import Radiology from '~/components/content/radiology-order/main.vue'
|
import Radiology from '~/components/content/radiology-order/main.vue'
|
||||||
import Consultation from '~/components/content/consultation/list.vue'
|
import Consultation from '~/components/content/consultation/list.vue'
|
||||||
@@ -62,7 +62,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', component: Radiology, props: { encounter_id: data.id } },
|
{ value: 'mcu-radiology', label: 'Order Radiologi', component: Radiology, props: { encounter_id: data.id } },
|
||||||
{ value: 'mcu-lab-cp', label: 'Order Lab PK', component: CpLabOrder, props: { encounter_id: data.id } },
|
{ value: 'mcu-lab-cp', label: 'Order Lab PK', component: CpLabOrder, props: { encounter_id: data.id } },
|
||||||
|
|||||||
@@ -0,0 +1,132 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
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 Dialog from '~/components/pub/my-ui/modal/dialog.vue'
|
||||||
|
|
||||||
|
import { useQueryCRUDMode } from '~/composables/useQueryCRUD'
|
||||||
|
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 headerPrep: HeaderPrep = {
|
||||||
|
title: 'Tambah Order Obat / Resep',
|
||||||
|
icon: 'i-lucide-box',
|
||||||
|
}
|
||||||
|
|
||||||
|
const mixDialogOpen = ref(false)
|
||||||
|
const nonMixDialogOpen = ref(false)
|
||||||
|
|
||||||
|
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>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Header
|
||||||
|
:prep="headerPrep"
|
||||||
|
:ref-search-nav="headerPrep.refSearchNav"
|
||||||
|
class="mb-4 xl:mb-5"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Detail :data="data" />
|
||||||
|
|
||||||
|
<ItemListEntry
|
||||||
|
:data="prescriptionItems"
|
||||||
|
@add="addItem"/>
|
||||||
|
<Separator class="my-5" />
|
||||||
|
|
||||||
|
<div class="w-full flex justify-center">
|
||||||
|
<Nav @click="navClick" />
|
||||||
|
</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>
|
||||||
@@ -1,37 +1,82 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { DataTableLoader } from '~/components/pub/my-ui/data-table/type'
|
import { usePaginatedList } from '~/composables/usePaginatedList'
|
||||||
import type { HeaderPrep, RefSearchNav } from '~/components/pub/my-ui/data/types'
|
|
||||||
|
import { toast } from '~/components/pub/ui/toast'
|
||||||
|
import { ActionEvents, type HeaderPrep } from '~/components/pub/my-ui/data/types'
|
||||||
import Header from '~/components/pub/my-ui/nav-header/prep.vue'
|
import Header from '~/components/pub/my-ui/nav-header/prep.vue'
|
||||||
import PrescriptionItemListEntry from '~/components/app/prescription-item/list-entry.vue'
|
import RecordConfirmation from '~/components/pub/my-ui/confirmation/record-confirmation.vue'
|
||||||
|
|
||||||
const data = ref([])
|
// Handlers
|
||||||
|
import {
|
||||||
|
recId,
|
||||||
|
recAction,
|
||||||
|
recItem,
|
||||||
|
isReadonly,
|
||||||
|
isFormEntryDialogOpen,
|
||||||
|
isRecordConfirmationOpen,
|
||||||
|
handleActionRemove,
|
||||||
|
handleActionSave,
|
||||||
|
} from '~/handlers/prescription.handler'
|
||||||
|
|
||||||
const refSearchNav: RefSearchNav = {
|
// Services
|
||||||
onClick: () => {
|
import { getList, getDetail } from '~/services/prescription.service'
|
||||||
// open filter modal
|
import List from '~/components/app/prescription/list.vue'
|
||||||
},
|
import type { Prescription } from '~/models/prescription'
|
||||||
onInput: (_val: string) => {
|
|
||||||
// filter patient list
|
|
||||||
},
|
|
||||||
onClear: () => {
|
|
||||||
// clear url param
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
const isLoading = reactive<DataTableLoader>({
|
const props = defineProps<{
|
||||||
isTableLoading: false,
|
encounter_id: number
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const route = useRoute()
|
||||||
|
const { setQueryParams } = useQueryParam()
|
||||||
|
|
||||||
|
const title = ref('')
|
||||||
|
|
||||||
|
const plainEid = route.params.id
|
||||||
|
const encounter_id = (plainEid && typeof plainEid == 'string') ? parseInt(plainEid) : 0
|
||||||
|
|
||||||
|
const {
|
||||||
|
data,
|
||||||
|
isLoading,
|
||||||
|
paginationMeta,
|
||||||
|
searchInput,
|
||||||
|
fetchData: getMyList,
|
||||||
|
} = usePaginatedList<Prescription>({
|
||||||
|
fetchFn: async ({ page, search }) => {
|
||||||
|
const result = await getList({
|
||||||
|
search,
|
||||||
|
page,
|
||||||
|
'encounter-id': encounter_id,
|
||||||
|
includes: 'doctor,doctor-employee,doctor-employee-person',
|
||||||
|
})
|
||||||
|
return { success: result.success || false, body: result.body || {} }
|
||||||
|
},
|
||||||
|
entityName: 'prescription'
|
||||||
})
|
})
|
||||||
|
|
||||||
const recId = ref<number>(0)
|
|
||||||
const recAction = ref<string>('')
|
|
||||||
const recItem = ref<any>(null)
|
|
||||||
|
|
||||||
const headerPrep: HeaderPrep = {
|
const headerPrep: HeaderPrep = {
|
||||||
title: 'Resep Obat',
|
title: 'Order Obat',
|
||||||
icon: 'i-lucide-panel-bottom',
|
icon: 'i-lucide-box',
|
||||||
|
refSearchNav: {
|
||||||
|
placeholder: 'Cari (min. 3 karakter)...',
|
||||||
|
minLength: 3,
|
||||||
|
debounceMs: 500,
|
||||||
|
showValidationFeedback: true,
|
||||||
|
onInput: (value: string) => {
|
||||||
|
searchInput.value = value
|
||||||
|
},
|
||||||
|
onClick: () => {},
|
||||||
|
onClear: () => {},
|
||||||
|
},
|
||||||
addNav: {
|
addNav: {
|
||||||
label: 'Tambah',
|
label: 'Tambah',
|
||||||
onClick: () => navigateTo('/tools-equipment-src/equipment/add'),
|
icon: 'i-lucide-plus',
|
||||||
|
onClick: () => {
|
||||||
|
recItem.value = null
|
||||||
|
recId.value = 0
|
||||||
|
isFormEntryDialogOpen.value = true
|
||||||
|
isReadonly.value = false
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,33 +85,82 @@ provide('rec_action', recAction)
|
|||||||
provide('rec_item', recItem)
|
provide('rec_item', recItem)
|
||||||
provide('table_data_loader', isLoading)
|
provide('table_data_loader', isLoading)
|
||||||
|
|
||||||
onMounted(() => {
|
const getMyDetail = async (id: number | string) => {
|
||||||
getMaterialList()
|
const result = await getDetail(id)
|
||||||
|
if (result.success) {
|
||||||
|
const currentValue = result.body?.data || {}
|
||||||
|
recItem.value = currentValue
|
||||||
|
isFormEntryDialogOpen.value = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Watch for row actions when recId or recAction changes
|
||||||
|
watch([recId, recAction], () => {
|
||||||
|
switch (recAction.value) {
|
||||||
|
case ActionEvents.showDetail:
|
||||||
|
getMyDetail(recId.value)
|
||||||
|
title.value = 'Detail Konsultasi'
|
||||||
|
isReadonly.value = true
|
||||||
|
break
|
||||||
|
case ActionEvents.showEdit:
|
||||||
|
getMyDetail(recId.value)
|
||||||
|
title.value = 'Edit Konsultasi'
|
||||||
|
isReadonly.value = false
|
||||||
|
break
|
||||||
|
case ActionEvents.showConfirmDelete:
|
||||||
|
break
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
async function getMaterialList() {
|
watch([isFormEntryDialogOpen], async () => {
|
||||||
isLoading.dataListLoading = true
|
if (isFormEntryDialogOpen.value) {
|
||||||
|
isFormEntryDialogOpen.value = false;
|
||||||
|
const saveResp = await handleActionSave({ encounter_id }, getMyList, () =>{}, toast)
|
||||||
|
if (saveResp.success) {
|
||||||
|
setQueryParams({
|
||||||
|
'mode': 'entry',
|
||||||
|
'id': saveResp.body?.data?.id.toString()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
// const resp = await xfetch('/api/v1/material')
|
function cancel(data: Prescription) {
|
||||||
// if (resp.success) {
|
recId.value = data.id
|
||||||
// data.value = (resp.body as Record<string, any>).data
|
recItem.value = data
|
||||||
// }
|
isRecordConfirmationOpen.value = true
|
||||||
|
|
||||||
isLoading.dataListLoading = false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 }" :ref-search-nav="refSearchNav" />
|
<Header :prep="{ ...headerPrep }" />
|
||||||
|
<List
|
||||||
|
v-if="!isLoading.dataListLoading"
|
||||||
|
:data="data"
|
||||||
|
:pagination-meta="paginationMeta"
|
||||||
|
@cancel="cancel"
|
||||||
|
@edit="edit"
|
||||||
|
@submit="submit"
|
||||||
|
/>
|
||||||
|
|
||||||
<AppPrescriptionList v-if="!isLoading.dataListLoading" />
|
<RecordConfirmation
|
||||||
|
v-model:open="isRecordConfirmationOpen"
|
||||||
<AppPrescriptionEntry />
|
action="delete"
|
||||||
|
:record="recItem"
|
||||||
<PrescriptionItemListEntry :data=[] />
|
@confirm="() => handleActionRemove(recId, getMyList, toast)"
|
||||||
<div>
|
@cancel=""
|
||||||
<Button>
|
>
|
||||||
Tambah
|
</RecordConfirmation>
|
||||||
</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 } = useQueryCRUDMode()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<List v-if="mode === 'list'" :encounter_id="encounter_id" />
|
||||||
|
<Entry v-else :encounter_id="encounter_id" />
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import { createCrudHandler, genCrudHandler } from '~/handlers/_handler'
|
||||||
|
import { create, update, remove } from '~/services/prescription-item.service'
|
||||||
|
|
||||||
|
export const {
|
||||||
|
recId,
|
||||||
|
recAction,
|
||||||
|
recItem,
|
||||||
|
isReadonly,
|
||||||
|
isProcessing,
|
||||||
|
isFormEntryDialogOpen,
|
||||||
|
isRecordConfirmationOpen,
|
||||||
|
onResetState,
|
||||||
|
handleActionSave,
|
||||||
|
handleActionEdit,
|
||||||
|
handleActionRemove,
|
||||||
|
handleCancelForm,
|
||||||
|
} = genCrudHandler({ create, update, remove})
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import { createCrudHandler, genCrudHandler } from '~/handlers/_handler'
|
||||||
|
import { create, update, remove } from '~/services/prescription.service'
|
||||||
|
|
||||||
|
export const {
|
||||||
|
recId,
|
||||||
|
recAction,
|
||||||
|
recItem,
|
||||||
|
isReadonly,
|
||||||
|
isProcessing,
|
||||||
|
isFormEntryDialogOpen,
|
||||||
|
isRecordConfirmationOpen,
|
||||||
|
onResetState,
|
||||||
|
handleActionSave,
|
||||||
|
handleActionEdit,
|
||||||
|
handleActionRemove,
|
||||||
|
handleCancelForm,
|
||||||
|
} = genCrudHandler({ create, update, remove})
|
||||||
@@ -28,9 +28,10 @@ export interface DeleteDto {
|
|||||||
|
|
||||||
export function genCreateDto(): CreateDto {
|
export function genCreateDto(): CreateDto {
|
||||||
return {
|
return {
|
||||||
|
date: '',
|
||||||
encounter_id: 0,
|
encounter_id: 0,
|
||||||
problem: '',
|
problem: '',
|
||||||
unit_id: 0,
|
dstUnit_id: 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import { z } from 'zod'
|
||||||
|
import type { PrescriptionItem } from '~/models/prescription-item'
|
||||||
|
|
||||||
|
const PrescriptionItemSchema = z.object({
|
||||||
|
})
|
||||||
|
|
||||||
|
type PrescriptionItemFormData = z.infer<typeof PrescriptionItemSchema> & PrescriptionItem
|
||||||
|
|
||||||
|
export { PrescriptionItemSchema }
|
||||||
|
export type { PrescriptionItemFormData }
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import { z } from 'zod'
|
||||||
|
import type { Prescription } from '~/models/prescription'
|
||||||
|
|
||||||
|
const PrescriptionSchema = z.object({
|
||||||
|
'encounter-id': z.number().nullable().optional(),
|
||||||
|
})
|
||||||
|
|
||||||
|
type PrescriptionFormData = z.infer<typeof PrescriptionSchema> & Prescription
|
||||||
|
|
||||||
|
export { PrescriptionSchema }
|
||||||
|
export type { PrescriptionFormData }
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import * as base from './_crud-base'
|
||||||
|
|
||||||
|
const path = '/api/v1/prescription-item'
|
||||||
|
|
||||||
|
export function create(data: any) {
|
||||||
|
return base.create(path, data)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getList(params: any = null) {
|
||||||
|
return base.getList(path, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getDetail(id: number | string) {
|
||||||
|
return base.getDetail(path, id)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function update(id: number | string, data: any) {
|
||||||
|
return base.update(path, id, data)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function remove(id: number | string) {
|
||||||
|
return base.remove(path, id)
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import * as base from './_crud-base'
|
||||||
|
|
||||||
|
const path = '/api/v1/prescription'
|
||||||
|
const name = 'prescription'
|
||||||
|
|
||||||
|
export function create(data: any) {
|
||||||
|
return base.create(path, data)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getList(params: any = null) {
|
||||||
|
return base.getList(path, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getDetail(id: number | string, params?: any) {
|
||||||
|
return base.getDetail(path, id, name, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function update(id: number | string, data: any) {
|
||||||
|
return base.update(path, id, data)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function remove(id: number | string) {
|
||||||
|
return base.remove(path, id)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user