index.blade.php 7.3 KB

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