| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <table class="table table-sm table-sm-text table-hover">
- <thead>
- <tr>
- <th class="text-right pr-3">ID</th>
- <th>Name</th>
- <th>Tests</th>
- <th>Period</th>
- <th>Report Month</th>
- <th></th>
- </tr>
- </thead>
- <tbody>
- <?php
- $project_ids = array_column($projects, "id");
- $tests = Test::query(["project_id" => $project_ids]);
- foreach($projects as $project) {
- $year = date("Y", strtotime($project->dts_start));
- $date_start = date("M jS", strtotime(explode(" ", $project->dts_start)[0]));
- $date_deadline = date("M jS", strtotime(explode(" ", $project->dts_deadline)[0]));
- $report_month = "N/A";
- if($project->dts_report) {
- $dt_report = new DateTime($project->dts_report . " UTC");
- $report_month = $dt_report->format("M Y");
- }
- $time_of_day_icon = $project->time_of_day != "A" ? $project->getTimeOfDayIcon() : null;
- $time_of_day_text = $project->getTimeOfDayText();
- $template = $project->getTemplate();
- $completed_tests = array_filter($tests, function($test) use ($project) {
- return ($project->id == $test->project_id) && ($test->status == Test::STATUS_COMPLETED);
- });
- $completed_test_count = count($completed_tests);
- ?>
- <tr>
- <td class="text-right pr-3 align-middle">
- <?=$project->id?>
- </td>
- <td class="align-middle">
- <small><strong><a href="<?=htmlspecialchars($template->getURL())?>"><?=htmlspecialchars($template->name)?></a></strong></small><br />
- <a href="/account/projects/<?=$project->id?>"><?=htmlspecialchars($project->name)?></a>
- <?php
- if($time_of_day_icon) {
- ?>
- <i class="fal fa-<?=$time_of_day_icon?>" data-toggle="tooltip" data-title="<?=$time_of_day_text?> Tests"></i>
- <?php
- }
- ?>
- </td>
- <td class="align-middle">
- <small><strong>Completed</strong></small><br />
- <?=$completed_test_count?> / <?=$project->test_count?>
- </td>
- <td class="align-middle">
- <small><strong><?=$year?></strong></small><br />
- <?=$date_start?> -
- <?=$date_deadline?>
- </td>
- <td class="align-middle">
- <?=$report_month?>
- </td>
- <td class="text-right align-middle">
- <a class="btn btn-sm btn-outline-primary" href="/account/projects/<?=$project->id?>/edit">Edit</a>
- </td>
- </tr>
- <?php
- }
- ?>
- </tbody>
- </table>
- <?php
- if(empty($projects)) {
- ?>
- <div class="alert alert-info">
- No projects to display.
- </div>
- <?php
- }
- ?>
|