|
|
@@ -1,4 +1,9 @@
|
|
|
<?php /** @noinspection PhpUnhandledExceptionInspection */
|
|
|
+
|
|
|
+/**
|
|
|
+ * @var User $user
|
|
|
+ */
|
|
|
+
|
|
|
$addresses = $user->getAddresses();
|
|
|
$referrer = $user->getReferrer();
|
|
|
|
|
|
@@ -213,23 +218,25 @@ const userId = <?=$user->id?>;
|
|
|
?>
|
|
|
</div>
|
|
|
<div class="tab-pane fade" id="tests" role="tabpanel" aria-labelledby="tests-tab">
|
|
|
- <h3>Assigned Tests</h3>
|
|
|
|
|
|
- <?php
|
|
|
- if(empty($pending_tests)) {
|
|
|
- ?>
|
|
|
- <div class="alert alert-info">This user has no assigned tests.</div>
|
|
|
+ <section class="mb-4">
|
|
|
+ <h3>Assigned Tests</h3>
|
|
|
+
|
|
|
<?php
|
|
|
- }
|
|
|
- else {
|
|
|
- ?>
|
|
|
- <table class="table table-sm table-hover">
|
|
|
- <col style="width: 10%;" />
|
|
|
- <col style="width: 40%;" />
|
|
|
- <col style="width: 20%;" />
|
|
|
- <col style="width: 10%;" />
|
|
|
- <col style="width: 10%;" />
|
|
|
- <thead>
|
|
|
+ if(empty($pending_tests)) {
|
|
|
+ ?>
|
|
|
+ <div class="alert alert-info">This user has no assigned tests.</div>
|
|
|
+ <?php
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ ?>
|
|
|
+ <table class="table table-sm table-hover">
|
|
|
+ <col style="width: 10%;" />
|
|
|
+ <col style="width: 40%;" />
|
|
|
+ <col style="width: 20%;" />
|
|
|
+ <col style="width: 10%;" />
|
|
|
+ <col style="width: 10%;" />
|
|
|
+ <thead>
|
|
|
<tr>
|
|
|
<th>ID</th>
|
|
|
<th>Location</th>
|
|
|
@@ -237,64 +244,129 @@ const userId = <?=$user->id?>;
|
|
|
<th>Date Due</th>
|
|
|
<th></th>
|
|
|
</tr>
|
|
|
- </thead>
|
|
|
- <?php
|
|
|
- foreach($pending_tests as $test) {
|
|
|
- $project = $test->getProject();
|
|
|
- $location = $test->getLocation();
|
|
|
+ </thead>
|
|
|
+ <?php
|
|
|
+ foreach($pending_tests as $test) {
|
|
|
+ $project = $test->getProject();
|
|
|
+ $location = $test->getLocation();
|
|
|
|
|
|
- if(!is_null($test->dts_due)) {
|
|
|
- $date = explode(" ", $test->dts_due)[0];
|
|
|
- $unix_date = strtotime($date);
|
|
|
- }
|
|
|
- else {
|
|
|
- $date = explode(" ", $project->dts_deadline)[0];
|
|
|
- $unix_date = strtotime($date);
|
|
|
- }
|
|
|
+ if($test->dts_due !== null) {
|
|
|
+ $date = explode(" ", $test->dts_due)[0];
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $date = explode(" ", $project->dts_deadline)[0];
|
|
|
+ }
|
|
|
|
|
|
- $date = date("d/m/Y", $unix_date);
|
|
|
+ $unix_date = strtotime($date);
|
|
|
|
|
|
- ?>
|
|
|
- <tr>
|
|
|
- <td><?=$test->id?></td>
|
|
|
- <td>
|
|
|
- <a href="/account/locations/<?=$location->id?>"><?=htmlspecialchars($location->name)?></a><br />
|
|
|
- <small><?=htmlspecialchars($location->getDisplayAddress(["address_1", "address_2", "city", "postcode"]))?></small>
|
|
|
- </td>
|
|
|
- <td class="align-middle">
|
|
|
- <a href="/account/projects/<?=$project->id?>"><?=htmlspecialchars($project->name)?></a>
|
|
|
- </td>
|
|
|
- <td class="align-middle">
|
|
|
- <?=$date?>
|
|
|
- </td>
|
|
|
- <td class="align-middle text-right">
|
|
|
- </td>
|
|
|
- </tr>
|
|
|
+ $date = date("d/m/Y", $unix_date);
|
|
|
+
|
|
|
+ ?>
|
|
|
+ <tr>
|
|
|
+ <td><?=$test->id?></td>
|
|
|
+ <td>
|
|
|
+ <a href="/account/locations/<?=$location->id?>"><?=htmlspecialchars($location->name)?></a><br />
|
|
|
+ <small><?=htmlspecialchars($location->getDisplayAddress(["address_1", "address_2", "city", "postcode"]))?></small>
|
|
|
+ </td>
|
|
|
+ <td class="align-middle">
|
|
|
+ <a href="/account/projects/<?=$project->id?>"><?=htmlspecialchars($project->name)?></a>
|
|
|
+ </td>
|
|
|
+ <td class="align-middle">
|
|
|
+ <?=$date?>
|
|
|
+ </td>
|
|
|
+ <td class="align-middle text-right">
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ <?php
|
|
|
+ }
|
|
|
+ ?>
|
|
|
+ </table>
|
|
|
<?php
|
|
|
}
|
|
|
?>
|
|
|
- </table>
|
|
|
- <?php
|
|
|
- }
|
|
|
- ?>
|
|
|
+ </section>
|
|
|
|
|
|
- <h3>Completed Tests</h3>
|
|
|
+ <section class="mb-4">
|
|
|
+ <h3>Completed / Cancelled Tests</h3>
|
|
|
|
|
|
- <?php
|
|
|
- if(empty($completed_tests)) {
|
|
|
- ?>
|
|
|
- <div class="alert alert-info">This user has no completed tests.</div>
|
|
|
<?php
|
|
|
- }
|
|
|
- else {
|
|
|
- ?>
|
|
|
- <table class="table table-sm table-hover">
|
|
|
- <col style="width: 10%;" />
|
|
|
- <col style="width: 40%;" />
|
|
|
- <col style="width: 20%;" />
|
|
|
- <col style="width: 10%;" />
|
|
|
- <col style="width: 10%;" />
|
|
|
- <thead>
|
|
|
+ if(empty($completed_tests)) {
|
|
|
+ ?>
|
|
|
+ <div class="alert alert-info">This user has no completed or cancelled tests.</div>
|
|
|
+ <?php
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ $test_count = count($completed_tests);
|
|
|
+
|
|
|
+ $cancelled_count = 0;
|
|
|
+ $completed_count = 0;
|
|
|
+ $pass_fail_test_count = 0;
|
|
|
+ $pass_count = 0;
|
|
|
+ $pass_rate = "0.00";
|
|
|
+
|
|
|
+ foreach($completed_tests as $test) {
|
|
|
+ $template = $test->getProject()->getTemplate();
|
|
|
+ if($template->hasPassFail() && $test->isCompleted()) {
|
|
|
+ $completed_count++;
|
|
|
+ $pass_fail_test_count++;
|
|
|
+ if($test->isPass()) {
|
|
|
+ $pass_count++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if($test->isCancelled()) {
|
|
|
+ $cancelled_count++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if($pass_fail_test_count > 0) {
|
|
|
+ $pass_rate = bcmul($pass_count / $pass_fail_test_count, 100, 2);
|
|
|
+ }
|
|
|
+
|
|
|
+ ?>
|
|
|
+
|
|
|
+ <div class="row mb-4">
|
|
|
+ <div class="col-lg-3">
|
|
|
+ <div class="card card-body mb-3">
|
|
|
+ Completed Tests
|
|
|
+ <div class="stat">
|
|
|
+ <?=number_format($pass_fail_test_count)?>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="col-lg-3">
|
|
|
+ <div class="card card-body mb-3">
|
|
|
+ Pass Count
|
|
|
+ <div class="stat">
|
|
|
+ <?=number_format($pass_count)?> / <?=number_format($pass_fail_test_count)?>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="col-lg-3">
|
|
|
+ <div class="card card-body mb-3">
|
|
|
+ Pass Rate
|
|
|
+ <div class="stat">
|
|
|
+ <?=$pass_rate?>%
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="col-lg-3">
|
|
|
+ <div class="card card-body mb-3">
|
|
|
+ Cancelled Tests
|
|
|
+ <div class="stat">
|
|
|
+ <?=$cancelled_count?>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <table class="table table-sm table-hover">
|
|
|
+ <col style="width: 10%;" />
|
|
|
+ <col style="width: 40%;" />
|
|
|
+ <col style="width: 20%;" />
|
|
|
+ <col style="width: 10%;" />
|
|
|
+ <col style="width: 10%;" />
|
|
|
+ <thead>
|
|
|
<tr>
|
|
|
<th>ID</th>
|
|
|
<th>Location</th>
|
|
|
@@ -302,37 +374,38 @@ const userId = <?=$user->id?>;
|
|
|
<th>Date</th>
|
|
|
<th></th>
|
|
|
</tr>
|
|
|
- </thead>
|
|
|
- <?php
|
|
|
- foreach($completed_tests as $test) {
|
|
|
- $project = $test->getProject();
|
|
|
- $location = $test->getLocation();
|
|
|
- $date = explode(" ", $test->dts_start)[0];
|
|
|
- $date = date("d/m/Y", strtotime($date));
|
|
|
- ?>
|
|
|
- <tr>
|
|
|
- <td><?=$test->id?></td>
|
|
|
- <td>
|
|
|
- <a href="/account/locations/<?=$location->id?>"><?=htmlspecialchars($location->name)?></a><br />
|
|
|
- <small><?=htmlspecialchars($location->getDisplayAddress(["address_1", "address_2", "city", "postcode"]))?></small>
|
|
|
- </td>
|
|
|
- <td class="align-middle">
|
|
|
- <a href="/account/projects/<?=$project->id?>"><?=htmlspecialchars($project->name)?></a>
|
|
|
- </td>
|
|
|
- <td class="align-middle">
|
|
|
- <?=$date?>
|
|
|
- </td>
|
|
|
- <td class="align-middle text-right">
|
|
|
- <a class="btn btn-outline-primary" href="/account/tests/<?=$test->id?>">View</a>
|
|
|
- </td>
|
|
|
- </tr>
|
|
|
+ </thead>
|
|
|
+ <?php
|
|
|
+ foreach($completed_tests as $test) {
|
|
|
+ $project = $test->getProject();
|
|
|
+ $location = $test->getLocation();
|
|
|
+ $date = explode(" ", $test->dts_start)[0];
|
|
|
+ $date = date("d/m/Y", strtotime($date));
|
|
|
+ ?>
|
|
|
+ <tr>
|
|
|
+ <td><?=$test->id?></td>
|
|
|
+ <td>
|
|
|
+ <a href="/account/locations/<?=$location->id?>"><?=htmlspecialchars($location->name)?></a><br />
|
|
|
+ <small><?=htmlspecialchars($location->getDisplayAddress(["address_1", "address_2", "city", "postcode"]))?></small>
|
|
|
+ </td>
|
|
|
+ <td class="align-middle">
|
|
|
+ <a href="/account/projects/<?=$project->id?>"><?=htmlspecialchars($project->name)?></a>
|
|
|
+ </td>
|
|
|
+ <td class="align-middle">
|
|
|
+ <?=$date?>
|
|
|
+ </td>
|
|
|
+ <td class="align-middle text-right">
|
|
|
+ <a class="btn btn-outline-primary" href="/account/tests/<?=$test->id?>">View</a>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ <?php
|
|
|
+ }
|
|
|
+ ?>
|
|
|
+ </table>
|
|
|
<?php
|
|
|
}
|
|
|
?>
|
|
|
- </table>
|
|
|
- <?php
|
|
|
- }
|
|
|
- ?>
|
|
|
+ </section>
|
|
|
</div>
|
|
|
<div class="tab-pane fade" id="nearby-locations" role="tabpanel" aria-labelledby="nearby-locations-tab">
|
|
|
<?php
|
|
|
@@ -342,8 +415,7 @@ const userId = <?=$user->id?>;
|
|
|
<?php
|
|
|
}
|
|
|
else {
|
|
|
- $address = $addresses[0];
|
|
|
-
|
|
|
+ $first_address = $addresses[0];
|
|
|
?>
|
|
|
<div class="row">
|
|
|
<div class="col-lg-6 mb-4">
|
|
|
@@ -391,8 +463,6 @@ const userId = <?=$user->id?>;
|
|
|
<div data-test-pass-container><strong>Result:</strong> <span></span></div>
|
|
|
</div>
|
|
|
</div>
|
|
|
-
|
|
|
-
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -422,10 +492,7 @@ const userId = <?=$user->id?>;
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- <div id="nearby-locations-map" style="height: 480px;" data-maps data-lat="<?=$address->latitude?>" data-lng="<?=$address->longitude?>" data-zoom="10">
|
|
|
+ <div id="nearby-locations-map" style="height: 480px;" data-maps data-lat="<?=$first_address->latitude?>" data-lng="<?=$first_address->longitude?>" data-zoom="10">
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|