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:
@@ -51,17 +51,25 @@
|
||||
<x-logistics.card>
|
||||
<x-logistics.section-header title="Résultats document_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 ($hasSearchedDocs && ! $errorMessage)
|
||||
<x-logistics.card>
|
||||
<x-logistics.section-header title="Résultats document_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
|
||||
|
||||
{{-- document_detail --}}
|
||||
@@ -94,7 +102,7 @@
|
||||
</div>
|
||||
|
||||
<div wire:loading.remove wire:target="getDocumentDetail" class="mt-4">
|
||||
<x-logistics.json-block :data="$detailData" />
|
||||
<x-logistics.json-block :data="$detailData" :searched="$hasDetail" />
|
||||
</div>
|
||||
</div>
|
||||
</x-logistics.card>
|
||||
@@ -123,7 +131,7 @@
|
||||
</div>
|
||||
|
||||
<div wire:loading.remove wire:target="getStatusList" class="mt-4">
|
||||
<x-logistics.json-block :data="$statusData" />
|
||||
<x-logistics.json-block :data="$statusData" :searched="$hasStatus" />
|
||||
</div>
|
||||
</div>
|
||||
</x-logistics.card>
|
||||
@@ -176,7 +184,7 @@
|
||||
</div>
|
||||
|
||||
<div wire:loading.remove wire:target="getUnitPriceAndVat" class="mt-4">
|
||||
<x-logistics.json-block :data="$priceData" />
|
||||
<x-logistics.json-block :data="$priceData" :searched="$hasPrice" />
|
||||
</div>
|
||||
</div>
|
||||
</x-logistics.card>
|
||||
@@ -211,7 +219,7 @@
|
||||
</div>
|
||||
|
||||
<div wire:loading.remove wire:target="getDueDate" class="mt-4">
|
||||
<x-logistics.json-block :data="$dueDateData" />
|
||||
<x-logistics.json-block :data="$dueDateData" :searched="$hasDueDate" />
|
||||
</div>
|
||||
</div>
|
||||
</x-logistics.card>
|
||||
@@ -246,7 +254,7 @@
|
||||
</div>
|
||||
|
||||
<div wire:loading.remove wire:target="getAttachListThumbnail" class="mt-4">
|
||||
<x-logistics.json-block :data="$attachData" />
|
||||
<x-logistics.json-block :data="$attachData" :searched="$hasAttach" />
|
||||
</div>
|
||||
</div>
|
||||
</x-logistics.card>
|
||||
@@ -290,7 +298,7 @@
|
||||
</div>
|
||||
|
||||
<div wire:loading.remove wire:target="getPdf" class="mt-4">
|
||||
<x-logistics.json-block :data="$pdfData" />
|
||||
<x-logistics.json-block :data="$pdfData" :searched="$hasPdf" />
|
||||
</div>
|
||||
</div>
|
||||
</x-logistics.card>
|
||||
@@ -371,7 +379,7 @@
|
||||
</div>
|
||||
|
||||
<div wire:loading.remove wire:target="addDocument" class="mt-4">
|
||||
<x-logistics.json-block :data="$addResult" />
|
||||
<x-logistics.json-block :data="$addResult" :searched="$hasAdded" />
|
||||
</div>
|
||||
</div>
|
||||
</x-logistics.card>
|
||||
@@ -430,7 +438,7 @@
|
||||
</div>
|
||||
|
||||
<div wire:loading.remove wire:target="modDocument" class="mt-4">
|
||||
<x-logistics.json-block :data="$modResult" />
|
||||
<x-logistics.json-block :data="$modResult" :searched="$hasModified" />
|
||||
</div>
|
||||
</div>
|
||||
</x-logistics.card>
|
||||
|
||||
Reference in New Issue
Block a user