Alan Lam 8 лет назад
Родитель
Сommit
8997615e86

+ 41 - 21
controllers/account.php

@@ -8,12 +8,13 @@ $users_pending_verification = 0;
 $tests_pending_verification = 0;
 $tests_remaining = 0;
 
-$links = [];
+$icons = [];
 
 if(Core::$user->level >= User::LEVEL_ADMIN) {
-	$links["/account/customers"] = "Customers";
-	$links["/account/map-overview"] = "Map Overview";
-	$links["/account/users"] = (Core::$user->level == User::LEVEL_SUPERADMIN ? "Users" : "Testers");
+
+	$icons[] = new AccountIcon("Customers", "/account/customers", "warehouse");
+	$icons[] = new AccountIcon("Map Overview", "/account/map-overview", "map-marked");
+	$icons[] = new AccountIcon((Core::$user->level == User::LEVEL_SUPERADMIN ? "Users" : "Testers"), "/account/users", "users");
 
 	$users = User::query(["level" => User::LEVEL_UNVERIFIED]);
 	$tests = Test::query(["status" => Test::STATUS_PENDING_VERIFICATION]);
@@ -23,52 +24,71 @@ if(Core::$user->level >= User::LEVEL_ADMIN) {
 }
 
 if(Core::$user->level >= User::LEVEL_CUSTOMER) {
-	$links["/account/reports"] = "Reports";
-	$links["/account/projects"] = "Projects";
-	$links["/account/locations"] = "Locations";
-	$links["/account/templates"] = "Templates";
+	$icons[] = new AccountIcon("Reports", "/account/reports", "chart-pie");
+	$icons[] = new AccountIcon("Projects", "/account/projects", "list");
+	$icons[] = new AccountIcon("Locations", "/account/locations", "map-marker");
+	$icons[] = new AccountIcon("Templates", "/account/templates", "file-alt");
 }
 
 if(Core::$user->level >= User::LEVEL_TESTER) {
-	$links["/account/tests"] = "Tests";
-	$links["/account/practice"] = "Practice";
-
 	$tests = Core::$user->getPendingTests();
 	$tests_remaining = count($tests);
 
+	$tests_icon = new AccountIcon("Tests", "/account/tests", "clipboard-check");
+	$tests_icon->setCounter($tests_remaining);
+
+	$icons[] = $tests_icon;
+	$icons[] = new AccountIcon("Practice", "/account/practice", "chalkboard-teacher");
 }
 
 if(Core::$user->level == User::LEVEL_TESTER) {
-	$links["/account/addresses"] = "Addresses";
-	$links["/account/tests/completed"] = "Tests (Completed)";
+	$icons[] = new AccountIcon("Addresses", "/account/addresses", "address-book");
+	$icons[] = new AccountIcon("Tests (Completed)", "/account/tests/completed", "check");
 }
 
 if(Core::$user->level == User::LEVEL_REGISTERED) {
-	$links["/account/submit-id"] = "Submit ID";
+	$icons[] = new AccountIcon("Submit ID", "/account/submit-id", "id-card");
 }
 
 if(!Core::$user->terms_accepted) {
-	$links = [];
+	$icons = [];
 }
 
-$links["/account/settings"] = "Settings";
+$icons[] = new AccountIcon("Settings", "/account/settings", "cog");
 
-asort($links);
+usort($icons, function($a, $b) {
+	return $a->name <=> $b->name;
+});
 
 // Actions
 $actions = [];
 if(Core::$user->level == User::LEVEL_DEACTIVATED) {
-	$actions["/account/reactivate"] = "Reactivate Account";
+	$actions[] = new AccountIcon("Reactivate Account", "/account/reactivate", "user-check");
 }
 else if(Core::$user->level == User::LEVEL_TESTER) {
-	$actions["/account/deactivate"] = "Deactivate Account...";
+	$actions[] = new AccountIcon("Deactivate Account...", "/account/deactivate", "user-times");
+}
+
+$actions[] = new AccountIcon("Delete Account...", "/account/delete", "user-slash");
+
+// To-do
+$to_do = [];
+if($users_pending_verification) {
+	$icon = new AccountIcon("Verify Users", "/account/users?level=" . User::LEVEL_UNVERIFIED, "user-check");
+	$icon->setCounter($users_pending_verification);
+	$to_do[] = $icon;
+}
+
+if($tests_pending_verification) {
+	$icon = new AccountIcon("Verify Tests", "/account/tests?status=" . Test::STATUS_PENDING_VERIFICATION, "clipboard-check");
+	$icon->setCounter($tests_pending_verification);
+	$to_do[] = $icon;
 }
-$actions["/account/delete"] = "Delete Account...";
 
 $referrals = Core::$user->getReferrals();
 
 View::includeOnce("header", compact("page_title"));
-View::include("account", compact("links", "actions", "referrals", "users_pending_verification", "tests_pending_verification", "tests_remaining"));
+View::include("account", compact("icons", "actions", "to_do", "referrals"));
 View::includeOnce("footer");
 
 ?>

+ 52 - 19
controllers/reports.php

@@ -198,8 +198,10 @@ if($submit) {
 
 			"maleTesterCount" => 0,
 			"femaleTesterCount" => 0,
+
 			"maleChallengerCount" => 0,
 			"femaleChallengerCount" => 0,
+			"unspecifiedChallengerCount" => 0,
 
 			"maleChallengeMaleCount" => 0,
 			"maleChallengeMalePassCount" => 0,
@@ -223,8 +225,11 @@ if($submit) {
 		$total_data = (object) [
 			"maleTesterCount" => 0,
 			"femaleTesterCount" => 0,
+
 			"maleChallengerCount" => 0,
 			"femaleChallengerCount" => 0,
+			"unspecifiedChallengerCount" => 0,
+
 			"testCount" => 0,
 			"passCount" => 0,
 			"failCount" => 0,
@@ -378,10 +383,15 @@ if($submit) {
 				$data[$key]->maleChallengerCount++;
 				$total_data->maleChallengerCount++;
 			}
-			if($test->challenger_gender == "F") {
+			else if($test->challenger_gender == "F") {
 				$data[$key]->femaleChallengerCount++;
 				$total_data->femaleChallengerCount++;
 			}
+			else {
+				$data[$key]->unspecifiedChallengerCount++;
+				$total_data->unspecifiedChallengerCount++;
+			}
+
 
 			if($tester->gender == "M") {
 				if($test->challenger_gender == "M") {
@@ -443,10 +453,7 @@ if($submit) {
 				"#FFAB91",
 				"#F44336",
 			],
-			"datalabels" => [
-				"backgroundColor" => "rgba(0, 0, 0, 0.75)",
-				"borderRadius" => "2",
-			],
+			"datalabels" => Chart::DATALABELS_BOX,
 		]);
 		$chart->setPrintSuffixes("");
 		$chart->print = true;
@@ -460,17 +467,19 @@ if($submit) {
 		$chart = new Chart;
 		$chart->setType("pie");
 		$chart->setTitle("Staff Gender $date_range_label");
-		$chart->setLabels(["Male", "Female"]);
+		$chart->setLabels(["Male", "Female", "Unspecified"]);
 		$chart->addDataset("Counts", [
 			$total_data->maleChallengerCount,
 			$total_data->femaleChallengerCount,
+			$total_data->unspecifiedChallengerCount,
 		], [
 			"background_colours" => [
 				"#2196F3",
 				"#E91E63",
-			]
+				"#9E9E9E",
+			],
+			"datalabels" => Chart::DATALABELS_BOX,
 		]);
-		$chart->setDatalabelSuffixes(" Test");
 		$charts[] = $chart;
 
 		// Tester Gender
@@ -485,9 +494,9 @@ if($submit) {
 			"background_colours" => [
 				"#2196F3",
 				"#E91E63",
-			]
+			],
+			"datalabels" => Chart::DATALABELS_BOX,
 		]);
-		$chart->setDatalabelSuffixes(" Test");
 		$charts[] = $chart;
 
 		// Pass / Fail
@@ -502,9 +511,9 @@ if($submit) {
 			"background_colours" => [
 				"#4CAF50",
 				"#F44336",
-			]
+			],
+			"datalabels" => Chart::DATALABELS_BOX,
 		]);
-		$chart->setDatalabelSuffixes(" Test");
 		$charts[] = $chart;
 
 		// Pass Rate Period
@@ -628,10 +637,7 @@ if($submit) {
 					"#FFAB91",
 					"#F44336",
 				],
-				"datalabels" => [
-					"backgroundColor" => "rgba(0, 0, 0, 0.75)",
-					"borderRadius" => "2",
-				],
+				"datalabels" => Chart::DATALABELS_BOX,
 			]);
 			$charts[] = $chart;
 		}
@@ -695,10 +701,19 @@ if($submit) {
 
 			// Region Pass Rate (Selected Date Range)
 			$data_values = [];
+
+			$test_counts = [];
+			$pass_counts = [];
+			$fail_counts = [];
+
 			foreach($region_data as $region => $r_data) {
 				$total_region_test_count = array_sum(array_column($r_data, "testCount"));
 				$total_region_pass_count = array_sum(array_column($r_data, "passCount"));
 
+				$test_counts[] = $total_region_test_count;
+				$pass_counts[] = $total_region_pass_count;
+				$fail_counts[] = $total_region_test_count - $total_region_pass_count;
+
 				$data_values[] = ($total_region_test_count == 0) ? 0 : round(($total_region_pass_count * 100) / $total_region_test_count);
 			}
 
@@ -710,10 +725,15 @@ if($submit) {
 			$chart->setType("bar");
 			$chart->setTitle("Region Pass Rate $date_range_label");
 			$chart->setLabels($x_data_labels);
-			$chart->addDataset("Pass Rate (%)", $data_values , [
+			$chart->addDataset("Pass %", $data_values , [
 				"background_colours" => "#2196F3"
 			]);
+			$chart->addPrintDataset("Tests", $test_counts);
+			$chart->addPrintDataset("Pass", $pass_counts);
+			$chart->addPrintDataset("Fail", $fail_counts);
+
 			$chart->setDatalabelSuffixes("%");
+			$chart->print = true;
 			$charts[] = $chart;
 
 			// Region Pass Rate Period
@@ -752,11 +772,20 @@ if($submit) {
 
 			// Area Pass Rate (Selected Date Range)
 			$data_values = [];
+
+			$test_counts = [];
+			$pass_counts = [];
+			$fail_counts = [];
+
 			foreach($area_manager_data as $area_manager => $a_data) {
 				$total_area_manager_test_count = array_sum(array_column($a_data, "testCount"));
 				$total_area_manager_pass_count = array_sum(array_column($a_data, "passCount"));
 				$total_area_manager_fail_count = array_sum(array_column($a_data, "failCount"));
 
+				$test_counts[] = $total_area_manager_test_count;
+				$pass_counts[] = $total_area_manager_pass_count;
+				$fail_counts[] = $total_area_manager_fail_count;
+
 				$data_values[] = ($total_region_test_count == 0) ? 0 : round(($total_area_manager_pass_count * 100) / $total_area_manager_test_count);
 			}
 
@@ -775,10 +804,14 @@ if($submit) {
 			$chart->setType("bar");
 			$chart->setTitle("Area Manager Pass Rate $date_range_label");
 			$chart->setLabels($x_data_labels);
-			$chart->addDataset("Pass Rate (%)", $data_values , [
+			$chart->addDataset("Pass %", $data_values , [
 				"background_colours" => "#2196F3"
 			]);
+			$chart->addPrintDataset("Tests", $test_counts);
+			$chart->addPrintDataset("Pass", $pass_counts);
+			$chart->addPrintDataset("Fail", $fail_counts);
 			$chart->setDatalabelSuffixes("%");
+			$chart->print = true;
 			$charts[] = $chart;
 
 			// Area Pass Rate Period
@@ -846,7 +879,7 @@ if($submit) {
 
 
 View::includeOnce("header", compact("page_title"));
-View::include("reports", compact("customer", "date_range", "from_quarter", "to_quarter", "date_resolution", "all_projects", "project_ids", "charts", "data", "total_data", "locations_missing_region", "locations_missing_area_manager", "region_data", "area_manager_data"));
+View::include("reports", compact("customer", "date_range", "from_quarter", "to_quarter", "date_resolution", "all_projects", "project_ids", "charts", "data", "total_data", "locations_missing_region", "locations_missing_area_manager", "region_data", "area_manager_data", "key_labels"));
 View::includeOnce("footer");
 
 ?>

+ 83 - 1
controllers/reports_presentation.php

@@ -42,7 +42,7 @@ foreach($charts_b64 as $index => $b64) {
 	$chart = $charts[$index];
 
 	$labels = $chart->getLabels();
-	$datasets = $chart->getDatasets();
+	$datasets = array_merge($chart->getDatasets(), $chart->getPrintDatasets());
 
 	$column_count = 1 + count($labels);
 
@@ -164,6 +164,88 @@ foreach($charts_b64 as $index => $b64) {
 	$names[] = $name;
 }
 
+// Region/Area Manager Stats
+
+foreach([0, 1] as $mode) {
+
+	switch($mode) {
+		case 0:
+			$current_data = $region_data;
+			$mode_text = "Region";
+			break;
+		case 1:
+			$current_data = $area_manager_data;
+			$mode_text = "Area Manager";
+			break;
+	}
+
+	foreach($current_data as $data_id => $rows) {
+
+		$slide = $presentation->createSlide();
+
+		// Title
+		$shape = $slide->createRichTextShape()
+			  ->setHeight(120)->setWidth(940)
+			  ->setOffsetX(30)->setOffsetY(30);
+		$run = $shape->createTextRun("$mode_text: $data_id");
+		$run->getFont()->setSize(36);
+
+		// Table
+
+		$shape = $slide->createTableShape(5)
+			->setWidth(900)
+			->setOffsetX(30)
+			->setOffsetY(110);
+		// Create header row
+		$row = $shape->createRow();
+		$row->setHeight(20);
+
+		foreach(["Period", "Tests", "Passes", "Fails", "Rate"] as $label) {
+			$cell = $row->nextCell();
+			$cell->getActiveParagraph()->getAlignment()
+				->setMarginBottom(4)
+				->setMarginLeft(4)
+				->setMarginRight(4)
+				->setMarginTop(4);
+			$cell->createTextRun($label)
+				->getFont()->setBold(true);
+		}
+
+		$index = 0;
+
+		foreach($rows as $key => $data) {
+			$rate = ($data->testCount == 0) ? "0.00" : number_format(($data->passCount * 100) / $data->testCount, 2);
+			$label = $key_labels[$index];
+
+			$values = [$data->testCount, $data->passCount, $data->failCount, "$rate%"];
+
+			$row = $shape->createRow();
+			$row->setHeight(20);
+			$cell = $row->nextCell();
+			$cell->getActiveParagraph()->getAlignment()
+				->setMarginBottom(4)
+				->setMarginLeft(4)
+				->setMarginRight(4)
+				->setMarginTop(4);
+			$cell->createTextRun($label)
+				->getFont()->setBold(true);
+			foreach($values as $value) {
+				$cell = $row->nextCell();
+				$cell->getActiveParagraph()->getAlignment()
+					->setHorizontal(Alignment::HORIZONTAL_RIGHT)
+					->setMarginBottom(4)
+					->setMarginLeft(4)
+					->setMarginRight(4)
+					->setMarginTop(4);
+				$cell->createTextRun($value);
+			}
+
+			$index++;
+		}
+	}
+}
+
+
 if($action == "export-pptx") {
 	header("Content-Type: application/vnd.openxmlformats-officedocument.presentationml.presentation");
 	$pptx_writer = IOFactory::createWriter($presentation, "PowerPoint2007");

+ 21 - 0
engine/account_icon.php

@@ -0,0 +1,21 @@
+<?php
+
+class AccountIcon {
+
+	public $name = "";
+	public $icon = "";
+	public $url = "";
+
+	public $counter = false;
+
+	public function __construct($name, $url, $icon) {
+		$this->name = $name;
+		$this->icon = $icon;
+		$this->url = $url;
+	}
+
+	public function setCounter($counter) {
+		$this->counter = $counter;
+	}
+
+}

+ 25 - 2
engine/chart.php

@@ -2,10 +2,16 @@
 
 class Chart {
 
+	const DATALABELS_BOX = [
+		"backgroundColor" => "rgba(0, 0, 0, 0.75)",
+		"borderRadius" => "2",
+	];
+
 	private $id = "";
 	private $title = "Untitled";
 	private $type = "bar";
 	private $datasets = [];
+	private $printDatasets = [];
 	private $labels = [];
 	private $printLabels = null;
 
@@ -132,10 +138,24 @@ class Chart {
 
 	}
 
+	public function addPrintDataset($label, $data) {
+
+		$dataset = [
+			"label" => $label,
+			"data" => $data,
+		];
+
+		$this->printDatasets[] = (object) $dataset;
+	}
+
 	public function getDatasets() {
 		return $this->datasets;
 	}
 
+	public function getPrintDatasets() {
+		return $this->printDatasets;
+	}
+
 	public function getLabels() {
 		return $this->labels;
 	}
@@ -248,14 +268,17 @@ class Chart {
 			</thead>
 			<tbody>
 			<?php
-			foreach($this->datasets as $index => $dataset) {
+
+			$datasets = array_merge($this->datasets, $this->printDatasets);
+
+			foreach($datasets as $index => $dataset) {
 
 				$suffix = "";
 
 				$suffixes = $this->printSuffixes ?? $this->datalabelSuffixes;
 
 				if($suffixes) {
-					$suffix = $suffixes[$index];
+					$suffix = $suffixes[$index] ?? "";
 				}
 
 				$data = $dataset->data;

+ 3 - 0
engine/user.php

@@ -276,6 +276,9 @@ class User extends Model {
 	}
 
 	public function getDisplayName() {
+
+		if(empty($this->email)) return "Deleted User";
+
 		$parts = array_filter([$this->first_name, $this->last_name]);
 		return implode(" ", $parts);
 	}

+ 13 - 1
public/js/app.js

@@ -43,7 +43,19 @@ $(function() {
 		specialSpan.attr("class", specialClass);
 	});
 
-    var clipboard = new ClipboardJS(".btn[data-clipboard-target]");
+    var clipboard = new ClipboardJS("[data-clipboard-target], [data-clipboard-text]");
+	clipboard.on("success", function(e) {
+
+		$(e.trigger).tooltip("hide").attr("data-original-title", "Copied!").tooltip("show");
+
+		e.clearSelection();
+	});
+
+	let hasTooltips = $('[data-toggle="tooltip"]').length > 0;
+	if(hasTooltips) {
+		initialiseTooltips();
+	}
+
 
 });
 

+ 84 - 55
views/account.php

@@ -29,76 +29,106 @@
 	?>
 
 	<div class="row">
-		<div class="col-lg-4 mb-3 mb-lg-0">
+		<div class="col-xl mb-3 mb-lg-0">
 			<h3>Main Menu</h3>
-			<div class="list-group mb-3">
+			<div class="row">
 			<?php
-			foreach($links as $path => $text) {
+			foreach($icons as $icon) {
 				?>
-				<a class="list-group-item list-group-item-action" href="<?=htmlspecialchars($path)?>">
-					<?=htmlspecialchars($text)?>
-				</a>
+				<div class="col-6 col-sm-4 text-center">
+					<a class="btn btn-light btn-block mb-3 p-2" href="<?=htmlspecialchars($icon->url)?>">
+						<?php
+						if($icon->counter) {
+							?>
+							<span class="fa-layers fa-fw fa-3x mb-2">
+								<i class="fal fa-<?=htmlspecialchars($icon->icon)?>"></i>
+								<span class="fa-layers-counter fa-layers-bottom-right"><?=number_format($icon->counter)?></span>
+							</span>
+							<?php
+						}
+						else {
+							?>
+							<i class="fal fa-3x fa-<?=htmlspecialchars($icon->icon)?> mb-2"></i>
+							<?php
+						}
+						?>
+						<br />
+						<?=htmlspecialchars($icon->name)?>
+					</a>
+				</div>
 				<?php
 			}
 			?>
 			</div>
 			<h3>Actions</h3>
-			<div class="list-group mb-3">
+			<div class="row">
 			<?php
-			foreach($actions as $path => $text) {
-				$text_class = preg_match("/delete/i", $text) ? "text-danger" : "";
+			foreach($actions as $icon) {
+				$button_class = preg_match("/delete/i", $icon->name) ? "btn-danger" : "btn-light";
 				?>
-				<a class="list-group-item list-group-item-action <?=$text_class?>" href="<?=htmlspecialchars($path)?>">
-					<?=htmlspecialchars($text)?>
-				</a>
+				<div class="col-6 col-sm-4 text-center">
+					<a class="btn <?=$button_class?> btn-block mb-3 p-2" href="<?=htmlspecialchars($icon->url)?>">
+						<?php
+						if($icon->counter) {
+							?>
+							<span class="fa-layers fa-fw fa-3x mb-2">
+								<i class="fal fa-<?=htmlspecialchars($icon->icon)?>"></i>
+								<span class="fa-layers-counter fa-layers-bottom-right"><?=number_format($icon->counter)?></span>
+							</span>
+							<?php
+						}
+						else {
+							?>
+							<i class="fal fa-3x fa-<?=htmlspecialchars($icon->icon)?> mb-2"></i>
+							<?php
+						}
+						?>
+						<br />
+						<?=htmlspecialchars($icon->name)?>
+					</a>
+				</div>
 				<?php
 			}
 			?>
 			</div>
 		</div>
-		<div class="col-lg mb-3 mb-lg-0">
+		<div class="col-xl mb-3 mb-lg-0">
 
 			<?php
-			$has_to_do = !empty($users_pending_verification) || !empty($tests_pending_verification) || !empty($tests_remaining);
-
-			if($has_to_do) {
+			if($to_do) {
 				?>
 				<h3>To-Do</h3>
 
+				<div class="row">
 				<?php
-				if($users_pending_verification) {
-					$s = ($users_pending_verification == 1) ? "" : "s";
-					?>
-					<div class="alert alert-info mb-3 d-flex flex-row justify-content-between">
-						<div class="align-self-center">
-							<i class="fal fa-fw fa-info-circle"></i> <?=number_format($users_pending_verification)?> user<?=$s?> to be verified.
-						</div>
-						<a class="btn btn-primary" href="/account/users?level=<?=User::LEVEL_UNVERIFIED?>">View</a>
-					</div>
-					<?php
-				}
-				if($tests_pending_verification) {
-					$s = ($tests_pending_verification == 1) ? "" : "s";
+				foreach($to_do as $icon) {
 					?>
-					<div class="alert alert-info mb-3 d-flex flex-row justify-content-between">
-						<div class="align-self-center">
-							<i class="fal fa-fw fa-info-circle"></i> <?=number_format($tests_pending_verification)?> test<?=$s?> to be verified.
-						</div>
-						<a class="btn btn-primary" href="/account/tests?status=<?=Test::STATUS_PENDING_VERIFICATION?>">View</a>
-					</div>
-					<?php
-				}
-				if($tests_remaining) {
-					$s = ($tests_remaining == 1) ? "" : "s";
-					?>
-					<div class="alert alert-info mb-3 d-flex flex-row justify-content-between">
-						<div class="align-self-center">
-							<i class="fal fa-fw fa-info-circle"></i> <?=number_format($tests_remaining)?> test<?=$s?> remaining.
-						</div>
-						<a class="btn btn-primary" href="/account/tests">View</a>
+					<div class="col-6 col-sm-4 text-center">
+						<a class="btn btn-primary btn-block mb-3 p-2" href="<?=htmlspecialchars($icon->url)?>">
+							<?php
+							if($icon->counter) {
+								?>
+								<span class="fa-layers fa-fw fa-3x mb-2">
+									<i class="fal fa-<?=htmlspecialchars($icon->icon)?>"></i>
+									<span class="fa-layers-counter fa-layers-bottom-right"><?=number_format($icon->counter)?></span>
+								</span>
+								<?php
+							}
+							else {
+								?>
+								<i class="fal fa-3x fa-<?=htmlspecialchars($icon->icon)?> mb-2"></i>
+								<?php
+							}
+							?>
+							<br />
+							<?=htmlspecialchars($icon->name)?>
+						</a>
 					</div>
 					<?php
 				}
+				?>
+				</div>
+				<?php
 			}
 
 			if(Core::$user->level != User::LEVEL_DEACTIVATED && !Core::$user->terms_accepted) {
@@ -159,20 +189,19 @@
 					</span>
 					<span><?=number_format(count($referrals))?></span>
 				</div>
-				<div class="list-group-item d-flex align-items-center justify-content-between">
+				<div class="list-group-item d-flex justify-content-between">
 					<span>
 						<i class="fal fa-fw fa-external-link"></i>
 						Referral Link:
 					</span>
-					<div class="input-group input-group-sm w-50">
-						<input class="form-control w-auto" type="text" id="referral-link" readonly value="<?=PROTOCOL?>://<?=DOMAIN?>/register?r=<?=Core::$user->id?>" />
-						<div class="input-group-append">
-							<button class="btn btn-secondary" data-clipboard-target="#referral-link" data-toggle="tooltip" title="Copy to clipboard">
-								<i class="fal fa-fw fa-clipboard"></i>
-								<span class="sr-only">Copy to clipboard</span>
-							</button>
-						</div>
-					</div>
+
+					<span>
+						<a href="#" data-clipboard-text="<?=PROTOCOL?>://<?=DOMAIN?>/register?r=<?=Core::$user->id?>" data-toggle="tooltip" data-title="Copy to clipboard">
+							<i class="fal fa-fw fa-clipboard"></i>
+							Copy to clipboard
+						</a>
+					</span>
+
 				</div>
 			</div>
 		</div>

+ 93 - 87
views/reports.php

@@ -324,106 +324,112 @@ $date_range_custom_style = ($date_range == "custom") ? "" : "display: none";
 			<?php
 		}
 
-		if(PRODUCTION == false) {
-			?>
-			<div class="d-print-none">
-				<h2>Debug Information</h2>
-
-				<h3>Region Data</h3>
+		?>
+		<div class="d-print-none">
+			<h2>Extra Information</h2>
 
-				<?php
+			<h3>Region Data</h3>
 
-				foreach($region_data as $region => $rows) {
+			<?php
 
-					?>
-					<h4>Region: <?=htmlspecialchars($region)?></h4>
-
-					<table class="table">
-						<col style="width: 20%" />
-						<col style="width: 20%" />
-						<col style="width: 20%" />
-						<col style="width: 20%" />
-						<col style="width: 20%" />
-						<thead>
-							<tr>
-								<th>Key</th>
-								<th>Tests</th>
-								<th>Passes</th>
-								<th>Fails</th>
-								<th>Rate</th>
-							</tr>
-						</thead>
-						<tbody>
-						<?php
-						foreach($rows as $key => $data) {
-							$rate = ($data->testCount == 0) ? "0.00" : number_format(($data->passCount * 100) / $data->testCount, 2);
-							?>
-							<tr>
-								<td><?=htmlspecialchars($key)?></td>
-								<td><?=number_format($data->testCount)?></td>
-								<td><?=number_format($data->passCount)?></td>
-								<td><?=number_format($data->failCount)?></td>
-								<td><?=$rate?>%</td>
-							</tr>
-							<?php
-						}
-						?>
-						</tbody>
-					</table>
+			foreach($region_data as $region => $rows) {
 
+				?>
+				<h4>Region: <?=htmlspecialchars($region)?></h4>
+
+				<table class="table">
+					<col style="width: 20%" />
+					<col style="width: 20%" />
+					<col style="width: 20%" />
+					<col style="width: 20%" />
+					<col style="width: 20%" />
+					<thead>
+						<tr>
+							<th>Period</th>
+							<th>Tests</th>
+							<th>Passes</th>
+							<th>Fails</th>
+							<th>Rate</th>
+						</tr>
+					</thead>
+					<tbody>
 					<?php
 
-				}
+					$index = 0;
+
+					foreach($rows as $key => $data) {
+						$rate = ($data->testCount == 0) ? "0.00" : number_format(($data->passCount * 100) / $data->testCount, 2);
+						$label = $key_labels[$index];
+						?>
+						<tr>
+							<td><?=htmlspecialchars($label)?></td>
+							<td><?=number_format($data->testCount)?></td>
+							<td><?=number_format($data->passCount)?></td>
+							<td><?=number_format($data->failCount)?></td>
+							<td><?=$rate?>%</td>
+						</tr>
+						<?php
+						$index++;
+					}
+					?>
+					</tbody>
+				</table>
 
-				?>
-				<h3>Area Manager Data</h3>
 				<?php
 
-				foreach($area_manager_data as $area_manager => $rows) {
+			}
 
-					?>
-					<h4>Area Manager: <?=htmlspecialchars($area_manager)?></h4>
-
-					<table class="table">
-						<col style="width: 20%" />
-						<col style="width: 20%" />
-						<col style="width: 20%" />
-						<col style="width: 20%" />
-						<col style="width: 20%" />
-						<thead>
-							<tr>
-								<th>Key</th>
-								<th>Tests</th>
-								<th>Passes</th>
-								<th>Fails</th>
-								<th>Rate</th>
-							</tr>
-						</thead>
-						<tbody>
-						<?php
-						foreach($rows as $key => $data) {
-							$rate = ($data->testCount == 0) ? "0.00" : number_format(($data->passCount * 100) / $data->testCount, 2);
-							?>
-							<tr>
-								<td><?=htmlspecialchars($key)?></td>
-								<td><?=number_format($data->testCount)?></td>
-								<td><?=number_format($data->passCount)?></td>
-								<td><?=number_format($data->failCount)?></td>
-								<td><?=$rate?>%</td>
-							</tr>
-							<?php
-						}
-						?>
-						</tbody>
-					</table>
+			?>
+			<h3>Area Manager Data</h3>
+			<?php
+
+			foreach($area_manager_data as $area_manager => $rows) {
 
+				?>
+				<h4>Area Manager: <?=htmlspecialchars($area_manager)?></h4>
+
+				<table class="table">
+					<col style="width: 20%" />
+					<col style="width: 20%" />
+					<col style="width: 20%" />
+					<col style="width: 20%" />
+					<col style="width: 20%" />
+					<thead>
+						<tr>
+							<th>Period</th>
+							<th>Tests</th>
+							<th>Passes</th>
+							<th>Fails</th>
+							<th>Rate</th>
+						</tr>
+					</thead>
+					<tbody>
 					<?php
+					$index = 0;
+					foreach($rows as $key => $data) {
+						$rate = ($data->testCount == 0) ? "0.00" : number_format(($data->passCount * 100) / $data->testCount, 2);
+						$label = $key_labels[$index];
+						?>
+						<tr>
+							<td><?=htmlspecialchars($label)?></td>
+							<td><?=number_format($data->testCount)?></td>
+							<td><?=number_format($data->passCount)?></td>
+							<td><?=number_format($data->failCount)?></td>
+							<td><?=$rate?>%</td>
+						</tr>
+						<?php
+						$index++;
+					}
+					?>
+					</tbody>
+				</table>
 
-				}
-			?>
-			</div>
-			<?php
-		}
+				<?php
+
+			}
+		?>
+		</div>
+		<?php
 
 	}
 	?>