Просмотр исходного кода

Hide project table and move table to the right

Alan Lam 7 лет назад
Родитель
Сommit
7a2de10ff4
2 измененных файлов с 33 добавлено и 20 удалено
  1. 6 1
      public/js/app-reports.js
  2. 27 19
      views/reports.php

+ 6 - 1
public/js/app-reports.js

@@ -1,6 +1,6 @@
 $(function() {
 
-	$("#projects-table").DataTable({
+	var dataTable = $("#projects-table").DataTable({
 		dom: "tp",
 		data: projectData,
 		paging: false,
@@ -54,6 +54,11 @@ $(function() {
 
 	});
 
+	$("#show-projects-list-button").click(function() {
+		$("#projects-table-wrapper").toggle();
+		dataTable.columns.adjust();
+	});
+
 	$("canvas[data-chart]").each(function() {
 		var object = $(this).data("chart");
 

+ 27 - 19
views/reports.php

@@ -68,25 +68,6 @@ let projectData = <?=json_encode($project_table_data)?>;
 		<input type="hidden" name="customer_id" value="<?=htmlspecialchars($customer->id)?>" />
 
 		<div class="row">
-			<div class="col-md">
-				<div class="form-group">
-					<label>
-						Exclude Projects
-					</label>
-					<table class="table table-sm table-sm-text table-hover table-pointer" id="projects-table">
-						<thead>
-							<tr>
-								<th></th>
-								<th>ID</th>
-								<th>Name</th>
-								<th><span title="Time of Day" data-toggle="tooltip">TOD</span></th>
-								<th>Tests</th>
-								<th>Report Month</th>
-							</tr>
-						</thead>
-					</table>
-				</div>
-			</div>
 			<div class="col-md">
 				<div class="form-group">
 					<label class="form-label" for="date-range">
@@ -151,6 +132,33 @@ let projectData = <?=json_encode($project_table_data)?>;
 					Submit
 				</button>
 			</div>
+
+			<div class="col-md">
+				<div class="form-group">
+					<label class="d-block">
+						Exclude Projects
+					</label>
+
+					<button id="show-projects-list-button" type="button" class="btn btn-secondary">
+						<?=htmlspecialchars(__("Show project list"))?>
+					</button>
+
+					<div id="projects-table-wrapper" style="display: none;">
+						<table class="table table-sm table-sm-text table-hover table-pointer" id="projects-table">
+							<thead>
+								<tr>
+									<th></th>
+									<th>ID</th>
+									<th>Name</th>
+									<th><span title="Time of Day" data-toggle="tooltip">TOD</span></th>
+									<th>Tests</th>
+									<th>Report Month</th>
+								</tr>
+							</thead>
+						</table>
+					</div>
+				</div>
+			</div>
 		</div>
 	</form>