60 lines
1.7 KiB
PHP
60 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\ApprovalWorkflows\RelationManagers;
|
|
|
|
use Filament\Actions\CreateAction;
|
|
use Filament\Actions\DeleteAction;
|
|
use Filament\Actions\EditAction;
|
|
use Filament\Forms\Components\Select;
|
|
use Filament\Forms\Components\TextInput;
|
|
use Filament\Resources\RelationManagers\RelationManager;
|
|
use Filament\Schemas\Schema;
|
|
use Filament\Tables\Columns\TextColumn;
|
|
use Filament\Tables\Table;
|
|
|
|
class StepsRelationManager extends RelationManager
|
|
{
|
|
protected static string $relationship = 'steps';
|
|
|
|
public function form(Schema $schema): Schema
|
|
{
|
|
return $schema
|
|
->components([
|
|
TextInput::make('order')
|
|
->required()
|
|
->numeric()
|
|
->minValue(1),
|
|
|
|
TextInput::make('name')
|
|
->required()
|
|
->maxLength(255),
|
|
|
|
Select::make('role')
|
|
->required()
|
|
->options([
|
|
'travel_approver' => 'Travel Approver',
|
|
'administrator' => 'Administrator',
|
|
]),
|
|
]);
|
|
}
|
|
|
|
public function table(Table $table): Table
|
|
{
|
|
return $table
|
|
->recordTitleAttribute('name')
|
|
->columns([
|
|
TextColumn::make('order')->sortable(),
|
|
TextColumn::make('name'),
|
|
TextColumn::make('role'),
|
|
])
|
|
->defaultSort('order')
|
|
->headerActions([
|
|
CreateAction::make(),
|
|
])
|
|
->recordActions([
|
|
EditAction::make(),
|
|
DeleteAction::make(),
|
|
]);
|
|
}
|
|
}
|