Make allocations mobile friendly

This commit is contained in:
Charles 2024-04-19 10:18:51 -04:00
parent ee142a26b0
commit 82c294ab63

View File

@ -51,32 +51,21 @@ class EditNode extends EditRecord
]),
Tabs\Tab::make('Allocations')
->icon('tabler-plug-connected')
->columns(4)
->columns([
'default' => 1,
'sm' => 2,
'md' => 4,
])
->schema([
Forms\Components\Repeater::make('allocations')
->orderColumn('server_id')
->columnSpan(1)
->columns(4)
->relationship()
->addActionLabel('Create New Allocation')
->addAction(fn ($action) => $action->color('info'))
->schema([
Forms\Components\TextInput::make('ip')
->label('IP Address'),
Forms\Components\TextInput::make('ip_alias')
->label('Alias'),
Forms\Components\TextInput::make('port')
->minValue(0)
->maxValue(65535)
->numeric(),
Forms\Components\TextInput::make('server')
->formatStateUsing(fn (Allocation $allocation) => $allocation->server?->name)
->readOnly()
->placeholder('No Server'),
]),
Forms\Components\Section::make('Assign New Allocations')
->columnSpan(2)
->inlineLabel()
Forms\Components\Section::make('Create Allocation')
->columnSpan(4)
->columns([
'default' => 1,
'sm' => 2,
'md' => 4,
'lg' => 5,
])
//->inlineLabel()
->headerActions([
Forms\Components\Actions\Action::make('submit')
->color('success')
@ -86,22 +75,91 @@ class EditNode extends EditRecord
])
->schema([
Forms\Components\TextInput::make('ip')
->columnSpan([
'default' => 1,
'sm' => 1,
'md' => 2,
'lg' => 2,
])
->label('IP Address')
->placeholder('0.0.0.0')
->helperText('IP address to assign ports to')
->columnSpanFull(),
Forms\Components\TextInput::make('ip_alias')
->label('Alias')
->placeholder('minecraft')
->helperText('Display name to help you remember')
->columnSpanFull(),
Forms\Components\TextInput::make('ports')
->label('Ports')
->placeholder('x.x.x.x')
->helperText('IP address to assign ports to'),
Forms\Components\TagsInput::make('port')
->columnSpan([
'default' => 1,
'sm' => 1,
'md' => 1,
'lg' => 1,
])
->placeholder('25565')
->helperText('Individual ports or port ranges here separated by commas or spaces')
->columnSpanFull(),
->helperText('Individual ports or port ranges here separated by spaces')
->splitKeys(['Tab', ' ']),
Forms\Components\TextInput::make('ip_alias')
->columnSpan([
'default' => 1,
'sm' => 2,
'md' => 1,
'lg' => 2,
])
->label('Alias')
->placeholder('minecraft.pelican.dev')
->helperText('Display name to help you remember.'),
]),
Forms\Components\Repeater::make('allocations')
->orderColumn('server_id')
->columnSpan(4)
->columns([
'default' => 1,
'sm' => 3,
'md' => 4,
'lg' => 9,
])
->relationship()
->addActionLabel('Create New Allocation')
->addAction(fn ($action) => $action->color('info'))
->schema([
Forms\Components\TextInput::make('ip')
->label('IP Address')
->placeholder('x.x.x.x')
->columnSpan([
'default' => 1,
'sm' => 2,
'md' => 3,
'lg' => 2,
]),
Forms\Components\TextInput::make('port')
->placeholder('25565')
->columnSpan([
'default' => 1,
'sm' => 1,
'md' => 1,
'lg' => 1,
])
->minValue(0)
->maxValue(65535)
->numeric(),
Forms\Components\TextInput::make('ip_alias')
->placeholder('mincraft.pelican.dev')
->columnSpan([
'default' => 1,
'sm' => 2,
'md' => 2,
'lg' => 3,
])
->label('Alias'),
Forms\Components\TextInput::make('server')
->columnSpan([
'default' => 1,
'sm' => 1,
'md' => 2,
'lg' => 3,
])
->formatStateUsing(fn (Allocation $allocation) => $allocation->server?->name)
->activeUrl(true)
->placeholder('Not assigned'),
]),
]),
]),
]);
}