feat/prescription: added group and flat list
This commit is contained in:
@@ -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
|
||||
|
||||
<template>
|
||||
<Header :prep="{ ...headerPrep }" />
|
||||
<List
|
||||
v-if="!isLoading.dataListLoading"
|
||||
:data="data"
|
||||
:pagination-meta="paginationMeta"
|
||||
@cancel="confirmCancel"
|
||||
@edit="goToEdit"
|
||||
@submit="confirmSubmit"
|
||||
/>
|
||||
<template v-if="!flatMode">
|
||||
<Grouped
|
||||
v-if="!isLoading.dataListLoading"
|
||||
:data="data"
|
||||
:pagination-meta="paginationMeta"
|
||||
@cancel="confirmCancel"
|
||||
@edit="goToEdit"
|
||||
@submit="confirmSubmit"
|
||||
/>
|
||||
</template>
|
||||
<template v-else>
|
||||
<FlatList
|
||||
v-if="!isLoading.dataListLoading"
|
||||
:data="data"
|
||||
:pagination-meta="paginationMeta"
|
||||
@cancel="confirmCancel"
|
||||
@edit="goToEdit"
|
||||
@submit="confirmSubmit"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<RecordConfirmation
|
||||
v-model:open="isRecordConfirmationOpen"
|
||||
|
||||
Reference in New Issue
Block a user