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 ' -
+ '.csrf_field().' '.method_field('POST').' - +
'.csrf_field().' @@ -101,6 +110,7 @@ class TicketsController extends Controller }) ->editColumn('status', function (Ticket $tickets) { switch ($tickets->status) { + case 'Reopened': case 'Open': $badgeColor = 'badge-success'; break; diff --git a/app/Http/Controllers/TicketsController.php b/app/Http/Controllers/TicketsController.php index 2477d729..a2b55e43 100644 --- a/app/Http/Controllers/TicketsController.php +++ b/app/Http/Controllers/TicketsController.php @@ -104,9 +104,14 @@ class TicketsController extends Controller return redirect()->back()->with('success', __('Your comment has been submitted')); } - public function close($ticket_id) + public function changeStatus($ticket_id) { $ticket = Ticket::where('user_id', Auth::user()->id)->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(); return redirect()->back()->with('success', __('A ticket has been closed, ID: #') . $ticket->ticket_id); @@ -125,6 +130,7 @@ class TicketsController extends Controller }) ->editColumn('status', function (Ticket $tickets) { switch ($tickets->status) { + case 'Reopened': case 'Open': $badgeColor = 'badge-success'; break; @@ -149,12 +155,16 @@ class TicketsController extends Controller 'raw' => $tickets->updated_at ? strtotime($tickets->updated_at) : '']; }) ->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 ' - + '.csrf_field().' '.method_field('POST').' - +
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') -
- {{csrf_field()}} - {{method_field("POST") }} - -
- @endif + @if($ticket->status=='Closed') +
+ {{csrf_field()}} + {{method_field("POST") }} + +
+ @else +
+ {{csrf_field()}} + {{method_field("POST") }} + +
+ @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 @@
-
{{ config('app.name', 'Controlpanel.gg') }} Store
+
{{ CREDITS_DISPLAY_NAME }}
diff --git a/themes/default/views/ticket/show.blade.php b/themes/default/views/ticket/show.blade.php index 8d9afa26..7401038f 100644 --- a/themes/default/views/ticket/show.blade.php +++ b/themes/default/views/ticket/show.blade.php @@ -35,43 +35,58 @@
@if(!empty($server)) -

{{__("Server")}}: {{ $server->name }}

+

{{__("Server")}}: {{ $server->name }}

@endif -

{{__("Title")}}: {{ $ticket->title }}

-

{{__("Category")}}: {{ $ticketcategory->name }}

-

{{__("Status")}}: - @switch($ticket->status) - @case("Open") - {{__("Open")}} - @break - @case("Closed") - {{__("Closed")}} - @break - @case("Answered") - {{__("Answered")}} - @break - @case("Client Reply") - {{__("Client Reply")}} - @break - @endswitch -

-

Priority: - @switch($ticket->priority) - @case("Low") - {{__("Low")}} - @break - @case("Medium") - {{__("Medium")}} - @break - @case("High") - {{__("High")}} - @break - @endswitch -

+

{{__("Title")}}: {{ $ticket->title }}

+

{{__("Category")}}: {{ $ticketcategory->name }}

+

{{__("Status")}}: + @switch($ticket->status) + @case("Open") + {{__("Open")}} + @break + @case("Reopened") + {{__("Reopened")}} + @break + @case("Closed") + {{__("Closed")}} + @break + @case("Answered") + {{__("Answered")}} + @break + @case("Client Reply") + {{__("Client Reply")}} + @break + @endswitch +

+

Priority: + @switch($ticket->priority) + @case("Low") + {{__("Low")}} + @break + @case("Medium") + {{__("Medium")}} + @break + @case("High") + {{__("High")}} + @break + @endswitch +

{{__("Created on")}}: {{ $ticket->created_at->diffForHumans() }}

- @if($ticket->status!='Closed') + @if($ticket->status=='Closed')
+ action="{{route('ticket.changeStatus', ['ticket_id' => $ticket->ticket_id ])}}"> + {{csrf_field()}} + {{method_field("POST") }} + + + @else +
{{csrf_field()}} {{method_field("POST") }}
{{ $ticket->message }}
@foreach ($ticketcomments as $ticketcomment) -
-
-
-
User Image - {{ $ticketcomment->user->name }} - @if($ticketcomment->user->role === "member") - Member - @elseif ($ticketcomment->user->role === "client") - Client - @elseif ($ticketcomment->user->role === "moderator") - Moderator - @elseif ($ticketcomment->user->role === "admin") - Admin - @endif -
- {{ $ticketcomment->created_at->diffForHumans() }} +
+
+
+
User Image + {{ $ticketcomment->user->name }} + @if($ticketcomment->user->role === "member") + Member + @elseif ($ticketcomment->user->role === "client") + Client + @elseif ($ticketcomment->user->role === "moderator") + Moderator + @elseif ($ticketcomment->user->role === "admin") + Admin + @endif +
+ {{ $ticketcomment->created_at->diffForHumans() }} +
+
{{ $ticketcomment->ticketcomment }}
-
{{ $ticketcomment->ticketcomment }}
-
@endforeach
{!! csrf_field() !!}
- + @if ($errors->has('ticketcomment')) - + {{ $errors->first('ticketcomment') }} @endif