leave_request.blade.php 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. @extends('layouts.master')
  2. @section('content')
  3. <!-- DataTables -->
  4. <link rel="stylesheet" href="{{ asset('/assets/') }}/css/dataTables.bootstrap.min.css">
  5. <link rel="stylesheet" href="{{ asset('/assets/') }}/switch/rcswitcher.css">
  6. <link rel="stylesheet" href="{{ asset('/assets/') }}/alert/pnotify.css">
  7. <link rel="stylesheet" href="{{ asset('/assets/') }}/alert/sweetalert.css">
  8. <link rel="stylesheet" href="{{ asset('/assets/') }}/alert/sweet-alert-animations.css">
  9. <div class="row">
  10. <div class="col-md-12">
  11. <div class="panel panel-default">
  12. <!-- Default panel contents -->
  13. <div class="panel-heading"></div>
  14. <header class="panel-heading" style="height:50px;">
  15. <div class="pull-left">
  16. {{$title}}
  17. </div>
  18. <div>
  19. <a style="margin-left: 3px" href="{{ url('admin/leave_requests/apply') }}" class="btn btn-sm btn-info pull-right"><i class="fa fa-plus"></i> Leave Request</a>
  20. </div>
  21. </header>
  22. <div class="panel-body">
  23. <div class="clearfix"></div>
  24. <table class="table table-bordered" id="example">
  25. <thead>
  26. <tr>
  27. <th>#</th>
  28. <th class="text-center">
  29. Name
  30. </th>
  31. <th class="text-center">
  32. Purpose
  33. </th>
  34. <th class="text-center">
  35. Leave From
  36. </th>
  37. <th class="text-center">
  38. Leave To
  39. </th>
  40. <th class="text-center">
  41. Days
  42. </th>
  43. <th class="text-center">
  44. Status
  45. </th>
  46. <th class="text-center">
  47. Action
  48. </th>
  49. </tr>
  50. </thead>
  51. <tbody>
  52. @if (session('data'))
  53. <div class="alert alert-success">
  54. {{ session('data') }}
  55. </div>
  56. @endif
  57. <?php $count=1; ?>
  58. @foreach($all as $info)
  59. <tr>
  60. <td>{{ $count++ }}</td>
  61. <td class="text-center">
  62. @foreach($all_users as $user)
  63. @if($user['id']==$info->user_id)
  64. {{$user['name']}}
  65. @endif
  66. @endforeach
  67. </td>
  68. <td class="text-center">
  69. @foreach($purposes as $purp)
  70. @if($purp['id']==$info->purpose)
  71. {{$purp['name']}}
  72. @endif
  73. @endforeach
  74. </td>
  75. <td class="text-center">
  76. {{ date("jS-F-Y", strtotime($info->from)) }}
  77. </td>
  78. <td class="text-center">
  79. {{ date("jS-F-Y", strtotime($info->to)) }}
  80. </td>
  81. <td class="text-center">
  82. {{ $info->days}}
  83. </td>
  84. <td class="text-center">
  85. @if($info->approval == 0)
  86. <span class="label label-primary">Pending</span>
  87. @else
  88. {{ "" }}
  89. <span class="label label-success">Approved</span>
  90. @endif
  91. </td>
  92. <td class="parent-action-cls text-center">
  93. <a href="{{ url('admin/leave_requests/details') }}/{{ $info->id }}" class='btn btn-info btn-sm' data-toggle="tooltip" title="Details" data-placement="top"><i class="fa fa-edit"></i> Details</a>
  94. <a href="{{ url('admin/leave_requests/delete') }}/{{ $info->id }}" class='btn btn-default btn-sm' onclick="return confirm('Are you sure to delete this item ?')" data-toggle="tooltip" title="Delete" data-placement="top"><i class="fa fa-trash-o"></i></a>
  95. <!-- <span class="chk-active" style="cursor: pointer" data-id="{{$info->id}}" data-value="1">
  96. <i style="color:#398439;font-size: 18px;" class="fa fa-check-square-o" aria-hidden="true"></i> Approve
  97. </span>
  98. <span class="chk-active" style="cursor: pointer" data-id="{{$info->id}}" data-value="0">
  99. <i style="color:#d58512;font-size: 18px;" class="fa fa-square-o" aria-hidden="true"></i> Discard
  100. </span> -->
  101. <!--
  102. <input class="chk-active" data-id="{{$info->id}}" @if($info->approval == 1) checked="" @endif type="checkbox" value="1" /> Approve
  103. &nbsp; &nbsp;
  104. <input class="chk-active" data-id="{{$info->id}}" @if($info->approval == 1) checked="" @endif type="checkbox" value="0" /> Discard
  105. &nbsp; &nbsp;
  106. </span> -->
  107. </td>
  108. </tr>
  109. @endforeach
  110. </tbody>
  111. </table>
  112. </div>
  113. </div>
  114. </div>
  115. </div>
  116. <div class="modal fade" id="modalPreview">
  117. <div class="modal-dialog" style='width: 50%;'>
  118. </div>
  119. </div>
  120. @stop
  121. @section('style')
  122. <style>
  123. .modal-dialog {
  124. width: 70% !important;
  125. height: 70% !important;
  126. }
  127. .modal-content {
  128. height: auto;
  129. min-height: 70% !important;
  130. border-radius: 0;
  131. }
  132. </style>
  133. @stop
  134. @section('script')
  135. <script src="{{ asset('/assets/') }}/js/jquery.dataTables.min.js"></script>
  136. <script src="{{ asset('/assets/') }}/js/dataTables.bootstrap.min.js"></script>
  137. <script src="{{ asset('/assets/') }}/switch/rcswitcher.js"></script>
  138. <script src="{{ asset('/assets/') }}/alert/sweetalert.min.js"></script>
  139. <script src="{{ asset('/assets/') }}/alert/pnotify-init.js"></script>
  140. <script src="{{ asset('/assets/') }}/alert/notify.js"></script>
  141. <script type="text/javascript">
  142. $(document).ready(function() {
  143. $('body').on('hidden.bs.modal', '.modal', function () {
  144. $(this).removeData('bs.modal');
  145. });
  146. var table=$("#example").DataTable({
  147. "searching": true,
  148. "lengthChange": true,
  149. "ordering": true,
  150. stateSave: true
  151. });
  152. });
  153. </script>
  154. <script type="text/javascript">
  155. jQuery(document).ready(function($)
  156. {
  157. $('.chk-active').click(function(event)
  158. {
  159. var id = $(this).data('id');
  160. var stat = $(this).data('value');
  161. /*
  162. if($(this).is(':checked'))
  163. {
  164. stat = 10;
  165. }
  166. else
  167. {
  168. stat = 0;
  169. }*/
  170. $.ajax({
  171. url: "{{url('admin/leave_accept')}}",
  172. type: 'POST',
  173. data: {id: id,stat: stat},
  174. })
  175. .done(function(data){
  176. alert(data);
  177. location.reload();
  178. });
  179. });
  180. });
  181. </script>
  182. @if(Session::has('msg'))
  183. <div class="alert alert-success center-block msg_alt" >
  184. <a class="close" data-dismiss="alert" href="#">&times;</a>
  185. <strong><i class="fa fa-check"></i></strong>&nbsp;
  186. {{Session::get('msg')}}
  187. </div>
  188. @endif
  189. @stop