Update project dependencies and enhance documentation

- Added `barryvdh/laravel-dompdf` to `composer.json` for PDF generation capabilities.
- Updated `boost.json` to include `tailwindcss-development` in skills.
- Modified `package.json` and `package-lock.json` to upgrade Tailwind CSS and related packages.
- Improved README.md for clarity and corrected French language errors.
- Created design system documentation for Filament components.
- Added new Filament pages for Dashboard and Documentation with dynamic content loading.
- Enhanced TablesExplorer functionality with improved table and column management.
This commit is contained in:
2026-02-20 14:16:24 +01:00
parent 4aef33f270
commit 657c5ad5e3
46 changed files with 3318 additions and 857 deletions

View File

@@ -0,0 +1,19 @@
<?php
namespace App\Filament\Pages;
use Filament\Pages\Dashboard as BaseDashboard;
use Filament\Support\Icons\Heroicon;
class Dashboard extends BaseDashboard
{
protected static string|\BackedEnum|null $navigationIcon = Heroicon::OutlinedHome;
protected static ?string $navigationLabel = 'Accueil';
protected static ?string $title = 'API Logistics';
protected static ?int $navigationSort = 0;
protected string $view = 'filament.pages.dashboard';
}

View File

@@ -0,0 +1,47 @@
<?php
namespace App\Filament\Pages;
use Filament\Actions\Action;
use Filament\Pages\Page;
use Filament\Support\Icons\Heroicon;
use Illuminate\Support\Str;
class Documentation extends Page
{
protected static string|\BackedEnum|null $navigationIcon = Heroicon::OutlinedBookOpen;
protected static ?string $navigationLabel = 'Documentation';
protected static ?string $title = 'Documentation API';
protected static ?int $navigationSort = 0;
protected string $view = 'filament.pages.documentation';
public string $htmlContent = '';
public function mount(): void
{
$markdownPath = base_path('documentation/documentation_api_logistics.md');
$markdown = file_get_contents($markdownPath);
$this->htmlContent = Str::markdown($markdown);
}
public function getHeaderActions(): array
{
return [
Action::make('download')
->label('Télécharger en PDF')
->icon(Heroicon::OutlinedArrowDownTray)
->url(route('documentation.download-pdf'))
->openUrlInNewTab(),
Action::make('see_in_another_tab')
->label('Voir dans un nouvel onglet')
->icon(Heroicon::OutlinedArrowTopRightOnSquare)
->url(Documentation::getUrl())
->openUrlInNewTab(),
];
}
}

View File

@@ -23,24 +23,75 @@ class TablesExplorer extends Page
#[Url]
public string $selectedTable = '';
public string $tableFilter = '';
public array $tables = [];
public array $columns = [];
public ?array $tablesMetadata = null;
public ?array $columnsMetadata = null;
public ?string $errorMessage = null;
/**
* @var array<string, string>
*/
private static array $dataTypeLabels = [
'C' => 'Caractère',
'N' => 'Numérique',
'T' => 'Date/Heure',
'D' => 'Date',
'L' => 'Logique',
'M' => 'Mémo',
];
public function mount(): void
{
$this->loadTables();
if (filled($this->selectedTable)) {
$this->loadColumns();
}
}
public function loadTables(): void
public function selectTable(string $tableName): void
{
$this->selectedTable = $tableName;
$this->loadColumns();
}
/**
* @return array<int, array<string, mixed>>
*/
public function getFilteredTablesProperty(): array
{
if (blank($this->tableFilter)) {
return $this->tables;
}
$filter = mb_strtolower($this->tableFilter);
return array_values(array_filter(
$this->tables,
fn (array $table): bool => str_contains(mb_strtolower($table['name'] ?? ''), $filter),
));
}
public static function getDataTypeLabel(string $type): string
{
return self::$dataTypeLabels[strtoupper($type)] ?? $type;
}
private function loadTables(): void
{
try {
$service = app(LogisticsService::class);
$response = $service->tablesList();
$this->tables = $response['data'] ?? [];
$this->tablesMetadata = $response['metadata'] ?? null;
$this->errorMessage = $response['error'] ?? null;
} catch (LogisticsApiException $e) {
$this->errorMessage = $e->getMessage();
@@ -49,10 +100,11 @@ class TablesExplorer extends Page
}
}
public function loadColumns(): void
private function loadColumns(): void
{
if (blank($this->selectedTable)) {
$this->columns = [];
$this->columnsMetadata = null;
return;
}
@@ -61,12 +113,36 @@ class TablesExplorer extends Page
$service = app(LogisticsService::class);
$response = $service->columnList($this->selectedTable);
$this->columns = $response['data'] ?? [];
$rawColumns = $response['data'] ?? [];
$this->columns = $this->deduplicateColumns($rawColumns);
$this->columnsMetadata = $response['metadata'] ?? null;
$this->errorMessage = $response['error'] ?? null;
} catch (LogisticsApiException $e) {
$this->errorMessage = $e->getMessage();
$this->columns = [];
} catch (\Throwable $e) {
$this->errorMessage = "Erreur inattendue : {$e->getMessage()}";
$this->columns = [];
}
}
/**
* @param array<int, array<string, mixed>> $columns
* @return array<int, array<string, mixed>>
*/
private function deduplicateColumns(array $columns): array
{
$seen = [];
$unique = [];
foreach ($columns as $column) {
$key = ($column['name'] ?? '').'|'.($column['dataType'] ?? '');
if (! isset($seen[$key])) {
$seen[$key] = true;
$unique[] = $column;
}
}
return $unique;
}
}

View File

@@ -2,13 +2,12 @@
namespace App\Providers\Filament;
use App\Filament\Pages\Dashboard;
use Filament\Http\Middleware\DisableBladeIconComponents;
use Filament\Http\Middleware\DispatchServingFilamentEvent;
use Filament\Pages\Dashboard;
use Filament\Panel;
use Filament\PanelProvider;
use Filament\Support\Colors\Color;
use Filament\Widgets\FilamentInfoWidget;
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
use Illuminate\Cookie\Middleware\EncryptCookies;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
@@ -24,6 +23,7 @@ class AdminPanelProvider extends PanelProvider
->default()
->id('admin')
->path('admin')
->viteTheme('resources/css/filament/admin/theme.css')
->brandName('API Logistics')
->colors([
'primary' => Color::Blue,
@@ -34,9 +34,7 @@ class AdminPanelProvider extends PanelProvider
Dashboard::class,
])
->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\Filament\Widgets')
->widgets([
FilamentInfoWidget::class,
])
->widgets([])
->middleware([
EncryptCookies::class,
AddQueuedCookiesToResponse::class,