| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- <?php /** @noinspection PhpUnhandledExceptionInspection */
- /**
- * @var string $page_title
- * @var array $ranges
- */
- use Carbon\CarbonImmutable;
- $exclude_customers = Customer::query(["show_in_map_overview" => 0]);
- $exclude_customer_ids = array_column($exclude_customers, "id");
- $exclude_projects = Project::query(["customer_id" => $exclude_customer_ids]);
- $exclude_project_ids = array_column($exclude_projects, "id");
- ?>
- <div class="container mt-3 py-4">
- <h2><?=htmlspecialchars($page_title)?></h2>
- <div class="row">
- <?php
- foreach($ranges as $range) {
- $name = $range["name"];
- /** @var CarbonImmutable $dt_start */
- $dt_start = $range["start"];
- /** @var CarbonImmutable $dt_end */
- $dt_end = $range["end"];
- $dts_start = $dt_start->utc()->format("Y-m-d H:i:s");
- $dts_end = $dt_end->utc()->format("Y-m-d H:i:s");
- $test_count = Test::count([
- "project_id" => Constraint::notIn($exclude_project_ids),
- "dts_start" => Constraint::between($dts_start, $dts_end),
- "status" => Test::STATUS_COMPLETED
- ]);
- $projects = Project::query([
- "customer_id" => Constraint::notIn($exclude_customer_ids),
- "dts_start" => Constraint::between($dts_start, $dts_end),
- ], [
- "sort" => "dts_start"
- ]);
- ?>
- <div class="col-lg-4">
- <h3><?=htmlspecialchars($name)?></h3>
- <?php
- Html::renderStat("Test Count", $test_count);
- ?>
- <div class="list-group">
- <?php
- foreach($projects as $project) {
- $completed_count = $project->getCompletedTestCount();
- $percentage = round(($completed_count / $project->test_count) * 100);
- if($percentage > 100) $percentage = 100;
- ?>
- <a class="list-group-item list-group-item-action text-nowrap" style="font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis;" href="/account/projects/<?=$project->id?>">
- <?=htmlspecialchars($project->name)?>
- <div class="progress">
- <div class="progress-bar" role="progressbar" aria-valuenow="<?=$percentage?>" aria-valuemin="0" aria-valuemax="100" style="width: <?=$percentage?>%">
- </div>
- </div>
- <strong><?=htmlspecialchars(__("Completed:"))?></strong>
- <?=$percentage?>%
- (<?=$completed_count?> of <?=$project->test_count?>)
- </a>
- <?php
- }
- ?>
- </div>
- <?php
- ?>
- </div>
- <?php
- }
- ?>
- </div>
- </div>
|