This commit is contained in:
@@ -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 = () => {
|
||||
<div className="app-main-content-list-container form-page">
|
||||
<div className="app-main-content-list-func-container">
|
||||
<Tabs activeKey={activeTab} onSelect={(k) => setActiveTab(k)} id="customers-tab">
|
||||
{AuthService.canViewCustomerTab('personalInfo') && <Tab eventKey="personalInfo" title="Personal Information">
|
||||
{canAccessCustomerTab('personalInfo') && <Tab eventKey="personalInfo" title="Personal Information">
|
||||
{/* Basic Info Section */}
|
||||
<h6 className="text-primary">Basic Info</h6>
|
||||
<div className="app-main-content-fields-section">
|
||||
@@ -561,7 +564,7 @@ const ViewCustomer = () => {
|
||||
</div>
|
||||
</Tab>}
|
||||
|
||||
{AuthService.canViewCustomerTab('careServices') && <Tab eventKey="careServices" title="Care & Services">
|
||||
{canAccessCustomerTab('careServices') && <Tab eventKey="careServices" title="Care & Services">
|
||||
<h6 className="text-primary">Care & Services</h6>
|
||||
<div className="app-main-content-fields-section">
|
||||
<div className="field-body">
|
||||
@@ -606,7 +609,7 @@ const ViewCustomer = () => {
|
||||
</div>
|
||||
</Tab>}
|
||||
|
||||
{AuthService.canViewCustomerTab('medicalInsurance') && <Tab eventKey="medicalInsurance" title="Medical & Insurance">
|
||||
{canAccessCustomerTab('medicalInsurance') && <Tab eventKey="medicalInsurance" title="Medical & Insurance">
|
||||
{/* Providers Section */}
|
||||
<h6 className="text-primary">Providers</h6>
|
||||
<div className="app-main-content-fields-section">
|
||||
@@ -702,7 +705,7 @@ const ViewCustomer = () => {
|
||||
</div>
|
||||
</Tab>}
|
||||
|
||||
{AuthService.canViewCustomerTab('confidentialDetails') && <Tab eventKey="confidentialDetails" title="Confidential Details">
|
||||
{canAccessCustomerTab('confidentialDetails') && <Tab eventKey="confidentialDetails" title="Confidential Details">
|
||||
<h6 className="text-primary">Confidential Details</h6>
|
||||
<div className="app-main-content-fields-section">
|
||||
<div className="field-body">
|
||||
@@ -725,7 +728,7 @@ const ViewCustomer = () => {
|
||||
</Tab>}
|
||||
|
||||
|
||||
{AuthService.canViewCustomerTab('formSubmission') && <Tab eventKey="formSubmission" title="Form Submission">
|
||||
{canAccessCustomerTab('formSubmission') && <Tab eventKey="formSubmission" title="Form Submission">
|
||||
{/* Admission Forms Section */}
|
||||
<h6 className="text-primary">Admission Forms</h6>
|
||||
<div className="app-main-content-fields-section">
|
||||
|
||||
@@ -348,7 +348,7 @@ const ResourcesList = () => {
|
||||
<>
|
||||
<div className="list row mb-4">
|
||||
<Breadcrumb>
|
||||
<Breadcrumb.Item href="/medical/index">Medical</Breadcrumb.Item>
|
||||
<Breadcrumb.Item>Medical</Breadcrumb.Item>
|
||||
<Breadcrumb.Item active>
|
||||
Provider Information
|
||||
</Breadcrumb.Item>
|
||||
|
||||
Reference in New Issue
Block a user