Files
jabali-panel/app/Filament/Admin/Resources/HostingPackages/Schemas/HostingPackageForm.php
2026-01-27 23:38:27 +02:00

88 lines
3.6 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Filament\Admin\Resources\HostingPackages\Schemas;
use Filament\Forms\Components\Textarea;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Toggle;
use Filament\Schemas\Components\Section;
use Filament\Schemas\Schema;
class HostingPackageForm
{
public static function configure(Schema $schema): Schema
{
return $schema
->columns(1)
->components([
Section::make(__('Package Details'))
->schema([
TextInput::make('name')
->label(__('Name'))
->required()
->maxLength(120)
->unique(ignoreRecord: true),
Textarea::make('description')
->label(__('Description'))
->rows(3)
->columnSpanFull(),
Toggle::make('is_active')
->label(__('Active'))
->default(true),
])
->columns(2),
Section::make(__('Resource Limits'))
->description(__('Leave blank for unlimited.'))
->schema([
TextInput::make('disk_quota_mb')
->label(__('Disk Quota (MB)'))
->numeric()
->minValue(0)
->helperText(__('Example: 10240 = 10 GB')),
TextInput::make('bandwidth_gb')
->label(__('Bandwidth (GB / month)'))
->numeric()
->minValue(0),
TextInput::make('domains_limit')
->label(__('Domains Limit'))
->numeric()
->minValue(0),
TextInput::make('databases_limit')
->label(__('Databases Limit'))
->numeric()
->minValue(0),
TextInput::make('mailboxes_limit')
->label(__('Mailboxes Limit'))
->numeric()
->minValue(0),
])
->columns(2),
Section::make(__('System Resource Limits'))
->description(__('Optional cgroup limits applied to users in this package. Leave blank for unlimited.'))
->schema([
TextInput::make('cpu_limit_percent')
->label(__('CPU Limit (%)'))
->numeric()
->minValue(0)
->maxValue(100)
->helperText(__('Example: 50 = 50% CPU quota')),
TextInput::make('memory_limit_mb')
->label(__('Memory Limit (MB)'))
->numeric()
->minValue(0)
->helperText(__('Example: 1024 = 1 GB RAM')),
TextInput::make('io_limit_mb')
->label(__('Disk IO Limit (MB/s)'))
->numeric()
->minValue(0)
->helperText(__('Applied to read/write bandwidth')),
])
->columns(2),
]);
}
}