Enhance API parameter documentation and introduce reusable component
- Added a new Blade component `<x-logistics.param-table>` for displaying API parameter tables across all Filament pages, ensuring consistent styling and reducing HTML duplication. - Integrated parameter tables for each endpoint in the Articles, Documents, Divers, Journaux, Tiers, and other pages, providing users with clear reference information. - Updated the documentation to reflect the new structure and details of API parameters, including required fields and descriptions. - Improved user experience by ensuring that endpoints without parameters do not display empty tables. - Overall, enhanced the clarity and usability of API interactions within the application.
This commit is contained in:
@@ -139,6 +139,120 @@ class Documents extends Page
|
||||
|
||||
public bool $hasModified = false;
|
||||
|
||||
/**
|
||||
* @return array<int, array{name: string, type: string, required: string, description: string}>
|
||||
*/
|
||||
public function paramTableDocumentList(): array
|
||||
{
|
||||
return [
|
||||
['name' => 'select', 'type' => 'string', 'required' => 'Non', 'description' => 'Colonnes a retourner, separees par des virgules (colonnes de la table dochead). Par defaut : thirdid.'],
|
||||
['name' => 'thirdid', 'type' => 'string', 'required' => 'Non', 'description' => 'Identifiant du tiers (custid de la table cust). Si fourni, seuls les documents de ce tiers sont retournes.'],
|
||||
['name' => 'results', 'type' => 'string', 'required' => 'Non', 'description' => "Nombre maximum de resultats. N'a d'effet que lorsqu'un thirdid est egalement fourni. Limite par defaut : ~108."],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<int, array{name: string, type: string, required: string, description: string}>
|
||||
*/
|
||||
public function paramTableDocumentDetail(): array
|
||||
{
|
||||
return [
|
||||
['name' => 'jnl', 'type' => 'string', 'required' => 'Oui', 'description' => 'Code du journal auquel appartient le document (ex : 03VEN, 01COM).'],
|
||||
['name' => 'number', 'type' => 'string', 'required' => 'Oui', 'description' => 'Numero du document dans le journal (ex : 25105397).'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<int, array{name: string, type: string, required: string, description: string}>
|
||||
*/
|
||||
public function paramTableStatusList(): array
|
||||
{
|
||||
return [
|
||||
['name' => 'jnl', 'type' => 'string', 'required' => 'Oui', 'description' => 'Code du journal dont on veut connaitre les statuts (ex : 03VEN, 01COM, 02NEV).'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<int, array{name: string, type: string, required: string, description: string}>
|
||||
*/
|
||||
public function paramTableUnitPriceAndVat(): array
|
||||
{
|
||||
return [
|
||||
['name' => 'ARTID', 'type' => 'string', 'required' => 'Oui', 'description' => "Identifiant de l'article (champ artid de la table art)."],
|
||||
['name' => 'QTY', 'type' => 'string', 'required' => 'Oui', 'description' => 'Quantite demandee. Doit etre au format string (ex : "2", pas 2).'],
|
||||
['name' => 'JNL', 'type' => 'string', 'required' => 'Oui', 'description' => 'Code du journal (ex : 03VEN).'],
|
||||
['name' => 'THIRDID', 'type' => 'string', 'required' => 'Oui', 'description' => 'Identifiant du tiers (custid de la table cust).'],
|
||||
['name' => 'DATE', 'type' => 'string', 'required' => 'Oui', 'description' => 'Date de reference. Format obligatoire : YYYY-MM-DD.'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<int, array{name: string, type: string, required: string, description: string}>
|
||||
*/
|
||||
public function paramTableDueDate(): array
|
||||
{
|
||||
return [
|
||||
['name' => 'paydelay', 'type' => 'string', 'required' => 'Oui', 'description' => 'Code de delai de paiement. Valeurs via codes_list PAYDELAY (ex : 30, 30F, 60, 60F, 90F).'],
|
||||
['name' => 'date', 'type' => 'string', 'required' => 'Oui', 'description' => 'Date de depart pour le calcul. Format obligatoire : YYYY-MM-DD.'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<int, array{name: string, type: string, required: string, description: string}>
|
||||
*/
|
||||
public function paramTableAttachListThumbnail(): array
|
||||
{
|
||||
return [
|
||||
['name' => 'JNL', 'type' => 'string', 'required' => 'Oui', 'description' => 'Code du journal du document (ex : 03VEN).'],
|
||||
['name' => 'NUMBER', 'type' => 'string', 'required' => 'Oui', 'description' => 'Numero du document (ex : 25105397).'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<int, array{name: string, type: string, required: string, description: string}>
|
||||
*/
|
||||
public function paramTableGetPdf(): array
|
||||
{
|
||||
return [
|
||||
['name' => 'JNL', 'type' => 'string', 'required' => 'Oui', 'description' => 'Code du journal (ex : 03VEN).'],
|
||||
['name' => 'NUMBER', 'type' => 'string', 'required' => 'Oui', 'description' => 'Numero du document (ex : 25105397).'],
|
||||
['name' => 'LAYOUT', 'type' => 'string', 'required' => 'Oui', 'description' => 'Identifiant numerique de la mise en page (format string). Valeur "1" recommandee par defaut.'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<int, array{name: string, type: string, required: string, description: string}>
|
||||
*/
|
||||
public function paramTableDocumentAdd(): array
|
||||
{
|
||||
return [
|
||||
['name' => 'ThirdId', 'type' => 'string', 'required' => 'Oui', 'description' => 'Identifiant du tiers (custid de la table cust).'],
|
||||
['name' => 'Date', 'type' => 'string', 'required' => 'Oui', 'description' => "Date d'encodage du document (ex : 2026-02-20)."],
|
||||
['name' => 'JNL', 'type' => 'string', 'required' => 'Oui', 'description' => 'Code du journal (ex : VEN).'],
|
||||
['name' => 'Artid', 'type' => 'array', 'required' => 'Oui', 'description' => "Tableau d'identifiants d'articles. Chaque element correspond a une ligne du document."],
|
||||
['name' => 'Qty', 'type' => 'array', 'required' => 'Oui', 'description' => 'Tableau de quantites (format string). Correspondance positionnelle avec Artid.'],
|
||||
['name' => 'Saleprice', 'type' => 'array', 'required' => 'Oui', 'description' => 'Tableau des prix de vente unitaires (format string). Correspondance positionnelle avec Artid.'],
|
||||
['name' => 'Discount', 'type' => 'array', 'required' => 'Non', 'description' => 'Tableau des reductions de prix. Correspondance positionnelle avec Artid.'],
|
||||
['name' => 'Vatid', 'type' => 'array', 'required' => 'Non', 'description' => 'Tableau des identifiants de code TVA. Correspondance positionnelle avec Artid.'],
|
||||
['name' => 'Vatpc', 'type' => 'array', 'required' => 'Non', 'description' => 'Tableau des pourcentages de TVA. Correspondance positionnelle avec Artid.'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<int, array{name: string, type: string, required: string, description: string}>
|
||||
*/
|
||||
public function paramTableDocumentMod(): array
|
||||
{
|
||||
return [
|
||||
['name' => 'number', 'type' => 'string', 'required' => 'Oui', 'description' => 'Identifiant du document a modifier (ex : 2026/0001).'],
|
||||
['name' => 'JNL', 'type' => 'string', 'required' => 'Oui', 'description' => 'Code du journal lie au document (ex : VEN).'],
|
||||
['name' => 'Thirdid', 'type' => 'string', 'required' => 'Non', 'description' => 'Nouvel identifiant du tiers (si modification du tiers associe).'],
|
||||
['name' => 'Artid', 'type' => 'array', 'required' => 'Non', 'description' => "Tableau d'identifiants d'articles (remplace les lignes existantes)."],
|
||||
['name' => 'Qty', 'type' => 'array', 'required' => 'Non', 'description' => 'Tableau de quantites. Correspondance positionnelle avec Artid.'],
|
||||
['name' => 'Saleprice', 'type' => 'array', 'required' => 'Non', 'description' => 'Tableau des prix de vente unitaires. Correspondance positionnelle avec Artid.'],
|
||||
];
|
||||
}
|
||||
|
||||
public function searchDocuments(): void
|
||||
{
|
||||
$this->errorMessage = null;
|
||||
|
||||
Reference in New Issue
Block a user