Browse Source

Merge pull request 'staging upload 23-05-22' (#45) from staging into master

Reviewed-on: ordo/adw-frontend#45
pull/2/head
ibnu 1 year ago
parent
commit
1d253d5613
  1. 29
      src/views/Dashboard/DashboardProject.js

29
src/views/Dashboard/DashboardProject.js

@ -86,6 +86,8 @@ const DashboardProject = () => {
const [assignedHrCount, setAssignedHrCount] = useState(0); const [assignedHrCount, setAssignedHrCount] = useState(0);
const [actualHrCount, setActualHrCount] = useState(0); const [actualHrCount, setActualHrCount] = useState(0);
const [dataGantt, setDataGantt] = useState({}); const [dataGantt, setDataGantt] = useState({});
const [dataGanttParents, setDataGanttParents] = useState({});
const [isReadyGanttParents, setIsReadyGanttParents] = useState(false);
let history = useHistory(); let history = useHistory();
@ -96,6 +98,7 @@ const DashboardProject = () => {
getReportDistribution() getReportDistribution()
getComments() getComments()
getGantt() getGantt()
getGanttParents()
return () => { return () => {
console.log('unmount RenderMap'); console.log('unmount RenderMap');
} }
@ -154,6 +157,19 @@ const DashboardProject = () => {
} }
} }
const getGanttParents = async () => {
setIsReadyGanttParents(false)
const url = `${BASE_OSPRO}/api/hierarchy-ftths/tree-gantt/${GANTT_ID}`
try {
const response = await axios.get(url, HEADER)
setDataGanttParents(response)
setIsReadyGanttParents(true)
} catch (error) {
console.error('Failed to get gantt data:', error)
setIsReadyGanttParents(true)
}
}
const getAssignedHR = async () => { const getAssignedHR = async () => {
const url = `${BASE_OSPRO}/api/project/manpower/assigned/${GANTT_ID}` const url = `${BASE_OSPRO}/api/project/manpower/assigned/${GANTT_ID}`
try { try {
@ -565,7 +581,18 @@ const DashboardProject = () => {
<div style={{ display: 'flex', flexDirection: 'row', marginBottom: 10 }}> <div style={{ display: 'flex', flexDirection: 'row', marginBottom: 10 }}>
<div style={{ flex: 20, display: 'flex', flexDirection: 'column' }}> <div style={{ flex: 20, display: 'flex', flexDirection: 'column' }}>
<div style={{ fontSize: 16, fontWeight: 'bold', marginBottom: 10 }}>Project</div> <div style={{ fontSize: 16, fontWeight: 'bold', marginBottom: 10 }}>Project</div>
<div style={{ fontSize: 14 }}>{isReadyProjectDetail ? projectName : <SingleTextLoader />}</div> <div style={{ fontSize: 14 }}>
{isReadyProjectDetail && isReadyGanttParents && isReadyGantt
? (() => {
let parentNames = "";
for (let i = dataGanttParents.data.data.length - 1; i >= 0; i--) {
parentNames += " - ";
parentNames += dataGanttParents.data.data[i].name;
}
return projectName + parentNames + " - " + dataGantt.data.data.name_version;
})()
: <SingleTextLoader />}
</div>
</div> </div>
<div> <div>
<i className="fa fa-check-square" style={{ fontSize: 28 }}></i> <i className="fa fa-check-square" style={{ fontSize: 28 }}></i>

Loading…
Cancel
Save