File: D:/HostingSpaces/SBogers10/gggg.komma.nl/app/WebsiteConfig/WebsiteConfigSection.php
<?php
namespace App\WebsiteConfig;
use App\Buttons\Kms\ButtonService;
use Illuminate\Database\Eloquent\Model;
use Komma\KMS\Core\Attributes\Attribute;
use Komma\KMS\Core\Attributes\Documents;
use Komma\KMS\Core\Attributes\Models\ImageProperty;
use Komma\KMS\Core\Attributes\MultiSelect;
use Komma\KMS\Core\Attributes\Seperator;
use Komma\KMS\Core\Attributes\TextField;
use Komma\KMS\Core\Attributes\Title;
use Komma\KMS\Core\Attributes\Video;
use Komma\KMS\Core\Sections\Section;
use App\Servicepoints\Kms\ServicepointService;
use App\Servicepoints\Models\Servicepoint;
use Komma\KMS\Users\Models\KmsUserRole;
class WebsiteConfigSection extends Section
{
public function defineAttributesAndTabs(Model $currentModel = null): void
{
$buttonsService = \App::make(ButtonService::class);
$buttonModels = $buttonsService->getOptionsForSelect();
$attributes = [];
$attributes[] = (new Title())
->setLabelText('Bedrijfsgegevens')
->setMinimumUserRole(KmsUserRole::Admin);
$attributes[] = (new TextField())
->setLabelText('Url')
->setReference( 'company_url')
->setMinimumUserRole(KmsUserRole::Admin);
$attributes[] = (new TextField())
->setLabelText('Bedrijfsnaam')
->setReference( 'company_name')
->setMinimumUserRole(KmsUserRole::Admin);
$attributes[] = (new TextField())
->setLabelText('Adres')
->setReference( 'company_address')
->setMinimumUserRole(KmsUserRole::Admin);
$attributes[] = (new TextField())
->setLabelText('Postcode')
->setReference( 'company_zip')
->setMinimumUserRole(KmsUserRole::Admin);
$attributes[] = (new TextField())
->setLabelText('Stad')
->setReference( 'company_city')
->setMinimumUserRole(KmsUserRole::Admin);
$attributes[] = (new TextField())
->setLabelText('Land')
->setReference( 'company_country')
->setMinimumUserRole(KmsUserRole::Admin);
$attributes[] = (new TextField())
->setLabelText('KVK')
->setReference( 'company_kvk')
->setMinimumUserRole(KmsUserRole::Admin);
$attributes[] = (new TextField())
->setLabelText('E-mail')
->setReference( 'company_email')
->setMinimumUserRole(KmsUserRole::Admin);
$attributes[] = (new TextField())
->setLabelText('Telefoon link')
->setReference( 'company_phone_call')
->setMinimumUserRole(KmsUserRole::Admin);
$attributes[] = (new TextField())
->setLabelText('Telefoon weergave')
->setReference( 'company_phone_display')
->setMinimumUserRole(KmsUserRole::Admin);
// Google Maps
// ---------------------------------------
$attributes[] = (new Seperator())
->setMinimumUserRole(KmsUserRole::Admin);
$attributes[] = (new Title())
->setLabelText('Google Maps')
->setMinimumUserRole(KmsUserRole::Admin);
$attributes[] = (new TextField())
->setLabelText('Latitude')
->setPlaceholderText('Ex. 51.257929')
->setReference( 'google_maps_lat')
->setMinimumUserRole(KmsUserRole::Admin);
$attributes[] = (new TextField())
->setLabelText('Longitude')
->setPlaceholderText('Ex. 5.595330')
->setReference( 'google_maps_long')
->setMinimumUserRole(KmsUserRole::Admin);
// Social Media
// ---------------------------------------
$attributes[] = (new Seperator())
->setMinimumUserRole(KmsUserRole::Admin);
$attributes[] = (new Title())
->setLabelText('Sociale media')
->setMinimumUserRole(KmsUserRole::Admin);
$attributes[] = (new TextField())
->setLabelText('Facebook')
->setReference( 'company_social_facebook')
->setMinimumUserRole(KmsUserRole::Admin);
$attributes[] = (new TextField())
->setLabelText('Linkedin')
->setReference( 'company_social_linkedin')
->setMinimumUserRole(KmsUserRole::Admin);
$attributes[] = (new TextField())
->setLabelText('Instagram')
->setReference( 'company_social_instagram')
->setMinimumUserRole(KmsUserRole::Admin);
$attributes[] = (new TextField())
->setLabelText('Twitter')
->setReference( 'company_social_twitter')
->setMinimumUserRole(KmsUserRole::Admin);
// ServicePoint
// ---------------------------------------
$servicePointService = \App::make(ServicepointService::class);
$servicePointOptions = $servicePointService->getOptionsForSelect(false, true);
$attributes[] = (new Seperator())
->setMinimumUserRole(KmsUserRole::Admin);
$attributes[] = (new Title())
->setLabelText(__('KMS::global.defaultServicePoint'))
->setMinimumUserRole(KmsUserRole::SuperAdmin);
$attributes[] = (new TextField())
->setLabelText(__('KMS::global.servicePointHeading'))
->setReference( 'global_servicePoint_heading')
->setMinimumUserRole(KmsUserRole::SuperAdmin);
$attributes[] = (new MultiSelect())
->setItems($servicePointOptions->toArray())
->setLabelText(__('KMS::servicepoints.entity'))
->setMaxItemsToSelect(1)
->canBeLinkedWith(Servicepoint::class)
->setReference( 'global_servicePoint_id')
->setMinimumUserRole(KmsUserRole::SuperAdmin);
$attributes[] = (new MultiSelect())
->setItems($buttonModels->toArray())
->setMaxItemsToSelect(1)
->setLabelText(__('KMS::global.servicePointButton'))
->setReference( 'global_servicePoint_button_id')
->setMinimumUserRole(KmsUserRole::SuperAdmin);
// Callout Bar
// ---------------------------------------
$attributes[] = (new Seperator())
->setMinimumUserRole(KmsUserRole::Admin);
$attributes[] = (new Title())
->setLabelText(__('KMS::global.defaultCalloutBar'))
->setMinimumUserRole(KmsUserRole::SuperAdmin);
$attributes[] = (new TextField())
->setLabelText(__('KMS::global.calloutBarHeading'))
->setReference( 'global_CTA_heading')
->setMinimumUserRole(KmsUserRole::SuperAdmin);
$attributes[] = (new MultiSelect())
->setItems($buttonModels->toArray())
->setMaxItemsToSelect(1)
->setLabelText(__('KMS::global.calloutBarButton'))
->setReference( 'global_CTA_button_id')
->setMinimumUserRole(KmsUserRole::SuperAdmin);
// Logo's
// ---------------------------------------
$attributes[] = (new Seperator())
->setMinimumUserRole(KmsUserRole::SuperAdmin);
$attributes[] = (new Title())
->setLabelText(__('KMS::global.logos'))
->setMinimumUserRole(KmsUserRole::SuperAdmin);
$attributes[] = (new Documents())
->setLabelText(__('KMS::global.logo_on_light'))
->onlyAllowImages()
->setSmallDragAndDropArea()
->setMaxDocuments(1)
->setSubFolder('home')
->setImageProperties([
(new ImageProperty())->setName('small')->setCropMethod(ImageProperty::Fit)->setWidth(147)->setHeight(48),
])
->setReference( 'logo_on_light')
->setMinimumUserRole(KmsUserRole::SuperAdmin);
$attributes[] = (new Documents())
->setLabelText(__('KMS::global.logo_on_dark'))
->onlyAllowImages()
->setSmallDragAndDropArea()
->setMaxDocuments(1)
->setSubFolder('home')
->setImageProperties([
(new ImageProperty())->setName('small')->setCropMethod(ImageProperty::Fit)->setWidth(152)->setHeight(50),
])
->setReference( 'logo_on_dark')
->setMinimumUserRole(KmsUserRole::SuperAdmin);
// Hero
// ---------------------------------------
$attributes[] = (new Seperator())
->setMinimumUserRole(KmsUserRole::SuperAdmin);
$attributes[] = (new Title())
->setLabelText(__('KMS::global.homeHero'))
->setMinimumUserRole(KmsUserRole::SuperAdmin);
$attributes[] = (new Documents())
->setLabelText(__('KMS::global.homeHeroImages'))
->onlyAllowImages()
->setSmallDragAndDropArea()
->setMaxDocuments(5)
->setSubFolder('home')
->setImageProperties([
(new ImageProperty())->setName('large')->setCropMethod(ImageProperty::Fit)->setWidth(1152)->setHeight(640),
(new ImageProperty())->setName('medium')->setCropMethod(ImageProperty::Fit)->setWidth(920)->setHeight(460),
(new ImageProperty())->setName('small')->setCropMethod(ImageProperty::Fit)->setWidth(837)->setHeight(465),
])
->setReference( 'home_hero_images')
->setMinimumUserRole(KmsUserRole::SuperAdmin);
$attributes[] = (new TextField())
->setLabelText(__('KMS::global.homeHeroTitle'))
->setReference( 'home_hero_title')
->setMinimumUserRole(KmsUserRole::SuperAdmin);
// $attributes[] = (new Title(__('KMS::global.homeHeroVideoHeader')))
// ->setMinimumUserRole(KmsUserRole::SuperAdmin);
$attributes[] = (new Video())
->setLabelText(__('KMS::global.homeHeroVideo'))
->setReference( 'home_hero_video')
->setMinimumUserRole(KmsUserRole::SuperAdmin);
$attributes[] = (new Seperator())
->setMinimumUserRole(KmsUserRole::SuperAdmin);
$this->tabs->makeTab()->addItems($attributes);
}
}