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

fix: Mise à jour de l'onglet d'organisme pour les non-retenus #3603

Merged
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
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);
Loading