Make this form look nicer

This commit is contained in:
Lance Pioch 2024-04-28 17:43:15 -04:00
parent 36b7998714
commit b0dadc60f2

View File

@ -15,6 +15,7 @@ use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Validator; use Illuminate\Support\Facades\Validator;
use Closure; use Closure;
use Filament\Forms; use Filament\Forms;
use Illuminate\Support\HtmlString;
class CreateServer extends CreateRecord class CreateServer extends CreateRecord
{ {
@ -119,26 +120,30 @@ class CreateServer extends CreateRecord
Forms\Components\TextInput::make('allocation_ip') Forms\Components\TextInput::make('allocation_ip')
->datalist(Node::find($get('node_id'))?->ipAddresses() ?? []) ->datalist(Node::find($get('node_id'))?->ipAddresses() ?? [])
->label('IP Address') ->label('IP Address')
->inlineLabel()
->ipv4() ->ipv4()
->helperText("Usually your machine's public IP unless you are port forwarding.") ->helperText("Usually your machine's public IP unless you are port forwarding.")
// ->selectablePlaceholder(false) // ->selectablePlaceholder(false)
->required(), ->required(),
Forms\Components\TextInput::make('allocation_alias') Forms\Components\TextInput::make('allocation_alias')
->label('Alias') ->label('Alias')
->inlineLabel()
->default(null) ->default(null)
->datalist([ ->datalist([
$get('name'), $get('name'),
Egg::find($get('egg_id'))?->name, Egg::find($get('egg_id'))?->name,
]) ])
->helperText('This is just a display only name to help you recognize what this Allocation is used for.') ->helperText('Optional display name to help you remember what these are.')
->required(false), ->required(false),
Forms\Components\TagsInput::make('allocation_ports') Forms\Components\TagsInput::make('allocation_ports')
->placeholder('Examples: 27015, 27017-27019') ->placeholder('Examples: 27015, 27017-27019')
->helperText(' ->helperText(new HtmlString('
These are the ports that users can connect to this Server through. These are the ports that users can connect to this Server through.
They usually consist of the port forwarded ones. <br />
') You would have to port forward these on your home network.
'))
->label('Ports') ->label('Ports')
->inlineLabel()
->live() ->live()
->afterStateUpdated(function ($state, Forms\Set $set) { ->afterStateUpdated(function ($state, Forms\Set $set) {
$ports = collect(); $ports = collect();
@ -555,8 +560,4 @@ class CreateServer extends CreateRecord
return $service->handle($data); return $service->handle($data);
} }
// protected function getRedirectUrl(): string
// {
// return $this->getResource()::getUrl('edit');
// }
} }