File: D:/HostingSpaces/SBogers10/base.komma.pro/app/Vacancies/Kms/VacancySection.php
<?php
namespace App\Vacancies\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\MultiSelect;
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 App\Servicepoints\Models\Servicepoint;
use Komma\KMS\Users\Models\KmsUserRole;
final class VacancySection extends Section
{
/**
* Define the attributes and tabs for this section.
*
* @param Model $currentModel
*/
public function defineAttributesAndTabs(Model $currentModel = null): void
{
$servicePointService = \App::make(ServicepointService::class);
$servicePointOptions = $servicePointService->getOptionsForSelect(false, true);
$buttonsService = \App::make(ButtonService::class);
$buttonModels = $buttonsService->getOptionsForSelect();
$this->tabs->makeTab()->addItems([
(new OnOff())
->setReference('active')
->setLabelText(__('KMS::global.active'))
->switchOn(),
(new Seperator())->setMinimumUserRole(KmsUserRole::SuperAdmin),
(new Title())
->setLabelText(__('KMS::global.servicePoint'))
->setMinimumUserRole(KmsUserRole::SuperAdmin),
(new TextField())
->setReference('servicepoint_heading')
->setLabelText('Titel')
->setMinimumUserRole(KmsUserRole::SuperAdmin),
(new MultiSelect())
->setReference('servicepoint_id')
->setItems($servicePointOptions->toArray())
->setLabelText(__('KMS::servicePoints.section.title'))
->setMaxItemsToSelect(1)
->canBeLinkedWith(Servicepoint::class)
->setMinimumUserRole(KmsUserRole::Admin),
(new MultiSelect())
->setReference('servicepoint_button_id')
->setItems($buttonModels->toArray())
->setLabelText('Knop')
->setMinimumUserRole(KmsUserRole::SuperAdmin)
->setMaxItemsToSelect(1)
]);
$this->tabs->makeLanguageTabTemplate()->addItems([
(new TextField())
->setReference('name')
->setLabelText(__('KMS::global.title')),
(new TextArea())
->setReference('meta_description')
->setMinimumUserRole(KmsUserRole::SuperAdmin)
->setLabelText(__('KMS::global.metaDescription')),
(new ComponentArea())
->setReference('vacancy_components')
->setSubFolder('vacancy_component_data')
->setComponentTypes([
ComponentTypes::TEXT,
ComponentTypes::IMAGE,
ComponentTypes::TEXT_IMAGE,
ComponentTypes::VIDEO,
ComponentTypes::QUOTE,
ComponentTypes::CONTENT_PERSONAL,
ComponentTypes::TABS,
])
]);
}
}