Commit graph

7 commits

Author SHA1 Message Date
Vadym Samoilenko
6c93915768 Add custom CSV export template (per-client, per-user, global)
- Backend: export template system with priority chain:
  client template > user template > global template > built-in default
- New /api/export/template endpoints for any logged-in user (GET/POST/DELETE)
- Admin endpoints for global and per-client export templates
- detect_csv_template() auto-maps CSV headers to internal fields
- Frontend: ExportTemplateEditor component (upload CSV → map columns → save)
- AdminClientsPage: export template section per client card
- SheetPage: ⚙ button next to "Export CSV" opens inline template editor

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-23 19:29:22 +00:00
Vadym Samoilenko
eaa518b443 Fix emergency token being rejected by axios interceptor
Non-JWT tokens (like emergency access tokens) were treated as expired
by isTokenExpired(), triggering a MSAL silent refresh that fails and
clears the token. Fix: non-JWT tokens are treated as never-expired and
skip the 401-retry refresh path.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-23 19:14:31 +00:00
Vadym Samoilenko
8882286146 Fix voice recording and add Excel column mapping verification
- Voice: switch CommandBar from PTT (hold) to toggle mode (click), update
  to use new useSpeechRecognition toggle/listening API with auto-restart
- Mapping detection: new detect_excel_mapping() reads row 1 headers and
  auto-detects name/status/media columns via keyword matching
- Mapping endpoints: POST /api/admin/dropdowns/detect-mapping and
  /api/admin/clients/{id}/dropdowns/detect-mapping
- Upload/preview now accept name_col/status_col/media_col form fields to
  apply a confirmed mapping override
- Frontend: ColumnMappingStep component shows detected columns + 5-row
  sample for confirmation before upload
- AdminDropdownsPage and AdminClientsPage use 3-stage flow:
  detect → confirm mapping → preview all → apply

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-23 19:05:26 +00:00
Vadym Samoilenko
1b051f4d0d Add per-client category hierarchy, client management, and admin hardcoding
Backend:
- New /api/clients CRUD (create, list, delete, rename)
- dropdowns.py: _load_dropdowns(client_id) — per-client file first, global fallback
- admin.py: per-client dropdown upload/preview/delete endpoints
- ai_command.py: reads sheet's client_id, builds hierarchy from client-specific file
- sheets/manager.py: client_id stored in sheet metadata; get/set_sheet_client_id helpers
- sheets.py: create sheet accepts client_id; PATCH /{id}/client endpoint
- config_runtime.py: CLIENTS_FILE, CLIENTS_DROPDOWNS_DIR, ADMIN_EMAILS list
- user_store.py: bootstrap admin from ADMIN_EMAILS (daveporter + vadymsamoilenko)

Frontend:
- New Client type; SheetMeta gains client_id
- api/clients.ts, stores/useClientStore.ts — client CRUD
- useDropdownStore: re-fetches when client changes (no stale cache)
- SheetPage: client selector in header; fetches per-client categories
- BriefUploadPage: client selector before upload
- AdminClientsPage: create/delete clients, upload per-client .xlsx, preview before apply
- Sidebar: separate admin nav links (Users / Clients / Dropdowns)
- App.tsx: /admin/clients route

Data:
- 4 clients pre-seeded (Adidas, USTUDIO, 3M Colab, Bissell) with custom hierarchy files

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-23 18:56:01 +00:00
Vadym Samoilenko
fb26d9ab56 Fix Azure AD token expiry — auto-refresh before every request
- registerTokenRefresher() lets AuthGate inject acquireTokenSilent into axios
- Request interceptor checks JWT exp, proactively refreshes if within 60s of expiry
- Response interceptor retries on 401 with a fresh token, reloads on double failure
- Previously the idToken was cached once in sessionStorage and never refreshed,
  causing all requests to fail after 1 hour with "Token expired"

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-23 16:44:02 +00:00
Vadym Samoilenko
f85d6a6b51 fix: repair brief upload and real-time job progress
Three bugs fixed:

1. api/jobs.ts: remove manual Content-Type header on FormData upload.
   Setting it without the multipart boundary caused Quart to reject the
   request body — the root cause of brief upload failures.

2. progress.py: include full job.to_dict() in job.progress / job.completed
   / job.failed WebSocket messages. Frontend checks msg.job to call
   updateJob() — without it, job cards never updated in real-time.

3. AppShell: move useWebSocket() here from BriefUploadPage so the WS
   connection persists across all pages, not just the upload page.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-23 15:05:23 +00:00
Vadym Samoilenko
72c50b2c92 Initial commit — AC Tool unified application
Merges ac-helper (PHP Activation Calendar) and brief-extractor (Python AI)
into a single Docker app with React/TypeScript frontend.

Features:
- Brief upload → AI extraction → review → Activation Calendar import
- Handsontable v17 spreadsheet with dependent dropdowns (148 categories)
- AI natural language commands via Gemini (YOLO mode, voice input)
- Azure AD MSAL SPA PKCE authentication, user roles (user/admin)
- CSV Activation Calendar export
- Real-time WebSocket job progress
- Admin: user management, dropdown Excel upload
- Multi-stage Dockerfile, docker-compose, nginx proxy instructions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-23 13:24:46 +00:00