Skip to content

Commit

Permalink
🐛 Save and review for archetypes (#1466)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibolton336 authored Oct 12, 2023
1 parent fdb428d commit ee2e87e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
Section,
} from "@app/api/models";
import { CustomWizardFooter } from "../custom-wizard-footer";
import { getApplicationById } from "@app/api/rest";
import { getApplicationById, getArchetypeById } from "@app/api/rest";
import { NotificationsContext } from "@app/components/NotificationsContext";
import { WizardStepNavDescription } from "../wizard-step-nav-description";
import { QuestionnaireForm } from "../questionnaire-form";
Expand Down Expand Up @@ -442,23 +442,21 @@ export const AssessmentWizard: React.FC<AssessmentWizardProps> = ({
variant: "success",
});
if (isArchetype) {
//TODO: Review Archetype?
// assessment?.archetype?.id &&
// getArchetypeById(assessment.archetype.id)
// .then((data) => {
// history.push(
// formatPath(Paths.a, {
// applicationId: data.id,
// })
// );
// })
// .catch((error) => {
// pushNotification({
// title: getAxiosErrorMessage(error),
// variant: "danger",
// });
// });
// }
assessment?.archetype?.id &&
getArchetypeById(assessment.archetype.id)
.then((data) => {
history.push(
formatPath(Paths.archetypeReview, {
archetypeId: data.id,
})
);
})
.catch((error) => {
pushNotification({
title: getAxiosErrorMessage(error),
variant: "danger",
});
});
} else {
assessment?.application?.id &&
getApplicationById(assessment.application.id)
Expand Down Expand Up @@ -538,7 +536,6 @@ export const AssessmentWizard: React.FC<AssessmentWizardProps> = ({

const wizardFooter = (
<CustomWizardFooter
isArchetype={isArchetype}
isFirstStep={currentStep === 0}
isLastStep={currentStep === sortedSections.length}
isDisabled={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export interface CustomWizardFooterProps {
isLastStep: boolean;
isDisabled: boolean;
isFormInvalid: boolean;
isArchetype?: boolean;
hasAnswers?: boolean;
onSave: (review: boolean) => void;
onSaveAsDraft: () => void;
Expand All @@ -23,7 +22,6 @@ export const CustomWizardFooter: React.FC<CustomWizardFooterProps> = ({
isLastStep,
isDisabled,
isFormInvalid,
isArchetype,
hasAnswers,
onSave,
onSaveAsDraft,
Expand Down Expand Up @@ -51,16 +49,14 @@ export const CustomWizardFooter: React.FC<CustomWizardFooterProps> = ({
>
{t("actions.save")}
</Button>
{!isArchetype && (
<Button
variant="primary"
onClick={() => onSave(true)}
isDisabled={!enableNext || isDisabled || isFormInvalid}
cy-data="save-and-review"
>
{t("actions.saveAndReview")}
</Button>
)}
<Button
variant="primary"
onClick={() => onSave(true)}
isDisabled={!enableNext || isDisabled || isFormInvalid}
cy-data="save-and-review"
>
{t("actions.saveAndReview")}
</Button>
</>
) : (
<Button
Expand Down

0 comments on commit ee2e87e

Please sign in to comment.