feat(medicine-group): refactor list
This commit is contained in:
No files matched your search
@@ -30,7 +30,6 @@ function handlePageChange(page: number) {
|
|||||||
:func-html="funcHtml"
|
:func-html="funcHtml"
|
||||||
:func-component="funcComponent"
|
:func-component="funcComponent"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" />
|
<PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -1,19 +1,35 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import type { PaginationMeta } from '~/components/pub/custom-ui/pagination/pagination.type'
|
||||||
|
import PaginationView from '~/components/pub/custom-ui/pagination/pagination-view.vue'
|
||||||
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg'
|
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg'
|
||||||
|
|
||||||
defineProps<{
|
interface Props {
|
||||||
data: any[]
|
data: any[]
|
||||||
|
paginationMeta: PaginationMeta
|
||||||
|
}
|
||||||
|
|
||||||
|
defineProps<Props>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
pageChange: [page: number]
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
function handlePageChange(page: number) {
|
||||||
|
emit('pageChange', page)
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<PubBaseDataTable
|
<div class="space-y-4">
|
||||||
:rows="data"
|
<PubBaseDataTable
|
||||||
:cols="cols"
|
:rows="data"
|
||||||
:header="header"
|
:cols="cols"
|
||||||
:keys="keys"
|
:header="header"
|
||||||
:func-parsed="funcParsed"
|
:keys="keys"
|
||||||
:func-html="funcHtml"
|
:func-parsed="funcParsed"
|
||||||
:func-component="funcComponent"
|
:func-html="funcHtml"
|
||||||
/>
|
:func-component="funcComponent"
|
||||||
|
/>
|
||||||
|
<PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" />
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -1,19 +1,35 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import type { PaginationMeta } from '~/components/pub/custom-ui/pagination/pagination.type'
|
||||||
|
import PaginationView from '~/components/pub/custom-ui/pagination/pagination-view.vue'
|
||||||
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg'
|
import { cols, funcComponent, funcHtml, funcParsed, header, keys } from './list-cfg'
|
||||||
|
|
||||||
defineProps<{
|
interface Props {
|
||||||
data: any[]
|
data: any[]
|
||||||
|
paginationMeta: PaginationMeta
|
||||||
|
}
|
||||||
|
|
||||||
|
defineProps<Props>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
pageChange: [page: number]
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
function handlePageChange(page: number) {
|
||||||
|
emit('pageChange', page)
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<PubBaseDataTable
|
<div class="space-y-4">
|
||||||
:rows="data"
|
<PubBaseDataTable
|
||||||
:cols="cols"
|
:rows="data"
|
||||||
:header="header"
|
:cols="cols"
|
||||||
:keys="keys"
|
:header="header"
|
||||||
:func-parsed="funcParsed"
|
:keys="keys"
|
||||||
:func-html="funcHtml"
|
:func-parsed="funcParsed"
|
||||||
:func-component="funcComponent"
|
:func-html="funcHtml"
|
||||||
/>
|
:func-component="funcComponent"
|
||||||
|
/>
|
||||||
|
<PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" />
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -22,10 +22,14 @@ function handlePageChange(page: number) {
|
|||||||
<template>
|
<template>
|
||||||
<div class="space-y-4">
|
<div class="space-y-4">
|
||||||
<PubBaseDataTable
|
<PubBaseDataTable
|
||||||
:rows="data" :cols="cols" :header="header" :keys="keys" :func-parsed="funcParsed"
|
:rows="data"
|
||||||
:func-html="funcHtml" :func-component="funcComponent"
|
:cols="cols"
|
||||||
|
:header="header"
|
||||||
|
:keys="keys"
|
||||||
|
:func-parsed="funcParsed"
|
||||||
|
:func-html="funcHtml"
|
||||||
|
:func-component="funcComponent"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" />
|
<PaginationView :pagination-meta="paginationMeta" @page-change="handlePageChange" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -2,8 +2,7 @@
|
|||||||
// Components
|
// Components
|
||||||
import Dialog from '~/components/pub/base/modal/dialog.vue'
|
import Dialog from '~/components/pub/base/modal/dialog.vue'
|
||||||
import Header from '~/components/pub/custom-ui/nav-header/prep.vue'
|
import Header from '~/components/pub/custom-ui/nav-header/prep.vue'
|
||||||
import AppMedicineMethodEntryForm from '~/components/app/medicine-method/entry-form.vue'
|
import AppMedicineGroupEntryForm from '~/components/app/medicine-group/entry-form.vue'
|
||||||
import AppMedicineMethodList from '~/components/app/medicine-method/list.vue'
|
|
||||||
import RecordConfirmation from '~/components/pub/custom-ui/confirmation/record-confirmation.vue'
|
import RecordConfirmation from '~/components/pub/custom-ui/confirmation/record-confirmation.vue'
|
||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
@@ -27,7 +26,7 @@ import {
|
|||||||
handleActionEdit,
|
handleActionEdit,
|
||||||
handleActionRemove,
|
handleActionRemove,
|
||||||
handleCancelForm,
|
handleCancelForm,
|
||||||
} from '~/handlers/medicine-method.handler'
|
} from '~/handlers/medicine-group.handler'
|
||||||
|
|
||||||
// Services
|
// Services
|
||||||
import { getMedicineGroups, getMedicineGroupDetail } from '~/services/medicine-group.service'
|
import { getMedicineGroups, getMedicineGroupDetail } from '~/services/medicine-group.service'
|
||||||
@@ -47,7 +46,7 @@ const {
|
|||||||
const result = await getMedicineGroups({ search, page })
|
const result = await getMedicineGroups({ search, page })
|
||||||
return { success: result.success || false, body: result.body || {} }
|
return { success: result.success || false, body: result.body || {} }
|
||||||
},
|
},
|
||||||
entityName: 'medicine-method',
|
entityName: 'medicine-group',
|
||||||
})
|
})
|
||||||
|
|
||||||
const headerPrep: HeaderPrep = {
|
const headerPrep: HeaderPrep = {
|
||||||
@@ -93,12 +92,12 @@ watch([recId, recAction], () => {
|
|||||||
switch (recAction.value) {
|
switch (recAction.value) {
|
||||||
case ActionEvents.showDetail:
|
case ActionEvents.showDetail:
|
||||||
getCurrentMedicineGroupDetail(recId.value)
|
getCurrentMedicineGroupDetail(recId.value)
|
||||||
title.value = 'Detail Metode Obat'
|
title.value = 'Detail Kelompok Obat'
|
||||||
isReadonly.value = true
|
isReadonly.value = true
|
||||||
break
|
break
|
||||||
case ActionEvents.showEdit:
|
case ActionEvents.showEdit:
|
||||||
getCurrentMedicineGroupDetail(recId.value)
|
getCurrentMedicineGroupDetail(recId.value)
|
||||||
title.value = 'Edit Metode Obat'
|
title.value = 'Edit Kelompok Obat'
|
||||||
isReadonly.value = false
|
isReadonly.value = false
|
||||||
break
|
break
|
||||||
case ActionEvents.showConfirmDelete:
|
case ActionEvents.showConfirmDelete:
|
||||||
@@ -121,7 +120,7 @@ onMounted(async () => {
|
|||||||
|
|
||||||
<Dialog
|
<Dialog
|
||||||
v-model:open="isFormEntryDialogOpen"
|
v-model:open="isFormEntryDialogOpen"
|
||||||
:title="!!recItem ? title : 'Tambah Metode Obat'"
|
:title="!!recItem ? title : 'Tambah Kelompok Obat'"
|
||||||
size="lg"
|
size="lg"
|
||||||
prevent-outside
|
prevent-outside
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
import Dialog from '~/components/pub/base/modal/dialog.vue'
|
import Dialog from '~/components/pub/base/modal/dialog.vue'
|
||||||
import Header from '~/components/pub/custom-ui/nav-header/prep.vue'
|
import Header from '~/components/pub/custom-ui/nav-header/prep.vue'
|
||||||
import AppMedicineMethodEntryForm from '~/components/app/medicine-method/entry-form.vue'
|
import AppMedicineMethodEntryForm from '~/components/app/medicine-method/entry-form.vue'
|
||||||
import AppMedicineMethodList from '~/components/app/medicine-method/list.vue'
|
|
||||||
import RecordConfirmation from '~/components/pub/custom-ui/confirmation/record-confirmation.vue'
|
import RecordConfirmation from '~/components/pub/custom-ui/confirmation/record-confirmation.vue'
|
||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
|
|||||||
Reference in New Issue
Block a user