index.blade.php 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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 class="col-sm-8 pull-right">
  32. <a href="{{ $pre_uri . 'create' }}" class="btn btn-sm btn-primary pull-right">添加{{ $model_name }}</a>
  33. </div>
  34. </div>
  35. <table class="table table-striped table-bordered table-hover dataTables-example dataTable" id="sg-main-table">
  36. <thead>
  37. <tr>
  38. <th>姓名</th>
  39. <th>年龄</th>
  40. <th>婚姻状况</th>
  41. <th>职业</th>
  42. <th>工作地点</th>
  43. <th>住址</th>
  44. <th colspan="2">请假次数</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->name }}</td>
  57. <td>{{ $item->age }}</td>
  58. <td>{{ $item->getMarry() }}</td>
  59. <td>{{ $item->job }}</td>
  60. <td>{{ $item->work_addr }}</td>
  61. <td>{{ $item->addr }}</td>
  62. <td>{{ empty($item->short_leave_times) ? 0 : $item->short_leave_times }}</td>
  63. <td>{{ empty($item->long_leave_times) ? 0 : $item->long_leave_times }}</td>
  64. <td>
  65. <div class="btn-group">
  66. <a class="btn btn-sm btn-success btn-courses" href="{{ $pre_uri . 'Course/index?student_id=' . $item->id }}">课程</a>
  67. <a class="btn btn-sm btn-info btn-edit" href="{{ $pre_uri . 'edit?id=' . $item->id }}">编辑</a>
  68. <div class="btn btn-sm btn-danger btn-delete" data-id="{{ $item->id }}">删除</div>
  69. </div>
  70. </td>
  71. </tr>
  72. @endforeach
  73. @endif
  74. </tbody>
  75. </table>
  76. <div class="row">
  77. <div class="col-sm-12">{{ $list->links() }}</div>
  78. </div>
  79. </div>
  80. </div>
  81. </div>
  82. </div>
  83. </div>
  84. </div>
  85. <div class="modal fade" id="delete-modal" tabindex="-1" role="dialog" aria-labelledby="delete-label" aria-hidden="true">
  86. <div class="modal-dialog">
  87. <form id="delete-form" method="POST" action="{{ $pre_uri . 'delete' }}">
  88. {{ csrf_field() }}
  89. <input type="hidden" name="id" id="delete-input-id">
  90. <div class="modal-content">
  91. <div class="modal-header">
  92. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
  93. <h4 class="modal-title" id="delete-label">确定要删除吗?</h4>
  94. </div>
  95. <div class="modal-footer">
  96. <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
  97. <button type="submit" class="btn btn-danger">删除</button>
  98. </div>
  99. </div>
  100. </form>
  101. </div>
  102. </div>
  103. @endsection
  104. @section('footer')
  105. <script type="text/javascript">
  106. $(function () {
  107. $('#sg-main-table').on('click', '.btn-delete', function () {
  108. $('#delete-input-id').val($(this).attr('data-id'));
  109. $('#delete-modal').modal('show');
  110. });
  111. })
  112. </script>
  113. @endsection