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

Add Test Date to info window and various fixes

Alan Lam 8 лет назад
Родитель
Сommit
2aa90b7c72
2 измененных файлов с 18 добавлено и 2 удалено
  1. 11 2
      controllers/map_overview_ajax.php
  2. 7 0
      public/js/app-map-overview.js

+ 11 - 2
controllers/map_overview_ajax.php

@@ -55,6 +55,7 @@ if($submit) {
 					$customer_slug = str_replace("-", "_", Util::slug($customer->name));
 
 					$tester = null;
+					$formatted_start_dts = null;
 					$formatted_due_dts = null;
 
 					$icon = null;
@@ -66,12 +67,19 @@ if($submit) {
 
 						$tester = $test->getTester();
 
-						$unix_due = strtotime($test->dts_due);
-						$formatted_due_dts = date("d/m/Y H:i", $unix_due);
+						if(!is_null($test->dts_start)) {
+							$unix_start = strtotime($test->dts_start);
+							$formatted_start_dts = date("d/m/Y H:i", $unix_start);
+						}
 
 						if(is_null($test->pass)) {
 							$icon_file = "{$customer_slug}_pending.png";
 
+							if(!is_null($test->dts_due)) {
+								$unix_due = strtotime($test->dts_due);
+								$formatted_due_dts = date("d/m/Y H:i", $unix_due);
+							}
+
 							if($tester && $test->dts_due && time() > $unix_due) {
 								$icon_file = "{$customer_slug}_past_due.png";
 								$past_due = true;
@@ -103,6 +111,7 @@ if($submit) {
 					if($test) {
 						$data["test"] = [
 							"id" => $test->id,
+							"formattedStartDts" => $formatted_start_dts,
 							"formattedDueDts" => $formatted_due_dts,
 							"tester" => null,
 							"pastDue" => $past_due,

+ 7 - 0
public/js/app-map-overview.js

@@ -223,8 +223,14 @@ function addMarkerClickListenerForLocation(m, l) {
 
 		if(l.test) {
 
+			content += '<hr />';
+
 			content += '<div class="small"><strong>Test ID:</strong> <a href="/account/tests/' + l.test.id + '" target="_blank">' + l.test.id + '</a></div>';
 
+			if(l.test.formattedStartDts) {
+				content += '<div class="small"><strong>Date/Time:</strong> ' + l.test.formattedStartDts + '</div>';
+			}
+
 			if(l.test.tester) {
 				content += '<div class="small"><strong>Tester ID:</strong> ' + l.test.tester.id + '</div>';
 				content += '<div class="small"><strong>Tester Name:</strong> <a href="/account/users/' + l.test.tester.id + '" target="_blank">' + l.test.tester.name + '</a></div>';
@@ -238,6 +244,7 @@ function addMarkerClickListenerForLocation(m, l) {
 			if(l.test.formattedDueDts) {
 				content += '<div class="small"><strong>Due:</strong> ' + l.test.formattedDueDts + ' ' + pastDueBadge + '</div>';
 			}
+
 		}