File: D:/HostingSpaces/SBogers10/base.komma.pro/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.index_image'))
->onlyAllowImages()
->setSmallDragAndDropArea()
->setMaxDocuments(1)
->setSubFolder('projects')
->setImageProperties([
(new ImageProperty())->setName('medium')->setCropMethod(ImageProperty::Fit)->setWidth(444)->setHeight(296),
]),
(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 TextField())
->setLabelText(__('KMS::global.title'))
->setReference('name'),
(new TextArea())
->setReference('meta_description')
->setMinimumUserRole(KmsUserRole::SuperAdmin)
->setLabelText(__('KMS::global.metaDescription')),
(new ComponentArea())
->setReference('project_components')
->setSubFolder('project_component_data')
->setComponentTypes([
ComponentTypes::TEXT,
ComponentTypes::IMAGE,
ComponentTypes::TEXT_IMAGE,
ComponentTypes::VIDEO,
ComponentTypes::QUOTE,
ComponentTypes::CONTENT_PERSONAL,
ComponentTypes::TABS,
ComponentTypes::FEATURED_SERVICES,
ComponentTypes::TESTIMONIALS,
])
]);
}
}