| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <table id="projects-table" class="table table-sm table-sm-text table-hover">
- <col style="width: 48px;" />
- <thead>
- <tr>
- <th></th>
- <th class="text-right pr-3">ID</th>
- <th>Name</th>
- <th>Tests</th>
- <th>Period</th>
- <th>Report Month</th>
- <th>Actions</th>
- </tr>
- </thead>
- <tbody class="table-pointer">
- <?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 = $project->getDisplayReportMonth();
- $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-center align-middle">
- <input type="checkbox" name="ids[]" value="<?=$project->id?>" />
- </td>
- <td class="text-right pr-3 align-middle">
- <?=$project->id?>
- </td>
- <td class="align-middle">
- <small><strong><?=htmlspecialchars($template->name)?></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
- }
- if($project->dts_finished) {
- ?>
- <i class="fa fa-fw fa-check text-success" title="Finished" data-toggle="tooltip"></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
- }
- ?>
|