spelling. Reason updating.

This commit is contained in:
1Day 2022-08-12 11:59:20 +02:00
parent ce927744a2
commit 7e822be443
3 changed files with 35 additions and 12 deletions

View file

@ -95,7 +95,7 @@ class TicketsController extends Controller
switch ($tickets->status) {
case 'Open':
$badgeColor = 'badge-success';
break;
break;
case 'Closed':
$badgeColor = 'badge-danger';
break;
@ -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';
break;
default:
$text = "Blocked";
$badgeColor = 'badge-danger';
break;
default:
$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;
@ -198,5 +205,5 @@ class TicketsController extends Controller
->rawColumns(['user', 'status', 'reason', 'created_at', 'actions'])
->make(true);
}
}
}

View file

@ -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>

View file

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