Merge branch 'trunk'
This commit is contained in:
commit
cde565295a
2 changed files with 25 additions and 5 deletions
|
|
@ -70,7 +70,7 @@ class TicketController extends Controller
|
|||
});
|
||||
});
|
||||
}
|
||||
$tickets = $tickets->where('status', $request->status ? '=' : '<>', TicketStatus::archived());
|
||||
$tickets = $tickets->where('status', ($request->st==TicketStatus::archived()) ? '=' : '<>', TicketStatus::archived());
|
||||
if ($request->search) {
|
||||
$tickets = $this->searchTicket($tickets, $request);
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -12,10 +12,10 @@ $userPr = Auth::user()->sites ?? collect([]);
|
|||
<div class="col">
|
||||
<div class="btn-group float-end">
|
||||
<a href="{{ route('ticket.create') }}" class="btn btn-primary">{{ __('Créer un ticket') }}</a>
|
||||
@if(request()->status)
|
||||
<a href="{{ route('ticket.index') }}" class="btn btn-success">{{ __('Tickets en cours') }}</a>
|
||||
@if(session('tickets.st') == TicketStatus::archived())
|
||||
<a href="{{ route('ticket.index', ['sts' => -1 ]) }}" class="btn btn-success">{{ __('Tickets Actifs') }}</a>
|
||||
@else
|
||||
<a href="{{ route('ticket.index', ['status' => TicketStatus::archived()]) }}" class="float-end btn btn-secondary">{{ __('Tickets Archivés') }}</a>
|
||||
<a href="{{ route('ticket.index', ['st' => TicketStatus::archived()]) }}" class="float-end btn btn-secondary">{{ __('Tickets Archivés') }}</a>
|
||||
@endif
|
||||
<a href="{{ route('ticket.index', ['rst' => 1]) }}" class="btn btn-dark">{{ __('Réinitialiser le tri') }}</a>
|
||||
</div>
|
||||
|
|
@ -31,6 +31,14 @@ $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)
|
||||
<option value="{{ $statut->value }}" @if(intval(session('tickets.st')) == $statut->value)selected="selected" @endif>{{ $statut->label }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue