index.blade.php 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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>{{ $student->name . '的' . $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. @if($list->count() == 0)
  32. <div class="col-sm-8 pull-right">
  33. <a href="{{ $pre_uri . 'create?student_id=' . $student->id }}" class="btn btn-sm btn-primary pull-right">添加{{ $model_name }}</a>
  34. </div>
  35. @endif
  36. </div>
  37. <table class="table table-striped table-bordered table-hover dataTables-example dataTable" id="sg-main-table">
  38. <thead>
  39. <tr>
  40. <th>课程种类</th>
  41. <th>报名日期</th>
  42. <th>课程截止日期</th>
  43. <th>课程剩余天数</th>
  44. <th>讲师分配</th>
  45. <th>操作</th>
  46. </tr>
  47. </thead>
  48. <tbody>
  49. @if($list->count() <= 0)
  50. <tr>
  51. <td colspan="9" style="text-align: center;">暂无{{ $model_name }}</td>
  52. </tr>
  53. @else
  54. @foreach($list as $item)
  55. <tr>
  56. <td>{{ $item->course->name }}</td>
  57. <td>{{ $item->apply_date }}</td>
  58. <td>{{ $item->end_date }}</td>
  59. <td>{{ $item->remain_days }}</td>
  60. <td>{{ $item->getTeacherNames() }}</td>
  61. <td>
  62. <div class="btn-group">
  63. <a class="btn btn-sm btn-info btn-edit" href="{{ $pre_uri . 'edit?id=' . $item->id }}">编辑</a>
  64. <div class="btn btn-sm btn-danger btn-delete" data-id="{{ $item->id }}">删除</div>
  65. </div>
  66. </td>
  67. </tr>
  68. @endforeach
  69. @endif
  70. </tbody>
  71. </table>
  72. <div class="row">
  73. <div class="col-sm-12">{{ $list->links() }}</div>
  74. </div>
  75. </div>
  76. </div>
  77. </div>
  78. </div>
  79. </div>
  80. </div>
  81. <div class="modal fade" id="delete-modal" tabindex="-1" role="dialog" aria-labelledby="delete-label" aria-hidden="true">
  82. <div class="modal-dialog">
  83. <form id="delete-form" method="POST" action="{{ $pre_uri . 'delete' }}">
  84. {{ csrf_field() }}
  85. <input type="hidden" name="id" id="delete-input-id">
  86. <div class="modal-content">
  87. <div class="modal-header">
  88. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
  89. <h4 class="modal-title" id="delete-label">确定要删除吗?</h4>
  90. </div>
  91. <div class="modal-footer">
  92. <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
  93. <button type="submit" class="btn btn-danger">删除</button>
  94. </div>
  95. </div>
  96. </form>
  97. </div>
  98. </div>
  99. @endsection
  100. @section('footer')
  101. <script type="text/javascript">
  102. $(function () {
  103. $('#sg-main-table').on('click', '.btn-delete', function () {
  104. $('#delete-input-id').val($(this).attr('data-id'));
  105. $('#delete-modal').modal('show');
  106. });
  107. })
  108. </script>
  109. @endsection