diff --git a/src/layout/LayoutMenu.jsx b/src/layout/LayoutMenu.jsx index 71ff29c..a0dfd5a 100644 --- a/src/layout/LayoutMenu.jsx +++ b/src/layout/LayoutMenu.jsx @@ -76,7 +76,7 @@ const allItems = [ icon: , label: Compressor C, }, - ] + ], }, { key: 'dashboard-svg-airdryer', @@ -103,7 +103,7 @@ const allItems = [ icon: , label: Air Dryer C, }, - ] + ], }, ], }, @@ -142,11 +142,11 @@ const allItems = [ icon: , label: Status, }, - { - key: 'master-shift', - icon: , - label: Shift, - }, + // { + // key: 'master-shift', + // icon: , + // label: Shift, + // }, ], }, { @@ -219,15 +219,15 @@ const allItems = [ ), }, - { - key: 'jadwal-shift', - icon: , - label: ( - - Jadwal Shift - - ), - }, + // { + // key: 'jadwal-shift', + // icon: , + // label: ( + // + // Jadwal Shift + // + // ), + // }, ]; 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; \ No newline at end of file +export default LayoutMenu; diff --git a/src/pages/contact/component/ListContact.jsx b/src/pages/contact/component/ListContact.jsx index c878a66..373edde 100644 --- a/src/pages/contact/component/ListContact.jsx +++ b/src/pages/contact/component/ListContact.jsx @@ -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 ( @@ -118,7 +116,14 @@ const ContactCard = memo(function ContactCard({ contact, showEditModal, showDele {/* Edit and Delete Buttons - Bottom Right */} -
+
{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}