@@ -11,12 +11,19 @@ const MANDATE_PRIORITY_THRESHOLD = 10;
11
11
12
12
export default function StructureCurrentGovernance ( ) {
13
13
const { id } = useUrl ( ) ;
14
- const { data, isLoading, error } = useFetch ( `/relations?filters[resourceId]=${ id } &filters[relationTag]=${ tag } &limit=500&sort=relationType.priority` ) ;
14
+ const { data, isLoading, error } = useFetch (
15
+ `/relations?filters[resourceId]=${ id } &filters[relationTag]=${ tag } &limit=500&sort=relationType.priority` ,
16
+ ) ;
15
17
16
18
if ( ! data ?. data ?. length > 0 ) return null ;
17
19
const currentMandates = data ?. data
18
- . filter ( ( mandate ) => ( ! mandate . endDate || ( mandate . endDate >= getComparableNow ( ) ) ) )
19
- . filter ( ( mandate ) => ( mandate ?. relationType ?. priority < MANDATE_PRIORITY_THRESHOLD ) ) ;
20
+ . filter (
21
+ ( mandate ) => mandate . active !== false
22
+ && ( ! mandate . endDate || mandate . endDate >= getComparableNow ( ) ) ,
23
+ )
24
+ . filter (
25
+ ( mandate ) => mandate ?. relationType ?. priority < MANDATE_PRIORITY_THRESHOLD ,
26
+ ) ;
20
27
21
28
return (
22
29
< Bloc
@@ -25,15 +32,17 @@ export default function StructureCurrentGovernance() {
25
32
data = { { totalCount : currentMandates ?. length || 0 } }
26
33
hideOnEmptyView
27
34
>
28
- < BlocTitle as = "h3" look = "h5" > Gouvernance actuelle</ BlocTitle >
35
+ < BlocTitle as = "h3" look = "h5" >
36
+ Gouvernance actuelle
37
+ </ BlocTitle >
29
38
< BlocContent >
30
39
< Row gutters >
31
40
{ currentMandates . map ( ( mandate ) => (
32
41
< Col key = { mandate . id } n = "12 md-6" >
33
42
< RelationCard relation = { mandate } />
34
43
</ Col >
35
44
) ) }
36
- { ( currentMandates . length < data . data . length ) && (
45
+ { currentMandates . length < data . data . length && (
37
46
< Col n = "12 md-6" >
38
47
< GoToCard
39
48
to = { `/structures/${ id } /gouvernance-et-referents` }
0 commit comments