|
1 | 1 | @php |
2 | 2 | $defaultValue = ($filter->hasFilterDefaultValue() ? (bool) $filter->getFilterDefaultValue() : false) |
3 | 3 | @endphp |
4 | | -<div class="flex flex-cols" |
5 | | - x-data="newBooleanFilter('{{ $filter->getKey() }}', '{{ $tableName }}', '{{ $defaultValue }}')" |
6 | | -> |
7 | | - <x-livewire-tables::tools.filter-label :$filter :$filterLayout :$tableName :$isTailwind :$isBootstrap4 :$isBootstrap5 :$isBootstrap /> |
8 | | - <input id="thisId" type="checkbox" name="switch" class="hidden" :checked="value" /> |
| 4 | +@if($isTailwind) |
| 5 | + <div class="flex flex-cols" x-data="newBooleanFilter('{{ $filter->getKey() }}', '{{ $tableName }}', '{{ $defaultValue }}')"> |
| 6 | + <x-livewire-tables::tools.filter-label :$filter :$filterLayout :$tableName :$isTailwind :$isBootstrap4 :$isBootstrap5 :$isBootstrap /> |
| 7 | + <input id="thisId" type="checkbox" name="switch" class="hidden" :checked="value" /> |
9 | 8 |
|
10 | | - <button x-cloak {{ $filterInputAttributes->merge([ |
11 | | - ":class" => "(value == 1 || value == true) ? '".$filterInputAttributes['activeColor']."' : '".$filterInputAttributes['inactiveColor']."'", |
12 | | - ]) |
13 | | - ->class([ |
14 | | - 'relative inline-flex h-6 py-0.5 ml-4 focus:outline-none rounded-full w-10' => ($filterInputAttributes['default-styling'] ?? true) |
15 | | - ]) |
16 | | - ->except(['default-styling','default-colors','activeColor','inactiveColor','blobColor']) |
17 | | - }}> |
18 | | - <span :class="(value == 1 || value == true) ? 'translate-x-[18px]' : 'translate-x-0.5'" class="w-5 h-5 duration-200 ease-in-out rounded-full shadow-md {{ $filterInputAttributes['blobColor'] }}"></span> |
19 | | - </button> |
20 | | - <template x-if="(value == 1 || value == true)"> |
21 | | - <button @click="toggleStatusWithReset" type="button" |
22 | | - class="flex-shrink-0 ml-1 h-6 w-6 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" |
23 | | - > |
24 | | - |
25 | | - <span class="sr-only">{{ __($localisationPath.'Remove filter option') }}</span> |
26 | | - <x-heroicon-m-x-mark class="h-6 w-6" /> |
| 9 | + <button x-cloak {{ $filterInputAttributes->merge([ |
| 10 | + ":class" => "(value == 1 || value == true) ? '".$filterInputAttributes['activeColor']."' : '".$filterInputAttributes['inactiveColor']."'", |
| 11 | + ]) |
| 12 | + ->class([ |
| 13 | + 'relative inline-flex h-6 py-0.5 ml-4 focus:outline-none rounded-full w-10' => ($filterInputAttributes['default-styling'] ?? true) |
| 14 | + ]) |
| 15 | + ->except(['default-styling','default-colors','activeColor','inactiveColor','blobColor']) |
| 16 | + }}> |
| 17 | + <span :class="(value == 1 || value == true) ? 'translate-x-[18px]' : 'translate-x-0.5'" class="w-5 h-5 duration-200 ease-in-out rounded-full shadow-md {{ $filterInputAttributes['blobColor'] }}"></span> |
27 | 18 | </button> |
28 | | - </template> |
29 | | -</div> |
| 19 | + <template x-if="(value == 1 || value == true)"> |
| 20 | + <button @click="toggleStatusWithReset" type="button" |
| 21 | + class="flex-shrink-0 ml-1 h-6 w-6 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" |
| 22 | + > |
| 23 | + |
| 24 | + <span class="sr-only">{{ __($localisationPath.'Remove filter option') }}</span> |
| 25 | + <x-heroicon-m-x-mark class="h-6 w-6" /> |
| 26 | + </button> |
| 27 | + </template> |
| 28 | + </div> |
| 29 | +@elseif($isBootstrap4) |
| 30 | + <div class="custom-control custom-switch" x-data="newBooleanFilter('{{ $filter->getKey() }}', '{{ $tableName }}', '{{ $defaultValue }}')"> |
| 31 | + <input type="checkbox" class="custom-control-input" id="customSwitch1" :checked="value" @click="toggleStatusWithUpdate" x-ref="switchButton"> |
| 32 | + <x-livewire-tables::tools.filter-label class="custom-control-label" for="customSwitch1" :$filter :$filterLayout :$tableName :$isTailwind :$isBootstrap4 :$isBootstrap5 :$isBootstrap /> |
| 33 | + </div> |
| 34 | +@else |
| 35 | + <div class="form-check form-switch" x-data="newBooleanFilter('{{ $filter->getKey() }}', '{{ $tableName }}', '{{ $defaultValue }}')"> |
| 36 | + <x-livewire-tables::tools.filter-label :$filter :$filterLayout :$tableName :$isTailwind :$isBootstrap4 :$isBootstrap5 :$isBootstrap /> |
| 37 | + <input id="thisId" type="checkbox" name="switch" class="form-check-input" role="switch" :checked="value" @click="toggleStatusWithUpdate" x-ref="switchButton"/> |
| 38 | + </div> |
| 39 | +@endif |
0 commit comments