Unit {{ $unit->unit_no }} Rooms

Manage and organize rooms within this unit.

@can('owner-admin') Add New Room @endcan

Listing Rooms

{{-- 💡 使用領導的 Search Component --}}
@if($unit->rooms->count() > 0) {{-- 💡 使用領導的 Table TH Component,並精準綁定 sortField --}} @can('owner-admin') @endcan @foreach($unit->rooms as $room) @php $status = strtolower((string) $room->status); $badge = match ($status) { 'vacant','available' => 'bg-green-100 text-green-800', 'occupied' => 'bg-amber-100 text-amber-800', 'maintenance' => 'bg-blue-100 text-blue-800', default => 'bg-gray-100 text-gray-800', }; $assetNames = $room->assets->pluck('name')->filter()->unique()->values(); @endphp {{-- 💡 完美還原:操作按鈕與 SVG 圖標 --}} @can('owner-admin') @endcan @endforeach
{{ strtoupper(substr($room->room_no ?? 'R', 0, 1)) }}
{{ $room->room_no }}
{{ $room->room_type }} {{ ucfirst($room->status) }} {{ $room->unit->owner->name ?? '-' }} @if($assetNames->count())
@foreach($assetNames->take(3) as $n) {{ $n }} @endforeach @if($assetNames->count() > 3) +{{ $assetNames->count() - 3 }} more @endif
@else No assets @endif
{{ optional($room->created_at)->format('d M Y') }}
@if($status !== 'inactive' && $status !== 'removed') {{-- Active 狀態:顯示 Edit 和 Delete --}}
@csrf @method('DELETE')
@else {{-- Inactive/Removed 狀態:顯示 Restore --}}
@csrf @method('PATCH')
@endif
{{-- 分頁 --}}
{{ $unit->rooms->links() }}
@else

No rooms assigned to this unit

Add the first room to get started.

@endif