commit
3143fab29e
|
@ -117,7 +117,7 @@ class TicketsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
public function blacklist() {
|
public function blacklist() {
|
||||||
$users = User::get();
|
$users = User::paginate();
|
||||||
$ticketcategories = TicketCategory::all();
|
$ticketcategories = TicketCategory::all();
|
||||||
return view("moderator.ticket.blacklist", compact("users", "ticketcategories"));
|
return view("moderator.ticket.blacklist", compact("users", "ticketcategories"));
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,11 @@ class TicketsController extends Controller
|
||||||
$user = User::where('id', $request->user_id)->first();
|
$user = User::where('id', $request->user_id)->first();
|
||||||
$check = TicketBlacklist::where('user_id', $user->id)->first();
|
$check = TicketBlacklist::where('user_id', $user->id)->first();
|
||||||
if($check){
|
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(
|
TicketBlacklist::create(array(
|
||||||
"user_id" => $user->id,
|
"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));
|
return redirect()->back()->with('success', __('Successfully add User to blacklist, User name: ' . $user->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function blacklistDelete($id) {
|
public function blacklistDelete($id) {
|
||||||
$blacklist = TicketBlacklist::where('id', $id)->first();
|
$blacklist = TicketBlacklist::where('id', $id)->first();
|
||||||
$blacklist->delete();
|
$blacklist->delete();
|
||||||
|
@ -166,14 +171,16 @@ class TicketsController extends Controller
|
||||||
->editColumn('status', function (TicketBlacklist $blacklist) {
|
->editColumn('status', function (TicketBlacklist $blacklist) {
|
||||||
switch ($blacklist->status) {
|
switch ($blacklist->status) {
|
||||||
case 'True':
|
case 'True':
|
||||||
$badgeColor = 'badge-success';
|
$text = "Blocked";
|
||||||
|
$badgeColor = 'badge-danger';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$badgeColor = 'badge-danger';
|
$text = "Unblocked";
|
||||||
|
$badgeColor = 'badge-success';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return '<span class="badge ' . $badgeColor . '">' . $blacklist->status . '</span>';
|
return '<span class="badge ' . $badgeColor . '">' . $text . '</span>';
|
||||||
})
|
})
|
||||||
->editColumn('reason', function (TicketBlacklist $blacklist) {
|
->editColumn('reason', function (TicketBlacklist $blacklist) {
|
||||||
return $blacklist->reason;
|
return $blacklist->reason;
|
||||||
|
|
|
@ -245,8 +245,8 @@
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="{{ route('moderator.ticket.blacklist') }}" class="nav-link @if (Request::routeIs('moderator.ticket.blacklist')) active @endif">
|
<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>
|
<i class="nav-icon fas fa-user-times"></i>
|
||||||
<p>{{ __('Black List') }}</p>
|
<p>{{ __('Ticket Blacklist') }}</p>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
@endif
|
@endif
|
||||||
|
@ -467,6 +467,22 @@
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@endif
|
@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>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|
|
@ -75,8 +75,8 @@
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group ">
|
<div class="form-group ">
|
||||||
<label for="reason" class="control-label">Reason</label>
|
<label for="reason" class="control-label">{{__("Reason")}}</label>
|
||||||
<input id="reason" type="text" class="form-control" name="reason" placeholder="Input Some Reason">
|
<input id="reason" type="text" class="form-control" name="reason" placeholder="Input Some Reason" required>
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn btn-primary ticket-once">
|
<button type="submit" class="btn btn-primary ticket-once">
|
||||||
{{__('Submit')}}
|
{{__('Submit')}}
|
||||||
|
|
Loading…
Reference in a new issue