index.blade.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. @extends('admin.layouts')
  2. @section('css')
  3. <link href="/assets/global/vendor/bootstrap-table/bootstrap-table.min.css" type="text/css" rel="stylesheet">
  4. @endsection
  5. @section('content')
  6. <div class="page-content container-fluid">
  7. <div class="panel">
  8. <div class="panel-heading">
  9. <h2 class="panel-title">用户分组控制<small>(同一节点可分配至多个分组,一个用户只能属于一个分组;对于用户可见/可用节点:先按分组后按等级)</small></h2>
  10. <div class="panel-actions">
  11. <a class="btn btn-primary" href="{{route('admin.user.group.create')}}">
  12. <i class="icon wb-plus" aria-hidden="true"></i>添加分组
  13. </a>
  14. </div>
  15. </div>
  16. <div class="panel-body">
  17. <table class="text-md-center" data-toggle="table" data-mobile-responsive="true">
  18. <thead class="thead-default">
  19. <tr>
  20. <th> #</th>
  21. <th> 分组名称</th>
  22. <th> 操作</th>
  23. </tr>
  24. </thead>
  25. <tbody>
  26. @foreach ($list as $vo)
  27. <tr>
  28. <td> {{$vo->id}} </td>
  29. <td> {{$vo->name}} </td>
  30. <td>
  31. <div class="btn-group">
  32. <a href="{{route('admin.user.group.edit',$vo->id)}}" class="btn btn-primary">
  33. <i class="icon wb-edit" aria-hidden="true"></i>
  34. </a>
  35. <button onclick="deleteUserGroup('{{route('admin.user.group.destroy',$vo->id)}}')" class="btn btn-danger">
  36. <i class="icon wb-trash" aria-hidden="true"></i>
  37. </button>
  38. </div>
  39. </td>
  40. </tr>
  41. @endforeach
  42. </tbody>
  43. </table>
  44. </div>
  45. <div class="panel-footer">
  46. <div class="row">
  47. <div class="col-sm-4">
  48. 共 <code>{{$list->total()}}</code> 个分组
  49. </div>
  50. <div class="col-sm-8">
  51. <nav class="Page navigation float-right">
  52. {{$list->links()}}
  53. </nav>
  54. </div>
  55. </div>
  56. </div>
  57. </div>
  58. </div>
  59. @endsection
  60. @section('script')
  61. <script src="/assets/global/vendor/bootstrap-table/bootstrap-table.min.js" type="text/javascript"></script>
  62. <script src="/assets/global/vendor/bootstrap-table/extensions/mobile/bootstrap-table-mobile.min.js" type="text/javascript"></script>
  63. <script type="text/javascript">
  64. // 删除用户分组
  65. function deleteUserGroup(url) {
  66. swal.fire({
  67. title: '提示',
  68. text: '确定删除该分组吗?',
  69. icon: 'info',
  70. showCancelButton: true,
  71. cancelButtonText: '{{trans('home.ticket_close')}}',
  72. confirmButtonText: '{{trans('home.ticket_confirm')}}',
  73. }).then((result) => {
  74. if (result.value) {
  75. $.ajax({
  76. method: 'DELETE',
  77. url: url,
  78. data: {_token: '{{csrf_token()}}'},
  79. dataType: 'json',
  80. success: function (ret) {
  81. if (ret.status === 'success') {
  82. swal.fire({title: ret.message, icon: 'success', timer: 1000, showConfirmButton: false}).then(() => window.location.reload());
  83. } else {
  84. swal.fire({title: ret.message, icon: 'error'}).then(() => window.location.reload());
  85. }
  86. },
  87. });
  88. }
  89. });
  90. }
  91. </script>
  92. @endsection