index.phtml 9.7 KB

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