The previous ::boolean cast caused query failure when suspendu column
is not a native boolean type. Casting to ::text first handles all
column types (char, varchar, int, boolean).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add WHERE NOT COALESCE(af.suspendu::boolean, false) AND NOT COALESCE(a.suspendu::boolean, false)
to pgGetArticlesByFournisseur — products flagged as suspended in artfou1
or articles table are no longer shown in the grid.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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>
- 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>
- 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>
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>
- 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>
- 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>
Replace last_reception CTE with direct LEFT JOIN artfou1 WHERE preference=true (fournisseur
principal de l'article). Use ABS(SUM(mntmvtttc)) instead of SUM(-mntmvtttc). Both fournisseur
and nomenclature queries now use LEFT JOIN to include all sold articles.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>