feat: allow withdrawal of application unless rejected
This commit is contained in:
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user