index.blade.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. @extends('admin.layout')
  2. <style type="text/css">
  3. </style>
  4. @section('header')
  5. @endsection
  6. @section('content')
  7. <div id="sg-main-container-sg">
  8. <div class="wrapper wrapper-content animated fadeInRight">
  9. <div class="row">
  10. <div class="col-sm-12">
  11. <div class="ibox float-e-margins">
  12. <div class="ibox-title">
  13. <h5>{{ $model_name . '列表' }}</h5>
  14. <div class="ibox-tools">
  15. <a class="collapse-link"> <i class="fa fa-chevron-up"></i>
  16. </a>
  17. </div>
  18. </div>
  19. <div class="ibox-content">
  20. <div class="row">
  21. <div class="col-sm-4">
  22. <form>
  23. <div class="input-group">
  24. <input type="text" value="{{ request('keyword') }}" placeholder="请输入讲师姓名/课程名/学员名搜索" name="keyword" class="input-sm form-control">
  25. <span class="input-group-btn">
  26. <button type="submit" class="btn btn-sm btn-primary">搜索</button>
  27. </span>
  28. </div>
  29. </form>
  30. </div>
  31. </div>
  32. <table class="table table-striped table-bordered table-hover dataTables-example dataTable" id="sg-main-table">
  33. <thead>
  34. <tr>
  35. <th>讲师姓名</th>
  36. <th>课程种类</th>
  37. <th>评价平均分</th>
  38. <th>学员姓名</th>
  39. <th>评价时间</th>
  40. <th>操作</th>
  41. </tr>
  42. </thead>
  43. <tbody>
  44. @if($list->count() <= 0)
  45. <tr>
  46. <td colspan="6" style="text-align: center;">暂无{{ $model_name }}</td>
  47. </tr>
  48. @else
  49. @foreach($list as $item)
  50. <tr>
  51. <td>{{ empty($item->teacher) ? '' : $item->teacher->name }}</td>
  52. <td>{{ empty($item->course) ? '' : $item->course->name }}</td>
  53. <td></td>
  54. <td>{{ empty($item->student) ? '' : $item->student->name }}</td>
  55. <td>{{ $item->created_at }}</td>
  56. <td>
  57. <div class="btn-group">
  58. <a class="btn btn-sm btn-info btn-detail" href="{{ $pre_uri . 'detail?id=' . $item->id }}">详情</a>
  59. <div class="btn btn-sm btn-danger btn-delete" data-id="{{ $item->id }}">删除</div>
  60. </div>
  61. </td>
  62. </tr>
  63. @endforeach
  64. @endif
  65. </tbody>
  66. </table>
  67. <div class="row">
  68. <div class="col-sm-12">{{ $list->links() }}</div>
  69. </div>
  70. </div>
  71. </div>
  72. </div>
  73. </div>
  74. </div>
  75. </div>
  76. <div class="modal fade" id="delete-modal" tabindex="-1" role="dialog" aria-labelledby="delete-label" aria-hidden="true">
  77. <div class="modal-dialog">
  78. <form id="delete-form" method="POST" action="{{ $pre_uri . 'delete' }}">
  79. {{ csrf_field() }}
  80. <input type="hidden" name="id" id="delete-input-id">
  81. <div class="modal-content">
  82. <div class="modal-header">
  83. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
  84. <h4 class="modal-title" id="delete-label">确定要删除吗?</h4>
  85. </div>
  86. <div class="modal-footer">
  87. <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
  88. <button type="submit" class="btn btn-danger">删除</button>
  89. </div>
  90. </div>
  91. </form>
  92. </div>
  93. </div>
  94. @endsection
  95. @section('footer')
  96. <script type="text/javascript">
  97. $(function () {
  98. $('#sg-main-table').on('click', '.btn-delete', function () {
  99. $('#delete-input-id').val($(this).attr('data-id'));
  100. $('#delete-modal').modal('show');
  101. });
  102. })
  103. </script>
  104. @endsection