|
|
@@ -18,34 +18,39 @@ use Carbon\CarbonImmutable;
|
|
|
|
|
|
$values = $test->getValues(true);
|
|
|
|
|
|
-$test_details = [];
|
|
|
+$get_test_details = static function(Test $test) use ($project, $location): array {
|
|
|
+ $test_details = [];
|
|
|
|
|
|
-$test_details["Project"] = sprintf('<a href="/account/projects/%d">%s</a>', $test->project_id, $project->getNameHtml());
|
|
|
+ $test_details["Project"] = sprintf('<a href="/account/projects/%d">%s</a>', $test->project_id, $project->getNameHtml());
|
|
|
|
|
|
-$test_details["Status"] = "<span class=\"badge badge-lg badge-" . $test->getStatusClass() . "\">" . $test->getStatusText() . "</span>";
|
|
|
+ $test_details["Status"] = "<span class=\"badge badge-lg badge-" . $test->getStatusClass() . "\">" . $test->getStatusText() . "</span>";
|
|
|
|
|
|
-if($test->isVoid()) {
|
|
|
- $test_details["Result"] = "<span class=\"badge badge-lg badge-secondary\">Void</span>";
|
|
|
-}
|
|
|
-else {
|
|
|
- $test_details["Result"] = "<span class=\"badge badge-lg badge-" . $test->getPassClass() . "\">" . $test->getPassText() . "</span>";
|
|
|
-}
|
|
|
+ if($test->isVoid()) {
|
|
|
+ $test_details["Result"] = "<span class=\"badge badge-lg badge-secondary\">Void</span>";
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $test_details["Result"] = "<span class=\"badge badge-lg badge-" . $test->getPassClass() . "\">" . $test->getPassText() . "</span>";
|
|
|
+ }
|
|
|
|
|
|
-$test_details["Location"] = "<a href=\"/account/locations/$location->id\" target=\"_blank\">" . htmlspecialchars($location->name) . "</a>";
|
|
|
-$test_details["Address"] = htmlspecialchars($location->getDisplayAddress(["address_1", "address_2", "city", "postal_code"]));
|
|
|
+ $test_details["Location"] = "<a href=\"/account/locations/$location->id\" target=\"_blank\">" . htmlspecialchars($location->name) . "</a>";
|
|
|
+ $test_details["Address"] = htmlspecialchars($location->getDisplayAddress(["address_1", "address_2", "city", "postal_code"]));
|
|
|
|
|
|
-if($test->dts_end) {
|
|
|
- $test_details = array_merge($test_details, [
|
|
|
- "Duration" => $test->getDisplayDuration(),
|
|
|
- "Start" => Util::getDisplayDateTime(strtotime($test->dts_start . " UTC")),
|
|
|
- "End" => Util::getDisplayDateTime(strtotime($test->dts_end . " UTC")),
|
|
|
- ]);
|
|
|
-}
|
|
|
+ if($test->dts_end) {
|
|
|
+ $test_details = array_merge($test_details, [
|
|
|
+ "Duration" => $test->getDisplayDuration(),
|
|
|
+ "Start" => Util::getDisplayDateTime(strtotime($test->dts_start . " UTC")),
|
|
|
+ "End" => Util::getDisplayDateTime(strtotime($test->dts_end . " UTC")),
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(in_array($test->getStatus(), [Test::STATUS_CANCELLED, Test::STATUS_COMPLETED], true)) {
|
|
|
+ $test_details["Verified"] = Util::getDisplayDateTime(strtotime($test->dts_verified . " UTC"));
|
|
|
+ $test_details["Retest"] = $test->retest ? "Yes" : "No";
|
|
|
+ }
|
|
|
+
|
|
|
+ return $test_details;
|
|
|
+};
|
|
|
|
|
|
-if(in_array($test->getStatus(), [Test::STATUS_CANCELLED, Test::STATUS_COMPLETED], true)) {
|
|
|
- $test_details["Verified"] = Util::getDisplayDateTime(strtotime($test->dts_verified . " UTC"));
|
|
|
- $test_details["Retest"] = $test->retest ? "Yes" : "No";
|
|
|
-}
|
|
|
|
|
|
$tester_details = [
|
|
|
"Name" => "Unassigned"
|
|
|
@@ -232,7 +237,7 @@ function render_card_list_group($details) {
|
|
|
</div>
|
|
|
</div>
|
|
|
<?php
|
|
|
- render_card_list_group($test_details);
|
|
|
+ render_card_list_group($get_test_details($test));
|
|
|
?>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -530,6 +535,29 @@ function render_card_list_group($details) {
|
|
|
?>
|
|
|
</div>
|
|
|
</div>
|
|
|
+
|
|
|
+ <?php
|
|
|
+ $previous_test = $test->getPreviousTest();
|
|
|
+ if($previous_test) {
|
|
|
+ $dt = $previous_test->getDateTimeStart();
|
|
|
+ $previous_test_details = $get_test_details($previous_test);
|
|
|
+ $previous_test_details_subset = [
|
|
|
+ "Date/Time" => $previous_test_details["Start"],
|
|
|
+ "Result" => $previous_test_details["Result"],
|
|
|
+ ];
|
|
|
+
|
|
|
+ ?>
|
|
|
+ <div class="card mb-3">
|
|
|
+ <div class="card-header">
|
|
|
+ <?=htmlspecialchars(__("Previous Test"))?>
|
|
|
+ </div>
|
|
|
+ <?php
|
|
|
+ render_card_list_group($previous_test_details_subset);
|
|
|
+ ?>
|
|
|
+ </div>
|
|
|
+ <?php
|
|
|
+ }
|
|
|
+ ?>
|
|
|
</div>
|
|
|
</div>
|
|
|
</form>
|