| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472 |
- <?php
- /**
- * @var Test $test
- */
- $test_details = [
- "Status" => "<span class=\"badge badge-lg badge-" . $test->getStatusClass() . "\">" . $test->getStatusText() . "</span>",
- "Result" => "<span class=\"badge badge-lg badge-" . $test->getPassClass() . "\">" . $test->getPassText() . "</span>",
- "Location" => "<a href=\"/account/locations/$location->id\" target=\"_blank\">" . htmlspecialchars($location->name) . "</a>",
- "Address" => htmlspecialchars($location->getDisplayAddress(["address_1", "address_2", "city", "postal_code"])),
- ];
- if(!is_null($test->dts_end)) {
- $test_details = array_merge($test_details, [
- "Duration" => $test->getDisplayDuration(),
- "Start" => Util::getDisplayDateTime(strtotime($test->dts_start . " UTC")),
- "End" => Util::getDisplayDateTime(strtotime($test->dts_end . " UTC")),
- ]);
- }
- if(in_array($test->status, [Test::STATUS_CANCELLED, Test::STATUS_COMPLETED])) {
- $test_details["Verified"] = Util::getDisplayDateTime(strtotime($test->dts_verified . " UTC"));
- $test_details["Retest"] = $test->retest ? "Yes" : "No";
- }
- $tester_details = [
- "Name" => "Unassigned"
- ];
- if($tester) {
- $tester_details = [
- "Name" => "<a href=\"/account/users/$tester->id\" target=\"_blank\">" . $tester->getDisplayName() . "</a>",
- "Date of Birth" => $tester->date_of_birth,
- "Gender" => $tester->getGenderText(),
- "Phone" => $tester->phone,
- "Score" => $tester->score,
- ];
- $tester_invoice_details = [
- "Status" => Test::getStatusTesterInvoiceText($test->status_tester_invoice),
- "Generated" => $test->dts_tester_invoice_generated ? Util::getDisplayDateTimeFromUTC($test->dts_tester_invoice_generated) : "N/A",
- "Paid" => $test->dts_tester_invoice_paid ? Util::getDisplayDateTimeFromUTC($test->dts_tester_invoice_paid) : "N/A",
- ];
- if($test->test_travel_cost) {
- $tester_invoice_details["Travel Costs"] = "£" . number_format($test->test_travel_cost, 2);
- }
- else {
- $tester_invoice_details["Travel Costs"] = "N/A";
- }
- if($test->hasTesterInvoicePDF()) {
- $tester_invoice_details["PDF"] = "<a href=\"/account/tests/{$test->id}/invoice\" target=\"_blank\">Download Invoice</a>";
- }
- }
- function render_card_list_group($details) {
- ?>
- <div class="list-group list-group-flush">
- <?php
- foreach($details as $title => $html) {
- ?>
- <div class="list-group-item">
- <div class="row" style="overflow: hidden; text-overflow: ellipsis;">
- <div class="col-md-auto">
- <?=htmlspecialchars($title)?>
- </div>
- <div class="col-md text-right" style="width: auto; overflow: hidden; text-overflow: ellipsis;">
- <?=$html?>
- </div>
- </div>
- </div>
- <?php
- }
- ?>
- </div>
- <?php
- }
- ?>
- <div class="container mt-3 py-4">
- <div class="row">
- <div class="col">
- <h2>Edit/Verify Test</h2>
- </div>
- <div class="col-auto justify-self-center">
- <div class="dropdown">
- <button class="btn btn-secondary dropdown-toggle" type="button" id="actions-button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
- Actions
- </button>
- <div class="dropdown-menu dropdown-menu-right" aria-labelledby="actions-button">
- <a class="dropdown-item" href="/account/projects/<?=$test->project_id?>">View Project</a>
- <div class="dropdown-divider"></div>
- <a class="dropdown-item" href="/account/tests/<?=$test->id?>/pdf" target="_blank">Generate New PDF</a>
- <?php
- if($test->hasPDF()) {
- $pdf_url = $test->getPDFUrl();
- ?>
- <a class="dropdown-item" href="<?=$pdf_url?>" target="_blank">View Sent PDF</a>
- <?php
- }
- if($test->hasTesterInvoicePDF()) {
- ?>
- <a class="dropdown-item" href="/account/tests/<?=$test->id?>/invoice" target="_blank">Download Tester Invoice</a>
- <?php
- }
- ?>
- </div>
- </div>
- </div>
- </div>
- <form method="post">
- <input type="hidden" name="submit" value="<?=$_SESSION["csrf_token"]?>" />
- <div class="row">
- <div class="col-xl">
- <div class="card mb-3">
- <div class="card-header">
- Submitted Data
- </div>
- <div class="card-body">
- <?php
- $header_count = 0;
- foreach($fields as $field) {
- $field = $template->applyOverridesToField($field);
- if($header_count > 0 && $field->type == "header") {
- ?>
- <hr />
- <?php
- }
- if($field->type == "file") {
- $path = $test->getDirectory() . "/" . $field->name . ".jpg";
- ?>
- <div class="row mb-1">
- <label class="col-sm-8 col-form-label"><?=htmlspecialchars($field->label)?></label>
- <div class="col-sm-4">
- <a href="/account/tests/<?=$test->id?>/files/<?=$field->name?>" target="_blank">
- <img class="img-fluid rounded" src="/account/tests/<?=$test->id?>/files/<?=$field->name?>" alt="<?=htmlspecialchars($field->label)?>" />
- </a>
- </div>
- </div>
- <?php
- continue;
- }
- if(!empty($field->name)) {
- $name = $field->name;
- if(isset($test->$name)) $field->value = $test->$name;
- else if(isset($values[$name])) $field->value = $values[$name];
- }
- Form::renderField($field);
- if($field->type == "header") {
- $header_count++;
- }
- }
- ?>
- </div>
- </div>
- </div>
- <div class="col-xl">
- <div class="row">
- <div class="col-md col-xl-12">
- <div class="card mb-3">
- <div class="card-header">
- Info
- </div>
- <div class="card-body p-0">
- <div id="map" data-maps data-lat="<?=$location->latitude?>" data-lng="<?=$location->longitude?>" data-zoom="17" data-marker="true" style="height: 320px;">
- </div>
- </div>
- <?php
- render_card_list_group($test_details);
- ?>
- </div>
- </div>
- <div class="col-md col-xl-12">
- <div class="card mb-3">
- <div class="card-header">
- Tester
- </div>
- <?php
- render_card_list_group($tester_details);
- ?>
- </div>
- <?php
- if(isset($tester_invoice_details)) {
- ?>
- <div class="card mb-3">
- <div class="card-header">
- Tester Invoice
- </div>
- <?php
- render_card_list_group($tester_invoice_details);
- if($test->status_tester_invoice == Test::STATUS_TESTER_INVOICE_PENDING) {
- ?>
- <div class="card-body text-center">
- <button class="btn btn-success" type="submit" name="accept_tester_invoice" value="1">
- Paid Invoice
- </button>
- <button class="btn btn-danger" type="submit" name="reject_tester_invoice" value="1">
- Reject Invoice
- </button>
- </div>
- <?php
- }
- ?>
- </div>
- <?php
- }
- ?>
- </div>
- </div>
- <div class="card mb-3">
- <div class="card-header">
- Verification
- </div>
- <div class="card-body">
- <div class="row mb-1">
- <label class="col-sm-4 col-form-label">Verifier</label>
- <div class="col-sm">
- <?=htmlspecialchars(Core::$user->getDisplayName())?>
- </div>
- </div>
- <hr />
- <div class="row mb-1">
- <label class="col-sm-4 col-form-label" for="pass-override">Pass Override</label>
- <div class="col-sm">
- <select class="form-control" name="pass_override" id="pass-override">
- <option value="">None</option>
- <option value="1">Pass</option>
- <option value="0">Fail</option>
- </select>
- </div>
- </div>
- <div class="row mb-1">
- <label class="col-sm-4 col-form-label" for="start-override-day">Start Override</label>
- <div class="col-sm">
- <select class="form-control w-auto d-inline-block" name="start_override_day" id="start-override-day">
- <option value="">Day</option>
- <?php
- Form::renderDayOptions();
- ?>
- </select>
- <select class="form-control w-auto d-inline-block" name="start_override_month" id="start-override-month">
- <option value="">Month</option>
- <?php
- Form::renderMonthOptions();
- ?>
- </select>
- <select class="form-control w-auto d-inline-block" name="start_override_year" id="start-override-year">
- <option value="">Year</option>
- <?php
- Form::renderYearOptionsDescending(2017, date("Y"), date("Y"));
- ?>
- </select>
- <select class="form-control w-auto d-inline-block" name="start_override_hour" id="start-override-hour">
- <option value="">HH</option>
- <?php
- Form::renderHourOptions();
- ?>
- </select>
- <select class="form-control w-auto d-inline-block" name="start_override_minute" id="start-override-minute">
- <option value="">MM</option>
- <?php
- Form::renderMinuteOptions();
- ?>
- </select>
- <select class="form-control w-auto d-inline-block" name="start_override_second" id="start-override-second">
- <option value="">SS</option>
- <?php
- Form::renderSecondOptions();
- ?>
- </select>
- </div>
- </div>
- <div class="row mb-1">
- <label class="col-sm-4 col-form-label" for="end-override-day">End Override</label>
- <div class="col-sm">
- <select class="form-control w-auto d-inline-block" name="end_override_day" id="end-override-day">
- <option value="">Day</option>
- <?php
- Form::renderDayOptions();
- ?>
- </select>
- <select class="form-control w-auto d-inline-block" name="end_override_month" id="end-override-month">
- <option value="">Month</option>
- <?php
- Form::renderMonthOptions();
- ?>
- </select>
- <select class="form-control w-auto d-inline-block" name="end_override_year" id="end-override-year">
- <option value="">Year</option>
- <?php
- Form::renderYearOptionsDescending(2017, date("Y"), date("Y"));
- ?>
- </select>
- <select class="form-control w-auto d-inline-block" name="end_override_hour" id="end-override-hour">
- <option value="">HH</option>
- <?php
- Form::renderHourOptions();
- ?>
- </select>
- <select class="form-control w-auto d-inline-block" name="end_override_minute" id="end-override-minute">
- <option value="">MM</option>
- <?php
- Form::renderMinuteOptions();
- ?>
- </select>
- <select class="form-control w-auto d-inline-block" name="end_override_second" id="end-override-second">
- <option value="">SS</option>
- <?php
- Form::renderSecondOptions();
- ?>
- </select>
- </div>
- </div>
- <div class="row mb-1">
- <label class="col-sm-4 col-form-label" for="customer-fee">Customer Fee Override</label>
- <div class="col-sm">
- <div class="input-group">
- <div class="input-group-prepend">
- <span class="input-group-text">£</span>
- </div>
- <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)?>" />
- </div>
- </div>
- </div>
- <div class="row mb-1">
- <label class="col-sm-4 col-form-label" for="tester-fee">Tester Fee Override</label>
- <div class="col-sm">
- <div class="input-group">
- <div class="input-group-prepend">
- <span class="input-group-text">£</span>
- </div>
- <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)?>" />
- </div>
- </div>
- </div>
- <div class="row mb-1">
- <label class="col-sm-4 col-form-label" for="verifier-notes">Verifier Notes</label>
- <div class="col-sm">
- <textarea class="form-control" name="verifier_notes" id="verifier-notes" placeholder="Enter verifier notes" value="<?=htmlspecialchars($test->verifier_notes)?>" rows="4"></textarea>
- </div>
- </div>
- <div class="row mb-1">
- <div class="col-sm-4">Set As Retest</div>
- <div class="col-sm">
- <div class="form-check">
- <input class="form-check-input" type="checkbox" name="retest" id="retest" value="1" <?=Form::checked($test->retest)?> />
- <label class="form-check-label" for="retest">Set As Retest</label>
- </div>
- </div>
- </div>
- <?php
- if($test->status == Test::STATUS_PENDING_VERIFICATION) {
- ?>
- <div class="row mb-1">
- <div class="col-sm-4 col-form-label">Create Retest</div>
- <div class="col-sm">
- <select class="form-control" name="retest_project_id">
- <option value="0">None</option>
- <?php
- foreach($future_projects as $future_project) {
- ?>
- <option value="<?=$future_project->id?>"><?=htmlspecialchars($future_project->name)?></option>
- <?php
- }
- ?>
- </select>
- </div>
- </div>
- <?php
- if($customer->email) {
- ?>
- <div class="row mb-1">
- <div class="col-sm-4">
- <label class="form-check-label" for="email-customer">Email Headquarters</label>
- </div>
- <div class="col-sm">
- <div class="form-check">
- <input class="form-check-input" type="checkbox" name="email_customer" id="email-customer" value="1" <?=Form::checked($customer->email_after_test)?> />
- <label class="form-check-label" for="email-customer"><?=htmlspecialchars($customer->email)?></label>
- </div>
- </div>
- </div>
- <?php
- }
- if($location->email) {
- ?>
- <div class="row mb-1">
- <div class="col-sm-4">
- <label class="form-check-label" for="email-location">Email Venue</label>
- </div>
- <div class="col-sm">
- <div class="form-check">
- <input class="form-check-input" type="checkbox" name="email_location" id="email-location" value="1" <?=Form::checked($customer->email_locations_after_test)?> />
- <label class="form-check-label" for="email-location"><?=htmlspecialchars($location->email)?></label>
- </div>
- </div>
- </div>
- <?php
- }
- if($location->area_manager_email) {
- ?>
- <div class="row mb-1">
- <div class="col-sm-4">
- <label class="form-check-label" for="email-location-area-manager">Email Area Manager</label>
- </div>
- <div class="col-sm">
- <div class="form-check">
- <input class="form-check-input" type="checkbox" name="email_location_area_manager" id="email-location-area-manager" value="1" <?=Form::checked($customer->email_locations_after_test)?> />
- <label class="form-check-label" for="email-location-area-manager"><?=htmlspecialchars($location->area_manager_email)?></label>
- </div>
- </div>
- </div>
- <?php
- }
- ?>
- <div class="row mb-1">
- <label class="col-sm-4 col-form-label" for="tester-message">Message to Tester (if rejecting)</label>
- <div class="col-sm">
- <textarea class="form-control" name="tester_message" id="tester-message" placeholder="Enter message to tester" value="<?=htmlspecialchars($tester_message)?>" rows="4"></textarea>
- </div>
- </div>
- <div class="row mb-1">
- <div class="col-sm offset-sm-4">
- <button class="btn btn-success" type="submit" name="accept" value="1">Accept</button>
- <button class="btn btn-danger" type="submit" name="reject" value="1">Reject</button>
- </div>
- </div>
- <?php
- }
- else {
- ?>
- <div class="row mb-1">
- <div class="col-sm offset-sm-4">
- <button class="btn btn-primary" type="submit">Submit</button>
- </div>
- </div>
- <?php
- }
- ?>
- </div>
- </div>
- </div>
- </div>
- </form>
- </div>
|