Skip to content

Commit e7fa24e

Browse files
committed
Bug-fix: Ticket number button
1 parent 6a05160 commit e7fa24e

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

app/Http/Livewire/TicketDetails.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,12 @@ public function ticketSaved(): void
5252
/**
5353
* Copy a ticket url
5454
*
55-
* @param Ticket $ticket
55+
* @param int $ticketId
5656
* @return void
5757
*/
58-
public function copyTicketUrl(Ticket $ticket): void {
58+
public function copyTicketUrl(int $ticketId): void
59+
{
60+
$ticket = Ticket::where('id', $ticketId)->first();
5961
Notification::make()
6062
->success()
6163
->title(__('Ticket url copied'))

app/Http/Livewire/Tickets.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,15 @@
22

33
namespace App\Http\Livewire;
44

5-
use App\Models\FavoriteProject;
65
use App\Models\Project;
76
use App\Models\Ticket;
87
use App\Models\User;
98
use Filament\Forms\Components\Grid;
109
use Filament\Forms\Components\MultiSelect;
11-
use Filament\Forms\Components\Select;
1210
use Filament\Forms\Components\TextInput;
1311
use Filament\Forms\Concerns\InteractsWithForms;
1412
use Filament\Forms\Contracts\HasForms;
15-
use Filament\Notifications\Actions\Action;
1613
use Filament\Notifications\Notification;
17-
use Illuminate\Support\Str;
1814
use Livewire\Component;
1915

2016
class Tickets extends Component implements HasForms
@@ -237,10 +233,12 @@ public function ticketDeleted()
237233
/**
238234
* Copy a ticket url
239235
*
240-
* @param Ticket $ticket
236+
* @param int $ticketId
241237
* @return void
242238
*/
243-
public function copyTicketUrl(Ticket $ticket): void {
239+
public function copyTicketUrl(int $ticketId): void
240+
{
241+
$ticket = Ticket::where('id', $ticketId)->first();
244242
Notification::make()
245243
->success()
246244
->title(__('Ticket url copied'))

resources/views/livewire/ticket-details.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<i class="fa fa-tag"></i>
1111
{{ $ticket->project->name }}
1212
<span class="text-xs text-gray-300">/</span>
13-
<button type="button" class="font-normal hover:cursor-pointer hover:underline" wire:click="copyTicketUrl({{ $ticket }})" title="@lang('Click to copy url to ticket')">{{ $ticket->ticket_number }}</button>
13+
<button type="button" class="font-normal hover:cursor-pointer hover:underline" wire:click="copyTicketUrl('{{ $ticket->id }}')" title="@lang('Click to copy url to ticket')">{{ $ticket->ticket_number }}</button>
1414
</span>
1515
<div class="w-full">
1616
@livewire('ticket-details.title', ['ticket' => $ticket])

resources/views/livewire/tickets.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
<i class="fa fa-tag"></i>
7070
{{ $ticket->project->name }}
7171
<span class="text-xs text-gray-300">/</span>
72-
<button type="button" class="font-normal hover:cursor-pointer hover:underline" wire:click="copyTicketUrl({{ $ticket }})" title="@lang('Click to copy url to ticket')">{{ $ticket->ticket_number }}</button>
72+
<button type="button" class="font-normal hover:cursor-pointer hover:underline" wire:click="copyTicketUrl('{{ $ticket->id }}')" title="@lang('Click to copy url to ticket')">{{ $ticket->ticket_number }}</button>
7373
</span>
7474
<div class="w-full flex flex-row justify-between items-start gap-5">
7575
<a href="{{ route('tickets.details', ['ticket' => $ticket, 'slug' => Str::slug($ticket->title)]) }}" class="text-lg font-medium text-gray-700 hover:underline">

0 commit comments

Comments
 (0)