Jelajahi Sumber

Convert stat boxes into table

Alan Lam 2 tahun lalu
induk
melakukan
530fc25bcf
1 mengubah file dengan 34 tambahan dan 33 penghapusan
  1. 34 33
      views/reports.php

+ 34 - 33
views/reports.php

@@ -349,51 +349,52 @@ let projectData = <?=json_encode($project_table_data)?>;
 		?>
 		</p>
 
-		<div class="row">
-			<div class="col-md-6">
-				<div class="card card-body mb-3">
-					Test Count
-					<div class="stat">
-						<?=$total_data->testCount?>
-					</div>
-				</div>
-			</div>
-			<?php
+		<?php
 
-			$render_pass_fail_card = static function(string $title, $pass, $fail) {
-				$total = $pass + $fail;
+		$render_pass_fail_row = static function(string $title, $pass, $fail) {
+			$total = $pass + $fail;
 
-				$pass_percentage = 0;
-				if($total > 0) {
-					$pass_percentage = number_format(($pass * 100) / $total, 2);
-				}
-				?>
-				<div class="col-md-6">
-					<div class="card card-body mb-3">
-						<?=htmlspecialchars($title)?>
-						<div class="stat">
-							<?=$pass?> /
-							<?=$fail?> (<?=$pass_percentage?>%)
-						</div>
-					</div>
-				</div>
-				<?php
-			};
+			$pass_percentage = 0;
+			if($total > 0) {
+				$pass_percentage = number_format(($pass * 100) / $total, 2);
+			}
+			?>
+			<tr>
+				<th><?=htmlspecialchars($title)?></th>
+				<td>
+					<?=$pass?> /
+					<?=$fail?> (<?=$pass_percentage?>%)
+				</td>
+			</tr>
+			<?php
+		};
+		?>
 
+		<table class="table table-bordered">
+			<colgroup>
+				<col style="width: 50%"/>
+				<col style="width: 50%"/>
+			</colgroup>
+			<tbody>
+			<tr>
+				<th><?=htmlspecialchars(__("Venue Test Count"))?></th>
+				<th><?=htmlspecialchars($total_data->testCount)?></th>
+			</tr>
+			<?php
 			if(isset($total_data->passCount)) {
-				$render_pass_fail_card("Gaming Pass / Fails", $total_data->passCount, $total_data->failCount);
+				$render_pass_fail_row("Gaming Pass / Fails", $total_data->passCount, $total_data->failCount);
 			}
 
 			if(isset($total_data->barCounts)) {
-				$render_pass_fail_card("Alcohol Pass / Fails", $total_data->barCounts["pass"],  $total_data->barCounts["fail"]);
+				$render_pass_fail_row("Alcohol Pass / Fails", $total_data->barCounts["pass"],  $total_data->barCounts["fail"]);
 			}
 
 			if(isset($total_data->combinedCounts)) {
-				$render_pass_fail_card("Combined Pass / Fails", $total_data->combinedCounts["pass"],  $total_data->combinedCounts["fail"]);
+				$render_pass_fail_row("Combined Pass / Fails", $total_data->combinedCounts["pass"],  $total_data->combinedCounts["fail"]);
 			}
-
 			?>
-		</div>
+			</tbody>
+		</table>
 
 		<div class="row mb-4">
 			<div class="col-md-4 d-print-none" style="position: relative;">