leave_details.blade.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322
  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. <header class="panel-heading" style="height:50px;">
  13. <div class="pull-left">
  14. {{$title}}
  15. </div>
  16. <div>
  17. <a style="margin-left: 3px" href="{{ url('admin/leave_requests') }}" class="btn btn-sm btn-info pull-right"><i class="fa fa-list"></i> Leave List</a>
  18. </div>
  19. </header>
  20. <div class="clearfix"></div>
  21. <div class="panel-body">
  22. <form action="{{ url('admin/leave_req_approved/'.$leave_req->id) }}" method="POST" class="form-horizontal" role="form">
  23. {{ csrf_field() }}
  24. <div class="col-md-7">
  25. <div class="form-group">
  26. <label for="purpose" class="col-sm-2">Name : </label>
  27. <div class="col-sm-10">
  28. @foreach($all_users as $user)
  29. @if($user['id']==$leave_req->user_id)
  30. {{$user['name']}}
  31. @endif
  32. @endforeach
  33. </div>
  34. </div>
  35. <div class="form-group">
  36. <label for="purpose" class="col-sm-2">Purpose : </label>
  37. <div class="col-sm-10">
  38. @foreach($purposes as $purp)
  39. @if($purp['id']==$leave_req->purpose)
  40. {{$purp['name']}}
  41. @endif
  42. @endforeach
  43. </div>
  44. </div>
  45. <div class="form-group">
  46. <label for="description" class="col-sm-2">Application</label>
  47. <div class="col-sm-7">
  48. {{ $leave_req->description }}
  49. </div>
  50. </div>
  51. </div>
  52. <div class="col-md-5">
  53. <div class="form-group">
  54. <label for="due_date" class="col-sm-2">From :</label>
  55. <div class="col-sm-8">
  56. <input type='text' name="from" id="from" class="form-control date" placeholder="From Date" value="{{ date('Y-m-d', strtotime($leave_req->from)) }}" required="">
  57. </div>
  58. </div>
  59. <div class="form-group">
  60. <label for="due_date" class="col-sm-2">To :</label>
  61. <div class="col-sm-8">
  62. <input type='text' name="to" id="to" value="{{ date('Y-m-d', strtotime($leave_req->to)) }}" class="form-control date" placeholder="To Date" required="">
  63. </div>
  64. </div>
  65. <div class="form-group">
  66. <div class="col-sm-10 col-sm-offset-2">
  67. @if($leave_req->approval == 0)
  68. <button type="submit" class="btn btn-info">Approved</button>
  69. @else
  70. <span class="btn btn-info disabled">Already Approved</span>
  71. @endif
  72. <a href="{{ url('admin/leave_req_discard') }}/{{ $leave_req->id }}" class='btn btn-info'> Discard </a>
  73. </div>
  74. </div>
  75. </div>
  76. </form>
  77. </div>
  78. </div>
  79. </div>
  80. <div class="col-md-12">
  81. <div class="panel panel-default">
  82. <div class="panel-body">
  83. <header class="panel-heading" style="height:40px;">
  84. <div class="pull-left">
  85. Leave Summary
  86. </div>
  87. </header>
  88. <div class="clearfix"></div>
  89. <table class="table table-bordered">
  90. <thead>
  91. <tr>
  92. <th class="text-right"> # </th>
  93. <th class="text-center">
  94. Leave Head
  95. </th>
  96. <th class="text-center">
  97. Allowed
  98. </th>
  99. <th class="text-center">
  100. Taken
  101. </th>
  102. <th class="text-center">
  103. Remaining
  104. </th>
  105. </tr>
  106. </thead>
  107. <tbody>
  108. <?php $count=1; ?>
  109. @foreach($purposes as $pur)
  110. <tr>
  111. <td class="text-right">{{ $count++ }}</td>
  112. <td class="text-center">
  113. {{ $pur['name']}}
  114. </td>
  115. <td class="text-center">
  116. {{ $pur['approved_days'] }}
  117. </td>
  118. <td class="text-center">
  119. @if(!empty($pur['taken']))
  120. {{ $pur['taken'] }}
  121. @else
  122. {{ 0 }}
  123. @endif
  124. </td>
  125. <td class="text-center">
  126. <span class="label label-primary">{{ $remaining = ($pur['approved_days'] - $pur['taken']) }} days</span>
  127. </td>
  128. </tr>
  129. @endforeach
  130. </tbody>
  131. </table>
  132. </div>
  133. </div>
  134. </div><div class="col-md-12">
  135. <div class="panel panel-default">
  136. <div class="panel-body">
  137. <header class="panel-heading" style="height:40px;">
  138. <div class="pull-left">
  139. Leave History
  140. </div>
  141. </header>
  142. <div class="clearfix"></div>
  143. <table class="table table-bordered">
  144. <thead>
  145. <tr>
  146. <th class="text-right"> # </th>
  147. <th class="text-center">
  148. Name
  149. </th>
  150. <th class="text-center">
  151. Purpose
  152. </th>
  153. <th class="text-center">
  154. Leave From
  155. </th>
  156. <th class="text-center">
  157. Leave To
  158. </th>
  159. <th class="text-center">
  160. Days
  161. </th>
  162. <th class="text-center">
  163. Status
  164. </th>
  165. </tr>
  166. </thead>
  167. <tbody>
  168. <?php $count=1; ?>
  169. @foreach($all_leave_req as $info)
  170. <tr>
  171. <td class="text-right">{{ $count++ }}</td>
  172. <td class="text-center">
  173. @foreach($all_users as $user)
  174. @if($user['id']==$info->user_id)
  175. {{$user['name']}}
  176. @endif
  177. @endforeach
  178. </td>
  179. <td class="text-center">
  180. @foreach($purposes as $purp)
  181. @if($purp['id']==$info->purpose)
  182. {{$purp['name']}}
  183. @endif
  184. @endforeach
  185. </td>
  186. <td class="text-center">
  187. {{ date("jS-F-Y", strtotime($info->from)) }}
  188. </td>
  189. <td class="text-center">
  190. {{ date("jS-F-Y", strtotime($info->to)) }}
  191. </td>
  192. <td class="text-right">
  193. <?php
  194. /*$start = strtotime($info->from);
  195. $end = strtotime($info->to);
  196. $days_between = (ceil(abs( $end - $start) / 86400))+1;
  197. echo $days_between;*/
  198. ?>
  199. {{ $info->days }}
  200. </td>
  201. <td class="text-center">
  202. @if($info->approval == 0)
  203. <span class="label label-primary">Pending</span>
  204. @else
  205. <span class="label label-success">Approved</span>
  206. @endif
  207. </td>
  208. </tr>
  209. @endforeach
  210. </tbody>
  211. </table>
  212. </div>
  213. </div>
  214. </div>
  215. </div>
  216. <div class="modal fade" id="modalPreview">
  217. <div class="modal-dialog" style='width: 50%;'>
  218. </div>
  219. </div>
  220. @stop
  221. @section('style')
  222. <style>
  223. .modal-dialog {
  224. width: 70% !important;
  225. height: 70% !important;
  226. }
  227. .modal-content {
  228. height: auto;
  229. min-height: 70% !important;
  230. border-radius: 0;
  231. }
  232. </style>
  233. @stop
  234. @section('script')
  235. <script src="{{ asset('/assets/') }}/js/jquery.dataTables.min.js"></script>
  236. <script src="{{ asset('/assets/') }}/js/dataTables.bootstrap.min.js"></script>
  237. <script src="{{ asset('/assets/') }}/switch/rcswitcher.js"></script>
  238. <script src="{{ asset('/assets/') }}/alert/sweetalert.min.js"></script>
  239. <script src="{{ asset('/assets/') }}/alert/pnotify-init.js"></script>
  240. <script src="{{ asset('/assets/') }}/alert/notify.js"></script>
  241. <script type="text/javascript">
  242. $(document).ready(function() {
  243. $( ".date" ).datepicker({
  244. changeMonth: true,
  245. changeYear: true,
  246. dateFormat:"yy-mm-dd"
  247. });
  248. });
  249. </script>
  250. <script type="text/javascript">
  251. $(document).ready(function() {
  252. $('body').on('hidden.bs.modal', '.modal', function () {
  253. $(this).removeData('bs.modal');
  254. });
  255. var table=$("#example").DataTable({
  256. "searching": true,
  257. "lengthChange": true,
  258. "ordering": true,
  259. stateSave: true
  260. });
  261. });
  262. </script>
  263. <script type="text/javascript">
  264. jQuery(document).ready(function($)
  265. {
  266. $('.chk-active').click(function(event)
  267. {
  268. var id = $(this).data('id');
  269. var stat = $(this).data('value');
  270. /*
  271. if($(this).is(':checked'))
  272. {
  273. stat = 10;
  274. }
  275. else
  276. {
  277. stat = 0;
  278. }*/
  279. $.ajax({
  280. url: "{{url('admin/leave_accept')}}",
  281. type: 'POST',
  282. data: {id: id,stat: stat},
  283. })
  284. .done(function(data){
  285. alert(data);
  286. location.reload();
  287. });
  288. });
  289. });
  290. </script>
  291. @if(Session::has('msg'))
  292. <div class="alert alert-success center-block msg_alt" >
  293. <a class="close" data-dismiss="alert" href="#">&times;</a>
  294. <strong><i class="fa fa-check"></i></strong>&nbsp;
  295. {{Session::get('msg')}}
  296. </div>
  297. @endif
  298. @stop