summaryrefslogtreecommitdiff
path: root/resources/views
diff options
context:
space:
mode:
authorSam Light <samlight1994@gmail.com>2025-03-30 14:20:57 +0100
committerSam Light <samlight1994@gmail.com>2025-03-30 14:20:57 +0100
commite744b8d67ef1d18050158dd523ba7d804c1c8528 (patch)
tree56c90a83912bd63bdd507e76e5ef00c82a904b50 /resources/views
parenta883170dd1c723bcd02916f9bc8a96ed85a61761 (diff)
Filters, sorting, escaping and more....
Diffstat (limited to 'resources/views')
-rw-r--r--resources/views/table.blade.php10
-rw-r--r--resources/views/toolbar/select-filter.blade.php23
2 files changed, 32 insertions, 1 deletions
diff --git a/resources/views/table.blade.php b/resources/views/table.blade.php
index bcefe57..448a290 100644
--- a/resources/views/table.blade.php
+++ b/resources/views/table.blade.php
@@ -9,7 +9,15 @@
<thead>
<tr>
@foreach($columns as $column)
- <th scope="col">{{ $column->getTitle() }}</th>
+ <th
+ scope="col"
+ @class(['sortable' => $column->isSortable()])
+ @if($column->isSortable())
+ wire:click="orderBy('{{ $column->name }}')"
+ @endif
+ >
+ {{ $column->getTitle() }}
+ </th>
@endforeach
</tr>
</thead>
diff --git a/resources/views/toolbar/select-filter.blade.php b/resources/views/toolbar/select-filter.blade.php
new file mode 100644
index 0000000..13cdbc1
--- /dev/null
+++ b/resources/views/toolbar/select-filter.blade.php
@@ -0,0 +1,23 @@
+<div class="filter d-flex align-items-center">
+ @if ($label)
+ <label for="{{ $id }}" class="mx-3">
+ {{ $label }}
+ </label>
+ @endif
+ <select
+ id="{{ $id }}"
+ class="form-control"
+ wire:model.live="filters.{{ $key }}"
+ >
+ @if (!empty($placeholder))
+ <option value="">
+ {{ $placeholder }}
+ </option>
+ @endif
+ @foreach ($options as $value => $option)
+ <option value="{{ $value }}">
+ {{ $option }}
+ </option>
+ @endforeach
+ </select>
+</div>