HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
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,
                ])
        ]);
    }
}