Refactor error handling and enhance API interactions across Filament pages

- Introduced `ApiErrorTranslator` to normalize and translate API error messages, providing clearer feedback in French.
- Updated all Filament pages (Articles, Documents, Divers, Journaux, Tiers, TablesExplorer) to utilize the new error translation mechanism, improving user experience during API interactions.
- Added validation for required fields before API calls, ensuring users receive immediate feedback when mandatory inputs are missing.
- Implemented tracking properties to distinguish between "never searched" and "searched without results," enhancing the user interface.
- Removed the obsolete `$results` property from the Articles page and added a new `$barcode` property to align with API requirements.
- Updated documentation to reflect changes in API behavior and error handling, including new metadata returned by the `art_list` endpoint.
- Added new tests to verify the functionality of the barcode handling and validation logic.
This commit is contained in:
2026-02-23 10:15:17 +01:00
parent 7df94b64fa
commit bb1bbc2904
29 changed files with 1075 additions and 157 deletions

View File

@@ -55,17 +55,25 @@
<x-logistics.card>
<x-logistics.section-header title="Résultats third_list">
<x-slot:actions>
@if ($metadata)
<span class="rounded-full bg-gray-100 px-2.5 py-0.5 text-xs font-medium tabular-nums text-gray-600 dark:bg-white/10 dark:text-gray-300">
{{ $metadata['rowcount'] ?? 0 }} résultat(s)
</span>
@endif
<span class="rounded-full bg-gray-100 px-2.5 py-0.5 text-xs font-medium tabular-nums text-gray-600 dark:bg-white/10 dark:text-gray-300">
{{ count($data) }} résultat(s)
</span>
</x-slot:actions>
</x-logistics.section-header>
<div class="p-6">
<x-logistics.data-table :data="$data" />
</div>
</x-logistics.card>
@elseif ($hasSearched && ! $errorMessage)
<x-logistics.card>
<x-logistics.section-header title="Résultats third_list" />
<div class="p-6">
<x-logistics.empty-state
icon="heroicon-o-magnifying-glass"
title="Aucune donnée n'a été trouvée pour votre demande."
/>
</div>
</x-logistics.card>
@endif
{{-- third_GetArtHistory --}}
@@ -92,7 +100,7 @@
</div>
<div wire:loading.remove wire:target="getArtHistory" class="mt-4">
<x-logistics.json-block :data="$historyData" />
<x-logistics.json-block :data="$historyData" :searched="$hasHistory" />
</div>
</div>
</x-logistics.card>