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:
@@ -27,15 +27,13 @@
|
||||
wire:model="select"
|
||||
label="Colonnes (select)"
|
||||
id="select"
|
||||
placeholder="artid,artname"
|
||||
placeholder="artid,name1"
|
||||
/>
|
||||
<x-logistics.form-field
|
||||
wire:model="results"
|
||||
label="Nombre de résultats (results)"
|
||||
id="results"
|
||||
type="number"
|
||||
min="1"
|
||||
max="100"
|
||||
wire:model="barcode"
|
||||
label="Code-barres (barcode)"
|
||||
id="barcode"
|
||||
placeholder="Ex: 5411068700323"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -55,17 +53,25 @@
|
||||
<x-logistics.card>
|
||||
<x-logistics.section-header title="Résultats art_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 art_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
|
||||
|
||||
{{-- art_getstk --}}
|
||||
@@ -92,7 +98,7 @@
|
||||
</div>
|
||||
|
||||
<div wire:loading.remove wire:target="getStock" class="mt-4">
|
||||
<x-logistics.json-block :data="$stockData" />
|
||||
<x-logistics.json-block :data="$stockData" :searched="$hasCheckedStock" />
|
||||
</div>
|
||||
</div>
|
||||
</x-logistics.card>
|
||||
|
||||
Reference in New Issue
Block a user