瀏覽代碼

spelling. Reason updating.

1Day 2 年之前
父節點
當前提交
7e822be443

+ 15 - 8
app/Http/Controllers/Moderation/TicketsController.php

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

+ 18 - 2
resources/views/layouts/main.blade.php

@@ -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>
-                                    <p>{{ __('Black List') }}</p>
+                                    <i class="nav-icon fas fa-user-times"></i>
+                                    <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>
 
 

+ 2 - 2
resources/views/moderator/ticket/blacklist.blade.php

@@ -75,8 +75,8 @@
                                     </select>
                                     </select>
                                 </div>
                                 </div>
                                 <div class="form-group ">
                                 <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>
                                 </div>
                                 <button type="submit" class="btn btn-primary ticket-once">
                                 <button type="submit" class="btn btn-primary ticket-once">
                                     {{__('Submit')}}
                                     {{__('Submit')}}