Merge pull request #172 from dikstub-rssa/feat/uploads-85-after-reset
Fix: debug Uplaod Doc after reset
This commit is contained in:
@@ -6,8 +6,8 @@ import { handleActionSave,} from '~/handlers/supporting-document.handler'
|
|||||||
import { toast } from '~/components/pub/ui/toast'
|
import { toast } from '~/components/pub/ui/toast'
|
||||||
import Confirmation from '~/components/pub/my-ui/confirmation/confirmation.vue'
|
import Confirmation from '~/components/pub/my-ui/confirmation/confirmation.vue'
|
||||||
import { DocumentUploadSchema } from '~/schemas/document-upload.schema'
|
import { DocumentUploadSchema } from '~/schemas/document-upload.schema'
|
||||||
|
import { toFormData } from '~/lib/utils'
|
||||||
import { uploadAttachment } from '~/services/supporting-document.service'
|
import { uploadAttachment } from '~/services/supporting-document.service'
|
||||||
import { printFormData, toFormData } from '~/lib/utils'
|
|
||||||
|
|
||||||
// #region Props & Emits
|
// #region Props & Emits
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
|
|||||||
@@ -7,6 +7,21 @@ import { getList, remove } from '~/services/supporting-document.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 RecordConfirmation from '~/components/pub/my-ui/confirmation/record-confirmation.vue'
|
import RecordConfirmation from '~/components/pub/my-ui/confirmation/record-confirmation.vue'
|
||||||
|
import DocPreviewDialog from '~/components/pub/my-ui/modal/doc-preview-dialog.vue'
|
||||||
|
import Dialog from '~/components/pub/my-ui/modal/dialog.vue'
|
||||||
|
import type { PagePermission } from '~/models/role'
|
||||||
|
import { PAGE_PERMISSIONS } from '~/lib/page-permission'
|
||||||
|
import { unauthorizedToast } from '~/lib/utils'
|
||||||
|
// #endregion
|
||||||
|
|
||||||
|
|
||||||
|
// #region Permission
|
||||||
|
const roleAccess: PagePermission = PAGE_PERMISSIONS['/rehab/encounter']
|
||||||
|
const { getPagePermissions } = useRBAC()
|
||||||
|
const pagePermission = getPagePermissions(roleAccess)
|
||||||
|
|
||||||
|
const {user,userRole} = useUserStore()
|
||||||
|
const {getUserPermissions} = useRBAC()
|
||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
// #region State
|
// #region State
|
||||||
@@ -19,7 +34,7 @@ const route = useRoute()
|
|||||||
const encounterId = typeof route.params.id == 'string' ? parseInt(route.params.id) : 0
|
const encounterId = typeof route.params.id == 'string' ? parseInt(route.params.id) : 0
|
||||||
|
|
||||||
const { data, paginationMeta, handlePageChange, handleSearch, searchInput, fetchData } = usePaginatedList({
|
const { data, paginationMeta, handlePageChange, handleSearch, searchInput, fetchData } = usePaginatedList({
|
||||||
fetchFn: (params) => getList({
|
fetchFn: (params) => getList({
|
||||||
'encounter-id': encounterId,
|
'encounter-id': encounterId,
|
||||||
// includes: "employee",
|
// includes: "employee",
|
||||||
...params,
|
...params,
|
||||||
@@ -27,6 +42,7 @@ const { data, paginationMeta, handlePageChange, handleSearch, searchInput, fetch
|
|||||||
entityName: 'encounter-document',
|
entityName: 'encounter-document',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const isDocPreviewDialogOpen = ref(false)
|
||||||
const isRecordConfirmationOpen = ref(false)
|
const isRecordConfirmationOpen = ref(false)
|
||||||
const recId = ref<number>(0)
|
const recId = ref<number>(0)
|
||||||
const recAction = ref<string>('')
|
const recAction = ref<string>('')
|
||||||
@@ -36,13 +52,15 @@ const timestamp = ref<number>(0)
|
|||||||
const headerPrep: HeaderPrep = {
|
const headerPrep: HeaderPrep = {
|
||||||
title: "Upload Dokumen",
|
title: "Upload Dokumen",
|
||||||
icon: 'i-lucide-newspaper',
|
icon: 'i-lucide-newspaper',
|
||||||
addNav: {
|
}
|
||||||
|
if (pagePermission.canCreate) {
|
||||||
|
headerPrep.addNav = {
|
||||||
label: "Upload Dokumen",
|
label: "Upload Dokumen",
|
||||||
onClick: () => navigateTo({
|
onClick: () => navigateTo({
|
||||||
name: 'rehab-encounter-id-document-upload-add',
|
name: 'rehab-encounter-id-document-upload-add',
|
||||||
params: { id: encounterId },
|
params: { id: encounterId },
|
||||||
}),
|
}),
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const refSearchNav: RefSearchNav = {
|
const refSearchNav: RefSearchNav = {
|
||||||
@@ -101,6 +119,24 @@ provide('timestamp', timestamp)
|
|||||||
watch([recId, recAction, timestamp], () => {
|
watch([recId, recAction, timestamp], () => {
|
||||||
switch (recAction.value) {
|
switch (recAction.value) {
|
||||||
case ActionEvents.showDetail:
|
case ActionEvents.showDetail:
|
||||||
|
isDocPreviewDialogOpen.value = true
|
||||||
|
break
|
||||||
|
case ActionEvents.showEdit:
|
||||||
|
if(pagePermission.canUpdate){
|
||||||
|
navigateTo({
|
||||||
|
name: 'rehab-encounter-id-document-upload-document_id-edit',
|
||||||
|
params: { id: encounterId, "document_id": recId.value },
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
unauthorizedToast()
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case ActionEvents.showConfirmDelete:
|
||||||
|
if(pagePermission.canDelete){
|
||||||
|
isRecordConfirmationOpen.value = true
|
||||||
|
} else {
|
||||||
|
unauthorizedToast()
|
||||||
|
}
|
||||||
navigateTo(recItem.value.filePath, { external: true, open: { target: '_blank' } })
|
navigateTo(recItem.value.filePath, { external: true, open: { target: '_blank' } })
|
||||||
break
|
break
|
||||||
case ActionEvents.showEdit:
|
case ActionEvents.showEdit:
|
||||||
@@ -140,4 +176,8 @@ watch([recId, recAction, timestamp], () => {
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</RecordConfirmation>
|
</RecordConfirmation>
|
||||||
|
|
||||||
|
<Dialog v-model:open="isDocPreviewDialogOpen" title="Preview Dokumen" size="2xl">
|
||||||
|
<DocPreviewDialog :link="recItem?.filePath" />
|
||||||
|
</Dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import { getDetail } from '~/services/encounter.service'
|
|||||||
import type { TabItem } from '~/components/pub/my-ui/comp-tab/type'
|
import type { TabItem } from '~/components/pub/my-ui/comp-tab/type'
|
||||||
import CompTab from '~/components/pub/my-ui/comp-tab/comp-tab.vue'
|
import CompTab from '~/components/pub/my-ui/comp-tab/comp-tab.vue'
|
||||||
|
|
||||||
|
import { genEncounter } from '~/models/encounter'
|
||||||
|
|
||||||
// PLASE ORDER BY TAB POSITION
|
// PLASE ORDER BY TAB POSITION
|
||||||
import Status from '~/components/content/encounter/status.vue'
|
import Status from '~/components/content/encounter/status.vue'
|
||||||
import AssesmentFunctionList from '~/components/content/soapi/entry.vue'
|
import AssesmentFunctionList from '~/components/content/soapi/entry.vue'
|
||||||
@@ -19,7 +21,6 @@ import CpLabOrder from '~/components/content/cp-lab-order/main.vue'
|
|||||||
import Radiology from '~/components/content/radiology-order/main.vue'
|
import Radiology from '~/components/content/radiology-order/main.vue'
|
||||||
import Consultation from '~/components/content/consultation/list.vue'
|
import Consultation from '~/components/content/consultation/list.vue'
|
||||||
import DocUploadList from '~/components/content/document-upload/list.vue'
|
import DocUploadList from '~/components/content/document-upload/list.vue'
|
||||||
import { genEncounter } from '~/models/encounter'
|
|
||||||
import GeneralConsentList from '~/components/content/general-consent/entry.vue'
|
import GeneralConsentList from '~/components/content/general-consent/entry.vue'
|
||||||
import ResumeList from '~/components/content/resume/list.vue'
|
import ResumeList from '~/components/content/resume/list.vue'
|
||||||
import ControlLetterList from '~/components/content/control-letter/list.vue'
|
import ControlLetterList from '~/components/content/control-letter/list.vue'
|
||||||
|
|||||||
@@ -2,14 +2,9 @@
|
|||||||
import type { LinkItem, ListItemDto } from './types'
|
import type { LinkItem, ListItemDto } from './types'
|
||||||
import { ActionEvents } from './types'
|
import { ActionEvents } from './types'
|
||||||
|
|
||||||
interface Props {
|
const props = defineProps<{
|
||||||
rec: ListItemDto
|
rec: ListItemDto
|
||||||
size?: 'default' | 'sm' | 'lg'
|
}>()
|
||||||
}
|
|
||||||
|
|
||||||
const props = withDefaults(defineProps<Props>(), {
|
|
||||||
size: 'lg',
|
|
||||||
})
|
|
||||||
|
|
||||||
const recId = inject<Ref<number>>('rec_id')!
|
const recId = inject<Ref<number>>('rec_id')!
|
||||||
const recAction = inject<Ref<string>>('rec_action')!
|
const recAction = inject<Ref<string>>('rec_action')!
|
||||||
@@ -63,7 +58,7 @@ function del() {
|
|||||||
<DropdownMenu>
|
<DropdownMenu>
|
||||||
<DropdownMenuTrigger as-child>
|
<DropdownMenuTrigger as-child>
|
||||||
<SidebarMenuButton
|
<SidebarMenuButton
|
||||||
:size="size"
|
size="lg"
|
||||||
class="data-[state=open]:text-sidebar-accent-foreground data-[state=open]:bg-white dark:data-[state=open]:bg-slate-800"
|
class="data-[state=open]:text-sidebar-accent-foreground data-[state=open]:bg-white dark:data-[state=open]:bg-slate-800"
|
||||||
>
|
>
|
||||||
<Icon
|
<Icon
|
||||||
|
|||||||
@@ -51,7 +51,6 @@ export function useRBAC() {
|
|||||||
canDelete: hasDeleteAccess(roleAccess),
|
canDelete: hasDeleteAccess(roleAccess),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
checkRole,
|
checkRole,
|
||||||
checkPermission,
|
checkPermission,
|
||||||
@@ -61,6 +60,6 @@ export function useRBAC() {
|
|||||||
hasUpdateAccess,
|
hasUpdateAccess,
|
||||||
hasDeleteAccess,
|
hasDeleteAccess,
|
||||||
getPagePermissions,
|
getPagePermissions,
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,47 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import type { PagePermission } from '~/models/role'
|
|
||||||
import Error from '~/components/pub/my-ui/error/error.vue'
|
|
||||||
import { PAGE_PERMISSIONS } from '~/lib/page-permission'
|
|
||||||
import ContentChemotherapyAdminList from '~/components/content/chemotherapy/admin-list.vue'
|
|
||||||
import ContentChemotherapyVerification from '~/components/content/chemotherapy/verification.vue'
|
|
||||||
|
|
||||||
definePageMeta({
|
|
||||||
middleware: ['rbac'],
|
|
||||||
roles: ['doctor', 'nurse', 'admisi', 'pharmacy', 'billing', 'management'],
|
|
||||||
title: 'Kemoterapi Admin',
|
|
||||||
contentFrame: 'cf-full-width',
|
|
||||||
})
|
|
||||||
|
|
||||||
const route = useRoute()
|
|
||||||
|
|
||||||
useHead({
|
|
||||||
title: () => 'Verifikasi Jadwal Pasien',
|
|
||||||
})
|
|
||||||
|
|
||||||
const roleAccess: PagePermission = PAGE_PERMISSIONS['/doctor'] || {}
|
|
||||||
|
|
||||||
const { checkRole, hasReadAccess } = useRBAC()
|
|
||||||
|
|
||||||
// Check if user has access to this page
|
|
||||||
const hasAccess = checkRole(roleAccess)
|
|
||||||
if (!hasAccess) {
|
|
||||||
navigateTo('/403')
|
|
||||||
}
|
|
||||||
|
|
||||||
// Define permission-based computed properties
|
|
||||||
const canRead = true // hasReadAccess(roleAccess)
|
|
||||||
|
|
||||||
const mode = computed(() => route.params.mode as string)
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div>
|
|
||||||
<div v-if="canRead">
|
|
||||||
<ContentChemotherapyVerification />
|
|
||||||
</div>
|
|
||||||
<Error
|
|
||||||
v-else
|
|
||||||
:status-code="403"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import type { PagePermission } from '~/models/role'
|
|
||||||
import Error from '~/components/pub/my-ui/error/error.vue'
|
|
||||||
import { PAGE_PERMISSIONS } from '~/lib/page-permission'
|
|
||||||
|
|
||||||
definePageMeta({
|
|
||||||
middleware: ['rbac'],
|
|
||||||
roles: ['doctor', 'nurse', 'admisi', 'pharmacy', 'billing', 'management'],
|
|
||||||
title: 'Daftar Kempterapi',
|
|
||||||
contentFrame: 'cf-full-width',
|
|
||||||
})
|
|
||||||
|
|
||||||
const route = useRoute()
|
|
||||||
|
|
||||||
useHead({
|
|
||||||
title: () => route.meta.title as string,
|
|
||||||
})
|
|
||||||
|
|
||||||
const roleAccess: PagePermission = PAGE_PERMISSIONS['/doctor']
|
|
||||||
|
|
||||||
const { checkRole, hasReadAccess } = useRBAC()
|
|
||||||
|
|
||||||
// Check if user has access to this page
|
|
||||||
const hasAccess = checkRole(roleAccess)
|
|
||||||
if (!hasAccess) {
|
|
||||||
navigateTo('/403')
|
|
||||||
}
|
|
||||||
|
|
||||||
// Define permission-based computed properties
|
|
||||||
const canRead = true // hasReadAccess(roleAccess)
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div>
|
|
||||||
<div v-if="canRead">
|
|
||||||
<ContentChemotherapyList />
|
|
||||||
</div>
|
|
||||||
<Error v-else :status-code="403" />
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
@@ -16,9 +16,9 @@ useHead({
|
|||||||
title: () => route.meta.title as string,
|
title: () => route.meta.title as string,
|
||||||
})
|
})
|
||||||
|
|
||||||
const roleAccess: PagePermission = PAGE_PERMISSIONS['/patient']
|
const roleAccess: PagePermission = PAGE_PERMISSIONS['/rehab/encounter']
|
||||||
|
|
||||||
const { checkRole, hasReadAccess } = useRBAC()
|
const { checkRole, getPagePermissions } = useRBAC()
|
||||||
|
|
||||||
// Check if user has access to this page
|
// Check if user has access to this page
|
||||||
const hasAccess = checkRole(roleAccess)
|
const hasAccess = checkRole(roleAccess)
|
||||||
@@ -27,14 +27,13 @@ const hasAccess = checkRole(roleAccess)
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
// Define permission-based computed properties
|
// Define permission-based computed properties
|
||||||
// const canRead = hasReadAccess(roleAccess)
|
const pagePermission = getPagePermissions(roleAccess)
|
||||||
const canRead = true
|
|
||||||
const callbackUrl = route.query['return-path'] as string | undefined
|
const callbackUrl = route.query['return-path'] as string | undefined
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<div v-if="canRead">
|
<div v-if="pagePermission.canRead">
|
||||||
<ContentControlLetterAdd :callback-url="callbackUrl" />
|
<ContentControlLetterAdd :callback-url="callbackUrl" />
|
||||||
</div>
|
</div>
|
||||||
<Error v-else :status-code="403" />
|
<Error v-else :status-code="403" />
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { PAGE_PERMISSIONS } from '~/lib/page-permission'
|
|||||||
definePageMeta({
|
definePageMeta({
|
||||||
middleware: ['rbac'],
|
middleware: ['rbac'],
|
||||||
roles: ['doctor', 'nurse', 'admisi', 'pharmacy', 'billing', 'management'],
|
roles: ['doctor', 'nurse', 'admisi', 'pharmacy', 'billing', 'management'],
|
||||||
title: 'Update Surat Kontrol',
|
title: 'Update Dokumen Pendukung',
|
||||||
contentFrame: 'cf-full-width',
|
contentFrame: 'cf-full-width',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { PAGE_PERMISSIONS } from '~/lib/page-permission'
|
|||||||
definePageMeta({
|
definePageMeta({
|
||||||
middleware: ['rbac'],
|
middleware: ['rbac'],
|
||||||
roles: ['doctor', 'nurse', 'admisi', 'pharmacy', 'billing', 'management'],
|
roles: ['doctor', 'nurse', 'admisi', 'pharmacy', 'billing', 'management'],
|
||||||
title: 'Tambah Surat Kontrol',
|
title: 'Tambah Dokumen Pendukung',
|
||||||
contentFrame: 'cf-full-width',
|
contentFrame: 'cf-full-width',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ useHead({
|
|||||||
|
|
||||||
const roleAccess: PagePermission = PAGE_PERMISSIONS['/rehab/encounter']
|
const roleAccess: PagePermission = PAGE_PERMISSIONS['/rehab/encounter']
|
||||||
|
|
||||||
const { checkRole, hasCreateAccess } = useRBAC()
|
const { checkRole, hasCreateAccess, getPagePermissions } = useRBAC()
|
||||||
|
|
||||||
// Check if user has access to this page
|
// Check if user has access to this page
|
||||||
const hasAccess = checkRole(roleAccess)
|
const hasAccess = checkRole(roleAccess)
|
||||||
@@ -30,11 +30,11 @@ const hasAccess = checkRole(roleAccess)
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
// Define permission-based computed properties
|
// Define permission-based computed properties
|
||||||
const canCreate = true // hasCreateAccess(roleAccess)
|
const pagePermission = getPagePermissions(roleAccess)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div v-if="canCreate">
|
<div v-if="pagePermission.canRead">
|
||||||
<ContentEncounterProcess />
|
<ContentEncounterProcess />
|
||||||
</div>
|
</div>
|
||||||
<Error v-else :status-code="403" />
|
<Error v-else :status-code="403" />
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ const MAX_SIZE_BYTES = 1 * 1024 * 1024 // 1MB
|
|||||||
const DocumentUploadSchema = z.object({
|
const DocumentUploadSchema = z.object({
|
||||||
entityType_code: z.string().default('encounter'),
|
entityType_code: z.string().default('encounter'),
|
||||||
ref_id: z.number(),
|
ref_id: z.number(),
|
||||||
upload_employee_id: z.number(),
|
upload_employee_id: z.number().optional(),
|
||||||
|
// upload_employee_id: z.number(),
|
||||||
name: z.string({ required_error: 'Mohon isi', }),
|
name: z.string({ required_error: 'Mohon isi', }),
|
||||||
type_code: z.string({ required_error: 'Mohon isi', }),
|
type_code: z.string({ required_error: 'Mohon isi', }),
|
||||||
content: z.custom<File>()
|
content: z.custom<File>()
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
import * as base from './_crud-base'
|
import * as base from './_crud-base'
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
import { encounterClassCodes, uploadCode, type UploadCodeKey } from '~/lib/constants'
|
import { uploadCode, type UploadCodeKey } from '~/lib/constants'
|
||||||
|
|
||||||
const path = '/api/v1/encounter-document'
|
const path = '/api/v1/encounter-document'
|
||||||
const create_path = '/api/v1/upload'
|
const create_path = '/api/v1/upload-file'
|
||||||
const name = 'encounter-document'
|
const name = 'encounter-document'
|
||||||
|
|
||||||
export function create(data: any) {
|
export function create(data: any) {
|
||||||
@@ -53,4 +53,4 @@ export async function uploadAttachment(file: File, userId: number, key: UploadCo
|
|||||||
console.error('Error uploading attachment:', error)
|
console.error('Error uploading attachment:', error)
|
||||||
throw new Error('Failed to upload attachment')
|
throw new Error('Failed to upload attachment')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -199,6 +199,11 @@
|
|||||||
"title": "Peserta",
|
"title": "Peserta",
|
||||||
"icon": "i-lucide-circuit-board",
|
"icon": "i-lucide-circuit-board",
|
||||||
"link": "/integration/bpjs/member"
|
"link": "/integration/bpjs/member"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "Surat Kontrol",
|
||||||
|
"icon": "i-lucide-circuit-board",
|
||||||
|
"link": "/integration/bpjs/control-letter"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user