2022-08-07 12:48:05 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Filament\Resources\BiddersResource\RelationManagers;
|
|
|
|
|
|
|
|
use Filament\Forms;
|
|
|
|
use Filament\Resources\Form;
|
|
|
|
use Filament\Resources\RelationManagers\RelationManager;
|
|
|
|
use Filament\Resources\Table;
|
|
|
|
use Filament\Tables;
|
|
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
|
|
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
2023-03-16 13:07:06 -04:00
|
|
|
use App\Models\Bidders;
|
2022-08-07 12:48:05 -04:00
|
|
|
|
|
|
|
class WinningBidsRelationManager extends RelationManager
|
|
|
|
{
|
|
|
|
protected static string $relationship = 'winningBids';
|
|
|
|
|
|
|
|
protected static ?string $recordTitleAttribute = 'winning_bidder_num';
|
|
|
|
|
|
|
|
public static function form(Form $form): Form
|
|
|
|
{
|
|
|
|
return $form
|
|
|
|
->schema([
|
2023-03-16 13:07:06 -04:00
|
|
|
Forms\Components\Select::make('winning_bidder_num')
|
|
|
|
->label('Winning Bidder Number')
|
|
|
|
->options(Bidders::pluck('bidder_assigned_number', 'idbidders'))
|
|
|
|
->searchable(),
|
2022-08-07 12:48:05 -04:00
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function table(Table $table): Table
|
|
|
|
{
|
|
|
|
return $table
|
|
|
|
->columns([
|
2022-09-12 07:57:09 -04:00
|
|
|
Tables\Columns\TextColumn::make('items.item_assigned_num')
|
|
|
|
->label('Item Number')
|
|
|
|
->sortable(),
|
2023-03-16 13:07:06 -04:00
|
|
|
Tables\Columns\TextColumn::make('bidders.winning_bidder_num')
|
2022-09-12 07:57:09 -04:00
|
|
|
->label('Bidder Number')
|
|
|
|
->sortable(),
|
|
|
|
Tables\Columns\TextColumn::make('winning_cost')
|
|
|
|
->label('Winning Bid Amt')
|
|
|
|
->money('usd', 'true')
|
|
|
|
->sortable(),
|
|
|
|
|
2022-08-07 12:48:05 -04:00
|
|
|
])
|
|
|
|
->filters([
|
|
|
|
//
|
|
|
|
])
|
|
|
|
->headerActions([
|
|
|
|
Tables\Actions\CreateAction::make(),
|
|
|
|
])
|
|
|
|
->actions([
|
|
|
|
Tables\Actions\EditAction::make(),
|
|
|
|
Tables\Actions\DeleteAction::make(),
|
|
|
|
])
|
|
|
|
->bulkActions([
|
|
|
|
Tables\Actions\DeleteBulkAction::make(),
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|