|
|
@@ -139,16 +139,60 @@ function initialiseLocations() {
|
|
|
|
|
|
|
|
|
// Add to list group
|
|
|
- let listGroupItem = $("div[data-nearby-location-list-group-item-template]").clone();
|
|
|
- listGroupItem.removeAttr("data-nearby-location-list-group-item-template");
|
|
|
+ let lgi = $("div[data-nearby-location-list-group-item-template]").clone();
|
|
|
+ lgi.removeAttr("data-nearby-location-list-group-item-template");
|
|
|
|
|
|
- listGroupItem.find("a[data-location-name]").text(location.name);
|
|
|
- listGroupItem.find("span[data-location-distance]").text(location.distance + " miles");
|
|
|
- listGroupItem.find("span[data-location-id]").text(location.id);
|
|
|
- listGroupItem.find("span[data-location-internal-id]").text(location.internalId);
|
|
|
- listGroupItem.find("small[data-location-address]").text(location.address);
|
|
|
+ lgi.find("a[data-location-name]").text(location.name);
|
|
|
+ lgi.find("span[data-location-distance]").text(location.distance + " miles");
|
|
|
+ lgi.find("span[data-location-id]").text(location.id);
|
|
|
+ lgi.find("span[data-location-internal-id]").text(location.internalId);
|
|
|
+ lgi.find("small[data-location-address]").text(location.address);
|
|
|
|
|
|
- listGroupItem.appendTo("#nearby-locations-list-group").show();
|
|
|
+ if(location.test) {
|
|
|
+ let test = location.test;
|
|
|
+ let tester = test.tester;
|
|
|
+ let project = test.project;
|
|
|
+
|
|
|
+ lgi.find("div[data-test-container]").removeClass("d-none");
|
|
|
+ lgi.find("div[data-test-id-container] a").text(test.id).attr("href", "/account/tests/" + test.id);
|
|
|
+ lgi.find("div[data-test-project-name-container] a").text(project.name).attr("href", "/account/projects/" + project.id);
|
|
|
+
|
|
|
+ if(tester) {
|
|
|
+ lgi.find("div[data-test-user-name-container] a").text(tester.name).attr("href", "/account/users/" + tester.id);
|
|
|
+
|
|
|
+ let passText = "";
|
|
|
+ let passClass = "";
|
|
|
+
|
|
|
+ if(test.pass === null) {
|
|
|
+ passText = "Pending";
|
|
|
+ passClass = "warning";
|
|
|
+ lgi.find("div[data-test-due-dts-container]").removeClass("d-none").find("span").text(test.formattedDueDts);
|
|
|
+
|
|
|
+ if(test.pastDue) {
|
|
|
+ lgi.find("div[data-test-due-dts-container]").append(" <span class=\"badge badge-danger\">Overdue</span>");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if(test.pass === 0) {
|
|
|
+ passText = "Fail";
|
|
|
+ passClass = "danger";
|
|
|
+ }
|
|
|
+ else if(test.pass === 1) {
|
|
|
+ passText = "Pass";
|
|
|
+ passClass = "success";
|
|
|
+ }
|
|
|
+
|
|
|
+ if(test.pass !== null) {
|
|
|
+ lgi.find("div[data-test-start-dts-container]").removeClass("d-none").find("span").text(test.formattedStartDts);
|
|
|
+ }
|
|
|
+
|
|
|
+ lgi.find("div[data-test-pass-container] span").addClass("text-" + passClass).text(passText);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ lgi.appendTo("#nearby-locations-list-group").show();
|
|
|
|
|
|
addMarkerClickListenerForLocation(marker, location);
|
|
|
|
|
|
@@ -188,7 +232,7 @@ function addMarkerClickListenerForLocation(m, l) {
|
|
|
|
|
|
let pastDueBadge = '';
|
|
|
if(l.test.pastDue) {
|
|
|
- pastDueBadge = '<span class="badge badge-lg badge-primary">Past Due</span>';
|
|
|
+ pastDueBadge = '<span class="badge badge-lg badge-primary">Overdue</span>';
|
|
|
}
|
|
|
|
|
|
if(l.test.formattedDueDts) {
|