📊 Marketing Hub v4.0

Dashboard Overhaul + AMD Compliance — Complete Project Board

247
Total Tasks
8
Phases
0%
Complete
~30d
Estimate
🔄 Pipeline (247)
🔀 Flow
🎯 Vision
🏛 ADRs
❌ Gaps

🎨 Phase 0: Design (v0.dev prompts + review)

15 tasksNot Started

Dashboard Design

MH-001v0 prompt: Dashboard Main Layout (hero metrics, grid, health indicator)
MH-002v0 prompt: Budget Matrix Widget (Region × Fund, progress bars, emoji)
MH-003v0 prompt: Attention Required Widget (red card, expandable partner lists)
MH-004v0 prompt: Burn Rate Gauge + Claim Pipeline Funnel
MH-005v0 prompt: Deadline Tracker (countdown cards, urgency colors)
MH-006v0 prompt: Top Partners Chart + KPI Summary Cards
MH-007v0 prompt: Drill-down Modal/Sheet (table + filters)
MH-008v0 prompt: Approval Queue (list + quick approve buttons)
MH-009v0 prompt: Quarterly Comparison Chart + Trend
MH-010v0 prompt: Wave Management Form (Wave 1/2/Buffer)
MH-011v0 prompt: Bulk Actions UI (checkbox select + action bar)

Design Review

MH-012Review all v0 outputs, merge into project
MH-013Ensure AMD brand compliance (colors, fonts, dark theme)
MH-014Mobile responsive check for all components
MH-015Design sign-off from Timur

⚙️ Phase 1: Schema & Data Foundation

20 tasksNot Started

Migrations

MH-101Prisma migration: Wave fields (wave1Amount, wave2Amount, bufferAmount) on BudgetEntry + PartnerPlan
MH-102Prisma migration: Strategy enum (IMS_30, BREADTH_OF_CHANNEL, AWARENESS_SERVER, DEMAND_GEN, BRAND_AWARENESS, PARTNER_ENABLEMENT, LEAD_GEN)
MH-103Prisma migration: PartnerTier extend (+PANDISTRI, DISTRIBUTOR, VAR, REGISTERED)
MH-104Prisma migration: reservationPct (Float) + reservationDate on PartnerPlan
MH-105Prisma migration: PopActivityType model (id, code, name, category, popRequirements, isActive)
MH-106Prisma migration: planDeadline + claimDeadline (DateTime) on PartnerPlan
MH-107Prisma migration: MdfClaim → popActivityTypeId relation

Backend Updates

MH-108Update PartnerPlan DTO (add wave, strategy, deadlines, reservationPct)
MH-109Update BudgetEntry DTO (add wave fields)
MH-110Update MdfClaim DTO (add popActivityTypeId)
MH-111Create PopActivityType service + controller (CRUD)
MH-112Validation: wave1 + wave2 + buffer ≤ totalBudget
MH-113Validation: planDeadline must be in future at creation

Seed Data

MH-114Seed: 39 POP Activity Types from AMD guidelines
MH-115Seed: Strategy values in reference data
MH-116Seed: Demo data — plans with waves, deadlines, strategies for all 4 regions

Tests

MH-117Unit tests: wave validation
MH-118Unit tests: PopActivityType CRUD
MH-119Integration test: migration runs clean
MH-120QA Gate: existing 103 E2E tests still pass

🔌 Phase 2: Dashboard Backend APIs

28 tasksNot Started

Core Endpoints

MH-201GET /dashboard/summary — hero metrics (totalPlans, totalBudget, totalSpent, remaining, activePlans, partners, regions, activities count)
MH-202GET /dashboard/budget-status — {quarter, approved, declined, inReview, pending, total} × Q1-Q4
MH-203GET /dashboard/region-fund-matrix — [{region, funds: [{type, allocated, spent, remaining, utilPct, status}]}]
MH-204GET /dashboard/attention-required — {noPlans: [{partner, region}], inReview: [...], overdue: [...], noStatus: [...]}
MH-205GET /dashboard/burn-rate — {quarter, allocated, spent, remainingDays, totalDays, timePct, spentPct, status}
MH-206GET /dashboard/claim-pipeline — {pending: $, submitted: $, underReview: $, approved: $, reimbursed: $}
MH-207GET /dashboard/top-partners?limit=10 — [{partner, allocated, spent, remaining, activities, roi, leads}]
MH-208GET /dashboard/deadline-tracker — {overdue: [{partner, deadline, daysPast}], urgent: [...], soon: [...], ok: count, noDeadline: count}
MH-209GET /dashboard/quarterly-comparison — [{quarter, allocated, spent, remaining, plans, partners, utilPct}]
MH-210GET /dashboard/kpi-summary — {totalLeads, totalAttendees, totalImpressions, costPerLead, costPerAttendee, byQuarter: [...]}

Service Layer

MH-211DashboardService: summary aggregation (Prisma groupBy + count)
MH-212DashboardService: budget-status aggregation
MH-213DashboardService: region-fund matrix calculation
MH-214DashboardService: attention-required queries (4 separate queries)
MH-215DashboardService: burn-rate calculation (date math + aggregation)
MH-216DashboardService: claim pipeline aggregation
MH-217DashboardService: top partners ranking (sort by allocated desc)
MH-218DashboardService: deadline tracker (compare dates, group by urgency)
MH-219DashboardService: quarterly comparison
MH-220DashboardService: KPI summary from ActivityKpi

Caching & Performance

MH-221Redis cache: dashboard/* endpoints, TTL 5min
MH-222Cache invalidation: on plan/claim/budget create/update/approve
MH-223Performance test: all dashboard endpoints < 500ms

Tests

MH-224Unit tests: each dashboard service method
MH-225Integration tests: endpoints return correct structure
MH-226Test with empty data (no plans, no budgets)
MH-227Test role-based filtering (Manager sees only own region)
MH-228QA Gate: Postman collection for all dashboard endpoints

🖥️ Phase 3: Dashboard Frontend — Widgets

53 tasksNot Started

API Integration Layer

MH-301useDashboardSummary() hook (SWR/React Query)
MH-302useBudgetStatus() hook
MH-303useRegionFundMatrix() hook
MH-304useAttentionRequired() hook
MH-305useBurnRate() hook
MH-306useClaimPipeline() hook
MH-307useTopPartners() hook
MH-308useDeadlineTracker() hook
MH-309useQuarterlyComparison() hook
MH-310useKpiSummary() hook

Hero Section

MH-311HeroMetrics component (6 cards: Budget, Spent, Remaining, Plans, Activities, Approval Rate)
MH-312BudgetHealthIndicator component (🟢🟡🔴 overall status)
MH-313Hero animations (framer-motion enter, count-up numbers)
MH-314Hero loading skeleton

Row 1: Budget Overview

MH-315RegionFundMatrix component (table + progress bars + emoji utilization)
MH-316RegionFundMatrix: click row → drill-down modal
MH-317FundTypeDonut component (recharts, interactive, click → filter)
MH-318QuarterlyBudgetBars component (stacked bar, allocated vs spent)
MH-319Row 1 loading skeletons
MH-320Row 1 empty states

Row 2: Attention & Status

MH-321AttentionRequired component (card with expandable sections)
MH-322AttentionRequired: No Plan list (auto-updated)
MH-323AttentionRequired: In Review list
MH-324AttentionRequired: Overdue list
MH-325AttentionRequired: click partner → navigate to plan
MH-326ApprovalQueue component (list + approve/reject buttons)
MH-327ApprovalQueue: inline approve without page reload
MH-328DeadlineTracker component (cards with countdown, urgency colors)
MH-329DeadlineTracker: overdue red pulsing, urgent yellow
MH-330Row 2 loading skeletons

Row 3: Performance

MH-331BurnRateGauge component (circular gauge, spent% vs time%)
MH-332BurnRateGauge: trend arrow (accelerating / decelerating)
MH-333ClaimPipelineFunnel component (stages with $ amounts)
MH-334ClaimPipelineFunnel: click stage → drill-down
MH-335TopPartners component (horizontal bar chart)
MH-336TopPartners: click partner → partner detail page
MH-337Row 3 loading skeletons

Row 4: Analytics

MH-338KpiSummary component (Leads, Attendees, Impressions cards + Cost/Lead, Cost/Attendee)
MH-339QuarterlyComparison component (line/bar chart Q1→Q4)
MH-340ActivityTypeBreakdown component (treemap or horizontal bars)
MH-341Row 4 loading skeletons

Drill-down System

MH-342DrilldownSheet component (shadcn Sheet, reusable)
MH-343DrilldownSheet: table with sort + filter
MH-344DrilldownSheet: export to CSV
MH-345Region drill-down (click region → all partners in region)
MH-346Partner drill-down (click partner → all plans/activities)
MH-347Status drill-down (click "5 No Plan" → list of 5)
MH-348Deadline drill-down (click "3 Overdue" → list)

Dashboard Page Assembly

MH-349Dashboard page layout (responsive grid)
MH-350Dashboard mobile layout (stack vertically)
MH-351Dashboard error boundary (widget-level, not page-level)
MH-352Dashboard refresh mechanism (pull-to-refresh / auto-refresh)
MH-353QA Gate: all widgets render with real data

📝 Phase 4: Forms & Flow Improvements

31 tasksNot Started

Wave Management

MH-401WaveInputs component (Wave 1 / Wave 2 / Buffer with validation)
MH-402WaveInputs: auto-calc remaining from total
MH-403Wave display on Plan detail page (progress bars per wave)
MH-404Wave display on Budget page

Strategy

MH-405StrategySelector component (dropdown with descriptions)
MH-406Strategy on Plan creation wizard
MH-407Strategy filter on Plans list page

POP Activity Types

MH-408PopActivityTypeSelector component (grouped by category, with code)
MH-409PopActivityType on MDF Claim form
MH-410PoP requirements tooltip (what documents needed per type)
MH-411PopActivityType admin page (CRUD)

Deadlines

MH-412DeadlineInputs component (Plan Deadline + Claim Deadline pickers)
MH-413Deadline on Plan creation form
MH-414Deadline countdown on Plan detail page
MH-415Overdue visual indicator (red border/badge)

Reservation Status

MH-416ReservationProgress component (percentage bar + date)
MH-417Reservation input on Plan form
MH-418Reservation status on Plan detail page

Bulk Operations

MH-419BulkSelectBar component (sticky bottom bar with count + actions)
MH-420Checkbox column on Plans list
MH-421Bulk Approve API (POST /plans/bulk-approve)
MH-422Bulk Reject API (POST /plans/bulk-reject)
MH-423Bulk approve confirmation dialog
MH-424Success/error toast notifications

Multi-Quarter View

MH-425PartnerQuarterlyView component (Q1|Q2|Q3|Q4 side-by-side)
MH-426Partner page: show all quarters
MH-427Year total + trend arrow

Tests

MH-428E2E: wave management flow
MH-429E2E: bulk approve flow
MH-430E2E: deadline creation + overdue indicator
MH-431QA Gate: all new forms work end-to-end

🔔 Phase 5: Notifications & Export

27 tasksNot Started

Email Setup

MH-501SMTP configuration (via SSH tunnel through VPN)
MH-502Email service (NestJS Mailer module)
MH-503Email templates: HTML branded (AMD style)

Deadline Notifications

MH-504Cron job: check deadlines daily
MH-505Email: 7 days before deadline
MH-506Email: 3 days before deadline
MH-507Email: 1 day before deadline
MH-508Email: overdue notification
MH-509In-app notification for each email sent

Approval Notifications

MH-510Email: plan submitted (to Manager/Head)
MH-511Email: plan approved/rejected (to submitter)
MH-512Email: claim submitted (to reviewer)
MH-513Email: claim approved/rejected (to submitter)

Notification Center

MH-514NotificationBell component (badge count)
MH-515NotificationDropdown (list of recent)
MH-516Mark as read / mark all read
MH-517Notification preferences (per user, what to receive)

Export

MH-518PDF: quarterly report template (branded AMD)
MH-519PDF: Dashboard snapshot (metrics + charts as images)
MH-520PDF: Partner scorecard
MH-521Excel export: matching our Excel template structure
MH-522Excel export: Budget matrix tab
MH-523Export button on Dashboard + Analytics pages

Tests

MH-524Test: email sends correctly (dev SMTP)
MH-525Test: cron triggers notifications
MH-526Test: PDF generates without errors
MH-527QA Gate: notification flow end-to-end

✨ Phase 6: Polish & Deploy

23 tasksNot Started

Mobile

MH-601Dashboard: mobile layout (single column, swipeable cards)
MH-602Drill-down: bottom sheet on mobile
MH-603Approval Queue: swipe to approve/reject
MH-604Test on iPhone + Android

Loading & Error States

MH-605Skeleton loaders for every dashboard widget
MH-606Error boundary per widget (one fails, others work)
MH-607Empty states with illustrations
MH-608Retry buttons on error

Performance

MH-609Dashboard API: all endpoints < 500ms
MH-610Frontend: lazy load below-fold widgets
MH-611Images/charts: loading optimization
MH-612Lighthouse audit: > 90 performance score

Testing

MH-613Update existing 103 E2E tests (no regressions)
MH-614New E2E: dashboard widget loading
MH-615New E2E: drill-down flow
MH-616New E2E: bulk approve flow
MH-617New E2E: notification flow
MH-618Cross-browser testing (Chrome, Safari, Firefox)

Deploy

MH-619Build + deploy to prod (reports.teamone.dev)
MH-620Smoke test on prod
MH-621Demo session with Head of Marketing
MH-622User documentation / walkthrough guide
MH-623Handoff: training for regional managers

🏛️ Phase 7: AMD Compliance & Business Rules (from MOG/POP PDFs)

50 tasksNot Started

Reservation System

MH-701Prisma model: Reservation (id, reservationId, fundType, startDate, endDate, fundLifespan, status, partnerId, createdBy)
MH-702Reservation statuses enum: DRAFT, SUBMITTED, APPROVED, REJECTED, EDITED_PENDING, CANCELLED, EXPIRED
MH-703Reservation CRUD API + service
MH-704Business rule: Activity CANNOT start without APPROVED Reservation
MH-705Business rule: Activity dates MUST fall within Reservation start/end
MH-706Reservation expiry cron (auto-expire past end date)
MH-707Reservation ID generation (unique, trackable)
MH-708Reservation UI: create, edit, cancel flow
MH-709Reservation link to Activity Report + MDF Claim
MH-710Dashboard widget: Reservations status (active/expiring/expired)

Claim Validity & Timeline

MH-711Claim Validity Period calculation: 6 months after quarter end
MH-712Business rule: block claim submission after validity period
MH-713Warning: "X days left to submit claim" on Activity detail
MH-714Auto-reject cron: mark expired claims as REJECTED_LATE
MH-715Dashboard: claims approaching validity deadline

Invoice Validation

MH-716Invoice model fields: billTo, billFrom, invoiceDate, invoiceRef, itemizedDetails, currency, taxAmount, totalAmount, reservationId, vatNumber
MH-717Invoice validation checklist (11 required fields from MOG)
MH-718Invoice upload UI with field-by-field validation
MH-719Non-editable format check (PDF only, no pro-forma)
MH-720Invoice ↔ Reservation ID cross-reference validation

Country Exclusions

MH-721Seed: excluded countries list (Russia, Belarus, Cuba, Iran, North Korea, Syria, Crimea, Donetsk, Luhansk)
MH-722Business rule: block plan/activity creation for excluded countries
MH-723UI warning when selecting excluded country
MH-724Admin page: manage excluded countries list

Exchange Rate & Currency

MH-725Currency field on BudgetEntry, PartnerPlan, MdfClaim, Invoice
MH-726Exchange rate service: fetch rates (invoice date OR avg execution period)
MH-727Auto-convert to USD for dashboard aggregation
MH-728Exchange rate display on claim review page
MH-729Currency selector on forms (EUR, GBP, SEK, NOK, PLN, CZK, CHF, AED, SAR)

LOA (Letter of Authorization)

MH-730LOA model: id, partnerId, thirdPartyPayee, reason, approvalDate, documents
MH-731LOA upload + approval flow
MH-732Business rule: third-party payment requires approved LOA
MH-733LOA reference on Claim when payee ≠ partner

AMD Benefit & PoP Validation

MH-734PoP validation checklist per Activity Type (from POP PDF)
MH-735Checklist UI on claim review: "✅ AMD logo present" / "✅ URL visible" / "✅ Dates visible"
MH-736Reviewer must complete checklist before approving claim
MH-737Ineligible expenses reference list (travel, personal taxes, finance charges, cancelled events)
MH-738Warning when claim includes potentially ineligible expense

Payment Tracking

MH-739Payment status on Claim: PENDING → SCHEDULED → PAID → FAILED
MH-740Payment due date calculation (from verified claim receipt)
MH-741Payment tracking on Dashboard ($ pending payment, $ paid this quarter)
MH-742Payment confirmation upload (proof of payment)

Requested vs Allocated

MH-743requestedAmount field on PartnerPlan (Ivana's ask from screenshot)
MH-744Requested vs Allocated comparison on Plan detail
MH-745Dashboard: total requested vs total allocated gap

Tests

MH-746E2E: Reservation → Activity → Claim full flow
MH-747E2E: claim blocked without Reservation
MH-748E2E: claim blocked after validity period
MH-749E2E: excluded country blocked
MH-750QA Gate: all compliance rules enforced

Complete User Flow (AMD Compliant)

1

📋 Planning

Head of Marketing
  • Set budget per region × fund type
  • Set Quarterly Goals + deadlines
  • Set Wave 1/Wave 2 dates
2

📝 Partner Plans

Regional Managers
  • Create plans: partner, funding, tier, strategy
  • Set Wave 1/2/Buffer amounts
  • Submit → SUBMITTED
3

🎫 Reservations

System + Head
  • Generate Reservation ID per approved plan
  • Reservation MUST be approved BEFORE activity starts
  • Track fund lifespan, start/end dates
4

✅ Approval

Head of Marketing
  • Dashboard: 'X plans awaiting review'
  • Approve / Decline / Approved with changes
  • Bulk approve for routine plans
5

🎯 Execution

Employees
  • Activity Reports (mobile wizard)
  • KPIs: Leads, Attendees, Impressions
  • Upload PoP, record Actual Spent
6

📊 Monitoring

Head (real-time)
  • Burn Rate, KPI vs Goals, Deadlines
  • Attention Required: overdue, no plan
  • Drill-down: click metric → details
7

💳 Claims

All roles
  • MDF Claim → Invoice + PoP + POP Activity Type
  • 6-month validity period after quarter end
  • Invoice validation (11 fields), AMD Benefit check
8

💰 Payment

AMD Finance
  • Claim approved → Payment scheduled
  • Track: Pending → Scheduled → Paid
  • Exchange rate conversion (EUR/GBP/etc → USD)
9

📈 Analytics

Head
  • ROI per partner, Q-over-Q trends
  • Top/Bottom performers, Partner Scorecard
  • PDF export for C-level

👤 Users

  • Head of Marketing EMEA (1)
  • Regional Managers (4: CE, NUKI, SE, MEA)
  • Employees (~20-30, mobile-first)

💰 Budget

  • 4 Funds: ASPEN, Client MDF, MidMarket, Server MDF
  • 4 Regions × ~50 Partners
  • Waves: Wave 1 → Wave 2 → Buffer
  • Currencies: EUR, GBP, SEK, NOK, PLN, USD

🎫 Reservations (NEW)

  • Reservation ID before any activity
  • Fund lifespan tracking
  • Activity blocked without approved reservation
  • Auto-expire past end date

🎯 Dashboard = Command Center

  • 5-second status: 🟢🟡🔴
  • Click metric → drill-down modal
  • Interactive recharts
  • Reservation + Claim + Payment tracking

🏛️ AMD Compliance (NEW)

  • Country exclusions (RU, BY, CU, IR, NK, SY)
  • Claim validity: 6 months after Q end
  • Invoice validation (11 fields)
  • PoP checklist per activity type
  • Ineligible expenses warnings
  • LOA for third-party payments
  • Exchange rate conversion

📊 Key Metrics

  • Budget: Allocated vs Spent vs Remaining
  • Burn Rate: spent% vs time%
  • KPI: Leads, Attendees, Cost/Lead
  • Claims Pipeline + Payment Pipeline
  • Requested vs Allocated gap

Architecture Decisions

ADR-001: Separate API per widget

Parallel loading, independent cache

ADR-002: Drill-down via modals

No page navigation from Dashboard

ADR-003: Wave fields on BudgetEntry

Nullable, not separate table

ADR-004: POP Types as model

39 types + PoP requirements metadata

ADR-005: Strategy as enum

Fixed AMD set

ADR-006: Backend computes status colors

Logic in one place

ADR-007: Redis cache TTL 5min

Invalidate on write operations

ADR-008: Excel = backup, app = primary

Import module for migration

ADR-009: Outgoing tunnels only

mediascope → charley, no incoming

ADR-010: 103 E2E tests must pass

Don't break v3.1

ADR-011: Reservation as separate model

Not part of PartnerPlan — AMD requires trackable Reservation ID with own lifecycle

ADR-012: Claim validity enforced at DB level

CHECK constraint + cron, not just UI warning

ADR-013: Multi-currency with USD base

Store original currency + USD converted amount on every financial record

Gap Analysis (Updated with AMD Compliance)

🔧 Schema Gaps

  • Wave 1/2/Buffer — NOT in schema
  • Strategy field — NOT in schema
  • PartnerTier: +4 types missing
  • Reservation model — NOT in schema
  • POP Activity Types (39) — NOT in schema
  • Invoice validation fields — NOT in schema
  • Currency + exchange rate — NOT in schema
  • LOA model — NOT in schema
  • Country exclusions — NOT in schema
  • Payment status on Claim — NOT in schema
  • requestedAmount — NOT in schema

📊 Dashboard Gaps

  • Attention Required — MISSING
  • Burn Rate — MISSING
  • Claim Pipeline — MISSING
  • Payment Pipeline — MISSING (NEW)
  • Top Partners — MISSING
  • Deadline Tracker — MISSING
  • Reservation Tracker — MISSING (NEW)
  • Quarterly Comparison — MISSING
  • Drill-down modals — MISSING
  • Requested vs Allocated — MISSING (NEW)

🏛️ Compliance Gaps (NEW)

  • Reservation flow — MISSING
  • Claim validity (6 months) — MISSING
  • Invoice validation (11 fields) — MISSING
  • Country exclusions — MISSING
  • Exchange rate conversion — MISSING
  • LOA workflow — MISSING
  • PoP validation checklist — MISSING
  • Ineligible expenses warnings — MISSING
  • AMD Benefit check — MISSING

✅ Already Working

  • Auth + 4 roles + security
  • Activity Reports (wizard, KPI, files)
  • Budget + Partner Plans
  • MDF Claims + approval (basic)
  • Tasks, Templates, Goals
  • i18n EN+RU, Audit Log
  • 103/103 E2E tests ✓
  • Infrastructure: systemd, SSL ✓