diff --git a/FRONTEND/.env.example b/FRONTEND/.env.example index 3d93867..ad105e4 100755 --- a/FRONTEND/.env.example +++ b/FRONTEND/.env.example @@ -1 +1,3 @@ -VITE_BACKEND_URL=http://localhost:8000/ \ No newline at end of file +VITE_BACKEND_URL=http://localhost:8000/ + +VITE_URL_DRAWIO="https://viewer.diagrams.net/?tags=%7B%7D&lightbox=1&highlight=0000ff&edit=_blank&layers=1&nav=1&title=Test%20Draw.drawio&dark=auto#Uhttps%3A%2F%2Fdrive.google.com%2Fuc%3Fid%3D1LmB9wCac9DonQPFU-53g1nhI9SfvWuWK%26export%3Ddownload" \ No newline at end of file diff --git a/FRONTEND/src/pages/Allocation/Allocation.tsx b/FRONTEND/src/pages/Allocation/Allocation.tsx index 2e2cf0e..4200a5a 100644 --- a/FRONTEND/src/pages/Allocation/Allocation.tsx +++ b/FRONTEND/src/pages/Allocation/Allocation.tsx @@ -10,6 +10,7 @@ import { Popover, Text, Tooltip, + Switch, } from '@mantine/core' import { IconInnerShadowTopRightFilled } from '@tabler/icons-react' import { useEffect, useState } from 'react' @@ -80,6 +81,31 @@ const Allocation = () => { const [opened, setOpened] = useState(false) const [issDetail, setIssDetail] = useState('') const [data, setData] = useState({}) + const [showDrawio, setShowDrawio] = useState(true) + + useEffect(() => { + // Check if iframe already exists + const existingIframe = document.querySelector('#drawio iframe') + if (existingIframe) return + + // Add iframe only if it doesn't exist + const iframe = document.createElement('iframe') + iframe.src = import.meta.env.VITE_URL_DRAWIO ?? '' + iframe.style.width = '100%' + iframe.style.height = '500px' + const drawioDiv = document.getElementById('drawio') + if (drawioDiv) { + drawioDiv.appendChild(iframe) + } + + return () => { + const iframe = document.querySelector('#drawio iframe') + if (iframe) { + iframe.remove() + } + } + }, []) + const getAll = async () => { try { const res = await get(getAllUserDoing) @@ -117,6 +143,14 @@ const Allocation = () => { }, []) return (
+ + setShowDrawio(event.currentTarget.checked)} + /> + +
{ }} > - + {/* Admin/ Personnel Allocation - + */} "P:" is the timspent/timeestimate number within the project itself @@ -224,27 +258,38 @@ const Allocation = () => { alignItems: 'center', }} > - - - iss.fields.status.name === 'In Progress' && - ((Date.now() - (new Date(iss.changelog?.histories[0]?.created)).getTime()) > 172800000) - ).length > 0 ? 'block' :'none'} - /> + + + iss.fields.status.name === + 'In Progress' && + Date.now() - + new Date( + iss.changelog?.histories[0]?.created, + ).getTime() > + 172800000, + ).length > 0 + ? 'block' + : 'none' + } + /> - - - {user} - + + + {user} + { }} ml={'md'} p="0 20px" - > - {`P: `} + {`P: `} {`${ userData.p_total_spent / 60 / 60 }h/`}