index.blade.php 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. @extends('admin.table_layouts')
  2. @section('content')
  3. <div class="page-content container-fluid">
  4. <div class="panel">
  5. <div class="panel-heading">
  6. <h2 class="panel-title">{{ trans('admin.menu.rule.group') }}</h2>
  7. @can('admin.rule.group.create')
  8. <div class="panel-actions">
  9. <a class="btn btn-outline-primary" href="{{ route('admin.rule.group.create') }}">
  10. <i class="icon wb-plus" aria-hidden="true"></i> {{ trans('common.add') }}
  11. </a>
  12. </div>
  13. @endcan
  14. </div>
  15. <div class="panel-body">
  16. <table class="text-md-center" data-toggle="table" data-mobile-responsive="true">
  17. <thead class="thead-default">
  18. <tr>
  19. <th> #</th>
  20. <th> {{ trans('model.rule_group.name') }}</th>
  21. <th> {{ trans('model.rule_group.type') }}</th>
  22. <th> {{ trans('common.action') }}</th>
  23. </tr>
  24. </thead>
  25. <tbody>
  26. @foreach ($ruleGroups as $ruleGroup)
  27. <tr>
  28. <td> {{ $ruleGroup->id }} </td>
  29. <td> {{ $ruleGroup->name }} </td>
  30. <td> {!! $ruleGroup->type_label !!} </td>
  31. <td>
  32. @canany(['admin.rule.group.edit', 'admin.rule.group.destroy'])
  33. <div class="btn-group">
  34. @can('admin.rule.group.edit')
  35. <a class="btn btn-sm btn-outline-primary" href="{{ route('admin.rule.group.edit', $ruleGroup) }}">
  36. <i class="icon wb-edit"></i> {{ trans('common.edit') }}
  37. </a>
  38. @endcan
  39. @can('admin.rule.group.destroy')
  40. <button class="btn btn-sm btn-outline-danger"
  41. onclick="delRuleGroup('{{ route('admin.rule.group.destroy', $ruleGroup) }}', '{{ $ruleGroup->name }}')">
  42. <i class="icon wb-trash"></i> {{ trans('common.delete') }}
  43. </button>
  44. @endcan
  45. </div>
  46. @endcanany
  47. </td>
  48. </tr>
  49. @endforeach
  50. </tbody>
  51. </table>
  52. </div>
  53. <div class="panel-footer">
  54. <div class="row">
  55. <div class="col-sm-4">
  56. {!! trans('admin.rule.group.counts', ['num' => $ruleGroups->total()]) !!}
  57. </div>
  58. <div class="col-sm-8">
  59. <nav class="Page navigation float-right">
  60. {{ $ruleGroups->links() }}
  61. </nav>
  62. </div>
  63. </div>
  64. </div>
  65. </div>
  66. </div>
  67. @endsection
  68. @push('javascript')
  69. @can('admin.rule.group.destroy')
  70. <script>
  71. // 删除规则分组
  72. function delRuleGroup(url, name) {
  73. swal.fire({
  74. title: '{{ trans('common.warning') }}',
  75. text: '{{ trans('admin.confirm.delete.0', ['attribute' => trans('model.rule_group.attribute')]) }}' +
  76. name + '{{ trans('admin.confirm.delete.1') }}',
  77. icon: "warning",
  78. showCancelButton: true,
  79. cancelButtonText: '{{ trans('common.close') }}',
  80. confirmButtonText: '{{ trans('common.confirm') }}'
  81. }).then((result) => {
  82. if (result.value) {
  83. $.ajax({
  84. method: "DELETE",
  85. url: url,
  86. data: {
  87. _token: '{{ csrf_token() }}'
  88. },
  89. dataType: "json",
  90. success: function(ret) {
  91. if (ret.status === "success") {
  92. swal.fire({
  93. title: ret.message,
  94. icon: "success",
  95. timer: 1000,
  96. showConfirmButton: false
  97. }).then(() => window.location.reload());
  98. } else {
  99. swal.fire({
  100. title: ret.message,
  101. icon: "error"
  102. }).then(() => window.location.reload());
  103. }
  104. }
  105. });
  106. }
  107. });
  108. }
  109. </script>
  110. @endcan
  111. @endpush