test_verify_form.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683
  1. <?php /** @noinspection PhpUnhandledExceptionInspection */
  2. /**
  3. * @controller test.php
  4. *
  5. * @var Test $test
  6. * @var User $tester
  7. * @var Location $location
  8. * @var Project $project
  9. * @var Project[] $future_projects
  10. * @var Customer $customer
  11. * @var Template $template
  12. * @var array $fields
  13. * @var string $tester_message
  14. */
  15. use Carbon\CarbonImmutable;
  16. use Helpers\StripeHelper;
  17. $user = Core::$user;
  18. $config = $template->getConfiguration();
  19. $values = $test->getValues(true);
  20. $get_test_details = static function(Test $test) use ($project, $location, $user): array {
  21. $test_details = [];
  22. $test_details["Project"] = sprintf('<a href="/account/projects/%d">%s</a>', $test->project_id, $project->getNameHtml());
  23. $test_details["Status"] = "<span class=\"badge badge-lg badge-" . $test->getStatusClass() . "\">" . $test->getStatusText() . "</span>";
  24. if($test->isVoid()) {
  25. $test_details["Result"] = "<span class=\"badge badge-lg badge-secondary\">Void</span>";
  26. }
  27. else {
  28. $test_details["Result"] = "<span class=\"badge badge-lg badge-" . $test->getPassClass() . "\">" . $test->getPassText() . "</span>";
  29. }
  30. $test_details["Location"] = "<a href=\"/account/locations/$location->id\" target=\"_blank\">" . htmlspecialchars($location->name) . "</a>";
  31. $test_details["Address"] = htmlspecialchars($location->getDisplayAddress(["address_1", "address_2", "city", "postal_code"]));
  32. if($test->stripe_invoice_id) {
  33. $stripe_helper = StripeHelper::getInstance();
  34. $stripe_invoice = $stripe_helper->createInvoice($test, "0.00");
  35. $test_details["Stripe Invoice"] = sprintf("<a href=\"%s\" target=\"_blank\">View</a>", htmlspecialchars($stripe_invoice->hosted_invoice_url));
  36. }
  37. $previous_test = $test->getPreviousTest();
  38. $next_test = $test->getNextTest();
  39. if($previous_test) {
  40. $test_details["Previous Test"] = sprintf('<a href="/account/tests/%d">%s</a>', $previous_test->id, $previous_test->getProject()->getNameHtml());
  41. }
  42. if($next_test) {
  43. $test_details["Next Test"] = sprintf('<a href="/account/tests/%d">%s</a>', $next_test->id, $next_test->getProject()->getNameHtml());
  44. }
  45. if($test->dts_end) {
  46. $test_details = array_merge($test_details, [
  47. "Duration" => $test->getDisplayDuration(),
  48. "Start" => Util::getDisplayDateTime(strtotime($test->dts_start . " UTC")),
  49. "End" => Util::getDisplayDateTime(strtotime($test->dts_end . " UTC")),
  50. ]);
  51. }
  52. if(in_array($test->getStatus(), [Test::STATUS_CANCELLED, Test::STATUS_COMPLETED], true)) {
  53. $test_details["Verified"] = Util::getDisplayDateTime(strtotime($test->dts_verified . " UTC"));
  54. $test_details["Retest"] = $test->retest ? "Yes" : "No";
  55. }
  56. return $test_details;
  57. };
  58. $tester_details = [
  59. "Name" => "Unassigned"
  60. ];
  61. if($tester) {
  62. $tester_details = [
  63. "Name" => "<a href=\"/account/users/$tester->id\" target=\"_blank\">" . $tester->getDisplayName() . "</a>",
  64. "Date of Birth" => $tester->date_of_birth,
  65. "Gender" => $tester->getGenderText(),
  66. "Phone" => $tester->phone,
  67. "Score" => $tester->score,
  68. ];
  69. $tester_invoice_details = [
  70. "Status" => Test::getStatusTesterInvoiceText($test->status_tester_invoice),
  71. "Generated" => $test->dts_tester_invoice_generated ? Util::getDisplayDateTimeFromUTC($test->dts_tester_invoice_generated) : "N/A",
  72. "Paid" => $test->dts_tester_invoice_paid ? Util::getDisplayDateTimeFromUTC($test->dts_tester_invoice_paid) : "N/A",
  73. ];
  74. if($test->test_travel_cost) {
  75. $tester_invoice_details["Travel Costs"] = "£" . number_format($test->test_travel_cost, 2);
  76. }
  77. else {
  78. $tester_invoice_details["Travel Costs"] = "N/A";
  79. }
  80. if($test->test_travel_cost_description) {
  81. $tester_invoice_details["Travel Cost Description"] = htmlspecialchars($test->test_travel_cost_description);
  82. }
  83. else {
  84. $tester_invoice_details["Travel Cost Description"] = "N/A";
  85. }
  86. if($test->hasTesterInvoicePDF()) {
  87. $tester_invoice_details["PDF"] = "<a href=\"/account/tests/{$test->id}/invoice\" target=\"_blank\">Download Invoice</a>";
  88. }
  89. if($test->hasTravelCostsPhoto()) {
  90. $tester_invoice_details["Photo"] = "<a href=\"/account/tests/{$test->id}/files/travel_costs\" target=\"_blank\">View Photo</a>";
  91. }
  92. }
  93. function render_card_list_group($details) {
  94. ?>
  95. <div class="list-group list-group-flush">
  96. <?php
  97. foreach($details as $title => $html) {
  98. ?>
  99. <div class="list-group-item">
  100. <div class="row" style="overflow: hidden; text-overflow: ellipsis;">
  101. <div class="col-md-auto">
  102. <?=htmlspecialchars($title)?>
  103. </div>
  104. <div class="col-md text-right" style="width: auto; overflow: hidden; text-overflow: ellipsis;">
  105. <?=$html?>
  106. </div>
  107. </div>
  108. </div>
  109. <?php
  110. }
  111. ?>
  112. </div>
  113. <?php
  114. }
  115. ?>
  116. <div class="container mt-3 py-4">
  117. <div class="row">
  118. <div class="col">
  119. <h2>Edit/Verify Test</h2>
  120. </div>
  121. <div class="col-auto justify-self-center">
  122. <div class="dropdown">
  123. <button class="btn btn-secondary dropdown-toggle" type="button" id="actions-button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  124. Actions
  125. </button>
  126. <div class="dropdown-menu dropdown-menu-right" aria-labelledby="actions-button">
  127. <a class="dropdown-item" href="/account/projects/<?=$test->project_id?>">View Project</a>
  128. <div class="dropdown-divider"></div>
  129. <a class="dropdown-item" href="/account/tests/<?=$test->id?>/pdf" target="_blank">Generate New PDF</a>
  130. <?php
  131. if($test->hasPDF()) {
  132. $pdf_url = $test->getPDFUrl();
  133. ?>
  134. <a class="dropdown-item" href="<?=$pdf_url?>" target="_blank">View Sent PDF</a>
  135. <?php
  136. }
  137. if($test->hasTesterInvoicePDF()) {
  138. ?>
  139. <a class="dropdown-item" href="/account/tests/<?=$test->id?>/invoice" target="_blank">Download Tester Invoice</a>
  140. <?php
  141. }
  142. if($test->hasTravelCostsPhoto()) {
  143. ?>
  144. <a class="dropdown-item" href="/account/tests/<?=$test->id?>/files/travel_costs" target="_blank">View Travel Costs Photo</a>
  145. <?php
  146. }
  147. ?>
  148. </div>
  149. </div>
  150. </div>
  151. </div>
  152. <form method="post">
  153. <input type="hidden" name="submit" value="<?=$_SESSION["csrf_token"]?>" />
  154. <div class="row">
  155. <div class="col-xl-6">
  156. <div class="card mb-3">
  157. <div class="card-header">
  158. Submitted Data
  159. </div>
  160. <div class="card-body">
  161. <?php
  162. $header_count = 0;
  163. foreach($fields as $field) {
  164. $field = $template->applyOverridesToField($field);
  165. if($field->type === "file") {
  166. $path = $test->getDirectory() . "/" . $field->name . ".jpg";
  167. ?>
  168. <div class="row mb-1">
  169. <label class="col-sm-8 col-form-label"><?=htmlspecialchars($field->label)?></label>
  170. <div class="col-sm-4">
  171. <a href="/account/tests/<?=$test->id?>/files/<?=$field->name?>" target="_blank">
  172. <img class="img-fluid rounded" src="/account/tests/<?=$test->id?>/files/<?=$field->name?>" alt="<?=htmlspecialchars($field->label)?>" />
  173. </a>
  174. </div>
  175. </div>
  176. <?php
  177. continue;
  178. }
  179. if(!empty($field->name)) {
  180. $name = $field->name;
  181. if(isset($test->$name)) $field->value = $test->$name;
  182. else if(isset($values[$name])) $field->value = $values[$name];
  183. }
  184. $field->template = $template;
  185. Form::renderField($field);
  186. if($field->type === "header") {
  187. $header_count++;
  188. }
  189. }
  190. ?>
  191. <hr/>
  192. <h3><?=htmlspecialchars(__("Void"))?></h3>
  193. <?php
  194. Form::renderField((object) [
  195. "type" => "checkbox",
  196. "name" => "void",
  197. "value" => $test->void,
  198. "label" => __("Void - All Tests / Venue Closed"),
  199. ]);
  200. if($config->hasAlcohol ?? false) {
  201. Form::renderField((object) [
  202. "type" => "checkbox",
  203. "name" => "void_primary",
  204. "value" => $test->void_primary,
  205. "label" => __("Void - Gaming Test"),
  206. ]);
  207. Form::renderField((object) [
  208. "type" => "checkbox",
  209. "name" => "void_secondary",
  210. "value" => $test->void_secondary,
  211. "label" => __("Void - Alcohol Test"),
  212. ]);
  213. }
  214. Form::renderField((object) [
  215. "type" => "textarea",
  216. "name" => "void_notes",
  217. "label" => __("Void Notes"),
  218. "value" => $test->void_notes,
  219. "maxLength" => 65535,
  220. "helpText" => __("You must fill in this field if any part of the test was void."),
  221. ]);
  222. ?>
  223. </div>
  224. </div>
  225. </div>
  226. <div class="col-xl-6">
  227. <div class="row">
  228. <div class="col-md col-xl-12">
  229. <div class="card mb-3">
  230. <div class="card-header">
  231. Info
  232. </div>
  233. <div class="card-body p-0">
  234. <div id="map" data-maps data-lat="<?=$location->latitude?>" data-lng="<?=$location->longitude?>" data-zoom="17" data-marker="true" style="height: 320px;">
  235. </div>
  236. </div>
  237. <?php
  238. render_card_list_group($get_test_details($test));
  239. ?>
  240. </div>
  241. </div>
  242. <div class="col-md col-xl-12">
  243. <div class="card mb-3">
  244. <div class="card-header">
  245. Tester
  246. </div>
  247. <?php
  248. render_card_list_group($tester_details);
  249. ?>
  250. </div>
  251. <?php
  252. if(isset($tester_invoice_details)) {
  253. ?>
  254. <div class="card mb-3">
  255. <div class="card-header">
  256. Tester Invoice
  257. </div>
  258. <?php
  259. render_card_list_group($tester_invoice_details);
  260. if($test->getTesterInvoiceStatus() === Test::STATUS_TESTER_INVOICE_PENDING) {
  261. ?>
  262. <div class="card-body text-center">
  263. <button class="btn btn-success" type="submit" name="accept_tester_invoice" value="1">
  264. Paid Invoice
  265. </button>
  266. <button class="btn btn-danger" type="submit" name="reject_tester_invoice" value="1">
  267. Reject Invoice
  268. </button>
  269. </div>
  270. <?php
  271. }
  272. ?>
  273. </div>
  274. <?php
  275. }
  276. ?>
  277. </div>
  278. </div>
  279. <?php
  280. if($test->verifier_id && $test->dts_verified) {
  281. $verifier = $test->getVerifier();
  282. $time_verified = CarbonImmutable::parse($test->dts_verified, "UTC")->getTimestamp();
  283. ?>
  284. <div class="card mb-3">
  285. <div class="card-header">
  286. <?=htmlspecialchars(__("Verification Info"))?>
  287. </div>
  288. <div class="list-group list-group-flush">
  289. <div class="list-group-item d-flex justify-content-between">
  290. <div>
  291. <?=htmlspecialchars(__("Verifier"))?>
  292. </div>
  293. <div>
  294. <?=htmlspecialchars($verifier->getDisplayName())?>
  295. </div>
  296. </div>
  297. <div class="list-group-item d-flex justify-content-between">
  298. <div>
  299. <?=htmlspecialchars(__("Verified Date/Time"))?>
  300. </div>
  301. <div>
  302. <?=htmlspecialchars(Util::getDisplayDateTime($time_verified))?>
  303. </div>
  304. </div>
  305. <div class="list-group-item d-flex justify-content-between">
  306. <div>
  307. <?=htmlspecialchars(__("Verifier Notes"))?>
  308. </div>
  309. <div>
  310. <?=$test->getVerifierNotesHtml()?>
  311. </div>
  312. </div>
  313. </div>
  314. </div>
  315. <?php
  316. }
  317. ?>
  318. <div class="card mb-3">
  319. <div class="card-header">
  320. Verification
  321. </div>
  322. <div class="card-body">
  323. <div class="row mb-1 align-items-center">
  324. <label class="col-sm-4 col-form-label col-form-label-sm">Verifier</label>
  325. <div class="col-sm">
  326. <?=htmlspecialchars(Core::$user->getDisplayName())?>
  327. </div>
  328. </div>
  329. <hr />
  330. <section class="mb-4">
  331. <h5><?=htmlspecialchars(__("Overrides"))?></h5>
  332. <?php
  333. if($template->hasPassFail()) {
  334. ?>
  335. <div class="row mb-1">
  336. <label class="col-sm-4 col-form-label col-form-label-sm" for="pass-override">Pass Override</label>
  337. <div class="col-sm">
  338. <select class="form-control form-control-sm" name="pass_override" id="pass-override">
  339. <option value="">None</option>
  340. <option value="1">Pass</option>
  341. <option value="0">Fail</option>
  342. </select>
  343. </div>
  344. </div>
  345. <?php
  346. }
  347. ?>
  348. <div class="row mb-1">
  349. <label class="col-sm-4 col-form-label col-form-label-sm" for="start-override">Start Override</label>
  350. <div class="col-sm">
  351. <input class="form-control form-control-sm" type="datetime-local" name="start_override" id="start-override" />
  352. </div>
  353. </div>
  354. <div class="row mb-1">
  355. <label class="col-sm-4 col-form-label col-form-label-sm" for="end-override">End Override</label>
  356. <div class="col-sm">
  357. <input class="form-control form-control-sm" type="datetime-local" name="end_override" id="end-override" />
  358. </div>
  359. </div>
  360. <div class="row mb-1">
  361. <label class="col-sm-4 col-form-label col-form-label-sm" for="customer-fee">Customer Fee Override</label>
  362. <div class="col-sm">
  363. <div class="input-group input-group-sm">
  364. <div class="input-group-prepend">
  365. <span class="input-group-text">£</span>
  366. </div>
  367. <input class="form-control" type="number" step="0.01" min="0" name="customer_fee" id="customer-fee" placeholder="Enter customer fee override" value="<?=htmlspecialchars($test->customer_fee)?>" />
  368. </div>
  369. </div>
  370. </div>
  371. <div class="row mb-1">
  372. <label class="col-sm-4 col-form-label col-form-label-sm" for="tester-fee">Tester Fee Override</label>
  373. <div class="col-sm">
  374. <div class="input-group input-group-sm">
  375. <div class="input-group-prepend">
  376. <span class="input-group-text">£</span>
  377. </div>
  378. <input class="form-control" type="number" step="0.01" min="0" name="tester_fee" id="tester-fee" placeholder="Enter tester fee override" value="<?=htmlspecialchars($test->test_fee)?>" />
  379. </div>
  380. </div>
  381. </div>
  382. </section>
  383. <section class="mb-4">
  384. <h5><?=htmlspecialchars(__("Costs & Notes"))?></h5>
  385. <div class="row mb-1">
  386. <label class="col-sm-4 col-form-label col-form-label-sm" for="travel-cost">Travel Costs</label>
  387. <div class="col-sm">
  388. <div class="input-group input-group-sm">
  389. <div class="input-group-prepend">
  390. <span class="input-group-text">£</span>
  391. </div>
  392. <input class="form-control" type="number" step="0.01" min="0" max="999.99" name="travel_cost" id="travel-cost" placeholder="Enter travel costs" value="<?=htmlspecialchars($test->test_travel_cost)?>" />
  393. </div>
  394. </div>
  395. </div>
  396. <div class="row mb-1">
  397. <label class="col-sm-4 col-form-label col-form-label-sm" for="verifier-notes">Verifier Notes</label>
  398. <div class="col-sm">
  399. <textarea class="form-control form-control-sm" name="verifier_notes" id="verifier-notes" placeholder="Enter verifier notes" rows="4"><?=htmlspecialchars($test->verifier_notes)?></textarea>
  400. </div>
  401. </div>
  402. <div class="row mb-1 align-items-center">
  403. <label class="col-sm-4 col-form-label col-form-label-sm" for="retest">Set As Retest</label>
  404. <div class="col-sm">
  405. <div class="custom-control custom-checkbox">
  406. <input class="custom-control-input" type="checkbox" name="retest" id="retest" value="1" <?=Form::checked($test->retest)?> />
  407. <label class="custom-control-label" for="retest">This test was a retest</label>
  408. </div>
  409. </div>
  410. </div>
  411. </section>
  412. <section class="mb-4">
  413. <h5><?=htmlspecialchars(__("New Test"))?></h5>
  414. <div class="row mb-1">
  415. <label class="col-sm-4 col-form-label col-form-label-sm" for="new-test-project-id">
  416. Create New Test
  417. </label>
  418. <div class="col-sm">
  419. <div class="input-group">
  420. <select class="form-control" name="new_test_project_id" id="new-test-project-id">
  421. <option value="0">Do not create</option>
  422. <?php
  423. foreach($future_projects as $future_project) {
  424. ?>
  425. <option value="<?=$future_project->id?>" data-customer-fee="<?=$future_project->default_customer_fee?>">
  426. <?=htmlspecialchars($future_project->name)?>
  427. </option>
  428. <?php
  429. }
  430. ?>
  431. </select>
  432. <div class="input-group-append">
  433. <div class="input-group-text">
  434. <div class="custom-control custom-checkbox">
  435. <input class="custom-control-input" type="checkbox" name="new_test_is_retest" id="new-test-is-retest" value="1" />
  436. <label class="custom-control-label" for="new-test-is-retest"><?=htmlspecialchars(__("Retest"))?></label>
  437. </div>
  438. </div>
  439. </div>
  440. </div>
  441. </div>
  442. </div>
  443. <?php
  444. if($customer->isBillingEnabled()) {
  445. if(!$location->email) {
  446. ?>
  447. <div class="alert alert-warning">
  448. <i class="fa fa-fw fa-exclamation-triangle"></i>
  449. <?=htmlspecialchars(__("Billing is enabled for %s but this location does not have an email address set for the invoice to be sent to.", $customer->name))?>
  450. </div>
  451. <?php
  452. }
  453. else {
  454. ?>
  455. <div class="row mb-1 align-items-center">
  456. <label class="col-sm-4 col-form-label col-form-label-sm" for="payment-required">
  457. Payment Required
  458. </label>
  459. <div class="col-sm">
  460. <div class="custom-control custom-checkbox">
  461. <input class="custom-control-input" id="payment-required" name="payment_required" type="checkbox" value="1" />
  462. <label class="custom-control-label" for="payment-required"><?=htmlspecialchars(__("Send invoice to %s", $location->email))?></label>
  463. </div>
  464. </div>
  465. </div>
  466. <div class="row mb-1 align-items-center" hidden>
  467. <label class="col-sm-4 col-form-label col-form-label-sm" for="invoice-amount">
  468. Invoice Amount
  469. </label>
  470. <div class="col-sm">
  471. <div class="input-group input-group-sm">
  472. <div class="input-group-prepend">
  473. <span class="input-group-text">£</span>
  474. </div>
  475. <input class="form-control" type="number" step="0.01" min="0" max="999.99" name="invoice_amount" id="invoice-amount" placeholder="Enter invoice amount" value="0.00" />
  476. </div>
  477. </div>
  478. </div>
  479. <?php
  480. }
  481. ?>
  482. <?php
  483. }
  484. ?>
  485. </section>
  486. <?php
  487. if($test->getStatus() === Test::STATUS_PENDING_VERIFICATION) {
  488. ?>
  489. <section class="mb-4">
  490. <h5><?=htmlspecialchars(__("Notifications"))?></h5>
  491. <?php
  492. $customer_checked = $customer->email_after_test;
  493. $location_checked = $customer->email_locations_after_test;
  494. $email_address_configs = [
  495. ["email" => $customer->email, "label" => "Email Headquarters", "name" => "email_customer", "checked" => $customer_checked],
  496. ["email" => $location->email, "label" => "Email Venue", "name" => "email_location", "checked" => $location_checked],
  497. ["email" => $location->area_manager_email, "label" => "Email AM", "name" => "email_location_area_manager", "checked" => $location_checked],
  498. ["email" => $location->operations_manager_email, "label" => "Email OM", "name" => "email_location_operations_manager", "checked" => $location_checked],
  499. ["email" => $location->gaming_manager_email, "label" => "Email GM", "name" => "email_location_gaming_manager", "checked" => $location_checked],
  500. ["email" => $location->senior_gaming_manager_email, "label" => "Email SGM", "name" => "email_location_senior_gaming_manager", "checked" => $location_checked],
  501. ];
  502. foreach($email_address_configs as $email_address_config) {
  503. $email_address = $email_address_config["email"];
  504. if(!$email_address) {
  505. continue;
  506. }
  507. $label = $email_address_config["label"];
  508. $name = $email_address_config["name"];
  509. $checked = $email_address_config["checked"];
  510. $id = str_replace("_", "-", $name);
  511. ?>
  512. <div class="row mb-1">
  513. <label class="col-sm-4 col-form-label col-form-label-sm" for="<?= $id ?>">
  514. <?= htmlspecialchars($label) ?>
  515. </label>
  516. <div class="col-sm">
  517. <div class="custom-control custom-checkbox">
  518. <input class="custom-control-input" type="checkbox" name="<?= $name ?>"
  519. id="<?= $id ?>" value="1" <?= Form::checked($checked) ?> />
  520. <label class="custom-control-label"
  521. for="<?= $id ?>"><?= htmlspecialchars($email_address) ?></label>
  522. </div>
  523. </div>
  524. </div>
  525. <?php
  526. }
  527. ?>
  528. <div class="row mb-1">
  529. <label class="col-sm-4 col-form-label col-form-label-sm"
  530. for="include-previous-test"><?= htmlspecialchars(__("Previous Test")) ?></label>
  531. <div class="col-sm">
  532. <div class="custom-control custom-checkbox">
  533. <input class="custom-control-input" type="checkbox" name="include_previous_test"
  534. id="include-previous-test" value="1" checked/>
  535. <label class="custom-control-label" for="include-previous-test">
  536. <?= htmlspecialchars(__("Attach PDF")) ?>
  537. </label>
  538. </div>
  539. </div>
  540. </div>
  541. <div class="row mb-1">
  542. <label class="col-sm-4 col-form-label col-form-label-sm" for="tester-message">Message to Tester (if
  543. rejecting)</label>
  544. <div class="col-sm">
  545. <textarea class="form-control form-control-sm" name="tester_message"
  546. id="tester-message" placeholder="Enter message to tester"
  547. rows="4"><?= htmlspecialchars($tester_message) ?></textarea>
  548. </div>
  549. </div>
  550. </section>
  551. <?php
  552. }
  553. ?>
  554. <?php
  555. // Submit buttons
  556. if($test->getStatus() === Test::STATUS_PENDING_VERIFICATION) {
  557. ?>
  558. <div class="row mb-1">
  559. <div class="col-sm offset-sm-4">
  560. <button class="btn btn-success" type="submit" name="accept" value="1">Accept
  561. </button>
  562. <button class="btn btn-danger" type="submit" name="reject" value="1">Reject</button>
  563. </div>
  564. </div>
  565. <?php
  566. }
  567. else {
  568. ?>
  569. <div class="row mb-1">
  570. <div class="col-sm offset-sm-4">
  571. <button class="btn btn-primary" type="submit">Submit</button>
  572. </div>
  573. </div>
  574. <?php
  575. }
  576. ?>
  577. </div>
  578. </div>
  579. <?php
  580. $previous_test = $test->getPreviousTest();
  581. if($previous_test) {
  582. $dt = $previous_test->getDateTimeStart();
  583. $previous_test_details = $get_test_details($previous_test);
  584. $previous_test_details_subset = [
  585. "Date/Time" => $previous_test_details["Start"] ?? "",
  586. "Result" => $previous_test_details["Result"] ?? "",
  587. ];
  588. ?>
  589. <div class="card mb-3">
  590. <div class="card-header">
  591. <?=htmlspecialchars(__("Previous Test"))?>
  592. </div>
  593. <?php
  594. render_card_list_group($previous_test_details_subset);
  595. ?>
  596. </div>
  597. <?php
  598. }
  599. ?>
  600. </div>
  601. </div>
  602. </form>
  603. </div>