Files
gujurly.com/app/Filament/Pages/ManageSolutions.php

114 lines
4.2 KiB
PHP

<?php
namespace App\Filament\Pages;
use App\Settings\SolutionSettings;
use Filament\Forms\Components\FileUpload;
use Filament\Forms\Components\Grid;
use Filament\Forms\Components\Repeater;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use Filament\Pages\SettingsPage;
use Illuminate\Contracts\Support\Htmlable;
class ManageSolutions extends SettingsPage
{
protected static ?string $navigationIcon = 'heroicon-o-wrench-screwdriver';
protected static string $settings = SolutionSettings::class;
public function form(Form $form): Form
{
return $form
->schema([
Section::make('Solutions Section')
->description('Manage the content for the solutions section on the homepage.')
->icon('heroicon-o-puzzle-piece')
->schema([
TextInput::make('solutions_subtitle')
->label('Subtitle')
->required()
->maxLength(100),
TextInput::make('solutions_header')
->label('Header')
->required()
->maxLength(255),
FileUpload::make('solutions_image')
->label('Image')
->image()
->directory('solutions')
->required(),
Grid::make()->schema([
TextInput::make('solutions_button_text')
->label('Button Text')
->required()
->maxLength(50),
TextInput::make('solutions_button_url')
->label('Button URL')
->required()
->maxLength(255)
->url(),
])->columns(2),
]),
Section::make('Solution Items')
->description('Manage individual solution items.')
->icon('heroicon-o-cube')
->schema([
Repeater::make('solution_items')
->label('Solution Items')
->schema([
TextInput::make('icon_class')
->label('Icon Class')
->helperText('e.g., flaticon-it-department. Refer to Flaticon for available icons.')
->required()
->maxLength(100),
TextInput::make('title')
->label('Title')
->required()
->maxLength(100),
TextInput::make('link')
->label('Link')
->required()
->maxLength(255)
->url(),
])
->columns(3)
->minItems(1)
->maxItems(6)
->defaultItems(3)
->grid(2)
->reorderable()
->collapsible(),
]),
])
->columns(1)
->statePath('data');
}
public static function getNavigationGroup(): ?string
{
return __('CMS');
}
public static function getNavigationLabel(): string
{
return __('Solutions');
}
public function getTitle(): string|Htmlable
{
return 'Solutions';
}
public function getHeading(): string|Htmlable
{
return 'Edit solutions text, icons, and links from here';
}
public function getSubheading(): string|Htmlable|null
{
return 'Manage the solutions section content, including individual solution items.';
}
}