96 lines
4.1 KiB
PHP
96 lines
4.1 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Pages;
|
|
|
|
use BackedEnum;
|
|
use Filament\Forms\Components\Checkbox;
|
|
use Filament\Forms\Components\Select;
|
|
use Filament\Forms\Components\TextInput;
|
|
use Filament\Schemas\Components\Section;
|
|
use Filament\Schemas\Schema;
|
|
use Filament\Support\Icons\Heroicon;
|
|
use Inerba\DbConfig\AbstractPageSettings;
|
|
|
|
class ImapSettings extends AbstractPageSettings
|
|
{
|
|
/**
|
|
* @var array<string, mixed> | null
|
|
*/
|
|
public ?array $data = [];
|
|
|
|
protected static ?string $title = 'Imap Settings';
|
|
|
|
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedEnvelope; // Uncomment if you want to set a custom navigation icon
|
|
|
|
// protected ?string $subheading = ''; // Uncomment if you want to set a custom subheading
|
|
|
|
// protected static ?string $slug = 'imap-settings'; // Uncomment if you want to set a custom slug
|
|
|
|
protected string $view = 'filament.pages.imap-settings';
|
|
|
|
protected function settingName(): string
|
|
{
|
|
return 'imap';
|
|
}
|
|
|
|
/**
|
|
* Provide default values.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function getDefaultData(): array
|
|
{
|
|
return [
|
|
'public.default_account' => 'default',
|
|
'public.protocol' => 'imap',
|
|
'premium.default_email' => 'default',
|
|
'premium.protocol' => 'imap',
|
|
];
|
|
}
|
|
|
|
public function form(Schema $schema): Schema
|
|
{
|
|
return $schema
|
|
->components([
|
|
Section::make('Public Mailbox Imap')
|
|
->description('Enter your imap server')
|
|
->collapsible()
|
|
->schema([
|
|
TextInput::make('public.host')->label('Hostname')->required(),
|
|
TextInput::make('public.port')->label('Port')->required(),
|
|
Select::make('public.encryption')->options([
|
|
'none' => 'None',
|
|
'ssl' => 'SSL',
|
|
'tls' => 'TLS',
|
|
]),
|
|
Checkbox::make('public.validate_cert')->label('Validate Encryption Certificate')->default(false),
|
|
TextInput::make('public.username')->label('Username')->required(),
|
|
TextInput::make('public.password')->label('Password')->required(),
|
|
TextInput::make('public.default_account')->label('Default Account')->placeholder('default'),
|
|
TextInput::make('public.protocol')->label('Protocol')->placeholder('imap'),
|
|
Checkbox::make('public.cc_check')->label('Check CC Field')->default(false)->helperText('If enabled, we will check the CC field as well while fetching mails.'),
|
|
]),
|
|
|
|
Section::make('Premium Mailbox Imap')
|
|
->description('Enter your imap server')
|
|
->collapsed()
|
|
->schema([
|
|
TextInput::make('premium.host')->label('Hostname')->required(),
|
|
TextInput::make('premium.port')->label('Port')->required(),
|
|
Select::make('premium.encryption')->options([
|
|
'none' => 'None',
|
|
'ssl' => 'SSL',
|
|
'tls' => 'TLS',
|
|
]),
|
|
Checkbox::make('premium.validate_cert')->label('Validate Encryption Certificate')->default(false),
|
|
TextInput::make('premium.username')->label('Username')->required(),
|
|
TextInput::make('premium.password')->label('Password')->required(),
|
|
TextInput::make('premium.default_account')->label('Default Account')->placeholder('default'),
|
|
TextInput::make('premium.protocol')->label('Protocol')->placeholder('imap'),
|
|
Checkbox::make('premium.cc_check')->label('Check CC Field')->default(false)->helperText('If enabled, we will check the CC field as well while fetching mails.'),
|
|
]),
|
|
])
|
|
->statePath('data');
|
|
}
|
|
}
|