File tree Expand file tree Collapse file tree 4 files changed +46
-0
lines changed Expand file tree Collapse file tree 4 files changed +46
-0
lines changed Original file line number Diff line number Diff line change
1
+ <div class =" form-check" >
2
+ <input
3
+ class =" form-check-input"
4
+ onclick =" event.stopPropagation();"
5
+ type =" checkbox"
6
+ id =" filter-{{ $key } } -select-all"
7
+ wire:input =" selectAllFilters('{{ $key } } ')"
8
+ {{ count ($filters [$key ]) === count ($filter -> options ()) ? ' checked' : ' ' } }
9
+ >
10
+ <label class =" form-check-label" for =" filter-{{ $key } } -select-all" >@lang (' All' )</label >
11
+ </div >
1
12
@foreach ($filter -> options () as $optionKey => $value )
2
13
<div class =" form-check" wire:key =" filter-{{ $key } } -multiselect-{{ $optionKey } }" >
3
14
<input
Original file line number Diff line number Diff line change
1
+ <div class =" form-check" >
2
+ <input
3
+ onclick =" event.stopPropagation();"
4
+ type =" checkbox"
5
+ id =" filter-{{ $key } } -select-all"
6
+ wire:input =" selectAllFilters('{{ $key } } ')"
7
+ {{ count ($filters [$key ]) === count ($filter -> options ()) ? ' checked' : ' ' } }
8
+ >
9
+ <label class =" form-check-label" for =" filter-{{ $key } } -select-all" >@lang (' All' )</label >
10
+ </div >
1
11
@foreach ($filter -> options () as $optionKey => $value )
2
12
<div class =" form-check" wire:key =" filter-{{ $key } } -multiselect-{{ $optionKey } }" >
3
13
<input
Original file line number Diff line number Diff line change 1
1
<div class =" mt-1 relative rounded-md" >
2
+ <div >
3
+ <input
4
+ type =" checkbox"
5
+ id =" filter-{{ $key } } -select-all"
6
+ wire:input =" selectAllFilters('{{ $key } } ')"
7
+ {{ count ($filters [$key ]) === count ($filter -> options ()) ? ' checked' : ' ' } }
8
+ >
9
+ <label for =" filter-{{ $key } } -select-all" >@lang (' All' )</label >
10
+ </div >
2
11
@foreach ($filter -> options () as $optionKey => $value )
3
12
<div wire:key =" filter-{{ $key } } -multiselect-{{ $optionKey } }" >
4
13
<input
Original file line number Diff line number Diff line change @@ -196,6 +196,22 @@ public function cleanFilters(): void
196
196
})->toArray ();
197
197
}
198
198
199
+ public function selectAllFilters ($ filterKey ): void
200
+ {
201
+ $ filter = $ this ->filters ()[$ filterKey ];
202
+
203
+ if (! $ filter ->isMultiSelect ()) {
204
+ return ;
205
+ }
206
+
207
+ if (count ($ this ->filters [$ filterKey ]) === count ($ filter ->options ())) {
208
+ $ this ->removeFilter ($ filterKey );
209
+ return ;
210
+ }
211
+
212
+ $ this ->filters [$ filterKey ] = array_keys ($ filter ->options ());
213
+ }
214
+
199
215
/**
200
216
* Define the string location to a view to be included as the filters view
201
217
*
You can’t perform that action at this time.
0 commit comments