Integrate dynamic solution settings into homepage: replace static service titles and button with values from SolutionSettings, and implement a loop to display service items dynamically.
This commit is contained in:
106
app/Filament/Pages/ManageSolutions.php
Normal file
106
app/Filament/Pages/ManageSolutions.php
Normal file
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use App\Settings\SolutionSettings;
|
||||
use Filament\Forms\Components\Grid;
|
||||
use Filament\Forms\Components\Section;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\Repeater;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Pages\Page;
|
||||
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')
|
||||
->maxLength(100),
|
||||
TextInput::make('solutions_header')
|
||||
->label('Header')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
Grid::make()->schema([
|
||||
TextInput::make('solutions_button_text')
|
||||
->label('Button Text')
|
||||
->maxLength(50),
|
||||
TextInput::make('solutions_button_url')
|
||||
->label('Button URL')
|
||||
->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.';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user