This commit is contained in:
Dennis 2023-02-23 09:32:37 +01:00 committed by GitHub
commit 485aeedbf1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 440 additions and 303 deletions

View file

@ -9,6 +9,7 @@ use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\Log;
use PayPalCheckoutSdk\Core\PayPalHttpClient;
use PayPalCheckoutSdk\Core\ProductionEnvironment;
use PayPalCheckoutSdk\Core\SandboxEnvironment;
@ -74,7 +75,7 @@ function PaypalPay(Request $request)
"application_context" => [
"cancel_url" => route('payment.Cancel'),
"return_url" => route('payment.PayPalSuccess', ['payment' => $payment->id]),
'brand_name' => config('app.name', 'Laravel'),
'brand_name' => config('app.name', 'Controlpanel.GG'),
'shipping_preference' => 'NO_SHIPPING'
]
@ -85,14 +86,23 @@ function PaypalPay(Request $request)
// Call API with your client and get a response for your call
$response = getPayPalClient()->execute($request);
// check for any errors in the response
if ($response->statusCode != 201) {
throw new \Exception($response->statusCode);
}
// make sure the link is not empty
if (empty($response->result->links[1]->href)) {
throw new \Exception('No redirect link found');
}
Redirect::away($response->result->links[1]->href)->send();
return;
} catch (HttpException $ex) {
error_log($ex->statusCode);
error_log($ex->getMessage());
Log::error('PayPal Payment: ' . $ex->getMessage());
$payment->delete();
Redirect::route('payment.Cancel');
Redirect::route('store.index')->with('error', __('Payment failed'))->send();
return;
}
}

View file

@ -14,6 +14,7 @@ use Illuminate\Http\JsonResponse;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Log;
class ServerController extends Controller
{
@ -27,38 +28,6 @@ class ServerController extends Controller
return view('admin.servers.index');
}
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @return Response
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*
* @param Server $server
* @return Response
*/
public function show(Server $server)
{
//
}
/**
* Show the form for editing the specified resource.
*
@ -196,6 +165,8 @@ class ServerController extends Controller
public function dataTable(Request $request)
{
$query = Server::with(['user', 'product']);
if ($request->has('product')) {
$query->where('product_id', '=', $request->input('product'));
}
@ -204,6 +175,9 @@ class ServerController extends Controller
}
$query->select('servers.*');
Log::info($request->input('order'));
return datatables($query)
->addColumn('user', function (Server $server) {
return '<a href="' . route('admin.users.show', $server->user->id) . '">' . $server->user->name . '</a>';
@ -232,7 +206,7 @@ class ServerController extends Controller
';
})
->addColumn('status', function (Server $server) {
$labelColor = $server->isSuspended() ? 'text-danger' : 'text-success';
$labelColor = $server->suspended ? 'text-danger' : 'text-success';
return '<i class="fas ' . $labelColor . ' fa-circle mr-2"></i>';
})

View file

@ -14,6 +14,7 @@ use Illuminate\Validation\Rule;
class ShopProductController extends Controller
{
/**
* Display a listing of the resource.
*
@ -66,23 +67,12 @@ class ShopProductController extends Controller
'display' => 'required|string|max:60',
]);
$disabled = ! is_null($request->input('disabled'));
$disabled = !is_null($request->input('disabled'));
ShopProduct::create(array_merge($request->all(), ['disabled' => $disabled]));
return redirect()->route('admin.store.index')->with('success', __('Store item has been created!'));
}
/**
* Display the specified resource.
*
* @param ShopProduct $shopProduct
* @return Response
*/
public function show(ShopProduct $shopProduct)
{
//
}
/**
* Show the form for editing the specified resource.
*
@ -116,7 +106,7 @@ class ShopProductController extends Controller
'display' => 'required|string|max:60',
]);
$disabled = ! is_null($request->input('disabled'));
$disabled = !is_null($request->input('disabled'));
$shopProduct->update(array_merge($request->all(), ['disabled' => $disabled]));
return redirect()->route('admin.store.index')->with('success', __('Store item has been updated!'));
@ -129,7 +119,7 @@ class ShopProductController extends Controller
*/
public function disable(Request $request, ShopProduct $shopProduct)
{
$shopProduct->update(['disabled' => ! $shopProduct->disabled]);
$shopProduct->update(['disabled' => !$shopProduct->disabled]);
return redirect()->route('admin.store.index')->with('success', __('Product has been updated!'));
}
@ -147,19 +137,20 @@ class ShopProductController extends Controller
return redirect()->back()->with('success', __('Store item has been removed!'));
}
public function dataTable()
public function dataTable(Request $request)
{
$query = ShopProduct::query();
return datatables($query)
->addColumn('actions', function (ShopProduct $shopProduct) {
return '
<a data-content="'.__('Edit').'" data-toggle="popover" data-trigger="hover" data-placement="top" href="'.route('admin.store.edit', $shopProduct->id).'" class="btn btn-sm btn-info mr-1"><i class="fas fa-pen"></i></a>
<a data-content="' . __('Edit') . '" data-toggle="popover" data-trigger="hover" data-placement="top" href="' . route('admin.store.edit', $shopProduct->id) . '" class="btn btn-sm btn-info mr-1"><i class="fas fa-pen"></i></a>
<form class="d-inline" onsubmit="return submitResult();" method="post" action="'.route('admin.store.destroy', $shopProduct->id).'">
'.csrf_field().'
'.method_field('DELETE').'
<button data-content="'.__('Delete').'" data-toggle="popover" data-trigger="hover" data-placement="top" class="btn btn-sm btn-danger mr-1"><i class="fas fa-trash"></i></button>
<form class="d-inline" onsubmit="return submitResult();" method="post" action="' . route('admin.store.destroy', $shopProduct->id) . '">
' . csrf_field() . '
' . method_field('DELETE') . '
<button data-content="' . __('Delete') . '" data-toggle="popover" data-trigger="hover" data-placement="top" class="btn btn-sm btn-danger mr-1"><i class="fas fa-trash"></i></button>
</form>
';
})
@ -167,12 +158,12 @@ class ShopProductController extends Controller
$checked = $shopProduct->disabled == false ? 'checked' : '';
return '
<form class="d-inline" onsubmit="return submitResult();" method="post" action="'.route('admin.store.disable', $shopProduct->id).'">
'.csrf_field().'
'.method_field('PATCH').'
<form class="d-inline" onsubmit="return submitResult();" method="post" action="' . route('admin.store.disable', $shopProduct->id) . '">
' . csrf_field() . '
' . method_field('PATCH') . '
<div class="custom-control custom-switch">
<input '.$checked.' name="disabled" onchange="this.form.submit()" type="checkbox" class="custom-control-input" id="switch'.$shopProduct->id.'">
<label class="custom-control-label" for="switch'.$shopProduct->id.'"></label>
<input ' . $checked . ' name="disabled" onchange="this.form.submit()" type="checkbox" class="custom-control-input" id="switch' . $shopProduct->id . '">
<label class="custom-control-label" for="switch' . $shopProduct->id . '"></label>
</div>
</form>
';

View file

@ -26,6 +26,7 @@ use Spatie\QueryBuilder\QueryBuilder;
class UserController extends Controller
{
private Pterodactyl $pterodactyl;
public function __construct(Pterodactyl $pterodactyl)
@ -132,7 +133,7 @@ class UserController extends Controller
]);
}
if (! is_null($request->input('new_password'))) {
if (!is_null($request->input('new_password'))) {
$request->validate([
'new_password' => 'required|string|min:8',
'new_password_confirmation' => 'required|same:new_password',
@ -259,7 +260,7 @@ class UserController extends Controller
public function toggleSuspended(User $user)
{
try {
! $user->isSuspended() ? $user->suspend() : $user->unSuspend();
!$user->isSuspended() ? $user->suspend() : $user->unSuspend();
} catch (Exception $exception) {
return redirect()->back()->with('error', $exception->getMessage());
}
@ -270,52 +271,45 @@ class UserController extends Controller
/**
* @throws Exception
*/
public function dataTable()
public function dataTable(Request $request)
{
$query = User::with(['discordUser', 'servers'])->select('users.*');
$query = User::with('discordUser')->withCount('servers');
// manually count referrals in user_referrals table
$query->selectRaw('users.*, (SELECT COUNT(*) FROM user_referrals WHERE user_referrals.referral_id = users.id) as referrals_count');
return datatables($query)
->addColumn('avatar', function (User $user) {
return '<img width="28px" height="28px" class="rounded-circle ml-1" src="'.$user->getAvatar().'">';
return '<img width="28px" height="28px" class="rounded-circle ml-1" src="' . $user->getAvatar() . '">';
})
->addColumn('credits', function (User $user) {
return '<i class="fas fa-coins mr-2"></i> '.$user->credits();
return '<i class="fas fa-coins mr-2"></i> ' . $user->credits();
})
->addColumn('verified', function (User $user) {
return $user->getVerifiedStatus();
})
->addColumn('servers', function (User $user) {
return $user->servers->count();
})
->addColumn('referrals', function (User $user) {
return DB::table('user_referrals')->where('referral_id', '=', $user->id)->count();
})
->addColumn('discordId', function (User $user) {
return $user->discordUser ? $user->discordUser->id : '';
})
->addColumn('last_seen', function (User $user) {
return ['display' => $user->last_seen ? $user->last_seen->diffForHumans() : '',
'raw' => $user->last_seen ? strtotime($user->last_seen) : '', ];
})
->addColumn('actions', function (User $user) {
$suspendColor = $user->isSuspended() ? 'btn-success' : 'btn-warning';
$suspendIcon = $user->isSuspended() ? 'fa-play-circle' : 'fa-pause-circle';
$suspendText = $user->isSuspended() ? __('Unsuspend') : __('Suspend');
return '
<a data-content="'.__('Login as User').'" data-toggle="popover" data-trigger="hover" data-placement="top" href="'.route('admin.users.loginas', $user->id).'" class="btn btn-sm btn-primary mr-1"><i class="fas fa-sign-in-alt"></i></a>
<a data-content="'.__('Verify').'" data-toggle="popover" data-trigger="hover" data-placement="top" href="'.route('admin.users.verifyEmail', $user->id).'" class="btn btn-sm btn-secondary mr-1"><i class="fas fa-envelope"></i></a>
<a data-content="'.__('Show').'" data-toggle="popover" data-trigger="hover" data-placement="top" href="'.route('admin.users.show', $user->id).'" class="btn btn-sm text-white btn-warning mr-1"><i class="fas fa-eye"></i></a>
<a data-content="'.__('Edit').'" data-toggle="popover" data-trigger="hover" data-placement="top" href="'.route('admin.users.edit', $user->id).'" class="btn btn-sm btn-info mr-1"><i class="fas fa-pen"></i></a>
<form class="d-inline" method="post" action="'.route('admin.users.togglesuspend', $user->id).'">
'.csrf_field().'
<button data-content="'.$suspendText.'" data-toggle="popover" data-trigger="hover" data-placement="top" class="btn btn-sm '.$suspendColor.' text-white mr-1"><i class="far '.$suspendIcon.'"></i></button>
</form>
<form class="d-inline" onsubmit="return submitResult();" method="post" action="'.route('admin.users.destroy', $user->id).'">
'.csrf_field().'
'.method_field('DELETE').'
<button data-content="'.__('Delete').'" data-toggle="popover" data-trigger="hover" data-placement="top" class="btn btn-sm btn-danger mr-1"><i class="fas fa-trash"></i></button>
</form>
<a data-content="' . __('Login as User') . '" data-toggle="popover" data-trigger="hover" data-placement="top" href="' . route('admin.users.loginas', $user->id) . '" class="btn btn-sm btn-primary mr-1"><i class="fas fa-sign-in-alt"></i></a>
<a data-content="' . __('Verify') . '" data-toggle="popover" data-trigger="hover" data-placement="top" href="' . route('admin.users.verifyEmail', $user->id) . '" class="btn btn-sm btn-secondary mr-1"><i class="fas fa-envelope"></i></a>
<a data-content="' . __('Show') . '" data-toggle="popover" data-trigger="hover" data-placement="top" href="' . route('admin.users.show', $user->id) . '" class="btn btn-sm text-white btn-warning mr-1"><i class="fas fa-eye"></i></a>
<a data-content="' . __('Edit') . '" data-toggle="popover" data-trigger="hover" data-placement="top" href="' . route('admin.users.edit', $user->id) . '" class="btn btn-sm btn-info mr-1"><i class="fas fa-pen"></i></a>
<form class="d-inline" method="post" action="' . route('admin.users.togglesuspend', $user->id) . '">
' . csrf_field() . '
<button data-content="' . $suspendText . '" data-toggle="popover" data-trigger="hover" data-placement="top" class="btn btn-sm ' . $suspendColor . ' text-white mr-1"><i class="far ' . $suspendIcon . '"></i></button>
</form>
<form class="d-inline" onsubmit="return submitResult();" method="post" action="' . route('admin.users.destroy', $user->id) . '">
' . csrf_field() . '
' . method_field('DELETE') . '
<button data-content="' . __('Delete') . '" data-toggle="popover" data-trigger="hover" data-placement="top" class="btn btn-sm btn-danger mr-1"><i class="fas fa-trash"></i></button>
</form>
';
})
->editColumn('role', function (User $user) {
@ -334,15 +328,15 @@ class UserController extends Controller
break;
}
return '<span class="badge '.$badgeColor.'">'.$user->role.'</span>';
return '<span class="badge ' . $badgeColor . '">' . $user->role . '</span>';
})
->editColumn('last_seen', function (User $user) {
return $user->last_seen ? $user->last_seen->diffForHumans() : __('Never');
})
->editColumn('name', function (User $user) {
return '<a class="text-info" target="_blank" href="'.config('SETTINGS::SYSTEM:PTERODACTYL:URL').'/admin/users/view/'.$user->pterodactyl_id.'">'.strip_tags($user->name).'</a>';
return '<a class="text-info" target="_blank" href="' . config('SETTINGS::SYSTEM:PTERODACTYL:URL') . '/admin/users/view/' . $user->pterodactyl_id . '">' . strip_tags($user->name) . '</a>';
})
/*->orderColumn('last_seen', function ($query) {
$query->orderBy('last_seen', "desc");
})*/
->rawColumns(['avatar', 'name', 'credits', 'role', 'usage', 'referrals', 'actions', 'last_seen'])
->make(true);
->rawColumns(['avatar', 'name', 'credits', 'role', 'usage', 'actions'])
->make();
}
}

View file

@ -25,7 +25,12 @@ class TicketsController extends Controller
public function show($ticket_id)
{
try {
$ticket = Ticket::where('ticket_id', $ticket_id)->firstOrFail();
} catch (Exception $e)
{
return redirect()->back()->with('warning', __('Ticket not found on the server. It potentially got deleted earlier'));
}
$ticketcomments = $ticket->ticketcomments;
$ticketcategory = $ticket->ticketcategory;
$server = Server::where('id', $ticket->server)->first();
@ -33,9 +38,20 @@ class TicketsController extends Controller
return view('moderator.ticket.show', compact('ticket', 'ticketcategory', 'ticketcomments', 'server'));
}
public function close($ticket_id)
public function changeStatus($ticket_id)
{
try {
$ticket = Ticket::where('ticket_id', $ticket_id)->firstOrFail();
} catch(Exception $e)
{
return redirect()->back()->with('warning', __('Ticket not found on the server. It potentially got deleted earlier'));
}
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;
@ -45,7 +61,13 @@ class TicketsController extends Controller
public function delete($ticket_id)
{
try {
$ticket = Ticket::where('ticket_id', $ticket_id)->firstOrFail();
} catch (Exception $e)
{
return redirect()->back()->with('warning', __('Ticket not found on the server. It potentially got deleted earlier'));
}
TicketComment::where('ticket_id', $ticket->id)->delete();
$ticket->delete();
@ -55,7 +77,11 @@ class TicketsController extends Controller
public function reply(Request $request)
{
$this->validate($request, ['ticketcomment' => 'required']);
$ticket = Ticket::where('id', $request->input('ticket_id'))->firstOrFail();
try {
$ticket = Ticket::where('id', $request->input('ticket_id'))->firstOrFail();
} catch (Exception $e){
return redirect()->back()->with('warning', __('Ticket not found on the server. It potentially got deleted earlier'));
}
$ticket->status = 'Answered';
$ticket->update();
TicketComment::create([
@ -63,7 +89,12 @@ class TicketsController extends Controller
'user_id' => Auth::user()->id,
'ticketcomment' => $request->input('ticketcomment'),
]);
try {
$user = User::where('id', $ticket->user_id)->firstOrFail();
} catch(Exception $e)
{
return redirect()->back()->with('warning', __('User not found on the server. Check on the admin database or try again later.'));
}
$newmessage = $request->input('ticketcomment');
$user->notify(new ReplyNotification($ticket, $user, $newmessage));
@ -85,12 +116,16 @@ class TicketsController extends Controller
return '<a href="'.route('admin.users.show', $tickets->user->id).'">'.$tickets->user->name.'</a>';
})
->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 '
<a data-content="'.__('View').'" data-toggle="popover" data-trigger="hover" data-placement="top" href="'.route('moderator.ticket.show', ['ticket_id' => $tickets->ticket_id]).'" class="btn btn-sm text-white btn-info mr-1"><i class="fas fa-eye"></i></a>
<form class="d-inline" method="post" action="'.route('moderator.ticket.close', ['ticket_id' => $tickets->ticket_id]).'">
<form class="d-inline" method="post" action="'.route('moderator.ticket.changeStatus', ['ticket_id' => $tickets->ticket_id]).'">
'.csrf_field().'
'.method_field('POST').'
<button data-content="'.__('Close').'" data-toggle="popover" data-trigger="hover" data-placement="top" class="btn btn-sm text-white btn-warning mr-1"><i class="fas fa-times"></i></button>
<button data-content="'.__($statusButtonText).'" data-toggle="popover" data-trigger="hover" data-placement="top" class="btn btn-sm text-white '.$statusButtonColor.' mr-1"><i class="fas '.$statusButtonIcon.'"></i></button>
</form>
<form class="d-inline" method="post" action="'.route('moderator.ticket.delete', ['ticket_id' => $tickets->ticket_id]).'">
'.csrf_field().'
@ -101,6 +136,7 @@ class TicketsController extends Controller
})
->editColumn('status', function (Ticket $tickets) {
switch ($tickets->status) {
case 'Reopened':
case 'Open':
$badgeColor = 'badge-success';
break;
@ -135,8 +171,13 @@ class TicketsController extends Controller
public function blacklistAdd(Request $request)
{
$user = User::where('id', $request->user_id)->first();
try {
$user = User::where('id', $request->user_id)->firstOrFail();
$check = TicketBlacklist::where('user_id', $user->id)->first();
}
catch (Exception $e){
return redirect()->back()->with('warning', __('User not found on the server. Check the admin database or try again later.'));
}
if ($check) {
$check->reason = $request->reason;
$check->status = 'True';
@ -163,7 +204,12 @@ class TicketsController extends Controller
public function blacklistChange($id)
{
$blacklist = TicketBlacklist::where('id', $id)->first();
try {
$blacklist = TicketBlacklist::where('id', $id)->first();
}
catch (Exception $e){
return redirect()->back()->with('warning', __('User not found on the server. Check the admin database or try again later.'));
}
if ($blacklist->status == 'True') {
$blacklist->status = 'False';
} else {

View file

@ -26,53 +26,50 @@ class TicketsController extends Controller
return view('ticket.index', compact('tickets', 'ticketcategories'));
}
public function create()
{
//check in blacklist
$check = TicketBlacklist::where('user_id', Auth::user()->id)->first();
if ($check && $check->status == 'True') {
return redirect()->route('ticket.index')->with('error', __("You can't make a ticket because you're on the blacklist for a reason: '".$check->reason."', please contact the administrator"));
}
$ticketcategories = TicketCategory::all();
$servers = Auth::user()->servers;
return view('ticket.create', compact('ticketcategories', 'servers'));
}
public function store(Request $request)
{
$this->validate($request, [
'title' => 'required',
'ticketcategory' => 'required',
'priority' => 'required',
'message' => 'required', ]
'title' => 'required',
'ticketcategory' => 'required',
'priority' => 'required',
'message' => 'required',]
);
$ticket = new Ticket([
'title' => $request->input('title'),
'user_id' => Auth::user()->id,
'ticket_id' => strtoupper(Str::random(8)),
'ticketcategory_id' => $request->input('ticketcategory'),
'priority' => $request->input('priority'),
'message' => $request->input('message'),
'status' => 'Open',
'server' => $request->input('server'), ]
'title' => $request->input('title'),
'user_id' => Auth::user()->id,
'ticket_id' => strtoupper(Str::random(8)),
'ticketcategory_id' => $request->input('ticketcategory'),
'priority' => $request->input('priority'),
'message' => $request->input('message'),
'status' => 'Open',
'server' => $request->input('server'),]
);
$ticket->save();
$user = Auth::user();
if(config('SETTINGS::TICKET:NOTIFY') == "all"){ $admin = User::where('role', 'admin')->orWhere('role', 'mod')->get();}
if(config('SETTINGS::TICKET:NOTIFY') == "admin"){ $admin = User::where('role', 'admin')->get();}
if(config('SETTINGS::TICKET:NOTIFY') == "moderator"){ $admin = User::where('role', 'mod')->get();}
if (config('SETTINGS::TICKET:NOTIFY') == "all") {
$admin = User::where('role', 'admin')->orWhere('role', 'mod')->get();
}
if (config('SETTINGS::TICKET:NOTIFY') == "admin") {
$admin = User::where('role', 'admin')->get();
}
if (config('SETTINGS::TICKET:NOTIFY') == "moderator") {
$admin = User::where('role', 'mod')->get();
}
$user->notify(new CreateNotification($ticket));
if(config('SETTINGS::TICKET:NOTIFY') != "none"){
if (config('SETTINGS::TICKET:NOTIFY') != "none") {
Notification::send($admin, new AdminCreateNotification($ticket, $user));
}
return redirect()->route('ticket.index')->with('success', __('A ticket has been opened, ID: #').$ticket->ticket_id);
return redirect()->route('ticket.index')->with('success', __('A ticket has been opened, ID: #') . $ticket->ticket_id);
}
public function show($ticket_id)
{
$ticket = Ticket::where('ticket_id', $ticket_id)->firstOrFail();
try {
$ticket = Ticket::where('ticket_id', $ticket_id)->firstOrFail();
} catch (Exception $e) {
return redirect()->back()->with('warning', __('Ticket not found on the server. It potentially got deleted earlier'));
}
$ticketcomments = $ticket->ticketcomments;
$ticketcategory = $ticket->ticketcategory;
$server = Server::where('id', $ticket->server)->first();
@ -85,10 +82,14 @@ class TicketsController extends Controller
//check in blacklist
$check = TicketBlacklist::where('user_id', Auth::user()->id)->first();
if ($check && $check->status == 'True') {
return redirect()->route('ticket.index')->with('error', __("You can't reply a ticket because you're on the blacklist for a reason: '".$check->reason."', please contact the administrator"));
return redirect()->route('ticket.index')->with('error', __("You can't reply a ticket because you're on the blacklist for a reason: '" . $check->reason . "', please contact the administrator"));
}
$this->validate($request, ['ticketcomment' => 'required']);
$ticket = Ticket::where('id', $request->input('ticket_id'))->firstOrFail();
try {
$ticket = Ticket::where('id', $request->input('ticket_id'))->firstOrFail();
} catch (Exception $e) {
return redirect()->back()->with('warning', __('Ticket not found on the server. It potentially got deleted earlier'));
}
$ticket->status = 'Client Reply';
$ticket->update();
$ticketcomment = TicketComment::create([
@ -104,9 +105,32 @@ class TicketsController extends Controller
return redirect()->back()->with('success', __('Your comment has been submitted'));
}
public function close($ticket_id)
public function create()
{
$ticket = Ticket::where('user_id', Auth::user()->id)->where("ticket_id", $ticket_id)->firstOrFail();
//check in blacklist
$check = TicketBlacklist::where('user_id', Auth::user()->id)->first();
if ($check && $check->status == 'True') {
return redirect()->route('ticket.index')->with('error', __("You can't make a ticket because you're on the blacklist for a reason: '" . $check->reason . "', please contact the administrator"));
}
$ticketcategories = TicketCategory::all();
$servers = Auth::user()->servers;
return view('ticket.create', compact('ticketcategories', 'servers'));
}
public function changeStatus($ticket_id)
{
try {
$ticket = Ticket::where('user_id', Auth::user()->id)->where("ticket_id", $ticket_id)->firstOrFail();
} catch (Exception $e) {
return redirect()->back()->with('warning', __('Ticket not found on the server. It potentially got deleted earlier'));
}
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);
@ -121,10 +145,11 @@ class TicketsController extends Controller
return $tickets->ticketcategory->name;
})
->editColumn('title', function (Ticket $tickets) {
return '<a class="text-info" href="'.route('ticket.show', ['ticket_id' => $tickets->ticket_id]).'">'.'#'.$tickets->ticket_id.' - '.htmlspecialchars($tickets->title).'</a>';
return '<a class="text-info" href="' . route('ticket.show', ['ticket_id' => $tickets->ticket_id]) . '">' . '#' . $tickets->ticket_id . ' - ' . htmlspecialchars($tickets->title) . '</a>';
})
->editColumn('status', function (Ticket $tickets) {
switch ($tickets->status) {
case 'Reopened':
case 'Open':
$badgeColor = 'badge-success';
break;
@ -139,7 +164,7 @@ class TicketsController extends Controller
break;
}
return '<span class="badge '.$badgeColor.'">'.$tickets->status.'</span>';
return '<span class="badge ' . $badgeColor . '">' . $tickets->status . '</span>';
})
->editColumn('priority', function (Ticket $tickets) {
return __($tickets->priority);
@ -149,12 +174,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 '
<a data-content="'.__('View').'" data-toggle="popover" data-trigger="hover" data-placement="top" href="'.route('ticket.show', ['ticket_id' => $tickets->ticket_id]).'" class="btn btn-sm text-white btn-info mr-1"><i class="fas fa-eye"></i></a>
<form class="d-inline" method="post" action="'.route('ticket.close', ['ticket_id' => $tickets->ticket_id]).'">
'.csrf_field().'
'.method_field('POST').'
<button data-content="'.__('Close').'" data-toggle="popover" data-trigger="hover" data-placement="top" class="btn btn-sm text-white btn-warning mr-1"><i class="fas fa-times"></i></button>
<a data-content="' . __('View') . '" data-toggle="popover" data-trigger="hover" data-placement="top" href="' . route('ticket.show', ['ticket_id' => $tickets->ticket_id]) . '" class="btn btn-sm text-white btn-info mr-1"><i class="fas fa-eye"></i></a>
<form class="d-inline" method="post" action="' . route('ticket.changeStatus', ['ticket_id' => $tickets->ticket_id]) . '">
' . csrf_field() . '
' . method_field('POST') . '
<button data-content="' . __($statusButtonText) . '" data-toggle="popover" data-trigger="hover" data-placement="top" class="btn btn-sm text-white ' . $statusButtonColor . ' mr-1"><i class="fas ' . $statusButtonIcon . '"></i></button>
</form>
</form>

View file

@ -1 +1 @@
@import "default.css";.layout-fixed .wrapper .sidebar{ height:calc(100vh - 3.5rem - 1px);background:radial-gradient(#061b29,black);}body:not(.sidebar-mini-md) .content-wrapper,body:not(.sidebar-mini-md) .main-footer,body:not(.sidebar-mini-md) .main-header{ transition:margin-left .3s ease-in-out;margin-left:250px;background:radial-gradient(#061b29,black);}[class*=sidebar-dark] .brand-link,[class*=sidebar-dark] .brand-link .pushmenu{ color:hsla(0,0%,100%,.8);background:radial-gradient(#061b29,black);}.main-sidebar .brand-text,.main-sidebar .logo-xl,.main-sidebar .logo-xs,.sidebar .nav-link p,.sidebar .user-panel .info{ transition:margin-left .3s linear,opacity .3s ease,visibility .3s ease;color:#d3d3d3;}.sidebar-dark-primary .nav-sidebar>.nav-item>.nav-link.active,.sidebar-light-primary .nav-sidebar>.nav-item>.nav-link.active{ color:#fff;background:radial-gradient(#1b4b61,#fd030300);border-radius:50px;}.dark-mode .card{ background-color:#00000000;color:#ffffff99;border-width:3px;border-color:#f7f7f7;border-style:double;border-radius:15px;}.btn-info{ color:#ffffff;background-color:#b8171700;border-color:#ffffff;box-shadow:none;}.btn-warning{ color:#ffffff;background-color:#ffc10700;border-color:#ffffff;box-shadow:none;}.card-title{ float:left;font-size:1.1rem;font-weight:400;margin:0;color:white;}.dark-mode .text-muted{ color:#ffffff99!important;}.dark-mode .list-group-item{ background-color:#343a4000;border-color:#ffffff99;}.dark-mode .info-box{ background-color:#343a4000;color:#fff;border:3px;border-style:double;border-radius:15px;border-color:white;}label:not(.form-check-label):not(.custom-file-label){ font-weight:700;color:#ffffffc2;}.dark-mode .custom-control-label:before,.dark-mode .custom-file-label,.dark-mode .custom-file-label:after,.dark-mode .custom-select,.dark-mode .form-control,.dark-mode .input-group-text{ background-color:#007af400;color:#828282;}.alert-success{ color:#fff;background-color:#28a745;border-color:#ffffff;border-radius:15px;border-style:double;}.dark-mode{ color:#fff;background:radial-gradient(#061b29,black);}.dark-mode .invoice{ background-color:#343a4000;border:3px;border-radius:15px;border-color:white;border:double;}.dark-mode .nav-tabs .nav-item.show .nav-link,.dark-mode .nav-tabs .nav-link.active{ background-color:#ffffff1c;color:#fff;}.slim-crop-area img,.slim-image-editor img,.slim-popover img,.slim img{ background:black;}.dark-mode .callout{ background-color:#00ff0333;}.callout.callout-info{ border-left-color:#00e11d;}.p-3{ padding:1rem!important;background:#061b29;}.small-box>.small-box-footer{ color:hsla(0,0%,100%,.8);display:block;padding:3px 0;position:relative;text-align:center;text-decoration:none;z-index:10;background:#061b29;}.dark-mode .dropdown-menu{ background-color:#061b29;border-color:white;}.card-header:first-child{ border-radius:14px 14px 0px 0px;background:#061b29;}.card-body{ flex:1 1 auto;min-height:1px;padding:1.25rem;background:#061b29;}.justify-content-between{ justify-content:space-between!important;background:#061b29;}.dark-mode .card .card-footer{ background-color:#061b29;border-radius:0px 0px 14px 14px;}.dark-mode .select2-selection--single{ background-color:#061b29;border-color:#6c757d;}.select2-search--dropdown{ display:block;padding:4px;background:#061b29;}.select2-container--default .select2-results__option{ padding:6px 12px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background:blue;background:#061b29;}.dark-mode .select2-dropdown,.dark-mode .select2-dropdown .select2-search__field,.dark-mode .select2-search--inline .select2-search__field{ background-color:#061b29;border-color:#ffffff;color:#fff;}.modal-header{ background:#061b29;}.modal-body{ position:relative;flex:1 1 auto;padding:1rem;background:#061b29;}.dark-mode .modal-footer,.dark-mode .modal-header{ border-color:#ffffff;background:#061b29;}
@import "default.css";.layout-fixed .wrapper .sidebar{ height:calc(100vh - 3.5rem - 1px);background:radial-gradient(#061b29,black);}body:not(.sidebar-mini-md) .content-wrapper,body:not(.sidebar-mini-md) .main-footer,body:not(.sidebar-mini-md) .main-header{ transition:margin-left .3s ease-in-out;background:radial-gradient(#061b29,black);}[class*=sidebar-dark] .brand-link,[class*=sidebar-dark] .brand-link .pushmenu{ color:hsla(0,0%,100%,.8);background:radial-gradient(#061b29,black);}.main-sidebar .brand-text,.main-sidebar .logo-xl,.main-sidebar .logo-xs,.sidebar .nav-link p,.sidebar .user-panel .info{ transition:margin-left .3s linear,opacity .3s ease,visibility .3s ease;color:#d3d3d3;}.sidebar-dark-primary .nav-sidebar>.nav-item>.nav-link.active,.sidebar-light-primary .nav-sidebar>.nav-item>.nav-link.active{ color:#fff;background:radial-gradient(#1b4b61,#fd030300);border-radius:50px;}.dark-mode .card{ background-color:#00000000;color:#ffffff99;border-width:3px;border-color:#f7f7f7;border-style:double;border-radius:15px;}.btn-info{ color:#ffffff;background-color:#b8171700;border-color:#ffffff;box-shadow:none;}.btn-warning{ color:#ffffff;background-color:#ffc10700;border-color:#ffffff;box-shadow:none;}.card-title{ float:left;font-size:1.1rem;font-weight:400;margin:0;color:white;}.dark-mode .text-muted{ color:#ffffff99!important;}.dark-mode .list-group-item{ background-color:#343a4000;border-color:#ffffff99;}.dark-mode .info-box{ background-color:#343a4000;color:#fff;border:3px;border-style:double;border-radius:15px;border-color:white;}label:not(.form-check-label):not(.custom-file-label){ font-weight:700;color:#ffffffc2;}.dark-mode .custom-control-label:before,.dark-mode .custom-file-label,.dark-mode .custom-file-label:after,.dark-mode .custom-select,.dark-mode .form-control,.dark-mode .input-group-text{ background-color:#007af400;color:#828282;}.alert-success{ color:#fff;background-color:#28a745;border-color:#ffffff;border-radius:15px;border-style:double;}.dark-mode{ color:#fff;background:radial-gradient(#061b29,black);}.dark-mode .invoice{ background-color:#343a4000;border:3px;border-radius:15px;border-color:white;border:double;}.dark-mode .nav-tabs .nav-item.show .nav-link,.dark-mode .nav-tabs .nav-link.active{ background-color:#ffffff1c;color:#fff;}.slim-crop-area img,.slim-image-editor img,.slim-popover img,.slim img{ background:black;}.dark-mode .callout{ background-color:#00ff0333;}.callout.callout-info{ border-left-color:#00e11d;}.p-3{ padding:1rem!important;background:#061b29;}.small-box>.small-box-footer{ color:hsla(0,0%,100%,.8);display:block;padding:3px 0;position:relative;text-align:center;text-decoration:none;z-index:10;background:#061b29;}.dark-mode .dropdown-menu{ background-color:#061b29;border-color:white;}.card-header:first-child{ border-radius:14px 14px 0px 0px;background:#061b29;}.card-body{ flex:1 1 auto;min-height:1px;padding:1.25rem;background:#061b29;}.justify-content-between{ justify-content:space-between!important;background:#061b29;}.dark-mode .card .card-footer{ background-color:#061b29;border-radius:0px 0px 14px 14px;}.dark-mode .select2-selection--single{ background-color:#061b29;border-color:#6c757d;}.select2-search--dropdown{ display:block;padding:4px;background:#061b29;}.select2-container--default .select2-results__option{ padding:6px 12px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background:blue;background:#061b29;}.dark-mode .select2-dropdown,.dark-mode .select2-dropdown .select2-search__field,.dark-mode .select2-search--inline .select2-search__field{ background-color:#061b29;border-color:#ffffff;color:#fff;}.modal-header{ background:#061b29;}.modal-body{ position:relative;flex:1 1 auto;padding:1rem;background:#061b29;}.dark-mode .modal-footer,.dark-mode .modal-header{ border-color:#ffffff;background:#061b29;}

View file

@ -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');

View file

@ -441,7 +441,7 @@
<strong>Copyright &copy; 2021-{{ date('Y') }} <a
href="{{ url('/') }}">{{ env('APP_NAME', 'Laravel') }}</a>.</strong>
All rights
reserved. Powered by <a href="https://controlpanel.gg">ControlPanel</a>.
reserved. Powered by <a href="https://controlpanel.gg">ControlPanel</a>. | Theme by <a href="https://2icecube.de/cpgg">2IceCube</a>
@if (!str_contains(config('BRANCHNAME'), 'main') && !str_contains(config('BRANCHNAME'), 'unknown'))
Version <b>{{ config('app')['version'] }} - {{ config('BRANCHNAME') }}</b>
@endif

View file

@ -1,15 +1,15 @@
<table id="datatable" class="table table-striped">
<thead>
<tr>
<th width="20"></th>
<th>{{__('Name')}}</th>
<th>{{__('User')}}</th>
<th>{{__('Server id')}}</th>
<th>{{__('Config')}}</th>
<th>{{__('Suspended at')}}</th>
<th>{{__('Created at')}}</th>
<th></th>
</tr>
<tr>
<th width="20"></th>
<th>{{ __('Name') }}</th>
<th>{{ __('User') }}</th>
<th>{{ __('Server id') }}</th>
<th>{{ __('Config') }}</th>
<th>{{ __('Suspended at') }}</th>
<th>{{ __('Created at') }}</th>
<th></th>
</tr>
</thead>
<tbody>
</tbody>
@ -17,30 +17,53 @@
<script>
function submitResult() {
return confirm("{{__('Are you sure you wish to delete?')}}") !== false;
return confirm("{{ __('Are you sure you wish to delete?') }}") !== false;
}
document.addEventListener("DOMContentLoaded", function () {
document.addEventListener("DOMContentLoaded", function() {
$('#datatable').DataTable({
language: {
url: '//cdn.datatables.net/plug-ins/1.11.3/i18n/{{config("SETTINGS::LOCALE:DATATABLES")}}.json'
url: '//cdn.datatables.net/plug-ins/1.11.3/i18n/{{ config('SETTINGS::LOCALE:DATATABLES') }}.json'
},
processing: true,
serverSide: true,
stateSave: true,
ajax: "{{route('admin.servers.datatable')}}{{$filter ?? ''}}",
order: [[ 5, "desc" ]],
columns: [
{data: 'status' , name : 'servers.suspended'},
{data: 'name'},
{data: 'user' , name : 'user.name'},
{data: 'identifier'},
{data: 'resources' , name : 'product.name'},
{data: 'suspended'},
{data: 'created_at'},
{data: 'actions' , sortable : false},
ajax: "{{ route('admin.servers.datatable') }}{{ $filter ?? '' }}",
order: [
[6, "desc"]
],
fnDrawCallback: function( oSettings ) {
columns: [{
data: 'status',
name: 'servers.suspended',
sortable: false
},
{
data: 'name'
},
{
data: 'user',
name: 'user.name',
},
{
data: 'identifier'
},
{
data: 'resources',
name: 'product.name',
sortable: false
},
{
data: 'suspended'
},
{
data: 'created_at'
},
{
data: 'actions',
sortable: false
},
],
fnDrawCallback: function(oSettings) {
$('[data-toggle="popover"]').popover();
}
});

View file

@ -102,10 +102,12 @@
data: 'price'
},
{
data: 'display'
data: 'display',
sortable: false
},
{
data: 'description'
data: 'description',
sortable: false
},
{
data: 'created_at'
@ -121,7 +123,4 @@
});
});
</script>
@endsection

View file

@ -6,12 +6,13 @@
<div class="container-fluid">
<div class="row mb-2">
<div class="col-sm-6">
<h1>{{__('Users')}}</h1>
<h1>{{ __('Users') }}</h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="{{route('home')}}">{{__('Dashboard')}}</a></li>
<li class="breadcrumb-item"><a class="text-muted" href="{{route('admin.users.index')}}">{{__('Users')}}</a></li>
<li class="breadcrumb-item"><a href="{{ route('home') }}">{{ __('Dashboard') }}</a></li>
<li class="breadcrumb-item"><a class="text-muted"
href="{{ route('admin.users.index') }}">{{ __('Users') }}</a></li>
</ol>
</div>
</div>
@ -27,9 +28,9 @@
<div class="card-header">
<div class="d-flex justify-content-between">
<h5 class="card-title"><i class="fas fa-users mr-2"></i>{{__('Users')}}</h5>
<a href="{{route('admin.users.notifications')}}" class="btn btn-sm btn-primary"><i
class="fas fa-paper-plane mr-1"></i>{{__('Notify')}}</a>
<h5 class="card-title"><i class="fas fa-users mr-2"></i>{{ __('Users') }}</h5>
<a href="{{ route('admin.users.notifications') }}" class="btn btn-sm btn-primary"><i
class="fas fa-paper-plane mr-1"></i>{{ __('Notify') }}</a>
</div>
</div>
@ -37,21 +38,21 @@
<table id="datatable" class="table table-striped">
<thead>
<tr>
<th>discordId</th>
<th>ip</th>
<th>pterodactyl_id</th>
<th>{{__('Avatar')}}</th>
<th>{{__('Name')}}</th>
<th>{{__('Role')}}</th>
<th>{{__('Email')}}</th>
<th>{{CREDITS_DISPLAY_NAME}}</th>
<th>{{__('Servers')}}</th>
<th>{{__("Referrals")}}</th>
<th>{{__('Verified')}}</th>
<th>{{__('Last seen')}}</th>
<th></th>
</tr>
<tr>
<th>discordId</th>
<th>ip</th>
<th>pterodactyl_id</th>
<th>{{ __('Avatar') }}</th>
<th>{{ __('Name') }}</th>
<th>{{ __('Role') }}</th>
<th>{{ __('Email') }}</th>
<th>{{ CREDITS_DISPLAY_NAME }}</th>
<th>{{ __('Servers') }}</th>
<th>{{ __('Referrals') }}</th>
<th>{{ __('Verified') }}</th>
<th>{{ __('Last seen') }}</th>
<th></th>
</tr>
</thead>
<tbody>
</tbody>
@ -68,41 +69,75 @@
<script>
function submitResult() {
return confirm("{{__('Are you sure you wish to delete?')}}") !== false;
return confirm("{{ __('Are you sure you wish to delete?') }}") !== false;
}
document.addEventListener("DOMContentLoaded", function () {
document.addEventListener("DOMContentLoaded", function() {
$('#datatable').DataTable({
language: {
url: '//cdn.datatables.net/plug-ins/1.11.3/i18n/{{config("SETTINGS::LOCALE:DATATABLES")}}.json'
url: '//cdn.datatables.net/plug-ins/1.11.3/i18n/{{ config('SETTINGS::LOCALE:DATATABLES') }}.json'
},
processing: true,
serverSide: true, //why was this set to false before? increased loadingtimes by 10 seconds
stateSave: true,
ajax: "{{route('admin.users.datatable')}}",
order: [[ 11, "asc" ]],
columns: [
{data: 'discordId', visible: false, name: 'discordUser.id'},
{data: 'pterodactyl_id', visible: false},
{data: 'ip', visible: false},
{data: 'avatar' , sortable : false},
{data: 'name'},
{data: 'role'},
{data: 'email', name: 'users.email'},
{data: 'credits' , name : 'users.credits'},
{data: 'servers'},
{data: 'referrals'},
{data: 'verified' , sortable : false},
{data: 'last_seen', type: 'num', render: {_: 'display', sort: 'raw'}},
{data: 'actions' , sortable : false},
ajax: "{{ route('admin.users.datatable') }}{{ $filter ?? '' }}",
order: [
[11, "desc"]
],
fnDrawCallback: function( oSettings ) {
columns: [{
data: 'discordId',
visible: false,
name: 'discordUser.id'
},
{
data: 'pterodactyl_id',
visible: false
},
{
data: 'ip',
visible: false
},
{
data: 'avatar',
sortable: false
},
{
data: 'name'
},
{
data: 'role'
},
{
data: 'email',
name: 'users.email'
},
{
data: 'credits',
name: 'users.credits'
},
{
data: 'servers_count'
},
{
data: 'referrals_count',
},
{
data: 'verified',
sortable: false
},
{
data: 'last_seen',
},
{
data: 'actions',
sortable: false
},
],
fnDrawCallback: function(oSettings) {
$('[data-toggle="popover"]').popover();
}
});
});
</script>
@endsection

View file

@ -44,6 +44,9 @@
@case("Open")
<span class="badge badge-success">{{__("Open")}}</span>
@break
@case("Reopened")
<span class="badge badge-success">{{__("Reopened")}}</span>
@break
@case("Closed")
<span class="badge badge-danger">{{__("Closed")}}</span>
@break
@ -61,21 +64,35 @@
<span class="badge badge-success">{{__("Low")}}</span>
@break
@case("Medium")
<span class="badge badge-warning">{{__("Closed")}}</span>
<span class="badge badge-warning">{{__("Medium")}}</span>
@break
@case("High")
<span class="badge badge-danger">{{__("Answered")}}</span>
<span class="badge badge-danger">{{__("High")}}</span>
@break
@endswitch
</p>
<p><b>{{__("Created on")}}:</b> {{ $ticket->created_at->diffForHumans() }}</p>
@if($ticket->status!='Closed')
<form class="d-inline" method="post" action="{{route('moderator.ticket.close', ['ticket_id' => $ticket->ticket_id ])}}">
{{csrf_field()}}
{{method_field("POST") }}
<button data-content="{{__("Close")}}" data-toggle="popover" data-trigger="hover" data-placement="top" class="btn btn-sm text-white btn-warning mr-1"><i class="fas fa-times"></i>{{__("Close")}}</button>
</form>
@endif
@if($ticket->status=='Closed')
<form class="d-inline" method="post"
action="{{route('moderator.ticket.changeStatus', ['ticket_id' => $ticket->ticket_id ])}}">
{{csrf_field()}}
{{method_field("POST") }}
<button data-content="{{__("Reopen")}}" data-toggle="popover"
data-trigger="hover" data-placement="top"
class="btn btn-sm text-white btn-success mr-1"><i
class="fas fa-redo"></i>{{__("Reopen")}}</button>
</form>
@else
<form class="d-inline" method="post"
action="{{route('moderator.ticket.changeStatus', ['ticket_id' => $ticket->ticket_id ])}}">
{{csrf_field()}}
{{method_field("POST") }}
<button data-content="{{__("Close")}}" data-toggle="popover"
data-trigger="hover" data-placement="top"
class="btn btn-sm text-white btn-warning mr-1"><i
class="fas fa-times"></i>{{__("Close")}}</button>
</form>
@endif
</div>
</div>
</div>

View file

@ -35,43 +35,58 @@
<div class="card-body">
<div class="ticket-info">
@if(!empty($server))
<p><b>{{__("Server")}}:</b> <a href="{{ config('SETTINGS::SYSTEM:PTERODACTYL:URL') }}/server/{{ $server->identifier }}" target="__blank">{{ $server->name }} </a></p>
<p><b>{{__("Server")}}:</b> <a
href="{{ config('SETTINGS::SYSTEM:PTERODACTYL:URL') }}/server/{{ $server->identifier }}"
target="__blank">{{ $server->name }} </a></p>
@endif
<p><b>{{__("Title")}}:</b> {{ $ticket->title }}</p>
<p><b>{{__("Category")}}:</b> {{ $ticketcategory->name }}</p>
<p><b>{{__("Status")}}:</b>
@switch($ticket->status)
@case("Open")
<span class="badge badge-success">{{__("Open")}}</span>
@break
@case("Closed")
<span class="badge badge-danger">{{__("Closed")}}</span>
@break
@case("Answered")
<span class="badge badge-info">{{__("Answered")}}</span>
@break
@case("Client Reply")
<span class="badge badge-warning">{{__("Client Reply")}}</span>
@break
@endswitch
</p>
<p><b>Priority:</b>
@switch($ticket->priority)
@case("Low")
<span class="badge badge-success">{{__("Low")}}</span>
@break
@case("Medium")
<span class="badge badge-warning">{{__("Closed")}}</span>
@break
@case("High")
<span class="badge badge-danger">{{__("Answered")}}</span>
@break
@endswitch
</p>
<p><b>{{__("Title")}}:</b> {{ $ticket->title }}</p>
<p><b>{{__("Category")}}:</b> {{ $ticketcategory->name }}</p>
<p><b>{{__("Status")}}:</b>
@switch($ticket->status)
@case("Open")
<span class="badge badge-success">{{__("Open")}}</span>
@break
@case("Reopened")
<span class="badge badge-success">{{__("Reopened")}}</span>
@break
@case("Closed")
<span class="badge badge-danger">{{__("Closed")}}</span>
@break
@case("Answered")
<span class="badge badge-info">{{__("Answered")}}</span>
@break
@case("Client Reply")
<span class="badge badge-warning">{{__("Client Reply")}}</span>
@break
@endswitch
</p>
<p><b>Priority:</b>
@switch($ticket->priority)
@case("Low")
<span class="badge badge-success">{{__("Low")}}</span>
@break
@case("Medium")
<span class="badge badge-warning">{{__("Medium")}}</span>
@break
@case("High")
<span class="badge badge-danger">{{__("High")}}</span>
@break
@endswitch
</p>
<p><b>{{__("Created on")}}:</b> {{ $ticket->created_at->diffForHumans() }}</p>
@if($ticket->status!='Closed')
@if($ticket->status=='Closed')
<form class="d-inline" method="post"
action="{{route('ticket.close', ['ticket_id' => $ticket->ticket_id ])}}">
action="{{route('ticket.changeStatus', ['ticket_id' => $ticket->ticket_id ])}}">
{{csrf_field()}}
{{method_field("POST") }}
<button data-content="{{__("Reopen")}}" data-toggle="popover"
data-trigger="hover" data-placement="top"
class="btn btn-sm text-white btn-success mr-1"><i
class="fas fa-redo"></i>{{__("Reopen")}}</button>
</form>
@else
<form class="d-inline" method="post"
action="{{route('ticket.changeStatus', ['ticket_id' => $ticket->ticket_id ])}}">
{{csrf_field()}}
{{method_field("POST") }}
<button data-content="{{__("Close")}}" data-toggle="popover"
@ -96,56 +111,60 @@
<div class="card-header">
<div class="d-flex justify-content-between">
<h5 class="card-title"><img
src="https://www.gravatar.com/avatar/{{ md5(strtolower($ticket->user->email)) }}?s=25"
class="user-image" alt="User Image">
<a href="/admin/users/{{$ticket->user->id}}">{{ $ticket->user->name }} </a>
@if($ticket->user->role === "member")
<span class="badge badge-secondary"> Member </span>
@elseif ($ticket->user->role === "client")
<span class="badge badge-success"> Client </span>
@elseif ($ticket->user->role === "moderator")
<span class="badge badge-info"> Moderator </span>
@elseif ($ticket->user->role === "admin")
<span class="badge badge-danger"> Admin </span>
@endif
src="https://www.gravatar.com/avatar/{{ md5(strtolower($ticket->user->email)) }}?s=25"
class="user-image" alt="User Image">
<a href="/admin/users/{{$ticket->user->id}}">{{ $ticket->user->name }} </a>
@if($ticket->user->role === "member")
<span class="badge badge-secondary"> Member </span>
@elseif ($ticket->user->role === "client")
<span class="badge badge-success"> Client </span>
@elseif ($ticket->user->role === "moderator")
<span class="badge badge-info"> Moderator </span>
@elseif ($ticket->user->role === "admin")
<span class="badge badge-danger"> Admin </span>
@endif
</h5>
<span class="badge badge-primary">{{ $ticket->created_at->diffForHumans() }}</span>
<span
class="badge badge-primary">{{ $ticket->created_at->diffForHumans() }}</span>
</div>
</div>
<div class="card-body" style="white-space:pre-wrap">{{ $ticket->message }}</div>
</div>
@foreach ($ticketcomments as $ticketcomment)
<div class="card">
<div class="card-header">
<div class="d-flex justify-content-between">
<h5 class="card-title"><img
src="https://www.gravatar.com/avatar/{{ md5(strtolower($ticketcomment->user->email)) }}?s=25"
class="user-image" alt="User Image">
<a href="/admin/users/{{$ticketcomment->user->id}}">{{ $ticketcomment->user->name }}</a>
@if($ticketcomment->user->role === "member")
<span class="badge badge-secondary"> Member </span>
@elseif ($ticketcomment->user->role === "client")
<span class="badge badge-success"> Client </span>
@elseif ($ticketcomment->user->role === "moderator")
<span class="badge badge-info"> Moderator </span>
@elseif ($ticketcomment->user->role === "admin")
<span class="badge badge-danger"> Admin </span>
@endif
</h5>
<span class="badge badge-primary">{{ $ticketcomment->created_at->diffForHumans() }}</span>
<div class="card">
<div class="card-header">
<div class="d-flex justify-content-between">
<h5 class="card-title"><img
src="https://www.gravatar.com/avatar/{{ md5(strtolower($ticketcomment->user->email)) }}?s=25"
class="user-image" alt="User Image">
<a href="/admin/users/{{$ticketcomment->user->id}}">{{ $ticketcomment->user->name }}</a>
@if($ticketcomment->user->role === "member")
<span class="badge badge-secondary"> Member </span>
@elseif ($ticketcomment->user->role === "client")
<span class="badge badge-success"> Client </span>
@elseif ($ticketcomment->user->role === "moderator")
<span class="badge badge-info"> Moderator </span>
@elseif ($ticketcomment->user->role === "admin")
<span class="badge badge-danger"> Admin </span>
@endif
</h5>
<span
class="badge badge-primary">{{ $ticketcomment->created_at->diffForHumans() }}</span>
</div>
</div>
<div class="card-body"
style="white-space:pre-wrap">{{ $ticketcomment->ticketcomment }}</div>
</div>
<div class="card-body" style="white-space:pre-wrap">{{ $ticketcomment->ticketcomment }}</div>
</div>
@endforeach
<div class="comment-form">
<form action="{{ route('ticket.reply')}}" method="POST" class="form reply-form">
{!! csrf_field() !!}
<input type="hidden" name="ticket_id" value="{{ $ticket->id }}">
<div class="form-group{{ $errors->has('ticketcomment') ? ' has-error' : '' }}">
<textarea rows="10" id="ticketcomment" class="form-control" name="ticketcomment"></textarea>
<textarea rows="10" id="ticketcomment" class="form-control"
name="ticketcomment"></textarea>
@if ($errors->has('ticketcomment'))
<span class="help-block">
<span class="help-block">
<strong>{{ $errors->first('ticketcomment') }}</strong>
</span>
@endif