Files
gujurly.com/app/Filament/Pages/ManageSite.php
2025-07-26 13:25:50 +05:00

160 lines
6.4 KiB
PHP

<?php
namespace App\Filament\Pages;
use App\Settings\SiteSettings;
use Filament\Forms;
use Filament\Forms\Form;
use Filament\Pages\SettingsPage;
use Illuminate\Contracts\Support\Htmlable;
class ManageSite extends SettingsPage
{
protected static ?string $navigationIcon = 'heroicon-o-globe-alt';
protected static string $settings = SiteSettings::class;
protected function getHeaderActions(): array
{
return [
$this->getSaveFormAction()
->formId('form'),
];
}
public function form(Form $form): Form
{
return $form
->schema([
Forms\Components\Section::make('Basic Information')
->description('General website configuration')
->icon('heroicon-o-information-circle')
->collapsible()
->schema([
Forms\Components\Grid::make()->schema([
Forms\Components\TextInput::make('name')
->label('Site Name')
->required()
->maxLength(100),
Forms\Components\TextInput::make('tagline')
->label('Site Tagline')
->helperText('A short phrase describing your site')
->maxLength(150),
Forms\Components\Textarea::make('description')
->label('Site Description')
->helperText('A detailed description of your website')
->rows(3)
->maxLength(500),
])->columns(2),
]),
Forms\Components\Section::make('Company Information')
->description('Contact details and location information')
->icon('heroicon-o-building-office')
->collapsible()
->schema([
Forms\Components\Grid::make()->schema([
Forms\Components\TextInput::make('company_name')
->label('Company Name')
->required()
->maxLength(100),
Forms\Components\TextInput::make('company_email')
->label('Company Email')
->email()
->required()
->maxLength(100),
Forms\Components\TextInput::make('company_phone')
->label('Company Phone')
->maxLength(20),
Forms\Components\TextInput::make('company_phone_2')
->label('Company Additional Phone')
->maxLength(20),
])->columns(2),
Forms\Components\Textarea::make('company_address')
->label('Company Address')
->rows(2)
->maxLength(200),
]),
Forms\Components\Section::make('Legal Information')
->description('Copyright and legal page URLs')
->icon('heroicon-o-document-text')
->collapsible()
->schema([
Forms\Components\TextInput::make('footer_company_header')
->label('Footer header')
->required()
->maxLength(100),
]),
Forms\Components\Section::make('Legal Information')
->description('Copyright and legal page URLs')
->icon('heroicon-o-document-text')
->collapsible()
->schema([
Forms\Components\TextInput::make('copyright_text')
->label('Copyright Text')
->maxLength(200),
Forms\Components\Grid::make()->schema([
Forms\Components\TextInput::make('terms_url')
->label('Terms & Conditions URL')
->maxLength(100)
->prefix(function (Forms\Get $get) {
return url('/');
}),
Forms\Components\TextInput::make('privacy_url')
->label('Privacy Policy URL')
->maxLength(100)
->prefix(function (Forms\Get $get) {
return url('/');
}),
])->columns(2),
]),
Forms\Components\Section::make('Error Messages')
->description('Custom error messages for your website')
->icon('heroicon-o-exclamation-triangle')
->collapsible()
->schema([
Forms\Components\Grid::make()->schema([
Forms\Components\Textarea::make('custom_404_message')
->label('404 Not Found Message')
->rows(2)
->maxLength(500),
Forms\Components\Textarea::make('custom_500_message')
->label('500 Server Error Message')
->rows(2)
->maxLength(500),
])->columns(2),
]),
])
->columns(3);
}
public static function getNavigationGroup(): ?string
{
return __('Settings');
}
public static function getNavigationLabel(): string
{
return 'Website';
}
public function getTitle(): string|Htmlable
{
return 'Website Settings';
}
public function getHeading(): string|Htmlable
{
return 'Website Settings';
}
public function getSubheading(): string|Htmlable|null
{
return 'Manage your website\'s general configuration';
}
}