202508141346

包廂 Grid 加入樓層加入全部
This commit is contained in:
allen.yan 2025-08-14 13:47:31 +08:00
parent 5e146b344e
commit 9ecabc9069
2 changed files with 3 additions and 2 deletions

View File

@ -33,6 +33,7 @@ class RoomGrid extends Component
if ($branch) { if ($branch) {
$rooms = Room::where('branch_id', $branch->id)->orderBy('name', 'asc')->get(); $rooms = Room::where('branch_id', $branch->id)->orderBy('name', 'asc')->get();
$floors = $rooms->pluck('floor')->unique()->sort()->values()->toArray(); $floors = $rooms->pluck('floor')->unique()->sort()->values()->toArray();
array_unshift($floors, 'all');
} }
return view('livewire.grids.room-grid', [ return view('livewire.grids.room-grid', [

View File

@ -8,7 +8,7 @@
:class="floor === '{{ $fl }}' ? 'bg-blue-500 text-white' : 'bg-white text-gray-700'" :class="floor === '{{ $fl }}' ? 'bg-blue-500 text-white' : 'bg-white text-gray-700'"
x-on:click="floor = '{{ $fl }}'" x-on:click="floor = '{{ $fl }}'"
> >
{{ $fl }}F {{ $fl === 'all' ? '全部' : $fl . '樓' }}
</button> </button>
@endforeach @endforeach
</div> </div>
@ -30,7 +30,7 @@
<div wire:poll.5s> <div wire:poll.5s>
<div class="grid grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-4"> <div class="grid grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-4">
@forelse($rooms as $room) @forelse($rooms as $room)
<div x-show="floor == '{{ $room->floor }}' && (type == 'all' || type == '{{ $room->type }}')" x-transition class="transition-all duration-300"> <div x-show="(floor == 'all' || floor == '{{ $room->floor }}') && (type == 'all' || type == '{{ $room->type }}')" x-transition class="transition-all duration-300">
@if($room->type->value === \App\Enums\RoomType::SVR->value) @if($room->type->value === \App\Enums\RoomType::SVR->value)
<x-room-card-svr :room="$room" /> <x-room-card-svr :room="$room" />
@else @else