ソースを参照

Sort projects by deadline. Limit height of list groups.

Alan Lam 8 年 前
親
コミット
0cffcfca6d
2 ファイル変更、12 行追加、4 行削除
  1. 3 0
      controllers/map_overview.php
  2. 9 4
      views/map_overview.php

+ 3 - 0
controllers/map_overview.php

@@ -11,6 +11,9 @@ $today = gmdate("Y-m-d") . " 00:00:00";
 
 
 $projects = Project::query([
 $projects = Project::query([
 	"dts_deadline" => (new Constraint("MORE_THAN_OR_EQUAL"))->setValues($today)
 	"dts_deadline" => (new Constraint("MORE_THAN_OR_EQUAL"))->setValues($today)
+], [
+	"sort" => "dts_deadline",
+	"order" => "desc",
 ]);
 ]);
 
 
 Customer::load(array_column($projects, "customer_id"));
 Customer::load(array_column($projects, "customer_id"));

+ 9 - 4
views/map_overview.php

@@ -20,7 +20,7 @@
 			</div>
 			</div>
 
 
 			<h3>Customers</h3>
 			<h3>Customers</h3>
-			<div class="list-group">
+			<div class="list-group d-block limit-height-1">
 			<?php
 			<?php
 			foreach($customers as $customer) {
 			foreach($customers as $customer) {
 				?>
 				?>
@@ -35,14 +35,19 @@
 		</div>
 		</div>
 		<div class="col-md mb-3">
 		<div class="col-md mb-3">
 			<h3>Current/Future Projects</h3>
 			<h3>Current/Future Projects</h3>
-			<div class="list-group">
+			<div class="list-group d-block limit-height-2">
 			<?php
 			<?php
 			foreach($projects as $project) {
 			foreach($projects as $project) {
 				$customer = $project->getCustomer();
 				$customer = $project->getCustomer();
+				$unix_deadline = strtotime($project->dts_deadline . " UTC");
+				$deadline = date("d/m/Y", $unix_deadline);
 				?>
 				?>
 				<a class="list-group-item list-group-item-action d-flex justify-content-between" data-project-id="<?=$project->id?>" data-selected="false">
 				<a class="list-group-item list-group-item-action d-flex justify-content-between" data-project-id="<?=$project->id?>" data-selected="false">
-					<div>
-						<small><strong><?=strtoupper(htmlspecialchars($customer->name))?></strong></small><br />
+					<div class="w-100">
+						<div class="d-flex justify-content-between">
+							<small><strong><?=strtoupper(htmlspecialchars($customer->name))?></strong></small>
+							<small><strong>DEADLINE: <?=$deadline?></strong></small>
+						</div>
 						<?=htmlspecialchars($project->name)?>
 						<?=htmlspecialchars($project->name)?>
 					</div>
 					</div>
 					<span class="badge badge-pill badge-lg align-self-center"></span>
 					<span class="badge badge-pill badge-lg align-self-center"></span>