Fix display of report ID and status on the by-id page.

This commit is contained in:
Eli Ribble 2026-04-09 13:48:48 +00:00
parent 882636de8f
commit cb9e5146bf
No known key found for this signature in database
2 changed files with 14 additions and 5 deletions

View file

@ -54,6 +54,12 @@ export function formatRelativeTime(dateString: string): string {
if (diffHours < 24) return `${diffHours} hour${diffHours > 1 ? "s" : ""} ago`;
return `${diffDays} day${diffDays > 1 ? "s" : ""} ago`;
}
export function formatReportID(id: string): string {
if (id.length === 12) {
return `${id.substring(0, 4)}-${id.substring(4, 8)}-${id.substring(8)}`;
}
return id;
}
export function formatTimeRelative(t: Date): string {
const now = new Date();
const diffMs = now.getTime() - t.getTime();

View file

@ -1,4 +1,7 @@
<style scoped>
.capitalized {
text-transform: capitalize;
}
.map-container {
border-radius: 10px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
@ -50,8 +53,8 @@
<div
class="card-header bg-primary text-white d-flex justify-content-between align-items-center"
>
<h5 class="mb-0">Report {{ id }}</h5>
<span class="badge bg-warning text-dark status-badge">
<h5 class="mb-0">Report {{ formatReportID(id) }}</h5>
<span class="badge bg-warning capitalized status-badge text-dark">
{{ report.status }}
</span>
</div>
@ -59,7 +62,7 @@
<div class="row">
<div class="col-md-4 mb-3">
<strong><i class="bi bi-tag me-2"></i>Type:</strong>
<span>{{ report.type }}</span>
<span class="capitalized">{{ report.type }}</span>
</div>
<div class="col-md-4 mb-3">
<strong><i class="bi bi-calendar me-2"></i>Created:</strong>
@ -127,7 +130,7 @@
<div class="timeline-date">
{{ formatTimeRelative(item.created) }}
</div>
<h5 class="mb-1">{{ item.type }}</h5>
<h5 class="capitalized mb-1">{{ item.type }}</h5>
<p class="mb-0">{{ item.message }}</p>
</div>
</div>
@ -149,7 +152,7 @@ import { useStoreDistrict } from "@/rmo/store/district";
import { useStorePublicReport } from "@/store/publicreport";
import type { Marker } from "@/types";
import type { District, PublicReport } from "@/type/api";
import { formatTimeRelative } from "@/format";
import { formatReportID, formatTimeRelative } from "@/format";
// Props
interface Props {