tests_available.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <div class="container mt-3 py-4">
  2. <input type="hidden" id="csrf-token" value="<?=htmlspecialchars($_SESSION["csrf_token"])?>" />
  3. <div class="row">
  4. <div class="col">
  5. <h2>Find Tests</h2>
  6. </div>
  7. <div class="col-auto">
  8. <a id="claim-tests-button" class="btn btn-primary disabled" href="#" data-toggle="modal" data-target="#modal-test-claim">Claim <span id="claim-number">0</span> ...</a>
  9. </div>
  10. </div>
  11. <div class="card mb-3">
  12. <div class="card-body">
  13. On this page you can search for tests that are currently available. Please use the "Select" buttons or click on the map markers to select and deselect a test. After you have made your selections, please click the "Claim" button on the top-right of this page to assign yourself the tests.
  14. </div>
  15. </div>
  16. <div class="row">
  17. <div class="col-lg-6 order-2 order-lg-1 mb-3 mb-lg-0">
  18. <div class="list-group limit-height-2">
  19. <?php
  20. foreach($tests as $test) {
  21. $location = $test->getLocation();
  22. $distance = Geolocation::getDistance($location->getGeolocation(), $address->getGeolocation());
  23. $distance_formatted = number_format($distance, 1);
  24. $project = $test->getProject();
  25. $template = $project->getTemplate();
  26. ?>
  27. <div class="list-group-item">
  28. <div class="d-flex justify-content-between">
  29. <div>
  30. <div><?=htmlspecialchars($location->name)?></div>
  31. <div><small><?=htmlspecialchars($location->getDisplayAddress())?></small></div>
  32. <div>
  33. <small><strong>Type:</strong> <?=htmlspecialchars($template->name)?></small>
  34. <?php
  35. if($project->isNighttime()) {
  36. ?>
  37. <span class="badge badge-dark">
  38. <i class="fas fa-fw fa-moon"></i>
  39. Nighttime
  40. </span>
  41. <?php
  42. }
  43. ?>
  44. </div>
  45. <div>
  46. <small><strong><?=htmlspecialchars($distance_formatted)?> mi</strong> from your <?=htmlspecialchars($address->name)?> address.</small>
  47. </div>
  48. </div>
  49. <button class="btn btn-primary align-self-start" data-test-id="<?=$test->id?>">Select</button>
  50. </div>
  51. </div>
  52. <?php
  53. }
  54. ?>
  55. </div>
  56. </div>
  57. <div class="col-lg-6 order-1 order-lg-2 mb-3 mb-lg-0">
  58. <div class="input-group mb-3">
  59. <div class="input-group-prepend">
  60. <span class="input-group-text">
  61. Location
  62. </span>
  63. </div>
  64. <input class="form-control" type="text" data-autocomplete="map" />
  65. </div>
  66. <div id="map" data-maps data-lat="<?=$latitude?>" data-lng="<?=$longitude?>" data-zoom="9" data-callback="getTests" style="width: 100%; height: 458px;">
  67. </div>
  68. </div>
  69. </div>
  70. </div>