| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- <?php
- /**
- * @var Location[] $locations
- * @var Test[] $latest_tests
- */
- $user = Core::$user;
- ?>
- <div class="table-responsive limit-height-2">
- <table class="table table-sm table-sm-text table-hover">
- <colgroup>
- <col style="width: 1%"/>
- <col style="width: 30%"/>
- <col style="width: 30%"/>
- <col style="width: 10%"/>
- <col style="width: 5%"/>
- <col style="width: 5%"/>
- <col style="width: 20%"/>
- <col style="width: 1%"/>
- </colgroup>
- <thead>
- <tr>
- <th class="text-right pr-3">ID</th>
- <th>Name / Address</th>
- <th>Legal Entity</th>
- <th>Internal ID</th>
- <th>Tests</th>
- <th>Retests</th>
- <th>Latest Test Result</th>
- <th>Actions</th>
- </tr>
- </thead>
- <tbody>
- <?php
- foreach($locations as $location) {
- $class = "";
- if($location->isArchived()) $class = "text-muted";
- $test = $latest_tests[$location->id] ?? null;
- ?>
- <tr class="<?=$class?>">
- <td class="text-right pr-3">
- <?=$location->id?>
- </td>
- <td>
- <a href="/account/locations/<?=$location->id?>"><?=htmlspecialchars($location->name)?></a>
- <?php
- if($location->closed) {
- ?>
- <span class="badge badge-danger">Closed</span>
- <?php
- }
- if($location->isArchived()) {
- ?>
- <span class="badge badge-secondary"><?=htmlspecialchars(__("Archived"))?></span>
- <?php
- }
- ?>
- <br />
- <small><?=htmlspecialchars($location->getDisplayAddress(["address_1", "address_2", "city", "postal_code"]))?></small>
- </td>
- <td>
- <?=htmlspecialchars($location->legal_entity_name)?>
- </td>
- <td>
- <?=htmlspecialchars($location->internal_id)?>
- </td>
- <td class="text-right">
- <?=htmlspecialchars(number_format($location->test_count))?>
- </td>
- <td class="text-right">
- <?=htmlspecialchars(number_format($location->retest_count))?>
- </td>
- <td>
- <?php
- if($test) {
- if($test->isPass()) {
- ?>
- <i class="fa fa-fw fa-check-circle text-success"></i> Passed on <?=$user->formatDate($test->getDateTimeStart())?>
- <?php
- }
- elseif($test->isVoid()) {
- ?>
- <i class="fa fa-fw fa-minus-circle text-secondary"></i> Void on <?=$user->formatDate($test->getDateTimeStart())?>
- <?php
- }
- elseif($test->isFail()) {
- ?>
- <i class="fa fa-fw fa-times-circle text-danger"></i> Failed on <?=$user->formatDate($test->getDateTimeStart())?>
- <?php
- }
- else {
- ?>
- None
- <?php
- }
- }
- else {
- ?>
- None
- <?php
- }
- ?>
- </td>
- <td class="text-right text-nowrap align-middle">
- <a class="btn btn-sm btn-outline-primary" href="/account/locations/<?=$location->id?>/edit">Edit</a>
- <button type="button" class="btn btn-sm btn-outline-primary btn-map" data-location-id="<?=$location->id?>">Map</button>
- </td>
- </tr>
- <?php
- }
- ?>
- </tbody>
- </table>
- </div>
- <?php
- if(empty($locations)) {
- ?>
- <div class="alert alert-info">
- No locations to display.
- </div>
- <?php
- }
- ?>
|