Squashed commit of the following:

commit 8e3ea9e8d1d7e3b06bc6e53e0b97f62222276171
Author: hasyim_kai <muhammad.hasyim.c.a@gmail.com>
Date:   Thu Nov 20 16:14:03 2025 +0700

    Feat: UI control letter history

commit f11f97f936447bdb225918abb43313f8db540d67
Author: hasyim_kai <muhammad.hasyim.c.a@gmail.com>
Date:   Thu Nov 20 15:18:25 2025 +0700

    Squashed commit of the following:

    commit dab6adc4a9
    Author: hasyim_kai <muhammad.hasyim.c.a@gmail.com>
    Date:   Tue Nov 18 11:19:48 2025 +0700

        Fix: add role authorization in Resume

    commit c28fc8f7aa
    Merge: 7ed1cc8 bcfb4c1
    Author: Muhammad Hasyim Chaidir Ali <68959522+Hasyim-Kai@users.noreply.github.com>
    Date:   Tue Nov 18 09:02:16 2025 +0700

        Merge branch 'dev' into feat/resume-81

    commit 7ed1cc83bf
    Author: hasyim_kai <muhammad.hasyim.c.a@gmail.com>
    Date:   Mon Nov 17 15:04:01 2025 +0700

        Feat: add doc preview in Resume List

    commit bcfb4c1456
    Merge: 1cbde57 975c87d
    Author: Munawwirul Jamal <57973347+munaja@users.noreply.github.com>
    Date:   Mon Nov 17 11:15:14 2025 +0700

        Merge pull request #147 from dikstub-rssa/feat/surat-kontrol-135

        Feat: Integration Rehab Medik - Surat Kontrol

    commit 15ab43c1b1
    Author: hasyim_kai <muhammad.hasyim.c.a@gmail.com>
    Date:   Mon Nov 17 10:38:21 2025 +0700

        Feat: add verification capthca and form adjustment

    commit 53bd8e7f6e
    Author: hasyim_kai <muhammad.hasyim.c.a@gmail.com>
    Date:   Fri Nov 7 08:55:23 2025 +0700

        Fix: refactor rehab medik - Resume UI

    commit fc308809b8
    Author: hasyim_kai <muhammad.hasyim.c.a@gmail.com>
    Date:   Wed Oct 29 14:57:19 2025 +0700

        Feat: add UI Rehab Medik > Proses > Resume

    commit 9b383a5437
    Merge: a4dc7d7 831749a
    Author: Muhammad Hasyim Chaidir Ali <68959522+Hasyim-Kai@users.noreply.github.com>
    Date:   Wed Oct 29 13:32:47 2025 +0700

        Merge pull request #139 from dikstub-rssa/dev

        Update branch feat/resume-81

commit 2b7bea70d66e8472220a2a2406889fc489cc1ebd
Author: hasyim_kai <muhammad.hasyim.c.a@gmail.com>
Date:   Tue Nov 18 11:20:51 2025 +0700

    Fix: Typo in Control Letter

commit 808e91527cf95de2a47387bb792a3af2e16d907b
Author: hasyim_kai <muhammad.hasyim.c.a@gmail.com>
Date:   Tue Nov 18 10:59:50 2025 +0700

    Fix: add role authorization in Control Letter
This commit is contained in:
hasyim_kai
2025-11-25 14:09:25 +07:00
parent 1dd8e8e7b3
commit f6ae61849d
5 changed files with 202 additions and 12 deletions
@@ -0,0 +1,28 @@
<script setup lang="ts">
import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
import type { PaginationMeta } from '~/components/pub/my-ui/pagination/pagination.type'
import PaginationView from '~/components/pub/my-ui/pagination/pagination-view.vue'
import { config } from './history-list.cfg'
interface Props {
data: any[]
paginationMeta: PaginationMeta
}
const props = defineProps<Props>()
const isModalOpen = inject(`isHistoryDialogOpen`) as Ref<boolean>
function handlePageChange(page: number) {
emit('pageChange', page)
}
</script>
<template>
<Dialog v-model:open="isModalOpen" title="Riwayat Surat Kontrol" size="full">
<PubMyUiDataTable
v-bind="config"
:rows="data"
:skeleton-size="props.paginationMeta?.pageSize"
/>
<PaginationView :pagination-meta="props.paginationMeta" @page-change="handlePageChange" />
</Dialog>
</template>
@@ -0,0 +1,85 @@
import type { Config } from '~/components/pub/my-ui/data-table'
import type { Patient } from '~/models/patient'
import { defineAsyncComponent } from 'vue'
import { educationCodes, genderCodes } from '~/lib/constants'
import { calculateAge } from '~/lib/utils'
const action = defineAsyncComponent(() => import('~/components/pub/my-ui/data/print-btn.vue'))
export const config: Config = {
cols: [{}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {width: 130}, {width: 30},],
headers: [
[
{ label: 'NAMA PASIEN' },
{ label: 'NO.SURAT KONTROL' },
{ label: 'NO.SEP' },
{ label: 'TANGGAL RENCANA KONTROL' },
{ label: 'TANGGAL TERBIT' },
{ label: 'DPJP' },
{ label: 'SPESIALIS' },
{ label: 'SUBSPESIALIS' },
{ label: 'TIPE RAWAT' },
{ label: 'DIBUAT OLEH' },
{ label: 'DIEDIT OLEH' },
{ label: 'STATUS' },
{ label: 'AKSI' },
],
],
keys: [
'date',
'name',
'name',
'name',
'name',
'name',
'name',
'name',
'name',
'name',
'name',
'status',
'action',
],
delKeyNames: [
{ key: 'code', label: 'Kode' },
{ key: 'name', label: 'Nama' },
],
parses: {
date: (rec: unknown): unknown => {
const date = (rec as any).date
if (typeof date == 'object' && date) {
return (date as Date).toLocaleDateString('id-ID')
} else if (typeof date == 'string') {
return (date as string).substring(0, 10)
}
return date
},
specialist_subspecialist: (rec: unknown): unknown => {
return '-'
},
dpjp: (rec: unknown): unknown => {
// const { person } = rec as Patient
return '-'
},
},
components: {
action(rec, idx) {
return {
idx,
rec: rec as object,
component: action,
}
},
},
htmls: {
sep_status(_rec) {
return 'SEP Internal'
},
},
}
+58 -11
View File
@@ -11,8 +11,19 @@ import { getList, remove } from '~/services/control-letter.service'
import { toast } from '~/components/pub/ui/toast' import { toast } from '~/components/pub/ui/toast'
import type { Encounter } from '~/models/encounter' import type { Encounter } from '~/models/encounter'
import WarningAlert from '~/components/pub/my-ui/alert/warning-alert.vue' import WarningAlert from '~/components/pub/my-ui/alert/warning-alert.vue'
import type { PagePermission } from '~/models/role'
import { PAGE_PERMISSIONS } from '~/lib/page-permission'
import { unauthorizedToast } from '~/lib/utils'
import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
import DocPreviewDialog from '~/components/pub/my-ui/modal/doc-preview-dialog.vue'
import HistoryDialog from '~/components/app/control-letter/history-dialog.vue'
// #endregion // #endregion
// #region Permission
const roleAccess: PagePermission = PAGE_PERMISSIONS['/rehab/encounter']
const { getPagePermissions } = useRBAC()
const pagePermission = getPagePermissions(roleAccess)
// #region State // #region State
const props = defineProps<{ const props = defineProps<{
encounter?: Encounter encounter?: Encounter
@@ -24,6 +35,10 @@ const { data, isLoading, paginationMeta, searchInput, handlePageChange, handleSe
fetchFn: (params) => getList({ ...params, includes: 'specialist,subspecialist,doctor-employee-person', }), fetchFn: (params) => getList({ ...params, includes: 'specialist,subspecialist,doctor-employee-person', }),
entityName: 'control-letter', entityName: 'control-letter',
}) })
const historyData = usePaginatedList({
fetchFn: (params) => getList({ ...params, includes: ['person', 'person-Addresses'] }),
entityName: 'control-letter-history',
})
const refSearchNav: RefSearchNav = { const refSearchNav: RefSearchNav = {
onClick: () => { onClick: () => {
@@ -37,6 +52,10 @@ const refSearchNav: RefSearchNav = {
}, },
} }
const isHistoryDialogOpen = ref(false)
provide('isHistoryDialogOpen', isHistoryDialogOpen)
const isDocPreviewDialogOpen = ref(false)
const isRecordConfirmationOpen = ref(false) const isRecordConfirmationOpen = ref(false)
const summaryLoading = ref(false) const summaryLoading = ref(false)
const isRequirementsMet = ref(true) const isRequirementsMet = ref(true)
@@ -44,17 +63,20 @@ const isRequirementsMet = ref(true)
const recId = ref<number>(0) const recId = ref<number>(0)
const recAction = ref<string>('') const recAction = ref<string>('')
const recItem = ref<any>(null) const recItem = ref<any>(null)
const timestamp = ref(new Date().toISOString())
const headerPrep: HeaderPrep = { const headerPrep: HeaderPrep = {
title: "Surat Kontrol", title: "Surat Kontrol",
icon: 'i-lucide-newspaper', icon: 'i-lucide-newspaper',
addNav: { }
if (pagePermission.canCreate) {
headerPrep.addNav = {
label: "Surat Kontrol", label: "Surat Kontrol",
onClick: () => navigateTo({ onClick: () => navigateTo({
name: 'rehab-encounter-id-control-letter-add', name: 'rehab-encounter-id-control-letter-add',
params: { id: encounterId }, params: { id: encounterId },
}), }),
}, }
} }
// #endregion // #endregion
@@ -105,11 +127,12 @@ function handleCancelConfirmation() {
provide('rec_id', recId) provide('rec_id', recId)
provide('rec_action', recAction) provide('rec_action', recAction)
provide('rec_item', recItem) provide('rec_item', recItem)
provide('timestamp', isLoading)
provide('table_data_loader', isLoading) provide('table_data_loader', isLoading)
// #endregion // #endregion
// #region Watchers // #region Watchers
watch([recId, recAction], () => { watch([recId, recAction, timestamp], () => {
switch (recAction.value) { switch (recAction.value) {
case ActionEvents.showDetail: case ActionEvents.showDetail:
navigateTo({ navigateTo({
@@ -119,17 +142,22 @@ watch([recId, recAction], () => {
break break
case ActionEvents.showEdit: case ActionEvents.showEdit:
// TODO: Handle edit action if(pagePermission.canUpdate){
// isFormEntryDialogOpen.value = true navigateTo({
navigateTo({ name: 'rehab-encounter-id-control-letter-control_letter_id-edit',
name: 'rehab-encounter-id-control-letter-control_letter_id-edit', params: { id: encounterId, "control_letter_id": recId.value },
params: { id: encounterId, "control_letter_id": recId.value }, })
}) } else {
unauthorizedToast()
}
break break
case ActionEvents.showConfirmDelete: case ActionEvents.showConfirmDelete:
// Trigger confirmation modal open if(pagePermission.canDelete){
isRecordConfirmationOpen.value = true isRecordConfirmationOpen.value = true
} else {
unauthorizedToast()
}
break break
} }
}) })
@@ -151,8 +179,19 @@ watch([recId, recAction], () => {
:ref-search-nav="refSearchNav" :ref-search-nav="refSearchNav"
@search="handleSearch" /> @search="handleSearch" />
<div class="mb-3 flex justify-end items-center">
<Button variant="outline"
class="gap-1 bg-transparent items-center text-orange-400 border-orange-400"
@click="isHistoryDialogOpen = true">
<Icon name="i-lucide-history" class="h-4 w-4" /> Riwayat Program Nasional</Button>
</div>
<AppControlLetterList :data="data" :pagination-meta="paginationMeta" @page-change="handlePageChange" /> <AppControlLetterList :data="data" :pagination-meta="paginationMeta" @page-change="handlePageChange" />
<Dialog v-model:open="isDocPreviewDialogOpen" title="Preview Dokumen" size="2xl">
<DocPreviewDialog :link="`https://www.antennahouse.com/hubfs/xsl-fo-sample/pdf/basic-link-1.pdf`" />
</Dialog>
<RecordConfirmation v-model:open="isRecordConfirmationOpen" action="delete" :record="recItem" <RecordConfirmation v-model:open="isRecordConfirmationOpen" action="delete" :record="recItem"
@confirm="handleConfirmDelete" @cancel="handleCancelConfirmation"> @confirm="handleConfirmDelete" @cancel="handleCancelConfirmation">
<template #default="{ record }"> <template #default="{ record }">
@@ -172,5 +211,13 @@ watch([recId, recAction], () => {
</div> </div>
</template> </template>
</RecordConfirmation> </RecordConfirmation>
<HistoryDialog
v-model:is-modal-open="isHistoryDialogOpen"
:data="historyData.data.value"
:pagination-meta="historyData.paginationMeta"
@page-change="historyData.handlePageChange"
/>
</div> </div>
</template> </template>
@@ -0,0 +1,30 @@
<script setup lang="ts">
import { ActionEvents, type ListItemDto } from '~/components/pub/my-ui/data/types';
const props = defineProps<{
url: string
btnTxt?: string
rec: ListItemDto
}>()
const recId = inject<Ref<number>>('rec_id')!
const recAction = inject<Ref<string>>('rec_action')!
const recItem = inject<Ref<any>>('rec_item')!
const timestamp = inject<Ref<any>>('timestamp')!
function handlePrint() {
recId.value = props.rec.id || 0
recAction.value = ActionEvents.showPrint
recItem.value = props.rec
timestamp.value = new Date().toISOString()
}
</script>
<template>
<Button
class="gap-3 items-center border-orange-400 text-orange-400"
variant="outline" @click="handlePrint">
<Icon name="i-lucide-printer" class="h-4 w-4" />
{{ props.btnTxt || 'Preview' }}
</Button>
</template>
+1 -1
View File
@@ -160,4 +160,4 @@ export function unauthorizedToast() {
description: 'You are not authorized to perform this action.', description: 'You are not authorized to perform this action.',
variant: 'destructive', variant: 'destructive',
}) })
} }