-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update prisma model * Clean amendements stats * fix naming * AJout le filtrage par departement * update * fixes stats
- Loading branch information
1 parent
e7a3b09
commit e36ade1
Showing
22 changed files
with
1,044 additions
and
298 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
"use client"; | ||
import * as React from "react"; | ||
|
||
import Stack from "@mui/material/Stack"; | ||
|
||
import DeputesView from "./DeputesView"; | ||
|
||
import { FilterContainer } from "@/components/FilterContainer"; | ||
import { Filter } from "./Filter"; | ||
import { groupDeputes } from "./groupDeputes"; | ||
import { getDeputes } from "./getDeputes"; | ||
|
||
interface DeputeFilterProps extends ReturnType<typeof groupDeputes> { | ||
deputes: Awaited<ReturnType<typeof getDeputes>>; | ||
} | ||
|
||
export default function DeputesFilter(props: DeputeFilterProps) { | ||
const { deputes, indexesPerNom, indexesPerGroup, indexesPerCirco, groups } = | ||
props; | ||
|
||
const [numeroDepartement, setNumeroDepartement] = React.useState< | ||
string | null | ||
>(null); | ||
|
||
return ( | ||
<React.Fragment> | ||
<Stack spacing={3} useFlexGap flex={2}> | ||
<FilterContainer> | ||
<Filter | ||
numeroDepartement={numeroDepartement} | ||
handleNumeroDepartement={setNumeroDepartement} | ||
/> | ||
</FilterContainer> | ||
</Stack> | ||
<Stack spacing={3} flex={5}> | ||
<DeputesView | ||
deputes={deputes} | ||
indexesPerNom={indexesPerNom} | ||
indexesPerGroup={indexesPerGroup} | ||
indexesPerCirco={indexesPerCirco} | ||
groups={groups} | ||
numeroDepartement={numeroDepartement} | ||
/> | ||
</Stack> | ||
</React.Fragment> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
"use client"; | ||
import * as React from "react"; | ||
import { Autocomplete, MenuItem } from "@mui/material"; | ||
import TextField from "@mui/material/TextField"; | ||
import { departements } from "./structureCircos"; | ||
|
||
type FilterProps = { | ||
numeroDepartement: string | null; | ||
handleNumeroDepartement: (numeroDepartement: string | null) => void; | ||
}; | ||
|
||
export const Filter = (props: FilterProps) => { | ||
const { numeroDepartement, handleNumeroDepartement } = props; | ||
|
||
const value = React.useMemo( | ||
() => | ||
numeroDepartement === null | ||
? null | ||
: departements.find((v) => v.numeroDepartement === numeroDepartement) ?? | ||
null, | ||
[numeroDepartement] | ||
); | ||
|
||
return ( | ||
<div> | ||
<Autocomplete | ||
disablePortal | ||
options={departements} | ||
isOptionEqualToValue={(option, value) => | ||
option.numeroDepartement === value.numeroDepartement | ||
} | ||
value={value} | ||
onChange={(_, newValue) => | ||
handleNumeroDepartement(newValue?.numeroDepartement ?? null) | ||
} | ||
groupBy={(option) => option.region} | ||
getOptionLabel={(option) => | ||
`${option.nomDepartement} (${option.numeroDepartement})` | ||
} | ||
getOptionKey={(option) => option.numeroDepartement} | ||
|
||
renderInput={(params) => <TextField {...params} label="Département" />} | ||
/> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.