Skip to content
Snippets Groups Projects
Commit d5021d5c authored by Rémi PAILHAREY's avatar Rémi PAILHAREY :fork_knife_plate:
Browse files

Merge branch '3-1-sge-backoffice-amelioration-distinction-consentement-expires-valides' into 'dev'

Resolve "[1] [SGE - Backoffice] Amélioration distinction consentement expirés/valides"

See merge request !88
parents 2a0f29d7 b3ce51dd
No related branches found
No related tags found
4 merge requests!96Deploy OpenShift v2,!95MEP fix liens undefined,!91MEP: removed Meilisearch,!88Resolve "[1] [SGE - Backoffice] Amélioration distinction consentement expirés/valides"
Pipeline #53806 passed
...@@ -153,25 +153,26 @@ const Consents: React.FC = () => { ...@@ -153,25 +153,26 @@ const Consents: React.FC = () => {
} }
}, [gridApi, selectedNodes]) }, [gridApi, selectedNodes])
const handleSearchChange = useCallback( const searchConsents = async () => {
async (newSearch: string) => { if (user) {
setSearch(newSearch) const consentPagination = await consentService.searchConsents(
if (user) { search,
const consentPagination = await consentService.searchConsents( rowsPerPage,
newSearch, page,
rowsPerPage, getAxiosXSRFHeader(user.xsrftoken)
page, )
getAxiosXSRFHeader(user.xsrftoken) if (consentPagination) {
) setConsents(consentPagination.rows)
if (consentPagination) { checkSelectedNodes()
setConsents(consentPagination.rows) setTotalRows(consentPagination.totalRows)
checkSelectedNodes()
setTotalRows(consentPagination.totalRows)
}
} }
}, }
[user, consentService, rowsPerPage, page, checkSelectedNodes] }
)
const handleSearchChange = (newSearch: string) => {
setSearch(newSearch)
setPage(0)
}
const resetSelection = useCallback(() => { const resetSelection = useCallback(() => {
if (gridApi) { if (gridApi) {
...@@ -252,12 +253,12 @@ const Consents: React.FC = () => { ...@@ -252,12 +253,12 @@ const Consents: React.FC = () => {
} }
}, [gridApi]) }, [gridApi])
/** Trigger search when page loads or when admin changes pagination */ /** Trigger search when page loads or when admin changes input or pagination */
useEffect(() => { useEffect(() => {
handleSearchChange(search) searchConsents()
// /!\ Do not change dependencies or effect will not trigger when pagination changes // /!\ Do not change dependencies or effect will not trigger when pagination changes
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, [rowsPerPage, page]) }, [rowsPerPage, page, search])
return ( return (
<> <>
...@@ -299,6 +300,9 @@ const Consents: React.FC = () => { ...@@ -299,6 +300,9 @@ const Consents: React.FC = () => {
rowMultiSelectWithClick={true} rowMultiSelectWithClick={true}
pagination={false} pagination={false}
suppressCellFocus={true} suppressCellFocus={true}
rowClassRules={{
expired: (params) => params.data.endDate < DateTime.now(),
}}
></AgGridReact> ></AgGridReact>
{!isShowingSelection && ( {!isShowingSelection && (
<TablePagination <TablePagination
......
...@@ -10,10 +10,14 @@ ...@@ -10,10 +10,14 @@
.ag-header-cell-text { .ag-header-cell-text {
color: $gold; color: $gold;
} }
.ag-row-odd, .ag-row {
.ag-row-even {
background: transparent !important; background: transparent !important;
transition: all 300ms ease !important; transition: all 300ms ease !important;
&.expired {
* {
color: $text-chart;
}
}
} }
.ag-cell-focus { .ag-cell-focus {
outline: none !important; outline: none !important;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment