diff --git a/Modules/Helpdesk/Livewire/TicketIndex.php b/Modules/Helpdesk/Livewire/TicketIndex.php index b297ec8c..27298b10 100644 --- a/Modules/Helpdesk/Livewire/TicketIndex.php +++ b/Modules/Helpdesk/Livewire/TicketIndex.php @@ -21,11 +21,13 @@ final class TicketIndex extends Component use AuthorizesRequests; use WithPagination; - public bool $confirmingTicketDeletion = false; + public bool $deleteModalOpen = false; - public ?int $ticketDeletionId = null; + public ?int $pendingDeleteTicketId = null; - public ?string $ticketDeletionReference = null; + public ?string $pendingDeleteTicketReference = null; + + public ?string $pendingDeleteTicketSubject = null; #[Url] public string $search = ''; @@ -47,18 +49,19 @@ final class TicketIndex extends Component /** * Open the delete confirmation modal for a visible ticket. */ - public function confirmDeleteTicket(int $ticketId): void + public function askToDeleteTicket(int $ticketId): void { $ticket = Ticket::query() ->visibleTo(Auth::user()) ->findOrFail($ticketId); - $this->ticketDeletionId = $ticket->id; - $this->ticketDeletionReference = $ticket->reference; - $this->confirmingTicketDeletion = true; + $this->pendingDeleteTicketId = $ticket->id; + $this->pendingDeleteTicketReference = $ticket->reference; + $this->pendingDeleteTicketSubject = $ticket->subject; + $this->deleteModalOpen = true; } - public function cancelDeleteTicket(): void + public function cancelTicketDelete(): void { $this->resetTicketDeletionState(); } @@ -66,9 +69,9 @@ final class TicketIndex extends Component /** * Delete the confirmed ticket. */ - public function deleteConfirmedTicket(): void + public function confirmTicketDelete(): void { - if ($this->ticketDeletionId === null) { + if ($this->pendingDeleteTicketId === null) { $this->resetTicketDeletionState(); return; @@ -76,7 +79,7 @@ final class TicketIndex extends Component $ticket = Ticket::query() ->visibleTo(Auth::user()) - ->findOrFail($this->ticketDeletionId); + ->findOrFail($this->pendingDeleteTicketId); $this->authorize('delete', $ticket); @@ -106,9 +109,10 @@ final class TicketIndex extends Component private function resetTicketDeletionState(): void { - $this->confirmingTicketDeletion = false; - $this->ticketDeletionId = null; - $this->ticketDeletionReference = null; + $this->deleteModalOpen = false; + $this->pendingDeleteTicketId = null; + $this->pendingDeleteTicketReference = null; + $this->pendingDeleteTicketSubject = null; } /** diff --git a/Modules/Helpdesk/Resources/views/livewire/ticket-index.blade.php b/Modules/Helpdesk/Resources/views/livewire/ticket-index.blade.php index 6b8e3043..39379e86 100644 --- a/Modules/Helpdesk/Resources/views/livewire/ticket-index.blade.php +++ b/Modules/Helpdesk/Resources/views/livewire/ticket-index.blade.php @@ -1,4 +1,4 @@ - +
- This will delete {{ $ticketDeletionReference }}. This action cannot be undone. + This will delete {{ $pendingDeleteTicketReference }}. This action cannot be undone.
Ticket subject
+{{ $pendingDeleteTicketSubject }}
+- Confirm only if this ticket was created in error or is no longer required. Related ticket data may also be removed depending on the model relationships. + Confirm only if this ticket was created in error or is no longer required.