<?php

namespace App\Filament\Tenant\Resources\OnlineOrderResource\RelationManagers;

use Filament\Resources\RelationManagers\RelationManager;
use Filament\Tables;
use Filament\Tables\Table;

class ItemsRelationManager extends RelationManager
{
    protected static string $relationship = 'items';

    protected static ?string $title = 'Produse';

    public function table(Table $table): Table
    {
        return $table
            ->recordTitleAttribute('name')
            ->columns([
                Tables\Columns\TextColumn::make('name')->label('Piesă')->wrap(),
                Tables\Columns\TextColumn::make('article')->label('Cod')->placeholder('—'),
                Tables\Columns\TextColumn::make('qty')->label('Cant.')->alignRight(),
                Tables\Columns\TextColumn::make('price')->label('Preț')->money('MDL')->alignRight(),
                Tables\Columns\TextColumn::make('total')->money('MDL')->alignRight(),
                Tables\Columns\IconColumn::make('fulfilled')->label('Onorat')->boolean(),
            ]);
    }
}
