board switching
This commit is contained in:
@@ -25,6 +25,18 @@ final class KanbanBoard extends Component
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
$requestedBoardId = request()->query('board_id');
|
||||
|
||||
if (is_numeric($requestedBoardId)) {
|
||||
$requestedBoardId = (int) $requestedBoardId;
|
||||
|
||||
if (KanbanBoardModel::query()->whereKey($requestedBoardId)->exists()) {
|
||||
$this->board_id = $requestedBoardId;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$this->board_id = KanbanBoardModel::query()
|
||||
->where('is_default', true)
|
||||
->orderBy('sort_order')
|
||||
@@ -139,6 +151,15 @@ final class KanbanBoard extends Component
|
||||
$this->refreshBoard();
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch the visible board without relying on DOM morph side effects.
|
||||
*/
|
||||
public function selectBoard(int|string|null $value): void
|
||||
{
|
||||
$this->board_id = is_numeric($value) ? (int) $value : null;
|
||||
$this->refreshBoard();
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the Kanban board.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user