Constraint::notEquals(Test::STATUS_CANCELLED), "location_id" => array_column($locations, "id"), "dts_start" => $customer->getYearCycleConstraint(TIMEZONE), ]); $test_counts = []; foreach($tests as $test) { if(!isset($test_counts[$test->location_id])) { $test_counts[$test->location_id] = 0; } if($test->isCompleted()) { $test_counts[$test->location_id]++; } } $latest_tests = $customer->getLatestTestByLocation(); $dt_start = $project->getDateTimeStart(); $dt_deadline = $project->getDateTimeDeadline(); $dt_report = $project->getDateTimeReport() ?: null; $date_report = $dt_report ? $dt_report->format("Y-m-d") : ""; $date_invoice = $project->invoice_date; $name_readonly = $project->id ? "" : "readonly"; $autogen_checked = $project->id ? "" : "checked"; // Figure out which locations are selected $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); }); /** * @param Location[] $locations * @param bool $selected * @return void */ $output_locations = static function(array $locations, bool $selected) use ($location_test, $test_counts, $customer, $latest_tests, $user) { 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(); } ?>
id?>
name)?> Edit
internal_id) { ?> Internal ID: internal_id)?>

Last Test: id] ?? null; if($test) { $test->renderTestStatus($user); } else { ?> None
getDisplayYearCycle()))?>"> Completed: id] ?? 0, $location->annual_test_count))?>

id ? "Edit" : "Add")?> Project for name)?>

Project Details

/>
/>
£
£
£
Tests will appear in "Find Tests" for testers.
" required />
" required />
id) { ?>

Template Overrides

getTemplateOverrides(); if(empty($overrides)) { ?>
There are no template overrides configured for this project.
getFields(); ?>
Field Element Value
field]->label)?> element)?> value)?>

" />

Project Locations

id) { ?>
Please be aware that deselecting a location will cancel the test for the project no matter its current status.
This action cannot be undone, you have been warned!

Selected

No locations selected for testing.

Not Selected

No additional locations are available for testing.

" />