|
|
@@ -9,6 +9,24 @@
|
|
|
* @var Template $template
|
|
|
*/
|
|
|
|
|
|
+// Get test counts for current year cycle
|
|
|
+$tests = Test::query([
|
|
|
+ "status" => 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]++;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
$dt_start = $project->getDateTimeStart();
|
|
|
$dt_deadline = $project->getDateTimeDeadline();
|
|
|
|
|
|
@@ -18,6 +36,7 @@ $date_report = $dt_report ? $dt_report->format("Y-m-d") : "";
|
|
|
$name_readonly = $project->id ? "" : "readonly";
|
|
|
$autogen_checked = $project->id ? "" : "checked";
|
|
|
|
|
|
+// Figure out which locations are selected
|
|
|
$tests = [];
|
|
|
$location_test = [];
|
|
|
if($project->id) {
|
|
|
@@ -30,7 +49,12 @@ if($project->id) {
|
|
|
$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) {
|
|
|
+/**
|
|
|
+ * @param Location[] $locations
|
|
|
+ * @param bool $selected
|
|
|
+ * @return void
|
|
|
+ */
|
|
|
+$output_locations = static function(array $locations, bool $selected) use ($location_test, $test_counts, $customer) {
|
|
|
foreach($locations as $location) {
|
|
|
$address = $location->getDisplayAddress(["address_1", "address_2", "city", "postal_code"]);
|
|
|
|
|
|
@@ -75,7 +99,11 @@ $output_locations = static function(array $locations, bool $selected) use ($loca
|
|
|
}
|
|
|
?>
|
|
|
</div>
|
|
|
- <small><?=htmlspecialchars($address)?></small>
|
|
|
+ <small><?=htmlspecialchars($address)?></small><br />
|
|
|
+ <small title="<?=htmlspecialchars(__("Number of tests completed between %s", $customer->getDisplayYearCycle()))?>">
|
|
|
+ <strong>Completed:</strong>
|
|
|
+ <?=htmlspecialchars(sprintf("%d / %d", $test_counts[$location->id] ?? 0, $location->annual_test_count))?>
|
|
|
+ </small>
|
|
|
</div>
|
|
|
<div class="col-auto align-self-center text-right">
|
|
|
<button class="btn btn-outline-<?=$button_class?>" type="button">
|