Răsfoiți Sursa

Added test result icons to project location list.

Alan Lam 8 ani în urmă
părinte
comite
a2949b13ae
3 a modificat fișierele cu 23 adăugiri și 1 ștergeri
  1. 14 0
      controllers/project_ajax.php
  2. 7 0
      public/js/app-project.js
  3. 2 1
      views/project.php

+ 14 - 0
controllers/project_ajax.php

@@ -40,12 +40,22 @@ if($submit) {
 					$test_id = null;
 					$status = 0;
 					$status_text = "";
+
+					$pass = 0;
+					$pass_class = "";
+					$pass_text = "";
+					$pass_icon = "";
+
 					$class = "secondary";
 					if($test) {
 						$test_id = $test->id;
 						$class = $test->getStatusClass();
 						$status = $test->status;
 						$status_text = $test->getStatusText();
+						$pass = $test->pass;
+						$pass_class = $test->getPassClass();
+						$pass_text = $test->getPassText();
+						$pass_icon = $test->getPassIcon();
 					}
 
 					$output[] = (object) [
@@ -55,6 +65,10 @@ if($submit) {
 						"address" => $location->getDisplayAddress(["address_1", "address_2", "city", "postal_code"]),
 						"status" => $status,
 						"statusText" => $status_text,
+						"pass" => (int) $pass,
+						"passClass" => $pass_class,
+						"passText" => $pass_text,
+						"passIcon" => $pass_icon,
 						"class" => $class,
 						"latitude" => (float) $location->latitude,
 						"longitude" => (float) $location->longitude

+ 7 - 0
public/js/app-project.js

@@ -78,6 +78,13 @@ function initialiseLocations() {
 			td.append($("<span>").addClass("badge").addClass("badge-" + cssClass).text(location.statusText));
 			tr.append(td);
 
+			var td = $("<td>").addClass("align-middle").addClass("text-center").addClass("text-" + location.passClass);
+			var div = $("<div>").attr("title", location.passText).attr("data-toggle", "tooltip");
+			div.append($("<i>").addClass().addClass("fas").addClass("fa-fw").addClass("fa-" + location.passIcon));
+			td.append(div);
+			tr.append(td);
+			div.tooltip();
+
 			var td = $("<td>").addClass("align-middle").addClass("text-right");
 			if(cssClass == "danger" || cssClass == "warning") {
 				var button = $("<button data-find-testers-button>").addClass("btn").addClass("btn-outline-primary").html("Find Testers");

+ 2 - 1
views/project.php

@@ -102,6 +102,7 @@ var projectID = <?=$project->id?>;
 					<tr>
 						<th>Name</th>
 						<th>Status</th>
+						<th>Result</th>
 						<th></th>
 					</tr>
 				</thead>
@@ -124,7 +125,7 @@ var projectID = <?=$project->id?>;
 						<th>Name / Distance</th>
 						<th class="text-right">Age</th>
 						<th class="text-right">Score</th>
-						<th class="text-right">User Level / Phone</th>
+						<th class="text-right">Level / Phone</th>
 						<th></th>
 					</tr>
 				</thead>