Commit Graph
48 Commits
Author SHA1 Message Date
Michael 4dfdcc1144 feat: implement infinite scrolling and background data loading for the product grid component 2026-04-02 17:47:10 +02:00
Michael 43644a7d1d feat: implement server-side product row data fetching with caching and aggregation logic 2026-04-02 17:28:23 +02:00
Michael 88a3121c92 feat: implement grid state management, data fetching, and infinite scroll infrastructure 2026-04-02 17:22:41 +02:00
Michael 2893114fca feat: implement infinite grid pagination with server-side data fetching and custom hook 2026-04-02 17:17:32 +02:00
Michael 4db7faa41f feat: implement server-side product data aggregation and caching for grid view 2026-04-02 17:00:21 +02:00
Michael 557e3ed8e0 feat: implement server-side data loader for product grid rows with caching and aggregation logic 2026-04-02 16:55:46 +02:00
Michael 7e4b370267 feat: implement PostgreSQL client for bulk data retrieval to replace per-article HTTP requests and configure Claude permissions 2026-04-02 16:31:11 +02:00
Michael ffa257fda1 feat: Implement product heatmap grid with comprehensive data aggregation and PostgreSQL client for product rows. 2026-03-23 16:09:09 +01:00
Michael 53b85381fa feat: add server-side API for fetching and processing comprehensive product data for the grid. 2026-03-23 14:00:27 +01:00
Michael b4f583415b feat: Add PostgreSQL client for FF Nancy data, replacing HTTP API calls with bulk SQL queries for improved performance. 2026-03-20 11:39:40 +01:00
Michael 70b49c5c56 feat: Introduce getProductRows server action for fetching and processing comprehensive product data from PostgreSQL. 2026-03-20 10:25:24 +01:00
Michael 4dd1b5f7c7 feat: Introduce PostgreSQL client for bulk data retrieval and integrate it into product grid data fetching actions. 2026-03-20 10:05:30 +01:00
Michael 58d467a7ea feat: implement product row data retrieval and processing logic for the grid. 2026-03-20 09:58:32 +01:00
MichaelandClaude Sonnet 4.6 65f455b4e2 perf: referentiel+ranking only for articles with sales, per-article ranking
The ranking bulk endpoint is capped at 500 by the API server, making
it useless for full supplier matching. Per-article ranking (codein filter)
works correctly and is now called only for articles WITH sales data.

getProductRows restructured:
- Phase 2A: mensuel + commandes in parallel (all articles)
- Phase 2B: referentiel + ranking in parallel, only for articlesWithData
  (articles that appear in mensuelMap)

For a 45060-article supplier with 5446 with sales:
- Referentiel: 45060 → 5446 calls (88% reduction)
- Ranking: 45060 → 5446 calls (88% reduction)

totalRankedProducts fetched from GET /api/ranking?limit=500 count.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-19 22:02:12 +01:00
MichaelandClaude Sonnet 4.6 1cd3ade77e perf: remove actif filter, increase batchSize, exclude Y articles without sales
- Remove actif/suspendu filter that caused wrong stats (893€ CA, 249 units)
  by incorrectly excluding products with sales. The parallel pagination
  and bulk ranking fixes are sufficient to handle large suppliers.
- Increase getMensuelByArticles and getReferentielByArticles batchSize
  from 20 to 50, reducing sequential batch iterations by ~2.5x.
- Filter gamme Y products with zero 12-month sales from returned rows.
  Reduces grid size (e.g. S053: 14775→fewer rows) without affecting
  products that actually sold. Y products with sales are preserved.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-19 21:23:34 +01:00
Michael 69c7d65482 feat: Add Claude settings to allow specific Git and Next.js Bash commands. 2026-03-19 20:06:11 +01:00
MichaelandClaude Sonnet 4.6 dcebf74f31 perf: replace N ranking API calls with 1 bulk fetch per supplier
getRankingByArticles now uses GET /api/ranking?foucentrale=<code>
to fetch all rankings for a supplier in a single request instead of
making one request per article. For a 500-article supplier this goes
from ~500 HTTP calls to 2 (count + bulk), eliminating the timeout
that caused the client-side crash on large suppliers.

Falls back to per-article requests if no codeFournisseur is provided
or if the bulk endpoint fails.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-19 18:53:49 +01:00
Michael aa69637f98 feat: Introduce bulk AI analyzer component to pre-classify products and prepare data for AI analysis, including context profiling. 2026-03-19 13:19:49 +01:00
Michael 8b7d81b20c feat: implement product grid with comprehensive product data fetching, processing, and heatmap display. 2026-03-19 12:41:03 +01:00
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 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 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 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
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 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 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 3ce22defa7 feat: Introduce product scoring based on weighted sales metrics and store participation, integrated into the product grid API, and add a performance test script. 2026-03-10 11:29:39 +01:00
Michael d75454dd56 feat: Implement virtualized product heatmap grid with data fetching and client integration. 2026-03-06 15:03:25 +01:00
Michael b7caf552a2 feat: Implement initial product data fetching API and establish the Product Requirements Document. 2026-02-23 11:27:14 +01:00
Michael 9493a39d12 feat(grid): preserve initial gamme reference and add modification icon 2026-02-21 18:30:48 +01:00
Michael 8567361107 feat(grid): refine nomenclature to 6-digits, single dropdown filter, and distinct store colors 2026-02-21 18:07:36 +01:00
Michael 93e01a475a fix(db): remove non-existent columns from schema and fix aggregation logic 2026-02-21 17:34:04 +01:00
Michael 33615bb1bd feat(grid): implement hierarchical nomenclature filter (Secteur > Rayon > Famille) 2026-02-21 17:27:33 +01:00
Michael cb7cbf873f feat(grid): add store participation icons in designation column 2026-02-21 15:44:53 +01:00
Michael 86240f4b46 chore(cleanup): remove unused imports, variables and fix missing hook dependencies 2026-02-21 15:15:22 +01:00
Michael c1bd0ae097 feat(grid): exclude current month from grid and scoring calculations 2026-02-21 15:13:29 +01:00
Michael 3544c0c898 feat(grid): ajout algorithme score produit avec parametrage dynamique et page d'aide 2026-02-21 04:00:51 +01:00