diff --git a/html/template/sync/communication-root.html b/html/template/sync/communication-root.html index 912013db..0dffd2ce 100644 --- a/html/template/sync/communication-root.html +++ b/html/template/sync/communication-root.html @@ -26,6 +26,24 @@ } return a.number + " " + a.street + ", " + a.locality; } + function formatDistance(meters) { + if (meters == undefined || meters == null) { + return "unknown"; + } + if (meters < 1) { + // Convert to millimeters + const mm = Math.round(meters * 1000); + return `${mm} mm`; + } else if (meters >= 1000) { + // Convert to kilometers + const km = Math.round(meters / 1000); + return `${km} km`; + } else { + // Keep in meters + const m = Math.round(meters); + return `${m} m`; + } + } function communicationsApp() { return { apiBase: "/api", @@ -72,7 +90,7 @@ "https://via.placeholder.com/400x300/cccccc/666666?text=Photo+1", "https://via.placeholder.com/400x300/cccccc/666666?text=Photo+2", ], - activityLog: [ + history: [ { action: "Report created", timestamp: new Date(Date.now() - 2 * 60 * 60 * 1000), @@ -176,10 +194,10 @@ ); // Add to activity log - if (!this.selectedCommunication.activityLog) { - this.selectedCommunication.activityLog = []; + if (!this.selectedCommunication.history) { + this.selectedCommunication.history = []; } - this.selectedCommunication.activityLog.push({ + this.selectedCommunication.history.push({ action: "Lead created", timestamp: new Date(), }); @@ -229,10 +247,10 @@ console.log("Message:", this.messageText); // Add to activity log - if (!this.selectedCommunication.activityLog) { - this.selectedCommunication.activityLog = []; + if (!this.selectedCommunication.history) { + this.selectedCommunication.history = []; } - this.selectedCommunication.activityLog.push({ + this.selectedCommunication.history.push({ action: "Message sent to reporter", timestamp: new Date(), }); @@ -824,7 +842,7 @@
Activity Log
@@ -904,7 +922,7 @@ >Distance from Reporter