feat: display assignments' dispositions and applications status in list

This commit is contained in:
Björn Fromme
2024-02-28 09:51:23 +01:00
parent 28c7f83f47
commit 63b78ef616
2 changed files with 43 additions and 7 deletions
+17
View File
@@ -463,4 +463,21 @@ class Assignment implements BlameableEntityInterface, TimestampableEntityInterfa
return $this; return $this;
} }
public function isStaffed(): bool
{
return $this->availableDispositions === $this->dispositions->count();
}
public function isPartlyStaffed(): bool
{
return $this->availableDispositions > $this->dispositions->count()
&& 0 === $this->applications->count();
}
public function isInProgress(): bool
{
return $this->availableDispositions > $this->dispositions->count()
&& 0 < $this->applications->count();
}
} }
@@ -62,13 +62,32 @@
{% for assignment in pagination %} {% for assignment in pagination %}
<tr> <tr>
<td> <td>
{% if assignment.status == 'closed' %} <div class="flex flex-col items-center space-y-2">
{{ icon('locked', 'w-4 h-4 text-red-500') }} {% if assignment.staffed %}
{% elseif assignment.status == 'draft' %} <svg viewBox="0 0 5 5" class="h-4 w-4 fill-current text-green-500">
{{ icon('hourglass', 'w-4 h-4 text-yellow-500') }} <circle cx="3" cy="3" r="2" />
{% else %} </svg>
{{ icon('unlocked', 'w-4 h-4') }} {% elseif assignment.partlyStaffed %}
{% endif %} <svg viewBox="0 0 5 5" class="h-4 w-4 fill-current text-yellow-500">
<circle cx="3" cy="3" r="2" />
</svg>
{% elseif assignment.inProgress %}
<svg viewBox="0 0 5 5" class="h-4 w-4 fill-current text-blue-500">
<circle cx="3" cy="3" r="2" />
</svg>
{% else %}
<svg viewBox="0 0 5 5" class="h-4 w-4 fill-current text-gray-100">
<circle cx="3" cy="3" r="2" />
</svg>
{% endif %}
{% if assignment.status == 'closed' %}
{{ icon('locked', 'w-4 h-4 text-red-500') }}
{% elseif assignment.status == 'draft' %}
{{ icon('hourglass', 'w-4 h-4 text-yellow-500') }}
{% else %}
{{ icon('unlocked', 'w-4 h-4') }}
{% endif %}
</div>
</td> </td>
<td> <td>
<a href="{{ path('app_administrative_assignment_detail', { 'uuid': assignment.uuid, 'r': return_url() }) }}"> <a href="{{ path('app_administrative_assignment_detail', { 'uuid': assignment.uuid, 'r': return_url() }) }}">