| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355 |
- <?php
- $filters_collapse = $filter_count ? "collapse show" : "collapse";
- $query = $_GET;
- unset($query["path"]);
- $query["sort"] = "SORT";
- $results = [
- "" => "Any",
- "1" => "Pass",
- "0" => "Fail",
- ];
- $custom_filters = [
- "overdue_project" => "Overdue (Project Deadline)",
- "overdue_test" => "Overdue (Test Due Date)",
- ];
- ?>
- <div class="container mt-3 py-4">
- <div class="row">
- <div class="col-sm">
- <h2>
- Tests
- </h2>
- </div>
- <div class="col-sm-auto">
- <div class="row">
- <div class="col-auto">
- <a class="btn btn-outline-primary" href="#filters" data-toggle="collapse">
- Toggle Filters <span class="badge badge-pill badge-danger"><?=$filter_count?></span>
- </a>
- </div>
- <div class="col">
- <div class="input-group">
- <div class="input-group-prepend">
- <span class="input-group-text">
- Sort
- </span>
- </div>
- <select class="form-control" id="sort-dropdown" data-url-template="/account/tests?<?=htmlspecialchars(http_build_query($query))?>">
- <?php
- foreach($sorts as $value => $display) {
- $selected = ($value == $sort) ? "selected" : "";
- ?>
- <option value="<?=$value?>" <?=$selected?>><?=$display?></option>
- <?php
- }
- ?>
- </select>
- </div>
- </div>
- </div>
- </div>
- </div>
- <div class="row my-3">
- <div class="col mb-1">
- <a class="btn btn-block btn-primary" href="/account/tests">Show All</a>
- </div>
- <div class="col mb-1">
- <a class="btn btn-block btn-secondary" href="/account/tests?status=<?=Test::STATUS_UNASSIGNED?>">Unassigned</a>
- </div>
- <div class="col mb-1">
- <a class="btn btn-block btn-warning" href="/account/tests?status=<?=Test::STATUS_CONFIRMED?>">Confirmed</a>
- </div>
- <div class="col mb-1">
- <a class="btn btn-block btn-success" href="/account/tests?status=<?=Test::STATUS_PENDING_VERIFICATION?>">Pending Verification</a>
- </div>
- <div class="col mb-1">
- <a class="btn btn-block btn-danger" href="/account/tests?pass=0">Fails</a>
- </div>
- </div>
- <div class="<?=$filters_collapse?>" id="filters">
- <form method="get">
- <div class="card card-body bg-light text-dark mb-3">
- <h3>Filters</h3>
- <div class="row mb-1">
- <div class="col-lg-6">
- <div class="row mb-1">
- <label class="col-form-label col-sm-4" for="status">Status</label>
- <div class="col-sm">
- <select class="form-control" name="status" id="status">
- <option value="">Any not cancelled</option>
- <?php
- foreach(Test::STATUSES as $value => $display) {
- $selected = ($value === $status) ? "selected" : "";
- ?>
- <option value="<?=$value?>" <?=$selected?>><?=htmlspecialchars($display)?></option>
- <?php
- }
- ?>
- </select>
- </div>
- </div>
- <div class="row mb-1">
- <label class="col-form-label col-sm-4" for="customer-id">Customer</label>
- <div class="col-sm">
- <select class="form-control" name="customer_id" id="customer-id">
- <option value="">Select customer</option>
- <?php
- foreach($customers as $customer) {
- $selected = ($customer->id == $customer_id) ? "selected" : "";
- ?>
- <option value="<?=$customer->id?>" <?=$selected?>><?=htmlspecialchars($customer->name)?></option>
- <?php
- }
- ?>
- </select>
- </div>
- </div>
- <div class="row mb-1">
- <label class="col-form-label col-sm-4" for="project-id">Project</label>
- <div class="col-sm">
- <select class="form-control" name="project_id" id="project-id">
- <option value="">Select project</option>
- <?php
- foreach($projects as $project) {
- $selected = ($project->id == $project_id) ? "selected" : "";
- ?>
- <option value="<?=$project->id?>" <?=$selected?>><?=htmlspecialchars($project->name)?></option>
- <?php
- }
- ?>
- </select>
- </div>
- </div>
- <div class="row mb-1">
- <label class="col-sm-4 col-form-label" for="pass">Result</label>
- <div class="col-sm">
- <select class="form-control" name="pass" id="pass">
- <?php
- foreach($results as $value => $display) {
- $selected = (strval($value) === strval($pass)) ? "selected" : "";
- ?>
- <option value="<?=$value?>" <?=$selected?>><?=htmlspecialchars($display)?></option>
- <?php
- }
- ?>
- </select>
- </div>
- </div>
- </div>
- <div class="col-lg">
- <div class="row mb-1">
- <label class="col-sm-4 col-form-label" for="test-id">Test ID</label>
- <div class="col-sm">
- <input class="form-control" type="text" name="test_id" id="test-id" placeholder="Enter test ID" value="<?=$test_id?>" />
- </div>
- </div>
- <div class="row mb-1">
- <label class="col-sm-4 col-form-label" for="location-id">Location ID</label>
- <div class="col-sm">
- <input class="form-control" type="text" name="location_id" id="location-id" placeholder="Enter location ID" value="<?=$location_id?>" />
- </div>
- </div>
- <div class="row mb-1">
- <label class="col-sm-4 col-form-label" for="location-internal-id">Internal ID</label>
- <div class="col-sm">
- <input class="form-control" type="text" name="location_internal_id" id="location-internal-id" placeholder="Enter location internal ID" value="<?=$location_internal_id?>" />
- </div>
- </div>
- <div class="row mb-1">
- <label class="col-sm-4 col-form-label" for="custom">Custom Filter</label>
- <div class="col-sm">
- <select class="form-control" name="custom" id="custom">
- <option value="">Select custom filter</option>
- <?php
- foreach($custom_filters as $value => $display) {
- $selected = (strval($value) === strval($custom)) ? "selected" : "";
- ?>
- <option value="<?=$value?>" <?=$selected?>><?=htmlspecialchars($display)?></option>
- <?php
- }
- ?>
- </select>
- </div>
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col-lg">
- <div class="row">
- <div class="col-sm offset-sm-4">
- <button class="btn btn-primary" type="submit">Filter</button>
- <a class="btn btn-secondary" href="/account/tests">Clear Filters</a>
- </div>
- </div>
- </div>
- <div class="col-lg">
- </div>
- </div>
- </div>
- <input type="hidden" name="sort" value="<?=$sort?>" />
- </form>
- </div>
- <?php
- if(empty($tests)) {
- ?>
- <div class="alert alert-info">
- There are no tests to display.
- </div>
- <?php
- }
- else {
- ?>
- <div class="mb-3">
- <?php
- View::include("pagination", compact("pagination_object"));
- ?>
- </div>
- <form method="post">
- <div class="table-responsive mb-3">
- <table class="table table-sm table-hover" style="min-width: 1024px;">
- <thead>
- <th></th>
- <th>ID</th>
- <th>Location</th>
- <th>Project</th>
- <th>Tester</th>
- <th>Due Date</th>
- <th>Status</th>
- <th>Result</th>
- <th></th>
- </thead>
- <tbody>
- <?php
- foreach($tests as $test) {
- $location = $test->getLocation();
- $project = $test->getProject();
- $tester = $test->getTester();
- $unix_start = strtotime($test->dts_start . " UTC");
- $unix_end = strtotime($test->dts_end . " UTC");
- ?>
- <tr>
- <td>
- <input type="checkbox" name="test_ids[]" value="<?=$test->id?>" />
- </td>
- <td>
- <?=$test->id?>
- </td>
- <td class="align-middle">
- <a href="/account/locations/<?=$location->id?>">
- <?=htmlspecialchars($location->name)?>
- <?php
- if($location->internal_id) {
- ?>
- <small>(Internal ID: <?=htmlspecialchars($location->internal_id)?>)</small>
- <?php
- }
- ?>
- </a><br />
- <small><?=htmlspecialchars($location->getDisplayAddress(["address_1", "address_2", "city"]))?></small>
- </td>
- <td class="align-middle">
- <a href="/account/projects/<?=$project->id?>"><?=htmlspecialchars($project->name)?></a><br />
- <small><strong>Deadline:</strong> <?=date("d/m/Y", strtotime($project->dts_deadline . " UTC"))?><small>
- </td>
- <td class="align-middle">
- <?php
- if($tester) {
- ?>
- <a href="/account/users/<?=$tester->id?>"><?=htmlspecialchars($tester->getDisplayName())?></a>
- <?php
- }
- else {
- ?>
- <small class="text-muted">N/A</small>
- <?php
- }
- ?>
- </td>
- <td class="text-center align-middle">
- <?php
- if(is_null($test->dts_due)) {
- ?>
- <small class="text-muted">N/A</small>
- <?php
- }
- else {
- ?>
- <?=explode(" ", $test->dts_due)[0]?>
- <?php
- }
- ?>
- </td>
- <td class="text-center align-middle">
- <span class="badge badge-<?=$test->getStatusClass()?>"><?=$test->getStatusText()?></span>
- </td>
- <td class="text-center align-middle text-<?=$test->getPassClass()?>">
- <div data-toggle="tooltip" title="<?=$test->getPassText()?>">
- <i class="fas fa-2x fa-fw fa-<?=$test->getPassIcon()?>"></i>
- </div>
- </td>
- <td class="text-right align-middle">
- <a class="btn btn-outline-primary" href="/account/tests/<?=$test->id?>">View</a>
- </td>
- </tr>
- <?php
- }
- ?>
- </tbody>
- </table>
- </div>
- <div class="row">
- <div class="col-md-6 offset-md-6">
- <div class="input-group">
- <div class="input-group-prepend">
- <span class="input-group-text">
- Batch Action
- </span>
- </div>
- <select class="form-control" name="batch_action" required>
- <option value="">Select Action</option>
- <option value="unassign">Unassign</option>
- </select>
- <div class="input-group-append">
- <button type="submit" class="btn btn-primary" name="submit" value="<?=htmlspecialchars($_SESSION["csrf_token"])?>">
- Submit
- </button>
- </div>
- </div>
- </div>
- </div>
- </form>
- <div class="mt-3">
- <?php
- View::include("pagination", compact("pagination_object"));
- ?>
- </div>
- <?php
- }
- ?>
- </div>
|