Bladeren bron

close button on ticket index

1day2die 2 jaren geleden
bovenliggende
commit
ca4309c131
2 gewijzigde bestanden met toevoegingen van 15 en 1 verwijderingen
  1. 13 1
      app/Http/Controllers/TicketsController.php
  2. 2 0
      themes/default/views/ticket/index.blade.php

+ 13 - 1
app/Http/Controllers/TicketsController.php

@@ -143,7 +143,19 @@ class TicketsController extends Controller
             ->editColumn('updated_at', function (Ticket $tickets) {
                 return $tickets->updated_at ? $tickets->updated_at->diffForHumans() : '';
             })
-            ->rawColumns(['category', 'title', 'status', 'updated_at'])
+            ->addColumn('actions', function (Ticket $tickets) {
+                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('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>
+                            </form>
+
+                            </form>
+                ';
+            })
+            ->rawColumns(['category', 'title', 'status', 'updated_at', "actions"])
             ->make(true);
     }
 }

+ 2 - 0
themes/default/views/ticket/index.blade.php

@@ -44,6 +44,7 @@
                                     <th>{{__('Priority')}}</th>
                                     <th>{{__('Status')}}</th>
                                     <th>{{__('Last Updated')}}</th>
+                                    <th>{{__('Actions')}}</th>
                                 </tr>
                                 </thead>
                                 <tbody>
@@ -88,6 +89,7 @@
                     {data: 'priority'},
                     {data: 'status'},
                     {data: 'updated_at', sortable: false},
+                    {data: 'actions', sortable: false},
                 ],
                 fnDrawCallback: function( oSettings ) {
                     $('[data-toggle="popover"]').popover();