Commit Graph
232 Commits
Author SHA1 Message Date
Michael aa02d019bd feat: Implement AI Copilot for product analysis and add comprehensive product grid data fetching. 2026-03-18 21:25:53 +01:00
Michael cefe6060d0 feat: implement virtualized heatmap grid component using TanStack Table and Virtual for product data display. 2026-03-18 20:52:13 +01:00
Michael aa77025d14 feat: introduce virtualized heatmap grid component with client-side filtering, sorting, and optimized Zustand state management. 2026-03-18 20:49:57 +01:00
Michael 9aca3b8ead feat: Add virtualized heatmap grid component with dynamic columns, filtering, and row selection. 2026-03-18 20:34:23 +01:00
Michael 8bd7ae8c45 feat: implement server action to fetch and process product rows with sales, stock, and classification data. 2026-03-18 20:08:15 +01:00
Michael c303427dd0 feat: implement a centralized HTTP client for the FF Nancy REST API, including data types, pagination, and functions for suppliers, articles, and movements. 2026-03-18 20:00:45 +01:00
Michael ab603e3a6f feat: Add a diagnostic API route and implement server-side logic for fetching and scoring product grid data. 2026-03-18 19:54:44 +01:00
Michael d616da8b91 feat: Introduce getProductRows API and related types for fetching and processing comprehensive product data, incorporating sales, stock, and classification. 2026-03-18 19:31:16 +01:00
MichaelandClaude Sonnet 4.6 8986f7d001 feat: integrate /referentiel endpoint for nomenclature, gamme, stock, PA
Replaces ventesProduits DB query with API call to /articles/:no_id/referentiel.
Called in parallel with mensuel and commandes.

Extracts:
- article.nom_code/nom_libelle → code3/libelle3 (nomenclature)
- gammes[0].gamme_code → codeGamme + codeGammeInit (frozen initial)
- prix.achat + fournisseurs[0].pcb → pa/prixAchat/pcb
- stock[] → stockActuel/stockTotal/stockValeur (real-time)
- performance.derniere_vente/derniere_entree → derniereVente/derniereLivraison

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 19:26:47 +01:00
MichaelandClaude Sonnet 4.6 ca467c73f6 chore: probe /api/articles/:no_id/referentiel in diag
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 19:24:09 +01:00
MichaelandClaude Sonnet 4.6 06e1b1a238 chore: add ventesProduits diagnostic to diag endpoint
Shows row counts, gamme/code3 fill rates, and sample rows
for AUXENCE/A025 to diagnose missing classification data.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 19:17:22 +01:00
MichaelandClaude Sonnet 4.6 84aa84cf41 fix: use Drizzle inArray() for ventesProduits classification query
Replaces raw sql ANY() template (which had array type issues) with
proper Drizzle inArray(), deduplicating by codein in JS.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 19:15:24 +01:00
MichaelandClaude Sonnet 4.6 09be89b557 fix: query ventesProduits by codein array instead of code_fournisseur
The old fournisseur code stored in ventesProduits may differ from the
new API codefou (e.g. "AUXENCE" vs "A025"), causing zero results.
Querying by codein = ANY(...) finds the classification data regardless
of how the supplier was previously keyed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 19:05:58 +01:00
Michael 518838c01e feat: introduce getProductRows API to fetch, process, and score product data from multiple sources. 2026-03-18 18:11:08 +01:00
MichaelandClaude Sonnet 4.6 47e617afd3 feat: restore reference, gtin, gamme initiale and nomenclature
api-ff-client.ts:
- FfArticle: add reference (ref_fou_principale) and gtin fields
- getArticlesByFournisseur: map ref_fou_principale → reference, gtin → gtin

get-product-rows.ts:
- ProductRow seeded with reference and gtin from API articles
- Phase 6: read codeGamme, codeGammeInit, code3, libelle3 from ventesProduits
  (read-only, DISTINCT ON codein ordered by updated_at DESC)
- Phase 7 snapshot still overrides DB gammes when a snapshot exists

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 18:08:21 +01:00
MichaelandClaude Sonnet 4.6 58f17152a1 feat: switch to /articles/:no_id/mensuel endpoint for sales & stock data
Replaces bulk mouvements pagination + per-article stock N+1 with a single
batched call to the new mensuel endpoint (confirmed working via diag).

api-ff-client.ts:
- Remove getStockByFournisseur (no longer needed)
- Add FfMensuelEntry/Ventes/Receptions interfaces
- Add getMensuelByArticles(articles, dateDebut, dateFin, batchSize=20)
  → Map<codein, FfMensuelEntry[]> using no_id as API identifier

get-product-rows.ts:
- Phase 2: getMensuelByArticles + getCommandesByFournisseur in parallel
- Phase 5: aggregate mois×site entries → sales12m, stock12m, workingStores
  - qte_vendue / ca_ht are negative → Math.abs()
  - stock carry-forward for months with no data
  - pa from prmp_fin_mois

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 18:00:55 +01:00
MichaelandClaude Sonnet 4.6 2d37a134d4 chore: update diag to probe new mensuel, stock/periode, and mouvements/types endpoints
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 16:44:01 +01:00
Michael 8aac493a97 feat: Add Claude settings to allow Bash git push operations. 2026-03-18 16:37:16 +01:00
MichaelandClaude Sonnet 4.6 5c40a615c7 fix: correct API field names for articles and mouvements endpoints
Articles:
- noid: r.no_id (was r.noid)
- codefou: r.codefou_principal (was r.codefou)
- nomfou: r.nom_fou_principal (was r.nomfou)
- pcb: r.pcb_principal (was r.pcb)

Mouvements:
- datemvt: r.datmvt (was r.datemvt) — CRITICAL
- qte: r.qtemvt (was r.qte) — CRITICAL
- montant: r.mntmvtht (was r.montant) — CRITICAL
- marge: r.margemvt (was r.marge) — CRITICAL
- URL now uses dateDebut/dateFin params (confirmed working vs datedeb/datefin which ignores filter)

Sites fallback: use real codes 292/579 (Frouard/Houdemont)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 15:03:19 +01:00
MichaelandClaude Sonnet 4.6 c33e22f7eb fix: extractList includes API-specific wrapper keys, diag uses real codefou
- extractList now explicitly checks "mouvements", "articles", "fournisseurs",
  "ventes", "stocks", "commandes" wrapper keys before generic array fallback
- Diag endpoint auto-fetches first real codefou from fournisseurs instead
  of hardcoded "AUXENCE" (which was supplier nom, not actual codefou)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 14:57:49 +01:00
MichaelandClaude Sonnet 4.6 9e500b6650 feat: enhance diag endpoint to probe mouvements API with multiple date param variants
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 14:50:32 +01:00
Michael c056750ea7 feat: implement FF Nancy API client including data models and functions for suppliers, articles, movements, and stock. 2026-03-18 14:44:44 +01:00
Michael 7b209292b9 feat: introduce GridClient component to manage grid state, scoring, and UI orchestration. 2026-03-18 14:35:24 +01:00
Michael 1035489db1 feat: Add FF Nancy API client and status endpoint, implement grid product fetching and draft change saving, and introduce AI Copilot core logic. 2026-03-18 14:31:29 +01:00
Michael 22aa6f101a feat: Implement AI-powered product analysis engine with rules for manager directives, dead stock, and relative supplier performance, supported by a new score engine. 2026-03-13 10:52:40 +01:00
Michael 38e8fc1eac feat: implement AI analysis engine for generating retail product recommendation prompts. 2026-03-13 08:55:30 +01:00
Michael 2d3a90d6c7 feat: add floating summary bar component with grid statistics, draft management, snapshot, and export functionality. 2026-03-12 14:25:39 +01:00
Michael 9faea9df07 feat: Implement AI analysis engine with simplified v5 logic for product recommendations based on relative supplier performance. 2026-03-12 13:38:23 +01:00
Michael 1f38f487b1 feat: implement AI copilot analysis engine with detailed product recommendation logic and system prompt generation. 2026-03-12 13:00:51 +01:00
Michael 97ed6dd829 feat: Add AI copilot analysis engine to generate system and contextual user prompts for product recommendations. 2026-03-12 12:42:19 +01:00
Michael 1a01e084a5 feat: Implement AI copilot analysis engine (v4) with comprehensive product recommendation logic and contextual data generation. 2026-03-12 12:26:54 +01:00
Michael b66867429b feat: implement v4 AI analysis engine with comprehensive product recommendation rules and contextual data for prompt generation. 2026-03-12 12:09:41 +01:00
Michael 12c4e0ce95 feat: add server action to fetch, process, and score product sales data, including schema initialization for code_gamme_init. 2026-03-12 11:10:47 +01:00
Michael 1458700cb7 feat: Implement 'dead stock' detection and override inter-product consistency rules in the AI analysis engine. 2026-03-11 17:00:46 +01:00
Michael 49e1dd9d9b feat: Implement v3 context profiler for multi-store product normalization and an AI analysis engine. 2026-03-11 16:41:01 +01:00
Michael cfbf293104 feat: Implement a composite weighted score engine and update the task markdown with a master plan and progress log. 2026-03-11 16:25:22 +01:00
Michael 12809b9924 Merge branch 'main' of https://github.com/R0m1k3/CollectFlow 2026-03-11 14:45:49 +01:00
Michael 6529b2fe15 feat: Add saveDraftChanges API endpoint to update product drafts and correctly set codeGammeInit using COALESCE. 2026-03-11 14:45:47 +01:00
Michael 05549fbde5 fix: add cache revalidation to snapshot APIs and fix imports 2026-03-10 16:29:45 +01:00
Michael 85972b287d fix: restore anonymous snapshot visibility and deletion 2026-03-10 16:16:23 +01:00
Michael 8237cf2d9f fix: snapshot deletion, restore grid logic and add diagnostic API 2026-03-10 16:07:24 +01:00
Michael 5eb3f6732e feat: Add Drizzle ORM database setup, product data fetching and processing with scoring, and a diagnostic API endpoint. 2026-03-10 16:04:55 +01:00
Michael 1e5bb74344 feat: implement getProductRows API to fetch, filter, and aggregate product sales data for the grid, including schema initialization and scoring. 2026-03-10 15:59:44 +01:00
Michael 10cea8c528 feat: Implement product grid with a new API for fetching and processing product sales data, including schema initialization and score computation, and a dashboard page for display. 2026-03-10 15:52:29 +01:00
Michael 5009bd7612 feat: Implement getProductRows API to fetch, aggregate, and score product sales data, including a self-healing schema initialization for code_gamme_init. 2026-03-10 15:30:43 +01:00
Michael 1b09994087 feat: implement product grid data fetching with schema self-healing and add a database verification script. 2026-03-10 13:53:33 +01:00
Michael 08d361e980 feat: Introduce database count verification scripts and update Next.js configuration for pg and server action body size. 2026-03-10 13:37:13 +01:00
Michael f15fbe69ec feat: Implement core grid state management with Zustand, define grid data types, and introduce a heatmap cell component. 2026-03-10 12:56:37 +01:00
Michael b408de4c9c feat: Implement API to fetch and process product sales data for grid display, including schema initialization, sales aggregation, and score calculation. 2026-03-10 12:47:13 +01:00
Michael 6046be50de feat: Introduce Drizzle ORM for database management and a script for initial schema setup. 2026-03-10 12:35:27 +01:00