I am building a seat reservation system for a small company. im using filament and laravel for this project. im using filament resource for this project. basically i am stuck at booking reservation form. in my form i have couple of fields
- select route
- departure date i want employee to select departure date and click a button to check availability and have the system display the available seat for the selected date, like wise for the arrival date also and finally can submit the booking request form. i will past my code of booking resource, please help me to figure this out.
namespace App\Filament\Resources;
use livewire;
use Filament\Forms;
use Filament\Tables;
use Livewire\Component;
use App\Models\BoatPass;
use Filament\Resources\Form;
use Filament\Resources\Table;
use Filament\Resources\Resource;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\DatePicker;
use Illuminate\Database\Eloquent\Builder;
use Filament\Forms\Components\DateTimePicker;
use App\Filament\Resources\BoatPassResource\Pages;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use App\Filament\Resources\BoatPassResource\RelationManagers;
class BoatPassResource extends Resource
{
protected static ?string $model = BoatPass::class;
protected static ?string $navigationIcon = 'heroicon-o-collection';
public static function form(Form $form): Form
{
return $form
->schema([
//
Select::make('route_id')
->rules(['exists:route,id'])
->required()
->relationship('route', 'name')
->searchable()
->placeholder('Route')
->columnSpan([]),
//----------------
DateTimePicker::make('departure_date')
->rules(['date'])
->required()
->placeholder('Departure Date Time')
->withoutTime()
->reactive()
->columnSpan([ ]),
//-----------------------
DateTimePicker::make('arrival_date')
->rules(['date'])
->required()
->placeholder('Departure Date Time')
->withoutTime()
->reactive()
->columnSpan([ ]),
//---------------------------
Select::make('leave_type')
->rules(['in:off_day,vacation,emergency'])
->required()
->searchable()
->options([
'off_day' => 'Off day',
'vacation' => 'Vacation',
'emergency' => 'Emergency',
])
->placeholder('Leave Type')
->columnSpan([]),
//-----------------------------
TextInput::make('Approval Status')->disabled()
->default('Pending'),
]);
}