Skip to content

Commit

Permalink
fix: Mise à jour de l'onglet d'organisme pour les non-retenus (#3603)
Browse files Browse the repository at this point in the history
Co-authored-by: Paul Gaucher <[email protected]>
  • Loading branch information
Pomarom and Pomarom authored Mar 15, 2024
1 parent 3f5b179 commit 3905e58
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 11 deletions.
26 changes: 15 additions & 11 deletions ui/modules/organismes/ListeOrganismesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,15 @@ function ListeOrganismesPage(props: ListeOrganismesPageProps) {
>
<TabList>
<Tab fontWeight="bold">Organismes fiables ({organismesFiables.length})</Tab>
<Tab fontWeight="bold">
<HStack>
<i className="ri-alarm-warning-fill"></i>
<Text>OFA : corrections attendues ({organismesACompleter.length})</Text>
</HStack>
</Tab>
{organisationType === "ADMINISTRATEUR" && (
{organismesACompleter.length !== 0 && (
<Tab fontWeight="bold">
<HStack>
<i className="ri-alarm-warning-fill"></i>
<Text>OFA : corrections attendues ({organismesACompleter.length})</Text>
</HStack>
</Tab>
)}
{organisationType === "ADMINISTRATEUR" && organismesNonRetenus.length !== 0 && (
<Tab fontWeight="bold">
<HStack>
<i className="ri-close-circle-fill"></i>
Expand All @@ -157,10 +159,12 @@ function ListeOrganismesPage(props: ListeOrganismesPageProps) {
<TabPanel>
<OrganismesFiablesPanelContent organismes={organismesFiables} />
</TabPanel>
<TabPanel>
<OrganismesACompleterPanelContent organismes={organismesACompleter} />
</TabPanel>
{organisationType === "ADMINISTRATEUR" && (
{organismesACompleter.length !== 0 && (
<TabPanel>
<OrganismesACompleterPanelContent organismes={organismesACompleter} />
</TabPanel>
)}
{organisationType === "ADMINISTRATEUR" && organismesNonRetenus.length !== 0 && (
<TabPanel>
<OrganismesNonRetenusPanelContent organismes={organismesNonRetenus} />
</TabPanel>
Expand Down
42 changes: 42 additions & 0 deletions ui/pages/organismes/[organismeId]/organismes/non-retenus.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { Center, Container, Spinner } from "@chakra-ui/react";
import { useQuery } from "@tanstack/react-query";
import { useRouter } from "next/router";

import { _get } from "@/common/httpClient";
import { Organisme } from "@/common/internal/Organisme";
import SimplePage from "@/components/Page/SimplePage";
import withAuth from "@/components/withAuth";
import ListeOrganismesPage from "@/modules/organismes/ListeOrganismesPage";

function OrganismesNonRetenus() {
const router = useRouter();
const organismeId = router.query.organismeId as string;
const { data: organismes } = useQuery<Organisme[]>(
["organismes", organismeId, "organismes"],
() => _get(`/api/v1/organismes/${organismeId}/organismes`),
{
enabled: !!organismeId,
}
);

if (!organismes) {
return (
<SimplePage title="">
<Container maxW="xl" p="8">
<Center>
<Spinner />
</Center>
</Container>
</SimplePage>
);
}

const prominentOrganisme = organismes.find((org) => org._id === organismeId);
if (prominentOrganisme) {
(prominentOrganisme as any).prominent = true;
}

return <ListeOrganismesPage organismes={organismes} activeTab="non-retenus" modePublique={true} />;
}

export default withAuth(OrganismesNonRetenus);

0 comments on commit 3905e58

Please sign in to comment.