feat: allow withdrawal of application unless rejected

This commit is contained in:
Björn Fromme
2024-12-02 14:27:40 +01:00
parent 8aca2a5e87
commit 4d2f37eec1
2 changed files with 11 additions and 7 deletions
+7 -5
View File
@@ -54,12 +54,14 @@ class ApplicationVoter extends Voter
if ($this->security->isGranted('ROLE_TEAMER') && in_array($attribute, $teamerAttributes)) {
$teamer = $user->getTeamer();
if ($teamer !== $application->getTeamer()) {
return false;
}
return match ($attribute) {
static::WITHDRAW => $teamer === $application->getTeamer(),
static::DELETE => $teamer === $application->getTeamer()
&& Application::STATUS_REJECTED === $status,
static::VIEW => $teamer === $application->getTeamer()
&& Application::STATUS_REJECTED !== $status,
static::DELETE => Application::STATUS_REJECTED === $status,
static::VIEW, static::WITHDRAW => Application::STATUS_REJECTED !== $status,
default => false,
};
}
+4 -2
View File
@@ -22,12 +22,14 @@
{% if application.comment and application.commentVisible %}
<strong>Begründung:</strong> {{ application.comment|nl2br}}
{% endif %}
{% elseif application.status == constant('App\\Entity\\Application::STATUS_PENDING') %}
{% endif %}
{% if application.status == constant('App\\Entity\\Application::STATUS_PENDING') %}
<twig:MessageBox message="Deine Bewerbung befindet sich in Bearbeitung."/>
{% if application.comment and application.commentVisible %}
<strong>Begründung:</strong> {{ application.comment|nl2br}}
{% endif %}
{% else %}
{% endif %}
{% if is_granted('WITHDRAW', application) %}
<twig:MessageBox message="Du hast dich am {{ application.createdAt|date('d.m.Y') }} auf diesen Einsatz beworben."/>
<button type="button"
class="btn btn--secondary"