Feat: Add voter to prevent applications to fully equipped assignments

This commit is contained in:
Björn Fromme
2023-11-03 10:31:51 +01:00
parent d016ee043a
commit 0d7f9afdfe
2 changed files with 44 additions and 27 deletions
+21 -22
View File
@@ -64,32 +64,31 @@
{% if assignment.applications|length %}
{% set application = assignment.applications[0] %}
{% if application.status == constant('App\\Entity\\Application::STATUS_REJECTED') %}
{% set icon = 'close' %}
{% set class = 'bg-gray-100 text-gray-800 hover:bg-gray-50' %}
{% set url = path('app_teamer_assignment', { 'uuid': assignment.uuid, 'r': return_url() }) %}
{% set label = 'Bewerbung abgelehnt' %}
<a href="{{ path('app_teamer_assignment', { 'uuid': assignment.uuid, 'r': return_url() }) }}"
class="btn btn--small flex items-center space-x-2 bg-gray-100 text-gray-800 hover:bg-gray-50">
{{ icon('close', 'w-4 h-4 shrink-0') }}
<span>Bewerbung abgelehnt</span>
</a>
{% else %}
{% set icon = 'hourglass' %}
{% set class = 'bg-yellow-100 text-yellow-800 hover:bg-yellow-50' %}
{% set url = path('app_teamer_assignment', { 'uuid': assignment.uuid, 'r': return_url() }) %}
{% set label = 'in Bearbeitung' %}
<a href="{{ path('app_teamer_assignment', { 'uuid': assignment.uuid, 'r': return_url() }) }}"
class="btn btn--small flex items-center space-x-2 bg-yellow-100 text-yellow-800 hover:bg-yellow-50">
{{ icon('hourglass', 'w-4 h-4 shrink-0') }}
<span>in Bearbeitung</span>
</a>
{% endif %}
{% elseif assignment.dispositions|length %}
{% set icon = 'check' %}
{% set class = 'bg-green-100 text-green-700 hover:bg-green-50' %}
{% set url = path('app_teamer_disposition_detail', { 'uuid': assignment.dispositions[0].uuid }) %}
{% set label = 'eingeteilt' %}
{% else %}
{% set icon = 'hand' %}
{% set class = '' %}
{% set url = path('app_teamer_assignment', { 'uuid': assignment.uuid, 'r': return_url() }) %}
{% set label = 'bewerben' %}
<a href="{{ path('app_teamer_disposition_detail', { 'uuid': assignment.dispositions[0].uuid }) }}"
class="btn btn--small flex items-center space-x-2 bg-green-100 text-green-700 hover:bg-green-50">
{{ icon('check', 'w-4 h-4 shrink-0') }}
<span>eingeteilt</span>
</a>
{% elseif is_granted('APPLY', assignment) %}
<a href="{{ path('app_teamer_assignment', { 'uuid': assignment.uuid, 'r': return_url() }) }}"
class="btn btn--small flex items-center space-x-2">
{{ icon('hand', 'w-4 h-4 shrink-0') }}
<span>bewerben</span>
</a>
{% endif %}
<a href="{{ url }}"
class="btn btn--small flex items-center space-x-2 {{ class }}">
{{ icon(icon, 'w-4 h-4 shrink-0') }}
<span>{{ label }}</span>
</a>
</div>
{% set isBookmarked = teamer.bookmarks.contains(assignment) %}
<a href="{{ path('app_teamer_bookmark_toggle', { 'uuid': assignment.uuid, 'r': return_url() }) }}"