organization->todos()->findOrFail($todoId); $todo->update([ 'is_done' => ! $todo->is_done, 'completed_at' => $todo->is_done ? null : now(), ]); } public function delete(int $todoId): void { $todo = $this->organization->todos()->findOrFail($todoId); $todo->delete(); session()->flash('status', "Tâche \"{$todo->title}\" supprimée."); } public function with(): array { return [ 'todos' => $this->organization->todos() ->with(['assignee', 'creator']) ->when($this->search, fn ($q) => $q->where('title', 'like', "%{$this->search}%")) ->when($this->category, fn ($q) => $q->where('category', $this->category)) ->when($this->status === 'open', fn ($q) => $q->where('is_done', false)) ->when($this->status === 'done', fn ($q) => $q->where('is_done', true)) ->orderBy('is_done') ->orderByRaw("CASE criticality WHEN 'urgent' THEN 0 WHEN 'high' THEN 1 WHEN 'medium' THEN 2 ELSE 3 END") ->orderByRaw('due_date IS NULL') ->orderBy('due_date') ->paginate(15), 'categories' => Todo::CATEGORIES, ]; } }; ?>

{{ $organization->name }}

ToDo

+ Nouvelle tâche
@forelse ($todos as $todo) @empty @endforelse
Titre Catégorie Criticité Échéance Assigné à
is_done) class="rounded border-slate-300"> {{ $todo->title }} {{ $todo->categoryLabel() }} {{ $todo->criticalityLabel() }} {{ $todo->due_date?->format('d/m/Y') ?? '—' }} @if ($todo->isOverdue()) (en retard) @endif {{ $todo->assignee?->name ?? '—' }} Modifier
Aucune tâche pour le moment.
{{ $todos->links() }}