Refactor: simplify ticket role checks and remove redundant debug calls
This commit is contained in:
parent
1ef7957a05
commit
83e56e35e0
@ -112,7 +112,6 @@ public function mount(): void
|
|||||||
if ($this->ticketParam && (int) $this->ticketParam > 0) {
|
if ($this->ticketParam && (int) $this->ticketParam > 0) {
|
||||||
$this->showTicket((int) $this->ticketParam);
|
$this->showTicket((int) $this->ticketParam);
|
||||||
}
|
}
|
||||||
ds($this->appId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -141,17 +140,12 @@ public function rendering(): void
|
|||||||
public function tickets(): PaginatedDataCollection
|
public function tickets(): PaginatedDataCollection
|
||||||
{
|
{
|
||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
if (!$user) {
|
|
||||||
return TicketListData::collect(collect(), PaginatedDataCollection::class);
|
|
||||||
}
|
|
||||||
|
|
||||||
$search = trim($this->search);
|
$search = trim($this->search);
|
||||||
$search = empty($search) ? null : $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->getList($search, $this->statusFilter, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->ticketService->getListForUser($user->id, $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">
|
<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>
|
<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
|
You do not currently have any active services expiring within 3 days. You can still submit a general
|
||||||
inquiry ticket without choosing a service.
|
inquiry ticket without choosing a service.
|
||||||
@ -681,8 +675,6 @@ class="w-11/12 md:w-5/12 p-6 bg-white"
|
|||||||
searchable
|
searchable
|
||||||
option-value="id"
|
option-value="id"
|
||||||
/>
|
/>
|
||||||
@ds($appsSearchable)
|
|
||||||
|
|
||||||
<!-- Issue Category -->
|
<!-- Issue Category -->
|
||||||
<x-mary-select
|
<x-mary-select
|
||||||
wire:model.live="form.issueCategory"
|
wire:model.live="form.issueCategory"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user