Refactor: simplify ticket role checks and remove redundant debug calls

This commit is contained in:
= 2026-06-22 08:43:23 +00:00
parent 1ef7957a05
commit 83e56e35e0

View File

@ -112,7 +112,6 @@ public function mount(): void
if ($this->ticketParam && (int) $this->ticketParam > 0) {
$this->showTicket((int) $this->ticketParam);
}
ds($this->appId);
}
/**
@ -141,17 +140,12 @@ public function rendering(): void
public function tickets(): PaginatedDataCollection
{
$user = auth()->user();
if (!$user) {
return TicketListData::collect(collect(), PaginatedDataCollection::class);
}
$search = trim($this->search);
$search = empty($search) ? null : $search;
if ($user->hasRole('Admin') || $user->hasRole('admin') || $user->can(TicketPermissionEnum::Read->value)) {
if ($user->hasRole(DefaultUserRole::Admin) || $user->can(TicketPermissionEnum::Read->value)) {
return $this->ticketService->getList($search, $this->statusFilter, 10);
}
return $this->ticketService->getListForUser($user->id, $search, $this->statusFilter, 10);
}
@ -523,7 +517,7 @@ public function toggleDrawer(): void
?>
<div class="space-y-6">
@if(!auth()->user()->hasRole('Admin') && !auth()->user()->hasRole('admin') && $this->eligibleApps->isEmpty())
@if(!auth()->user()->hasRole(DefaultUserRole::Admin) && $this->eligibleApps->isEmpty())
<x-mary-alert icon="lucide.alert-triangle" class="alert-warning text-xs shadow-sm rounded-xl" dismissible>
You do not currently have any active services expiring within 3 days. You can still submit a general
inquiry ticket without choosing a service.
@ -681,8 +675,6 @@ class="w-11/12 md:w-5/12 p-6 bg-white"
searchable
option-value="id"
/>
@ds($appsSearchable)
<!-- Issue Category -->
<x-mary-select
wire:model.live="form.issueCategory"