test_list_completed.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <div class="container mt-3 py-4">
  2. <h2>Completed Tests</h2>
  3. <?php
  4. if(empty($tests)) {
  5. ?>
  6. <div class="alert alert-info">
  7. You have not completed any tests yet.
  8. </div>
  9. <?php
  10. }
  11. else {
  12. ?>
  13. <div class="row">
  14. <div class="col-sm text-center text-sm-left align-self-center mb-3">
  15. <?=htmlspecialchars($pagination_object->rangeText)?>
  16. </div>
  17. <div class="col-sm-auto mb-3">
  18. <?php
  19. View::include("pagination");
  20. ?>
  21. </div>
  22. </div>
  23. <div class="list-group">
  24. <?php
  25. $original_timezone = date_default_timezone_get();
  26. foreach($tests as $test) {
  27. $location = $test->getLocation();
  28. $project = $test->getProject();
  29. $attire = $date_start = $time_start = $duration = "N/A";
  30. $attire_class = $date_start_class = $time_start_class = $duration_class = $fee_class = "text-muted";
  31. date_default_timezone_set("UTC");
  32. if($test->dts_start) {
  33. $start_dt = new DateTime($test->dts_start);
  34. $date_start = $start_dt->format("jS M Y");
  35. $time_start = $start_dt->format("H:i:s");
  36. $attire = $test->attire;
  37. $attire_class = $date_start_class = $time_start_class = "";
  38. }
  39. if($test->dts_start && $test->dts_end) {
  40. $end_dt = new DateTime($test->dts_end);
  41. $diff = $start_dt->diff($end_dt, true);
  42. $duration = $diff->format("%i min. %S sec.");
  43. $duration_class = "";
  44. }
  45. date_default_timezone_set($original_timezone);
  46. $status_class = $test->getStatusClass();
  47. $status_text = $test->getStatusText();
  48. $status_class = "secondary";
  49. $status_text = "Pending";
  50. if($test->status == Test::STATUS_CANCELLED) {
  51. $status_class = "danger";
  52. $status_text = "Rejected";
  53. $fee = "N/A";
  54. }
  55. if($test->status == Test::STATUS_COMPLETED) {
  56. $status_class = "success";
  57. $status_text = "Accepted";
  58. $fee = $test->fee ? $test->fee : $project->default_tester_fee;
  59. $fee = "£" . $fee;
  60. $fee_class = "";
  61. }
  62. ?>
  63. <div class="list-group-item list-group-item-action">
  64. <div class="row">
  65. <div class="col-xl">
  66. <div class="row">
  67. <div class="col order-1 order-sm-1">
  68. <strong>ID: <?=$test->id?></strong><br />
  69. <?php
  70. if($test->status == Test::STATUS_COMPLETED) {
  71. ?>
  72. <a href="/account/tests/<?=$test->id?>/invoice" target="_blank">
  73. <i class="fal fa-fw fa-external-link"></i> Invoice
  74. </a>
  75. <?php
  76. }
  77. ?>
  78. </div>
  79. <div class="col-sm order-3 order-sm-2">
  80. <hr class="d-block d-sm-none" />
  81. <?=htmlspecialchars($location->name)?><br />
  82. <small><?=htmlspecialchars($location->getDisplayAddress(["city", "postal_code"]))?></small>
  83. </div>
  84. <div class="col order-2 order-sm-3 text-right text-xl-center align-self-xl-center">
  85. <span class="badge badge-lg badge-<?=$status_class?>"><?=htmlspecialchars($status_text)?></span>
  86. </div>
  87. </div>
  88. <hr class="d-none d-sm-block d-xl-none" />
  89. </div>
  90. <div class="col-xl align-self-xl-center">
  91. <div class="row">
  92. <div class="col-sm <?=$date_start_class?> align-self-xl-center">
  93. <hr class="d-block d-sm-none" />
  94. <strong><?=htmlspecialchars($date_start)?></strong><br />
  95. <small><?=htmlspecialchars($time_start)?> / <?=htmlspecialchars($duration)?></small>
  96. </div>
  97. <div class="col-sm <?=$fee_class?> align-self-xl-center">
  98. <hr class="d-block d-sm-none" />
  99. Fee: <?=$fee?>
  100. </div>
  101. <div class="col-sm <?=$attire_class?> align-self-xl-center">
  102. <hr class="d-block d-sm-none" />
  103. <?=htmlspecialchars($attire)?><br />
  104. <a href="/account/tests/<?=$test->id?>/selfie">View selfie.</a>
  105. </div>
  106. </div>
  107. </div>
  108. </div>
  109. </div>
  110. <?php
  111. }
  112. ?>
  113. </div>
  114. <?php
  115. }
  116. ?>
  117. </div>