138 lines
8.3 KiB
PHP
138 lines
8.3 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(null)
|
|
->poll('5s')
|
|
->schema([
|
|
Section::make('Fájl információk')
|
|
->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('Előfeldolgozás eredménye')
|
|
->schema([
|
|
Grid::make(4)->schema([
|
|
TextEntry::make('file_meta.preprocess.statistics.data_rows')
|
|
->label('Adatsorok')
|
|
->icon('heroicon-o-table-cells'),
|
|
TextEntry::make('file_meta.preprocess.statistics.column_count')
|
|
->label('Oszlopok száma'),
|
|
TextEntry::make('file_meta.preprocess.file_info.file_size_human')
|
|
->label('Fájlméret'),
|
|
TextEntry::make('file_meta.preprocess.duration_seconds')
|
|
->label('Feldolgozási idő')
|
|
->suffix(' mp'),
|
|
]),
|
|
RepeatableEntry::make('file_meta.preprocess.warnings')
|
|
->label('Figyelmeztetések')
|
|
->schema([
|
|
TextEntry::make('message')->label('Leírás')->color('warning'),
|
|
TextEntry::make('severity')->label('Súlyosság')->badge()->color('warning'),
|
|
])
|
|
->visible(fn ($record) => !empty($record->file_meta['preprocess']['warnings'] ?? [])),
|
|
RepeatableEntry::make('file_meta.preprocess.errors')
|
|
->label('Hibák')
|
|
->schema([
|
|
TextEntry::make('message')->label('Leírás')->color('danger'),
|
|
TextEntry::make('severity')->label('Súlyosság')->badge()->color('danger'),
|
|
])
|
|
->visible(fn ($record) => !empty($record->file_meta['preprocess']['errors'] ?? [])),
|
|
])
|
|
->visible(fn ($record) => !empty($record->file_meta['preprocess'] ?? [])),
|
|
|
|
Section::make('Feldolgozási folyamat (Workflow)')
|
|
->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(),
|
|
]),
|
|
]),
|
|
]);
|
|
}
|
|
}
|