From a13c9be41cfbc7a31dd03142e691360359230704 Mon Sep 17 00:00:00 2001 From: Russ Long Date: Wed, 28 Sep 2022 07:52:27 -0400 Subject: [PATCH] more resource setup --- .../VehiclesRelationManager.php | 14 ++++++++--- app/Filament/Resources/CheckoutResource.php | 25 ++++++++++++++++++- .../BiddersRelationManager.php | 19 +++++++++++--- app/Models/Checkout.php | 2 +- 4 files changed, 52 insertions(+), 8 deletions(-) diff --git a/app/Filament/Resources/BiddersResource/RelationManagers/VehiclesRelationManager.php b/app/Filament/Resources/BiddersResource/RelationManagers/VehiclesRelationManager.php index f7bd0fa..998faee 100644 --- a/app/Filament/Resources/BiddersResource/RelationManagers/VehiclesRelationManager.php +++ b/app/Filament/Resources/BiddersResource/RelationManagers/VehiclesRelationManager.php @@ -9,6 +9,7 @@ use Filament\Resources\Table; use Filament\Tables; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\SoftDeletingScope; +use App\Models\CarShowCategory; class VehiclesRelationManager extends RelationManager { @@ -20,9 +21,16 @@ class VehiclesRelationManager extends RelationManager { return $form ->schema([ - Forms\Components\TextInput::make('owner') - ->required() - ->maxLength(255), + Forms\Components\TextInput::make('year') + ->label('Year'), + Forms\Components\TextInput::make('make') + ->label('Make'), + Forms\Components\TextInput::make('model') + ->label('Model'), + Forms\Components\Select::make('type') + ->label('Type') + ->options(CarShowCategory::vehtype()->pluck('category_name', 'id')) + ->searchable(), ]); } diff --git a/app/Filament/Resources/CheckoutResource.php b/app/Filament/Resources/CheckoutResource.php index a3bb0ea..235028a 100644 --- a/app/Filament/Resources/CheckoutResource.php +++ b/app/Filament/Resources/CheckoutResource.php @@ -15,7 +15,10 @@ use Illuminate\Database\Eloquent\SoftDeletingScope; use Filament\Tables\Columns\BooleanColumn; use Filament\Tables\Columns\TextColumn; use Filament\Forms\Components\TextInput; +use Filament\Forms\Components\Select; use Filament\Forms\Components\Toggle; +use App\Models\Bidders; +use App\Models\PaymentMethods; class CheckoutResource extends Resource { @@ -29,7 +32,27 @@ class CheckoutResource extends Resource { return $form ->schema([ - // + Select::make('bidder_num') + ->label('Bidder') + ->options( + Bidders::orderBy('bidder_assigned_number') + ->pluck('bidder_assigned_number', 'idbidders') + ) + ->searchable(), + TextInput::make('winnertotal') + ->label('Total Amount') + ->mask( + fn (TextInput\Mask $mask) => $mask->money( + prefix: '$', + thousandsSeparator: ',', + decimalPlaces: 2, + isSigned: false + ) + ), + Select::make('payment_method') + ->label('Payment Method') + ->options(PaymentMethods::all()->pluck('pm_name', 'pm_id')) + ->searchable(), ]); } diff --git a/app/Filament/Resources/CheckoutResource/RelationManagers/BiddersRelationManager.php b/app/Filament/Resources/CheckoutResource/RelationManagers/BiddersRelationManager.php index 1f8ee3b..e67facf 100644 --- a/app/Filament/Resources/CheckoutResource/RelationManagers/BiddersRelationManager.php +++ b/app/Filament/Resources/CheckoutResource/RelationManagers/BiddersRelationManager.php @@ -20,9 +20,20 @@ class BiddersRelationManager extends RelationManager { return $form ->schema([ - Forms\Components\TextInput::make('bidder_num') + Forms\Components\Select::make('bidder_num') + ->label('Number') ->required() - ->maxLength(255), + ->createOptionForm([ + Forms\Components\TextInput::make('bidder_fname')->label('First Name'), + Forms\Components\TextInput::make('bidder_lname')->label('Last Name'), + Forms\Components\TextInput::make('bidder_addr')->label('Address'), + Forms\Components\TextInput::make('bidder_city')->label('City'), + Forms\Components\TextInput::make('bidder_state')->label('State'), + Forms\Components\TextInput::make('bidder_zip')->label('Zip'), + Forms\Components\TextInput::make('bidder_phone')->label('Phone Number'), + Forms\Components\TextInput::make('bidder_email')->label('Email'), + Forms\Components\TextInput::make('bidder_assigned_number')->label('Assigned Number'), + ]), ]); } @@ -30,7 +41,9 @@ class BiddersRelationManager extends RelationManager { return $table ->columns([ - Tables\Columns\TextColumn::make('bidder_num'), + Tables\Columns\TextColumn::make('bidder_fname')->label('First Name'), + Tables\Columns\TextColumn::make('bidder_lname')->label('Last Name'), + Tables\Columns\TextColumn::make('bidder_assigned_number')->label('Number'), ]) ->filters([ // diff --git a/app/Models/Checkout.php b/app/Models/Checkout.php index 38bbfbf..73c239a 100644 --- a/app/Models/Checkout.php +++ b/app/Models/Checkout.php @@ -28,7 +28,7 @@ class Checkout extends Model public function bidders() { - return $this->belongsTo(Bidders::class, 'bidder_num'); + return $this->belongsTo(Bidders::class, 'bidder_num', 'idbidders'); } public function paymentMethod()