shoc-frontend-new/src/domain/work-orders/utils/service-notes-ui.ts
Arthur Bassi 7a30335ab8 feat(work-orders): add per-WO Aveta indicators and advanced filter
Dispatchers can flag Aveta on Service and Notes and filter those rows
without a site-level attribute.
2026-08-24 15:16:51 -03:00

19 lines
629 B
TypeScript

/** Design: cell shows Service & Notes layout when note, extras, or Aveta exist. */
export function hasServiceNotesDetails(
serviceNotes?: string | null,
extraServices?: string[] | null,
avetaRequired?: boolean | null,
): boolean {
return (
Boolean(serviceNotes?.trim()) || (extraServices?.length ?? 0) > 0 || Boolean(avetaRequired)
);
}
/** Truncate note for the board cell subtitle (~30 chars, design). */
export function truncateServiceNotesPreview(note: string, max = 30): string {
const trimmed = note.trim();
if (trimmed.length <= max) {
return trimmed;
}
return `${trimmed.slice(0, max)}…`;
}