Remember for each user which Kanban cards have their task list open
The open cards are kept in the user's board preferences (expanded_cards, at most 500), saved without redrawing the board and restored on return. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -36,6 +36,7 @@ use App\Modules\Users\Domain\Enums\Role;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Livewire\Attributes\Computed;
|
||||
use Livewire\Attributes\On;
|
||||
use Livewire\Attributes\Renderless;
|
||||
use Livewire\Attributes\Url;
|
||||
use Livewire\Component;
|
||||
|
||||
@@ -391,6 +392,20 @@ new class extends Component
|
||||
$this->statusMessage = __('jobs.board.customer_color_saved', ['customer' => $card->customerName ?? '']);
|
||||
}
|
||||
|
||||
/**
|
||||
* A card's task list opened or closed: remembered for this user only.
|
||||
* Renderless, so opening a card does not redraw the board.
|
||||
*/
|
||||
#[Renderless]
|
||||
public function setCardExpanded(string $key, bool $expanded): void
|
||||
{
|
||||
if ($this->findCard($key) === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->savePreferences($this->preferences->withCardExpanded($key, $expanded));
|
||||
}
|
||||
|
||||
public function setColumnColor(string $columnValue, ?string $color): void
|
||||
{
|
||||
$column = BoardColumn::tryFrom($columnValue);
|
||||
@@ -772,6 +787,7 @@ new class extends Component
|
||||
@elseif ($card->isOngoing())
|
||||
<x-jobs.board.ongoing-card
|
||||
:card="$card"
|
||||
:expanded="$this->preferences->isCardExpanded($card->key())"
|
||||
:compact="$compact"
|
||||
:can-move="$canMove"
|
||||
:can-color="$canColor"
|
||||
@@ -781,6 +797,7 @@ new class extends Component
|
||||
@else
|
||||
<x-jobs.board.job-card
|
||||
:card="$card"
|
||||
:expanded="$this->preferences->isCardExpanded($card->key())"
|
||||
:compact="$compact"
|
||||
:can-move="$canMove"
|
||||
:can-color="$canColor"
|
||||
|
||||
Reference in New Issue
Block a user