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 @@ + + + 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