From 76397637f04595afea94719a9106438dac515d4c Mon Sep 17 00:00:00 2001 From: Nurmuhammet Allanov Date: Tue, 29 Jul 2025 14:16:10 +0500 Subject: [PATCH] Integrate dynamic settings into About page: update content sections to utilize AboutSettings for titles, subtitles, paragraphs, and media sources, enhancing content management and user experience. --- app/Filament/Pages/AboutPageSettings.php | 289 +++++++++++++ app/Settings/AboutSettings.php | 47 +++ ...5_07_29_130842_create_contact_settings.php | 2 +- ...7_29_140725_add_default_about_settings.php | 82 ++++ .../views/web/pages/about/index.blade.php | 392 +++++------------- 5 files changed, 534 insertions(+), 278 deletions(-) create mode 100644 app/Filament/Pages/AboutPageSettings.php create mode 100644 app/Settings/AboutSettings.php create mode 100644 database/settings/2025_07_29_140725_add_default_about_settings.php diff --git a/app/Filament/Pages/AboutPageSettings.php b/app/Filament/Pages/AboutPageSettings.php new file mode 100644 index 0000000..f127eea --- /dev/null +++ b/app/Filament/Pages/AboutPageSettings.php @@ -0,0 +1,289 @@ +schema([ + Section::make('Our Story Section') + ->description("Manage the 'Our Story' content on the About Us page.") + ->icon('heroicon-o-book-open') + ->schema([ + TextInput::make('our_story_title') + ->label('Title') + ->required() + ->maxLength(100), + Textarea::make('our_story_subtitle') + ->label('Subtitle') + ->rows(2) + ->maxLength(255) + ->required(), + Textarea::make('our_story_paragraph_one') + ->label('Paragraph One') + ->rows(4) + ->maxLength(65535) + ->required(), + Textarea::make('our_story_paragraph_two') + ->label('Paragraph Two') + ->rows(4) + ->maxLength(65535) + ->required(), + Textarea::make('our_story_paragraph_three') + ->label('Paragraph Three') + ->rows(4) + ->maxLength(65535) + ->required(), + Grid::make(2)->schema([ + TextInput::make('our_story_button_text') + ->label('Button Text') + ->maxLength(50) + ->required(), + TextInput::make('our_story_button_url') + ->label('Button URL') + ->url() + ->maxLength(255) + ->required(), + ]), + FileUpload::make('our_story_video_poster') + ->label('Video Poster Image') + ->image() + ->maxSize(2048) + ->disk('public') + ->directory('about-us') + ->required(), + TextInput::make('our_story_video_source') + ->label('Video Source URL') + ->url() + ->maxLength(255) + ->required(), + ]), + + Section::make('Our Journey Section') + ->description("Manage the 'Our Journey' milestones on the About Us page.") + ->icon('heroicon-o-map') + ->schema([ + TextInput::make('our_journey_title') + ->label('Title') + ->required() + ->maxLength(100), + Textarea::make('our_journey_subtitle') + ->label('Subtitle') + ->rows(2) + ->maxLength(255) + ->required(), + Repeater::make('our_journey_milestones') + ->label('Milestones') + ->schema([ + TextInput::make('year') + ->label('Year') + ->numeric() + ->required(), + TextInput::make('title') + ->label('Milestone Title') + ->required() + ->maxLength(100), + Textarea::make('description') + ->label('Description') + ->rows(3) + ->maxLength(255) + ->required(), + FileUpload::make('image') + ->label('Image') + ->image() + ->maxSize(2048) + ->disk('public') + ->directory('about-us-milestones') + ->required(), + ]) + ->minItems(1) + ->columns(1) + ->reorderable() + ->collapsible(), + ]), + + Section::make('Company Structure Section') + ->description("Manage the 'Company Structure' details on the About Us page.") + ->icon('heroicon-o-user-group') + ->schema([ + TextInput::make('company_structure_title') + ->label('Title') + ->required() + ->maxLength(100), + Textarea::make('company_structure_subtitle') + ->label('Subtitle') + ->rows(2) + ->maxLength(255) + ->required(), + TextInput::make('company_structure_director_name') + ->label('Director Name') + ->required() + ->maxLength(100), + TextInput::make('company_structure_advisor_name') + ->label('Technical Advisor Name') + ->required() + ->maxLength(100), + Repeater::make('company_structure_departments') + ->label('Departments') + ->schema([ + TextInput::make('name') + ->label('Department Name') + ->required() + ->maxLength(100), + TextInput::make('person') + ->label('Contact Person') + ->required() + ->maxLength(100), + ]) + ->minItems(1) + ->columns(2) + ->reorderable() + ->collapsible(), + ]), + + Section::make('Our Management Section') + ->description("Manage the 'Our Management' team details on the About Us page.") + ->icon('heroicon-o-briefcase') + ->schema([ + TextInput::make('our_management_title') + ->label('Title') + ->required() + ->maxLength(100), + Textarea::make('our_management_subtitle') + ->label('Subtitle') + ->rows(2) + ->maxLength(255) + ->required(), + Repeater::make('our_management_team') + ->label('Team Members') + ->schema([ + FileUpload::make('image') + ->label('Image') + ->image() + ->maxSize(2048) + ->disk('public') + ->directory('about-us-team') + ->required(), + TextInput::make('name') + ->label('Name') + ->required() + ->maxLength(100), + TextInput::make('title') + ->label('Title/Position') + ->required() + ->maxLength(100), + Textarea::make('description') + ->label('Description') + ->rows(3) + ->maxLength(255) + ->required(), + ]) + ->minItems(1) + ->columns(1) + ->reorderable() + ->collapsible(), + ]), + + Section::make('Our Facilities Section') + ->description("Manage the 'Our Facilities' details on the About Us page.") + ->icon('heroicon-o-building-library') + ->schema([ + TextInput::make('our_facilities_title') + ->label('Title') + ->required() + ->maxLength(100), + Textarea::make('our_facilities_subtitle') + ->label('Subtitle') + ->rows(2) + ->maxLength(255) + ->required(), + Repeater::make('our_facilities_locations') + ->label('Locations') + ->schema([ + FileUpload::make('image') + ->label('Image') + ->image() + ->maxSize(2048) + ->disk('public') + ->directory('about-us-facilities') + ->required(), + TextInput::make('name') + ->label('Location Name') + ->required() + ->maxLength(100), + TextInput::make('location') + ->label('Address/Location') + ->required() + ->maxLength(255), + Textarea::make('description') + ->label('Description') + ->rows(3) + ->maxLength(255) + ->required(), + Repeater::make('tags') + ->label('Tags') + ->simple(TextInput::make('value') + ->label('Tag') + ->required() + ->maxLength(50)) + ->itemLabel(fn (array $state): ?string => $state['value'] ?? null) + ->minItems(1) + ->columns(1) + ->reorderable() + ->collapsible() + ->defaultItems(1), + ]) + ->minItems(1) + ->columns(1) + ->reorderable() + ->collapsible(), + ]), + ]) + ->columns(1) + ->statePath('data'); + } + + public static function getNavigationGroup(): ?string + { + return __('CMS'); + } + + public static function getNavigationLabel(): string + { + return __('About Page Settings'); + } + + public function getTitle(): string|Htmlable + { + return 'About Us'; + } + + public function getHeading(): string|Htmlable + { + return 'Edit About Us page text and images from here'; + } + + public function getSubheading(): string|Htmlable|null + { + return 'Manage the content sections of the About Us page.'; + } +} \ No newline at end of file diff --git a/app/Settings/AboutSettings.php b/app/Settings/AboutSettings.php new file mode 100644 index 0000000..30b9427 --- /dev/null +++ b/app/Settings/AboutSettings.php @@ -0,0 +1,47 @@ +migrator->add('contact.contact_subtitle', 'Default Contact Subtitle'); $this->migrator->add('contact.contact_header', 'Default Contact Header'); $this->migrator->add('contact.contact_paragraph', 'This is a default paragraph for the contact page. Please update it from the Filament panel.'); - $this->migrator->add('contact.phone_number', '+1234567890'); $this->migrator->add('contact.email_address', 'info@example.com'); + $this->migrator->add('contact.phone_number', '+1234567890'); $this->migrator->add('contact.location_address', '123 Main St, Anytown, USA'); $this->migrator->add('contact.map_embed_url', ''); } diff --git a/database/settings/2025_07_29_140725_add_default_about_settings.php b/database/settings/2025_07_29_140725_add_default_about_settings.php new file mode 100644 index 0000000..0085e2f --- /dev/null +++ b/database/settings/2025_07_29_140725_add_default_about_settings.php @@ -0,0 +1,82 @@ +migrator->add('cms_aboutpage.our_story_title', 'Our Story'); + $this->migrator->add('cms_aboutpage.our_story_subtitle', 'A journey of passion, innovation, and dedication that shaped who we are today.'); + $this->migrator->add('cms_aboutpage.our_story_paragraph_one', 'Founded in 2015, our company began with a simple mission: to revolutionize how businesses approach their challenges. What started as a small team of three passionate individuals has grown into a global organization serving clients across multiple industries.'); + $this->migrator->add('cms_aboutpage.our_story_paragraph_two', 'Through years of dedication and innovation, we\'ve established ourselves as industry leaders, known for our commitment to excellence and customer satisfaction.'); + $this->migrator->add('cms_aboutpage.our_story_paragraph_three', 'Today, we\'re proud to have a diverse team of experts working together to deliver exceptional solutions that make a real difference for our clients.'); + $this->migrator->add('cms_aboutpage.our_story_button_text', 'Learn more about our journey'); + $this->migrator->add('cms_aboutpage.our_story_button_url', '#'); + $this->migrator->add('cms_aboutpage.our_story_video_poster', 'placeholder.svg'); // Placeholder, change as needed + $this->migrator->add('cms_aboutpage.our_story_video_source', '#'); // Placeholder, change as needed + + $this->migrator->add('cms_aboutpage.our_journey_title', 'Our Journey'); + $this->migrator->add('cms_aboutpage.our_journey_subtitle', 'Explore our company\'s history and milestones through the years. Click on any date to learn more about our journey.'); + $this->migrator->add('cms_aboutpage.our_journey_milestones', [ + ['year' => 2010, 'title' => 'Start Company', 'description' => 'Launching a new company is an exciting journey that requires careful planning and execution. Let\'s begin!', 'image' => 'portfolio/portfolio-2.jpg'], + ['year' => 2014, 'title' => 'Opening Office', 'description' => 'Opening a new office represents growth and opportunity. Join us as we expand our operations!', 'image' => 'portfolio/portfolio-3.jpg'], + ['year' => 2018, 'title' => 'Project Management', 'description' => 'Effective project management ensures timely delivery and quality results. Our expert team is here to help!', 'image' => 'portfolio/portfolio-5.jpg'], + ['year' => 2021, 'title' => 'Open Research Team', 'description' => 'Our open research team is dedicated to innovation and collaboration, driving impactful solutions for clients.', 'image' => 'portfolio/portfolio-8.jpg'], + ['year' => 2024, 'title' => 'Winning Award', 'description' => 'Winning awards showcases our commitment to excellence and innovation. Thank you for believing', 'image' => 'portfolio/portfolio-6.jpg'], + ]); + + $this->migrator->add('cms_aboutpage.company_structure_title', 'Company Structure'); + $this->migrator->add('cms_aboutpage.company_structure_subtitle', 'Our organizational hierarchy designed for efficiency'); + $this->migrator->add('cms_aboutpage.company_structure_director_name', 'John Smith'); + $this->migrator->add('cms_aboutpage.company_structure_advisor_name', 'Sarah Johnson'); + $this->migrator->add('cms_aboutpage.company_structure_departments', [ + ['name' => 'HSE', 'person' => 'Michael Brown'], + ['name' => 'Personnel', 'person' => 'Emily Davis'], + ['name' => 'Operations', 'person' => 'Robert Wilson'], + ['name' => 'Finance', 'person' => 'Jennifer Lee'], + ]); + + $this->migrator->add('cms_aboutpage.our_management_title', 'Our Management'); + $this->migrator->add('cms_aboutpage.our_management_subtitle', 'Meet the leadership team driving our vision forward'); + $this->migrator->add('cms_aboutpage.our_management_team', [ + ['name' => 'John Smith', 'title' => 'Chief Executive Officer', 'description' => 'With over 20 years of industry experience, John leads our company with vision and strategic insight.', 'image' => 'placeholder.svg'], + ['name' => 'Sarah Johnson', 'title' => 'Chief Technical Officer', 'description' => 'Sarah brings technical excellence and innovation to every aspect of our products and services.', 'image' => 'placeholder.svg'], + ['name' => 'Michael Brown', 'title' => 'Head of Operations', 'description' => 'Michael ensures smooth operation across all our facilities and project deployments.', 'image' => 'placeholder.svg'], + ]); + + $this->migrator->add('cms_aboutpage.our_facilities_title', 'Our Facilities'); + $this->migrator->add('cms_aboutpage.our_facilities_subtitle', 'State-of-the-art locations where innovation happens'); + $this->migrator->add('cms_aboutpage.our_facilities_locations', [ + ['name' => 'Headquarters', 'location' => 'San Francisco, California', 'description' => 'Our global headquarters houses our executive team and primary R&D facilities with state-of-the-art equipment and collaborative spaces.', 'image' => 'placeholder.svg', 'tags' => ['R&D Labs', 'Executive Offices', 'Conference Center', 'Innovation Hub']], + ['name' => 'Manufacturing Center', 'location' => 'Austin, Texas', 'description' => 'Our primary manufacturing facility implements cutting-edge production techniques with a focus on sustainability and efficiency.', 'image' => 'placeholder.svg', 'tags' => ['Production Lines', 'Quality Control', 'Warehouse', 'Distribution Center']], + ]); + } + + public function down(): void + { + $this->migrator->delete('cms_aboutpage.our_story_title'); + $this->migrator->delete('cms_aboutpage.our_story_subtitle'); + $this->migrator->delete('cms_aboutpage.our_story_paragraph_one'); + $this->migrator->delete('cms_aboutpage.our_story_paragraph_two'); + $this->migrator->delete('cms_aboutpage.our_story_paragraph_three'); + $this->migrator->delete('cms_aboutpage.our_story_button_text'); + $this->migrator->delete('cms_aboutpage.our_story_button_url'); + $this->migrator->delete('cms_aboutpage.our_story_video_poster'); + $this->migrator->delete('cms_aboutpage.our_story_video_source'); + $this->migrator->delete('cms_aboutpage.our_journey_title'); + $this->migrator->delete('cms_aboutpage.our_journey_subtitle'); + $this->migrator->delete('cms_aboutpage.our_journey_milestones'); + $this->migrator->delete('cms_aboutpage.company_structure_title'); + $this->migrator->delete('cms_aboutpage.company_structure_subtitle'); + $this->migrator->delete('cms_aboutpage.company_structure_director_name'); + $this->migrator->delete('cms_aboutpage.company_structure_advisor_name'); + $this->migrator->delete('cms_aboutpage.company_structure_departments'); + $this->migrator->delete('cms_aboutpage.our_management_title'); + $this->migrator->delete('cms_aboutpage.our_management_subtitle'); + $this->migrator->delete('cms_aboutpage.our_management_team'); + $this->migrator->delete('cms_aboutpage.our_facilities_title'); + $this->migrator->delete('cms_aboutpage.our_facilities_subtitle'); + $this->migrator->delete('cms_aboutpage.our_facilities_locations'); + } +}; diff --git a/resources/views/web/pages/about/index.blade.php b/resources/views/web/pages/about/index.blade.php index 43d7daf..dca0f12 100644 --- a/resources/views/web/pages/about/index.blade.php +++ b/resources/views/web/pages/about/index.blade.php @@ -286,6 +286,9 @@ body { @endpush @section('content') + @php + $aboutSettings = app(App\Settings\AboutSettings::class); + @endphp