template.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <?php
  2. class Template extends Model {
  3. protected static $table = "template";
  4. protected static $id_field = "id";
  5. protected static $fillable_fields = ["customer_id", "name", "json"];
  6. protected static $field_map = [
  7. ];
  8. // Object methods
  9. public function getCustomer() {
  10. return Customer::get($this->customer_id);
  11. }
  12. public function renderBeforeTestForm() {
  13. $json = json_decode($this->json);
  14. $fields = $json->beforeTest;
  15. ?>
  16. <form method="post" enctype="multipart/form-data" id="before-test-form">
  17. <div class="alert alert-info">
  18. <i class="fal fa-fw fa-info-circle"></i>
  19. Answer as clearly and accurately as you can otherwise you may be contacted after the test for clarification and/or verification purposes.
  20. </div>
  21. <?php
  22. foreach($fields as $field) {
  23. Form::renderField($field);
  24. }
  25. ?>
  26. <input type="hidden" name="submit" value="<?=$_SESSION["csrf_token"]?>" />
  27. <button class="btn btn-primary mt-3" type="submit">Submit Info &amp; Photos</button><br />
  28. <div class="d-none mt-3" data-submitting-div>
  29. <i class="fal fa-fw fa-pulse fa-spinner"></i> Please wait. This may take a while for photos to upload.
  30. </div>
  31. </form>
  32. <?php
  33. }
  34. public function renderDuringTestForm() {
  35. $json = json_decode($this->json);
  36. $fields = $json->duringTest;
  37. ?>
  38. <form method="post" id="test-form">
  39. <input type="hidden" name="duration" id="duration" value="" required />
  40. <div class="bg-light text-center p-3 mb-3" style="position: sticky; top: 104px; z-index: 1000;" id="test-stop-button-container">
  41. <div>
  42. <button class="btn btn-block btn-success" type="button" id="test-start-button">
  43. Start Test
  44. </button>
  45. <button class="btn btn-block btn-danger" type="button" id="test-stop-button" style="display: none;">
  46. Stop Test
  47. </button>
  48. <small><span id="test-duration-span">0 min. 0 sec.</span></small>
  49. </div>
  50. </div>
  51. <div class="collapse" id="test-main-form-container">
  52. <div class="alert alert-info">
  53. <i class="fal fa-fw fa-info-circle"></i>
  54. Answer as clearly and accurately as you can otherwise you may be contacted after the test for clarification and/or verification purposes.
  55. </div>
  56. <?php
  57. foreach($fields as $field) {
  58. Form::renderField($field);
  59. }
  60. ?>
  61. <div class="bg-light text-center p-3 mt-3">
  62. <input type="hidden" name="submit" value="<?=htmlspecialchars($_SESSION["csrf_token"])?>" />
  63. <button class="btn btn-block btn-primary" type="submit" id="test-submit-button">Submit Test Results</button>
  64. <small class="form-text text-muted d-none" id="test-no-internet-text">
  65. <span class="text-danger">No Internet Connectivity</span><br />
  66. Please check your Internet connectivity and try again.
  67. </small>
  68. <small id="test-submit-status">
  69. </small>
  70. </div>
  71. </div>
  72. </form>
  73. <?php
  74. }
  75. }
  76. ?>