|
|
@@ -55,6 +55,7 @@ const ProjectResourceConsumptionRanking: React.FC = () => { |
|
|
|
const [receiptFromDate, setReceiptFromDate] = useState(null); |
|
|
|
const [receiptToDate, setReceiptToDate] = useState(null); |
|
|
|
const [selectedRows, setSelectedRows] = useState([]); |
|
|
|
const [chartProjectColor, setChartProjectColor]:any[] = useState([]); |
|
|
|
const [chartProjectName, setChartProjectName]:any[] = useState([]); |
|
|
|
const [chartProjectDisplayName, setChartProjectDisplayName]:any[] = useState([]); |
|
|
|
const [chartProjectBudgetedHour, setChartProjectBudgetedHour]:any[] = useState([]); |
|
|
@@ -131,15 +132,29 @@ const ProjectResourceConsumptionRanking: React.FC = () => { |
|
|
|
const projectBudgetedManHour = [] |
|
|
|
const projectSpentManHour = [] |
|
|
|
const manhourConsumptionPercentage = [] |
|
|
|
const chartColor = [] |
|
|
|
let c = 0 |
|
|
|
for (let i = 0; i < teamProjectResult.length; i++){ |
|
|
|
teamProjectResult[i].color = color[i] |
|
|
|
|
|
|
|
console.log(teamProjectResult[i]) |
|
|
|
projectNo.push(teamProjectResult[i].team + "(" + teamProjectResult[i].teamLead + ")") |
|
|
|
projectNo.push(teamProjectResult[i].projectCode + "(" + teamProjectResult[i].team + ")") |
|
|
|
projectName.push(teamProjectResult[i].projectName) |
|
|
|
projectBudgetedManHour.push(teamProjectResult[i].budgetedManhour) |
|
|
|
projectSpentManHour.push(teamProjectResult[i].spentManhour) |
|
|
|
manhourConsumptionPercentage.push(teamProjectResult[i].manhourConsumptionPercentage) |
|
|
|
if (i === 0) { |
|
|
|
chartColor.push(color[c]) |
|
|
|
teamProjectResult[i].color = color[c] |
|
|
|
} else if (teamProjectResult[i].team !== teamProjectResult[i - 1].team) { |
|
|
|
c = c + 1 |
|
|
|
chartColor.push(color[c]) |
|
|
|
teamProjectResult[i].color = color[c] |
|
|
|
} else if (teamProjectResult[i].team === teamProjectResult[i - 1].team){ |
|
|
|
chartColor.push(color[c]) |
|
|
|
teamProjectResult[i].color = color[c] |
|
|
|
} |
|
|
|
} |
|
|
|
setChartProjectColor(chartColor) |
|
|
|
setChartProjectName(projectNo) |
|
|
|
setChartProjectDisplayName(projectName) |
|
|
|
setChartProjectBudgetedHour(projectBudgetedManHour) |
|
|
@@ -319,6 +334,18 @@ const ProjectResourceConsumptionRanking: React.FC = () => { |
|
|
|
}, |
|
|
|
flex: 0.1, |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: "projectCode", |
|
|
|
field: "projectCode", |
|
|
|
headerName: "Project No", |
|
|
|
minWidth:100 |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: "projectName", |
|
|
|
field: "projectName", |
|
|
|
headerName: "Project", |
|
|
|
minWidth:300 |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: "team", |
|
|
|
field: "team", |
|
|
@@ -331,6 +358,27 @@ const ProjectResourceConsumptionRanking: React.FC = () => { |
|
|
|
headerName: "Team Leader", |
|
|
|
minWidth: 70 |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: "expectedStage", |
|
|
|
field: "expectedStage", |
|
|
|
headerName: "Expected Stage", |
|
|
|
minWidth: 300, |
|
|
|
renderCell: (params: any) => { |
|
|
|
if (params.row.expectedStage != null){ |
|
|
|
const expectedStage = params.row.expectedStage; |
|
|
|
const lines = expectedStage.split(",").map((line:any, index:any) => ( |
|
|
|
<React.Fragment key={index}> |
|
|
|
{line.trim()} |
|
|
|
<br /> |
|
|
|
</React.Fragment> |
|
|
|
)); |
|
|
|
return <div>{lines}</div>; |
|
|
|
} else { |
|
|
|
return <div>-</div>; |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: "budgetedManhour", |
|
|
|
field: "budgetedManhour", |
|
|
@@ -370,12 +418,18 @@ const ProjectResourceConsumptionRanking: React.FC = () => { |
|
|
|
}, |
|
|
|
minWidth: 70 |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: "comingPaymentMilestone", |
|
|
|
field: "comingPaymentMilestone", |
|
|
|
headerName: "Coming Payment Milestone", |
|
|
|
minWidth: 100 |
|
|
|
}, |
|
|
|
{ |
|
|
|
id: "alert", |
|
|
|
field: "alert", |
|
|
|
headerName: "Alert", |
|
|
|
renderCell: (params: any) => { |
|
|
|
if (params.row.alert === true) { |
|
|
|
if (params.row.alert === 1) { |
|
|
|
return ( |
|
|
|
<span className="text-red-300 text-center"> |
|
|
|
<ReportProblemIcon /> |
|
|
@@ -587,7 +641,7 @@ const ProjectResourceConsumptionRanking: React.FC = () => { |
|
|
|
if (i === selectedRowsData.length && i > 0) { |
|
|
|
projectArray.push("Remained"); |
|
|
|
} else if (selectedRowsData.length > 0) { |
|
|
|
projectArray.push(selectedRowsData[i].team); |
|
|
|
projectArray.push(selectedRowsData[i].projectName); |
|
|
|
totalBudgetManhour += Number(selectedRowsData[i].budgetedManhour); |
|
|
|
totalSpent += Number(selectedRowsData[i].spentManhour); |
|
|
|
pieChartColorArray.push(selectedRowsData[i].color); |
|
|
@@ -639,7 +693,7 @@ const ProjectResourceConsumptionRanking: React.FC = () => { |
|
|
|
const currentPageProjectBudgetedManhour = chartProjectBudgetedHour.slice(startIndex, endIndex) |
|
|
|
const currentPageProjectSpentManhour = chartProjectSpentHour.slice(startIndex, endIndex) |
|
|
|
const currentPageData = chartManhourConsumptionPercentage.slice(startIndex, endIndex); |
|
|
|
const colorArray = color.slice(startIndex, endIndex); |
|
|
|
const colorArray = chartProjectColor.slice(startIndex, endIndex); |
|
|
|
console.log(currentPage) |
|
|
|
console.log(Math.ceil(chartManhourConsumptionPercentage.length / recordsPerPage)) |
|
|
|
setCurrentPageProjectList(currentPageProjectData) |
|
|
|