- Added migration for ticket assignment and comments (`assigned_user_id` and `ticket_replies` table). - Implemented `TicketAssignedNotification` and `TicketCommentedNotification`. - Created `ReplyData`, `TicketListData`, and `PostReplyRequest` data classes. - Introduced `ResolveNotificationRouteController` for modular notification redirection. - Updated UI to support assigning users and posting comments on tickets. - User is navigated to comments page when clicked on the ticket, upon navigation ticket details modal is opened. - Extended tests to cover assignments, comments, status transitions, and notifications.
38 lines
1009 B
PHP
38 lines
1009 B
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 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,
|
|
);
|
|
}
|
|
}
|