Activites
; -} diff --git a/app/depute/[slug]/[tab]/Amendements.tsx b/app/depute/[slug]/[tab]/Amendements.tsx deleted file mode 100644 index 76cc88c..0000000 --- a/app/depute/[slug]/[tab]/Amendements.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import React from "react"; - -import Stack from "@mui/material/Stack"; - -import AmendementCard from "@/components/folders/AmendementCard"; -import { prisma } from "@/prisma"; - -async function getDeputeAmendementUnCached(slug: string) { - try { - return await prisma.acteur.findFirst({ - where: { slug }, - - // Verifier que ca fonctionne quadn on aura les amendements dans la DB - include: { amendements: true, groupeParlementaire: true }, - }); - } catch (error) { - console.error(`Error fetching amendement from depute ${slug}:`, error); - throw error; - } -} - -export const getDeputeAmendement = React.cache(getDeputeAmendementUnCached); - -export default async function Amendements(props: { deputeSlug: string }) { - const deputeWithAmendements = await getDeputeAmendement(props.deputeSlug); - - const { amendements, ...depute } = deputeWithAmendements!; - - return ( -Amendements
- {amendements && - amendements - .sort((a, b) => - Number.parseInt(a.numeroOrdreDepot || "") < - Number.parseInt(b.numeroOrdreDepot || "") - ? -1 - : 1 - ) - .map((amendement) => ( -Pas de documents trouvé.
; - // } - // return ( - //Amendements
+ {amendements && + amendements + .sort((a, b) => + Number.parseInt(a.numeroOrdreDepot || "") < + Number.parseInt(b.numeroOrdreDepot || "") + ? -1 + : 1 + ) + .map((amendement) => { + const numeroNotice = amendement.texteLegislatifRef?.numNotice; + const section = amendement.divisionArticleDesignationCourte; + // const subSection = amendement.alineaDesignation; + + const article = [ + section, + // subSection + ] + .filter((item) => item !== null) + .join(" "); + + const titre = `Amendement N°${amendement.numeroOrdreDepot}${ + numeroNotice == null + ? "" + : ` au text N°${numeroNotice}${article ? ` - ${article}` : ""}` + }`; + return ( +Activités
; } diff --git a/app/depute/[slug]/qag/QuestionCard.tsx b/app/depute/[slug]/qag/QuestionCard.tsx new file mode 100644 index 0000000..7bddbbf --- /dev/null +++ b/app/depute/[slug]/qag/QuestionCard.tsx @@ -0,0 +1,146 @@ +"use client"; +import * as React from "react"; + +import Typography from "@mui/material/Typography"; +import Stack from "@mui/material/Stack"; +import Accordion from "@mui/material/Accordion"; +import AccordionDetails from "@mui/material/AccordionDetails"; +import AccordionSummary from "@mui/material/AccordionSummary"; + +import ExpandMoreIcon from "@mui/icons-material/ExpandMore"; + +import { Organe, Question } from "@prisma/client"; +import StatusChip from "@/components/StatusChip"; + +type QuestionCardProps = { + question: Question & { minIntRef: Organe | null }; +}; + +export default function QuestionCard(props: QuestionCardProps) { + const { + question: { + uid, + type, + numero, + dateDepot, + dateCloture, + titre, + rubrique, + texteQuestion, + erratumQuestion, + texteReponse, + erratumReponse, + minIntRef, + }, + } = props; + + const pannelId = `${uid}-pannel`; + const headerId = `${uid}-header`; + + return ( +Deputé inconnu
; + } + const { questions = [] } = deputeWithQuestions; + return ( +{JSON.stringify(item, null, 2)}+
Deputé inconnu
; diff --git a/components/folders/AmendementCard.tsx b/components/folders/AmendementCard.tsx index 074d9f2..8182bbc 100644 --- a/components/folders/AmendementCard.tsx +++ b/components/folders/AmendementCard.tsx @@ -32,10 +32,11 @@ function getStatus(label: string | null) { type AmendementCardProps = { amendement: Amendement; depute: null | (Acteur & { groupeParlementaire: Organe | null }); + titre?: string; }; export default function AmendementCard(props: AmendementCardProps) { - const { amendement, depute } = props; + const { amendement, depute, titre } = props; // TODO: utiliser la base cosignataires amendement pour avoir le nombre et les noms const nbSignataires = amendement.signatairesLibelle @@ -65,20 +66,23 @@ export default function AmendementCard(props: AmendementCardProps) { spacing={1} sx={{ width: "100%", mr: 2 }} > -