labelList.blade.php 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. <h3 class="panel-title">标签列表
  10. <small>标签影响用户查看/订阅节点信息(用户和节点通过标签进行关联)</small>
  11. </h3>
  12. <div class="panel-actions">
  13. <a href="/admin/addLabel" class="btn btn-primary"><i class="icon wb-plus"></i>添加标签</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. <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. <a href="/admin/editLabel?id={{$label->id}}&page={{Request::get('page', 1)}}" class="btn btn-primary"><i class="icon wb-edit"></i></a>
  44. <button class="btn btn-danger" onclick="delLabel('{{$label->id}}','{{$label->name}}')"><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. 共 <code>{{$labelList->total()}}</code> 个标签
  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" type="text/javascript"></script>
  70. <script src="/assets/global/vendor/bootstrap-table/extensions/mobile/bootstrap-table-mobile.min.js" type="text/javascript"></script>
  71. <script type="text/javascript">
  72. // 删除标签
  73. function delLabel(id, name) {
  74. swal.fire({
  75. title: '警告',
  76. text: '确定删除标签 【' + name + '】 ?',
  77. type: 'warning',
  78. showCancelButton: true,
  79. cancelButtonText: '{{trans('home.ticket_close')}}',
  80. confirmButtonText: '{{trans('home.ticket_confirm')}}',
  81. }).then((result) => {
  82. if (result.value) {
  83. $.post("/admin/delLabel", {id: id, _token: '{{csrf_token()}}'}, function (ret) {
  84. if (ret.status === 'success') {
  85. swal.fire({title: ret.message, type: 'success', timer: 1000, showConfirmButton: false})
  86. .then(() => window.location.reload())
  87. } else {
  88. swal.fire({title: ret.message, type: "error"}).then(() => window.location.reload())
  89. }
  90. });
  91. }
  92. });
  93. }
  94. </script>
  95. @endsection