Skip to content

Commit

Permalink
don't disable the tab when the project summary is submitted but there…
Browse files Browse the repository at this point in the history
…'s no irt/final app
  • Loading branch information
taraepp committed Oct 25, 2024
1 parent bcb4653 commit 1bebd18
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 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
7 changes: 4 additions & 3 deletions services/core-web/src/components/mine/Projects/Project.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ const Project: FC = () => {
const [isValid, setIsValid] = useState(true);
const [activeTab, setActiveTab] = useState("overview");

const { information_requirements_table, major_mine_application } = project;
const { information_requirements_table, major_mine_application, project_summary } = project;

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

Expand Down Expand Up @@ -131,7 +132,7 @@ const Project: FC = () => {
{
key: "information-requirements-table",
label: "IRT",
disabled: !hasInformationRequirementsTable,
disabled: !hasInformationRequirementsTable && !isProjectSummarySubmitted,
children: (
<div className="padding-lg">
<InformationRequirementsTableTab />
Expand All @@ -141,7 +142,7 @@ const Project: FC = () => {
{
key: "final-app",
label: "Final Application",
disabled: !hasFinalAplication,
disabled: !hasFinalAplication && !isProjectSummarySubmitted,
children: (
<div className="padding-lg">
<MajorMineApplicationTab />
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

0 comments on commit 1bebd18

Please sign in to comment.