Fix display of report ID and status on the by-id page.
This commit is contained in:
parent
882636de8f
commit
cb9e5146bf
2 changed files with 14 additions and 5 deletions
|
|
@ -54,6 +54,12 @@ export function formatRelativeTime(dateString: string): string {
|
||||||
if (diffHours < 24) return `${diffHours} hour${diffHours > 1 ? "s" : ""} ago`;
|
if (diffHours < 24) return `${diffHours} hour${diffHours > 1 ? "s" : ""} ago`;
|
||||||
return `${diffDays} day${diffDays > 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 {
|
export function formatTimeRelative(t: Date): string {
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const diffMs = now.getTime() - t.getTime();
|
const diffMs = now.getTime() - t.getTime();
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,7 @@
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
.capitalized {
|
||||||
|
text-transform: capitalize;
|
||||||
|
}
|
||||||
.map-container {
|
.map-container {
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
|
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
|
||||||
|
|
@ -50,8 +53,8 @@
|
||||||
<div
|
<div
|
||||||
class="card-header bg-primary text-white d-flex justify-content-between align-items-center"
|
class="card-header bg-primary text-white d-flex justify-content-between align-items-center"
|
||||||
>
|
>
|
||||||
<h5 class="mb-0">Report {{ id }}</h5>
|
<h5 class="mb-0">Report {{ formatReportID(id) }}</h5>
|
||||||
<span class="badge bg-warning text-dark status-badge">
|
<span class="badge bg-warning capitalized status-badge text-dark">
|
||||||
{{ report.status }}
|
{{ report.status }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -59,7 +62,7 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4 mb-3">
|
<div class="col-md-4 mb-3">
|
||||||
<strong><i class="bi bi-tag me-2"></i>Type:</strong>
|
<strong><i class="bi bi-tag me-2"></i>Type:</strong>
|
||||||
<span>{{ report.type }}</span>
|
<span class="capitalized">{{ report.type }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4 mb-3">
|
<div class="col-md-4 mb-3">
|
||||||
<strong><i class="bi bi-calendar me-2"></i>Created:</strong>
|
<strong><i class="bi bi-calendar me-2"></i>Created:</strong>
|
||||||
|
|
@ -127,7 +130,7 @@
|
||||||
<div class="timeline-date">
|
<div class="timeline-date">
|
||||||
{{ formatTimeRelative(item.created) }}
|
{{ formatTimeRelative(item.created) }}
|
||||||
</div>
|
</div>
|
||||||
<h5 class="mb-1">{{ item.type }}</h5>
|
<h5 class="capitalized mb-1">{{ item.type }}</h5>
|
||||||
<p class="mb-0">{{ item.message }}</p>
|
<p class="mb-0">{{ item.message }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -149,7 +152,7 @@ import { useStoreDistrict } from "@/rmo/store/district";
|
||||||
import { useStorePublicReport } from "@/store/publicreport";
|
import { useStorePublicReport } from "@/store/publicreport";
|
||||||
import type { Marker } from "@/types";
|
import type { Marker } from "@/types";
|
||||||
import type { District, PublicReport } from "@/type/api";
|
import type { District, PublicReport } from "@/type/api";
|
||||||
import { formatTimeRelative } from "@/format";
|
import { formatReportID, formatTimeRelative } from "@/format";
|
||||||
|
|
||||||
// Props
|
// Props
|
||||||
interface Props {
|
interface Props {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue