feat: show due or invalid documents on teamer dashboard

This commit is contained in:
Björn Fromme
2024-01-31 18:47:40 +01:00
parent 893be8a5eb
commit 258b8663dc
4 changed files with 37 additions and 24 deletions
+17
View File
@@ -57,12 +57,29 @@ class IndexController extends AbstractController
->getUpcomingDispositionsByTeamer($teamer) ->getUpcomingDispositionsByTeamer($teamer)
; ;
$dispositionDocuments = $this->processDocuments($upcomingDispositions);
return $this->render('teamer/index.html.twig', [ return $this->render('teamer/index.html.twig', [
'matchingAssignments' => $matchingAssignments, 'matchingAssignments' => $matchingAssignments,
'recentFeedback' => $recentFeedback, 'recentFeedback' => $recentFeedback,
'pendingApplications' => $pendingApplications, 'pendingApplications' => $pendingApplications,
'currentDispositions' => $currentDispositions, 'currentDispositions' => $currentDispositions,
'upcomingDispositions' => $upcomingDispositions, 'upcomingDispositions' => $upcomingDispositions,
'dispositionDocuments' => $dispositionDocuments,
]); ]);
} }
private function processDocuments(array $upcomingDispositions): array
{
$dispositions = [];
foreach ($upcomingDispositions as $disposition) {
/** @var Disposition $disposition */
if ($disposition->isContractDue() || $disposition->isContractRejected() || $disposition->isInvoiceDue()) {
$dispositions[] = $disposition;
}
}
return $dispositions;
}
} }
+9
View File
@@ -206,6 +206,15 @@ class Disposition implements BlameableEntityInterface, TimestampableEntityInterf
return $period->isStarted(); return $period->isStarted();
} }
public function isContractRejected(): bool
{
if (null === $contractDocument = $this->getDocumentByType(Upload::TYPE_CONTRACT)) {
return false;
}
return $contractDocument->isRejected();
}
public function isInvoiceDue(): bool public function isInvoiceDue(): bool
{ {
if (null !== $this->getDocumentByType(Upload::TYPE_INVOICE)) { if (null !== $this->getDocumentByType(Upload::TYPE_INVOICE)) {
@@ -23,27 +23,6 @@
} %} } %}
</div> </div>
<div> <div>
{% if disposition.assignment.documents|length %}
<h2 class="text-lg font-bold">
Dokumente
</h2>
<ul class="pb-4 divide-y divide-gray-200">
{% for document in disposition.assignment.documents %}
<li class="py-2">
<a href="{{ path('app_common_download', { 'uuid': document.uuid }) }}"
target="_blank"
title="Download {{ document }}"
class="group">
<div class="flex items-center justify-between">
<span class="flex-1">{{ document }}</span>
{{ icon('download', 'w-4 h-4 duration-200 group-hover:scale-125') }}
</div>
</a>
</li>
{% endfor %}
</ul>
{% endif %}
{# Upload contract #} {# Upload contract #}
{% if workflow_has_marked_place(disposition, 'new') %} {% if workflow_has_marked_place(disposition, 'new') %}
<h2 class="text-lg font-bold pb-4"> <h2 class="text-lg font-bold pb-4">
+11 -3
View File
@@ -41,9 +41,9 @@
Meine Dokumente Meine Dokumente
</h2> </h2>
<ul class="divide-y divide-gray-200"> <ul class="divide-y divide-gray-200">
{% for disposition in currentDispositions %} {% for disposition in dispositionDocuments %}
{% set assignment = disposition.assignment %} {% set assignment = disposition.assignment %}
{% if disposition.contractDue or disposition.invoiceDue %} {% if disposition.contractDue or disposition.invoiceDue or disposition.contractRejected %}
<li class="py-2 first:pt-0 last:pb-0"> <li class="py-2 first:pt-0 last:pb-0">
<a href="{{ path('app_teamer_disposition_detail', { 'uuid': disposition.uuid }) }}"> <a href="{{ path('app_teamer_disposition_detail', { 'uuid': disposition.uuid }) }}">
<div class="flex items-center space-x-1"> <div class="flex items-center space-x-1">
@@ -54,7 +54,15 @@
<span class="whitespace-nowrap">{{ assignment.destination.hotel }}</span> <span class="whitespace-nowrap">{{ assignment.destination.hotel }}</span>
</div> </div>
</div> </div>
<div class="pl-5 whitespace-nowrap">{% if disposition.contractDue %}Honorarvertrag{% else %}Honorarnote{% endif %} fällig</div> <div class="pl-5 whitespace-nowrap text-red-500">
{%- if disposition.contractDue -%}
Honorarvertrag fällig
{%- elseif disposition.contractRejected %}
Honorarvertrag muss erneut hochgeladen werden
{%- elseif disposition.invoiceDue -%}
Honorarnote fällig
{%- endif %}
</div>
</a> </a>
</li> </li>
{% endif %} {% endif %}