<?php

namespace App\Filament\Resources\Appendices\Tables;

use Filament\Tables;
use Filament\Tables\Table;

class AppendicesTable
{
    public static function configure(Table $table): Table
    {
        return $table
            ->columns([
                Tables\Columns\TextColumn::make('contract.contract_number')
                    ->label('Hợp đồng')
                    ->searchable()
                    ->sortable(),

                Tables\Columns\TextColumn::make('product.code')
                    ->label('Sản phẩm')
                    ->searchable(),

                Tables\Columns\TextColumn::make('type')
                    ->label('Loại phụ lục')
                    ->badge(),

                Tables\Columns\TextColumn::make('apply_from_order')
                    ->label('Từ CN')
                    ->alignCenter(),

                Tables\Columns\TextColumn::make('signing_date')
                    ->label('Ngày ký')
                    ->date('d/m/Y')
                    ->sortable(),
            ])
            ->defaultSort('signing_date', 'desc');
    }
}
