- Added activity logs for ticket status changes, comments, and ticket views. - Implemented `TicketStatusChangedNotification` to notify users of status updates. - Enhanced ticket list filtering with pagination, search, and status filters. - Updated UI to better handle ticket assignments, status updates, and comment notifications. - Extended tests for activity logs, unauthorized actions, status change notifications, and filtering functionalities.
40 lines
1.1 KiB
PHP
40 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Data\Ui\Ticket;
|
|
|
|
use App\Enums\TicketStatusEnum;
|
|
use App\Models\Ticket;
|
|
use Spatie\LaravelData\Data;
|
|
|
|
final class TicketListData extends Data
|
|
{
|
|
public function __construct(
|
|
public int $id,
|
|
public string $ticketId,
|
|
public string $userName,
|
|
public ?string $appName,
|
|
public string $issueCategory,
|
|
public string $createdAt,
|
|
public TicketStatusEnum $status,
|
|
public string $statusSlug,
|
|
public ?int $assignedUserId = null,
|
|
) {}
|
|
|
|
public static function fromModel(Ticket $ticket): self
|
|
{
|
|
return new self(
|
|
id: $ticket->id,
|
|
ticketId: $ticket->ticket_id,
|
|
userName: $ticket->user->name,
|
|
appName: $ticket->connectedApp?->name,
|
|
issueCategory: $ticket->issue_category,
|
|
createdAt: $ticket->created_at->toDateTimeString(),
|
|
status: TicketStatusEnum::from($ticket->status->name),
|
|
statusSlug: $ticket->status->name,
|
|
assignedUserId: $ticket->assigned_user_id,
|
|
);
|
|
}
|
|
}
|