mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-06 00:42:04 +00:00
Dispatchers need reschedule and carried-over counts after one event. Advanced filters and the detail header stay at two or more.
16 lines
672 B
TypeScript
16 lines
672 B
TypeScript
import { fmtDate } from "@/domain/work-orders/utils/wizard-date-utils";
|
|
|
|
export function formatRescheduleCountLabel(count: number): string {
|
|
return count === 1 ? "1 time" : `${count} times`;
|
|
}
|
|
|
|
/** Hover copy for the Reschedule pill (count ≥ 1). Uses originalDate when the API sends it. */
|
|
export function formatRescheduleHover(count: number, originalDate?: string): string {
|
|
const times = formatRescheduleCountLabel(count);
|
|
const base = `Rescheduled ${times} — this WO has had its date changed ${times}.`;
|
|
const formatted = originalDate ? fmtDate(originalDate) : "";
|
|
if (!formatted) {
|
|
return base;
|
|
}
|
|
return `${base} Original date: ${formatted}.`;
|
|
}
|