mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-02 23:53:21 +00:00
46 lines
1.7 KiB
TypeScript
46 lines
1.7 KiB
TypeScript
import {
|
|
OPEN_WIZARD_STATUSES,
|
|
workOrderDrilldownUrl,
|
|
} from "@/domain/dashboard/utils/work-order-drilldown-links";
|
|
import type { NotificationItem } from "@/domain/notifications/types/notification-feed";
|
|
import { ASSIGNEE_FILTER_UNASSIGNED } from "@/domain/work-orders/types/work-order-list";
|
|
import {
|
|
UNASSIGNED_QUEUE_DATE_FROM,
|
|
UNASSIGNED_QUEUE_DATE_TO,
|
|
} from "@/domain/work-orders/utils/board-query-params";
|
|
import { workOrderDeepLinkUrl } from "@/domain/work-orders/utils/work-order-deep-link";
|
|
|
|
/** Every open, unassigned work order in any week, through the existing Work Orders filter params. */
|
|
export function unassignedQueueUrl(): string {
|
|
const search = new URLSearchParams();
|
|
search.set("dateFrom", UNASSIGNED_QUEUE_DATE_FROM);
|
|
search.set("dateTo", UNASSIGNED_QUEUE_DATE_TO);
|
|
search.set("dispatchers", ASSIGNEE_FILTER_UNASSIGNED);
|
|
search.set("statuses", OPEN_WIZARD_STATUSES.join(","));
|
|
return workOrderDrilldownUrl(search, "notification");
|
|
}
|
|
|
|
/** The work order form with vendor assignment open — where the vendor reminders always sent "Choose vendor". */
|
|
export function chooseVendorUrl(workOrderId: number): string {
|
|
return `/workorders/edit/${workOrderId}?assignVendor=1`;
|
|
}
|
|
|
|
export function workOrderViewUrl(workOrderId: number): string {
|
|
return `/workorders/${workOrderId}`;
|
|
}
|
|
|
|
export function notificationTargetUrl(
|
|
item: Pick<NotificationItem, "reason" | "target">,
|
|
): string | null {
|
|
const { target } = item;
|
|
if (target.kind === "queue") {
|
|
return target.queue === "unassigned" ? unassignedQueueUrl() : null;
|
|
}
|
|
if (target.workOrderId == null) {
|
|
return null;
|
|
}
|
|
if (item.reason === "no-vendor") {
|
|
return chooseVendorUrl(target.workOrderId);
|
|
}
|
|
return workOrderDeepLinkUrl(target.workOrderId, target.tab);
|
|
}
|