# Promo Calendar

Standalone Streamlit app — unified view of all promotions across B2C MP,
B2C WEB, B2B FMCG, B2B FITNESS sources, with conflict detection,
Gantt timeline, source-coverage heatmap, status tracking and Excel
import / export.

## Pages

1. **📊 Calendar dashboard** — KPIs (total / active / SKUs / conflicts /
   units), conflict cards (multi-source overlaps on same SKU), Plotly
   Gantt timeline with NOW marker, all-promos table, status update /
   delete, source-coverage heatmap.

2. **➕ Quick-add** — single-form entry for a new promotion (name,
   source, type, outcome, status, SKU list, week range, category,
   owner, units, notes).

3. **📥 Import / Export** — Excel import with smart column detection
   (`name`, `source`, `start_week`, `end_week`, `skus`, etc. with HR/EN
   aliases), CSV + Excel export of the full calendar, wipe-all reset.

## Install

```bash
pip install -r requirements.txt
```

Python 3.12 recommended.

## Run

Windows: double-click `Start_PromoCalendar.bat` (or `.cmd` if `.bat` is
blocked). The tool opens at **http://localhost:8503** so it can run
side-by-side with the main demand tool (8501) and Promo Tool (8502).

Mac / Linux:
```bash
python -m streamlit run app.py --server.port 8503
```

## Storage

Single CSV: `promocalendar/data/promo_calendar.csv` with columns:
`id, name, source, type, outcome, status, start_year, start_week,
end_year, end_week, skus, units, category, owner, notes, created_at,
updated_at`.

## Sources / statuses / outcomes

- **Sources**: B2C — MP (retail), B2C — WEB, B2B — FMCG, B2B — FITNESS
- **Statuses**: 💡 idea → ✅ approved → 🔧 preparing → 🟢 live → ✓ done → 📊 analyzed
- **Outcomes**: 📦 Rješavanje lagera, 💰 Veći RUC, 👥 Novi kupci, 🚀 Traffic driver
- **Types**: Univerzalna, Kampanja, Wholesale, Web, Loyalty, Rok istek,
  Partner / Passport, Otvaranje, Dani centra, VISA

## Conflict detection rule

Two promotions are flagged as a conflict when they:
1. Share at least one SKU,
2. Have overlapping calendar weeks,
3. Come from **different sources**.

Same-source overlapping promotions on the same SKU are not flagged
(they're a single source's choice).
