commit
3143fab29e
|
@ -117,7 +117,7 @@ class TicketsController extends Controller
|
|||
}
|
||||
|
||||
public function blacklist() {
|
||||
$users = User::get();
|
||||
$users = User::paginate();
|
||||
$ticketcategories = TicketCategory::all();
|
||||
return view("moderator.ticket.blacklist", compact("users", "ticketcategories"));
|
||||
}
|
||||
|
@ -126,7 +126,11 @@ class TicketsController extends Controller
|
|||
$user = User::where('id', $request->user_id)->first();
|
||||
$check = TicketBlacklist::where('user_id', $user->id)->first();
|
||||
if($check){
|
||||
return redirect()->back()->with('error', __('Target User already in blacklist'));
|
||||
$check->reason = $request->reason;
|
||||
$check->status = "True";
|
||||
$check->save();
|
||||
|
||||
return redirect()->back()->with('info', __('Target User already in blacklist. Reason updated'));
|
||||
}
|
||||
TicketBlacklist::create(array(
|
||||
"user_id" => $user->id,
|
||||
|
@ -136,6 +140,7 @@ class TicketsController extends Controller
|
|||
return redirect()->back()->with('success', __('Successfully add User to blacklist, User name: ' . $user->name));
|
||||
}
|
||||
|
||||
|
||||
public function blacklistDelete($id) {
|
||||
$blacklist = TicketBlacklist::where('id', $id)->first();
|
||||
$blacklist->delete();
|
||||
|
@ -166,14 +171,16 @@ class TicketsController extends Controller
|
|||
->editColumn('status', function (TicketBlacklist $blacklist) {
|
||||
switch ($blacklist->status) {
|
||||
case 'True':
|
||||
$badgeColor = 'badge-success';
|
||||
$text = "Blocked";
|
||||
$badgeColor = 'badge-danger';
|
||||
break;
|
||||
default:
|
||||
$badgeColor = 'badge-danger';
|
||||
$text = "Unblocked";
|
||||
$badgeColor = 'badge-success';
|
||||
break;
|
||||
}
|
||||
|
||||
return '<span class="badge ' . $badgeColor . '">' . $blacklist->status . '</span>';
|
||||
return '<span class="badge ' . $badgeColor . '">' . $text . '</span>';
|
||||
})
|
||||
->editColumn('reason', function (TicketBlacklist $blacklist) {
|
||||
return $blacklist->reason;
|
||||
|
|
|
@ -245,8 +245,8 @@
|
|||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="{{ route('moderator.ticket.blacklist') }}" class="nav-link @if (Request::routeIs('moderator.ticket.blacklist')) active @endif">
|
||||
<i class="nav-icon fas fa-user"></i>
|
||||
<p>{{ __('Black List') }}</p>
|
||||
<i class="nav-icon fas fa-user-times"></i>
|
||||
<p>{{ __('Ticket Blacklist') }}</p>
|
||||
</a>
|
||||
</li>
|
||||
@endif
|
||||
|
@ -467,6 +467,22 @@
|
|||
}
|
||||
})
|
||||
@endif
|
||||
@if (Session::has('info'))
|
||||
Swal.fire({
|
||||
icon: 'info',
|
||||
title: '{{ Session::get('info') }}',
|
||||
position: 'top-end',
|
||||
showConfirmButton: false,
|
||||
background: '#343a40',
|
||||
toast: true,
|
||||
timer: 3000,
|
||||
timerProgressBar: true,
|
||||
didOpen: (toast) => {
|
||||
toast.addEventListener('mouseenter', Swal.stopTimer)
|
||||
toast.addEventListener('mouseleave', Swal.resumeTimer)
|
||||
}
|
||||
})
|
||||
@endif
|
||||
</script>
|
||||
</body>
|
||||
|
||||
|
|
|
@ -75,8 +75,8 @@
|
|||
</select>
|
||||
</div>
|
||||
<div class="form-group ">
|
||||
<label for="reason" class="control-label">Reason</label>
|
||||
<input id="reason" type="text" class="form-control" name="reason" placeholder="Input Some Reason">
|
||||
<label for="reason" class="control-label">{{__("Reason")}}</label>
|
||||
<input id="reason" type="text" class="form-control" name="reason" placeholder="Input Some Reason" required>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary ticket-once">
|
||||
{{__('Submit')}}
|
||||
|
|
Loading…
Reference in a new issue