From 9fd008a806f8f0ffb2f77c50cc7e0578ea0ce3ac Mon Sep 17 00:00:00 2001 From: Lixian Zhou Date: Thu, 12 Mar 2026 16:07:31 -0400 Subject: [PATCH] fix --- client/src/components/customers/ViewCustomer.js | 17 ++++++++++------- .../src/components/resources/ResourcesList.js | 2 +- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/client/src/components/customers/ViewCustomer.js b/client/src/components/customers/ViewCustomer.js index d959015..a2227fa 100644 --- a/client/src/components/customers/ViewCustomer.js +++ b/client/src/components/customers/ViewCustomer.js @@ -36,7 +36,10 @@ const ViewCustomer = () => { const [activeTab, setActiveTab] = useState(normalizedInitialTab || 'personalInfo'); const [formFiles, setFormFiles] = useState({}); const customerTabOrder = ['personalInfo', 'careServices', 'medicalInsurance', 'confidentialDetails', 'formSubmission']; - const visibleTabs = customerTabOrder.filter((tabKey) => AuthService.canViewCustomerTab(tabKey)); + const canAccessCustomerTab = (tabKey) => { + return AuthService.canViewCustomerTab(tabKey) || AuthService.canEditCustomerTab(tabKey); + }; + const visibleTabs = customerTabOrder.filter((tabKey) => canAccessCustomerTab(tabKey)); const firstVisibleTab = visibleTabs[0] || 'personalInfo'; @@ -69,7 +72,7 @@ const ViewCustomer = () => { }, [activeTab]); useEffect(() => { - if (!AuthService.canViewAnyCustomerTab()) { + if (visibleTabs.length === 0) { window.alert('You haven\'t login yet OR this user does not have access to this page. Please change an admin account to login.') AuthService.logout(); navigate(`/login`); @@ -159,7 +162,7 @@ const ViewCustomer = () => {
setActiveTab(k)} id="customers-tab"> - {AuthService.canViewCustomerTab('personalInfo') && + {canAccessCustomerTab('personalInfo') && {/* Basic Info Section */}
Basic Info
@@ -561,7 +564,7 @@ const ViewCustomer = () => {
} - {AuthService.canViewCustomerTab('careServices') && + {canAccessCustomerTab('careServices') &&
Care & Services
@@ -606,7 +609,7 @@ const ViewCustomer = () => {
} - {AuthService.canViewCustomerTab('medicalInsurance') && + {canAccessCustomerTab('medicalInsurance') && {/* Providers Section */}
Providers
@@ -702,7 +705,7 @@ const ViewCustomer = () => {
} - {AuthService.canViewCustomerTab('confidentialDetails') && + {canAccessCustomerTab('confidentialDetails') &&
Confidential Details
@@ -725,7 +728,7 @@ const ViewCustomer = () => { } - {AuthService.canViewCustomerTab('formSubmission') && + {canAccessCustomerTab('formSubmission') && {/* Admission Forms Section */}
Admission Forms
diff --git a/client/src/components/resources/ResourcesList.js b/client/src/components/resources/ResourcesList.js index e6d19d4..f25d7e4 100644 --- a/client/src/components/resources/ResourcesList.js +++ b/client/src/components/resources/ResourcesList.js @@ -348,7 +348,7 @@ const ResourcesList = () => { <>
- Medical + Medical Provider Information