Parcourir la source

Added ID column to locations and testers. Converted text buttons to icon buttons. Moved internal ID to its own line.

Alan Lam il y a 8 ans
Parent
commit
72dc08fedd
3 fichiers modifiés avec 30 ajouts et 18 suppressions
  1. 1 0
      controllers/project_ajax.php
  2. 25 15
      public/js/app-project.js
  3. 4 3
      views/project.php

+ 1 - 0
controllers/project_ajax.php

@@ -63,6 +63,7 @@ if($submit) {
 						"testId" => (int) $test_id,
 						"name" => $location->name,
 						"address" => $location->getDisplayAddress(["address_1", "address_2", "city", "postal_code"]),
+						"address1" => $location->address_1,
 						"status" => $status,
 						"statusText" => $status_text,
 						"pass" => (int) $pass,

+ 25 - 15
public/js/app-project.js

@@ -133,18 +133,25 @@ function initialiseLocations() {
 			// Populate table
 			var tr = $("<tr data-location-id=\"" + location.id + "\" data-internal-id=\"" + location.internalId + "\" data-latitude=\"" + location.latitude + "\" data-longitude=\"" + location.longitude + "\" data-filter-value=\"" + filterValue + "\"></tr>");
 
-			var a = $("<a>").attr("href", "/account/locations/" + location.id).attr("target", "_blank").text(location.name);
+			var td = $("<td class=\"text-right\"></td>");
+			td.append(location.id);
+			tr.append(td);
 
-			if(location.internalId) {
-				var small = $("<small>").text("(Internal ID: " + location.internalId + ")");
-				a.append(" ");
-				a.append(small);
-			}
+			var a = $("<a>").attr("href", "/account/locations/" + location.id).attr("target", "_blank").text(location.name);
 
 			var td = $("<td></td>");
 			td.append(a);
 			td.append("<br />");
-			td.append($("<small>").text(location.address));
+
+			if(location.internalId) {
+				var small = $("<small class=\"text-info\">").text("Internal ID: " + location.internalId);
+				td.append(small);
+				td.append("<br />");
+			}
+
+			var address = $("<small>").text(location.address1);
+
+			td.append(address);
 			tr.append(td);
 
 			var td = $("<td>").addClass("align-middle").addClass("text-center");
@@ -160,10 +167,10 @@ function initialiseLocations() {
 
 			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");
+				var button = $("<button data-find-testers-button title=\"Find Testers\" data-toggle=\"tooltip\">").addClass("btn").addClass("btn-outline-primary").html("<i class=\"fal fa-fw fa-search\"></i>").tooltip();
 			}
 			else {
-				var button = $("<a class=\"btn btn-outline-primary\" href=\"/account/tests/" + location.testId + "\">").html("View Test");
+				var button = $("<a class=\"btn btn-outline-success\" href=\"/account/tests/" + location.testId + "\" title=\"View Test\" data-toggle=\"tooltip\" >").html("<i class=\"fal fa-fw fa-clipboard-check\"></i>").tooltip();
 			}
 
 			td.append(button);
@@ -286,8 +293,15 @@ function initialiseTesters() {
 
 			var tr = $("<tr data-tester-id=\"" + tester.id + "\" data-address-id=\"" + tester.addressId + "\" data-filter-value=\"" + filterValue + "\"></tr>");
 
+			var td = $("<td class=\"text-right\"></td>");
+			td.append(tester.id);
+			tr.append(td);
+
 			var td = $("<td></td>");
-			td.append("<a href=\"/account/users/" + tester.id + "\" target=\"_blank\">" + tester.name + "</a>");
+			td.append("<a href=\"/account/users/" + tester.id + "\" target=\"_blank\">" + tester.name + "</a> ");
+
+			td.append("<small>(" +  tester.score + ")</small>");
+
 			td.append("<br />");
 
 			var small = $("<small>Distance: " + tester.distanceMiles + " / " + tester.maxRadiusMiles + " miles</small>");
@@ -301,10 +315,6 @@ function initialiseTesters() {
 			td.append(tester.age);
 			tr.append(td);
 
-			td = $("<td class=\"text-right align-middle\"></td>");
-			td.append(tester.score);
-			tr.append(td);
-
 			td = $("<td class=\"text-right align-middle\"></td>");
 			td.append("<span class=\"badge badge-" + tester.levelClass + "\">" + tester.levelText + "</span>");
 			td.append("<br />");
@@ -313,7 +323,7 @@ function initialiseTesters() {
 
 			td = $("<td class=\"text-right align-middle\"></td>");
 			if(!tester.isCurrentTester) {
-				td.append("<button class=\"btn btn-outline-primary\" data-assign-button>Assign...</button>");
+				td.append($("<button class=\"btn btn-outline-primary\" data-assign-button title=\"Assign\" data-toggle=\"tooltip\"><i class=\"fal fa-fw fa-user-plus\"></i>...</button>").tooltip());
 			}
 			tr.append(td);
 

+ 4 - 3
views/project.php

@@ -129,6 +129,7 @@ var projectID = <?=$project->id?>;
 				<table class="table table-hover table-sm">
 					<thead>
 						<tr>
+							<th class="text-right">ID</th>
 							<th>Name</th>
 							<th>Status</th>
 							<th>Result</th>
@@ -162,9 +163,9 @@ var projectID = <?=$project->id?>;
 				<table class="table table-hover table-sm">
 					<thead>
 						<tr>
-							<th>Name / Distance</th>
-							<th class="text-right">Age</th>
-							<th class="text-right">Score</th>
+							<th class="text-right">ID</th>
+							<th>Name / Score / Dist.</th>
+							<th>Age</th>
 							<th class="text-right">Level / Phone</th>
 							<th></th>
 						</tr>