diff --git a/migrations/Version20250430080623.php b/migrations/Version20250430080623.php new file mode 100644 index 0000000..33f5b95 --- /dev/null +++ b/migrations/Version20250430080623.php @@ -0,0 +1,35 @@ +addSql(<<<'SQL' + ALTER TABLE job_profile ADD category VARCHAR(255) DEFAULT NULL + SQL); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql(<<<'SQL' + ALTER TABLE job_profile DROP category + SQL); + } +} diff --git a/src/Entity/JobProfile.php b/src/Entity/JobProfile.php index 5ba0657..e097164 100644 --- a/src/Entity/JobProfile.php +++ b/src/Entity/JobProfile.php @@ -20,6 +20,10 @@ class JobProfile implements BlameableEntityInterface, TimestampableEntityInterfa use TimestampableEntity; use SoftDeletableEntity; + public const CATEGORY_GUIDE = 'guide'; + public const CATEGORY_COURSE = 'course'; + public const CATEGORY_SERVICE = 'service'; + #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] @@ -32,6 +36,10 @@ class JobProfile implements BlameableEntityInterface, TimestampableEntityInterfa #[Assert\NotBlank(message: 'Bitte gib die Bezeichnung an')] private ?string $name = null; + #[ORM\Column(length: 255, nullable: true)] + #[Assert\NotBlank(message: 'Bitte wähle die Kategorie')] + private ?string $category = null; + #[ORM\Column(type: Types::JSON)] private array $requiredLicenses = []; @@ -74,6 +82,28 @@ class JobProfile implements BlameableEntityInterface, TimestampableEntityInterfa return $this; } + public function getCategory(): ?string + { + return $this->category; + } + + public function setCategory(?string $category): static + { + $this->category = $category; + + return $this; + } + + public function getCategoryLabel(): ?string + { + return match ($this->category) { + static::CATEGORY_GUIDE => 'Reiseleitung', + static::CATEGORY_COURSE => 'Kursleitung', + static::CATEGORY_SERVICE => 'Serviceteam', + default => null, + }; + } + public function getRequiredLicenses(): array { return $this->requiredLicenses; diff --git a/src/Form/JobProfileType.php b/src/Form/JobProfileType.php index 569cd2e..52a8fe7 100644 --- a/src/Form/JobProfileType.php +++ b/src/Form/JobProfileType.php @@ -22,6 +22,15 @@ class JobProfileType extends AbstractType ->add('name', TextType::class, [ 'label' => 'Bezeichnung', ]) + ->add('category', ChoiceType::class, [ + 'label' => 'Kategorie', + 'placeholder' => 'bitte zuordnen...', + 'choices' => [ + 'Reiseleitung' => JobProfile::CATEGORY_GUIDE, + 'Kursleitung' => JobProfile::CATEGORY_COURSE, + 'Serviceteam' => JobProfile::CATEGORY_SERVICE, + ], + ]) ->add('requiredTrainings', EntityType::class, [ 'label' => 'vorausgesetzte Fortbildung', 'required' => false, diff --git a/templates/admin/system/job_profile/_form.html.twig b/templates/admin/system/job_profile/_form.html.twig index c3907ca..4010af9 100644 --- a/templates/admin/system/job_profile/_form.html.twig +++ b/templates/admin/system/job_profile/_form.html.twig @@ -1,6 +1,7 @@ {{ form_start(form) }}
{{ form_row(form.name) }} + {{ form_row(form.category) }} {{ form_row(form.feedbackSet) }} {{ form_row(form.requiredTrainings) }} {{ form_row(form.requiredLicenses) }} diff --git a/templates/admin/system/job_profile/index.html.twig b/templates/admin/system/job_profile/index.html.twig index 1d43383..0782a4d 100644 --- a/templates/admin/system/job_profile/index.html.twig +++ b/templates/admin/system/job_profile/index.html.twig @@ -14,6 +14,9 @@ Bezeichnung + + Kategorie + vorausg. Fortbildung(en) @@ -31,6 +34,11 @@ {{ jobProfile.name }} + + + {{ jobProfile.categoryLabel | default('-') }} + +