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 = () => {