diff --git a/src/components/BottomModal/BottomModal.js b/src/components/BottomModal/BottomModal.js index 69b04c3..27d1bf3 100644 --- a/src/components/BottomModal/BottomModal.js +++ b/src/components/BottomModal/BottomModal.js @@ -6,8 +6,9 @@ import Icon from '@iconify/react' import closeCircleOutline from '@iconify/icons-ion/close-circle-outline'; import removeCircleOutline from '@iconify/icons-ion/remove-circle-outline'; import windowMaximaze from '@iconify/icons-mdi/window-maximize'; +import { NotificationContainer, NotificationManager } from 'react-notifications'; -const BottomModal = ({title, tableHeader, tableData, closeModal, isReady}) => { +const BottomModal = ({ title, tableHeader, tableData, closeModal, isReady }) => { const [tableHeight, setTableHeight] = useState(150) const [resizableWidth, setResizableWidth] = useState("100%") const [resizableHeight, setResizableHeight] = useState(300) @@ -39,25 +40,42 @@ const BottomModal = ({title, tableHeader, tableData, closeModal, isReady}) => { const renderTableRow = (item) => { let row = []; + // looping through its object keys (item is an object) Object.keys(item).map(key => { if (key === 'project_name') { let URL = `/#/dashboard-project/${item['id']}/${item['last_gantt_id']}`; - row.push({item[key]}) - } else if(key === 'last_gantt_id') { - } else if(key === 'id') { - } else { - row.push({item[key]}) + row.push( + + { + e.preventDefault(); + if (!item['last_gantt_id']) { + NotificationManager.warning('Data Gantt Belum Tersedia.', 'Warning'); + } else { + window.location.href = URL; + } + }} + > + {item[key]} + + + ); + } else if (key === 'id' || key === 'last_gantt_id') { + } else { + row.push({item[key]}); } - }) + }); + return row; - } + }; const RenderTable = useMemo(() => { if (tableData && tableData.length > 0) { return ( - + {tableHeader && tableHeader.length > 0 && tableHeader.map((item, idx) => ( @@ -66,8 +84,8 @@ const BottomModal = ({title, tableHeader, tableData, closeModal, isReady}) => { } - - {tableData && tableData.length > 0 && + + {tableData && tableData.length > 0 && tableData.map((item, index) => { return ( {renderTableRow(item, tableHeader)} @@ -85,92 +103,95 @@ const BottomModal = ({title, tableHeader, tableData, closeModal, isReady}) => { // // //
No Data Available
-
+
No Data Available
) }, [tableData, isReady]) return ( - { - setResizableWidth("100%"); - setResizableHeight(resizableHeight + d.height); - if (e.screenY < 100) { // max - setResizableHeight('100vh'); - setTableHeight(450) - } - else if (e.screenY < 150) { - setTableHeight(400) - } - else if (e.screenY < 200) { - setTableHeight(350) - } - else if (e.screenY < 250) { - setTableHeight(300) - } - else if (e.screenY < 300) { - setTableHeight(250) - } - else if (e.screenY < 400) { - setTableHeight(200) - } - else if (e.screenY < 600) { - setTableHeight(150) // default - } - else if (e.screenY >= 600) { - setBottomTableWindow('min'); - } - }} - > -
- - -

{title}

- - - setBottomTableWindow("min")} - > - - - setBottomTableWindow("max")} - > - - - - - - -
- - - {isReady ? RenderTable :
Loading data...
} -
-
-
-
+ <> + + { + setResizableWidth("100%"); + setResizableHeight(resizableHeight + d.height); + if (e.screenY < 100) { // max + setResizableHeight('100vh'); + setTableHeight(450) + } + else if (e.screenY < 150) { + setTableHeight(400) + } + else if (e.screenY < 200) { + setTableHeight(350) + } + else if (e.screenY < 250) { + setTableHeight(300) + } + else if (e.screenY < 300) { + setTableHeight(250) + } + else if (e.screenY < 400) { + setTableHeight(200) + } + else if (e.screenY < 600) { + setTableHeight(150) // default + } + else if (e.screenY >= 600) { + setBottomTableWindow('min'); + } + }} + > +
+ + +

{title}

+ + + setBottomTableWindow("min")} + > + + + setBottomTableWindow("max")} + > + + + + + + +
+ + + {isReady ? RenderTable :
Loading data...
} +
+
+
+
+ ) }