Files
kreios/backoffice/app/Filament/Resources/PreventivoResource/RelationManagers/ItemsRelationManager.php
T
carmine.savino 1e352eb2ef feat: Implement price list management and import functionality
- Added ListinoRelationManager for managing price lists associated with models.
- Introduced ImportaListiniAction for importing price lists from Excel files.
- Created ListinoPrezzo model to represent price entries in the database.
- Developed ListinoExcelParser for parsing Excel files containing price lists.
- Implemented ListinoImporter to handle the import logic and associations.
- Added migration for creating listino_prezzi table and converting measures to mm.
- Updated frontend logic to handle new price list features and validations.
- Enhanced tests for price list import and conversion functionalities.
2026-10-19 16:51:24 +02:00

58 lines
2.5 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace App\Filament\Resources\PreventivoResource\RelationManagers;
use App\Support\ConfigurazioneFormatter;
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Model;
class ItemsRelationManager extends RelationManager
{
protected static string $relationship = 'items';
protected static ?string $title = 'Prodotti configurati';
protected static ?string $modelLabel = 'prodotto';
public function table(Table $table): Table
{
return $table
->recordTitleAttribute('nome_modello')
->columns([
Tables\Columns\ImageColumn::make('immagine_path')
->label('Anteprima')
->disk('public')
->height(60)
->square(),
Tables\Columns\TextColumn::make('nome_modello')
->label('Modello')
->description(fn (Model $record) => trim(($record->sistema ? ucfirst($record->sistema) : '').' '.($record->type ?? ''))),
Tables\Columns\TextColumn::make('dimensioni')
->label('Dimensioni')
->state(fn (Model $record) => $record->larghezza && $record->altezza
? "{$record->larghezza} × {$record->altezza} mm" : '—'),
Tables\Columns\TextColumn::make('quantita')->label('Q.tà'),
Tables\Columns\TextColumn::make('prezzo_unitario')->label('Prezzo un.')->money('EUR'),
Tables\Columns\TextColumn::make('prezzo_totale')->label('Totale')->money('EUR'),
])
->actions([
Tables\Actions\ViewAction::make()
->infolist(fn ($infolist) => $infolist->schema([
\Filament\Infolists\Components\ImageEntry::make('immagine_path')
->label('Anteprima')
->disk('public')
->height(220),
\Filament\Infolists\Components\KeyValueEntry::make('configurazione_display')
->label('Configurazione selezionata')
->state(fn (Model $record) => collect(ConfigurazioneFormatter::toRows($record->payload))
->mapWithKeys(fn ($row) => [$row['label'] => $row['value']])
->all())
->columnSpanFull(),
])),
])
->paginated(false);
}
}