d2d.emegrendeles.hu/app/Filament/Resources/PricelistFiles/Schemas/PricelistFileInfolist.php
2026-03-07 06:31:34 +01:00

105 lines
5.4 KiB
PHP

<?php
namespace App\Filament\Resources\PricelistFiles\Schemas;
use App\Enums\PricelistFileStatusEnum;
use Filament\Schemas\Components\Section;
use Filament\Infolists\Components\TextEntry;
use Filament\Infolists\Components\RepeatableEntry;
use Filament\Schemas\Components\Grid;
use Filament\Schemas\Schema;
class PricelistFileInfolist
{
public static function configure(Schema $schema): Schema
{
return $schema
->components([
Section::make('Fájl információk')
->poll('5s')
->schema([
Grid::make(3)
->schema([
TextEntry::make('filename')
->label('Fájlnév')
->icon('heroicon-o-document-text')
->color('primary'),
TextEntry::make('supplier.name')
->label('Beszállító')
->icon('heroicon-o-user'),
TextEntry::make('status')
->label('Státusz')
->badge()
->formatStateUsing(fn (PricelistFileStatusEnum $state): string => $state->label())
->color(fn (PricelistFileStatusEnum $state): string => match ($state) {
PricelistFileStatusEnum::todo => 'gray',
PricelistFileStatusEnum::inprogress => 'info',
PricelistFileStatusEnum::done => 'success',
PricelistFileStatusEnum::fail => 'danger',
PricelistFileStatusEnum::waiting_for_approval => 'primary',
PricelistFileStatusEnum::closed => 'warning',
}),
]),
Grid::make(3)
->schema([
TextEntry::make('available_date')
->label('Életbelépés dátuma')
->date('Y.m.d'),
TextEntry::make('created_at')
->label('Feltöltés időpontja')
->dateTime('Y.m.d H:i'),
TextEntry::make('processing_current_step')
->label('Aktuális folyamat')
->weight('bold')
->color('info')
->formatStateUsing(fn ($state, $record) => "$state ({$record->processing_current_step_percentage}%)"),
]),
TextEntry::make('note')
->label('Megjegyzés')
->placeholder('Nincs megjegyzés')
->columnSpanFull(),
]),
Section::make('Feldolgozási folyamat (Workflow)')
->poll('5s')
->schema([
RepeatableEntry::make('workflow_steps')
->label(false)
->schema([
TextEntry::make('label')
->label('Lépés')
->weight('bold')
->inlineLabel(),
TextEntry::make('status')
->label('Állapot')
->badge()
->inlineLabel()
->formatStateUsing(fn (string $state): string => match ($state) {
'pending' => 'várakozik',
'inprogress' => 'folyamatban',
'completed' => 'kész',
'failed' => 'hiba',
default => $state,
})
->color(fn (string $state): string => match ($state) {
'pending' => 'gray',
'inprogress' => 'info',
'completed' => 'success',
'failed' => 'danger',
default => 'gray',
})
->icon(fn (string $state): string => match ($state) {
'pending' => 'heroicon-o-clock',
'inprogress' => 'heroicon-o-arrow-path',
'completed' => 'heroicon-o-check-circle',
'failed' => 'heroicon-o-x-circle',
default => 'heroicon-o-question-mark-circle',
}),
])
->columns(2)
->columnSpanFull(),
]),
]);
}
}