hidden jadwal shift and master-shift
This commit is contained in:
@@ -76,7 +76,7 @@ const allItems = [
|
||||
icon: <NodeExpandOutlined style={{ fontSize: '19px' }} />,
|
||||
label: <Link to="/dashboard-svg/compressor-c">Compressor C</Link>,
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
{
|
||||
key: 'dashboard-svg-airdryer',
|
||||
@@ -103,7 +103,7 @@ const allItems = [
|
||||
icon: <NodeExpandOutlined style={{ fontSize: '19px' }} />,
|
||||
label: <Link to="/dashboard-svg/airdryer-c">Air Dryer C</Link>,
|
||||
},
|
||||
]
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -142,11 +142,11 @@ const allItems = [
|
||||
icon: <SafetyOutlined style={{ fontSize: '19px' }} />,
|
||||
label: <Link to="/master/status">Status</Link>,
|
||||
},
|
||||
{
|
||||
key: 'master-shift',
|
||||
icon: <ClockCircleOutlined style={{ fontSize: '19px' }} />,
|
||||
label: <Link to="/master/shift">Shift</Link>,
|
||||
},
|
||||
// {
|
||||
// key: 'master-shift',
|
||||
// icon: <ClockCircleOutlined style={{ fontSize: '19px' }} />,
|
||||
// label: <Link to="/master/shift">Shift</Link>,
|
||||
// },
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -219,15 +219,15 @@ const allItems = [
|
||||
</Link>
|
||||
),
|
||||
},
|
||||
{
|
||||
key: 'jadwal-shift',
|
||||
icon: <CalendarOutlined style={{ fontSize: '19px' }} />,
|
||||
label: (
|
||||
<Link to="/jadwal-shift" className="fontMenus">
|
||||
Jadwal Shift
|
||||
</Link>
|
||||
),
|
||||
},
|
||||
// {
|
||||
// key: 'jadwal-shift',
|
||||
// icon: <CalendarOutlined style={{ fontSize: '19px' }} />,
|
||||
// label: (
|
||||
// <Link to="/jadwal-shift" className="fontMenus">
|
||||
// Jadwal Shift
|
||||
// </Link>
|
||||
// ),
|
||||
// },
|
||||
];
|
||||
|
||||
const LayoutMenu = () => {
|
||||
@@ -255,11 +255,11 @@ const LayoutMenu = () => {
|
||||
const masterKeyMap = {
|
||||
'plant-sub-section': 'master-plant-sub-section',
|
||||
'brand-device': 'master-brand-device',
|
||||
'device': 'master-device',
|
||||
'unit': 'master-unit',
|
||||
'tag': 'master-tag',
|
||||
'status': 'master-status',
|
||||
'shift': 'master-shift'
|
||||
device: 'master-device',
|
||||
unit: 'master-unit',
|
||||
tag: 'master-tag',
|
||||
status: 'master-status',
|
||||
shift: 'master-shift',
|
||||
};
|
||||
return masterKeyMap[subPath] || `master-${subPath}`;
|
||||
}
|
||||
@@ -276,7 +276,7 @@ const LayoutMenu = () => {
|
||||
if (subPath === 'airdryer-a') return 'dashboard-svg-airdryer-airdryer-a';
|
||||
if (subPath === 'airdryer-b') return 'dashboard-svg-airdryer-airdryer-b';
|
||||
if (subPath === 'airdryer-c') return 'dashboard-svg-airdryer-airdryer-c';
|
||||
|
||||
|
||||
return `dashboard-svg-${subPath}`;
|
||||
}
|
||||
|
||||
@@ -284,8 +284,8 @@ const LayoutMenu = () => {
|
||||
if (pathname.startsWith('/report/')) {
|
||||
const subPath = pathParts[1];
|
||||
const reportKeyMap = {
|
||||
'trending': 'report-trending',
|
||||
'report': 'report-report'
|
||||
trending: 'report-trending',
|
||||
report: 'report-report',
|
||||
};
|
||||
return reportKeyMap[subPath] || `report-${subPath}`;
|
||||
}
|
||||
@@ -294,8 +294,8 @@ const LayoutMenu = () => {
|
||||
if (pathname.startsWith('/history/')) {
|
||||
const subPath = pathParts[1];
|
||||
const historyKeyMap = {
|
||||
'alarm': 'history-alarm',
|
||||
'event': 'history-event'
|
||||
alarm: 'history-alarm',
|
||||
event: 'history-event',
|
||||
};
|
||||
return historyKeyMap[subPath] || `history-${subPath}`;
|
||||
}
|
||||
@@ -306,7 +306,7 @@ const LayoutMenu = () => {
|
||||
// Function to get parent keys from menu key
|
||||
const getParentKeys = (key) => {
|
||||
const parentKeys = [];
|
||||
|
||||
|
||||
if (key.startsWith('dashboard-svg-compressor-')) {
|
||||
parentKeys.push('dashboard-svg', 'dashboard-svg-compressor');
|
||||
} else if (key.startsWith('dashboard-svg-airdryer-')) {
|
||||
@@ -320,7 +320,7 @@ const LayoutMenu = () => {
|
||||
} else if (key.startsWith('history-')) {
|
||||
parentKeys.push('history');
|
||||
}
|
||||
|
||||
|
||||
return parentKeys;
|
||||
};
|
||||
|
||||
@@ -330,7 +330,7 @@ const LayoutMenu = () => {
|
||||
setSelectedKeys([currentKey]);
|
||||
|
||||
const parentKeys = getParentKeys(currentKey);
|
||||
|
||||
|
||||
// Always keep the parent menus open when a child is selected
|
||||
if (parentKeys.length > 0) {
|
||||
setStateOpenKeys(parentKeys);
|
||||
@@ -359,13 +359,13 @@ const LayoutMenu = () => {
|
||||
|
||||
const onOpenChange = (openKeys) => {
|
||||
const currentOpenKey = openKeys.find((key) => stateOpenKeys.indexOf(key) === -1);
|
||||
|
||||
|
||||
// If clicking on a menu that was previously closed
|
||||
if (currentOpenKey !== undefined) {
|
||||
const repeatIndex = openKeys
|
||||
.filter((key) => key !== currentOpenKey)
|
||||
.findIndex((key) => levelKeys[key] === levelKeys[currentOpenKey]);
|
||||
|
||||
|
||||
setStateOpenKeys(
|
||||
openKeys
|
||||
.filter((_, index) => index !== repeatIndex)
|
||||
@@ -376,12 +376,10 @@ const LayoutMenu = () => {
|
||||
// but keep other parent menus open if they have active children
|
||||
const currentKey = getMenuKeyFromPath(location.pathname);
|
||||
const necessaryParentKeys = getParentKeys(currentKey);
|
||||
|
||||
|
||||
// Filter out only the menus that are necessary to keep open
|
||||
const filteredOpenKeys = openKeys.filter(key =>
|
||||
necessaryParentKeys.includes(key)
|
||||
);
|
||||
|
||||
const filteredOpenKeys = openKeys.filter((key) => necessaryParentKeys.includes(key));
|
||||
|
||||
setStateOpenKeys(filteredOpenKeys);
|
||||
}
|
||||
};
|
||||
@@ -391,9 +389,7 @@ const LayoutMenu = () => {
|
||||
|
||||
const karyawan = () => {
|
||||
return allItems
|
||||
.filter(
|
||||
(item) => item.key !== 'setting'
|
||||
)
|
||||
.filter((item) => item.key !== 'setting')
|
||||
.map((item) => {
|
||||
if (item.key === 'master') {
|
||||
return {
|
||||
@@ -403,7 +399,7 @@ const LayoutMenu = () => {
|
||||
return item;
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
const items = isAdmin === 1 ? allItems : karyawan();
|
||||
|
||||
return (
|
||||
@@ -423,4 +419,4 @@ const LayoutMenu = () => {
|
||||
/>
|
||||
);
|
||||
};
|
||||
export default LayoutMenu;
|
||||
export default LayoutMenu;
|
||||
|
||||
@@ -12,8 +12,6 @@ import { useNavigate } from 'react-router-dom';
|
||||
import { NotifAlert, NotifConfirmDialog } from '../../../components/Global/ToastNotif';
|
||||
import { getAllContact, deleteContact } from '../../../api/contact';
|
||||
|
||||
const { TabPane } = Tabs;
|
||||
|
||||
const ContactCard = memo(function ContactCard({ contact, showEditModal, showDeleteModal }) {
|
||||
return (
|
||||
<Col xs={24} sm={12} md={8} lg={6}>
|
||||
@@ -118,7 +116,14 @@ const ContactCard = memo(function ContactCard({ contact, showEditModal, showDele
|
||||
</div>
|
||||
|
||||
{/* Edit and Delete Buttons - Bottom Right */}
|
||||
<div style={{ display: 'flex', justifyContent: 'flex-end', gap: '8px', marginTop: '8px' }}>
|
||||
<div
|
||||
style={{
|
||||
display: 'flex',
|
||||
justifyContent: 'flex-end',
|
||||
gap: '8px',
|
||||
marginTop: '8px',
|
||||
}}
|
||||
>
|
||||
<Space>
|
||||
<Button
|
||||
type="text"
|
||||
@@ -127,9 +132,11 @@ const ContactCard = memo(function ContactCard({ contact, showEditModal, showDele
|
||||
borderColor: '#faad14',
|
||||
padding: '2px 6px',
|
||||
fontSize: '11px',
|
||||
height: '24px'
|
||||
height: '24px',
|
||||
}}
|
||||
icon={<EditOutlined style={{ color: '#faad14', fontSize: '11px' }} />}
|
||||
icon={
|
||||
<EditOutlined style={{ color: '#faad14', fontSize: '11px' }} />
|
||||
}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
showEditModal(contact);
|
||||
@@ -145,7 +152,7 @@ const ContactCard = memo(function ContactCard({ contact, showEditModal, showDele
|
||||
borderColor: 'red',
|
||||
padding: '2px 6px',
|
||||
fontSize: '11px',
|
||||
height: '24px'
|
||||
height: '24px',
|
||||
}}
|
||||
icon={<DeleteOutlined style={{ fontSize: '11px' }} />}
|
||||
onClick={(e) => {
|
||||
@@ -282,7 +289,6 @@ const ListContact = memo(function ListContact(props) {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
return (
|
||||
<React.Fragment>
|
||||
<Card>
|
||||
@@ -302,7 +308,11 @@ const ListContact = memo(function ListContact(props) {
|
||||
}}
|
||||
onSearch={(value) => setFormDataFilter({ criteria: value })}
|
||||
allowClear={{
|
||||
clearIcon: <span onClick={() => setFormDataFilter(defaultFilter)}>✕</span>,
|
||||
clearIcon: (
|
||||
<span onClick={() => setFormDataFilter(defaultFilter)}>
|
||||
✕
|
||||
</span>
|
||||
),
|
||||
}}
|
||||
enterButton={
|
||||
<Button
|
||||
@@ -353,12 +363,25 @@ const ListContact = memo(function ListContact(props) {
|
||||
marginBottom: '16px',
|
||||
}}
|
||||
>
|
||||
<Tabs activeKey={activeTab} onChange={setActiveTab} size="large">
|
||||
<TabPane tab="All" key="all" />
|
||||
<TabPane tab="Operator" key="operator" />
|
||||
<TabPane tab="Gudang" key="gudang" />
|
||||
</Tabs>
|
||||
|
||||
<Tabs
|
||||
activeKey={activeTab}
|
||||
onChange={setActiveTab}
|
||||
size="large"
|
||||
items={[
|
||||
{
|
||||
key: 'all',
|
||||
label: 'All',
|
||||
},
|
||||
{
|
||||
key: 'operator',
|
||||
label: 'Operator',
|
||||
},
|
||||
{
|
||||
key: 'gudang',
|
||||
label: 'Gudang',
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{getFilteredContacts().length === 0 ? (
|
||||
@@ -377,7 +400,7 @@ const ListContact = memo(function ListContact(props) {
|
||||
id: contact.contact_id || contact.id,
|
||||
name: contact.contact_name || contact.name,
|
||||
phone: contact.contact_phone || contact.phone,
|
||||
status: contact.is_active ? 'active' : 'inactive'
|
||||
status: contact.is_active ? 'active' : 'inactive',
|
||||
}}
|
||||
showEditModal={showEditModal}
|
||||
showDeleteModal={showDeleteModal}
|
||||
|
||||
Reference in New Issue
Block a user