|
@@ -30,6 +30,10 @@ interface Props { |
|
|
grades: Grade[]; |
|
|
grades: Grade[]; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const baseCellSx: SxProps = { |
|
|
|
|
|
textAlign: "right", |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
const leftBorderCellSx: SxProps = { |
|
|
const leftBorderCellSx: SxProps = { |
|
|
borderLeft: "1px solid", |
|
|
borderLeft: "1px solid", |
|
|
borderColor: "divider", |
|
|
borderColor: "divider", |
|
@@ -142,11 +146,11 @@ const ResourceAllocationByGrade: React.FC<Props> = ({ grades }) => { |
|
|
{t("Allocation Type")} |
|
|
{t("Allocation Type")} |
|
|
</TableCell> |
|
|
</TableCell> |
|
|
{grades.map((column, idx) => ( |
|
|
{grades.map((column, idx) => ( |
|
|
<TableCell key={`${column.id}${idx}`}> |
|
|
|
|
|
|
|
|
<TableCell sx={baseCellSx} key={`${column.id}${idx}`}> |
|
|
{column.name} |
|
|
{column.name} |
|
|
</TableCell> |
|
|
</TableCell> |
|
|
))} |
|
|
))} |
|
|
<TableCell sx={leftBorderCellSx}>{t("Total")}</TableCell> |
|
|
|
|
|
|
|
|
<TableCell sx={{...baseCellSx, leftBorderCellSx}}>{t("Total")}</TableCell> |
|
|
</TableRow> |
|
|
</TableRow> |
|
|
</TableHead> |
|
|
</TableHead> |
|
|
<TableBody> |
|
|
<TableBody> |
|
@@ -160,12 +164,12 @@ const ResourceAllocationByGrade: React.FC<Props> = ({ grades }) => { |
|
|
// renderValue={(val) => percentFormatter.format(val)} |
|
|
// renderValue={(val) => percentFormatter.format(val)} |
|
|
onChange={makeUpdatePercentage(column.id)} |
|
|
onChange={makeUpdatePercentage(column.id)} |
|
|
convertValue={(inputValue) => Number(inputValue)} |
|
|
convertValue={(inputValue) => Number(inputValue)} |
|
|
cellSx={{ backgroundColor: "primary.lightest" }} |
|
|
|
|
|
inputSx={{ width: "3rem" }} |
|
|
|
|
|
|
|
|
cellSx={{ ...baseCellSx, backgroundColor: "primary.lightest" }} |
|
|
|
|
|
inputSx={{ ...baseCellSx, width: "3rem" }} |
|
|
error={manhourPercentageByGrade[column.id] < 0} |
|
|
error={manhourPercentageByGrade[column.id] < 0} |
|
|
/> |
|
|
/> |
|
|
))} |
|
|
))} |
|
|
<TableCell sx={{ ...(totalPercentage === 100 && leftBorderCellSx), ...(totalPercentage !== 100 && { ...errorCellSx, borderRight: "1px solid", borderColor: "error.main" }) }}> |
|
|
|
|
|
|
|
|
<TableCell sx={{...baseCellSx, ...(totalPercentage === 100 && leftBorderCellSx), ...(totalPercentage !== 100 && { ...errorCellSx, borderRight: "1px solid", borderColor: "error.main" }) }}> |
|
|
{((totalPercentage.toString().includes(".") && totalPercentage.toString() || totalPercentage.toFixed(1)) + "%")} |
|
|
{((totalPercentage.toString().includes(".") && totalPercentage.toString() || totalPercentage.toFixed(1)) + "%")} |
|
|
{/* {percentFormatter.format(totalPercentage)} */} |
|
|
{/* {percentFormatter.format(totalPercentage)} */} |
|
|
</TableCell> |
|
|
</TableCell> |
|
@@ -173,13 +177,13 @@ const ResourceAllocationByGrade: React.FC<Props> = ({ grades }) => { |
|
|
<TableRow> |
|
|
<TableRow> |
|
|
<TableCell sx={rightBorderCellSx}>{t("Manhour")}</TableCell> |
|
|
<TableCell sx={rightBorderCellSx}>{t("Manhour")}</TableCell> |
|
|
{grades.map((column, idx) => ( |
|
|
{grades.map((column, idx) => ( |
|
|
<TableCell key={`${column.id}${idx}`}> |
|
|
|
|
|
|
|
|
<TableCell sx={baseCellSx} key={`${column.id}${idx}`}> |
|
|
{manhourFormatter.format( |
|
|
{manhourFormatter.format( |
|
|
manhourPercentageByGrade[column.id] / 100 * totalManhour, |
|
|
manhourPercentageByGrade[column.id] / 100 * totalManhour, |
|
|
)} |
|
|
)} |
|
|
</TableCell> |
|
|
</TableCell> |
|
|
))} |
|
|
))} |
|
|
<TableCell sx={leftBorderCellSx}> |
|
|
|
|
|
|
|
|
<TableCell sx={{...baseCellSx, leftBorderCellSx}}> |
|
|
{manhourFormatter.format(totalManhour)} |
|
|
{manhourFormatter.format(totalManhour)} |
|
|
</TableCell> |
|
|
</TableCell> |
|
|
</TableRow> |
|
|
</TableRow> |
|
@@ -255,7 +259,7 @@ const ResourceAllocationByStage: React.FC<Props> = ({ grades, allTasks }) => { |
|
|
<TableRow> |
|
|
<TableRow> |
|
|
<TableCell>{t("Stage")}</TableCell> |
|
|
<TableCell>{t("Stage")}</TableCell> |
|
|
<TableCell sx={leftBorderCellSx}>{t("Task Count")}</TableCell> |
|
|
<TableCell sx={leftBorderCellSx}>{t("Task Count")}</TableCell> |
|
|
<TableCell colSpan={2} sx={leftRightBorderCellSx}> |
|
|
|
|
|
|
|
|
<TableCell colSpan={2} sx={{...baseCellSx, ...leftRightBorderCellSx}}> |
|
|
{t("Total Manhour")} |
|
|
{t("Total Manhour")} |
|
|
</TableCell> |
|
|
</TableCell> |
|
|
{grades.map((column, idx) => ( |
|
|
{grades.map((column, idx) => ( |
|
@@ -269,7 +273,7 @@ const ResourceAllocationByStage: React.FC<Props> = ({ grades, allTasks }) => { |
|
|
{taskGroups.map((tg, idx) => ( |
|
|
{taskGroups.map((tg, idx) => ( |
|
|
<TableRow key={`${tg.id}${idx}`}> |
|
|
<TableRow key={`${tg.id}${idx}`}> |
|
|
<TableCell>{tg.name}</TableCell> |
|
|
<TableCell>{tg.name}</TableCell> |
|
|
<TableCell sx={leftBorderCellSx}> |
|
|
|
|
|
|
|
|
<TableCell sx={{...baseCellSx, ...leftBorderCellSx}}> |
|
|
{currentTaskGroups[tg.id].taskIds.length} |
|
|
{currentTaskGroups[tg.id].taskIds.length} |
|
|
</TableCell> |
|
|
</TableCell> |
|
|
<TableCellEdit |
|
|
<TableCellEdit |
|
@@ -279,12 +283,13 @@ const ResourceAllocationByStage: React.FC<Props> = ({ grades, allTasks }) => { |
|
|
onChange={makeUpdatePercentage(tg.id)} |
|
|
onChange={makeUpdatePercentage(tg.id)} |
|
|
convertValue={(inputValue) => Number(inputValue)} |
|
|
convertValue={(inputValue) => Number(inputValue)} |
|
|
cellSx={{ |
|
|
cellSx={{ |
|
|
|
|
|
...baseCellSx, |
|
|
backgroundColor: "primary.lightest", |
|
|
backgroundColor: "primary.lightest", |
|
|
}} |
|
|
}} |
|
|
inputSx={{ width: "3rem" }} |
|
|
|
|
|
|
|
|
inputSx={{ ...baseCellSx, width: "3rem" }} |
|
|
error={currentTaskGroups[tg.id].percentAllocation < 0} |
|
|
error={currentTaskGroups[tg.id].percentAllocation < 0} |
|
|
/> |
|
|
/> |
|
|
<TableCell sx={rightBorderCellSx}> |
|
|
|
|
|
|
|
|
<TableCell sx={{...baseCellSx, ...rightBorderCellSx}}> |
|
|
{manhourFormatter.format( |
|
|
{manhourFormatter.format( |
|
|
currentTaskGroups[tg.id].percentAllocation / 100 * totalManhour, |
|
|
currentTaskGroups[tg.id].percentAllocation / 100 * totalManhour, |
|
|
)} |
|
|
)} |
|
@@ -293,7 +298,7 @@ const ResourceAllocationByStage: React.FC<Props> = ({ grades, allTasks }) => { |
|
|
const stageHours = |
|
|
const stageHours = |
|
|
currentTaskGroups[tg.id].percentAllocation / 100 * totalManhour; |
|
|
currentTaskGroups[tg.id].percentAllocation / 100 * totalManhour; |
|
|
return ( |
|
|
return ( |
|
|
<TableCell key={`${column.id}${idx}`}> |
|
|
|
|
|
|
|
|
<TableCell sx={baseCellSx} key={`${column.id}${idx}`}> |
|
|
{manhourFormatter.format( |
|
|
{manhourFormatter.format( |
|
|
manhourPercentageByGrade[column.id] / 100 * stageHours, |
|
|
manhourPercentageByGrade[column.id] / 100 * stageHours, |
|
|
)} |
|
|
)} |
|
@@ -304,13 +309,13 @@ const ResourceAllocationByStage: React.FC<Props> = ({ grades, allTasks }) => { |
|
|
))} |
|
|
))} |
|
|
<TableRow> |
|
|
<TableRow> |
|
|
<TableCell>{t("Total")}</TableCell> |
|
|
<TableCell>{t("Total")}</TableCell> |
|
|
<TableCell sx={leftBorderCellSx}> |
|
|
|
|
|
|
|
|
<TableCell sx={{...baseCellSx, ...leftBorderCellSx}}> |
|
|
{Object.values(currentTaskGroups).reduce( |
|
|
{Object.values(currentTaskGroups).reduce( |
|
|
(acc, tg) => acc + tg.taskIds.length, |
|
|
(acc, tg) => acc + tg.taskIds.length, |
|
|
0, |
|
|
0, |
|
|
)} |
|
|
)} |
|
|
</TableCell> |
|
|
</TableCell> |
|
|
<TableCell sx={{ |
|
|
|
|
|
|
|
|
<TableCell sx={{...baseCellSx, |
|
|
...(Object.values(currentTaskGroups).reduce((acc, tg) => acc + tg.percentAllocation, 0,) === 100 && leftBorderCellSx), |
|
|
...(Object.values(currentTaskGroups).reduce((acc, tg) => acc + tg.percentAllocation, 0,) === 100 && leftBorderCellSx), |
|
|
...(Object.values(currentTaskGroups).reduce((acc, tg) => acc + tg.percentAllocation, 0,) !== 100 && errorCellSx) |
|
|
...(Object.values(currentTaskGroups).reduce((acc, tg) => acc + tg.percentAllocation, 0,) !== 100 && errorCellSx) |
|
|
}} |
|
|
}} |
|
@@ -337,7 +342,7 @@ const ResourceAllocationByStage: React.FC<Props> = ({ grades, allTasks }) => { |
|
|
0, |
|
|
0, |
|
|
).toFixed(1) + "%" } */} |
|
|
).toFixed(1) + "%" } */} |
|
|
</TableCell> |
|
|
</TableCell> |
|
|
<TableCell sx={rightBorderCellSx}> |
|
|
|
|
|
|
|
|
<TableCell sx={{...baseCellSx, ...rightBorderCellSx}}> |
|
|
{manhourFormatter.format( |
|
|
{manhourFormatter.format( |
|
|
Object.values(currentTaskGroups).reduce( |
|
|
Object.values(currentTaskGroups).reduce( |
|
|
(acc, tg) => acc + tg.percentAllocation / 100 * totalManhour, |
|
|
(acc, tg) => acc + tg.percentAllocation / 100 * totalManhour, |
|
@@ -355,7 +360,7 @@ const ResourceAllocationByStage: React.FC<Props> = ({ grades, allTasks }) => { |
|
|
0, |
|
|
0, |
|
|
); |
|
|
); |
|
|
return ( |
|
|
return ( |
|
|
<TableCell key={`${column.id}${idx}`}> |
|
|
|
|
|
|
|
|
<TableCell sx={baseCellSx} key={`${column.id}${idx}`}> |
|
|
{manhourFormatter.format(hours)} |
|
|
{manhourFormatter.format(hours)} |
|
|
</TableCell> |
|
|
</TableCell> |
|
|
); |
|
|
); |
|
|