test_verify_form.php 22 KB

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