feat: additional categories for job profiles
addresses #869dv9m9g
This commit is contained in:
+32
-10
@@ -21,12 +21,41 @@ class JobProfile implements BlameableEntityInterface, TimestampableEntityInterfa
|
|||||||
use SoftDeletableEntity;
|
use SoftDeletableEntity;
|
||||||
|
|
||||||
public const CATEGORY_GUIDE = 'guide';
|
public const CATEGORY_GUIDE = 'guide';
|
||||||
public const CATEGORY_COURSE = 'course';
|
|
||||||
public const CATEGORY_COURSE_SKI = 'course_ski';
|
public const CATEGORY_COURSE_SKI = 'course_ski';
|
||||||
|
public const CATEGORY_COURSE_SKI_BEGINNER = 'course_ski_beginner';
|
||||||
|
public const CATEGORY_COURSE_SKI_ADVANCED = 'course_ski_advanced';
|
||||||
public const CATEGORY_COURSE_BOARD = 'course_board';
|
public const CATEGORY_COURSE_BOARD = 'course_board';
|
||||||
|
public const CATEGORY_COURSE_BOARD_BEGINNER = 'course_board_beginner';
|
||||||
|
public const CATEGORY_COURSE_BOARD_ADVANCED = 'course_board_advanced';
|
||||||
public const CATEGORY_SERVICE = 'service';
|
public const CATEGORY_SERVICE = 'service';
|
||||||
public const CATEGORY_EVENT_TEAM = 'event_team';
|
public const CATEGORY_EVENT_TEAM = 'event_team';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array<string, string>
|
||||||
|
*/
|
||||||
|
public static function getCategories(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
self::CATEGORY_GUIDE => 'Reiseleitung',
|
||||||
|
self::CATEGORY_COURSE_SKI => 'Kursleitung Ski',
|
||||||
|
self::CATEGORY_COURSE_SKI_BEGINNER => 'Kursleitung Ski Anfänger:innen',
|
||||||
|
self::CATEGORY_COURSE_SKI_ADVANCED => 'Kursleitung Ski fortgeschritten',
|
||||||
|
self::CATEGORY_COURSE_BOARD => 'Kursleitung Board',
|
||||||
|
self::CATEGORY_COURSE_BOARD_BEGINNER => 'Kursleitung Board Anfänger:innen',
|
||||||
|
self::CATEGORY_COURSE_BOARD_ADVANCED => 'Kursleitung Board fortgeschritten',
|
||||||
|
self::CATEGORY_SERVICE => 'Serviceteamer:in',
|
||||||
|
self::CATEGORY_EVENT_TEAM => 'Eventteamer:in',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return list<string>
|
||||||
|
*/
|
||||||
|
public static function getCategoryValues(): array
|
||||||
|
{
|
||||||
|
return array_keys(self::getCategories());
|
||||||
|
}
|
||||||
|
|
||||||
#[ORM\Id]
|
#[ORM\Id]
|
||||||
#[ORM\GeneratedValue]
|
#[ORM\GeneratedValue]
|
||||||
#[ORM\Column]
|
#[ORM\Column]
|
||||||
@@ -41,6 +70,7 @@ class JobProfile implements BlameableEntityInterface, TimestampableEntityInterfa
|
|||||||
|
|
||||||
#[ORM\Column(length: 255, nullable: true)]
|
#[ORM\Column(length: 255, nullable: true)]
|
||||||
#[Assert\NotBlank(message: 'Bitte wähle die Kategorie')]
|
#[Assert\NotBlank(message: 'Bitte wähle die Kategorie')]
|
||||||
|
#[Assert\Choice(callback: [self::class, 'getCategoryValues'], message: 'Die Kategorie ist ungültig')]
|
||||||
private ?string $category = null;
|
private ?string $category = null;
|
||||||
|
|
||||||
#[ORM\Column(type: Types::JSON)]
|
#[ORM\Column(type: Types::JSON)]
|
||||||
@@ -99,15 +129,7 @@ class JobProfile implements BlameableEntityInterface, TimestampableEntityInterfa
|
|||||||
|
|
||||||
public function getCategoryLabel(): ?string
|
public function getCategoryLabel(): ?string
|
||||||
{
|
{
|
||||||
return match ($this->category) {
|
return self::getCategories()[$this->category] ?? null;
|
||||||
static::CATEGORY_GUIDE => 'Reiseleitung',
|
|
||||||
static::CATEGORY_COURSE => 'Kursleitung',
|
|
||||||
static::CATEGORY_COURSE_SKI => 'Kursleitung Ski',
|
|
||||||
static::CATEGORY_COURSE_BOARD => 'Kursleitung Board',
|
|
||||||
static::CATEGORY_SERVICE => 'Serviceteam',
|
|
||||||
static::CATEGORY_EVENT_TEAM => 'Eventteam',
|
|
||||||
default => null,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getRequiredLicenses(): array
|
public function getRequiredLicenses(): array
|
||||||
|
|||||||
@@ -25,13 +25,7 @@ class JobProfileType extends AbstractType
|
|||||||
->add('category', ChoiceType::class, [
|
->add('category', ChoiceType::class, [
|
||||||
'label' => 'Kategorie',
|
'label' => 'Kategorie',
|
||||||
'placeholder' => 'bitte zuordnen...',
|
'placeholder' => 'bitte zuordnen...',
|
||||||
'choices' => [
|
'choices' => array_flip(JobProfile::getCategories()),
|
||||||
'Reiseleitung' => JobProfile::CATEGORY_GUIDE,
|
|
||||||
'Kursleitung Ski' => JobProfile::CATEGORY_COURSE_SKI,
|
|
||||||
'Kursleitung Board' => JobProfile::CATEGORY_COURSE_BOARD,
|
|
||||||
'Serviceteam' => JobProfile::CATEGORY_SERVICE,
|
|
||||||
'Eventteam' => JobProfile::CATEGORY_EVENT_TEAM,
|
|
||||||
],
|
|
||||||
])
|
])
|
||||||
->add('requiredTrainings', EntityType::class, [
|
->add('requiredTrainings', EntityType::class, [
|
||||||
'label' => 'vorausgesetzte Fortbildung',
|
'label' => 'vorausgesetzte Fortbildung',
|
||||||
|
|||||||
Reference in New Issue
Block a user