feat/prescription-56: wip

This commit is contained in:
Andrian Roshandy
2025-11-05 21:23:04 +07:00
parent f8d906b6c2
commit 8462eba94b
5 changed files with 133 additions and 0 deletions
@@ -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,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>
+17
View File
@@ -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})
+23
View File
@@ -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)
}