log.blade.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. @extends('admin.table_layouts')
  2. @section('content')
  3. <div class="page-content container-fluid">
  4. <x-admin.table-panel :title="trans('admin.menu.rule.trigger')" :theads="[
  5. '#',
  6. 'UID',
  7. trans('model.user.username'),
  8. trans('model.node.attribute'),
  9. trans('admin.logs.rule.name'),
  10. trans('admin.logs.rule.reason'),
  11. trans('admin.logs.rule.created_at'),
  12. ]" :count="trans('admin.logs.counts', ['num' => $ruleLogs->total()])" :pagination="$ruleLogs->links()">
  13. @can('admin.rule.clear')
  14. <x-slot:actions>
  15. <button class="btn btn-outline-primary" onclick="clearLog()">
  16. <i class="icon wb-rubber" aria-hidden="true"></i>{{ trans('admin.logs.rule.clear_all') }}
  17. </button>
  18. </x-slot:actions>
  19. @endcan
  20. <x-slot:filters>
  21. <x-admin.filter.input class="col-xxl-1 col-lg-2 col-md-1 col-sm-4" name="user_id" type="number" :placeholder="trans('model.user.id')" />
  22. <x-admin.filter.input class="col-xxl-2 col-md-3 col-sm-4" name="username" :placeholder="trans('model.user.username')" />
  23. <x-admin.filter.selectpicker class="col-xxl-1 col-md-3 col-4" name="node_id" :title="trans('model.node.attribute')" :options="$nodes->mapWithKeys(fn($name, $id) => [$id => $id . ' - ' . $name])" />
  24. <x-admin.filter.selectpicker class="col-xxl-1 col-md-3 col-4" name="rule_id" :title="trans('model.rule.attribute')" :options="$rules" />
  25. </x-slot:filters>
  26. <x-slot:tbody>
  27. @foreach ($ruleLogs as $ruleLog)
  28. <tr>
  29. <td> {{ $ruleLog->id }} </td>
  30. <td> {{ $ruleLog->user->id ?? '【' . trans('common.deleted_item', ['attribute' => trans('common.account')]) . '】' }} </td>
  31. <td> {{ $ruleLog->user->username ?? '【' . trans('common.deleted_item', ['attribute' => trans('common.account')]) . '】' }} </td>
  32. <td> {{ empty($ruleLog->node) ? '【' . trans('common.deleted_item', ['attribute' => trans('model.node.attribute')]) . '】' : '【' . trans('model.node.attribute') . '#: ' . $ruleLog->node_id . '】' . $ruleLog->node->name }}
  33. </td>
  34. <td> {{ $ruleLog->rule_id ? '⛔ ' . ($ruleLog->rule->name ?? '【' . trans('common.deleted_item', ['attribute' => trans('model.rule.attribute')]) . '】') : trans('admin.logs.rule.tag') }}
  35. </td>
  36. <td> {{ $ruleLog->reason }} </td>
  37. <td> {{ $ruleLog->created_at }} </td>
  38. </tr>
  39. @endforeach
  40. </x-slot:tbody>
  41. </x-admin.table-panel>
  42. </div>
  43. @endsection
  44. @push('javascript')
  45. <script>
  46. @can('admin.rule.clear')
  47. // 清除所有记录
  48. function clearLog() {
  49. showConfirm({
  50. title: '{{ trans('common.warning') }}',
  51. text: '{{ trans('admin.logs.rule.clear_confirm') }}',
  52. icon: 'warning',
  53. onConfirm: function() {
  54. ajaxPost('{{ route('admin.rule.clear') }}');
  55. }
  56. });
  57. }
  58. @endcan
  59. </script>
  60. @endpush