diff --git a/app/Http/Controllers/Moderation/TicketsController.php b/app/Http/Controllers/Moderation/TicketsController.php index be974ad2..a020098e 100644 --- a/app/Http/Controllers/Moderation/TicketsController.php +++ b/app/Http/Controllers/Moderation/TicketsController.php @@ -33,9 +33,14 @@ class TicketsController extends Controller return view('moderator.ticket.show', compact('ticket', 'ticketcategory', 'ticketcomments', 'server')); } - public function close($ticket_id) + public function changeStatus($ticket_id) { $ticket = Ticket::where('ticket_id', $ticket_id)->firstOrFail(); + if($ticket->status == "Closed"){ + $ticket->status = "Reopened"; + $ticket->save(); + return redirect()->back()->with('success', __('A ticket has been reopened, ID: #') . $ticket->ticket_id); + } $ticket->status = 'Closed'; $ticket->save(); $ticketOwner = $ticket->user; @@ -85,12 +90,16 @@ class TicketsController extends Controller return ''.$tickets->user->name.''; }) ->addColumn('actions', function (Ticket $tickets) { + $statusButtonColor = ($tickets->status == "Closed") ? 'btn-success' : 'btn-warning'; + $statusButtonIcon = ($tickets->status == "Closed") ? 'fa-redo' : 'fa-times'; + $statusButtonText = ($tickets->status == "Closed") ? __('Reopen') : __('Close'); + return ' -
diff --git a/routes/web.php b/routes/web.php index c86a0c66..fbbdb028 100644 --- a/routes/web.php +++ b/routes/web.php @@ -113,7 +113,7 @@ Route::middleware(['auth', 'checkSuspended'])->group(function () { Route::post('ticket/new', [TicketsController::class, 'store'])->middleware(['throttle:ticket-new'])->name('ticket.new.store'); Route::get('ticket/show/{ticket_id}', [TicketsController::class, 'show'])->name('ticket.show'); Route::post('ticket/reply', [TicketsController::class, 'reply'])->middleware(['throttle:ticket-reply'])->name('ticket.reply'); - Route::post('ticket/close/{ticket_id}', [TicketsController::class, 'close'])->name('ticket.close'); + Route::post('ticket/status/{ticket_id}', [TicketsController::class, 'changeStatus'])->name('ticket.changeStatus'); } //admin @@ -211,7 +211,7 @@ Route::middleware(['auth', 'checkSuspended'])->group(function () { Route::get('ticket/datatable', [ModTicketsController::class, 'datatable'])->name('ticket.datatable'); Route::get('ticket/show/{ticket_id}', [ModTicketsController::class, 'show'])->name('ticket.show'); Route::post('ticket/reply', [ModTicketsController::class, 'reply'])->name('ticket.reply'); - Route::post('ticket/close/{ticket_id}', [ModTicketsController::class, 'close'])->name('ticket.close'); + Route::post('ticket/status/{ticket_id}', [ModTicketsController::class, 'changeStatus'])->name('ticket.changeStatus'); Route::post('ticket/delete/{ticket_id}', [ModTicketsController::class, 'delete'])->name('ticket.delete'); //ticket moderation blacklist Route::get('ticket/blacklist', [ModTicketsController::class, 'blacklist'])->name('ticket.blacklist'); diff --git a/themes/default/views/moderator/ticket/show.blade.php b/themes/default/views/moderator/ticket/show.blade.php index 2d51c5dd..dda8c1f9 100644 --- a/themes/default/views/moderator/ticket/show.blade.php +++ b/themes/default/views/moderator/ticket/show.blade.php @@ -44,6 +44,9 @@ @case("Open") {{__("Open")}} @break + @case("Reopened") + {{__("Reopened")}} + @break @case("Closed") {{__("Closed")}} @break @@ -69,13 +72,27 @@ @endswitch{{__("Created on")}}: {{ $ticket->created_at->diffForHumans() }}
- @if($ticket->status!='Closed') - - @endif + @if($ticket->status=='Closed') + + @else + + @endif diff --git a/themes/default/views/store/index.blade.php b/themes/default/views/store/index.blade.php index 5f024d48..7d105867 100644 --- a/themes/default/views/store/index.blade.php +++ b/themes/default/views/store/index.blade.php @@ -36,7 +36,7 @@