Files
logisticsAPI/resources/views/filament/pages/tiers.blade.php
2026-02-20 08:40:00 +01:00

92 lines
5.0 KiB
PHP

<x-filament-panels::page>
@if ($errorMessage)
<div class="rounded-lg bg-danger-50 p-4 text-sm text-danger-600 dark:bg-danger-400/10 dark:text-danger-400">
{{ $errorMessage }}
</div>
@endif
{{-- Formulaire de recherche --}}
<div class="rounded-xl bg-white p-6 shadow-sm ring-1 ring-gray-950/5 dark:bg-gray-900 dark:ring-white/10">
<h3 class="text-base font-semibold text-gray-950 dark:text-white">Rechercher des tiers</h3>
<div class="mt-4 grid grid-cols-1 gap-4 sm:grid-cols-3">
<div>
<label for="search" class="block text-sm font-medium text-gray-700 dark:text-gray-300">Recherche (obligatoire)</label>
<input wire:model="search" type="text" id="search" placeholder="Filtre de recherche..."
class="mt-1 block w-full rounded-lg border-gray-300 shadow-sm focus:border-primary-500 focus:ring-primary-500 dark:border-white/10 dark:bg-white/5 dark:text-white sm:text-sm" />
</div>
<div>
<label for="select" class="block text-sm font-medium text-gray-700 dark:text-gray-300">Colonnes (select)</label>
<input wire:model="select" type="text" id="select" placeholder="custid,custname"
class="mt-1 block w-full rounded-lg border-gray-300 shadow-sm focus:border-primary-500 focus:ring-primary-500 dark:border-white/10 dark:bg-white/5 dark:text-white sm:text-sm" />
</div>
<div>
<label for="results" class="block text-sm font-medium text-gray-700 dark:text-gray-300">Nombre de resultats</label>
<input wire:model="results" type="number" id="results" min="1" max="100"
class="mt-1 block w-full rounded-lg border-gray-300 shadow-sm focus:border-primary-500 focus:ring-primary-500 dark:border-white/10 dark:bg-white/5 dark:text-white sm:text-sm" />
</div>
</div>
<div class="mt-4">
<x-filament::button wire:click="searchTiers" icon="heroicon-o-magnifying-glass">
Rechercher
</x-filament::button>
</div>
</div>
{{-- Resultats --}}
@if (count($data) > 0)
<div class="rounded-xl bg-white p-6 shadow-sm ring-1 ring-gray-950/5 dark:bg-gray-900 dark:ring-white/10">
<div class="flex items-center justify-between">
<h3 class="text-base font-semibold text-gray-950 dark:text-white">Resultats</h3>
@if ($metadata)
<span class="text-sm text-gray-500">{{ $metadata['rowcount'] ?? 0 }} resultat(s)</span>
@endif
</div>
<div class="mt-4 overflow-x-auto">
<table class="w-full text-left text-sm">
<thead class="border-b border-gray-200 dark:border-white/10">
<tr>
@foreach (array_keys(is_array(reset($data)) ? reset($data) : $data) as $key)
<th class="px-3 py-2 font-medium text-gray-500 dark:text-gray-400">{{ $key }}</th>
@endforeach
</tr>
</thead>
<tbody class="divide-y divide-gray-100 dark:divide-white/5">
@foreach ($data as $row)
<tr>
@foreach ((is_array($row) ? $row : [$row]) as $value)
<td class="px-3 py-2 text-gray-700 dark:text-gray-300">{{ is_array($value) ? json_encode($value) : $value }}</td>
@endforeach
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@endif
{{-- Historique des articles d'un tiers --}}
<div class="rounded-xl bg-white p-6 shadow-sm ring-1 ring-gray-950/5 dark:bg-gray-900 dark:ring-white/10">
<h3 class="text-base font-semibold text-gray-950 dark:text-white">Historique des articles d'un tiers</h3>
<div class="mt-4 flex items-end gap-4">
<div class="flex-1">
<label for="historyThirdId" class="block text-sm font-medium text-gray-700 dark:text-gray-300">Identifiant tiers (thirdid)</label>
<input wire:model="historyThirdId" type="text" id="historyThirdId" placeholder="Ex: CUST001"
class="mt-1 block w-full rounded-lg border-gray-300 shadow-sm focus:border-primary-500 focus:ring-primary-500 dark:border-white/10 dark:bg-white/5 dark:text-white sm:text-sm" />
</div>
<x-filament::button wire:click="getArtHistory" icon="heroicon-o-clock">
Voir l'historique
</x-filament::button>
</div>
@if (count($historyData) > 0)
<div class="mt-4 overflow-x-auto">
<pre class="rounded-lg bg-gray-50 p-4 text-sm text-gray-700 dark:bg-gray-800 dark:text-gray-300">{{ json_encode($historyData, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) }}</pre>
</div>
@endif
</div>
</x-filament-panels::page>