Enhance homepage with dynamic success and portfolio settings: replace static content with values from SuccessSettings and PortfolioSettings, and implement loops for skill and portfolio items.
This commit is contained in:
104
app/Filament/Pages/ManageSuccess.php
Normal file
104
app/Filament/Pages/ManageSuccess.php
Normal file
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use App\Settings\SuccessSettings;
|
||||
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\SettingsPage;
|
||||
use Illuminate\Contracts\Support\Htmlable;
|
||||
|
||||
class ManageSuccess extends SettingsPage
|
||||
{
|
||||
protected static ?string $navigationIcon = 'heroicon-o-check-circle';
|
||||
|
||||
protected static string $settings = SuccessSettings::class;
|
||||
|
||||
public function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Section::make('Success Section Content')
|
||||
->description('Manage the main content for the success section.')
|
||||
->icon('heroicon-o-document-text')
|
||||
->schema([
|
||||
TextInput::make('success_subtitle')
|
||||
->label('Subtitle')
|
||||
->maxLength(100),
|
||||
TextInput::make('success_header')
|
||||
->label('Header')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
Textarea::make('success_paragraph')
|
||||
->label('Paragraph')
|
||||
->rows(3)
|
||||
->maxLength(65535),
|
||||
Grid::make()->schema([
|
||||
TextInput::make('success_button_text')
|
||||
->label('Button Text')
|
||||
->maxLength(50),
|
||||
TextInput::make('success_button_url')
|
||||
->label('Button URL')
|
||||
->maxLength(255)
|
||||
->url(),
|
||||
])->columns(2),
|
||||
]),
|
||||
Section::make('Skill Items')
|
||||
->description('Manage the skill items with their names and percentages.')
|
||||
->icon('heroicon-o-adjustments-vertical')
|
||||
->schema([
|
||||
Repeater::make('skill_items')
|
||||
->label('Skill Items')
|
||||
->schema([
|
||||
TextInput::make('name')
|
||||
->label('Skill Name')
|
||||
->required()
|
||||
->maxLength(100),
|
||||
TextInput::make('percentage')
|
||||
->label('Percentage')
|
||||
->numeric()
|
||||
->required()
|
||||
->minValue(0)
|
||||
->maxValue(100),
|
||||
])
|
||||
->columns(2)
|
||||
->minItems(1)
|
||||
->maxItems(5)
|
||||
->defaultItems(2)
|
||||
->reorderable()
|
||||
->collapsible(),
|
||||
]),
|
||||
])
|
||||
->columns(1)
|
||||
->statePath('data');
|
||||
}
|
||||
|
||||
public static function getNavigationGroup(): ?string
|
||||
{
|
||||
return __('CMS');
|
||||
}
|
||||
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return __('Success Section');
|
||||
}
|
||||
|
||||
public function getTitle(): string|Htmlable
|
||||
{
|
||||
return 'Success Section';
|
||||
}
|
||||
|
||||
public function getHeading(): string|Htmlable
|
||||
{
|
||||
return 'Edit success section content from here';
|
||||
}
|
||||
|
||||
public function getSubheading(): string|Htmlable|null
|
||||
{
|
||||
return 'Manage the success section content, including text, button, and skill bars.';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user