|
|
@@ -39,6 +39,8 @@ $(function() {
|
|
|
initialiseLocations();
|
|
|
});
|
|
|
|
|
|
+ $("#pending-tests").on("change", () => initialiseLocations());
|
|
|
+
|
|
|
});
|
|
|
|
|
|
function initialiseAddresses() {
|
|
|
@@ -99,9 +101,10 @@ function initialiseLocations() {
|
|
|
let map = maps["nearby-locations-map"];
|
|
|
|
|
|
$.get("/api/users/" + userId + "/get-locations", {
|
|
|
- "address_id": $("#address-id").val(),
|
|
|
- "date_start": $("#date-start").val(),
|
|
|
- "date_end": $("#date-end").val()
|
|
|
+ address_id: $("#address-id").val(),
|
|
|
+ date_start: $("#date-start").val(),
|
|
|
+ date_end: $("#date-end").val(),
|
|
|
+ pending_tests: $("#pending-tests").is(":checked") ? 1 : 0
|
|
|
}, function(response) {
|
|
|
if(!response.success) return false;
|
|
|
if(!response.locations) return false;
|
|
|
@@ -224,45 +227,46 @@ function initialiseLocations() {
|
|
|
|
|
|
}
|
|
|
|
|
|
-function addMarkerClickListenerForLocation(m, l) {
|
|
|
+function addMarkerClickListenerForLocation(marker, location) {
|
|
|
|
|
|
let map = maps["map"];
|
|
|
|
|
|
- m.addListener("click", function() {
|
|
|
- let content = "<strong><a href=\"/account/locations/" + l.id + "\" target=\"_blank\">" + l.name + "</a></strong><br />";
|
|
|
- if(l.internalId) {
|
|
|
- content += "<div class=\"small\"><strong>Internal ID:</strong> " + l.internalId + "</div>";
|
|
|
+ marker.addListener("click", function() {
|
|
|
+ let content = "<strong><a href=\"/account/locations/" + location.id + "\" target=\"_blank\">" + location.name + "</a></strong><br />";
|
|
|
+ if(location.internalId) {
|
|
|
+ content += "<div class=\"small\"><strong>Internal ID:</strong> " + location.internalId + "</div>";
|
|
|
}
|
|
|
- content += "<div class=\"small\"><strong>Location ID:</strong> " + l.id + "</div>";
|
|
|
+ content += "<div class=\"small\"><strong>Location ID:</strong> " + location.id + "</div>";
|
|
|
|
|
|
- if(l.test) {
|
|
|
+ if(location.test) {
|
|
|
|
|
|
content += '<hr />';
|
|
|
|
|
|
- content += '<div class="small"><strong>Test ID:</strong> <a href="/account/tests/' + l.test.id + '" target="_blank">' + l.test.id + '</a></div>';
|
|
|
+ content += '<div class="small"><strong>Test ID:</strong> <a href="/account/tests/' + location.test.id + '" target="_blank">' + location.test.id + '</a></div>';
|
|
|
+ content += '<div class="small"><strong>Project:</strong> <a href="/account/projects/' + location.test.project.id + '" target="_blank">' + location.test.project.name + '</a></div>';
|
|
|
|
|
|
- if(l.test.formattedStartDts) {
|
|
|
- content += '<div class="small"><strong>Date/Time:</strong> ' + l.test.formattedStartDts + '</div>';
|
|
|
+ if(location.test.formattedStartDts) {
|
|
|
+ content += '<div class="small"><strong>Date/Time:</strong> ' + location.test.formattedStartDts + '</div>';
|
|
|
}
|
|
|
|
|
|
- if(l.test.tester) {
|
|
|
- content += '<div class="small"><strong>Tester ID:</strong> ' + l.test.tester.id + '</div>';
|
|
|
- content += '<div class="small"><strong>Tester Name:</strong> <a href="/account/users/' + l.test.tester.id + '" target="_blank">' + l.test.tester.name + '</a></div>';
|
|
|
+ if(location.test.tester) {
|
|
|
+ content += '<div class="small"><strong>Tester ID:</strong> ' + location.test.tester.id + '</div>';
|
|
|
+ content += '<div class="small"><strong>Tester Name:</strong> <a href="/account/users/' + location.test.tester.id + '" target="_blank">' + location.test.tester.name + '</a></div>';
|
|
|
}
|
|
|
|
|
|
let pastDueBadge = '';
|
|
|
- if(l.test.pastDue) {
|
|
|
+ if(location.test.pastDue) {
|
|
|
pastDueBadge = '<span class="badge badge-lg badge-primary">Overdue</span>';
|
|
|
}
|
|
|
|
|
|
- if(l.test.formattedDueDts) {
|
|
|
- content += '<div class="small"><strong>Due:</strong> ' + l.test.formattedDueDts + ' ' + pastDueBadge + '</div>';
|
|
|
+ if(location.test.formattedDueDts) {
|
|
|
+ content += '<div class="small"><strong>Due:</strong> ' + location.test.formattedDueDts + ' ' + pastDueBadge + '</div>';
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
infoWindow.setContent(content);
|
|
|
- infoWindow.open(map, m);
|
|
|
+ infoWindow.open(map, marker);
|
|
|
});
|
|
|
|
|
|
}
|