<?php

namespace App\Filament\Resources\ClientInputResource\Widgets;

use App\Models\ClientInput;
use Closure;
use Filament\Tables;
use Filament\Widgets\TableWidget as BaseWidget;
use Illuminate\Database\Eloquent\Builder;

class LatestClientInputs extends BaseWidget
{
    protected function getTableQuery(): Builder
    {
        return ClientInput::query()->latest();
    }

    protected int | string | array $columnSpan = 'full';
    protected function getTableColumns(): array
    {
        return [
            Tables\Columns\TextColumn::make('postalCode.name')
                ->searchable()
                ->label('Code postal'),
            Tables\Columns\TextColumn::make('client.full_name')->searchable(),
            Tables\Columns\TextColumn::make('remarque')->searchable(),
            Tables\Columns\TextColumn::make('solution.name')->searchable(),
            Tables\Columns\TextColumn::make('created_at')
                ->dateTime(),
        ];
    }
}
