getPendingTests(); $locations = Location::load(array_column($tests, "location_id")); $bounds = new GeolocationBounds; foreach($tests as $test) { $location = $test->getLocation(); $bounds->extend($location->latitude, $location->longitude); } $latitude = 51.3555177; $longitude = -1.1743197; if(HTTP::isAJAX()) { JSON::header(); $action = http::value("action"); switch($action) { case "get-tests": $output = []; foreach($tests as $test) { $location = $test->getLocation(); $icon = null; switch($test->status) { case 2: $icon = "building-orange"; break; case 3: $icon = "building-green"; break; case 4: $icon = "building-pink"; break; case 8: $icon = "building-grey"; break; } $output[] = (object) [ "status" => $test->getStatusText(), "statusClass" => $test->getStatusClass(), "name" => $location->name, "address" => $location->getDisplayAddress(["address_1", "address_2", "city", "county", "postal_code", "state"]), "icon" => $icon, "geolocation" => $location->getGeolocation(), ]; } JSON::success([ "tests" => $output, "southWest" => $bounds->getSouthWest(), "northEast" => $bounds->getNorthEast(), ]); break; default: JSON::fail("Invalid action"); } } View::includeOnce("header", compact("page_title")); View::include("test_list_assigned", compact("tests", "latitude", "longitude")); ?>