293 lines
12 KiB
PHP
293 lines
12 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Pages;
|
|
|
|
use App\Settings\HomeSettings;
|
|
use Filament\Forms\Components\FileUpload;
|
|
use Filament\Forms\Components\Grid;
|
|
use Filament\Forms\Components\Repeater;
|
|
use Filament\Forms\Components\Section;
|
|
use Filament\Forms\Components\Textarea;
|
|
use Filament\Forms\Components\TextInput;
|
|
use Filament\Forms\Form;
|
|
use Filament\Pages\SettingsPage;
|
|
use Illuminate\Contracts\Support\Htmlable;
|
|
|
|
class HomePageSettings extends SettingsPage
|
|
{
|
|
protected static ?string $navigationIcon = 'heroicon-o-home';
|
|
|
|
protected static string $settings = HomeSettings::class;
|
|
|
|
public function form(Form $form): Form
|
|
{
|
|
return $form
|
|
->schema([
|
|
Section::make('Hero Section')
|
|
->description('Manage the main hero section content on the homepage.')
|
|
->icon('heroicon-o-photo')
|
|
->schema([
|
|
TextInput::make('hero_badge_text')
|
|
->label('Hero Badge Text')
|
|
->maxLength(50)
|
|
->required(),
|
|
TextInput::make('hero_header')
|
|
->label('Hero Header')
|
|
->required()
|
|
->maxLength(100),
|
|
Textarea::make('hero_sub_header')
|
|
->label('Hero Sub Header')
|
|
->rows(3)
|
|
->maxLength(255)
|
|
->required(),
|
|
Grid::make()->schema([
|
|
TextInput::make('hero_link_button_text')
|
|
->label('Hero Button Text')
|
|
->maxLength(50)
|
|
->required(),
|
|
TextInput::make('hero_link_button_url')
|
|
->label('Hero Button URL')
|
|
->maxLength(255)
|
|
->url()
|
|
->required(),
|
|
])->columns(2),
|
|
]),
|
|
|
|
Section::make('About Section')
|
|
->description('Manage the about section content on the homepage.')
|
|
->icon('heroicon-o-building-office-2')
|
|
->schema([
|
|
TextInput::make('about_subtitle')
|
|
->label('About Subtitle')
|
|
->maxLength(100)
|
|
->required(),
|
|
TextInput::make('about_header')
|
|
->label('About Header')
|
|
->required()
|
|
->maxLength(255),
|
|
Textarea::make('about_paragraph')
|
|
->label('About Paragraph')
|
|
->rows(5)
|
|
->maxLength(65535)
|
|
->required(),
|
|
Grid::make()->schema([
|
|
TextInput::make('about_projects_text')
|
|
->label('Projects Text')
|
|
->maxLength(100)
|
|
->required(),
|
|
|
|
TextInput::make('about_projects_number')
|
|
->label('Projects Number')
|
|
->numeric()
|
|
->required(),
|
|
|
|
])->columns(2),
|
|
Grid::make()->schema([
|
|
TextInput::make('about_members_text')
|
|
->label('Members Text')
|
|
->maxLength(100)
|
|
->required(),
|
|
|
|
TextInput::make('about_members_number')
|
|
->label('Members Number')
|
|
->numeric()
|
|
->required(),
|
|
|
|
])->columns(2),
|
|
Grid::make()->schema([
|
|
|
|
TextInput::make('about_reviews_text')
|
|
->label('Reviews Text')
|
|
->maxLength(100)
|
|
->required(),
|
|
|
|
TextInput::make('about_reviews_number')
|
|
->label('Reviews Number')
|
|
->numeric()
|
|
->required(),
|
|
|
|
])->columns(2),
|
|
Grid::make()->schema([
|
|
TextInput::make('about_button_text')
|
|
->label('About Button Text')
|
|
->maxLength(50)
|
|
->required(),
|
|
TextInput::make('about_button_url')
|
|
->label('About Button URL')
|
|
->maxLength(255)
|
|
->url()
|
|
->required(),
|
|
])->columns(2),
|
|
|
|
Grid::make()->schema([
|
|
FileUpload::make('about_image_one')
|
|
->label('About Image One (245x410)')
|
|
->image()
|
|
->maxSize(2048)
|
|
->disk('public')
|
|
->directory('about-images')
|
|
->required(),
|
|
FileUpload::make('about_image_two')
|
|
->label('About Image Two (375x391)')
|
|
->image()
|
|
->maxSize(2048)
|
|
->disk('public')
|
|
->directory('about-images')
|
|
->required(),
|
|
])->columns(2),
|
|
]),
|
|
|
|
Section::make('Background Video')
|
|
->description('Upload or link the background video for the hero section.')
|
|
->icon('heroicon-o-camera')
|
|
->schema([
|
|
TextInput::make('bg_video')
|
|
->label('Background Video URL')
|
|
->maxLength(255)
|
|
->url()
|
|
->required(),
|
|
]),
|
|
|
|
Section::make('Industry Area')
|
|
->description('Manage the content for the industry area section.')
|
|
->icon('heroicon-o-building-office')
|
|
->schema([
|
|
TextInput::make('industry_subtitle')
|
|
->label('Subtitle')
|
|
->maxLength(100)
|
|
->required(),
|
|
TextInput::make('industry_header')
|
|
->label('Header')
|
|
->required()
|
|
->maxLength(255),
|
|
Textarea::make('industry_paragraph')
|
|
->label('Paragraph')
|
|
->rows(3)
|
|
->maxLength(65535)
|
|
->required(),
|
|
Grid::make()->schema([
|
|
TextInput::make('industry_button_text')
|
|
->label('Button Text')
|
|
->maxLength(50)
|
|
->required(),
|
|
TextInput::make('industry_button_url')
|
|
->label('Button URL')
|
|
->maxLength(255)
|
|
->url()
|
|
->required(),
|
|
])->columns(2),
|
|
FileUpload::make('industry_image_one')
|
|
->label('Industry Image One (520x400)')
|
|
->image()
|
|
->maxSize(2048)
|
|
->disk('public')
|
|
->directory('industry-images')
|
|
->required(),
|
|
Repeater::make('industry_items')
|
|
->label('Industry Items')
|
|
->schema([
|
|
FileUpload::make('icon')
|
|
->label('Icon (SVG)')
|
|
->directory('industry-icons')
|
|
->acceptedFileTypes(['image/svg+xml'])
|
|
->maxSize(1024) // 1MB
|
|
->required(),
|
|
TextInput::make('title')
|
|
->label('Title')
|
|
->required()
|
|
->maxLength(100),
|
|
Textarea::make('description')
|
|
->label('Description')
|
|
->rows(2)
|
|
->maxLength(255)
|
|
->required(),
|
|
])
|
|
->columns(2)
|
|
->minItems(1)
|
|
->maxItems(5)
|
|
->defaultItems(2)
|
|
->reorderable()
|
|
->collapsible(),
|
|
]),
|
|
|
|
Section::make('Text Slide Area')
|
|
->description('Manage the content for the text slide area section.')
|
|
->icon('heroicon-o-chat-bubble-bottom-center-text')
|
|
->schema([
|
|
TextInput::make('text_slide_subtitle')
|
|
->label('Subtitle')
|
|
->maxLength(100)
|
|
->required(),
|
|
TextInput::make('text_slide_header')
|
|
->label('Header')
|
|
->required()
|
|
->maxLength(255),
|
|
FileUpload::make('text_slide_image')
|
|
->label('Text Slide Image (540x350)')
|
|
->image()
|
|
->maxSize(2048)
|
|
->disk('public')
|
|
->directory('text-slide-images')
|
|
->required(),
|
|
TextInput::make('text_slide_counter_number')
|
|
->label('Counter Number')
|
|
->numeric()
|
|
->default(29)
|
|
->required(),
|
|
Repeater::make('text_slide_items')
|
|
->label('Text Slide Items')
|
|
->schema([
|
|
FileUpload::make('icon')
|
|
->label('Icon (SVG)')
|
|
->directory('text-slide-icons')
|
|
->acceptedFileTypes(['image/svg+xml'])
|
|
->maxSize(1024) // 1MB
|
|
->required(),
|
|
TextInput::make('link')
|
|
->label('Link')
|
|
->required()
|
|
->url()
|
|
->maxLength(255),
|
|
TextInput::make('text')
|
|
->label('Text')
|
|
->required()
|
|
->maxLength(100),
|
|
])
|
|
->columns(3)
|
|
->minItems(1)
|
|
->maxItems(10)
|
|
->defaultItems(6)
|
|
->reorderable()
|
|
->collapsible(),
|
|
]),
|
|
])
|
|
->columns(1)
|
|
->statePath('data');
|
|
}
|
|
|
|
public static function getNavigationGroup(): ?string
|
|
{
|
|
return __('CMS');
|
|
}
|
|
|
|
public static function getNavigationLabel(): string
|
|
{
|
|
return __('Home');
|
|
}
|
|
|
|
public function getTitle(): string|Htmlable
|
|
{
|
|
return 'Home';
|
|
}
|
|
|
|
public function getHeading(): string|Htmlable
|
|
{
|
|
return 'Edit homepage text and images from here';
|
|
}
|
|
|
|
public function getSubheading(): string|Htmlable|null
|
|
{
|
|
return 'Manage the homepage hero section, background video, and call-to-action content.';
|
|
}
|
|
}
|