Page split-view qui permet de composer une facture native dans Rubis avec preview PDF en live (debounce 500 ms via POST /invoices/preview-pdf → Blob → objectURL → iframe). UI - Gauche : panneau d'édition organisé en cards (destinataire, dates + plan, lignes éditables, thème + accent, notes). - Droite : iframe sticky qui affiche le PDF rendu côté serveur. Loader discret pendant la génération, fallback "sélectionnez un client" tant qu'on n'a pas un payload minimal valide. - Lignes : ajout/suppression, quantité décimale (heures, demi-jours), taux TVA selon FRENCH_TVA_RATES, total HT recalculé live. - Totaux client-side : mêmes règles d'arrondi (Math.round par ligne) que invoice_totals.ts côté serveur — feedback instantané, le serveur recalcule à la persistance. - Footer sticky : "Enregistrer en brouillon" / "Émettre la facture", avec rappel que l'émission consomme la séquence (irréversible). API client - `useCreateNativeInvoice` : POST /invoices/native, invalide les caches invoices + counts. - `previewInvoicePdf(input, signal)` : POST /invoices/preview-pdf qui retourne un Blob (annulable via AbortSignal pour les frappes rapides). - `api.postBlob` : helper générique POST+JSON → Blob (inverse de fetchBlob). Defaults : les settings résolus de l'org (theme, accent, paymentTermsDays) sont chargés une fois au mount et appliqués comme valeurs initiales. Liste factures : remplace le bouton "Nouvelle facture" par deux actions côte-à-côte — "Importer" (secondaire, mène à /factures/import) et "Créer une facture" (primaire, mène à /factures/nouvelle). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
React + TypeScript + Vite
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available:
- @vitejs/plugin-react uses Oxc
- @vitejs/plugin-react-swc uses SWC
React Compiler
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see this documentation.
Expanding the ESLint configuration
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Remove tseslint.configs.recommended and replace with this
tseslint.configs.recommendedTypeChecked,
// Alternatively, use this for stricter rules
tseslint.configs.strictTypeChecked,
// Optionally, add this for stylistic rules
tseslint.configs.stylisticTypeChecked,
// Other configs...
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])
You can also install eslint-plugin-react-x and eslint-plugin-react-dom for React-specific lint rules:
// eslint.config.js
import reactX from 'eslint-plugin-react-x'
import reactDom from 'eslint-plugin-react-dom'
export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Enable lint rules for React
reactX.configs['recommended-typescript'],
// Enable lint rules for React DOM
reactDom.configs.recommended,
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])