feat: categories for job profiles

addresses #8698w62ex
This commit is contained in:
Björn Fromme
2025-04-30 10:19:40 +02:00
parent 3646661fed
commit 6f42ef9f7d
5 changed files with 83 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20250430080623 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->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);
}
}
+30
View File
@@ -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;
+9
View File
@@ -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,
@@ -1,6 +1,7 @@
{{ form_start(form) }}
<div class="flex flex-col space-y-4 pb-8">
{{ form_row(form.name) }}
{{ form_row(form.category) }}
{{ form_row(form.feedbackSet) }}
{{ form_row(form.requiredTrainings) }}
{{ form_row(form.requiredLicenses) }}
@@ -14,6 +14,9 @@
<th>
Bezeichnung
</th>
<th>
Kategorie
</th>
<th>
vorausg. Fortbildung(en)
</th>
@@ -31,6 +34,11 @@
{{ jobProfile.name }}
</a>
</td>
<td>
<a href="{{ path('app_admin_system_job_profile_edit', { 'id': jobProfile.id }) }}">
{{ jobProfile.categoryLabel | default('-') }}
</a>
</td>
<td>
<ul>
{% for training in jobProfile.requiredTrainings %}