index.phtml 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  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->momth == 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. echo "<h3 id='user'.$i.'' class='timeTitle'>$user <i class='fa fa-chevron-down right'></i></h3>";
  62. echo "
  63. <div class=\"wrapper hide\">";
  64. if(count($timesheet) > 0)
  65. {
  66. echo"
  67. <table width='100%'>
  68. <thead>
  69. <tr>
  70. <th>Date</th>
  71. <th>In</th>
  72. <th>Out</th>
  73. <th>Less Time</th>
  74. <th>Hours</th>
  75. <th>Code</th>
  76. <th>Date Stamp</th>
  77. <th>Validated</th>";
  78. if($this->accountLevel >= 900)
  79. {
  80. echo "<th>Action</th>";
  81. }
  82. echo"</tr>
  83. </thead>
  84. ";
  85. }
  86. $totalValidated = 0;
  87. $totalInvalid = 0;
  88. $totalVacation = 0;
  89. $totalSick = 0;
  90. foreach($timesheet as $key=>$entry)
  91. {
  92. echo "
  93. <tr>
  94. <td>".date("l, F jS Y",strtotime($entry['date']))."</td>
  95. <td>".date("g:i A",$entry['inTime'])."</td>
  96. <td>".date("g:i A",$entry['outTime'])."</td>
  97. <td>".$entry['lessTime']." <small>Hours</small></td>
  98. <td>".$entry['timeWorked']."</td>
  99. <td>".$entry['code']."</td>
  100. <td>".date("M. jS Y @ G:i A",strtotime($entry['timestamp']))."</td>
  101. <td><div class='text-center'>";
  102. if($entry['validated'] == 1)
  103. {
  104. echo "<i class=\"fa fa-check green\"></i>";
  105. }
  106. else
  107. {
  108. echo "<i class=\"fa fa-close red\"></i>";
  109. }
  110. echo "</td>";
  111. if($this->accountLevel >= 900)
  112. {
  113. echo "<td><a href=\"".$this->link(array('timesheet','remove',$key))."\"><i class=\"fa fa-trash\"></i> Remove</a></td>";
  114. }
  115. echo "</tr>";
  116. if(strlen($entry['note']) > 0)
  117. {
  118. echo "
  119. <tr>
  120. <td colspan='9'>
  121. <b>Note:</b> ".$entry['note']."
  122. </td>
  123. </tr>
  124. ";
  125. }
  126. if($entry['validated'] == 1)
  127. {
  128. $totalValidated += $entry['timeWorked'];
  129. }
  130. if($entry['validated'] == 0)
  131. {
  132. $totalInvalid += $entry['timeWorked'];
  133. }
  134. if($entry['code'] == "Vacation")
  135. {
  136. $totalVacation += $entry['timeWorked'];
  137. }
  138. if($entry['code'] == "Sick")
  139. {
  140. $totalSick += $entry['timeWorked'];
  141. }
  142. }
  143. if(count($timesheet) > 0)
  144. {
  145. echo "</table>";
  146. echo "<div class=\"row\">";
  147. echo "<div class='small-12'>
  148. FORM GOES HERE
  149. </div>";
  150. echo "</div>";
  151. echo "<div class=\"row\">";
  152. echo "<div class=\"small-6 medium-4 large-3 columns\">";
  153. echo "<div class=\"card successBg\">
  154. <div class=\"title\">Validated</div>
  155. <div class=\"value\">".$totalValidated." <small>Hours</small></div>
  156. </div>";
  157. echo "</div>";
  158. echo "<div class=\"small-6 medium-4 large-3 columns\">";
  159. echo "<div class=\"card warning\">
  160. <div class=\"title\">Not Validated</div>
  161. <div class=\"value\">".$totalInvalid." <small>Hours</small></div>
  162. </div>";
  163. echo "</div>";
  164. echo "<div class=\"small-6 medium-4 large-3 columns end\">";
  165. echo "<div class=\"card\">
  166. <div class=\"title\">Sick</div>
  167. <div class=\"value\">".$totalSick." <small>Hours</small></div>
  168. </div>";
  169. echo "</div>";
  170. echo "<div class=\"small-6 medium-4 large-3 columns end\">";
  171. echo "<div class=\"card\">
  172. <div class=\"title\">Vacation</div>
  173. <div class=\"value\">".$totalVacation." <small>Hours</small></div>
  174. </div>";
  175. echo "</div>";
  176. echo "</div>";
  177. }
  178. else
  179. {
  180. echo "<div class=\"text-center\">No time submitted</div>";
  181. }
  182. $i++;
  183. echo "</div><hr>";
  184. }
  185. ?>
  186. </div>
  187. </div>
  188. </div>
  189. <div id="yearForm" class="reveal-modal small" data-reveal aria-labelledby="Change Year" aria-hidden="true" role="dialog">
  190. <h2 id="modalTitle">Select a Year</h2>
  191. <?php echo $this->yearForm ?>
  192. <a class="close-reveal-modal" aria-label="Close">&#215;</a>
  193. </div>
  194. <div id="print" class="reveal-modal small" data-reveal aria-labelledby="Print Report" aria-hidden="true" role="dialog">
  195. <h2>Print Individual Time Sheet</h2>
  196. <?php echo $this->printTimeSheetForm ?>
  197. <a class="close-reveal-modal" aria-label="Close">&#215;</a>
  198. </div>
  199. <script>
  200. $(function() {
  201. $(".timeTitle").click(function() {
  202. $(this).next(".wrapper").slideToggle("slow");
  203. $(this).find("i").toggleClass("fa-chevron-up fa-chevron-down")
  204. return false;
  205. });
  206. $("#hideAll").click(function() {
  207. $(".wrapper").slideUp();
  208. $(".timeTitle").find("i").removeClass("fa-chevron-up")
  209. $(".timeTitle").find("i").addClass("fa-chevron-down")
  210. return false;
  211. });
  212. $("#showAll").click(function() {
  213. $(".wrapper").slideDown();
  214. $(".timeTitle").find("i").removeClass("fa-chevron-down")
  215. $(".timeTitle").find("i").addClass("fa-chevron-up")
  216. return false;
  217. });
  218. });
  219. </script>