فهرست منبع

Add "View Travel Costs Photo" link

Alan Lam 6 سال پیش
والد
کامیت
20217f3637
3فایلهای تغییر یافته به همراه37 افزوده شده و 11 حذف شده
  1. 5 0
      engine/test.php
  2. 27 11
      views/test_list.php
  3. 5 0
      views/test_verify_form.php

+ 5 - 0
engine/test.php

@@ -675,6 +675,11 @@ class Test extends Model {
 		return file_exists($directory . "/tester_invoice.pdf");
 	}
 
+	public function hasTravelCostsPhoto(): bool {
+		$path = sprintf("%s/travel_costs.jpg", $this->getDirectory());
+		return file_exists($path);
+	}
+
 	/**
 	 * @return bool
 	 * @throws Exception

+ 27 - 11
views/test_list.php

@@ -1,4 +1,4 @@
-<?php
+<?php /** @noinspection PhpUnhandledExceptionInspection */
 $filters_collapse = $filter_count ? "collapse show" : "collapse";
 $query = $_GET;
 unset($query["path"]);
@@ -36,9 +36,9 @@ $custom_filters = [
 					<div class="col">
 						<div class="input-group">
 							<div class="input-group-prepend">
-								<span class="input-group-text">
+								<label for="sort-dropdown" class="input-group-text">
 									Sort
-								</span>
+								</label>
 							</div>
 							<select class="form-control" id="sort-dropdown" data-url-template="/account/tests?<?=htmlspecialchars(http_build_query($query))?>">
 							<?php
@@ -245,13 +245,17 @@ $custom_filters = [
 
 			<form method="post">
 
-				<div class="table-responsive mb-3">
+				<div class="table-responsive mb-3" style="min-height: 224px;">
 
 					<table class="table table-sm table-sm-text table-hover" style="min-width: 1024px;">
 						<thead>
+						<tr>
 							<th>
-                                <input type="checkbox" id="tests-table-select-all" />
-                            </th>
+								<label for="tests-table-select-all" class="sr-only">
+									<?=htmlspecialchars(__("Select All"))?>
+								</label>
+								<input type="checkbox" id="tests-table-select-all" />
+							</th>
 							<th>ID</th>
 							<th>Location</th>
 							<th>Project</th>
@@ -260,6 +264,7 @@ $custom_filters = [
 							<th>Status</th>
 							<th>Result</th>
 							<th></th>
+						</tr>
 						</thead>
 						<tbody>
 						<?php
@@ -277,7 +282,10 @@ $custom_filters = [
 
 							<tr>
 								<td>
-									<input type="checkbox" name="test_ids[]" value="<?=$test->id?>" />
+									<label for="test-checkbox-<?=$test->id?>" class="sr-only">
+										<?=htmlspecialchars(__("Select Test ID %d", $test->id))?>
+									</label>
+									<input type="checkbox" name="test_ids[]" id="test-checkbox-<?=$test->id?>" value="<?=$test->id?>" />
 								</td>
 								<td>
 									<?=$test->id?>
@@ -356,6 +364,11 @@ $custom_filters = [
 												<a class="dropdown-item" href="/account/tests/<?=$test->id?>/invoice">Download Tester Invoice</a>
 												<?php
 											}
+											if($test->hasTravelCostsPhoto()) {
+												?>
+												<a class="dropdown-item" href="/account/tests/<?=$test->id?>/files/travel_costs">View Travel Costs Photo</a>
+												<?php
+											}
 											?>
 										</div>
 									</div>
@@ -369,14 +382,17 @@ $custom_filters = [
 				</div>
 
 				<div class="row">
-					<div class="col-md-6 offset-md-6">
+					<div class="col-md">
+
+					</div>
+					<div class="col-md-auto">
 						<div class="input-group">
 							<div class="input-group-prepend">
-								<span class="input-group-text">
+								<label class="input-group-text" for="batch-action">
 									Batch Action
-								</span>
+								</label>
 							</div>
-							<select class="form-control" name="batch_action" required>
+							<select class="form-control" name="batch_action" id="batch-action" required>
 								<option value="">Select Action</option>
 								<option value="unassign">Unassign</option>
 								<option value="mark_tester_invoice_paid">Mark Tester Invoice as Paid</option>

+ 5 - 0
views/test_verify_form.php

@@ -119,6 +119,11 @@ function render_card_list_group($details) {
 						<a class="dropdown-item" href="/account/tests/<?=$test->id?>/invoice" target="_blank">Download Tester Invoice</a>
 						<?php
 					}
+					if($test->hasTravelCostsPhoto()) {
+						?>
+						<a class="dropdown-item" href="/account/tests/<?=$test->id?>/files/travel_costs" target="_blank">View Travel Costs Photo</a>
+						<?php
+					}
 					?>
 				</div>
 			</div>