labelList.blade.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. @extends('admin.layouts')
  2. @section('css')
  3. <link rel="stylesheet" href="/assets/global/vendor/bootstrap-table/bootstrap-table.min.css">
  4. @endsection
  5. @section('content')
  6. <div class="page-content container-fluid">
  7. <div class="panel">
  8. <div class="panel-heading">
  9. <h3 class="panel-title">标签列表
  10. <small>标签影响用户查看/订阅节点信息(用户和节点通过标签进行关联)</small>
  11. </h3>
  12. <div class="panel-actions">
  13. <button class="btn btn-primary" onclick="addLabel()"><i class="icon wb-plus"></i>添加标签</button>
  14. </div>
  15. </div>
  16. <div class="panel-body">
  17. <table class="text-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. <th> 关联节点数</th>
  24. <th> 排序</th>
  25. <th> 操作</th>
  26. </tr>
  27. </thead>
  28. <tbody>
  29. @if($labelList->isEmpty())
  30. <tr>
  31. <td colspan="6">暂无数据</td>
  32. </tr>
  33. @else
  34. @foreach($labelList as $label)
  35. <tr>
  36. <td> {{$label->id}} </td>
  37. <td> {{$label->name}} </td>
  38. <td> {{$label->userCount}} </td>
  39. <td> {{$label->nodeCount}} </td>
  40. <td> {{$label->sort}} </td>
  41. <td>
  42. <div class="btn-group">
  43. <button class="btn btn-primary" onclick="editLabel('{{$label->id}}')"><i class="icon wb-edit"></i></button>
  44. <button class="btn btn-danger" onclick="delLabel('{{$label->id}}')"><i class="icon wb-trash"></i></button>
  45. </div>
  46. </td>
  47. </tr>
  48. @endforeach
  49. @endif
  50. </tbody>
  51. </table>
  52. </div>
  53. <div class="panel-footer">
  54. <div class="row">
  55. <div class="col-sm-4">
  56. 共 {{$labelList->total()}} 个标签
  57. </div>
  58. <div class="col-sm-8">
  59. <nav class="Page navigation float-right">
  60. {{ $labelList->links() }}
  61. </nav>
  62. </div>
  63. </div>
  64. </div>
  65. </div>
  66. </div>
  67. @endsection
  68. @section('script')
  69. <script src="/assets/global/vendor/bootstrap-table/bootstrap-table.min.js"></script>
  70. <script src="/assets/global/vendor/bootstrap-table/extensions/mobile/bootstrap-table-mobile.min.js"></script>
  71. <script type="text/javascript">
  72. // 添加标签
  73. function addLabel() {
  74. window.location.href = '/admin/addLabel';
  75. }
  76. // 编辑标签
  77. function editLabel(id) {
  78. window.location.href = '/admin/editLabel?id=' + id + '&page={{Request::get('page', 1)}}';
  79. }
  80. // 删除标签
  81. function delLabel(id) {
  82. swal.fire({
  83. title: '警告',
  84. text: '确定删除标签?',
  85. type: 'warning',
  86. showCancelButton: true,
  87. cancelButtonText: '{{trans('home.ticket_close')}}',
  88. confirmButtonText: '{{trans('home.ticket_confirm')}}',
  89. }).then((result) => {
  90. if (result.value) {
  91. $.post("/admin/delLabel", {id: id, _token: '{{csrf_token()}}'}, function (ret) {
  92. if (ret.status === 'success') {
  93. swal.fire({title: ret.message, type: 'success', timer: 1000, showConfirmButton: false})
  94. .then(() => window.location.reload())
  95. } else {
  96. swal.fire({title: ret.message, type: "error"}).then(() => window.location.reload())
  97. }
  98. });
  99. }
  100. });
  101. }
  102. </script>
  103. @endsection