Merge branch 'develop' into trunk
This commit is contained in:
commit
9411dc30f8
2 changed files with 25 additions and 1 deletions
|
|
@ -78,13 +78,15 @@ class TicketController extends Controller
|
|||
$tickets = $tickets->paginate();
|
||||
|
||||
$sites = Site::select('id', 'name')->orderBy('name')->get();
|
||||
$status = TicketStatus::toArray();
|
||||
|
||||
return view('ticket.index', compact('tickets', 'sites'));
|
||||
return view('ticket.index', compact('tickets', 'sites', 'status'));
|
||||
}
|
||||
|
||||
private function filterTickets(Builder $tickets, Request $request): Builder
|
||||
{
|
||||
if ($request->rst) {
|
||||
Session::remove('tickets.st');
|
||||
Session::remove('tickets.pr');
|
||||
Session::remove('tickets.sort_col');
|
||||
Session::remove('tickets.sort_way');
|
||||
|
|
@ -92,6 +94,9 @@ class TicketController extends Controller
|
|||
if ($request->prs) {
|
||||
Session::remove('tickets.pr');
|
||||
}
|
||||
if ($request->sts) {
|
||||
Session::remove('tickets.st');
|
||||
}
|
||||
if ($request->sort_col) {
|
||||
Session::put('tickets.sort_col', $request->sort_col);
|
||||
}
|
||||
|
|
@ -101,12 +106,19 @@ class TicketController extends Controller
|
|||
if ($request->pr) {
|
||||
Session::put('tickets.pr', $request->pr);
|
||||
}
|
||||
if ($request->st) {
|
||||
Session::put('tickets.st', $request->st);
|
||||
}
|
||||
Session::save();
|
||||
|
||||
if (Session::has('tickets.pr')) {
|
||||
$tickets = $tickets->where('site_id', Session::get('tickets.pr'));
|
||||
}
|
||||
|
||||
if (Session::has('tickets.st')) {
|
||||
$tickets = $tickets->where('status', Session::get('tickets.st'));
|
||||
}
|
||||
|
||||
if (
|
||||
Session::has('tickets.sort_col') and
|
||||
Session::has('tickets.sort_way') and
|
||||
|
|
|
|||
|
|
@ -31,6 +31,18 @@ $userPr = Auth::user()->sites ?? collect([]);
|
|||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="float-end me-2">
|
||||
<select class="form-select" onchange="window.location='{{ route('ticket.index') }}?'+(this.value == -1 ? 'sts=-1' : 'st='+this.value);">
|
||||
<option value="-1">{{ __('Tous') }}</option>
|
||||
@foreach($status as $statut)
|
||||
@if (Auth::user()->isAdmin())
|
||||
<option value="{{ $statut->value }}" @if(intval(session('tickets.st')) == $statut->value)selected="selected" @endif>{{ $statut->label }}</option>
|
||||
@elseif ($userPr->filter(function($pr) use($site) { return $pr->id === $statut->value; })->count())
|
||||
<option value="{{ $statut->value }}" @if(intval(session('tickets.st')) == $statut->value)selected="selected" @endif>{{ $statut->label }}</option>
|
||||
@endif
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue