index.phtml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. <div class="section">
  2. <div class="row">
  3. <div class="small-7 columns">
  4. <h1><i class="fa fa-file"></i>Time Sheets <small>Active</small></h1>
  5. </div>
  6. <div class="small-5 columns text-right">
  7. <h1 class="subheader"><?php echo $this->monthName ?> <?php echo $this->year?></h1>
  8. </div>
  9. </div>
  10. <div class="row">
  11. <div class="small-12 columns">
  12. <ul class="button-group radius even-6">
  13. <?php
  14. $year = $this->year;
  15. if($this->month == 12)
  16. {
  17. $year = $this->nextYear;
  18. }
  19. if($this->month == 1)
  20. {
  21. $year = $this->previousYear;
  22. }
  23. ?>
  24. <li><a class="button small secondary" href="
  25. <?php
  26. switch ($this->month)
  27. {
  28. case 01:
  29. echo $this->link(array('reports',$this->previousYear, $this->previousMonth));
  30. break;
  31. default:
  32. echo $this->link(array('reports',$this->year, $this->previousMonth));
  33. }
  34. ?>
  35. "><i class="fa fa-caret-left"></i> Previous</a></li>
  36. <li><a class="button small secondary" href="
  37. <?php
  38. switch ($this->month)
  39. {
  40. case 12:
  41. echo $this->link(array('reports',$this->nextYear, $this->nextMonth));
  42. break;
  43. default:
  44. echo $this->link(array('reports',$this->year, $this->nextMonth));
  45. }
  46. ?>
  47. ">Next <i class="fa fa-caret-right"></i></a></li>
  48. <li><a id="showAll" class="button small secondary" href="#"><i class="fa fa-eye"></i> Show All</a></li>
  49. <li><a id="hideAll" class="button small secondary" href="#"><i class="fa fa-eye-slash"></i> Hide All</a></li>
  50. <li><a class="button small" href="<?php echo $this->link(array('reports','weekly')) ?>"><i class="fa fa-file"></i> Week Report</a></li>
  51. <li><a class="button small" data-reveal-id="print" href="#"><i class="fa fa-print"></i> Print</a></li>
  52. </ul>
  53. </div>
  54. </div>
  55. <div class="row">
  56. <div class="small-12 columns">
  57. <?php
  58. $i = 0;
  59. foreach($this->report as $user=>$timesheet)
  60. {
  61. $userId = $timesheet['id'];
  62. echo "<h3 id='user'.$i.'' class='timeTitle'>$user <i class='fa fa-chevron-down right'></i></h3>";
  63. echo "
  64. <div class=\"wrapper hide\">";
  65. if(count($timesheet) > 0)
  66. {
  67. echo"
  68. <table width='100%'>
  69. <thead>
  70. <tr>
  71. <th>Date</th>
  72. <th>In</th>
  73. <th>Out</th>
  74. <th>Less Time</th>
  75. <th>Hours</th>
  76. <th>Code</th>
  77. <th>Date Stamp</th>
  78. <th>Validated</th>";
  79. if($this->accountLevel >= 900)
  80. {
  81. echo "<th>Action</th>";
  82. }
  83. echo"</tr>
  84. </thead>
  85. ";
  86. }
  87. $totalValidated = 0;
  88. $totalInvalid = 0;
  89. $totalVacation = 0;
  90. $totalSick = 0;
  91. foreach($timesheet as $key=>$entry)
  92. {
  93. if($key != 'id')
  94. {
  95. echo "
  96. <tr>
  97. <td>".date("l, F jS Y",strtotime($entry['date']))."</td>
  98. <td>".date("g:i A",$entry['inTime'])."</td>
  99. <td>".date("g:i A",$entry['outTime'])."</td>
  100. <td>".$entry['lessTime']." <small>Hours</small></td>
  101. <td>".$entry['timeWorked']."</td>
  102. <td>".$entry['code']."</td>
  103. <td>".date("M. jS Y @ G:i A",strtotime($entry['timestamp']))."</td>
  104. <td><div class='text-center'>";
  105. if($entry['validated'] == 1)
  106. {
  107. echo "<i class=\"fa fa-check green\"></i>";
  108. }
  109. else
  110. {
  111. echo "<i class=\"fa fa-close red\"></i>";
  112. }
  113. echo "</td>";
  114. if($this->accountLevel >= 900)
  115. {
  116. echo "<td><a href=\"".$this->link(array('timesheet','remove',$key))."\"><i class=\"fa fa-trash\"></i> Remove</a></td>";
  117. }
  118. echo "</tr>";
  119. if(strlen($entry['note']) > 0)
  120. {
  121. echo "
  122. <tr>
  123. <td colspan='9'>
  124. <b>Note:</b> ".$entry['note']."
  125. </td>
  126. </tr>
  127. ";
  128. }
  129. if($entry['validated'] == 1)
  130. {
  131. $totalValidated += $entry['timeWorked'];
  132. }
  133. if($entry['validated'] == 0)
  134. {
  135. $totalInvalid += $entry['timeWorked'];
  136. }
  137. if($entry['code'] == "Vacation")
  138. {
  139. $totalVacation += $entry['timeWorked'];
  140. }
  141. if($entry['code'] == "Sick")
  142. {
  143. $totalSick += $entry['timeWorked'];
  144. }
  145. if($entry['code'] == "Sick (Family)")
  146. {
  147. $totalSick += $entry['timeWorked'];
  148. }
  149. }
  150. }
  151. if(count($timesheet) > 0)
  152. {
  153. echo "</table>";
  154. echo "<div class=\"row\">";
  155. echo "<div class=\"small-6 medium-4 large-3 columns\">";
  156. echo "<div class=\"card successBg\">
  157. <div class=\"title\">Validated</div>
  158. <div class=\"value\">".$totalValidated." <small>Hours</small></div>
  159. </div>";
  160. echo "</div>";
  161. echo "<div class=\"small-6 medium-4 large-3 columns\">";
  162. echo "<div class=\"card warning\">
  163. <div class=\"title\">Not Validated</div>
  164. <div class=\"value\">".$totalInvalid." <small>Hours</small></div>
  165. </div>";
  166. echo "</div>";
  167. echo "<div class=\"small-6 medium-4 large-3 columns\">";
  168. echo "<div class=\"card\">
  169. <div class=\"title\">Sick</div>
  170. <div class=\"value\">".$totalSick." <small>Hours</small></div>
  171. </div>";
  172. echo "</div>";
  173. echo "<div class=\"small-6 medium-4 large-3 columns\">";
  174. echo "<div class=\"card\">
  175. <div class=\"title\">Vacation</div>
  176. <div class=\"value\">".$totalVacation." <small>Hours</small></div>
  177. </div>";
  178. echo "</div>";
  179. echo "<div class=\"small-12 columns text-center\">";
  180. if(array_key_exists($user, $this->reviewed))
  181. {
  182. echo "<h4><i class='fa fa-check'></i> Reviewed by <b>".$this->reviewed[$user]['supervisor']."</b> on ".$this->reviewed[$user]['reviewDateFormatted']."</h4>";
  183. }
  184. else
  185. {
  186. echo "<a class='button radius' href='".$this->link(array('reports','reviewed',$userId,$this->year,$this->month))."'>Mark as reviewed</a>";
  187. }
  188. echo"</div>";
  189. echo "</div>";
  190. }
  191. else
  192. {
  193. echo "<div class=\"text-center\">No time submitted</div>";
  194. }
  195. $i++;
  196. echo "</div><hr>";
  197. }
  198. ?>
  199. </div>
  200. </div>
  201. </div>
  202. <div id="yearForm" class="reveal-modal small" data-reveal aria-labelledby="Change Year" aria-hidden="true" role="dialog">
  203. <h2 id="modalTitle">Select a Year</h2>
  204. <?php echo $this->yearForm ?>
  205. <a class="close-reveal-modal" aria-label="Close">&#215;</a>
  206. </div>
  207. <div id="print" class="reveal-modal small" data-reveal aria-labelledby="Print Report" aria-hidden="true" role="dialog">
  208. <h2>Print Individual Time Sheet</h2>
  209. <?php echo $this->printTimeSheetForm ?>
  210. <a class="close-reveal-modal" aria-label="Close">&#215;</a>
  211. </div>
  212. <script>
  213. $(function() {
  214. $(".timeTitle").click(function() {
  215. $(this).next(".wrapper").slideToggle("slow");
  216. $(this).find("i").toggleClass("fa-chevron-up fa-chevron-down");
  217. return false;
  218. });
  219. $("#hideAll").click(function() {
  220. $(".wrapper").slideUp();
  221. $(".timeTitle").find("i").removeClass("fa-chevron-up");
  222. $(".timeTitle").find("i").addClass("fa-chevron-down");
  223. return false;
  224. });
  225. $("#showAll").click(function() {
  226. $(".wrapper").slideDown();
  227. $(".timeTitle").find("i").removeClass("fa-chevron-down");
  228. $(".timeTitle").find("i").addClass("fa-chevron-up");
  229. return false;
  230. });
  231. });
  232. </script>