silent-auction/app/Filament/Resources/BiddersResource.php
2023-03-16 13:45:31 -04:00

89 lines
3.2 KiB
PHP

<?php
namespace App\Filament\Resources;
use App\Filament\Resources\BiddersResource\Pages;
use App\Filament\Resources\BiddersResource\RelationManagers;
use App\Models\Bidders;
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;
use Filament\Tables\Columns\TextColumn;
use Filament\Forms\Components\TextInput;
class BiddersResource extends Resource
{
protected static ?string $model = Bidders::class;
protected static ?string $recordTitleAttribute = 'idbidders';
protected static ?string $navigationIcon = 'heroicon-o-collection';
protected static ?string $navigationGroup = 'Silent Auction';
public static function form(Form $form): Form
{
return $form
->schema([
TextInput::make('bidder_fname')->label('First Name'),
TextInput::make('bidder_lname')->label('Last Name'),
TextInput::make('bidder_addr')->label('Address'),
TextInput::make('bidder_city')->label('City'),
TextInput::make('bidder_state')->label('State'),
TextInput::make('bidder_zip')->label('Zip'),
TextInput::make('bidder_phone')->label('Phone Number')
->mask(fn (TextInput\Mask $mask) => $mask->pattern('(000)000-0000')),
TextInput::make('bidder_email')->label('Email'),
TextInput::make('bidder_assigned_number')->label('Assigned Number'),
]);
}
public static function table(Table $table): Table
{
return $table
->columns([
TextColumn::make('bidder_assigned_number')->sortable()->label('Assigned Number'),
TextColumn::make('bidder_fname')->sortable()->label('First Name'),
TextColumn::make('bidder_lname')->sortable()->label('Last Name'),
TextColumn::make('bidder_addr')->label('Address'),
TextColumn::make('bidder_city')->label('City'),
TextColumn::make('bidder_state')->label('State'),
TextColumn::make('bidder_zip')->label('Zip'),
TextColumn::make('bidder_phone')->label('Phone Number'),
TextColumn::make('bidder_email')->label('Email'),
])
->filters([
//
])
->actions([
Tables\Actions\EditAction::make(),
])
->bulkActions([
Tables\Actions\DeleteBulkAction::make(),
])
->defaultSort('bidder_assigned_number');
}
public static function getRelations(): array
{
return [
RelationManagers\VehiclesRelationManager::class,
RelationManagers\CheckoutRelationManager::class,
RelationManagers\WinningBidsRelationManager::class,
];
}
public static function getPages(): array
{
return [
'index' => Pages\ListBidders::route('/'),
'create' => Pages\CreateBidders::route('/create'),
'edit' => Pages\EditBidders::route('/{record}/edit'),
];
}
}