index.blade.php 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. @extends('admin.layouts')
  2. @section('css')
  3. <link href="/assets/global/vendor/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
  4. <style>
  5. .table th a {
  6. color: #76838f;
  7. text-decoration: none;
  8. }
  9. </style>
  10. @endsection
  11. @section('content')
  12. <div class="page-content container-fluid">
  13. <div class="panel">
  14. <div class="panel-heading">
  15. <h3 class="panel-title">{{ trans('admin.menu.user.subscribe') }}</h3>
  16. </div>
  17. <div class="panel-body">
  18. <form class="form-row">
  19. <div class="form-group col-lg-1 col-sm-6">
  20. <input type="number" class="form-control" name="user_id" value="{{Request::query('user_id')}}" placeholder="{{ trans('model.user.id') }}"/>
  21. </div>
  22. <div class="form-group col-lg-3 col-sm-6">
  23. <input type="text" class="form-control" name="username" value="{{Request::query('username')}}" placeholder="{{ trans('model.user.username') }}"/>
  24. </div>
  25. <div class="form-group col-lg-3 col-sm-6">
  26. <input type="text" class="form-control" name="code" value="{{Request::query('code')}}" placeholder="{{ trans('model.subscribe.code') }}"/>
  27. </div>
  28. <div class="form-group col-lg-3 col-sm-6">
  29. <select name="status" id="status" class="form-control" onchange="this.form.submit()">
  30. <option value="" hidden>{{ trans('common.status.attribute') }}</option>
  31. <option value="0">{{ trans('common.status.banned') }}</option>
  32. <option value="1">{{ trans('common.status.normal') }}</option>
  33. </select>
  34. </div>
  35. <div class="form-group col-lg-2 col-sm-6 btn-group">
  36. <button type="submit" class="btn btn-primary">{{ trans('common.search') }}</button>
  37. <a href="{{route('admin.subscribe.index')}}" class="btn btn-danger">{{ trans('common.reset') }}</a>
  38. </div>
  39. </form>
  40. <table class="text-md-center" data-toggle="table" data-mobile-responsive="true">
  41. <thead class="thead-default">
  42. <tr>
  43. <th> @sortablelink('id', '#')</th>
  44. <th> {{ trans('model.user.username') }}</th>
  45. <th> {{ trans('model.subscribe.code') }}</th>
  46. <th> @sortablelink('times', trans('model.subscribe.req_times'))</th>
  47. <th> {{ trans('model.subscribe.updated_at') }}</th>
  48. <th> {{ trans('model.subscribe.ban_time') }}</th>
  49. <th> {{ trans('model.subscribe.ban_desc') }}</th>
  50. <th> {{trans('common.action')}}</th>
  51. </tr>
  52. </thead>
  53. <tbody>
  54. @foreach($subscribeList as $subscribe)
  55. <tr>
  56. <td> {{$subscribe->id}} </td>
  57. <td>
  58. @if($subscribe->has('user'))
  59. @can('admin.user.index')
  60. <a href="{{route('admin.user.index', ['id'=>$subscribe->user->id])}}" target="_blank">{{$subscribe->user->username}}</a>
  61. @else
  62. {{$subscribe->user->username}}
  63. @endcan
  64. @else
  65. 【{{trans('common.deleted_item', ['attribute' => trans('common.account')])}}】
  66. @endif
  67. </td>
  68. <td> {{$subscribe->code}} </td>
  69. <td>
  70. @can('admin.subscribe.log')
  71. <a href="{{route('admin.subscribe.log', $subscribe)}}" target="_blank">{{$subscribe->times}}</a>
  72. @endcan
  73. </td>
  74. <td> {{$subscribe->updated_at}} </td>
  75. <td> {{$subscribe->ban_time ? date('Y-m-d H:i', $subscribe->ban_time): ''}} </td>
  76. <td> {{ __($subscribe->ban_desc) }} </td>
  77. <td>
  78. @can('admin.subscribe.set')
  79. <button class="btn btn-sm @if($subscribe->status === 0) btn-outline-success @else btn-outline-danger @endif"
  80. onclick="setSubscribeStatus('{{route('admin.subscribe.set', $subscribe)}}')">
  81. @if($subscribe->status === 0)
  82. {{ trans('common.status.enabled') }}
  83. @else
  84. {{ trans('common.status.banned') }}
  85. @endif
  86. </button>
  87. @endcan
  88. </td>
  89. </tr>
  90. @endforeach
  91. </tbody>
  92. </table>
  93. </div>
  94. <div class="panel-footer">
  95. <div class="row">
  96. <div class="col-sm-4">
  97. {!! trans('admin.logs.counts', ['num' => $subscribeList->total()]) !!}
  98. </div>
  99. <div class="col-sm-8">
  100. <nav class="Page navigation float-right">
  101. {{$subscribeList->links()}}
  102. </nav>
  103. </div>
  104. </div>
  105. </div>
  106. </div>
  107. </div>
  108. @endsection
  109. @section('javascript')
  110. <script src="/assets/global/vendor/bootstrap-table/bootstrap-table.min.js"></script>
  111. <script src="/assets/global/vendor/bootstrap-table/extensions/mobile/bootstrap-table-mobile.min.js"></script>
  112. <script>
  113. $(document).ready(function() {
  114. $('#status').val({{Request::query('status')}});
  115. });
  116. @can('admin.subscribe.set')
  117. // 启用禁用用户的订阅
  118. function setSubscribeStatus(url) {
  119. $.post(url, {_token: '{{csrf_token()}}'}, function(ret) {
  120. if (ret.status === 'success') {
  121. swal.fire({title: ret.message, icon: 'success', timer: 1000, showConfirmButton: false}).then(() => {
  122. window.location.reload();
  123. });
  124. } else {
  125. swal.fire({title: ret.message, icon: 'error', timer: 1000, showConfirmButton: false}).then(() => {
  126. window.location.reload();
  127. });
  128. }
  129. });
  130. }
  131. @endcan
  132. </script>
  133. @endsection