labelList.blade.php 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. @extends('admin.layouts')
  2. @section('css')
  3. <link href="/assets/global/plugins/datatables/datatables.min.css" rel="stylesheet" type="text/css" />
  4. <link href="/assets/global/plugins/datatables/plugins/bootstrap/datatables.bootstrap.css" rel="stylesheet" type="text/css" />
  5. @endsection
  6. @section('content')
  7. <!-- BEGIN CONTENT BODY -->
  8. <div class="page-content" style="padding-top:0;">
  9. <!-- BEGIN PAGE BASE CONTENT -->
  10. <div class="row">
  11. <div class="col-md-12">
  12. <!-- BEGIN EXAMPLE TABLE PORTLET-->
  13. <div class="portlet light bordered">
  14. <div class="portlet-title">
  15. <div class="caption font-dark">
  16. <span class="caption-subject bold uppercase"> 标签列表 </span>
  17. <small>标签影响用户查看/订阅节点信息(用户和节点通过标签进行关联)</small>
  18. </div>
  19. <div class="actions">
  20. <div class="btn-group">
  21. <button class="btn sbold blue" onclick="addLabel()"> 添加标签 </button>
  22. </div>
  23. </div>
  24. </div>
  25. <div class="portlet-body">
  26. <div class="table-scrollable table-scrollable-borderless">
  27. <table class="table table-hover table-light">
  28. <thead>
  29. <tr>
  30. <th> # </th>
  31. <th> 名称 </th>
  32. <th> 关联用户数 </th>
  33. <th> 关联节点数 </th>
  34. <th> 排序 </th>
  35. <th style="text-align: center;"> 操作 </th>
  36. </tr>
  37. </thead>
  38. <tbody>
  39. @if($labelList->isEmpty())
  40. <tr>
  41. <td colspan="6" style="text-align: center;">暂无数据</td>
  42. </tr>
  43. @else
  44. @foreach($labelList as $label)
  45. <tr class="odd gradeX">
  46. <td> {{$label->id}} </td>
  47. <td> {{$label->name}} </td>
  48. <td> {{$label->userCount}} </td>
  49. <td> {{$label->nodeCount}} </td>
  50. <td> {{$label->sort}} </td>
  51. <td style="text-align: center;">
  52. <button type="button" class="btn btn-sm blue btn-outline" onclick="editLabel('{{$label->id}}')"> 编辑 </button>
  53. <button type="button" class="btn btn-sm red btn-outline" onclick="delLabel('{{$label->id}}')"> 删除 </button>
  54. </td>
  55. </tr>
  56. @endforeach
  57. @endif
  58. </tbody>
  59. </table>
  60. </div>
  61. <div class="row">
  62. <div class="col-md-4 col-sm-4">
  63. <div class="dataTables_info" role="status" aria-live="polite">共 {{$labelList->total()}} 个标签</div>
  64. </div>
  65. <div class="col-md-8 col-sm-8">
  66. <div class="dataTables_paginate paging_bootstrap_full_number pull-right">
  67. {{ $labelList->links() }}
  68. </div>
  69. </div>
  70. </div>
  71. </div>
  72. </div>
  73. <!-- END EXAMPLE TABLE PORTLET-->
  74. </div>
  75. </div>
  76. <!-- END PAGE BASE CONTENT -->
  77. </div>
  78. <!-- END CONTENT BODY -->
  79. @endsection
  80. @section('script')
  81. <script type="text/javascript">
  82. // 添加标签
  83. function addLabel() {
  84. window.location.href = '{{url('admin/addLabel')}}';
  85. }
  86. // 编辑标签
  87. function editLabel(id) {
  88. window.location.href = '{{url('admin/editLabel?id=')}}' + id + '&page=' + '{{Request::get('page', 1)}}';
  89. }
  90. // 删除标签
  91. function delLabel(id) {
  92. layer.confirm('确定删除标签?', {icon: 2, title:'警告'}, function(index) {
  93. $.post("{{url('admin/delLabel')}}", {id:id, _token:'{{csrf_token()}}'}, function(ret) {
  94. layer.msg(ret.message, {time:1000}, function() {
  95. if (ret.status == 'success') {
  96. window.location.reload();
  97. }
  98. });
  99. });
  100. layer.close(index);
  101. });
  102. }
  103. </script>
  104. @endsection