Skip to content

Commit 742bdc8

Browse files
committed
Add Bootstrap Boolean Filter
1 parent 33f9f59 commit 742bdc8

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

resources/views/components/tools/filters/boolean.blade.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
@php
22
$defaultValue = ($filter->hasFilterDefaultValue() ? (bool) $filter->getFilterDefaultValue() : false)
33
@endphp
4+
@if($isTailwind)
45
<div class="flex flex-cols"
56
x-data="newBooleanFilter('{{ $filter->getKey() }}', '{{ $tableName }}', '{{ $defaultValue }}')"
67
>
@@ -27,3 +28,21 @@ class="flex-shrink-0 ml-1 h-6 w-6 rounded-full inline-flex items-center justify-
2728
</button>
2829
</template>
2930
</div>
31+
@else
32+
<div class="form-check form-switch"
33+
x-data="newBooleanFilter('{{ $filter->getKey() }}', '{{ $tableName }}', '{{ $defaultValue }}')"
34+
>
35+
<x-livewire-tables::tools.filter-label :$filter :$filterLayout :$tableName :$isTailwind :$isBootstrap4 :$isBootstrap5 :$isBootstrap />
36+
<input id="thisId" type="checkbox" name="switch" class="form-check-input" role="switch" :checked="value" @click="toggleStatusWithUpdate" x-ref="switchButton"/>
37+
<template x-if="(value == 1 || value == true)">
38+
<button @click="toggleStatusWithReset" type="button"
39+
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"
40+
>
41+
42+
<span class="sr-only">{{ __($localisationPath.'Remove filter option') }}</span>
43+
<x-heroicon-m-x-mark class="h-6 w-6" />
44+
</button>
45+
</template>
46+
47+
</div>
48+
@endif

0 commit comments

Comments
 (0)