File: D:/HostingSpaces/SBogers68/otium-gebiedsontwikkeling.nl/app/Projects/Kms/ProjectSection.php
<?php
namespace App\Projects\Kms;
use App\Buttons\Kms\ButtonService;
use App\Components\ComponentTypes;
use Illuminate\Database\Eloquent\Model;
use Komma\KMS\Core\Attributes\ComponentArea;
use Komma\KMS\Core\Attributes\Models\ImageProperty;
use Komma\KMS\Core\Attributes\MultiSelect;
use Komma\KMS\Core\Attributes\Documents;
use Komma\KMS\Core\Attributes\OnOff;
use Komma\KMS\Core\Attributes\Seperator;
use Komma\KMS\Core\Attributes\TextArea;
use Komma\KMS\Core\Attributes\TextField;
use Komma\KMS\Core\Attributes\Title;
use Komma\KMS\Core\Sections\Section;
use App\Servicepoints\Kms\ServicepointService;
use Komma\KMS\Users\Models\KmsUserRole;
final class ProjectSection extends Section
{
public function defineAttributesAndTabs(Model $currentModel = null): void
{
/** @var ServicepointService $servicePointService */
$servicePointService = \App::make(ServicepointService::class);
$servicePointOptions = $servicePointService->getOptionsForSelect(false);
/** @var ButtonService $buttonsService */
$buttonsService = \App::make(ButtonService::class);
$buttonModels = $buttonsService->getOptionsForSelect();
$this->tabs->makeTab()->addItems([
(new OnOff())
->setReference('active')
->setLabelText(__('KMS::global.active'))
->switchOn(),
(new Documents())
->setReference('projects')
->setLabelText(__('KMS::global.image'))
->onlyAllowImages()
->setSmallDragAndDropArea()
->setMaxDocuments(1)
->setSubFolder('projects')
->setImageProperties([
(new ImageProperty())->setName('small')->setCropMethod(ImageProperty::Fit)->setWidth(500)->setHeight(500),
(new ImageProperty())->setName('medium')->setCropMethod(ImageProperty::Fit)->setWidth(720)->setHeight(414),
(new ImageProperty())->setName('large')->setCropMethod(ImageProperty::Fit)->setWidth(1440)->setHeight(828),
]),
//
// (new Seperator())
// ->setMinimumUserRole(KmsUserRole::SuperAdmin),
// (new Title())
// ->setLabelText(__('KMS::global.servicePoint'))
// ->setMinimumUserRole(KmsUserRole::SuperAdmin),
//
// (new TextField())
// ->setReference('servicepoint_heading')
// ->setLabelText(__('KMS::global.servicePoint'))
// ->setMinimumUserRole(KmsUserRole::SuperAdmin),
// (new MultiSelect())
// ->setReference('servicepoint_id')
// ->setItems($servicePointOptions->toArray())
// ->setLabelText(__('KMS::servicepoints.section.title'))
// ->setMaxItemsToSelect(1)
// ->setMinimumUserRole(KmsUserRole::SuperAdmin),
//
// (new MultiSelect())
// ->setReference('servicepoint_button_id')
// ->setItems($buttonModels->toArray())
// ->setLabelText('Knop')
// ->setMinimumUserRole(KmsUserRole::SuperAdmin)
// ->setMaxItemsToSelect(1),
]);
$this->tabs->makeLanguageTabTemplate()->addItems([
(new Title())
->setValue('Project gegevens'),
(new TextField())
->setLabelText(__('KMS::global.title'))
->setReference('name'),
(new TextField())
->setLabelText('Subtitel')
->setReference('subTitle'),
(new Seperator())
->setMinimumUserRole(KmsUserRole::Admin),
(new Title())
->setValue('Metadata'),
(new TextField())
->setReference('meta_title')
->setMinimumUserRole(KmsUserRole::Admin)
->setLabelText(__('KMS::global.metaTitle')),
(new TextArea())
->setReference('meta_description')
->setMinimumUserRole(KmsUserRole::Admin)
->setLabelText(__('KMS::global.metaDescription')),
(new ComponentArea())
->setReference('project_components')
->setSubFolder('project_component_data')
->setComponentTypes([
ComponentTypes::VIDEO_TEXT,
ComponentTypes::IMAGE,
ComponentTypes::TEXT,
ComponentTypes::DATA,
ComponentTypes::TEXT_IMAGE,
// ComponentTypes::QUOTE,
// ComponentTypes::CONTENT_PERSONAL,
// ComponentTypes::FEATURED_SERVICES,
// ComponentTypes::TESTIMONIALS,
])
]);
}
}