feat: improved teamer status label in overview

This commit is contained in:
Björn Fromme
2024-04-04 08:58:17 +02:00
parent 8030f0b050
commit f596290960
3 changed files with 22 additions and 4 deletions
+20 -2
View File
@@ -25,9 +25,27 @@ class AppRuntime implements RuntimeExtensionInterface
) {
}
public function teamerStatusLabel(string $status): string
public function teamerStatusLabel(Teamer $teamer): string
{
if (Teamer::STATUS_NEW === $status) {
$labelItems = [];
if ($teamer->getUser()->hasRole('ROLE_ADMIN')) {
$labelItems[] = 'Admin';
}
if ($teamer->getUser()->hasRole('ROLE_MANAGER')) {
$labelItems[] = 'Reisemanagement';
}
if ($teamer->getUser()->hasRole('ROLE_HOUSE_MANAGER')) {
$labelItems[] = 'Hausleitung';
}
if (0 < count($labelItems)) {
return implode(', ', $labelItems);
}
if (Teamer::STATUS_NEW === $teamer->getStatus()) {
return 'Neuteamer:in';
}
+1 -1
View File
@@ -78,7 +78,7 @@
Status:
</div>
<div>
{{ teamer.status|teamer_status_label }}
{{ teamer|teamer_status_label }}
</div>
</div>
<div>
@@ -80,7 +80,7 @@
</a>
</td>
<td>
{{ teamer.status|teamer_status_label }}
{{ teamer|teamer_status_label }}
</td>
<td>
{{ teamer.communication.email }}