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:
@@ -19,7 +19,7 @@
|
||||
<div class="grid grid-cols-1 gap-4 sm:grid-cols-3">
|
||||
<x-logistics.form-field
|
||||
wire:model="type"
|
||||
label="Type de journal (TYPE)"
|
||||
label="Type de journal (TYPE, obligatoire)"
|
||||
id="type"
|
||||
placeholder="Ex: V"
|
||||
/>
|
||||
@@ -55,17 +55,25 @@
|
||||
<x-logistics.card>
|
||||
<x-logistics.section-header title="Résultats jnl_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 jnl_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
|
||||
@else
|
||||
<x-logistics.card>
|
||||
|
||||
Reference in New Issue
Block a user