Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Save and review for archetypes #1466

Merged
merged 1 commit into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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