2022-08-06 15:39:24 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Filament\Resources;
|
|
|
|
|
|
|
|
use App\Filament\Resources\WinningBidsResource\Pages;
|
|
|
|
use App\Filament\Resources\WinningBidsResource\RelationManagers;
|
|
|
|
use App\Models\WinningBids;
|
|
|
|
use Filament\Forms;
|
|
|
|
use Filament\Resources\Form;
|
|
|
|
use Filament\Resources\Resource;
|
|
|
|
use Filament\Resources\Table;
|
|
|
|
use Filament\Tables;
|
|
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
|
|
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
2022-08-07 12:48:05 -04:00
|
|
|
use Filament\Tables\Columns\BooleanColumn;
|
|
|
|
use Filament\Tables\Columns\TextColumn;
|
|
|
|
use Filament\Forms\Components\TextInput;
|
|
|
|
use Filament\Forms\Components\Toggle;
|
2022-09-12 07:57:09 -04:00
|
|
|
use App\Models\Bidders;
|
|
|
|
use App\Models\Items;
|
|
|
|
use Filament\Forms\Components\Select;
|
|
|
|
|
|
|
|
use function Ramsey\Uuid\v1;
|
2022-08-06 15:39:24 -04:00
|
|
|
|
|
|
|
class WinningBidsResource extends Resource
|
|
|
|
{
|
|
|
|
protected static ?string $model = WinningBids::class;
|
|
|
|
|
|
|
|
protected static ?string $navigationIcon = 'heroicon-o-collection';
|
|
|
|
|
2022-08-07 13:07:31 -04:00
|
|
|
protected static ?string $navigationGroup = 'Silent Auction';
|
|
|
|
|
2022-08-06 15:39:24 -04:00
|
|
|
public static function form(Form $form): Form
|
|
|
|
{
|
|
|
|
return $form
|
|
|
|
->schema([
|
2022-09-12 07:57:09 -04:00
|
|
|
Select::make('winning_item_num')
|
|
|
|
->label('Item')
|
|
|
|
->options(Items::orderBy('item_assigned_num')->pluck('item_assigned_num', 'iditems'))
|
|
|
|
->searchable(),
|
|
|
|
Select::make('winning_bidder_num')
|
|
|
|
->label('Bidder')
|
|
|
|
->options(Bidders::all()->pluck('bidder_assigned_number', 'idbidders'))
|
|
|
|
->searchable(),
|
|
|
|
TextInput::make('winning_cost')
|
|
|
|
->label('Winning Bid'),
|
2022-08-06 15:39:24 -04:00
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function table(Table $table): Table
|
|
|
|
{
|
|
|
|
return $table
|
|
|
|
->columns([
|
2022-09-12 07:57:09 -04:00
|
|
|
TextColumn::make('items.item_assigned_num')
|
|
|
|
->label('Item Number')
|
|
|
|
->sortable(),
|
|
|
|
TextColumn::make('bidders.bidder_assigned_number')
|
|
|
|
->label('Bidder Number')
|
|
|
|
->sortable(),
|
|
|
|
TextColumn::make('winning_cost')
|
|
|
|
->label('Winning Bid Amt')
|
|
|
|
->money('usd', 'true')
|
|
|
|
->sortable(),
|
2022-08-06 15:39:24 -04:00
|
|
|
])
|
|
|
|
->filters([
|
|
|
|
//
|
|
|
|
])
|
|
|
|
->actions([
|
|
|
|
Tables\Actions\EditAction::make(),
|
|
|
|
])
|
|
|
|
->bulkActions([
|
|
|
|
Tables\Actions\DeleteBulkAction::make(),
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function getRelations(): array
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
//
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function getPages(): array
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'index' => Pages\ListWinningBids::route('/'),
|
|
|
|
'create' => Pages\CreateWinningBids::route('/create'),
|
|
|
|
'edit' => Pages\EditWinningBids::route('/{record}/edit'),
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|