diff --git a/packages/reva-admin-react/src/app/(aap)/agencies-settings/legal-information/page.tsx b/packages/reva-admin-react/src/app/(aap)/agencies-settings/legal-information/page.tsx index 247c44ef0..ce3c65e92 100644 --- a/packages/reva-admin-react/src/app/(aap)/agencies-settings/legal-information/page.tsx +++ b/packages/reva-admin-react/src/app/(aap)/agencies-settings/legal-information/page.tsx @@ -2,7 +2,6 @@ import Alert from "@codegouvfr/react-dsfr/Alert"; import Input from "@codegouvfr/react-dsfr/Input"; import { useLegalInformationsPage } from "./legalInformationsPage.hook"; -import { useFeatureflipping } from "@/components/feature-flipping/featureFlipping"; import { useAuth } from "@/components/auth/auth"; import { LegalInformationUpdateBlock } from "@/app/(aap)/agencies-settings/legal-information/_components/legal-information-update-block/LegalInformationUpdateBlock"; import { GrayCard } from "@/components/card/gray-card/GrayCard"; @@ -10,7 +9,6 @@ import { GrayCard } from "@/components/card/gray-card/GrayCard"; const LegalInformationPage = () => { const { maisonMereAAP, legalInformationsStatus } = useLegalInformationsPage(); const { isGestionnaireMaisonMereAAP } = useAuth(); - const { isFeatureActive } = useFeatureflipping(); return (

Informations juridiques

@@ -80,22 +78,20 @@ const LegalInformationPage = () => { )} - {isFeatureActive("LEGAL_INFORMATION_VALIDATION") && - isGestionnaireMaisonMereAAP && - maisonMereAAP && ( - ({ - ...d, - decisionTakenAt: new Date(d.decisionTakenAt), - }), - )} - /> - )} + {isGestionnaireMaisonMereAAP && maisonMereAAP && ( + ({ + ...d, + decisionTakenAt: new Date(d.decisionTakenAt), + }), + )} + /> + )} )}
diff --git a/packages/reva-admin-react/src/app/(admin)/maisonMereAAPs/[maisonMereAAPId]/page.tsx b/packages/reva-admin-react/src/app/(admin)/maisonMereAAPs/[maisonMereAAPId]/page.tsx index dbfe0b659..8dd5dd6bd 100644 --- a/packages/reva-admin-react/src/app/(admin)/maisonMereAAPs/[maisonMereAAPId]/page.tsx +++ b/packages/reva-admin-react/src/app/(admin)/maisonMereAAPs/[maisonMereAAPId]/page.tsx @@ -1,23 +1,15 @@ "use client"; import { useGraphQlClient } from "@/components/graphql/graphql-client/GraphqlClient"; -import { - OrganismSummary, - Typology, -} from "@/components/organism-summary/OrganismSummary"; - -import { Typology as TypologyOrganismSummaryNewLegal } from "@/components/organism-summary/OrganismSummaryNewLegal"; - -import { OrganismSummary as OrganismSummaryNewLegal } from "@/components/organism-summary/OrganismSummaryNewLegal"; +import { Typology } from "@/components/organism-summary/OrganismSummary"; +import { OrganismSummary } from "@/components/organism-summary/OrganismSummary"; import { graphql } from "@/graphql/generated"; import { useQuery } from "@tanstack/react-query"; import { useParams } from "next/navigation"; import { selectedDepartmentsToTreeSelectItems } from "@/utils"; import MaisonMereAAPForm from "@/app/(admin)/maisonMereAAPs/[maisonMereAAPId]/MaisonMereAAPForm"; import { sortRegionsByAlphabeticalOrderAndDOM } from "@/utils"; -import { BackButton } from "@/components/back-button/BackButton"; import { GrayCard } from "@/components/card/gray-card/GrayCard"; import ValidationDecisionForm from "./(components)/ValidationDecisionForm"; -import { useFeatureflipping } from "@/components/feature-flipping/featureFlipping"; import { Info } from "@/components/organism-summary/Info"; import { LegalDocumentList } from "@/components/legal-document-list/LegalDocumentList"; @@ -122,11 +114,6 @@ const MaisonMereAAPPage = () => { const { graphqlClient } = useGraphQlClient(); - const featureFlipping = useFeatureflipping(); - const showLegalValidation = featureFlipping.isFeatureActive( - "LEGAL_INFORMATION_VALIDATION", - ); - const { data: getMaisonMereAAPResponse, isLoading: isMaisonMereAAPLoading } = useQuery({ queryKey: ["getMaisonMereAAP", maisonMereAAPId], @@ -160,121 +147,69 @@ const MaisonMereAAPPage = () => { return ( maisonMereAAP && (
- {!showLegalValidation && ( - - Toutes les inscriptions - - )} - {showLegalValidation ? ( - c.ccn.label, - )} - createdAt={new Date(maisonMereAAP.createdAt)} - companyManagerFirstname={ - maisonMereAAP.statutValidationInformationsJuridiquesMaisonMereAAP == - "A_JOUR" - ? maisonMereAAP.managerFirstname || undefined - : maisonMereAAP.legalInformationDocuments?.managerFirstname - } - companyManagerLastname={ - maisonMereAAP.statutValidationInformationsJuridiquesMaisonMereAAP == - "A_JOUR" - ? maisonMereAAP.managerLastname || undefined - : maisonMereAAP.legalInformationDocuments?.managerLastname - } - legalInformationDocumentsDecisions={maisonMereAAP.legalInformationDocumentsDecisions.map( - (d) => ({ - ...d, - aapUpdatedDocumentsAt: new Date(d.aapUpdatedDocumentsAt), - decisionTakenAt: new Date(d.decisionTakenAt), - }), - )} - statutValidationInformationsJuridiquesMaisonMereAAP={ - maisonMereAAP.statutValidationInformationsJuridiquesMaisonMereAAP - } - /> - ) : ( - c.ccn.label, - )} - /> - )} - - {showLegalValidation ? ( - -

Agences

-
    - {maisonMereAAP.organisms.map((o) => ( -
  1. -

    - {o.informationsCommerciales?.nom || o.label} -

    - -
    {o.fermePourAbsenceOuConges ? "Oui" : "Non"}
    -
    - -
      - {o.managedDegrees.map((d) => ( -
    • {d.degree.longLabel}
    • - ))} -
    -
    -
  2. - ))} -
-
- ) : ( - -

Agences

-
    - {maisonMereAAP.organisms.map((o) => ( -
  1. -

    - {o.informationsCommerciales?.nom || o.label} -

    - -
    {o.fermePourAbsenceOuConges ? "Oui" : "Non"}
    -
    - -
      - {o.managedDegrees.map((d) => ( -
    • {d.degree.longLabel}
    • - ))} -
    -
    -
  2. - ))} -
-
- )} + c.ccn.label, + )} + createdAt={new Date(maisonMereAAP.createdAt)} + companyManagerFirstname={ + maisonMereAAP.statutValidationInformationsJuridiquesMaisonMereAAP == + "A_JOUR" + ? maisonMereAAP.managerFirstname || undefined + : maisonMereAAP.legalInformationDocuments?.managerFirstname + } + companyManagerLastname={ + maisonMereAAP.statutValidationInformationsJuridiquesMaisonMereAAP == + "A_JOUR" + ? maisonMereAAP.managerLastname || undefined + : maisonMereAAP.legalInformationDocuments?.managerLastname + } + legalInformationDocumentsDecisions={maisonMereAAP.legalInformationDocumentsDecisions.map( + (d) => ({ + ...d, + aapUpdatedDocumentsAt: new Date(d.aapUpdatedDocumentsAt), + decisionTakenAt: new Date(d.decisionTakenAt), + }), + )} + statutValidationInformationsJuridiquesMaisonMereAAP={ + maisonMereAAP.statutValidationInformationsJuridiquesMaisonMereAAP + } + /> + ) + +

Agences

+
    + {maisonMereAAP.organisms.map((o) => ( +
  1. +

    + {o.informationsCommerciales?.nom || o.label} +

    + +
    {o.fermePourAbsenceOuConges ? "Oui" : "Non"}
    +
    + +
      + {o.managedDegrees.map((d) => ( +
    • {d.degree.longLabel}
    • + ))} +
    +
    +
  2. + ))} +
+
{ maisonMereAAP.statutValidationInformationsJuridiquesMaisonMereAAP } /> - {showLegalValidation && - maisonMereAAP.statutValidationInformationsJuridiquesMaisonMereAAP === - "EN_ATTENTE_DE_VERIFICATION" && + {maisonMereAAP.statutValidationInformationsJuridiquesMaisonMereAAP === + "EN_ATTENTE_DE_VERIFICATION" && maisonMereAAP.legalInformationDocuments && ( <> { [searchFilter], ); - const featureFlipping = useFeatureflipping(); - const showLegalMenuItems = featureFlipping.isFeatureActive( - "LEGAL_INFORMATION_VALIDATION", - ); - - const items = useMemo(() => { - if (showLegalMenuItems) { - return [ - menuItem( - "Inscriptions à vérifier", - hrefSideMenu("pending"), - currentPathname, - subscriptionCountByStatus?.PENDING_SUBSCRIPTION, - ), - menuItem( - "Inscriptions refusées", - hrefSideMenu("rejected"), - currentPathname, - subscriptionCountByStatus?.REJECTED_SUBSCRIPTION, - ), + const items = useMemo( + () => [ + menuItem( + "Inscriptions à vérifier", + hrefSideMenu("pending"), + currentPathname, + subscriptionCountByStatus?.PENDING_SUBSCRIPTION, + ), + menuItem( + "Inscriptions refusées", + hrefSideMenu("rejected"), + currentPathname, + subscriptionCountByStatus?.REJECTED_SUBSCRIPTION, + ), - menuItem( - "Comptes administrateur à vérifier", - hrefSideMenu("check-legal-information"), - currentPathname, - subscriptionCountByStatus?.PENDING_LEGAL_VERIFICATION, - ), - menuItem( - "Comptes administrateur incomplets", - hrefSideMenu("validated"), - currentPathname, - subscriptionCountByStatus?.NEED_LEGAL_VERIFICATION, - ), - menuItem( - "Comptes administrateur vérifiés", - hrefSideMenu("up-to-date"), - currentPathname, - subscriptionCountByStatus?.APPROVED, - ), - ]; - } - return [ - menuItem("En attente", hrefSideMenu("pending"), currentPathname), - menuItem("Validées", hrefSideMenu("validated"), currentPathname), - menuItem("Refusées", hrefSideMenu("rejected"), currentPathname), - ]; - }, [ - showLegalMenuItems, - subscriptionCountByStatus, - currentPathname, - hrefSideMenu, - ]); + menuItem( + "Comptes administrateur à vérifier", + hrefSideMenu("check-legal-information"), + currentPathname, + subscriptionCountByStatus?.PENDING_LEGAL_VERIFICATION, + ), + menuItem( + "Comptes administrateur incomplets", + hrefSideMenu("validated"), + currentPathname, + subscriptionCountByStatus?.NEED_LEGAL_VERIFICATION, + ), + menuItem( + "Comptes administrateur vérifiés", + hrefSideMenu("up-to-date"), + currentPathname, + subscriptionCountByStatus?.APPROVED, + ), + ], + [subscriptionCountByStatus, currentPathname, hrefSideMenu], + ); return (
diff --git a/packages/reva-admin-react/src/components/organism-summary/OrganismSummary.tsx b/packages/reva-admin-react/src/components/organism-summary/OrganismSummary.tsx index ce02befce..746dea79a 100644 --- a/packages/reva-admin-react/src/components/organism-summary/OrganismSummary.tsx +++ b/packages/reva-admin-react/src/components/organism-summary/OrganismSummary.tsx @@ -1,10 +1,15 @@ import { format } from "date-fns"; +import { Badge } from "@codegouvfr/react-dsfr/Badge"; import { GrayCard } from "@/components/card/gray-card/GrayCard"; import { Info } from "./Info"; +import { + OrganismSummaryLegalInformationDocumentsDecisionProps, + OrganismSummaryLegalInformationDocumentsDecisions, +} from "./OrganismSummaryLegalInformationDocumentsDecisions"; +import { StatutValidationInformationsJuridiquesMaisonMereAap } from "@/graphql/generated/graphql"; import { CompanyPreview } from "../company-preview"; export type Typology = - | "generaliste" | "expertBranche" | "expertFiliere" | "expertBrancheEtFiliere"; @@ -15,27 +20,12 @@ const getTypologyLabel = (typology: Typology) => { return "Expert branche"; case "expertFiliere": return "Expert filière"; - case "generaliste": - return "Généraliste"; case "expertBrancheEtFiliere": return "Expert branche et filière"; } }; -export const OrganismSummary = ({ - companyName, - accountFirstname, - accountLastname, - accountEmail, - accountPhoneNumber, - companyWebsite, - companyQualiopiCertificateExpiresAt, - companySiret, - companyLegalStatus, - companyTypology, - ccns, - domaines, -}: { +export interface OrganismSummaryProps { companyName: string; accountFirstname: string; accountLastname: string; @@ -47,32 +37,69 @@ export const OrganismSummary = ({ companyLegalStatus: string; companyTypology: Typology; ccns?: string[]; - domaines?: string[]; -}) => ( + createdAt?: Date; + companyManagerFirstname?: string; + companyManagerLastname?: string; + legalInformationDocumentsDecisions: OrganismSummaryLegalInformationDocumentsDecisionProps[]; + statutValidationInformationsJuridiquesMaisonMereAAP: StatutValidationInformationsJuridiquesMaisonMereAap; +} + +export const OrganismSummary = ({ + companyName, + accountFirstname, + accountLastname, + accountEmail, + accountPhoneNumber, + companyWebsite, + companySiret, + companyLegalStatus, + companyTypology, + ccns, + createdAt, + companyManagerFirstname, + companyManagerLastname, + legalInformationDocumentsDecisions, + statutValidationInformationsJuridiquesMaisonMereAAP, +}: OrganismSummaryProps) => ( <>

{companyName}

-
- -

Informations générales

-
- - {accountFirstname} {accountLastname} - - - {accountEmail} - - - {accountPhoneNumber} - - - {companyWebsite || "Non spécifié"} - - - {format(companyQualiopiCertificateExpiresAt, "dd/MM/yyyy")} - -
-
- +
+ {statutValidationInformationsJuridiquesMaisonMereAAP === "A_JOUR" && ( + À jour + )} + {statutValidationInformationsJuridiquesMaisonMereAAP === + "A_METTRE_A_JOUR" && ( + Demande de précisions + )} +
+
    + {createdAt && ( +
  • Inscription envoyée le {format(createdAt, "dd/MM/yyyy")}
  • + )} + {legalInformationDocumentsDecisions.length > 0 && ( +
  • + {legalInformationDocumentsDecisions[0].decision == "VALIDE" + ? "Mise à jour validée le " + : "Demande de précision envoyée le "} + {format( + legalInformationDocumentsDecisions[0].decisionTakenAt, + "dd/MM/yyyy", + )} +
  • + )} +
+ {!!legalInformationDocumentsDecisions.length && ( + + )} +
- +

Typologie

{getTypologyLabel(companyTypology)} - {!!domaines?.length && ( - -
    - {domaines?.map((d) => ( -
  • - {d} -
  • - ))} -
-
- )} {!!ccns?.length && (
    diff --git a/packages/reva-admin-react/src/components/organism-summary/OrganismSummaryNewLegal.tsx b/packages/reva-admin-react/src/components/organism-summary/OrganismSummaryNewLegal.tsx deleted file mode 100644 index 746dea79a..000000000 --- a/packages/reva-admin-react/src/components/organism-summary/OrganismSummaryNewLegal.tsx +++ /dev/null @@ -1,142 +0,0 @@ -import { format } from "date-fns"; -import { Badge } from "@codegouvfr/react-dsfr/Badge"; -import { GrayCard } from "@/components/card/gray-card/GrayCard"; -import { Info } from "./Info"; -import { - OrganismSummaryLegalInformationDocumentsDecisionProps, - OrganismSummaryLegalInformationDocumentsDecisions, -} from "./OrganismSummaryLegalInformationDocumentsDecisions"; -import { StatutValidationInformationsJuridiquesMaisonMereAap } from "@/graphql/generated/graphql"; -import { CompanyPreview } from "../company-preview"; - -export type Typology = - | "expertBranche" - | "expertFiliere" - | "expertBrancheEtFiliere"; - -const getTypologyLabel = (typology: Typology) => { - switch (typology) { - case "expertBranche": - return "Expert branche"; - case "expertFiliere": - return "Expert filière"; - case "expertBrancheEtFiliere": - return "Expert branche et filière"; - } -}; - -export interface OrganismSummaryProps { - companyName: string; - accountFirstname: string; - accountLastname: string; - accountEmail: string; - accountPhoneNumber: string; - companyWebsite?: string | null; - companyQualiopiCertificateExpiresAt: Date; - companySiret: string; - companyLegalStatus: string; - companyTypology: Typology; - ccns?: string[]; - createdAt?: Date; - companyManagerFirstname?: string; - companyManagerLastname?: string; - legalInformationDocumentsDecisions: OrganismSummaryLegalInformationDocumentsDecisionProps[]; - statutValidationInformationsJuridiquesMaisonMereAAP: StatutValidationInformationsJuridiquesMaisonMereAap; -} - -export const OrganismSummary = ({ - companyName, - accountFirstname, - accountLastname, - accountEmail, - accountPhoneNumber, - companyWebsite, - companySiret, - companyLegalStatus, - companyTypology, - ccns, - createdAt, - companyManagerFirstname, - companyManagerLastname, - legalInformationDocumentsDecisions, - statutValidationInformationsJuridiquesMaisonMereAAP, -}: OrganismSummaryProps) => ( - <> -

    {companyName}

    -
    - {statutValidationInformationsJuridiquesMaisonMereAAP === "A_JOUR" && ( - À jour - )} - {statutValidationInformationsJuridiquesMaisonMereAAP === - "A_METTRE_A_JOUR" && ( - Demande de précisions - )} -
    -
      - {createdAt && ( -
    • Inscription envoyée le {format(createdAt, "dd/MM/yyyy")}
    • - )} - {legalInformationDocumentsDecisions.length > 0 && ( -
    • - {legalInformationDocumentsDecisions[0].decision == "VALIDE" - ? "Mise à jour validée le " - : "Demande de précision envoyée le "} - {format( - legalInformationDocumentsDecisions[0].decisionTakenAt, - "dd/MM/yyyy", - )} -
    • - )} -
    - {!!legalInformationDocumentsDecisions.length && ( - - )} -
    - - - -

    Typologie

    -
    - {getTypologyLabel(companyTypology)} - {!!ccns?.length && ( - -
      - {ccns?.map((c) => ( -
    • - {c} -
    • - ))} -
    -
    - )} -
    -
    -
    - -);