Skip to content

Commit

Permalink
[MDS-6139] Don't disable IRT/final app tab when "Start" button is ena…
Browse files Browse the repository at this point in the history
…bled (#3282)

* don't disable the tab when the project summary is submitted but there's no irt/final app

* revert behaviour on CORE because it's confusing

* simplify logic on enabling button
  • Loading branch information
taraepp authored Oct 25, 2024
1 parent bcb4653 commit 6ee1bde
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const InformationRequirementsTableTab = () => {
r1.map(({ requirement_guid, sub_requirements, ...rest }) => ({
requirement_guid,
...rest,
...r2.find((i) => i.requirement_guid === requirement_guid),
...r2?.find((i) => i.requirement_guid === requirement_guid),
sub_requirements: deepMergeById(sub_requirements, r2),
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ export const ProjectStagesTable: FC<ProjectStagesTableProps> = ({ projectStages
}
if (record.project_stage === "IRT") {
let buttonLabel: string;
let disableButton = Boolean(record.stage_status);
let enableButton = true;
if (!record.stage_status) {
buttonLabel = "Start";
disableButton = !isProjectSummarySubmitted;
enableButton = isProjectSummarySubmitted;
} else if (record.stage_status === "APV") {
buttonLabel = "View";
} else {
Expand All @@ -107,18 +107,18 @@ export const ProjectStagesTable: FC<ProjectStagesTableProps> = ({ projectStages
<Button
className="full-mobile margin-small"
onClick={() => record?.navigate_forward()}
disabled={disableButton}
disabled={!enableButton}
>
{buttonLabel}
</Button>
);
}
if (record.project_stage === "Application") {
let buttonLabel: string;
let disableButton = Boolean(record.stage_status);
let enableButton = true;
if (!record.stage_status) {
buttonLabel = "Start";
disableButton = !isProjectSummarySubmitted;
enableButton = isProjectSummarySubmitted;
} else if (["SUB", "UNR", "APV"].includes(record.stage_status)) {
buttonLabel = "View";
} else {
Expand All @@ -129,7 +129,7 @@ export const ProjectStagesTable: FC<ProjectStagesTableProps> = ({ projectStages
<Button
className="full-mobile margin-small"
onClick={() => record?.navigate_forward()}
disabled={disableButton}
disabled={!enableButton}
>
{buttonLabel}
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const ProjectPage: FC = () => {
mrc_review_required,
} = project;

const isProjectSummarySubmitted = Boolean(projectSummary?.submission_date);
const hasInformationRequirementsTable = Boolean(information_requirements_table?.irt_guid);
const hasFinalAplication = Boolean(major_mine_application?.major_mine_application_guid);

Expand Down Expand Up @@ -238,7 +239,7 @@ const ProjectPage: FC = () => {
{
label: "IRT",
key: "irt-entry",
disabled: !hasInformationRequirementsTable,
disabled: !hasInformationRequirementsTable && !isProjectSummarySubmitted,
children: (
<div className={pageClass}>
<InformationRequirementsTableEntryTab
Expand All @@ -251,7 +252,7 @@ const ProjectPage: FC = () => {
{
label: "Application",
key: "major-mine-application",
disabled: !hasFinalAplication,
disabled: !hasFinalAplication && !isProjectSummarySubmitted,
children: <div className={pageClass}>{majorMineApplicationTabContent}</div>,
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,6 @@ exports[`ProjectOverviewTab renders properly 1`] = `
>
<button
class="ant-btn ant-btn-default full-mobile margin-small"
disabled=""
type="button"
>
<span>
Expand Down

0 comments on commit 6ee1bde

Please sign in to comment.