2025-05-26 01:40:36 +00:00
|
|
|
import React, { useEffect, useState } from 'react';
|
|
|
|
|
import styled from '@emotion/styled';
|
2025-05-20 16:28:48 +00:00
|
|
|
import { Link } from 'react-router-dom';
|
2025-05-26 01:40:36 +00:00
|
|
|
import { Stack } from '@mui/material';
|
2025-05-27 18:19:40 +00:00
|
|
|
import { ToggleTabs, useLocalStore } from '@components';
|
2025-05-26 01:40:36 +00:00
|
|
|
|
|
|
|
|
const OuterContainer = styled(Stack)`
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
flex-direction: row;
|
2025-05-27 18:19:40 +00:00
|
|
|
justify-content: center;
|
2025-05-26 01:40:36 +00:00
|
|
|
padding: 10px 10px 0px 0px;
|
|
|
|
|
`;
|
2025-05-20 16:28:48 +00:00
|
|
|
|
2025-05-27 18:19:40 +00:00
|
|
|
const fields = {
|
|
|
|
|
departmentInformation: {
|
|
|
|
|
title: 'Information',
|
|
|
|
|
tab: 'department',
|
|
|
|
|
fields: []
|
|
|
|
|
},
|
|
|
|
|
departmentPermissions: {
|
|
|
|
|
title: 'Permissions',
|
|
|
|
|
tab: 'department',
|
|
|
|
|
fields: []
|
|
|
|
|
},
|
|
|
|
|
departmentManagers: {
|
|
|
|
|
title: 'Managers',
|
|
|
|
|
tab: 'department',
|
|
|
|
|
fields: []
|
|
|
|
|
},
|
|
|
|
|
departmentSubscriptions: {
|
|
|
|
|
title: 'Subscriptions',
|
|
|
|
|
tab: 'department',
|
|
|
|
|
fields: []
|
|
|
|
|
},
|
|
|
|
|
myInformation: {
|
|
|
|
|
title: 'Information',
|
|
|
|
|
tab: 'personal',
|
|
|
|
|
fields: []
|
|
|
|
|
},
|
|
|
|
|
myNotifications: {
|
|
|
|
|
title: 'Notifications',
|
|
|
|
|
tab: 'personal',
|
|
|
|
|
fields: []
|
|
|
|
|
},
|
|
|
|
|
departmentNotifications: {
|
|
|
|
|
title: 'Notifications',
|
|
|
|
|
tab: 'department',
|
|
|
|
|
fields: []
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-25 01:58:18 +00:00
|
|
|
export const Settings = () => {
|
2025-05-27 18:19:40 +00:00
|
|
|
const { user } = useLocalStore();
|
2025-05-26 01:40:36 +00:00
|
|
|
const tabs = [
|
|
|
|
|
{
|
|
|
|
|
label: 'Personal',
|
|
|
|
|
value: 'personal'
|
|
|
|
|
},
|
|
|
|
|
{
|
2025-05-27 18:19:40 +00:00
|
|
|
label: 'Department',
|
|
|
|
|
value: 'department'
|
2025-05-26 01:40:36 +00:00
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const [tabValue, setTabValue] = useState(tabs[0]);
|
2025-05-20 16:28:48 +00:00
|
|
|
|
|
|
|
|
useEffect(() => {
|
2025-05-25 01:58:18 +00:00
|
|
|
document.title = 'ShiftSync | Settings';
|
2025-05-20 16:28:48 +00:00
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div>
|
2025-05-27 18:19:40 +00:00
|
|
|
{user?.administrator ? (
|
|
|
|
|
<OuterContainer>
|
|
|
|
|
<ToggleTabs
|
2025-05-26 01:40:36 +00:00
|
|
|
tabs={tabs}
|
|
|
|
|
tabValue={tabValue}
|
|
|
|
|
setTabValue={setTabValue}
|
|
|
|
|
tabColor='#4D79FF'
|
2025-05-27 18:19:40 +00:00
|
|
|
/>
|
|
|
|
|
</OuterContainer>
|
|
|
|
|
) : null }
|
|
|
|
|
{tabValue?.value === 'personal' ? (
|
|
|
|
|
<div>
|
|
|
|
|
<h1>{`Settings Page${user?.administrator ? ` - ${tabValue?.label}` : ''}`}</h1>
|
|
|
|
|
<Link to="/">Go to Home</Link>
|
|
|
|
|
</div>
|
|
|
|
|
) : (
|
|
|
|
|
<div>
|
|
|
|
|
<h1>Settings Page - Organization</h1>
|
|
|
|
|
<Link to="/">Go to Home</Link>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
2025-05-20 16:28:48 +00:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|