Skip to content

Commit

Permalink
[MDS-6265] Project Summary: Change from Change Requested -> Under Rev…
Browse files Browse the repository at this point in the history
…iew on final submit only (#3353)

MDS-6265 Project Summary: Change from Change Requested -> Under Review on final submit only
  • Loading branch information
simensma-fresh authored Dec 19, 2024
1 parent 9ec204a commit 0c89126
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions services/common/src/components/forms/SteppedForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ interface SteppedFormProps extends Omit<FormWrapperProps, "onSubmit"> {
children: Array<ReactElement<StepProps>>;
handleTabChange: (newTab: string) => void | Promise<void>;
handleSaveDraft?: (formValues) => Promise<void>;
handleSaveData?: (values, newActiveTab?: string) => Promise<void>;
handleSaveData?: (values, newActiveTab?: string, currentTab?: string) => Promise<void>;
handleCancel?: () => void | Promise<void>;
transformPayload?: (values: any) => any;
activeTab: string;
Expand Down Expand Up @@ -108,7 +108,7 @@ const SteppedForm: FC<SteppedFormProps> = ({
setIsSubmitting(true);
try {
if (handleSaveData && (await saveCheck())) {
await handleSaveData(getValues(formValues), tab);
await handleSaveData(getValues(formValues), tab, `${tabs[tabIndex]}`);
}
if (errors.length > 0) return;
setTabIndex(indexOf(tabs, tab));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { areAuthFieldsDisabled, areDocumentFieldsDisabled, areFieldsDisabled, is
interface ProjectSummaryFormProps {
initialValues: IProjectSummary;
handleTabChange: (newTab: string) => void;
handleSaveData: (formValues, newActiveTab?) => Promise<void>;
handleSaveData: (formValues, newActiveTab?, currentTab?) => Promise<void>;
activeTab: string;
isEditMode?: boolean;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,20 @@ export const ProjectSummaryPage = () => {
history.push(url);
};

const handleSaveData = async (formValues, newActiveTab?: string) => {
const handleSaveData = async (formValues, newActiveTab?: string, currentTab?: string) => {
let message = newActiveTab
? "Successfully updated the project description."
: "Successfully submitted a project description to the Province of British Columbia.";
let status_code = projectSummary.status_code;
let is_historic = projectSummary.is_historic;

if (status_code === "CHR" && formValues.confirmation_of_submission) {
if (
status_code === "CHR" &&
formValues.confirmation_of_submission &&
currentTab === "declaration"
) {
// If a proponent re-submits the declaration, when changes are made to the project description,
// change it back to under review.
status_code = "UNR";
} else if ((!status_code || !isEditMode) && status_code !== "UNR") {
status_code = "DFT";
Expand Down

0 comments on commit 0c89126

Please sign in to comment.