202508030942

調整檔案位置
RoomGrid 加入 all
This commit is contained in:
allen.yan 2025-08-03 10:22:07 +08:00
parent cb530f94b8
commit 5d8c436f86
29 changed files with 23 additions and 20 deletions

View File

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

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Livewire\Forms\ImportDatas; namespace App\Livewire\ImportDatas;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
@ -108,7 +108,7 @@ class Artist extends Component
public function render() public function render()
{ {
return view('livewire.forms.import-datas.artist'); return view('livewire.import-datas.artist');
} }
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Livewire\Forms\ImportDatas; namespace App\Livewire\ImportDatas;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
@ -108,7 +108,7 @@ class Branch extends Component
public function render() public function render()
{ {
return view('livewire.forms.import-datas.branch'); return view('livewire.import-datas.branch');
} }
} }

View File

@ -1,6 +1,6 @@
<?php <?php
namespace App\Livewire\Forms\ImportDatas; namespace App\Livewire\ImportDatas;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
@ -108,7 +108,7 @@ class Song extends Component
public function render() public function render()
{ {
return view('livewire.forms.import-datas.song'); return view('livewire.import-datas.song');
} }
} }

View File

@ -44,7 +44,7 @@ final class ActivityLogTable extends PowerGridComponent
->showToggleColumns(); ->showToggleColumns();
//->showSoftDeletes() //->showSoftDeletes()
//->showSearchInput() //->showSearchInput()
$header->includeViewOnTop('livewire.forms.headers.activity-log'); $header->includeViewOnTop('livewire.headers.activity-log');
$actions[]=$header; $actions[]=$header;
$actions[]=PowerGrid::footer()->showPerPage()->showRecordCount(); $actions[]=PowerGrid::footer()->showPerPage()->showRecordCount();
return $actions; return $actions;

View File

@ -63,7 +63,7 @@ final class ArtistTable extends PowerGridComponent
//->showSoftDeletes() //->showSoftDeletes()
//->showSearchInput() //->showSearchInput()
if($this->canCreate){ if($this->canCreate){
$header->includeViewOnTop('livewire.forms.headers.artist') ; $header->includeViewOnTop('livewire.headers.artist') ;
} }
$actions[]=$header; $actions[]=$header;
$actions[]=PowerGrid::footer()->showPerPage()->showRecordCount(); $actions[]=PowerGrid::footer()->showPerPage()->showRecordCount();

View File

@ -61,7 +61,7 @@ final class BranchTable extends PowerGridComponent
//->showSoftDeletes() //->showSoftDeletes()
//->showSearchInput() //->showSearchInput()
if($this->canCreate){ if($this->canCreate){
$header->includeViewOnTop('livewire.forms.headers.branch') ; $header->includeViewOnTop('livewire.headers.branch') ;
} }
$actions[]=$header; $actions[]=$header;
$actions[]=PowerGrid::footer()->showPerPage()->showRecordCount(); $actions[]=PowerGrid::footer()->showPerPage()->showRecordCount();

View File

@ -42,7 +42,7 @@ final class RoleTable extends PowerGridComponent
$actions = []; $actions = [];
$header =PowerGrid::header(); $header =PowerGrid::header();
if($this->canCreate){ if($this->canCreate){
$header->includeViewOnTop('livewire.forms.headers.role'); $header->includeViewOnTop('livewire.headers.role');
} }
$actions[]=$header; $actions[]=$header;
$actions[]=PowerGrid::footer() $actions[]=PowerGrid::footer()

View File

@ -28,7 +28,7 @@ final class RoomStatusLogTable extends PowerGridComponent
$header = PowerGrid::header() $header = PowerGrid::header()
->withoutLoading() ->withoutLoading()
->showToggleColumns(); ->showToggleColumns();
$header->includeViewOnTop('livewire.forms.headers.room-status-log'); $header->includeViewOnTop('livewire.headers.room-status-log');
$actions[]=$header; $actions[]=$header;
$actions[]=PowerGrid::footer()->showPerPage()->showRecordCount(); $actions[]=PowerGrid::footer()->showPerPage()->showRecordCount();

View File

@ -18,6 +18,7 @@ use PowerComponents\LivewirePowerGrid\PowerGridComponent;
use PowerComponents\LivewirePowerGrid\Traits\WithExport; use PowerComponents\LivewirePowerGrid\Traits\WithExport;
use PowerComponents\LivewirePowerGrid\Components\SetUp\Exportable; use PowerComponents\LivewirePowerGrid\Components\SetUp\Exportable;
use Livewire\Attributes\On; use Livewire\Attributes\On;
use Livewire\Attributes\Url;
use WireUi\Traits\WireUiActions; use WireUi\Traits\WireUiActions;
final class RoomTable extends PowerGridComponent final class RoomTable extends PowerGridComponent
@ -26,6 +27,7 @@ final class RoomTable extends PowerGridComponent
public string $tableName = 'room-table'; public string $tableName = 'room-table';
public bool $canDownload; public bool $canDownload;
public bool $canDelect; public bool $canDelect;
#[Url]
public ?int $selectedBranchId = null; public ?int $selectedBranchId = null;
public ?string $external_ip= ""; public ?string $external_ip= "";
@ -54,7 +56,7 @@ final class RoomTable extends PowerGridComponent
$header = PowerGrid::header() $header = PowerGrid::header()
->withoutLoading() ->withoutLoading()
->showToggleColumns(); ->showToggleColumns();
$header->includeViewOnTop('livewire.forms.headers.room'); $header->includeViewOnTop('livewire.headers.room');
$actions[]=$header; $actions[]=$header;
$actions[]=PowerGrid::footer()->showPerPage()->showRecordCount(); $actions[]=PowerGrid::footer()->showPerPage()->showRecordCount();
return $actions; return $actions;

View File

@ -59,7 +59,7 @@ final class SongTable extends PowerGridComponent
} }
$header = PowerGrid::header()->showSoftDeletes()->showToggleColumns(); $header = PowerGrid::header()->showSoftDeletes()->showToggleColumns();
if($this->canCreate){ if($this->canCreate){
$header->includeViewOnTop('livewire.forms.headers.song'); $header->includeViewOnTop('livewire.headers.song');
} }
$actions[]=$header; $actions[]=$header;
$actions[]=PowerGrid::footer()->showPerPage()->showRecordCount(); $actions[]=PowerGrid::footer()->showPerPage()->showRecordCount();

View File

@ -53,7 +53,7 @@ final class TextAdsTable extends PowerGridComponent
} }
$header = PowerGrid::header()->showSoftDeletes()->showToggleColumns(); $header = PowerGrid::header()->showSoftDeletes()->showToggleColumns();
if($this->canCreate){ if($this->canCreate){
$header->includeViewOnTop('livewire.forms.headers.text-ad'); $header->includeViewOnTop('livewire.headers.text-ad');
} }
$actions[]=$header; $actions[]=$header;
$actions[]=PowerGrid::footer()->showPerPage()->showRecordCount(); $actions[]=PowerGrid::footer()->showPerPage()->showRecordCount();

View File

@ -55,7 +55,7 @@ final class UserTable extends PowerGridComponent
$header = PowerGrid::header() $header = PowerGrid::header()
->showToggleColumns(); ->showToggleColumns();
if($this->canCreate){ if($this->canCreate){
$header->includeViewOnTop('livewire.forms.headers.user'); $header->includeViewOnTop('livewire.headers.user');
} }
$actions[]=$header; $actions[]=$header;
$actions[]=PowerGrid::footer()->showPerPage()->showRecordCount(); $actions[]=PowerGrid::footer()->showPerPage()->showRecordCount();

View File

@ -3,5 +3,5 @@
<x-wireui:notifications/> <x-wireui:notifications/>
<livewire:tables.artist-table /> <livewire:tables.artist-table />
<livewire:forms.artist-form /> <livewire:forms.artist-form />
<livewire:forms.import-datas.artist /> <livewire:import-datas.artist />
</x-layouts.admin> </x-layouts.admin>

View File

@ -3,5 +3,5 @@
<x-wireui:notifications/> <x-wireui:notifications/>
<livewire:tables.branch-table /> <livewire:tables.branch-table />
<livewire:forms.branch-form /> <livewire:forms.branch-form />
<livewire:forms.import-datas.branch /> <livewire:import-datas.branch />
</x-layouts.admin> </x-layouts.admin>

View File

@ -3,5 +3,5 @@
<x-wireui:notifications/> <x-wireui:notifications/>
<livewire:tables.song-table /> <livewire:tables.song-table />
<livewire:forms.song-form /> <livewire:forms.song-form />
<livewire:forms.import-datas.song /> <livewire:import-datas.song />
</x-layouts.admin> </x-layouts.admin>

View File

@ -22,7 +22,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>
@ -44,7 +44,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