From 77005521c81300dbffca8a2d3c0f0ad5f8c5464a Mon Sep 17 00:00:00 2001 From: Olivier Legat Date: Wed, 13 Oct 2021 11:02:37 +0200 Subject: [PATCH 1/2] Filtrage tickets sur les statuts --- app/Http/Controllers/TicketController.php | 14 +++++++++++++- resources/views/ticket/index.blade.php | 12 ++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/TicketController.php b/app/Http/Controllers/TicketController.php index bb804f5..dde2737 100644 --- a/app/Http/Controllers/TicketController.php +++ b/app/Http/Controllers/TicketController.php @@ -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 diff --git a/resources/views/ticket/index.blade.php b/resources/views/ticket/index.blade.php index e71a3ac..e73d37f 100644 --- a/resources/views/ticket/index.blade.php +++ b/resources/views/ticket/index.blade.php @@ -31,6 +31,18 @@ $userPr = Auth::user()->sites ?? collect([]); @endforeach +
+ +
From 22626baf4699aadbcd25575c0973b69451921d0f Mon Sep 17 00:00:00 2001 From: Olivier Legat Date: Wed, 13 Oct 2021 11:20:42 +0200 Subject: [PATCH 2/2] =?UTF-8?q?Pr=C3=A9=20filtre=20Actifs/archiv=C3=A9s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/TicketController.php | 2 +- resources/views/ticket/index.blade.php | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/app/Http/Controllers/TicketController.php b/app/Http/Controllers/TicketController.php index dde2737..59e3631 100644 --- a/app/Http/Controllers/TicketController.php +++ b/app/Http/Controllers/TicketController.php @@ -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); } diff --git a/resources/views/ticket/index.blade.php b/resources/views/ticket/index.blade.php index e73d37f..4d861e8 100644 --- a/resources/views/ticket/index.blade.php +++ b/resources/views/ticket/index.blade.php @@ -12,10 +12,10 @@ $userPr = Auth::user()->sites ?? collect([]);
@@ -35,11 +35,7 @@ $userPr = Auth::user()->sites ?? collect([]);