Files
CapaKraken/packages/shared/src/constants/columns.ts
T
Hartmut 92a982b151 feat: Nearshore-Ratio indicator per project
Engine (packages/engine):
- calculateShoringRatio() pure function: onshore/offshore hours,
  country breakdown, threshold check, weighted by hours not headcount
- 12 unit tests: empty, 100% onshore/offshore, mixed ratios,
  custom threshold, case-insensitive, unknown country, FTE weighting

Schema:
- Project.shoringThreshold (default 55%) — per-project configurable
- Project.onshoreCountryCode (default "DE") — configurable onshore country

API (project router):
- getShoringRatio query: loads assignments with resource.country,
  computes ratio, returns full breakdown
- update mutation: accepts shoringThreshold + onshoreCountryCode

UI:
- ShoringIndicator: stacked horizontal bar with country segments,
  severity badge (green/yellow/red), hover tooltip, dark theme
- ShoringBadge: mini colored dot + % for project list column
- ProjectModal: "Max Offshore %" number input
- Project detail: indicator after budget status card
- Project list: "Shoring" column (default hidden, toggleable)

AI Assistant:
- get_shoring_ratio tool: human-readable breakdown with threshold alert

Colors: green (<threshold-10), yellow (threshold-10 to threshold), red (>=threshold)
Default: 55% offshore threshold, "DE" as onshore country

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-03-26 11:45:50 +01:00

37 lines
2.5 KiB
TypeScript

import type { ColumnDef } from "../types/columns.js";
export const RESOURCE_COLUMNS: ColumnDef[] = [
{ key: "displayName", label: "Name", defaultVisible: true, hideable: false },
{ key: "eid", label: "EID", defaultVisible: true, hideable: true },
{ key: "chapter", label: "Chapter", defaultVisible: true, hideable: true },
{ key: "roles", label: "Roles", defaultVisible: true, hideable: true },
{ key: "chargeability", label: "Chargeability", defaultVisible: true, hideable: true, sortable: true },
{ key: "lcr", label: "LCR", defaultVisible: false, hideable: true },
{ key: "valueScore", label: "Score", defaultVisible: false, hideable: true },
{ key: "rolledOff", label: "Rolled Off", defaultVisible: false, hideable: true },
{ key: "departed", label: "Departed", defaultVisible: false, hideable: true },
{ key: "isActive", label: "Status", defaultVisible: true, hideable: true },
];
export const PROJECT_COLUMNS: ColumnDef[] = [
{ key: "shortCode", label: "Code", defaultVisible: true, hideable: false },
{ key: "name", label: "Name", defaultVisible: true, hideable: false },
{ key: "status", label: "Status", defaultVisible: true, hideable: true },
{ key: "orderType", label: "Type", defaultVisible: true, hideable: true },
{ key: "dates", label: "Dates", defaultVisible: true, hideable: true },
{ key: "budget", label: "Budget", defaultVisible: false, hideable: true },
{ key: "allocations", label: "Allocations", defaultVisible: true, hideable: true },
{ key: "shoring", label: "Shoring", defaultVisible: false, hideable: true },
{ key: "responsible", label: "Responsible", defaultVisible: false, hideable: true },
];
export const ALLOCATION_COLUMNS: ColumnDef[] = [
{ key: "resource", label: "Resource", defaultVisible: true, hideable: false },
{ key: "project", label: "Project", defaultVisible: true, hideable: false },
{ key: "dates", label: "Dates", defaultVisible: true, hideable: true },
{ key: "hoursPerDay", label: "h/day", defaultVisible: true, hideable: true },
{ key: "status", label: "Status", defaultVisible: true, hideable: true },
{ key: "cost", label: "Daily Cost", defaultVisible: false, hideable: true },
{ key: "role", label: "Role", defaultVisible: true, hideable: true },
];