test_list_completed.php 4.7 KB

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