diff --git a/app/components/content/chemotherapy/process.vue b/app/components/content/chemotherapy/process.vue index 7f355b4b..aa71e381 100644 --- a/app/components/content/chemotherapy/process.vue +++ b/app/components/content/chemotherapy/process.vue @@ -3,5 +3,5 @@ import EncounterHome from '~/components/content/encounter/home.vue' diff --git a/app/components/content/encounter/home.vue b/app/components/content/encounter/home.vue index 1f2c2943..9e71ecd3 100644 --- a/app/components/content/encounter/home.vue +++ b/app/components/content/encounter/home.vue @@ -3,6 +3,7 @@ import { computed } from 'vue' import { useRoute, useRouter } from 'vue-router' import { getDetail } from '~/services/encounter.service' +import { getPositionAs } from '~/lib/roles' import type { TabItem } from '~/components/pub/my-ui/comp-tab/type' import CompTab from '~/components/pub/my-ui/comp-tab/comp-tab.vue' @@ -17,11 +18,15 @@ import Consultation from '~/components/content/consultation/list.vue' import ProtocolList from '~/components/app/chemotherapy/list.protocol.vue' import MedicineProtocolList from '~/components/app/chemotherapy/list.medicine.vue' +const authStore = useUserStore() const route = useRoute() const router = useRouter() +const activeRole = authStore.getActiveRole() +const activePosition = getPositionAs(activeRole) const props = defineProps<{ - classes?: string + classCode?: 'ambulatory' | 'emergency' | 'inpatient' | 'outpatient' + subClassCode?: 'reg' | 'rehab' | 'chemo' | 'emg' | 'eon' | 'op' | 'icu' | 'hcu' | 'vk' }>() // activeTab selalu sinkron dengan query param @@ -93,82 +98,202 @@ const tabsRaws: TabItem[] = [ { value: 'status', label: 'Status Masuk/Keluar', - groups: ['ambulatory', 'rehabilitation', 'chemotherapy'], + groups: ['medical'], + classCode: ['ambulatory', 'emergency', 'inpatient'], + subClassCode: ['reg', 'rehab', 'chemo', 'emg', 'eon', 'op', 'icu', 'hcu', 'vk'], component: Status, props: { encounter: data }, }, { value: 'early-medical-assessment', label: 'Pengkajian Awal Medis', - groups: ['ambulatory', 'rehabilitation', 'chemotherapy'], + groups: ['medical'], + classCode: ['ambulatory', 'emergency', 'inpatient'], + subClassCode: ['reg', 'rehab', 'chemo', 'emg', 'eon', 'op', 'icu', 'hcu', 'vk'], component: EarlyMedicalAssesmentList, }, { value: 'rehab-medical-assessment', label: 'Pengkajian Awal Medis Rehabilitasi Medis', - groups: ['ambulatory', 'rehabilitation', 'chemotherapy'], + groups: ['medical'], + classCode: ['ambulatory', 'emergency', 'inpatient'], + subClassCode: ['reg', 'rehab', 'chemo', 'emg', 'eon', 'op', 'icu', 'hcu', 'vk'], component: EarlyMedicalRehabList, }, { value: 'function-assessment', label: 'Asesmen Fungsi', - groups: ['ambulatory', 'rehabilitation'], + groups: ['medical'], + classCode: ['ambulatory', 'emergency', 'inpatient'], + subClassCode: ['reg', 'rehab', 'emg', 'eon', 'op', 'icu', 'hcu', 'vk'], component: AssesmentFunctionList, }, - { value: 'therapy-protocol', groups: ['ambulatory', 'rehabilitation'], label: 'Protokol Terapi' }, + { + value: 'therapy-protocol', + groups: ['medical'], + classCode: ['ambulatory'], + subClassCode: ['rehab'], + label: 'Protokol Terapi', + }, { value: 'chemotherapy-protocol', label: 'Protokol Kemoterapi', - groups: ['chemotherapy'], + groups: ['medical', 'verificator'], + classCode: ['ambulatory'], + subClassCode: ['chemo'], component: ProtocolList, props: { data: protocolRows, paginationMeta }, }, { value: 'chemotherapy-medicine', label: 'Protokol Obat Kemoterapi', - groups: ['chemotherapy'], + groups: ['medical', 'verificator'], + classCode: ['ambulatory'], + subClassCode: ['chemo'], component: MedicineProtocolList, props: { data: protocolRows, paginationMeta }, }, - { value: 'report', label: 'Laporan Tindakan', groups: ['chemotherapy'] }, - { value: 'patient-note', label: 'CPRJ', groups: ['ambulatory', 'rehabilitation', 'chemotherapy'] }, + { + value: 'report', + label: 'Laporan Tindakan', + groups: ['medical'], + classCode: ['ambulatory'], + subClassCode: ['chemo'], + }, + { + value: 'patient-note', + label: 'CPRJ', + groups: ['medical'], + classCode: ['ambulatory', 'emergency', 'inpatient'], + subClassCode: ['reg', 'rehab', 'emg', 'eon', 'op', 'icu', 'hcu', 'vk'], + }, { value: 'education-assessment', label: 'Asesmen Kebutuhan Edukasi', - groups: ['ambulatory', 'rehabilitation', 'chemotherapy'], + groups: ['medical'], + classCode: ['ambulatory', 'emergency', 'inpatient'], + subClassCode: ['reg', 'rehab', 'emg', 'eon', 'op', 'icu', 'hcu', 'vk'], + }, + { + value: 'consent', + label: 'General Consent', + groups: ['medical'], + classCode: ['ambulatory', 'emergency', 'inpatient'], + subClassCode: ['reg', 'rehab', 'emg', 'eon', 'op', 'icu', 'hcu', 'vk'], + }, + { + value: 'patient-note', + label: 'CPRJ', + groups: ['medical'], + classCode: ['ambulatory', 'emergency', 'inpatient'], + subClassCode: ['reg', 'rehab', 'emg', 'eon', 'op', 'icu', 'hcu', 'vk'], }, - { value: 'consent', label: 'General Consent', groups: ['ambulatory', 'rehabilitation', 'chemotherapy'] }, - { value: 'patient-note', label: 'CPRJ', groups: ['ambulatory', 'rehabilitation', 'chemotherapy'] }, { value: 'prescription', label: 'Order Obat', - groups: ['ambulatory', 'rehabilitation', 'chemotherapy'], + groups: ['medical'], + classCode: ['ambulatory', 'emergency', 'inpatient'], + subClassCode: ['reg', 'rehab', 'emg', 'eon', 'op', 'icu', 'hcu', 'vk'], component: PrescriptionList, }, - { value: 'device', label: 'Order Alkes', groups: ['ambulatory', 'rehabilitation', 'chemotherapy'] }, - { value: 'mcu-radiology', label: 'Order Radiologi', groups: ['ambulatory', 'rehabilitation', 'chemotherapy'] }, - { value: 'mcu-lab-pc', label: 'Order Lab PK', groups: ['ambulatory', 'rehabilitation', 'chemotherapy'] }, - { value: 'mcu-lab-micro', label: 'Order Lab Mikro', groups: ['ambulatory', 'rehabilitation', 'chemotherapy'] }, - { value: 'mcu-lab-pa', label: 'Order Lab PA', groups: ['ambulatory', 'rehabilitation', 'chemotherapy'] }, - { value: 'medical-action', label: 'Order Ruang Tindakan', groups: ['ambulatory', 'rehabilitation', 'chemotherapy'] }, - { value: 'mcu-result', label: 'Hasil Penunjang', groups: ['ambulatory', 'rehabilitation', 'chemotherapy'] }, + { + value: 'device', + label: 'Order Alkes', + groups: ['medical'], + classCode: ['ambulatory', 'emergency', 'inpatient'], + subClassCode: ['reg', 'rehab', 'emg', 'eon', 'op', 'icu', 'hcu', 'vk'], + }, + { + value: 'mcu-radiology', + label: 'Order Radiologi', + groups: ['medical'], + classCode: ['ambulatory', 'emergency', 'inpatient'], + subClassCode: ['reg', 'rehab', 'emg', 'eon', 'op', 'icu', 'hcu', 'vk'], + }, + { + value: 'mcu-lab-pc', + label: 'Order Lab PK', + groups: ['medical'], + classCode: ['ambulatory', 'emergency', 'inpatient'], + subClassCode: ['reg', 'rehab', 'emg', 'eon', 'op', 'icu', 'hcu', 'vk'], + }, + { + value: 'mcu-lab-micro', + label: 'Order Lab Mikro', + groups: ['medical'], + classCode: ['ambulatory', 'emergency', 'inpatient'], + subClassCode: ['reg', 'rehab', 'emg', 'eon', 'op', 'icu', 'hcu', 'vk'], + }, + { + value: 'mcu-lab-pa', + label: 'Order Lab PA', + groups: ['medical'], + classCode: ['ambulatory', 'emergency', 'inpatient'], + subClassCode: ['reg', 'rehab', 'emg', 'eon', 'op', 'icu', 'hcu', 'vk'], + }, + { + value: 'medical-action', + label: 'Order Ruang Tindakan', + groups: ['medical'], + classCode: ['ambulatory', 'emergency', 'inpatient'], + subClassCode: ['reg', 'rehab', 'emg', 'eon', 'op', 'icu', 'hcu', 'vk'], + }, + { + value: 'mcu-result', + label: 'Hasil Penunjang', + groups: ['medical'], + classCode: ['ambulatory', 'emergency', 'inpatient'], + subClassCode: ['reg', 'rehab', 'emg', 'eon', 'op', 'icu', 'hcu', 'vk'], + }, { value: 'consultation', label: 'Konsultasi', - groups: ['ambulatory', 'rehabilitation', 'chemotherapy'], + groups: ['medical'], + classCode: ['ambulatory', 'emergency', 'inpatient'], + subClassCode: ['reg', 'rehab', 'emg', 'eon', 'op', 'icu', 'hcu', 'vk'], component: Consultation, props: { encounter: data }, }, - { value: 'resume', label: 'Resume', groups: ['ambulatory', 'rehabilitation', 'chemotherapy'] }, - { value: 'control', label: 'Surat Kontrol', groups: ['ambulatory', 'rehabilitation', 'chemotherapy'] }, - { value: 'screening', label: 'Skrinning MPP', groups: ['ambulatory', 'rehabilitation', 'chemotherapy'] }, - { value: 'supporting-document', label: 'Upload Dokumen Pendukung', groups: ['ambulatory', 'rehabilitation'] }, - { value: 'price-list', label: 'Tarif Tindakan', groups: ['ambulatory', 'rehabilitation', 'chemotherapy'] }, + { + value: 'resume', + label: 'Resume', + groups: ['medical'], + classCode: ['ambulatory', 'emergency', 'inpatient'], + subClassCode: ['reg', 'rehab', 'emg', 'eon', 'op', 'icu', 'hcu', 'vk'], + }, + { + value: 'control', + label: 'Surat Kontrol', + groups: ['medical'], + classCode: ['ambulatory', 'emergency', 'inpatient'], + subClassCode: ['reg', 'rehab', 'emg', 'eon', 'op', 'icu', 'hcu', 'vk'], + }, + { + value: 'screening', + label: 'Skrinning MPP', + groups: ['medical'], + classCode: ['ambulatory', 'emergency', 'inpatient'], + subClassCode: ['reg', 'rehab', 'emg', 'eon', 'op', 'icu', 'hcu', 'vk'], + }, + { + value: 'supporting-document', + label: 'Upload Dokumen Pendukung', + groups: ['medical'], + classCode: ['ambulatory'], + subClassCode: ['rehab'], + }, + { + value: 'price-list', + label: 'Tarif Tindakan', + groups: ['medical'], + classCode: ['ambulatory', 'emergency', 'inpatient'], + subClassCode: ['reg', 'rehab', 'emg', 'eon', 'op', 'icu', 'hcu', 'vk'], + }, ] const tabs = computed(() => { return tabsRaws - .filter((tab: TabItem) => tab.groups ? tab.groups.some((group: string) => props.classes?.includes(group)) : true) + .filter((tab: TabItem) => (tab.groups ? tab.groups.some((group: string) => group?.includes(activePosition)) : true)) .map((tab: TabItem) => { return { ...tab, props: { ...tab.props, encounter: data } } }) diff --git a/app/components/pub/my-ui/comp-tab/type.ts b/app/components/pub/my-ui/comp-tab/type.ts index ba21d0b7..6ca710fa 100644 --- a/app/components/pub/my-ui/comp-tab/type.ts +++ b/app/components/pub/my-ui/comp-tab/type.ts @@ -3,5 +3,7 @@ export interface TabItem { label: string component?: any groups?: string[] + classCode?: string[] + subClassCode?: string[] props?: Record } diff --git a/app/lib/roles.ts b/app/lib/roles.ts new file mode 100644 index 00000000..4a7be625 --- /dev/null +++ b/app/lib/roles.ts @@ -0,0 +1,14 @@ +const standartRoles = ['emp|doc', 'emp|nur', 'emp|reg', 'emp|pha', 'emp|pay', 'emp|mng'] +const verificatorRole = 'verificator' + +export function getPositionAs(roleAccess: string): string { + if (roleAccess.includes('|')) { + if (standartRoles.includes(roleAccess)) { + return 'medical' + } + if (roleAccess.includes(verificatorRole)) { + return 'verificator' + } + } + return 'none' +} diff --git a/app/pages/(features)/integration/bpjs/sep/add.vue b/app/pages/(features)/integration/bpjs/sep/add.vue index eee40750..5db12aac 100644 --- a/app/pages/(features)/integration/bpjs/sep/add.vue +++ b/app/pages/(features)/integration/bpjs/sep/add.vue @@ -20,7 +20,7 @@ const roleAccess: PagePermission = PAGE_PERMISSIONS['/doctor'] const { checkRole, hasCreateAccess } = useRBAC() -Check if user has access to this page +// Check if user has access to this page const hasAccess = checkRole(roleAccess) if (!hasAccess) { throw createError({ diff --git a/app/pages/(features)/outpation-action/chemotherapy/[mode]/index.vue b/app/pages/(features)/outpation-action/chemotherapy/[mode]/index.vue index cf33691a..abfb65df 100644 --- a/app/pages/(features)/outpation-action/chemotherapy/[mode]/index.vue +++ b/app/pages/(features)/outpation-action/chemotherapy/[mode]/index.vue @@ -31,10 +31,10 @@ 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') -} +// const hasAccess = checkRole(roleAccess) +// if (!hasAccess) { +// navigateTo('/403') +// } // Define permission-based computed properties const canRead = true // hasReadAccess(roleAccess)