Skip to content

Commit 09b1d11

Browse files
committed
Add 'new' status support to tickets list page
- Use Ticket::ACTIVE_STATUSES for default selected statuses (includes 'new') - Replace hardcoded status arrays with Ticket::ALL_STATUSES constant - Replace hardcoded priority arrays with Ticket::ALL_PRIORITIES constant - Ensures newly created tickets appear in the default ticket list view
1 parent 6e50ea5 commit 09b1d11

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

app/Livewire/Tickets/TicketIndex.php

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
namespace App\Livewire\Tickets;
44

55
use App\Domains\Client\Models\Client;
6+
use App\Domains\Core\Models\User;
67
use App\Domains\Ticket\Models\Ticket;
78
use App\Livewire\BaseIndexComponent;
8-
use App\Domains\Core\Models\User;
99
use Illuminate\Support\Facades\Auth;
1010

1111
class TicketIndex extends BaseIndexComponent
@@ -46,7 +46,7 @@ public function mount()
4646
}
4747

4848
if (! $this->filter) {
49-
$this->selectedStatuses = $this->selectedStatuses ?: ['open', 'in_progress', 'waiting', 'on_hold'];
49+
$this->selectedStatuses = $this->selectedStatuses ?: Ticket::ACTIVE_STATUSES;
5050
$this->selectedPriorities = $this->selectedPriorities ?: [];
5151
$this->selectedAssignees = $this->selectedAssignees ?: [];
5252
$this->selectedClients = $this->selectedClients ?: [];
@@ -285,16 +285,11 @@ public function render()
285285
->orderBy('name')
286286
->get();
287287

288-
// All available statuses
289-
$statuses = ['open', 'in_progress', 'waiting', 'on_hold', 'resolved', 'closed', 'cancelled'];
288+
// All available statuses from model constants
289+
$statuses = Ticket::ALL_STATUSES;
290290

291291
// Use model constants for priorities
292-
$priorities = [
293-
Ticket::PRIORITY_LOW,
294-
Ticket::PRIORITY_MEDIUM,
295-
Ticket::PRIORITY_HIGH,
296-
Ticket::PRIORITY_CRITICAL,
297-
];
292+
$priorities = Ticket::ALL_PRIORITIES;
298293

299294
return view('livewire.tickets.ticket-index', [
300295
'tickets' => $tickets,
@@ -339,7 +334,7 @@ public function clearFilters()
339334
public function showAllTickets()
340335
{
341336
// Select all statuses to show all tickets
342-
$this->selectedStatuses = ['open', 'in_progress', 'waiting', 'on_hold', 'resolved', 'closed', 'cancelled'];
337+
$this->selectedStatuses = Ticket::ALL_STATUSES;
343338
$this->resetPage();
344339
}
345340
}

0 commit comments

Comments
 (0)