Skip to content
Snippets Groups Projects
Commit c9d61b0b authored by Pierre Ecarlat's avatar Pierre Ecarlat
Browse files

Merge branch '32-donnees-exporter-les-donnees-de-2020-a-2024-du-backoffice' into 'dev'

feat: Add exportAll button

See merge request !177
parents 865d17b0 4b1019f5
Branches dev
No related tags found
2 merge requests!178feat: Allow to download all consents,!177feat: Add exportAll button
Pipeline #121957 passed
......@@ -166,6 +166,26 @@ export const Consents: React.FC<{ type: 'sge' | 'grdf' }> = ({ type }) => {
resetSelection()
}, [gridApi, resetSelection])
const exportAllData = useCallback(() => {
const fetchAllData = async () => {
setIsLoading(true)
if (user) {
const allConsents = await consentService.searchConsents(
'',
totalRows,
0,
getAxiosXSRFHeader(user.xsrftoken)
)
if (allConsents) {
setConsents(allConsents.rows)
toggleOpenModal()
}
}
setIsLoading(false)
}
fetchAllData()
}, [user, totalRows, consentService, toggleOpenModal])
const onGridReady = ({ api }: GridReadyEvent) => {
//Grid init method
setGridApi(api)
......@@ -196,16 +216,19 @@ export const Consents: React.FC<{ type: 'sge' | 'grdf' }> = ({ type }) => {
<h1>Consentements {isGRDF ? 'GRDF' : 'Enedis'}</h1>
</div>
<div className={styles.content}>
<TextField
placeholder={`N°${isGRDF ? 'PCE' : 'PDL'} (14 chiffres)`}
label="Recherche"
value={search}
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
handleSearchChange(e.target.value)
}
disabled={isShowingSelection}
autoComplete="off"
/>
<div className={styles.inlineButtons}>
<TextField
placeholder={`N°${isGRDF ? 'PCE' : 'PDL'} (14 chiffres)`}
label="Recherche"
value={search}
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
handleSearchChange(e.target.value)
}
disabled={isShowingSelection}
autoComplete="off"
/>
<Button onClick={exportAllData}>Tout télécharger</Button>
</div>
<div
className="ag-theme-alpine-dark"
style={{ width: '100%', height: '75vh' }}
......
......@@ -6,6 +6,12 @@
padding: 1rem;
}
.inlineButtons {
display: flex;
justify-content: space-between;
align-items: center;
}
.footerButtons {
padding: 1rem 0;
display: flex;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment