diff --git a/app/components/app/prescription-item/mix-entry.vue b/app/components/app/prescription-item/mix-entry.vue index 187e9569..5a3c74fd 100644 --- a/app/components/app/prescription-item/mix-entry.vue +++ b/app/components/app/prescription-item/mix-entry.vue @@ -29,7 +29,7 @@ const emit = defineEmits<{ }>() watch(medicines, (data) => { - medicineItems.value = CB.objectsToItem(data, 'code', 'name') + medicineItems.value = CB.objectsToItems(data, 'code', 'name') }) function navClick(type: ClickType) { diff --git a/app/components/app/prescription-item/non-mix-entry.vue b/app/components/app/prescription-item/non-mix-entry.vue index 9115eeb9..90cf3e01 100644 --- a/app/components/app/prescription-item/non-mix-entry.vue +++ b/app/components/app/prescription-item/non-mix-entry.vue @@ -48,7 +48,7 @@ const emit = defineEmits<{ }>() watch(medicines, (data) => { - medicineItems.value = CB.objectsToItem(data, 'code', 'name') + medicineItems.value = CB.objectsToItems(data, 'code', 'name') }) function navClick(type: ClickType) { diff --git a/app/components/app/prescription/flat-list.vue b/app/components/app/prescription/flat-list.vue new file mode 100644 index 00000000..cf563ef2 --- /dev/null +++ b/app/components/app/prescription/flat-list.vue @@ -0,0 +1,88 @@ + + + + + Belum Ada Data + + + + Tambah Order + + + + + + + Tgl Order + DPJP + PPDS + Jenis Obat + Status + + + + + + + {{ item.issuedAt?.substring(0, 10) || item.createdAt?.substring(0, 10) }} + + + {{ item.doctor?.employee?.person?.name || '-' }} + + + + + + Racikan: {{ item.items.filter(function(element){ return element.isMix}).length }} + + + Non Racikan: {{ item.items.filter(function(element){ return !element.isMix}).length }} + + + + {{ item.status_code }} + + + { navClick(type, item) }" + /> + + + + + + + diff --git a/app/components/app/prescription/list.vue b/app/components/app/prescription/grouped-list.vue similarity index 100% rename from app/components/app/prescription/list.vue rename to app/components/app/prescription/grouped-list.vue diff --git a/app/components/content/prescription/list.vue b/app/components/content/prescription/list.vue index 5042a74b..af24808f 100644 --- a/app/components/content/prescription/list.vue +++ b/app/components/content/prescription/list.vue @@ -20,7 +20,8 @@ import { // Services import { getList, getDetail } from '~/services/prescription.service' -import List from '~/components/app/prescription/list.vue' +import FlatList from '~/components/app/prescription/flat-list.vue' +import Grouped from '~/components/app/prescription/grouped-list.vue' import type { Prescription } from '~/models/prescription' import { submit } from '~/services/prescription.service' import type { ToastFn } from '~/handlers/_handler' @@ -57,9 +58,25 @@ const { entityName: 'prescription' }) +function updateProvidedVal(val: boolean) { + flatMode.value = val +} +const flatMode = ref(false) +const flatModeLabel = ref('Mode Flat: Tidak') +provide('flatMode', { flatMode, updateProvidedVal }) +watch(flatMode, (newVal) => { + flatModeLabel.value = newVal ? 'Mode Flat: Ya' : 'Mode Flat: Tidak' +}) + const headerPrep: HeaderPrep = { title: 'Order Obat', icon: 'i-lucide-box', + components: [ + { + component: defineAsyncComponent(() => import('~/components/pub/my-ui/toggle/provided-toggle.vue')), + props: { variant: 'outline', label: flatModeLabel, providedKey: 'flatMode' } + }, + ], refSearchNav: { placeholder: 'Cari (min. 3 karakter)...', minLength: 3, @@ -161,14 +178,26 @@ async function handleActionSubmit(id: number, refresh: () => void, toast: ToastF - + + + + + + ([]) function toggleSelection(row: any, event?: Event) { if (event) event.stopPropagation() // cegah event bubble ke TableRow - const isMultiple = props.selectMode === 'multiple' // props.selectMode === 'multi' || + const isMultiple = props.selectMode === 'multiple' // props.selectMode === 'multi' || // gunakan pembanding berdasarkan id atau stringify data const findIndex = selected.value.findIndex((r) => JSON.stringify(r) === JSON.stringify(row)) @@ -128,7 +128,7 @@ function handleActionCellClick(event: Event, _cellRef: string) { 'bg-green-50': props.selectMode === 'single' && selected.some((r) => JSON.stringify(r) === JSON.stringify(row)), 'bg-blue-50': - (props.selectMode === 'multiple') && // props.selectMode === 'multi' || + (props.selectMode === 'multiple') && // props.selectMode === 'multi' || selected.some((r) => JSON.stringify(r) === JSON.stringify(row)), }" @click="toggleSelection(row)"