File: D:/HostingSpaces/SBogers10/beat-the-barn.komma.nl/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\Documents;
use Komma\KMS\Core\Attributes\Models\ImageProperty;
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 Documents())
->setReference('vacancies')
->setLabelText(__('KMS::global.index_image'))
->onlyAllowImages()
->setSmallDragAndDropArea()
->setMaxDocuments(1)
->setImageProperties([
(new ImageProperty())->setName('small')->setCropMethod(ImageProperty::Fit)->setWidth(444)->setHeight(336),
])
->setSubFolder('vacancies'),
(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 TextField())
->setReference('teaser')
->setLabelText('Teaser'),
(new TextArea())
->setReference('description')
->setLabelText(__('KMS::global.description'))
->enableTinymceEditor(),
(new Seperator())
->setMinimumUserRole(KmsUserRole::Admin),
(new Title())
->setLabelText('Meta gegevens')
->setMinimumUserRole(KmsUserRole::Admin),
(new TextField())
->setReference('meta_title')
->setLabelText(__('KMS::global.metaTitle'))
->setMinimumUserRole(KmsUserRole::Admin),
(new TextArea())
->setReference('meta_description')
->setLabelText(__('KMS::global.metaDescription'))
->setMinimumUserRole(KmsUserRole::Admin),
// (new ComponentArea())
// ->setReference('vacancy_components')
// ->setSubFolder('vacancy_component_data')
// ->setComponentTypes([
// ComponentTypes::TEXT,
// ComponentTypes::IMAGE,
// ComponentTypes::TEXT_IMAGE,
// ComponentTypes::VIDEO,
// ComponentTypes::QUOTE,
// ComponentTypes::TEXT_IMAGE_BOX,
// ComponentTypes::TEASER,
// ComponentTypes::CARDS,
// ])
]);
}
}