Merge pull request #210 from dikstub-rssa/feat/procedure-room-order
Feat/procedure room order
This commit is contained in:
@@ -0,0 +1,23 @@
|
|||||||
|
import type { Config } from '~/components/pub/my-ui/data-table'
|
||||||
|
|
||||||
|
type SmallDetailDto = any
|
||||||
|
|
||||||
|
export const config: Config = {
|
||||||
|
cols: [ { width: 150 }, {}, { width: 150 }],
|
||||||
|
|
||||||
|
headers: [
|
||||||
|
[
|
||||||
|
{ label: 'No' },
|
||||||
|
{ label: 'Name' },
|
||||||
|
{ label: 'Jumlah' },
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
keys: ['number', 'material.name', 'count'],
|
||||||
|
|
||||||
|
parses: {
|
||||||
|
number: (rec: unknown): unknown => {
|
||||||
|
return (rec as SmallDetailDto).medicineGroup?.name || '-'
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
//
|
||||||
|
import DataTable from '~/components/pub/my-ui/data-table/data-table.vue'
|
||||||
|
|
||||||
|
// Configs
|
||||||
|
import { config } from './quick-list.cfg'
|
||||||
|
import type { MaterialPackageItem } from '~/models/material-package-item';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
data: MaterialPackageItem[]
|
||||||
|
}
|
||||||
|
|
||||||
|
defineProps<Props>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="mb-4">
|
||||||
|
<div class="font-semibold text-sm 2xl:text-base mb-2">
|
||||||
|
Daftar Item BMHP
|
||||||
|
</div>
|
||||||
|
<DataTable v-bind="config" :rows="data" class="border"/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
//
|
||||||
|
import * as CB from '~/components/pub/my-ui/combobox'
|
||||||
|
import type { MaterialPackage } from '~/models/material-package';
|
||||||
|
|
||||||
|
//
|
||||||
|
const props =defineProps<{
|
||||||
|
data: MaterialPackage[]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const model = defineModel()
|
||||||
|
|
||||||
|
const items = computed(() => {
|
||||||
|
return props.data.map((item) => {
|
||||||
|
return {
|
||||||
|
label: item.name,
|
||||||
|
value: item.code,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="mb-4 2xl:mb-5">
|
||||||
|
<div class="font-semibold text-sm 2xl:text-base mb-2">
|
||||||
|
Paket BMHP
|
||||||
|
</div>
|
||||||
|
<div class="max-w-[600px]">
|
||||||
|
<CB.Combobox :items="items" v-model="model" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import type { Config } from '~/components/pub/my-ui/data-table'
|
||||||
|
import { defineAsyncComponent } from 'vue'
|
||||||
|
|
||||||
|
export const config: Config = {
|
||||||
|
cols: [{}, {}, { classVal: '!p-0.5' }],
|
||||||
|
|
||||||
|
headers: [
|
||||||
|
[
|
||||||
|
{ label: 'Kode' },
|
||||||
|
{ label: 'Nama' },
|
||||||
|
{ label: 'Catatan' },
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
keys: ['procedureRoom.code', 'procedureRoom.infra.name', 'note'],
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import DataTable from '~/components/pub/my-ui/data-table/data-table.vue'
|
||||||
|
|
||||||
|
import { config } from './list-detail.cfg'
|
||||||
|
import type { ProcedureRoomOrderItem } from '~/models/procedure-room-order-item';
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
data: ProcedureRoomOrderItem[]
|
||||||
|
}>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="mb-4 2xl:mb-5">
|
||||||
|
<div class="font-semibold text-sm 2xl:text-base mb-2">
|
||||||
|
Daftar Order Ruang
|
||||||
|
</div>
|
||||||
|
<DataTable class="border mb-3 2xl:mb-4"
|
||||||
|
v-bind="config"
|
||||||
|
:rows="data"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
import type { Config } from '~/components/pub/my-ui/data-table'
|
||||||
|
import { defineAsyncComponent } from 'vue'
|
||||||
|
|
||||||
|
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dud.vue'))
|
||||||
|
const input = defineAsyncComponent(() => import('~/components/pub/ui/input/Input.vue'))
|
||||||
|
|
||||||
|
export const config: Config = {
|
||||||
|
cols: [{}, {}, { classVal: '!p-0.5' }, { width: 50 }],
|
||||||
|
|
||||||
|
headers: [
|
||||||
|
[
|
||||||
|
{ label: 'Kode' },
|
||||||
|
{ label: 'Nama' },
|
||||||
|
{ label: 'Catatan' },
|
||||||
|
{ label: '' },
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
|
keys: ['procedureRoom.code', 'procedureRoom.infra.name', 'note'],
|
||||||
|
|
||||||
|
delKeyNames: [
|
||||||
|
{ key: 'mcuSrc.name', label: 'Nama' },
|
||||||
|
],
|
||||||
|
|
||||||
|
components: {
|
||||||
|
note(rec, idx) {
|
||||||
|
return {
|
||||||
|
idx,
|
||||||
|
rec: rec as object,
|
||||||
|
component: input,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
action(rec, idx) {
|
||||||
|
return {
|
||||||
|
idx,
|
||||||
|
rec: rec as object,
|
||||||
|
component: action,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
htmls: {},
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import DataTable from '~/components/pub/my-ui/data-table/data-table.vue'
|
||||||
|
|
||||||
|
import { config } from './list-entry.cfg'
|
||||||
|
import type { ProcedureRoomOrderItem } from '~/models/procedure-room-order-item';
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
data: ProcedureRoomOrderItem[]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
requestItem: []
|
||||||
|
}>()
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="mb-4 2xl:mb-5">
|
||||||
|
<div class="font-semibold text-sm 2xl:text-base mb-2">
|
||||||
|
Daftar Order Ruang
|
||||||
|
</div>
|
||||||
|
<DataTable class="border mb-3 2xl:mb-4"
|
||||||
|
v-bind="config"
|
||||||
|
:rows="data"
|
||||||
|
/>
|
||||||
|
<div class="-mx-1 [&_button]:mx-1">
|
||||||
|
<Button @click="emit('requestItem')">
|
||||||
|
<Icon name="i-lucide-plus" />
|
||||||
|
Pilih Item
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import * as DE from '~/components/pub/my-ui/doc-entry'
|
||||||
|
import type { ProcedureRoom } from '~/models/procedure-room';
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
data: ProcedureRoom
|
||||||
|
}>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="mb-4 2xl:mb-5">
|
||||||
|
<div class="font-semibold text-sm 2xl:text-base mb-2">
|
||||||
|
Detail Order
|
||||||
|
</div>
|
||||||
|
<DE.Block :col-count="2" mode="preview">
|
||||||
|
<DE.Cell>
|
||||||
|
<DE.Label>No. Order</DE.Label>
|
||||||
|
<DE.Colon />
|
||||||
|
<DE.Field>ORT-{{ data.id }}</DE.Field>
|
||||||
|
</DE.Cell>
|
||||||
|
<DE.Cell>
|
||||||
|
<DE.Label>Tgl. Order</DE.Label>
|
||||||
|
<DE.Colon />
|
||||||
|
<DE.Field>{{ data.createdAt?.substring(0, 10) }}</DE.Field>
|
||||||
|
</DE.Cell>
|
||||||
|
</DE.Block>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
import type { Config, RecComponent } from '~/components/pub/my-ui/data-table'
|
||||||
|
import { defineAsyncComponent } from 'vue'
|
||||||
|
import type { ProcedureRoomOrder } from '~/models/procedure-room-order'
|
||||||
|
|
||||||
|
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/dropdown-action-dsd.vue'))
|
||||||
|
|
||||||
|
export const config: Config = {
|
||||||
|
cols: [{}, {}, {}, {}, {}, { width: 50 }],
|
||||||
|
|
||||||
|
headers: [[
|
||||||
|
{ label: 'Tgl. Order' },
|
||||||
|
{ label: 'No. Order' },
|
||||||
|
{ label: 'Ruangan' },
|
||||||
|
{ label: 'Status' },
|
||||||
|
{ label: 'Resume' },
|
||||||
|
{ label: '' },
|
||||||
|
]],
|
||||||
|
|
||||||
|
keys: ['date', 'number', 'room', 'status_code', 'resume', 'action'],
|
||||||
|
|
||||||
|
delKeyNames: [
|
||||||
|
{ key: 'createdAt', label: 'Tgl. Order' },
|
||||||
|
{ key: 'id', label: 'No. Order' },
|
||||||
|
],
|
||||||
|
|
||||||
|
parses: {
|
||||||
|
date: (rec: any) => {
|
||||||
|
const recX = rec as ProcedureRoomOrder
|
||||||
|
return recX.createdAt ? recX.createdAt.substring(0, 10) : ''
|
||||||
|
|
||||||
|
},
|
||||||
|
number: (rec: any) => {
|
||||||
|
const recX = rec as ProcedureRoomOrder
|
||||||
|
return `ORT-${recX.id}`
|
||||||
|
},
|
||||||
|
room: (rec: any) => {
|
||||||
|
const recX = rec as ProcedureRoomOrder
|
||||||
|
let result = ''
|
||||||
|
if (recX.items && recX.items.length > 0) {
|
||||||
|
recX.items.forEach((item, idx) => {
|
||||||
|
result += item.infra?.name ? `<div>${item.infra.name}</div>` : ''
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// recX.ite
|
||||||
|
return ''
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
components: {
|
||||||
|
action(rec, idx) {
|
||||||
|
const res: RecComponent = {
|
||||||
|
idx,
|
||||||
|
rec: rec as object,
|
||||||
|
component: action,
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
htmls: {},
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
// Components
|
||||||
|
import DataTable from '~/components/pub/my-ui/data-table/data-table.vue'
|
||||||
|
import PaginationView from '~/components/pub/my-ui/pagination/pagination-view.vue'
|
||||||
|
|
||||||
|
// Types
|
||||||
|
import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
|
||||||
|
|
||||||
|
// Configs
|
||||||
|
import { config } from './list.cfg'
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
data: any[]
|
||||||
|
paginationMeta: PaginationMeta
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
pageChange: [page: number]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
function handlePageChange(page: number) {
|
||||||
|
emit('pageChange', page)
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<DataTable
|
||||||
|
v-bind="config"
|
||||||
|
:rows="data"
|
||||||
|
:skeleton-size="paginationMeta?.pageSize"
|
||||||
|
class="mb-4 border"
|
||||||
|
/>
|
||||||
|
<PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" />
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import type { ProcedureRoom } from '~/models/procedure-room';
|
||||||
|
import type { ProcedureRoomOrderItem } from '~/models/procedure-room-order-item';
|
||||||
|
|
||||||
|
const dataModel = defineModel({ type: Array as PropType<ProcedureRoomOrderItem[]>, required: true })
|
||||||
|
defineProps<{
|
||||||
|
data: ProcedureRoom[]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
pick: [item: ProcedureRoom]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
function pick(item: ProcedureRoom) {
|
||||||
|
emit('pick', item)
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="mb-5">
|
||||||
|
<div class="font-semibold text-sm 2xl:text-base mb-2">
|
||||||
|
Daftar Pilihan Ruang Tindakan
|
||||||
|
</div>
|
||||||
|
<div class="grid grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5 gap-2 2xl:gap-2">
|
||||||
|
<!-- <div v-for="item, idx in data" :key="idx" class="flex gap-2"> -->
|
||||||
|
<div v-if="data.length > 0" v-for="item, idx in data">
|
||||||
|
<Button
|
||||||
|
:variant="dataModel.some(e => e.procedureRoom.code === item.code) ? 'default' : 'outline'"
|
||||||
|
class="w-full"
|
||||||
|
type="button"
|
||||||
|
@click="pick(item)"
|
||||||
|
>
|
||||||
|
{{ item.infra?.name }}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
<div v-else class="col-span-full text-center text-sm text-gray-500">
|
||||||
|
<div>Tidak ada data ruang tindakan.</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import type { ProcedureRoom } from '~/models/procedure-room';
|
||||||
|
import type { ProcedureRoomOrderItem } from '~/models/procedure-room-order-item';
|
||||||
|
|
||||||
|
const dataModel = defineModel({ type: Array as PropType<ProcedureRoomOrderItem[]>, required: true })
|
||||||
|
defineProps<{
|
||||||
|
data: ProcedureRoom[]
|
||||||
|
pickMode: 'single' | 'multi'
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
pick: [item: ProcedureRoom]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
function pick(item: ProcedureRoom) {
|
||||||
|
emit('pick', item)
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="mb-5">
|
||||||
|
<div class="font-semibold text-sm 2xl:text-base mb-2">
|
||||||
|
Daftar Pilihan Ruang Tindakan
|
||||||
|
</div>
|
||||||
|
<div class="grid grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5 gap-2 2xl:gap-2">
|
||||||
|
<!-- <div v-for="item, idx in data" :key="idx" class="flex gap-2"> -->
|
||||||
|
<div v-if="data.length > 0" v-for="item, idx in data">
|
||||||
|
<Button
|
||||||
|
:variant="dataModel.some(e => e.procedureRoom.code === item.code) ? 'default' : 'outline'"
|
||||||
|
class="w-full"
|
||||||
|
type="button"
|
||||||
|
@click="pick(item)"
|
||||||
|
>
|
||||||
|
{{ item.infra?.name }}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
<div v-else class="col-span-full text-center text-sm text-gray-500">
|
||||||
|
<div>Tidak ada data ruang tindakan.</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import type { ProcedureRoom } from '~/models/procedure-room';
|
||||||
|
import type { ProcedureRoomOrderItem } from '~/models/procedure-room-order-item';
|
||||||
|
|
||||||
|
const dataModel = defineModel({ type: Array as PropType<ProcedureRoomOrderItem[]>, required: true })
|
||||||
|
defineProps<{
|
||||||
|
data: ProcedureRoom[]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
pick: [item: ProcedureRoom]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
function pick(item: ProcedureRoom) {
|
||||||
|
emit('pick', item)
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="mb-5">
|
||||||
|
<div class="font-semibold text-sm 2xl:text-base mb-2">
|
||||||
|
Daftar Pilihan Ruang Tindakan
|
||||||
|
</div>
|
||||||
|
<div class="grid grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5 gap-2 2xl:gap-2">
|
||||||
|
<!-- <div v-for="item, idx in data" :key="idx" class="flex gap-2"> -->
|
||||||
|
<div v-if="data.length > 0" v-for="item, idx in data">
|
||||||
|
<Button
|
||||||
|
:variant="dataModel.some(e => e.procedureRoom.code === item.code) ? 'default' : 'outline'"
|
||||||
|
class="w-full"
|
||||||
|
type="button"
|
||||||
|
@click="pick(item)"
|
||||||
|
>
|
||||||
|
{{ item.infra?.name }}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
<div v-else class="col-span-full text-center text-sm text-gray-500">
|
||||||
|
<div>Tidak ada data ruang tindakan.</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { procedureRoomTypeCodes } from '~/const/key-val/clinical'
|
||||||
|
|
||||||
|
const model = defineModel()
|
||||||
|
model.value = 'procedure'
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
pick: [type_code: string]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
function pick(type_code: string) {
|
||||||
|
model.value = type_code
|
||||||
|
emit('pick', type_code)
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="mb-5">
|
||||||
|
<div class="font-semibold text-sm 2xl:text-base mb-2">
|
||||||
|
Jenis Ruang Tindakan
|
||||||
|
</div>
|
||||||
|
<div class="-mx-1 [&_button]:mx-1 ">
|
||||||
|
<Button v-for="item, key in procedureRoomTypeCodes" :variant="model === key ? 'default' : 'outline'" @click="pick(key)">
|
||||||
|
{{ item }}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,173 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
//
|
||||||
|
import * as CH from '~/components/pub/my-ui/content-header'
|
||||||
|
import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
|
||||||
|
import NavEntry from '~/components/pub/my-ui/nav-footer/ba-de-dr-su.vue'
|
||||||
|
import NavDetail from '~/components/pub/my-ui/nav-footer/ba.vue'
|
||||||
|
import NavOk from '~/components/pub/my-ui/nav-footer/ok.vue'
|
||||||
|
|
||||||
|
// Procedure Room
|
||||||
|
import type { ProcedureRoom } from '~/models/procedure-room'
|
||||||
|
import { getList as getProcedureRoomList } from '~/services/procedure-room.service'
|
||||||
|
import PRSwitcher from '~/components/app/procedure-room/switcher.vue'
|
||||||
|
import PRMultiOptPicker from '~/components/app/procedure-room/multi-opt-picker.vue'
|
||||||
|
import PRPicker from '~/components/app/procedure-room/picker.vue'
|
||||||
|
|
||||||
|
// Material Package
|
||||||
|
import type { MaterialPackage } from '~/models/material-package'
|
||||||
|
import { getList as getMaterialPackageList } from '~/services/material-package.service'
|
||||||
|
|
||||||
|
// Material Package Item
|
||||||
|
import type { MaterialPackageItem } from '~/models/material-package-item'
|
||||||
|
import { getList as getmaterialPackageItems } from '~/services/material-package-item.service'
|
||||||
|
import MPSwitcher from '~/components/app/material-package/switcher.vue'
|
||||||
|
import MPIQuickList from '~/components/app/material-package-item/quick-list.vue'
|
||||||
|
|
||||||
|
// Main data
|
||||||
|
import { getDetail } from '~/services/procedure-room-order.service'
|
||||||
|
import Detail from '~/components/app/procedure-room-order/detail.vue'
|
||||||
|
|
||||||
|
// Items data
|
||||||
|
import type { ProcedureRoomOrderItem } from '~/models/procedure-room-order-item'
|
||||||
|
import {
|
||||||
|
getList as getOrderItemList,
|
||||||
|
create as createOrderItem,
|
||||||
|
remove as removeOrderItem,
|
||||||
|
} from '~/services/procedure-room-order-item.service'
|
||||||
|
import ItemListEntry from '~/components/app/procedure-room-order-item/list-entry.vue'
|
||||||
|
import ItemListDetail from '~/components/app/procedure-room-order-item/list-detail.vue'
|
||||||
|
|
||||||
|
// data
|
||||||
|
const { backToList, crudQueryParams } = useQueryCRUD()
|
||||||
|
const id = crudQueryParams.value.recordId
|
||||||
|
const dataRes = await getDetail(
|
||||||
|
typeof id === 'string' ? parseInt(id) : 0,
|
||||||
|
{ includes: 'encounter,doctor,doctor-employee,doctor-employee-person' }
|
||||||
|
)
|
||||||
|
const data = dataRes.body?.data
|
||||||
|
const items = ref<ProcedureRoomOrderItem[]>([])
|
||||||
|
|
||||||
|
// Header
|
||||||
|
const headerConfig: CH.Config = {
|
||||||
|
title: 'Order Ruang Tindakan',
|
||||||
|
icon: 'i-lucide-box',
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
const pickerDialogOpen = ref(false)
|
||||||
|
const procedureRooms = ref<ProcedureRoom[]>([])
|
||||||
|
const procedureRoomType = ref('procedure')
|
||||||
|
getProcedureRooms(procedureRoomType.value)
|
||||||
|
watch(procedureRoomType, async (newValue) => {
|
||||||
|
getProcedureRooms(newValue)
|
||||||
|
})
|
||||||
|
|
||||||
|
//
|
||||||
|
const materialPackages = ref<MaterialPackage[]>([])
|
||||||
|
const selectedMaterialPackage = ref('')
|
||||||
|
const res = await getMaterialPackageList()
|
||||||
|
if (res.success) {
|
||||||
|
materialPackages.value = res.body.data
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
const materialPackageItems = ref<MaterialPackageItem[]>([])
|
||||||
|
watch(selectedMaterialPackage, async (newValue) => {
|
||||||
|
const res = await getmaterialPackageItems({
|
||||||
|
'material-package-code': selectedMaterialPackage.value,
|
||||||
|
includes: 'material'
|
||||||
|
})
|
||||||
|
if (res.success) {
|
||||||
|
materialPackageItems.value = res.body.data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// last flow
|
||||||
|
onMounted(async () => {
|
||||||
|
await getItems()
|
||||||
|
})
|
||||||
|
|
||||||
|
///// functions
|
||||||
|
async function getProcedureRooms(typeCode: string) {
|
||||||
|
const res = await getProcedureRoomList({ 'type-code': typeCode, includes: 'infra' })
|
||||||
|
if (res.success) {
|
||||||
|
procedureRooms.value = res.body.data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getItems() {
|
||||||
|
const res = await getOrderItemList({
|
||||||
|
'procedure-room-order-id': crudQueryParams.value.recordId,
|
||||||
|
includes: 'procedureRoom,procedureRoom-infra',
|
||||||
|
})
|
||||||
|
if (res.success) {
|
||||||
|
items.value = res.body.data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function pickItem(item: ProcedureRoom) {
|
||||||
|
const exItem = items.value.find(e => e.procedureRoom_code === item.code)
|
||||||
|
if (exItem) {
|
||||||
|
await removeOrderItem(exItem.id)
|
||||||
|
await getItems()
|
||||||
|
} else {
|
||||||
|
const intId = parseInt(id?.toString() || '0')
|
||||||
|
await createOrderItem({
|
||||||
|
procedureRoomOrder_id: intId,
|
||||||
|
procedureRoom_code: item.code,
|
||||||
|
})
|
||||||
|
await getItems()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function requestItem() {
|
||||||
|
pickerDialogOpen.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
function navClick(type: 'back' | 'delete' | 'draft' | 'submit') {
|
||||||
|
if (type === 'back') {
|
||||||
|
backToList()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<CH.ContentHeader v-bind="headerConfig" />
|
||||||
|
|
||||||
|
<Separator class="mb-4" />
|
||||||
|
|
||||||
|
<Detail :data="data" />
|
||||||
|
|
||||||
|
<template v-if="data.status_code == 'new'">
|
||||||
|
<ItemListEntry :data="items" @requestItem="requestItem" />
|
||||||
|
<MPSwitcher :data="materialPackages" v-model="selectedMaterialPackage" />
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<ItemListDetail :data="items" @requestItem="requestItem" />
|
||||||
|
</template>
|
||||||
|
<MPIQuickList :data="materialPackageItems" />
|
||||||
|
|
||||||
|
<div class="w-full flex justify-center">
|
||||||
|
<NavEntry v-if="data.status_code == 'new'" @click="navClick" />
|
||||||
|
<NavDetail v-else @click="navClick" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Dialog
|
||||||
|
v-model:open="pickerDialogOpen"
|
||||||
|
title="Pilih Item"
|
||||||
|
size="2xl"
|
||||||
|
prevent-outside
|
||||||
|
>
|
||||||
|
<PRSwitcher v-model="procedureRoomType" />
|
||||||
|
<PRPicker
|
||||||
|
:data="procedureRooms"
|
||||||
|
:pick-mode="procedureRoomType == 'procedure' ? 'multi' : 'single'"
|
||||||
|
v-model="items"
|
||||||
|
@pick="pickItem"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Separator />
|
||||||
|
<NavOk @click="() => pickerDialogOpen = false" class="justify-center" />
|
||||||
|
</Dialog>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,191 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
// Composables
|
||||||
|
import { usePaginatedList } from '~/composables/usePaginatedList'
|
||||||
|
|
||||||
|
// Handlers
|
||||||
|
import type { ToastFn } from '~/handlers/_handler'
|
||||||
|
|
||||||
|
// Pubs component
|
||||||
|
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 RecordConfirmation from '~/components/pub/my-ui/confirmation/record-confirmation.vue'
|
||||||
|
|
||||||
|
// Order
|
||||||
|
import {
|
||||||
|
recId,
|
||||||
|
recAction,
|
||||||
|
recItem,
|
||||||
|
isRecordConfirmationOpen,
|
||||||
|
handleActionRemove,
|
||||||
|
} from '~/handlers/procedure-room-order.handler'
|
||||||
|
import { getList, create, submit } from '~/services/procedure-room-order.service'
|
||||||
|
import type { ProcedureRoomOrder } from '~/models/procedure-room-order'
|
||||||
|
import List from '~/components/app/procedure-room-order/list.vue'
|
||||||
|
|
||||||
|
// Common prep
|
||||||
|
const route = useRoute()
|
||||||
|
const { setQueryParams } = useQueryParam()
|
||||||
|
const { crudQueryParams } = useQueryCRUD()
|
||||||
|
|
||||||
|
const plainEid = route.params.id
|
||||||
|
const encounter_id = (plainEid && typeof plainEid == 'string') ? parseInt(plainEid) : 0
|
||||||
|
const isSubmitConfirmationOpen = ref(false)
|
||||||
|
|
||||||
|
// Main data
|
||||||
|
const {
|
||||||
|
data,
|
||||||
|
isLoading,
|
||||||
|
paginationMeta,
|
||||||
|
searchInput,
|
||||||
|
fetchData: getMyList,
|
||||||
|
} = usePaginatedList<ProcedureRoomOrder>({
|
||||||
|
fetchFn: async (params: any) => {
|
||||||
|
const result = await getList({
|
||||||
|
'encounter-id': encounter_id,
|
||||||
|
includes: 'items',
|
||||||
|
search: params.search,
|
||||||
|
page: params.page,
|
||||||
|
'page-number': params['page-number'] || 0,
|
||||||
|
'page-size': params['page-size'] || 10,
|
||||||
|
})
|
||||||
|
return { success: result.success || false, body: result.body || {} }
|
||||||
|
},
|
||||||
|
entityName: 'prescription'
|
||||||
|
})
|
||||||
|
|
||||||
|
// Header things
|
||||||
|
const headerPrep: HeaderPrep = {
|
||||||
|
title: 'Order Ruang Tindakan',
|
||||||
|
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: {
|
||||||
|
label: 'Tambah',
|
||||||
|
icon: 'i-lucide-plus',
|
||||||
|
onClick: async () => {
|
||||||
|
recItem.value = null
|
||||||
|
recId.value = 0
|
||||||
|
const res = await create({ encounter_id })
|
||||||
|
if (res.success) {
|
||||||
|
crudQueryParams.value = { mode: 'entry', recordId: res.body?.data.id.toString() || '0' }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
// list actions
|
||||||
|
const timestamp = ref<any>({})
|
||||||
|
provide('rec_id', recId)
|
||||||
|
provide('rec_action', recAction)
|
||||||
|
provide('rec_item', recItem)
|
||||||
|
provide('table_data_loader', isLoading)
|
||||||
|
provide('timestamp', timestamp)
|
||||||
|
watch(recAction, () => {
|
||||||
|
if (!recAction.value) {
|
||||||
|
return
|
||||||
|
} else if (recAction.value === ActionEvents.showDetail) {
|
||||||
|
crudQueryParams.value = { mode: 'entry', recordId: recId.value || '0' }
|
||||||
|
} else if (recAction.value === ActionEvents.showConfirmSubmit) {
|
||||||
|
isSubmitConfirmationOpen.value = true
|
||||||
|
} else if (recAction.value === ActionEvents.showConfirmDelete) {
|
||||||
|
isRecordConfirmationOpen.value = true
|
||||||
|
}
|
||||||
|
recAction.value = ''
|
||||||
|
})
|
||||||
|
|
||||||
|
///// functions
|
||||||
|
|
||||||
|
function confirmCancel(data: ProcedureRoomOrder) {
|
||||||
|
recId.value = data.id
|
||||||
|
recItem.value = data
|
||||||
|
isRecordConfirmationOpen.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
function goToEdit(data: ProcedureRoomOrder) {
|
||||||
|
setQueryParams({
|
||||||
|
'mode': 'entry',
|
||||||
|
'id': data.id.toString()
|
||||||
|
})
|
||||||
|
recItem.value = data
|
||||||
|
}
|
||||||
|
|
||||||
|
function confirmSubmit(data: ProcedureRoomOrder) {
|
||||||
|
recId.value = data.id
|
||||||
|
recItem.value = data
|
||||||
|
isSubmitConfirmationOpen.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleActionSubmit(id: number, refresh: () => void, toast: ToastFn) {
|
||||||
|
const result = await submit(id)
|
||||||
|
if (result.success) {
|
||||||
|
toast({ title: 'Berhasil', description: 'Resep telah di ajukan', variant: 'default' })
|
||||||
|
setTimeout(refresh, 300)
|
||||||
|
} else {
|
||||||
|
toast({ title: 'Gagal', description: 'Gagal menjalankan perintah', variant: 'destructive' })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<Header :prep="{ ...headerPrep }" />
|
||||||
|
|
||||||
|
<List
|
||||||
|
v-if="!isLoading.dataListLoading"
|
||||||
|
:data="data"
|
||||||
|
:pagination-meta="paginationMeta"
|
||||||
|
@cancel="confirmCancel"
|
||||||
|
@edit="goToEdit"
|
||||||
|
@submit="confirmSubmit"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<RecordConfirmation
|
||||||
|
v-model:open="isRecordConfirmationOpen"
|
||||||
|
action="delete"
|
||||||
|
:record="recItem"
|
||||||
|
@confirm="() => handleActionRemove(recId, getMyList, toast)"
|
||||||
|
@cancel=""
|
||||||
|
>
|
||||||
|
<div class="flex mb-2">
|
||||||
|
<div class="w-20">Tanggal</div>
|
||||||
|
<div class="w-4">:</div>
|
||||||
|
<div class="">{{ recItem.createdAt?.substring(0, 10) }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex">
|
||||||
|
<div class="w-20">DPJP</div>
|
||||||
|
<div class="w-4">:</div>
|
||||||
|
<div class="">{{ recItem.doctor?.employee?.person?.name }}</div>
|
||||||
|
</div>
|
||||||
|
</RecordConfirmation>
|
||||||
|
|
||||||
|
<RecordConfirmation
|
||||||
|
v-model:open="isSubmitConfirmationOpen"
|
||||||
|
action="delete"
|
||||||
|
customTitle="Ajukan Resep"
|
||||||
|
customMessage="Proses akan mengajukan resep ini untuk diproses lebih lanjut. Lanjutkan?"
|
||||||
|
customConfirmText="Ajukan"
|
||||||
|
:record="recItem"
|
||||||
|
@confirm="() => handleActionSubmit(recId, getMyList, toast)"
|
||||||
|
@cancel=""
|
||||||
|
>
|
||||||
|
<div class="flex mb-2">
|
||||||
|
<div class="w-20">Tanggal</div>
|
||||||
|
<div class="w-4">:</div>
|
||||||
|
<div class="">{{ recItem.createdAt.substring(0, 10) }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex">
|
||||||
|
<div class="w-20">DPJP</div>
|
||||||
|
<div class="w-4">:</div>
|
||||||
|
<div class="">{{ recItem.doctor?.employee?.person?.name }}</div>
|
||||||
|
</div>
|
||||||
|
</RecordConfirmation>
|
||||||
|
</template>
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
//
|
||||||
|
import List from './list.vue'
|
||||||
|
import Entry from './entry.vue'
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
encounter_id: number
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const { crudQueryParams } = useQueryCRUD()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<List v-if="crudQueryParams.mode === 'list'" :encounter_id="encounter_id" />
|
||||||
|
<Entry v-else :encounter_id="encounter_id" />
|
||||||
|
<div class="hidden">{{ crudQueryParams.mode }}</div>
|
||||||
|
</template>
|
||||||
@@ -18,6 +18,7 @@ export type MedObstacleCode = 'hearing' | 'sight' | 'physical' | 'emotional' | '
|
|||||||
export type LearnMethodCode = 'demo' | 'discuss-leaflet'
|
export type LearnMethodCode = 'demo' | 'discuss-leaflet'
|
||||||
export type LangClassCode = 'ind' | 'region' | 'foreign'
|
export type LangClassCode = 'ind' | 'region' | 'foreign'
|
||||||
export type TranslatorSrcCode = 'team' | 'family'
|
export type TranslatorSrcCode = 'team' | 'family'
|
||||||
|
export type ProcedureRoomTypeCode = 'procedure' | 'operation'
|
||||||
|
|
||||||
export const subjectCodes: Record<SubjectCode, string> = {
|
export const subjectCodes: Record<SubjectCode, string> = {
|
||||||
detail: 'Detail',
|
detail: 'Detail',
|
||||||
@@ -224,3 +225,8 @@ export const translatorSrcCodes: Record<TranslatorSrcCode, string> = {
|
|||||||
team: 'Tim Penerjemah',
|
team: 'Tim Penerjemah',
|
||||||
family: 'Keluarga',
|
family: 'Keluarga',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const procedureRoomTypeCodes: Record<ProcedureRoomTypeCode, string> = {
|
||||||
|
procedure: 'Ruang Tindakan',
|
||||||
|
operation: 'Ruang Operasi',
|
||||||
|
}
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ const ChemoMedicineProtocolListAsync = defineAsyncComponent(
|
|||||||
const DeviceOrderAsync = defineAsyncComponent(() => import('~/components/content/device-order/main.vue'))
|
const DeviceOrderAsync = defineAsyncComponent(() => import('~/components/content/device-order/main.vue'))
|
||||||
const PrescriptionAsync = defineAsyncComponent(() => import('~/components/content/prescription/main.vue'))
|
const PrescriptionAsync = defineAsyncComponent(() => import('~/components/content/prescription/main.vue'))
|
||||||
const CpLabOrderAsync = defineAsyncComponent(() => import('~/components/content/cp-lab-order/main.vue'))
|
const CpLabOrderAsync = defineAsyncComponent(() => import('~/components/content/cp-lab-order/main.vue'))
|
||||||
|
const ProcedureRoomOrderAsync = defineAsyncComponent(() => import('~/components/content/procedure-room-order/main.vue'))
|
||||||
const MicroLabOrderAsync = defineAsyncComponent(() => import('~/components/content/micro-lab-order/main.vue'))
|
const MicroLabOrderAsync = defineAsyncComponent(() => import('~/components/content/micro-lab-order/main.vue'))
|
||||||
const CprjAsync = defineAsyncComponent(() => import('~/components/content/cprj/entry.vue'))
|
const CprjAsync = defineAsyncComponent(() => import('~/components/content/cprj/entry.vue'))
|
||||||
const RadiologyAsync = defineAsyncComponent(() => import('~/components/content/radiology-order/main.vue'))
|
const RadiologyAsync = defineAsyncComponent(() => import('~/components/content/radiology-order/main.vue'))
|
||||||
@@ -164,8 +165,8 @@ const defaultKeys: Record<string, any> = {
|
|||||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||||
unit: 'all',
|
unit: 'all',
|
||||||
},
|
},
|
||||||
actionRoomOrder: {
|
procedureRoomOrder: {
|
||||||
id: 'action-room-order',
|
id: 'procedure-room-order',
|
||||||
title: 'Order Ruang Tindakan',
|
title: 'Order Ruang Tindakan',
|
||||||
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
classCode: ['ambulatory', 'emergency', 'inpatient'],
|
||||||
unit: 'all',
|
unit: 'all',
|
||||||
@@ -376,10 +377,9 @@ export function injectComponents(id: string | number, data: EncounterListData, m
|
|||||||
currentKeys.paLabOrder['component'] = null
|
currentKeys.paLabOrder['component'] = null
|
||||||
currentKeys.paLabOrder['props'] = { encounter_id: id }
|
currentKeys.paLabOrder['props'] = { encounter_id: id }
|
||||||
}
|
}
|
||||||
if (currentKeys?.actionRoomOrder) {
|
if (currentKeys?.procedureRoomOrder) {
|
||||||
// TODO: add component for actionRoomOrder
|
currentKeys.procedureRoomOrder['component'] = ProcedureRoomOrderAsync
|
||||||
currentKeys.actionRoomOrder['component'] = null
|
currentKeys.procedureRoomOrder['props'] = { encounter_id: id }
|
||||||
currentKeys.actionRoomOrder['props'] = { encounter_id: id }
|
|
||||||
}
|
}
|
||||||
if (currentKeys?.mcuResult) {
|
if (currentKeys?.mcuResult) {
|
||||||
// TODO: add component for mcuResult
|
// TODO: add component for mcuResult
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import { genCrudHandler } from '~/handlers/_handler'
|
||||||
|
import { create, update, remove } from '~/services/procedure-room-order.service'
|
||||||
|
|
||||||
|
export const {
|
||||||
|
recId,
|
||||||
|
recAction,
|
||||||
|
recItem,
|
||||||
|
isReadonly,
|
||||||
|
isProcessing,
|
||||||
|
isFormEntryDialogOpen,
|
||||||
|
isRecordConfirmationOpen,
|
||||||
|
onResetState,
|
||||||
|
handleActionSave,
|
||||||
|
handleActionEdit,
|
||||||
|
handleActionRemove,
|
||||||
|
handleCancelForm,
|
||||||
|
} = genCrudHandler({ create, update, remove})
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import { genCrudHandler } from '~/handlers/_handler'
|
||||||
|
import { create, update, remove } from '~/services/procedure-room.service'
|
||||||
|
|
||||||
|
export const {
|
||||||
|
recId,
|
||||||
|
recAction,
|
||||||
|
recItem,
|
||||||
|
isReadonly,
|
||||||
|
isProcessing,
|
||||||
|
isFormEntryDialogOpen,
|
||||||
|
isRecordConfirmationOpen,
|
||||||
|
onResetState,
|
||||||
|
handleActionSave,
|
||||||
|
handleActionEdit,
|
||||||
|
handleActionRemove,
|
||||||
|
handleCancelForm,
|
||||||
|
} = genCrudHandler({ create, update, remove})
|
||||||
+20
-3
@@ -1,10 +1,27 @@
|
|||||||
export interface Infra {
|
import { type Base, genBase } from "./_base";
|
||||||
id?: number
|
import { genProcedureRoom, type ProcedureRoom } from "./procedure-room";
|
||||||
|
|
||||||
|
export interface Infra extends Base {
|
||||||
code: string
|
code: string
|
||||||
name: string
|
name: string
|
||||||
infraGroup_code: string
|
infraGroup_code: string
|
||||||
parent_id?: number | string | null
|
parent_id?: number | string | null
|
||||||
|
unit_id?: number | string | null
|
||||||
specialist_id?: number | string | null
|
specialist_id?: number | string | null
|
||||||
subspecialist_id?: number | string | null
|
subspecialist_id?: number | string | null
|
||||||
unit_id?: number | string | null
|
procedureRoom?: ProcedureRoom
|
||||||
|
}
|
||||||
|
|
||||||
|
export function genInfra(): Infra {
|
||||||
|
return {
|
||||||
|
...genBase(),
|
||||||
|
code: '',
|
||||||
|
name: '',
|
||||||
|
infraGroup_code: '',
|
||||||
|
parent_id: null,
|
||||||
|
unit_id: null,
|
||||||
|
specialist_id: null,
|
||||||
|
subspecialist_id: null,
|
||||||
|
procedureRoom: genProcedureRoom(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
import { type Base, genBase } from "./_base"
|
||||||
|
|
||||||
|
export interface MaterialPackageItem extends Base {
|
||||||
|
materialPackage_code: string
|
||||||
|
material_code: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export function genMaterialPackage(): MaterialPackageItem {
|
||||||
|
return {
|
||||||
|
...genBase(),
|
||||||
|
materialPackage_code: '',
|
||||||
|
material_code: '',
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
import { type Base, genBase } from "./_base"
|
||||||
|
|
||||||
|
export interface MaterialPackage extends Base {
|
||||||
|
code: string
|
||||||
|
name: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export function genMaterialPackage(): MaterialPackage {
|
||||||
|
return {
|
||||||
|
...genBase(),
|
||||||
|
code: '',
|
||||||
|
name: '',
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
import { type Base, genBase } from "./_base";
|
||||||
|
import { genMaterialPackage, type MaterialPackage } from "./material-package";
|
||||||
|
import { genProcedureRoom, type ProcedureRoom } from "./procedure-room";
|
||||||
|
|
||||||
|
export interface ProcedureRoomOrderItem extends Base {
|
||||||
|
procedureRoomOrder_id: number
|
||||||
|
procedureRoom_code: string
|
||||||
|
procedureRoom: ProcedureRoom
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CreateDto {
|
||||||
|
procedureRoomOrder_id: number
|
||||||
|
procedureRoom_code: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UpdateDto extends CreateDto {
|
||||||
|
note?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export function genProcedureRoomOrderItem(): ProcedureRoomOrderItem {
|
||||||
|
return {
|
||||||
|
...genBase(),
|
||||||
|
procedureRoomOrder_id: 0,
|
||||||
|
procedureRoom_code: '',
|
||||||
|
procedureRoom: genProcedureRoom(),
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import { type Base, genBase } from "./_base";
|
||||||
|
import { genMaterialPackage, type MaterialPackage } from "./material-package";
|
||||||
|
import { genProcedureRoom, type ProcedureRoom } from "./procedure-room";
|
||||||
|
|
||||||
|
export interface ProcedureRoomOrder extends Base {
|
||||||
|
encounter_id: number
|
||||||
|
materialPackage_code?: string
|
||||||
|
materialPackage: MaterialPackage
|
||||||
|
items?: ProcedureRoom[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CreateDto {
|
||||||
|
encounter_id: number
|
||||||
|
}
|
||||||
|
|
||||||
|
export function genProcedureRoomOrder(): ProcedureRoomOrder {
|
||||||
|
return {
|
||||||
|
...genBase(),
|
||||||
|
encounter_id: 0,
|
||||||
|
materialPackage_code: '',
|
||||||
|
materialPackage: genMaterialPackage(),
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import { type Base, genBase } from "./_base";
|
||||||
|
import type { Infra } from "./infra";
|
||||||
|
|
||||||
|
export interface ProcedureRoom extends Base {
|
||||||
|
code: string
|
||||||
|
infra_code: string
|
||||||
|
infra?: Infra
|
||||||
|
type_code: string
|
||||||
|
unit_code: string
|
||||||
|
specialist_code?: string | null
|
||||||
|
subspecialist_code?: string | null
|
||||||
|
}
|
||||||
|
|
||||||
|
export function genProcedureRoom(): ProcedureRoom {
|
||||||
|
return {
|
||||||
|
...genBase(),
|
||||||
|
code: '',
|
||||||
|
infra_code: '',
|
||||||
|
type_code: '',
|
||||||
|
unit_code: '',
|
||||||
|
specialist_code: null,
|
||||||
|
subspecialist_code: null,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import { z } from 'zod'
|
||||||
|
import type { MaterialPackageItem } from '~/models/material-package-item'
|
||||||
|
|
||||||
|
const MaterialSchema = z.object({
|
||||||
|
materialPackage_code: z.string({ required_error: 'Kode harus diisi' }).min(1, 'Kode minimum 1 karakter'),
|
||||||
|
material_code: z.string({ required_error: 'Nama harus diisi' }).min(1, 'Nama minimum 1 karakter'),
|
||||||
|
})
|
||||||
|
|
||||||
|
type MaterialFormData = z.infer<typeof MaterialSchema> & Partial<MaterialPackageItem>
|
||||||
|
|
||||||
|
export { MaterialSchema }
|
||||||
|
export type { MaterialFormData }
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import { z } from 'zod'
|
||||||
|
import type { MaterialPackage } from '~/models/material-package'
|
||||||
|
|
||||||
|
const MaterialSchema = z.object({
|
||||||
|
code: z.string({ required_error: 'Kode harus diisi' }).min(1, 'Kode minimum 1 karakter'),
|
||||||
|
name: z.string({ required_error: 'Nama harus diisi' }).min(1, 'Nama minimum 1 karakter'),
|
||||||
|
})
|
||||||
|
|
||||||
|
type MaterialFormData = z.infer<typeof MaterialSchema> & Partial<MaterialPackage>
|
||||||
|
|
||||||
|
export { MaterialSchema }
|
||||||
|
export type { MaterialFormData }
|
||||||
@@ -1,14 +1,11 @@
|
|||||||
|
|
||||||
// Base
|
|
||||||
import * as base from './_crud-base'
|
import * as base from './_crud-base'
|
||||||
|
|
||||||
// Types
|
|
||||||
import type { Infra } from '~/models/infra'
|
import type { Infra } from '~/models/infra'
|
||||||
|
|
||||||
const path = '/api/v1/infra'
|
|
||||||
const name = 'infra'
|
const name = 'infra'
|
||||||
|
const path = `/api/v1/${name}`
|
||||||
|
|
||||||
export function create(data: any) {
|
export function create(data: Infra) {
|
||||||
return base.create(path, data, name)
|
return base.create(path, data, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -20,7 +17,7 @@ export function getDetail(id: number | string) {
|
|||||||
return base.getDetail(path, id, name)
|
return base.getDetail(path, id, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function update(id: number | string, data: any) {
|
export function update(id: number | string, data: Infra) {
|
||||||
return base.update(path, id, data, name)
|
return base.update(path, id, data, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,15 +25,26 @@ export function remove(id: number | string) {
|
|||||||
return base.remove(path, id, name)
|
return base.remove(path, id, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getValueLabelList(params: any = null): Promise<{ value: string; label: string }[]> {
|
export async function getValueLabelList(params: any = null, useId = false): Promise<{ value: string; label: string }[]> {
|
||||||
let data: { value: string; label: string }[] = []
|
let data: { value: string; label: string }[] = []
|
||||||
const result = await getList(params)
|
const result = await getList(params)
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
const resultData = result.body?.data || []
|
const resultData = result.body?.data || []
|
||||||
data = resultData.map((item: Infra) => ({
|
data = !useId ?
|
||||||
value: item.id ? Number(item.id) : item.code,
|
resultData.map((item: Infra) => ({ value: item.code, label: item.name })) :
|
||||||
label: item.name,
|
resultData.map((item: Infra) => ({ value: item.id, label: item.name }))
|
||||||
}))
|
|
||||||
}
|
}
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// export async function getProcedureRoomValueLabelList(params: any = null, useId = false): Promise<{ value: string; label: string }[]> {
|
||||||
|
// let data: { value: string; label: string }[] = []
|
||||||
|
// const result = await getList({ 'infraGroup_code': 'procedure-room' ,...params})
|
||||||
|
// if (result.success) {
|
||||||
|
// const resultData = result.body?.data || []
|
||||||
|
// data = !useId ?
|
||||||
|
// resultData.map((item: Infra) => ({ value: item.code, label: item.name })) :
|
||||||
|
// resultData.map((item: Infra) => ({ value: item.id, label: item.name }))
|
||||||
|
// }
|
||||||
|
// return data
|
||||||
|
// }
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
// Base
|
||||||
|
import * as base from './_crud-base'
|
||||||
|
|
||||||
|
const name = 'material-package-item'
|
||||||
|
const path = `/api/v1/${name}`
|
||||||
|
|
||||||
|
export function create(data: any) {
|
||||||
|
return base.create(path, data, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getList(params: any = null) {
|
||||||
|
return base.getList(path, params, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getDetail(id: number | string) {
|
||||||
|
return base.getDetail(path, id, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function update(id: number | string, data: any) {
|
||||||
|
return base.update(path, id, data, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function remove(id: number | string) {
|
||||||
|
return base.remove(path, id, name)
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
// Base
|
||||||
|
import type { MaterialPackage } from '~/models/material-package'
|
||||||
|
import * as base from './_crud-base'
|
||||||
|
|
||||||
|
const name = 'material-package'
|
||||||
|
const path = `/api/v1/${name}`
|
||||||
|
|
||||||
|
export function create(data: any) {
|
||||||
|
return base.create(path, data, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getList(params: any = null) {
|
||||||
|
return base.getList(path, params, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getDetail(id: number | string) {
|
||||||
|
return base.getDetail(path, id, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function update(id: number | string, data: any) {
|
||||||
|
return base.update(path, id, data, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function remove(id: number | string) {
|
||||||
|
return base.remove(path, id, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getValueLabelList(params: any = null, useId = false): Promise<{ value: string; label: string }[]> {
|
||||||
|
let data: { value: string; label: string }[] = []
|
||||||
|
const result = await getList(params)
|
||||||
|
if (result.success) {
|
||||||
|
const resultData = result.body?.data || []
|
||||||
|
data = !useId ?
|
||||||
|
resultData.map((item: MaterialPackage) => ({ value: item.code, label: item.name })) :
|
||||||
|
resultData.map((item: MaterialPackage) => ({ value: item.id, label: item.name }))
|
||||||
|
}
|
||||||
|
return data
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
// Base
|
||||||
|
import type { CreateDto, UpdateDto } from '~/models/procedure-room-order-item'
|
||||||
|
import * as base from './_crud-base'
|
||||||
|
|
||||||
|
const name = 'procedure-room-order-item'
|
||||||
|
const path = `/api/v1/${name}`
|
||||||
|
|
||||||
|
export function create(data: CreateDto) {
|
||||||
|
return base.create(path, data, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getList(params: any = null) {
|
||||||
|
return base.getList(path, params, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getDetail(id: number | string) {
|
||||||
|
return base.getDetail(path, id, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function update(id: number | string, data: UpdateDto) {
|
||||||
|
return base.update(path, id, data, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function remove(id: number | string) {
|
||||||
|
return base.remove(path, id, name)
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
// Base
|
||||||
|
import type { ProcedureRoomOrder, CreateDto } from '~/models/procedure-room-order'
|
||||||
|
import * as base from './_crud-base'
|
||||||
|
|
||||||
|
const name = 'procedure-room-order'
|
||||||
|
const path = `/api/v1/${name}`
|
||||||
|
|
||||||
|
export function create(data: CreateDto) {
|
||||||
|
return base.create(path, data, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getList(params: any = null) {
|
||||||
|
return base.getList(path, params, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getDetail(id: number | string, params: any = null) {
|
||||||
|
return base.getDetail(path, id, name, params)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function update(id: number | string, data: ProcedureRoomOrder) {
|
||||||
|
return base.update(path, id, data, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function remove(id: number | string) {
|
||||||
|
return base.remove(path, id, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export async function submit(id: number) {
|
||||||
|
try {
|
||||||
|
const resp = await xfetch(`${path}/${id}/submit`, 'PATCH')
|
||||||
|
const result: any = {}
|
||||||
|
if (resp.success) {
|
||||||
|
result.success = resp.success
|
||||||
|
result.body = (resp.body as Record<string, any>) || {}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`Error submitting ${name}:`, error)
|
||||||
|
throw new Error(`Failed to submit ${name}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
// Base
|
||||||
|
import type { ProcedureRoom } from '~/models/procedure-room'
|
||||||
|
import * as base from './_crud-base'
|
||||||
|
|
||||||
|
const name = 'procedure-room'
|
||||||
|
const path = `/api/v1/${name}`
|
||||||
|
|
||||||
|
export function create(data: ProcedureRoom) {
|
||||||
|
return base.create(path, data, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getList(params: any = null) {
|
||||||
|
return base.getList(path, params, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getDetail(id: number | string) {
|
||||||
|
return base.getDetail(path, id, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function update(id: number | string, data: ProcedureRoom) {
|
||||||
|
return base.update(path, id, data, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function remove(id: number | string) {
|
||||||
|
return base.remove(path, id, name)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user