| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- <div class="container mt-3 py-4">
- <h2>Completed Tests</h2>
- <?php
- if(empty($tests)) {
- ?>
- <div class="alert alert-info">
- You have not completed any tests yet.
- </div>
- <?php
- }
- else {
- ?>
- <div class="row">
- <div class="col-sm text-center text-sm-left align-self-center mb-3">
- <?=htmlspecialchars($pagination_object->rangeText)?>
- </div>
- <div class="col-sm-auto mb-3">
- <?php
- View::include("pagination");
- ?>
- </div>
- </div>
- <table class="table table-sm table-hover">
- <thead>
- <tr>
- <th class="text-right">ID</th>
- <th>Location</th>
- <th>Attire</th>
- <th>Selfie</th>
- <th>Date</th>
- <th>Time</th>
- <th>Duration</th>
- <th>Status</th>
- <th>Fee</th>
- </tr>
- </thead>
- <tbody>
- <?php
- $original_timezone = date_default_timezone_get();
- foreach($tests as $test) {
- $location = $test->getLocation();
- $project = $test->getProject();
- $attire = $date_start = $time_start = $duration = "N/A";
- $attire_class = $date_start_class = $time_start_class = $duration_class = $fee_class = "text-muted";
- date_default_timezone_set("UTC");
- if($test->dts_start) {
- $start_dt = new DateTime($test->dts_start);
- $date_start = $start_dt->format("d/m/Y");
- $time_start = $start_dt->format("H:i:s");
- $attire = $test->attire;
- $attire_class = $date_start_class = $time_start_class = "";
- }
- if($test->dts_start && $test->dts_end) {
- $end_dt = new DateTime($test->dts_end);
- $diff = $start_dt->diff($end_dt, true);
- $duration = $diff->format("%H:%I:%S");
- $duration_class = "";
- }
- date_default_timezone_set($original_timezone);
- $status_class = $test->getStatusClass();
- $status_text = $test->getStatusText();
- $status_class = "secondary";
- $status_text = "Pending";
- if($test->status == Test::STATUS_CANCELLED) {
- $status_class = "danger";
- $status_text = "Rejected";
- $fee = "N/A";
- }
- if($test->status == Test::STATUS_COMPLETED) {
- $status_class = "success";
- $status_text = "Accepted";
- $fee = $test->fee ? $test->fee : $project->default_tester_fee;
- $fee = "£" . $fee;
- $fee_class = "";
- }
- ?>
- <tr>
- <td class="text-right">
- <?=$test->id?>
- </td>
- <td>
- <?=htmlspecialchars($location->name)?><br />
- <small><?=htmlspecialchars($location->getDisplayAddress(["address_1", "address_2", "city", "postal_code"]))?></small>
- </td>
- <td class="<?=$attire_class?>">
- <?=htmlspecialchars($attire)?>
- </td>
- <td class="align-middle">
- <a class="btn btn-outline-primary" href="/account/tests/<?=$test->id?>/selfie">View</a>
- </td>
- <td class="text-center align-middle <?=$date_start_class?>">
- <?=htmlspecialchars($date_start)?>
- </td>
- <td class="text-center align-middle <?=$time_start_class?>">
- <?=htmlspecialchars($time_start)?>
- </td>
- <td class="text-center align-middle <?=$duration_class?>">
- <?=htmlspecialchars($duration)?>
- </td>
- <td class="text-center align-middle">
- <span class="badge badge-lg badge-<?=$status_class?>"><?=htmlspecialchars($status_text)?></span>
- </td>
- <td class="text-center align-middle <?=$fee_class?>">
- <?=$fee?>
- </td>
- </tr>
- <?php
- }
- ?>
- </tbody>
- </table>
- <?php
- }
- ?>
- </div>
|