fix: scope create form priorities to selected group; reset on group change
This commit is contained in:
@@ -245,7 +245,11 @@ class TicketController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
$priorities = PriorityLevel::orderBy('sort_order')->get();
|
||||
// Only pass global priorities + priorities scoped to accessible groups
|
||||
$groupIds = $groups->pluck('id')->toArray();
|
||||
$priorities = PriorityLevel::where(fn($q) => $q->whereNull('group_id')->orWhereIn('group_id', $groupIds))
|
||||
->orderBy('sort_order')
|
||||
->get();
|
||||
|
||||
return Inertia::render('Ticketing/Create', [
|
||||
'groups' => $groups,
|
||||
|
||||
Reference in New Issue
Block a user