1
0

test_verify_form.php 24 KB

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