ticketList.blade.php 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. @extends('user.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('title', '控制面板')
  7. @section('content')
  8. <!-- BEGIN CONTENT BODY -->
  9. <div class="page-content">
  10. <!-- BEGIN PAGE BREADCRUMB -->
  11. <ul class="page-breadcrumb breadcrumb">
  12. <li>
  13. <a href="{{url('user/ticketList')}}">工单</a>
  14. <i class="fa fa-circle"></i>
  15. </li>
  16. </ul>
  17. <!-- END PAGE BREADCRUMB -->
  18. <!-- BEGIN PAGE BASE CONTENT -->
  19. <div class="row">
  20. <div class="col-md-12">
  21. <!-- BEGIN EXAMPLE TABLE PORTLET-->
  22. <div class="portlet light bordered">
  23. <div class="portlet-title">
  24. <div class="caption font-dark">
  25. <i class="icon-question font-dark"></i>
  26. <span class="caption-subject bold uppercase"> 工单列表 </span>
  27. </div>
  28. <div class="actions">
  29. <div class="btn-group">
  30. <button class="btn sbold blue" data-toggle="modal" data-target="#charge_modal"> 发起工单 </button>
  31. </div>
  32. </div>
  33. </div>
  34. <div class="portlet-body">
  35. <div class="table-scrollable">
  36. <table class="table table-striped table-bordered table-hover table-checkable order-column" id="sample_1">
  37. <thead>
  38. <tr>
  39. <th> ID </th>
  40. <th> 标题 </th>
  41. <th> 状态 </th>
  42. </tr>
  43. </thead>
  44. <tbody>
  45. @if($ticketList->isEmpty())
  46. <tr>
  47. <td colspan="4">暂无数据</td>
  48. </tr>
  49. @else
  50. @foreach($ticketList as $key => $ticket)
  51. <tr class="odd gradeX">
  52. <td> {{$key + 1}} </td>
  53. <td> <a href="{{url('user/replyTicket?id=') . $ticket->id}}" target="_blank">{{$ticket->title}}</a> </td>
  54. <td>
  55. @if ($ticket->status == 0)
  56. <span class="label label-info"> 待处理 </span>
  57. @elseif ($ticket->status == 1)
  58. <span class="label label-danger"> 已回复 </span>
  59. @else
  60. <span class="label label-default"> 已关闭 </span>
  61. @endif
  62. </td>
  63. </tr>
  64. @endforeach
  65. @endif
  66. </tbody>
  67. </table>
  68. </div>
  69. <div class="row">
  70. <div class="col-md-4 col-sm-4">
  71. <div class="dataTables_info" role="status" aria-live="polite">共 {{$ticketList->total()}} 个工单</div>
  72. </div>
  73. <div class="col-md-8 col-sm-8">
  74. <div class="dataTables_paginate paging_bootstrap_full_number pull-right">
  75. {{ $ticketList->links() }}
  76. </div>
  77. </div>
  78. </div>
  79. </div>
  80. </div>
  81. <!-- END EXAMPLE TABLE PORTLET-->
  82. </div>
  83. </div>
  84. <div id="charge_modal" class="modal fade" tabindex="-1" data-focus-on="input:first" data-keyboard="false">
  85. <div class="modal-dialog">
  86. <div class="modal-content">
  87. <div class="modal-header">
  88. <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
  89. <h4 class="modal-title"> 发起工单 </h4>
  90. </div>
  91. <div class="modal-body">
  92. <input type="text" name="title" id="title" placeholder="工单标题" class="form-control margin-bottom-20">
  93. <textarea name="content" id="content" placeholder="请填写您的问题,如果图片请提交工单后在回复处上传图片" class="form-control margin-bottom-20" rows="4"></textarea>
  94. </div>
  95. <div class="modal-footer">
  96. <button type="button" data-dismiss="modal" class="btn red btn-outline">关闭</button>
  97. <button type="button" data-dismiss="modal" class="btn green btn-outline" onclick="addTicket()">提交</button>
  98. </div>
  99. </div>
  100. </div>
  101. </div>
  102. <!-- END PAGE BASE CONTENT -->
  103. </div>
  104. <!-- END CONTENT BODY -->
  105. @endsection
  106. @section('script')
  107. <script src="/assets/global/plugins/bootbox/bootbox.min.js" type="text/javascript"></script>
  108. <script type="text/javascript">
  109. // 回复工单
  110. function reply(id) {
  111. window.location.href = + id;
  112. }
  113. // 发起工单
  114. function addTicket() {
  115. var title = $("#title").val();
  116. var content = $("#content").val();
  117. if (title == '' || title == undefined) {
  118. bootbox.alert('工单标题不能为空');
  119. return false;
  120. }
  121. if (content == '' || content == undefined) {
  122. bootbox.alert('工单内容不能为空');
  123. return false;
  124. }
  125. bootbox.confirm({
  126. message: "确定提交工单?",
  127. buttons: {
  128. confirm: {
  129. label: '确定',
  130. className: 'btn-success'
  131. },
  132. cancel: {
  133. label: '取消',
  134. className: 'btn-danger'
  135. }
  136. },
  137. callback: function (result) {
  138. if (result) {
  139. $.post("{{url('user/addTicket')}}", {_token:'{{csrf_token()}}', title:title, content:content}, function(ret){
  140. if (ret.status == 'success') {
  141. bootbox.alert(ret.message, function(){
  142. window.location.reload();
  143. });
  144. } else {
  145. bootbox.alert(ret.message);
  146. }
  147. });
  148. }
  149. }
  150. });
  151. }
  152. </script>
  153. @endsection