# AdCenter Migration — Project Overview (Meeting Notes)

## Repositories + key paths
- **Target app (CI4):** `/var/www/php74/mason/adcenter.admedia.com/html`
- **Legacy reference:** `/var/www/php74/mason/advertisers7_new.admedia.com`
- **Design source:** `/var/www/php74/mason/adcenter.admedia.com/design`

## What’s been built so far (high-level)

### 1) Reusable UI components (built/extended)
These are reusable building blocks used by pages like Dashboard and the UI kit.

- **Form components**:
  - `html/app/Views/components/form/input.php`
  - `html/app/Views/components/form/select.php`
  - `html/app/Views/components/form/textarea.php`
  - `html/app/Views/components/form/checkbox.php`
- **Card components**:
  - `html/app/Views/components/card/card.php`
  - `html/app/Views/components/card/kpi.php`
- **Table component**:
  - `html/app/Views/components/table/table.php`
- **Dashboard-specific compositions** (still reusable within dashboard domain):
  - `html/app/Views/components/dashboard/filter_bar.php`
  - `html/app/Views/components/dashboard/announcement_item.php`
  - `html/app/Views/components/dashboard/insight_card.php`

### 2) Dashboard page (AP-2 epic) — UI structure mostly in place
- **Controller**:
  - `html/app/Controllers/Dashboard.php`
- **Page view + sections (composed, not monolithic)**:
  - `html/app/Views/dashboard/index.php`
  - `html/app/Views/dashboard/partials/announcements_section.php`
  - `html/app/Views/dashboard/partials/insights_section.php`
  - `html/app/Views/dashboard/partials/kpi_section.php`
  - `html/app/Views/dashboard/partials/chart_section.php`
  - `html/app/Views/dashboard/partials/table_section.php`
- **Drill-down placeholder view** (until Campaign Performance page is migrated):
  - `html/app/Views/dashboard/campaign_performance.php`

### 3) Dashboard backend plumbing (reusable services/utilities)
All shared logic lives in Services so controllers stay thin and view files stay markup-only.

- **Filter state + session persistence**:
  - `html/app/Services/Dashboard/DashboardFilters.php`
- **Reporting period (current vs previous equal-length window)**:
  - `html/app/Services/Dashboard/ReportingPeriod.php`
- **KPI registry/formatting (AP-63 stub interface point)**:
  - `html/app/Services/Dashboard/KpiRegistry.php`
- **KPI card presenter (controller → view data mapping)**:
  - `html/app/Services/Dashboard/DashboardKpiPresenter.php`
- **Chart presenter (build Chart.js config from real series)**:
  - `html/app/Services/Dashboard/DashboardChartPresenter.php`
- **Top campaigns table presenter** (currently blocked by missing campaign-level source table on this server):
  - `html/app/Services/Dashboard/DashboardTablePresenter.php`
- **Announcements source (stub; legacy equivalent not found yet)**:
  - `html/app/Services/Dashboard/AnnouncementCatalog.php`
- **Primary insights presenter + service (Ad Ops gated)**:
  - `html/app/Services/Dashboard/PrimaryInsightsPresenter.php`
  - `html/app/Services/Insights/PrimaryInsightsService.php`
- **Stats query service (real data)**:
  - `html/app/Services/Dashboard/StatsService.php`
    - Current server source uses **`Admin.account_daily_metrics`** (because `daily_budget_stats` is not present here).

### 4) Auth + session fields needed by dashboard
- **Login + session**:
  - `html/app/Controllers/Users.php`
  - Session now includes:
    - `adv_id` (currently set equal to `user_id`)
    - `is_ad_ops` (from `is_superuser`)

### 5) Layout + styling foundation
- **Main layout used by pages** (loads design CSS/JS bundles):
  - `html/app/Views/layouts/adcenter.php`
- **Chrome partials**:
  - `html/app/Views/partials/adcenter/sidebar.php`
  - `html/app/Views/partials/adcenter/topbar.php`
  - `html/app/Views/partials/adcenter/footer.php`

## Current status (talking points)
- **UI**: Dashboard page is structured and rendering with reusable components; needs continued work to match the design page’s layout/classes exactly.
- **Backend**:
  - **KPIs + chart**: integrated to real data via `StatsService` using `Admin.account_daily_metrics`.
  - **Top campaigns table**: blocked because the expected legacy table (`daily_budget_stats`) is not present on this server; we need the correct campaign-level stats source/table to finish AP-72 properly.
  - **Primary insights**: Ad Ops gated; trend-based insight logic is wired to available account metrics; campaign-level insight logic also depends on the missing campaign-level source.
- **Announcements**: still stubbed because no legacy source/store was found for “system announcements”.

## References / planning docs
- `migration/AP2_EXECUTION_PLAN.md`
- `migration/RULE.md`
- `migration/UI_STANDARDS.md`
- `migration/PATH_INFO.md`

