diff --git a/app/Enums/Tickets/TicketTypeEnum.php b/app/Enums/Tickets/TicketTypeEnum.php index 0e49b99..da89622 100644 --- a/app/Enums/Tickets/TicketTypeEnum.php +++ b/app/Enums/Tickets/TicketTypeEnum.php @@ -8,12 +8,12 @@ enum TicketTypeEnum: int { use BaseEnum; - case bug = 0; - case evolution = 1; - case br = 2; - case newsletter = 3; - case qrcode = 4; - case advice = 5; + case bug = 1; + case evolution = 2; + case br = 3; + case newsletter = 4; + case qrcode = 5; + case advice = 6; /** * Optionnal labels definition diff --git a/app/Http/Controllers/Bo/TicketController.php b/app/Http/Controllers/Bo/TicketController.php index 2584f3f..2e0fc1e 100644 --- a/app/Http/Controllers/Bo/TicketController.php +++ b/app/Http/Controllers/Bo/TicketController.php @@ -102,8 +102,9 @@ class TicketController extends Controller $sites = Site::select('id', 'name')->orderBy('name')->get(); $status = TicketStatusEnum::cases(); + $types = TicketTypeEnum::cases(); - return view('bo.pages.tickets.index', compact('tickets', 'sites', 'status')); + return view('bo.pages.tickets.index', compact('tickets', 'sites', 'status', 'types')); } /** @@ -500,6 +501,7 @@ class TicketController extends Controller Session::remove('tickets.ass'); Session::remove('tickets.st'); Session::remove('tickets.pr'); + Session::remove('tickets.ty'); Session::remove('tickets.sort_col'); Session::remove('tickets.sort_way'); Session::remove('tickets.search'); @@ -513,6 +515,9 @@ class TicketController extends Controller if ($request->sts) { Session::remove('tickets.st'); } + if ($request->tys) { + Session::remove('tickets.ty'); + } if ($request->sort_col) { Session::put('tickets.sort_col', $request->sort_col); } @@ -525,6 +530,9 @@ class TicketController extends Controller if ($request->st) { Session::put('tickets.st', $request->st); } + if ($request->ty) { + Session::put('tickets.ty', $request->ty); + } if ($request->ass) { Session::put('tickets.ass', $request->ass); } @@ -544,6 +552,11 @@ class TicketController extends Controller $tickets->where('status', Session::get('tickets.st')); } + if (Session::has('tickets.ty')) { + $tickets->where('type', Session::get('tickets.ty')); + } + + if ( Session::has('tickets.sort_col') and Session::has('tickets.sort_way') and diff --git a/database/migrations/2025_02_14_122301_rebase_tickets_type.php b/database/migrations/2025_02_14_122301_rebase_tickets_type.php new file mode 100644 index 0000000..6c8fcf1 --- /dev/null +++ b/database/migrations/2025_02_14_122301_rebase_tickets_type.php @@ -0,0 +1,42 @@ +get()->map(function (Ticket $model) { + $model->type = $model->getRawOriginal('type') + 1; + $model->saveQuietly(); + }); + TicketType::query()->orderBy('type', 'DESC')->get()->map(function (TicketType $model) { + $model->type = $model->getRawOriginal('type') + 1; + $model->saveQuietly(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down(): void + { + Ticket::query()->get()->map(function (Ticket $model) { + $model->type = $model->getRawOriginal('type') - 1; + $model->saveQuietly(); + }); + TicketType::query()->orderBy('type', 'DESC')->get()->map(function (TicketType $model) { + $model->type = $model->getRawOriginal('type') - 1; + $model->saveQuietly(); + }); + } +}; diff --git a/resources/ts/bo/utilities/fontawesome.ts b/resources/ts/bo/utilities/fontawesome.ts index ea24f8a..836339f 100644 --- a/resources/ts/bo/utilities/fontawesome.ts +++ b/resources/ts/bo/utilities/fontawesome.ts @@ -57,6 +57,7 @@ import { faSquarePlus, faSyncAlt, faTags, + faTicket, faTimes, faTrash, faUndoAlt, @@ -122,6 +123,7 @@ library.add(faBan); library.add(faCircleExclamation); library.add(faCircleInfo); library.add(faPaintRoller); +library.add(faTicket); // Front library.add(faChevronLeft); diff --git a/resources/views/bo/pages/tickets/index.blade.php b/resources/views/bo/pages/tickets/index.blade.php index 6642a15..85f73b3 100644 --- a/resources/views/bo/pages/tickets/index.blade.php +++ b/resources/views/bo/pages/tickets/index.blade.php @@ -30,7 +30,7 @@ @else - @endif @@ -115,7 +115,29 @@ @endcan
-
+
+ + + @push('scripts') + + @endpush +
+
+ +
+