getDateTimeStart(); $dt_deadline = $project->getDateTimeDeadline(); $dt_report = $project->getDateTimeReport() ?: null; $date_report = $dt_report ? $dt_report->format("Y-m-d") : ""; $name_readonly = $project->id ? "" : "readonly"; $autogen_checked = $project->id ? "" : "checked"; $tests = []; $location_test = []; if($project->id) { $tests = $project->getTests(); foreach($tests as $test) { $location_test[$test->location_id] = $test; } } $selected_locations = array_filter($locations, static function(Location $l) use ($location_ids) { return in_array($l->id, $location_ids, false); }); $deselected_locations = array_filter($locations, static function(Location $l) use ($location_ids) { return !in_array($l->id, $location_ids, false); }); $output_locations = static function(array $locations, bool $selected) use ($location_test) { foreach($locations as $location) { $address = $location->getDisplayAddress(["address_1", "address_2", "city", "postal_code"]); $filter_parts = array_filter([ $address, $location->name ]); $filter = strtolower(implode("", $filter_parts)); $button_class = $selected ? "danger" : "success"; $button_text = $selected ? "Deselect" : "Select"; $icon = $selected ? "times" : "check"; $test = $location_test[$location->id] ?? null; $test_status = $test_class = ""; if($test) { $test_status = $test->getStatusText(); $test_class = $test->getStatusClass(); } ?>