pushList.blade.php 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. @extends('admin.layouts')
  2. @section('css')
  3. <link href="/assets/global/vendor/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
  4. <link href="/assets/global/vendor/bootstrap-markdown/bootstrap-markdown.min.css" rel="stylesheet">
  5. @endsection
  6. @section('content')
  7. <div class="page-content container-fluid">
  8. <div class="panel">
  9. <div class="panel-heading">
  10. <h3 class="panel-title">{{ trans('admin.marketing.push.title') }}</h3>
  11. @can('admin.marketing.add')
  12. <div class="panel-actions">
  13. <button type="button" class="btn btn-primary disabled" data-toggle="modal" data-target="#send_modal">
  14. <i class="icon wb-plus"></i>{{ trans('admin.marketing.push.send') }}</button>
  15. </div>
  16. @endcan
  17. </div>
  18. <div class="panel-body">
  19. <form class="form-row">
  20. <div class="form-group col-lg-3 col-sm-6">
  21. <select class="form-control" name="status" id="status">
  22. <option value="" hidden>{{ trans('common.status.attribute') }}</option>
  23. <option value="0">{{ trans('common.to_be_send') }}</option>
  24. <option value="-1">{{ trans('common.failed') }}</option>
  25. <option value="1">{{ trans('common.success') }}</option>
  26. </select>
  27. </div>
  28. <div class="form-group col-lg-2 col-sm-6 btn-group">
  29. <button type="submit" class="btn btn-primary">{{ trans('common.search') }}</button>
  30. <a href="{{route('admin.marketing.push')}}" class="btn btn-danger">{{ trans('common.reset') }}</a>
  31. </div>
  32. </form>
  33. {{-- <div class="alert alert-info alert-dismissible" role="alert">--}}
  34. {{-- <button type="button" class="close" data-dismiss="alert" aria-label="{{ trans('common.close') }}">--}}
  35. {{-- <span aria-hidden="true">×</span></button>--}}
  36. {{-- 仅会推送给关注了您的消息通道的用户 @can('admin.system.index')<a href="{{route('admin.system.index')}}" class="alert-link" target="_blank">设置PushBear</a> @else 设置PushBear @endcan--}}
  37. {{-- </div>--}}
  38. <table class="text-md-center" data-toggle="table" data-mobile-responsive="true">
  39. <thead class="thead-default">
  40. <tr>
  41. <th> #</th>
  42. <th> {{ trans('validation.attributes.title') }}</th>
  43. <th> {{ trans('validation.attributes.content') }}</th>
  44. <th> {{ trans('admin.marketing.send_status') }}</th>
  45. <th> {{ trans('admin.marketing.send_time') }}</th>
  46. <th> {{ trans('admin.marketing.error_message') }}</th>
  47. </tr>
  48. </thead>
  49. <tbody>
  50. @foreach($pushes as $push)
  51. <tr>
  52. <td> {{$push->id}} </td>
  53. <td> {{$push->title}} </td>
  54. <td> {{$push->content}} </td>
  55. <td> {{$push->status_label}} </td>
  56. <td> {{$push->created_at}} </td>
  57. <td> {{$push->error}} </td>
  58. </tr>
  59. @endforeach
  60. </tbody>
  61. </table>
  62. </div>
  63. <div class="panel-footer">
  64. <div class="row">
  65. <div class="col-sm-4">
  66. {!! trans('admin.marketing.push.counts', ['num' => $pushes->total()]) !!}
  67. </div>
  68. <div class="col-sm-8">
  69. <nav class="Page navigation float-right">
  70. {{$pushes->links()}}
  71. </nav>
  72. </div>
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. @can('admin.marketing.add')
  78. <!-- 推送消息 -->
  79. <div id="send_modal" class="modal fade" tabindex="-1" data-focus-on="input:first" data-backdrop="static"
  80. data-keyboard="false">
  81. <div class="modal-dialog modal-lg modal-center">
  82. <div class="modal-content">
  83. <div class="modal-header">
  84. <button type="button" class="close" data-dismiss="modal" aria-label="{{ trans('common.close') }}">
  85. <span aria-hidden="true">×</span>
  86. </button>
  87. <h4 class="modal-title">{{ trans('admin.marketing.push.send') }}</h4>
  88. </div>
  89. <div class="modal-body">
  90. <div class="alert alert-danger" style="display: none;" id="msg"></div>
  91. <form action="#" method="post" class="form-horizontal">
  92. <div class="form-body">
  93. <div class="form-group">
  94. <div class="row">
  95. <label for="title" class="col-md-2 control-label"> {{ trans('validation.attributes.title') }} </label>
  96. <div class="col-md-6">
  97. <input type="text" class="form-control" name="title" id="title"/>
  98. </div>
  99. </div>
  100. </div>
  101. <div class="form-group">
  102. <div class="row">
  103. <label for="content" class="col-md-2 control-label"> {{ trans('validation.attributes.content') }} </label>
  104. <div class="col-md-9">
  105. <textarea class="form-control" rows="10" name="content" id="content" data-provide="markdown" data-iconlibrary="fa"></textarea>
  106. </div>
  107. </div>
  108. </div>
  109. </div>
  110. </form>
  111. </div>
  112. <div class="modal-footer">
  113. <button class="btn btn-danger mr-auto" data-dismiss="modal">{{ trans('common.cancel') }}</button>
  114. <button type="button" class="btn btn-primary disabled" onclick="return send();">{{ trans('common.send') }}</button>
  115. </div>
  116. </div>
  117. </div>
  118. </div>
  119. @endcan
  120. @endsection
  121. @section('javascript')
  122. <script src="/assets/global/vendor/bootstrap-table/bootstrap-table.min.js"></script>
  123. <script src="/assets/global/vendor/bootstrap-table/extensions/mobile/bootstrap-table-mobile.min.js"></script>
  124. <script src="/assets/global/vendor/bootstrap-markdown/bootstrap-markdown.min.js"></script>
  125. <script src="/assets/global/vendor/marked/marked.min.js"></script>
  126. <script>
  127. $(document).ready(function() {
  128. $('#status').val({{Request::query('status')}});
  129. });
  130. @can('admin.marketing.add')
  131. // 发送通道消息
  132. function send() {
  133. const title = $('#title').val();
  134. if (title.trim() === '') {
  135. $('#msg').show().html('{{ trans('validation.filled', ['attribute' => trans('validation.attributes.title')]) }}');
  136. title.focus();
  137. return false;
  138. }
  139. $.ajax({
  140. url: '{{route('admin.marketing.add')}}',
  141. method: 'POST',
  142. data: {_token: '{{csrf_token()}}', title: title, content: $('#content').val()},
  143. beforeSend: function() {
  144. $('#msg').show().html('{{ trans('admin.creating') }}');
  145. },
  146. success: function(ret) {
  147. if (ret.status === 'fail') {
  148. $('#msg').show().html(ret.message);
  149. return false;
  150. }
  151. $('#send_modal').modal('hide');
  152. },
  153. error: function() {
  154. $('#msg').show().html('{{ trans('common.request_failed') }}');
  155. },
  156. complete: function() {
  157. },
  158. });
  159. }
  160. // 关闭modal触发
  161. $('#send_modal').on('hide.bs.modal', function() {
  162. window.location.reload();
  163. });
  164. @endcan
  165. </script>
  166. @endsection