Commit Graph
237 Commits
Author SHA1 Message Date
MichaelandClaude Sonnet 4.6 dc16beeda4 feat: add no-sales-6-months tab to stock management page
Adds a second tab "Sans vente 6 mois" on the grid page listing all
products with no sale in the last 6 months, sorted by oldest last
sale first. Resolves merge conflicts from upstream refactor.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 12:49:13 +02:00
Michael 6492f93bf4 feat: add NoSalesTab component to display products without sales in the last 6 months 2026-04-14 12:45:21 +02:00
Michael d0ca0c3602 feat: implement database and AI provider configuration settings with Google GenAI integration 2026-04-10 15:00:47 +02:00
Michael a2c4a065dd feat: add ExportDropdown component with Excel and PDF export functionality for grid data 2026-04-10 13:25:19 +02:00
MichaelandClaude Sonnet 4.6 6b26676836 feat: flag products whose last registered supplier differs from current view
Instead of unreliable preference=1, use artfou1.no_id DESC (most recently
added artfou1 entry) to identify the last supplier for each product.
Shows an amber warning icon in the Désignation column when the last
supplier ≠ current supplier view, with tooltip showing who to attribute
the sales to.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 11:55:42 +02:00
MichaelandClaude Sonnet 4.6 6ef23de317 feat: restrict AI analysis to admin role only
- FloatingSummaryBar: hide BulkAiAnalyzer button for non-admins
- AiInsightBlock: hide individual Analyser button for non-admins
- Both use useSession() to check role === "admin"

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 11:43:48 +02:00
MichaelandClaude Sonnet 4.6 bbb04a4d2a fix: immediate AI loading feedback + auto-fallback for deprecated model
- BulkAiAnalyzer: set isAnalyzing=true immediately on click (before
  context fetch), so the spinner appears instantly instead of after
  1-2 seconds of silence
- analyze/route.ts: if configured model returns 400/404 (e.g., deprecated
  google/gemini-flash-1.5), automatically retry with google/gemini-2.0-flash-001
- batch-analyze/route.ts: same fallback logic

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 11:34:14 +02:00
MichaelandClaude Sonnet 4.6 2aa9cbecaa revert: restore grid to pre-infinite-scroll state
Remove infinite grid loading, useInfiniteGrid hook, and server-side
pagination API route. Revert grid components to the simpler version
that avoids 2MB+ cache failures from unstable_cache.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-03 11:26:13 +02:00
Michael b39e010903 feat: implement infinite grid loading with server-side pagination and client-side integration 2026-04-02 18:39:29 +02:00
Michael 49928e9c08 feat: implement useInfiniteGrid hook for paginated data fetching and state management 2026-04-02 17:53:09 +02:00
Michael 4dfdcc1144 feat: implement infinite scrolling and background data loading for the product grid component 2026-04-02 17:47:10 +02:00
Michael f70249555e feat: implement high-performance virtualized heatmap grid with granular Zustand state management 2026-04-02 17:36:42 +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
MichaelandClaude Sonnet 4.6 868886db87 feat: hit-parade date range + fournisseur filter; fix create user button layout
- Replace month dropdown with date picker (Du/Au) + Appliquer button
- Add fournisseur filter dropdown (client-side, all suppliers from current data)
- Totals update live when fournisseur filter changes
- SQL: use BETWEEN date range instead of TO_CHAR month match
- Create user button: proper 3-col form layout so button stays on one line

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 13:42:25 +02:00
MichaelandClaude Sonnet 4.6 05354a0e74 fix: restore apple-btn-primary style for create user button; guard Invalid Date on sync status
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 13:35:35 +02:00
MichaelandClaude Sonnet 4.6 ead53db496 feat: restrict gamme/export/exports-page to admin; fix create user button style
- Non-admin users see gamme as read-only badge (no select)
- Export button hidden for non-admin in grid
- Save drafts button hidden for non-admin
- Exports page hidden in sidebar for non-admin
- Create user button: explicit blue style (was unreadable with apple-btn-primary)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-01 13:29:52 +02:00
Michael 8ecba594cf feat: introduce virtualized heatmap grid component with dynamic monthly data and optimized cell rendering. 2026-03-23 16:20:17 +01: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 bba6fe05e8 feat: implement client-side grid orchestrator and core heatmap table component. 2026-03-23 14:13:39 +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 99954fb001 feat: Add AI Copilot Zustand store for managing and persisting product insights. 2026-03-23 13:34:36 +01:00
Michael 86df5d6f29 feat: introduce BulkAiAnalyzer component for bulk product classification and AI context profiling. 2026-03-23 12:43:02 +01:00
Michael e391550a30 feat: Introduce product assortment grid client and direct PostgreSQL data access for FF Nancy. 2026-03-20 14:25:30 +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
MichaelandClaude Sonnet 4.6 a16ec24cd7 perf+fix: parallelize article pagination, filter inactive articles, add gamme Y
Performance fixes for large suppliers (14k+ articles):
- fetchAllPages now fetches page 1, reads total count from response,
  then fetches remaining pages in parallel (10 at a time) instead of
  sequentially. Falls back to sequential if no count in response.
- getProductRows filters out suspended/inactive articles before calling
  getMensuelByArticles and getReferentielByArticles, reducing API calls
  from N_total to N_active (e.g. 14775→~2500 for S053).
- getRankingByArticles receives only active articles for bulk fetch.
- FfArticle now exposes actif and suspendu fields.

Gamme Y support:
- GammeSelect: add Y option with violet color
- GridFilterBar: add Y filter button with violet color
- BulkActionToolbar: add Y bulk assignment button

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-19 20:23:38 +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
MichaelandClaude Opus 4.6 414bf6133d fix: correct snapshot save to detect all gamme changes (drafts + validated)
handleSnapshot was only looking at active draftChanges to build the
snapshot. After validation (Valider), drafts are cleared but changes
are applied to row.codeGamme via applyDraftsToRows. This caused
handleSnapshot (Camera/Export) to save an empty snapshot that
overwrote the real one, losing all gamme changes on page reload.

Now handleSnapshot compares (draftChanges[codein] ?? row.codeGamme)
vs row.codeGammeInit to detect ALL changes, whether drafted or
already validated. Uses codeGammeInit as "before" reference (API
value, never modified).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 17:13:49 +01:00
Michael 01d2dc8b34 feat: add BulkAiAnalyzer component for automatic product classification and AI context profiling. 2026-03-19 15:52:48 +01:00
Michael 7cdbe8ec21 feat: add Zustand store for grid state and a hook to save draft modifications 2026-03-19 15:17:28 +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 a4528c6d14 feat: Add HeatmapGrid component for visualizing product data with TanStack Table, virtualization, and performance optimizations. 2026-03-19 13:02:16 +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 2b7e7bc1f4 feat: Introduce AI analysis engine with detailed system prompt and user message generation for product recommendations, and add an OpenRouter client. 2026-03-19 09:50:28 +01:00
Michael d8a9329075 feat: Introduce AI Copilot feature with product analysis engine, state management, and UI components for insights. 2026-03-19 07:53:56 +01:00
Michael 95795ce7e3 feat: Introduce AI analysis engine for product A/Z recommendations based on detailed business rules. 2026-03-18 22:15:14 +01:00
Michael de768128e3 feat: implement AI copilot analysis engine with v5 simplified system prompt and product recommendation rules. 2026-03-18 21:34:31 +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 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