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

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
public/css/bootstrap.min.css


+ 8 - 1
public/js/app-performance.js

@@ -60,4 +60,11 @@ function testsByStageFormatter(value, context) {
 	label += percentage + "%";
 
 	return label;
-}
+}
+
+window.onbeforeprint = function beforePrintHandler() {
+  for (var id in Chart.instances) {
+    Chart.instances[id].resize();
+	console.log(Chart.instances[id]);
+  }
+};

+ 28 - 0
scss/_print.scss

@@ -0,0 +1,28 @@
+%print-styles {
+	body {
+		padding-top: 0;
+	}
+
+	.container {
+		width: auto;
+	}
+
+	canvas[data-chart] {
+		width: 1110px !important;
+		height: 832px !important;
+		padding-right: 2cm;
+		padding-bottom: 1.5cm;
+	}
+}
+
+@media print {
+	@extend %print-styles;
+}
+
+.print {
+	@extend %print-styles;
+
+	.d-print-none {
+		display: none;
+	}
+}

+ 3 - 1
scss/bootstrap.scss

@@ -12,4 +12,6 @@ $enable-gradients: true;
 
 @import "../node_modules/bootstrap/scss/bootstrap.scss";
 
-@import "main.scss";
+@import "main.scss";
+
+@import "print.scss";

+ 1 - 1
views/breadcrumbs.php

@@ -5,7 +5,7 @@ $breadcrumbs = Core::$breadcrumbs;
 if(count($breadcrumbs) > 1) {
 	$breadcrumb_count = count($breadcrumbs);
 	?>
-	<nav class="breadcrumb-nav" aria-label="breadcrumb" role="navigation">
+	<nav class="breadcrumb-nav d-print-none" aria-label="breadcrumb" role="navigation">
 		<ol class="breadcrumb">
 			<?php
 

+ 1 - 1
views/footer.php

@@ -2,7 +2,7 @@
 		if(Core::$show_footer_content) {
 		?>
 
-		<footer class="my-3">
+		<footer class="my-3 d-print-none">
 			<div class="container">
 
 				<hr />

+ 9 - 3
views/header.php

@@ -8,6 +8,12 @@ if(!PRODUCTION) {
 	$icon = "/img/dev_icon.png";
 }
 
+$body_class = "";
+
+$print = http::value("print");
+if($print) $body_class = "print";
+
+
 ?>
 <!DOCTYPE html>
 <html>
@@ -46,9 +52,9 @@ if(!PRODUCTION) {
 		}
 		?>
 	</head>
-	<body>
+	<body class="<?=htmlspecialchars($body_class)?>">
 
-		<div class="fixed-top" style="overflow-y: auto; max-height: 100%;">
+		<div class="fixed-top d-print-none" style="overflow-y: auto; max-height: 100%;">
 			<nav class="navbar navbar-expand-lg navbar-light bg-light">
 				<div class="navbar-brand p-0">
 					<a href="/">
@@ -115,7 +121,7 @@ if(!PRODUCTION) {
 		if(!PRODUCTION) {
 			$style = (count(Core::$breadcrumbs) > 1) ? "margin-top: -1rem;" : "";
 			?>
-			<div class="p-2 mb-3 bg-danger text-white text-center" style="<?=$style?>">
+			<div class="p-2 mb-3 bg-danger text-white text-center d-print-none" style="<?=$style?>">
 				<strong>PLEASE NOTE:</strong> This is a development version of the site.
 			</div>
 			<?php

+ 89 - 85
views/performance.php

@@ -17,7 +17,7 @@ $date_range_custom_style = ($date_range == "custom") ? "" : "display: none";
 
 ?>
 <div class="container">
-	<div class="row">
+	<div class="row d-print-none">
 		<div class="col-auto">
 			<h2><?=htmlspecialchars($customer->name)?> Performance</h2>
 		</div>
@@ -25,7 +25,7 @@ $date_range_custom_style = ($date_range == "custom") ? "" : "display: none";
 		</div>
 	</div>
 
-	<form class="mb-4" method="post">
+	<form class="mb-4 d-print-none" method="post">
 
 		<input type="hidden" name="customer_id" value="<?=htmlspecialchars($customer->id)?>" />
 
@@ -161,7 +161,7 @@ $date_range_custom_style = ($date_range == "custom") ? "" : "display: none";
 	<?php
 	if($locations_missing_region) {
 		?>
-		<div class="alert alert-warning">
+		<div class="alert alert-warning d-print-none">
 			There are some locations that are missing "region" information:
 			<ul class="mb-0">
 			<?php
@@ -190,7 +190,7 @@ $date_range_custom_style = ($date_range == "custom") ? "" : "display: none";
 	<?php
 	if($locations_missing_area_manager) {
 		?>
-		<div class="alert alert-warning">
+		<div class="alert alert-warning d-print-none">
 			There are some locations that are missing "area manager" information:
 			<ul class="mb-0">
 			<?php
@@ -243,7 +243,7 @@ $date_range_custom_style = ($date_range == "custom") ? "" : "display: none";
 		</div>
 
 		<div class="row mb-4">
-			<div class="col-md-4" style="position: relative;">
+			<div class="col-md-4 d-print-none" style="position: relative;">
 				<h3>Chart List</h3>
 				<div class="list-group" style="position: sticky; top: 7rem;">
 				<?php
@@ -292,99 +292,103 @@ $date_range_custom_style = ($date_range == "custom") ? "" : "display: none";
 
 		if(PRODUCTION == false) {
 			?>
-			<h2>Debug Information</h2>
+			<div class="d-print-none">
+				<h2>Debug Information</h2>
 
-			<h3>Region Data</h3>
+				<h3>Region Data</h3>
 
-			<?php
+				<?php
 
-			foreach($region_data as $region => $rows) {
+				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>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>
+					<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>
 
-				<?php
+					<?php
 
-			}
+				}
 
-			?>
-			<h3>Area Manager Data</h3>
-			<?php
+				?>
+				<h3>Area Manager Data</h3>
+				<?php
 
-			foreach($area_manager_data as $area_manager => $rows) {
+				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>
+					<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>
 
-				<?php
+					<?php
 
-			}
+				}
+			?>
+			</div>
+			<?php
 		}
 
 	}

Некоторые файлы не были показаны из-за большого количества измененных файлов