🎉 First commit
This commit is contained in:
85
resources/views/filament/pages/tables-explorer.blade.php
Normal file
85
resources/views/filament/pages/tables-explorer.blade.php
Normal file
@@ -0,0 +1,85 @@
|
||||
<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
|
||||
|
||||
<div class="grid grid-cols-1 gap-6 lg:grid-cols-2">
|
||||
{{-- Liste des tables --}}
|
||||
<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">Tables disponibles</h3>
|
||||
<p class="mt-1 text-sm text-gray-500 dark:text-gray-400">Cliquez sur une table pour voir ses colonnes.</p>
|
||||
|
||||
<div class="mt-4 space-y-1">
|
||||
@forelse ($tables as $table)
|
||||
<button
|
||||
wire:click="$set('selectedTable', '{{ is_array($table) ? ($table['name'] ?? $table['tablename'] ?? '') : $table }}')"
|
||||
wire:then="loadColumns"
|
||||
class="flex w-full items-center rounded-lg px-3 py-2 text-left text-sm transition hover:bg-gray-50 dark:hover:bg-white/5 {{ $selectedTable === (is_array($table) ? ($table['name'] ?? $table['tablename'] ?? '') : $table) ? 'bg-primary-50 text-primary-600 dark:bg-primary-400/10 dark:text-primary-400' : 'text-gray-700 dark:text-gray-300' }}"
|
||||
>
|
||||
<x-filament::icon icon="heroicon-o-table-cells" class="mr-2 h-4 w-4" />
|
||||
{{ is_array($table) ? ($table['name'] ?? $table['tablename'] ?? json_encode($table)) : $table }}
|
||||
</button>
|
||||
@empty
|
||||
<p class="py-4 text-center text-sm text-gray-500">Aucune table trouvee. Verifiez votre cle API.</p>
|
||||
@endforelse
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- Colonnes de la table selectionnee --}}
|
||||
<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">
|
||||
Colonnes
|
||||
@if ($selectedTable)
|
||||
<span class="text-primary-600 dark:text-primary-400">: {{ $selectedTable }}</span>
|
||||
@endif
|
||||
</h3>
|
||||
|
||||
@if ($selectedTable)
|
||||
<div class="mt-4">
|
||||
<div wire:loading wire:target="loadColumns" class="py-8 text-center text-sm text-gray-500">
|
||||
Chargement...
|
||||
</div>
|
||||
|
||||
<div wire:loading.remove wire:target="loadColumns">
|
||||
@if (count($columns) > 0)
|
||||
<div class="overflow-x-auto">
|
||||
<table class="w-full text-left text-sm">
|
||||
<thead class="border-b border-gray-200 dark:border-white/10">
|
||||
<tr>
|
||||
@if (is_array(reset($columns)))
|
||||
@foreach (array_keys(reset($columns)) as $key)
|
||||
<th class="px-3 py-2 font-medium text-gray-500 dark:text-gray-400">{{ $key }}</th>
|
||||
@endforeach
|
||||
@else
|
||||
<th class="px-3 py-2 font-medium text-gray-500 dark:text-gray-400">Colonne</th>
|
||||
@endif
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-100 dark:divide-white/5">
|
||||
@foreach ($columns as $column)
|
||||
<tr>
|
||||
@if (is_array($column))
|
||||
@foreach ($column as $value)
|
||||
<td class="px-3 py-2 text-gray-700 dark:text-gray-300">{{ is_array($value) ? json_encode($value) : $value }}</td>
|
||||
@endforeach
|
||||
@else
|
||||
<td class="px-3 py-2 text-gray-700 dark:text-gray-300">{{ $column }}</td>
|
||||
@endif
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@else
|
||||
<p class="py-4 text-center text-sm text-gray-500">Aucune colonne trouvee.</p>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@else
|
||||
<p class="mt-4 text-sm text-gray-500 dark:text-gray-400">Selectionnez une table pour afficher ses colonnes.</p>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</x-filament-panels::page>
|
||||
Reference in New Issue
Block a user