- Added a toggle for switching between read and write modes on the Articles, Documents, Journaux, Tiers, and Divers pages, allowing users to access both data retrieval and data submission endpoints. - Updated the Documents page to cover all 9 documented endpoints, including 7 for reading and 2 for writing, with appropriate error handling. - Created a new Divers page to handle three endpoints: getserialnumber, codes_list, and custom_geninv_updatestock (the latter being non-functional). - Introduced new methods in LogisticsService for handling PDF generation and stock updates, with corresponding updates in the API documentation. - Improved form field components for better visual spacing in input fields.
135 lines
6.2 KiB
Markdown
135 lines
6.2 KiB
Markdown
# Tech Context
|
|
|
|
Dernière mise à jour : 2026-02-21
|
|
|
|
## Stack technique
|
|
|
|
| Composant | Version | Rôle |
|
|
|-----------|---------|------|
|
|
| PHP | 8.4 | Langage serveur |
|
|
| Laravel | 12 | Framework applicatif |
|
|
| Filament | 5.0 | Panel admin / dashboard |
|
|
| Livewire | 4 | Composants réactifs |
|
|
| Flux UI Free | 2.9+ | Composants UI Livewire |
|
|
| Fortify | 1.30+ | Authentification (existant, non utilisé par Filament) |
|
|
| Pest | 4.4+ | Framework de tests |
|
|
| MySQL | - | Base de données |
|
|
| Vite | 7.3 | Bundler frontend |
|
|
| Tailwind CSS | 4 | Framework CSS (via @tailwindcss/vite) |
|
|
| @tailwindcss/typography | 0.5.19 | Plugin prose pour le rendu markdown |
|
|
| barryvdh/laravel-dompdf | - | Génération PDF |
|
|
|
|
## Dépendances principales (composer.json)
|
|
|
|
- `filament/filament: ^5.0`
|
|
- `laravel/framework: ^12.0`
|
|
- `livewire/livewire: ^4.0`
|
|
- `livewire/flux: ^2.9.0`
|
|
- `laravel/fortify: ^1.30`
|
|
- `barryvdh/laravel-dompdf` (export PDF de la documentation)
|
|
|
|
## Frontend
|
|
|
|
- Tailwind CSS 4 avec le plugin Vite `@tailwindcss/vite`
|
|
- Plugin `@tailwindcss/typography` (v0.5.19) pour le rendu prose du markdown
|
|
- Thème Filament personnalisé : `resources/css/filament/admin/theme.css`
|
|
- Le thème Filament scanne les sources : `app/Filament/**/*`, `resources/views/filament/**/*`, `resources/views/components/logistics/**/*`
|
|
- Le thème inclut des styles CSS personnalisés pour la classe `.documentation-prose` (titres, tableaux, blocs de code, liens, listes) optimisés pour le dark mode Filament
|
|
- Build : `npm run build` (recompile `app.css` et `theme.css`)
|
|
|
|
## Configuration
|
|
|
|
### Variables d'environnement spécifiques
|
|
|
|
```
|
|
LOGISTICS_API_BASE_URL=http://tse-10-test.esi.local
|
|
LOGISTICS_API_KEY=<clé API>
|
|
LOGISTICS_API_FOLDER=esigescom
|
|
LOGISTICS_API_TIMEOUT=300
|
|
LOGISTICS_API_CONNECT_TIMEOUT=10
|
|
LOGISTICS_API_RETRY_TIMES=3
|
|
LOGISTICS_API_RETRY_SLEEP_MS=500
|
|
```
|
|
|
|
Fichier de config : `config/logistics.php`
|
|
|
|
| Clé de config | Variable .env | Défaut | Description |
|
|
|---------------|---------------|--------|-------------|
|
|
| `logistics.base_url` | `LOGISTICS_API_BASE_URL` | - | URL de base de l'API |
|
|
| `logistics.api_key` | `LOGISTICS_API_KEY` | - | Clé d'authentification |
|
|
| `logistics.folder` | `LOGISTICS_API_FOLDER` | - | Dossier dans l'URL |
|
|
| `logistics.timeout` | `LOGISTICS_API_TIMEOUT` | 30 | Timeout total de la requête (secondes) |
|
|
| `logistics.connect_timeout` | `LOGISTICS_API_CONNECT_TIMEOUT` | 10 | Timeout de connexion (secondes) |
|
|
| `logistics.retry.times` | `LOGISTICS_API_RETRY_TIMES` | 3 | Nombre de tentatives en cas d'échec de connexion |
|
|
| `logistics.retry.sleep_ms` | `LOGISTICS_API_RETRY_SLEEP_MS` | 500 | Délai entre les tentatives (ms) |
|
|
|
|
### Base de données
|
|
|
|
- Connexion : MySQL
|
|
- Base : `logistics`
|
|
- Configuration dans `.env` : `DB_CONNECTION=mysql`
|
|
|
|
## API Logistics
|
|
|
|
### Connexion
|
|
|
|
- Serveur : TSE-10-TEST (réseau privé)
|
|
- Base URL : `http://tse-10-test.esi.local`
|
|
- Dossier : `esigescom` (minuscules obligatoires)
|
|
- Authentification : Header `X-API-KEY`
|
|
- Méthode : POST pour tous les endpoints
|
|
|
|
### Structure de réponse
|
|
|
|
```json
|
|
{
|
|
"data": "<résultat>",
|
|
"metadata": { "rowcount": 0, "issuccess": true },
|
|
"error": "<message d'erreur ou null>"
|
|
}
|
|
```
|
|
|
|
Réponse `tables_list` : chaque table a `name` et `columnCount`.
|
|
Réponse `column_list` : chaque colonne a `name`, `dataType` (C/N/T/D/L/M), `length`, `precision`. Les colonnes sont retournées en double par l'API (dédupliquées côté client).
|
|
|
|
### Endpoints (19 méthodes dans LogisticsService)
|
|
|
|
| Endpoint | Méthode service | Type | Description | Paramètres principaux |
|
|
|----------|----------------|------|-------------|-----------------------|
|
|
| `tables_list` | `tablesList()` | Lecture | Liste des tables | - |
|
|
| `column_list/{table}` | `columnList(string)` | Lecture | Colonnes d'une table | table (URL) |
|
|
| `art_list` | `artList(array)` | Lecture | Liste d'articles | select, results, search, barcode |
|
|
| `art_getstk` | `artGetStock(string)` | Lecture | Stock d'un article | ARTID |
|
|
| `jnl_list` | `jnlList(array)` | Lecture | Liste des journaux | select, results, TYPE |
|
|
| `document_list` | `documentList(array)` | Lecture | Liste des documents | select, thirdid |
|
|
| `document_detail` | `documentDetail(string, string)` | Lecture | Détail d'un document | jnl, number |
|
|
| `Document_GetStatusList` | `documentGetStatusList(string)` | Lecture | Statuts d'un journal | jnl |
|
|
| `Document_GetUnitPriceAndVat` | `documentGetUnitPriceAndVat(array)` | Lecture | Prix et TVA | ARTID, QTY, JNL, THIRDID, DATE |
|
|
| `Document_GetDueDate` | `documentGetDueDate(string, string)` | Lecture | Échéance | paydelay, date |
|
|
| `Document_GetAttachListThumbnail` | `documentGetAttachListThumbnail(string, string)` | Lecture | Miniatures annexes | JNL, NUMBER |
|
|
| `Document_GetPDF` | `documentGetPdf(string, string, string)` | Lecture | Génération PDF | JNL, NUMBER, LAYOUT |
|
|
| `third_list` | `thirdList(array)` | Lecture | Liste des tiers | select, results, search |
|
|
| `third_GetArtHistory` | `thirdGetArtHistory(string)` | Lecture | Historique articles tiers | thirdid |
|
|
| `getserialnumber` | `getSerialNumber()` | Lecture | Numéro de série | - |
|
|
| `codes_list` | `codesList(array)` | Lecture | Données par code | code |
|
|
| `document_add` | `documentAdd(array)` | Écriture | Ajout d'un document | ThirdId, Date, Artid[], Qty[], Saleprice[], JNL, ... |
|
|
| `document_mod` | `documentMod(array)` | Écriture | Modification d'un document | number, Thirdid, Artid[], Qty[], Saleprice[], JNL, ... |
|
|
| `custom_geninv_updatestock` | `customGeninvUpdatestock(array)` | Écriture | Mise à jour inventaire | ARTID, STKID, QTY, ... |
|
|
|
|
**Endpoints non fonctionnels** : `Document_GetPDF` (paramètre LAYOUT inconnu), `custom_geninv_updatestock` (paramètre STKID inconnu, signification de TOCHECK/TOCHECKDETAIL/MODE à clarifier).
|
|
|
|
### Tables accessibles
|
|
|
|
art (160 col.), attach (13), barcode (12), category (10), codes (50), cust (216), docdet (82), dochead (212), docpay (22), file (17), hist (50), incodes (24), jnl (155), pers (78), price (28), stk (20)
|
|
|
|
### Types de colonnes (dataType)
|
|
|
|
| Code | Label | Couleur badge |
|
|
|------|-------|---------------|
|
|
| C | Caractère | Bleu |
|
|
| N | Numérique | Vert (emerald) |
|
|
| T | Date/Heure | Violet |
|
|
| D | Date | Violet |
|
|
| L | Logique | Ambre |
|
|
| M | Mémo | Gris |
|