Skip to content

Commit

Permalink
feat(admin): disable competence details and AAP decision sections if …
Browse files Browse the repository at this point in the history
…eligibility is partial

- Disabled competence details and AAP decision sections when eligibility is marked as PARTIAL_ELIGIBILITY_REQUIREMENT.
  • Loading branch information
ThomasDos committed Aug 13, 2024
1 parent 3079fb6 commit 040cc77
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ export const CompetenciesBlocksSection = ({
certificationCompetenceDetails,
blocsDeCompetences,
disabled,
disabledNoticeText,
}: {
isEditable: boolean;
competenceBlocsPartCompletion?: CompetenceBlocsPartCompletion;
certificationCompetenceDetails: CertificationCompetenceDetails[];
blocsDeCompetences: DffCertificationCompetenceBloc[];
disabled: boolean;
disabledNoticeText: string;
}) => {
const { candidacyId } = useParams();

Expand Down Expand Up @@ -86,12 +88,7 @@ export const CompetenciesBlocksSection = ({
))}
</ul>
)}
{disabled && (
<SmallNotice>
Vous devez d'abord détailler la certification visée avant d'intégrer
les prérequis.
</SmallNotice>
)}
{disabled && <SmallNotice>{disabledNoticeText}</SmallNotice>}
</CandidacySectionCard>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
BadgeToComplete,
DefaultCandidacySectionCard,
} from "@/components/card/candidacy-section-card/DefaultCandidacySectionCard";
import { SmallNotice } from "@/components/small-notice/SmallNotice";
import { DfFileAapDecision } from "@/graphql/generated/graphql";
import Badge from "@codegouvfr/react-dsfr/Badge";
import { useParams } from "next/navigation";
Expand All @@ -11,10 +12,12 @@ export const DecisionCard = ({
aapDecision,
aapDecisionComment,
isEditable,
disabled,
}: {
aapDecision: DfFileAapDecision | null;
aapDecisionComment: string | null;
isEditable: boolean;
disabled: boolean;
}) => {
const { candidacyId } = useParams();

Expand All @@ -38,11 +41,18 @@ export const DecisionCard = ({
title="Avis sur la faisabilité"
titleIconClass="fr-icon-thumb-up-fill"
status={aapDecision ? "COMPLETED" : "TO_COMPLETE"}
isEditable={isEditable}
isEditable={isEditable && !disabled}
disabled={disabled}
buttonOnClickHref={`/candidacies/${candidacyId}/feasibility-aap/decision`}
CustomBadge={<DecisionBadge />}
>
{aapDecisionComment && <p className="md:pl-10">{aapDecisionComment}</p>}
{disabled && (
<SmallNotice>
Une recevabilité en cours favorable existe déjà sur cette candidature.
Vous ne pouvez pas émettre un avis sur la faisabilité.
</SmallNotice>
)}
</DefaultCandidacySectionCard>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ const AapFeasibilityPage = () => {
feasibility?.decision === "ADMISSIBLE" ||
feasibility?.decision === "REJECTED";

const isEligibilityRequirementPartial =
dematerializedFeasibilityFile?.eligibilityRequirement ===
"PARTIAL_ELIGIBILITY_REQUIREMENT";

if (!feasibility) {
return null;
}
Expand Down Expand Up @@ -94,7 +98,15 @@ const AapFeasibilityPage = () => {
competenceBlocsPartCompletion={
dematerializedFeasibilityFile?.competenceBlocsPartCompletion
}
disabled={!dematerializedFeasibilityFile?.certificationPartComplete}
disabled={
!dematerializedFeasibilityFile?.certificationPartComplete ||
isEligibilityRequirementPartial
}
disabledNoticeText={
isEligibilityRequirementPartial
? "Vous n'avez pas besoin de compléter cette catégorie puisque votre candidat a déjà une recevabilité favorable en cours."
: "Vous devez d'abord détailler la certification visée avant d'intégrer les prérequis."
}
isEditable={isFeasibilityEditable}
/>
<PrerequisitesCard
Expand All @@ -115,6 +127,7 @@ const AapFeasibilityPage = () => {
dematerializedFeasibilityFile?.aapDecisionComment as string | null
}
isEditable={isFeasibilityEditable}
disabled={isEligibilityRequirementPartial}
/>
<AttachmentsCard
attachmentsPartComplete={
Expand Down

0 comments on commit 040cc77

Please sign in to comment.