feat: AI assistant (HartBOT), demand filling, budget-per-role, project favorites, and UX improvements

AI Assistant (HartBOT):
- Chat panel with inline layout, session persistence, message history (up-arrow recall)
- OpenAI function calling with 20+ tools (search, navigate, create/cancel allocations, update status)
- RBAC-aware tool filtering, fuzzy search with word-level matching
- Navigation actions (router.push) and data invalidation after mutations
- Country/metro city/org unit/role filtering on resource search

Demand Filling Enhancements:
- Two-phase fill modal: plan multiple resources, then confirm & assign all at once
- Availability preview per resource (available/partial/conflict days, existing bookings)
- Coverage bar showing demand hours distribution across assigned resources
- Fill demand from project detail page (new Assign button per demand)
- Fixed: filled demands no longer shown on timeline, demand bars no longer overlap

Budget per Role:
- DemandRequirement.budgetCents field (schema + API + UI)
- Project wizard step 3: budget input per role with allocation summary bar
- Project detail: allocated vs booked budget per demand
- Fill demand modal: role budget display with cost estimates
- AllocationModal: budget field for demand editing

Project Favorites:
- User.favoriteProjectIds (JSONB) with toggle API
- Star button on projects list and detail page (optimistic updates)
- "My Projects" dashboard widget (favorites + responsible person projects)

Project Management:
- Edit project from detail page (ProjectModal integration)
- Edit demands from detail page (AllocationModal integration)
- Admin-only project deletion (cascades assignments + demands)
- Create user accounts from admin panel

Timeline Fixes:
- Country multi-select filter with backend support
- URL param sync for same-page navigation (AI assistant integration)
- Demand lane stacking (no more overlapping bars)
- Single-day booking resize handles (always visible, min 6px)
- Single-day resize allowed (start === end)
- "All Clients" toggle (select all / deselect all)

Other Fixes:
- crypto.randomUUID fallback for non-secure contexts
- Chat message limit raised (200 max, client sends last 40)
- Status dropdown portal (no longer clipped by table overflow)
- Cents display restored in budget views (2 decimal places)
- Allocations grouped view with project sub-groups (collapsed by default)
- Server-side resource search for project wizard (no 500 limit)

Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
2026-03-16 15:31:48 +01:00
parent f5551e33c7
commit b0e55786c3
44 changed files with 4516 additions and 609 deletions
@@ -11,6 +11,7 @@ export const CreateAllocationBaseSchema = z.object({
role: z.string().max(200).optional(),
roleId: z.string().optional(),
headcount: z.number().int().min(1).default(1),
budgetCents: z.number().int().min(0).optional(),
status: z.nativeEnum(AllocationStatus).default(AllocationStatus.PROPOSED),
metadata: z.record(z.string(), z.unknown()).default({}),
});
@@ -24,6 +25,7 @@ export const CreateDemandRequirementBaseSchema = z.object({
role: z.string().max(200).optional(),
roleId: z.string().optional(),
headcount: z.number().int().min(1).default(1),
budgetCents: z.number().int().min(0).optional(),
status: z.nativeEnum(AllocationStatus).default(AllocationStatus.PROPOSED),
metadata: z.record(z.string(), z.unknown()).default({}),
});
@@ -63,6 +63,11 @@ const chargeabilityWidgetConfigSchema = z.object({
watchlistThreshold: z.number().int().min(0).max(100).optional(),
});
const myProjectsWidgetConfigSchema = z.object({
showFavorites: z.boolean().optional(),
showResponsible: z.boolean().optional(),
});
export const dashboardWidgetConfigSchemas = {
"stat-cards": z.object({}),
"resource-table": resourceTableWidgetConfigSchema,
@@ -71,6 +76,7 @@ export const dashboardWidgetConfigSchemas = {
"demand-view": demandWidgetConfigSchema,
"top-value-resources": topValueWidgetConfigSchema,
"chargeability-overview": chargeabilityWidgetConfigSchema,
"my-projects": myProjectsWidgetConfigSchema,
} as const;
type DashboardWidgetConfigSchemaMap = typeof dashboardWidgetConfigSchemas;
+1
View File
@@ -85,6 +85,7 @@ export interface DemandRequirementRecord {
role: string | null;
roleId: string | null;
headcount: number;
budgetCents: number;
status: AllocationStatus;
metadata: DemandRequirementMetadata;
createdAt: Date;
+19
View File
@@ -37,6 +37,11 @@ export interface ChargeabilityOverviewWidgetConfig {
watchlistThreshold?: number;
}
export interface MyProjectsWidgetConfig {
showFavorites?: boolean;
showResponsible?: boolean;
}
export interface DashboardWidgetConfigMap {
"stat-cards": StatCardsWidgetConfig;
"resource-table": ResourceTableWidgetConfig;
@@ -45,6 +50,7 @@ export interface DashboardWidgetConfigMap {
"demand-view": DemandWidgetConfig;
"top-value-resources": TopValueResourcesWidgetConfig;
"chargeability-overview": ChargeabilityOverviewWidgetConfig;
"my-projects": MyProjectsWidgetConfig;
}
export const DASHBOARD_WIDGET_TYPES = [
@@ -55,6 +61,7 @@ export const DASHBOARD_WIDGET_TYPES = [
"demand-view",
"top-value-resources",
"chargeability-overview",
"my-projects",
] as const;
export type DashboardWidgetType = (typeof DASHBOARD_WIDGET_TYPES)[number];
@@ -163,4 +170,16 @@ export const DASHBOARD_WIDGET_CATALOG = [
watchlistThreshold: 15,
},
},
{
type: "my-projects",
label: "My Projects",
description: "Quick access to your favorite and responsible projects",
icon: "⭐",
defaultSize: { w: 6, h: 6 },
minSize: { w: 4, h: 3 },
defaultConfig: {
showFavorites: true,
showResponsible: true,
},
},
] as const satisfies readonly DashboardWidgetCatalogEntry[];
+1
View File
@@ -8,6 +8,7 @@ export interface StaffingRequirement {
preferredSkills?: string[];
hoursPerDay: number;
headcount: number;
budgetCents?: number;
startDate?: string;
endDate?: string;
notes?: string;