|
15 | 15 |
|
16 | 16 | @foreach($this->getAppliedFiltersWithValues() as $filterSelectName => $value) |
17 | 17 | @php($filter = $this->getFilterByKey($filterSelectName)) |
18 | | - |
19 | | - @continue(is_null($filter)) |
20 | | - @continue($filter->isHiddenFromPills()) |
| 18 | + @continue(is_null($filter) || $filter->isHiddenFromPills()) |
| 19 | + @php( $filterPillTitle = $filter->getFilterPillTitle()) |
| 20 | + @php( $filterPillValue = $filter->getFilterPillValue($value)) |
| 21 | + @php( $separator = method_exists($filter, 'getPillsSeparator') ? $filter->getPillsSeparator() : ', ') |
| 22 | + @continue((is_array($filterPillValue) && empty($filterPillValue))) |
21 | 23 |
|
22 | 24 | @if ($filter->hasCustomPillBlade()) |
23 | 25 | @include($filter->getCustomPillBlade(), ['filter' => $filter]) |
24 | 26 | @else |
25 | | - <span |
26 | | - wire:key="{{ $tableName }}-filter-pill-{{ $filter->getKey() }}" |
27 | | - @class([ |
28 | | - 'inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium leading-4 bg-indigo-100 text-indigo-800 capitalize dark:bg-indigo-200 dark:text-indigo-900' => $isTailwind, |
29 | | - 'badge badge-pill badge-info d-inline-flex align-items-center' => $isBootstrap4, |
30 | | - 'badge rounded-pill bg-info d-inline-flex align-items-center' => $isBootstrap5, |
31 | | - ]) |
32 | | - > |
33 | | - {{ $filter->getFilterPillTitle() }}: |
34 | | - @php( $filterPillValue = $filter->getFilterPillValue($value)) |
35 | | - @php( $separator = method_exists($filter, 'getPillsSeparator') ? $filter->getPillsSeparator() : ', ') |
36 | | - |
37 | | - @if(is_array($filterPillValue) && !empty($filterPillValue)) |
38 | | - @foreach($filterPillValue as $filterPillArrayValue) |
39 | | - {{ $filterPillArrayValue }}{!! $separator !!} |
40 | | - @endforeach |
41 | | - @else |
42 | | - {{ $filterPillValue }} |
43 | | - @endif |
44 | | - |
45 | | - @if ($isTailwind) |
46 | | - <button |
47 | | - wire:click="resetFilter('{{ $filter->getKey() }}')" |
48 | | - type="button" |
49 | | - class="flex-shrink-0 ml-0.5 h-4 w-4 rounded-full inline-flex items-center justify-center text-indigo-400 hover:bg-indigo-200 hover:text-indigo-500 focus:outline-none focus:bg-indigo-500 focus:text-white" |
50 | | - > |
51 | | - <span class="sr-only">@lang('livewire-tables::Remove filter option')</span> |
52 | | - <x-heroicon-m-x-mark class="h-full" /> |
53 | | - </button> |
54 | | - @else |
55 | | - <a |
56 | | - href="#" |
57 | | - wire:click="resetFilter('{{ $filter->getKey() }}')" |
58 | | - @class([ |
59 | | - 'text-white ml-2' => ($isBootstrap), |
60 | | - ]) |
61 | | - > |
62 | | - <span @class([ |
63 | | - 'sr-only' => $isBootstrap4, |
64 | | - 'visually-hidden' => $isBootstrap5, |
65 | | - ])> |
66 | | - @lang('livewire-tables::Remove filter option') |
67 | | - </span> |
68 | | - <x-heroicon-m-x-mark class="laravel-livewire-tables-btn-tiny" /> |
69 | | - </a> |
70 | | - @endif |
71 | | - </span> |
| 27 | + <x-livewire-tables::tools.filter-pills.item :$filterPillTitle :$filterPillValue :$filterSelectName :$separator/> |
72 | 28 | @endif |
73 | 29 | @endforeach |
74 | | - |
75 | | - @if ($isTailwind) |
76 | | - <button |
77 | | - wire:click.prevent="setFilterDefaults" |
78 | | - class="focus:outline-none active:outline-none" |
79 | | - > |
80 | | - <span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-800 dark:bg-gray-200 dark:text-gray-900"> |
81 | | - @lang('livewire-tables::Clear') |
82 | | - </span> |
83 | | - </button> |
84 | | - @else |
85 | | - <a |
86 | | - href="#" |
87 | | - wire:click.prevent="setFilterDefaults" |
88 | | - @class([ |
89 | | - 'badge badge-pill badge-light' => $isBootstrap4, |
90 | | - 'badge rounded-pill bg-light text-dark text-decoration-none' => $isBootstrap5, |
91 | | - ]) |
92 | | - > |
93 | | - @lang('livewire-tables::Clear') |
94 | | - </a> |
95 | | - @endif |
| 30 | + <x-livewire-tables::tools.filter-pills.buttons.reset-all /> |
96 | 31 | </div> |
97 | 32 | </div> |
98 | 33 | @endif |
|
0 commit comments