Skip to content

Commit fd507a2

Browse files
committed
feat: adding purchase link to kulturkortet
1 parent d3b995a commit fd507a2

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

library/Kulturkortet/QRCodeViewer/KulturkortetQRCodeViewerAuthViewFactory.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function whenAuthenticated(MunicipioAuthenticatedUserInterface $user, Mun
6060
'days' => $this->wpService->__('Days', 'municipio'),
6161
'yourCultureCard' => $this->wpService->__('Your Kulturkort', 'municipio'),
6262
],
63-
'actions' => $this->getActions($navigation),
63+
'actions' => $this->getActions($navigation, true),
6464
'profile' => [
6565
'firstname' => $ticket['firstname'] ?? '',
6666
'lastname' => $ticket['lastname'] ?? '',
@@ -131,7 +131,7 @@ private function formatDate(mixed $date): ?string
131131
return $time ? date(DateFormat::getDateFormat('date'), $time) : null;
132132
}
133133

134-
private function getActions(MunicipioAuthNavigationInterface $navigation): array
134+
private function getActions(MunicipioAuthNavigationInterface $navigation, bool $hasValidKulturkort = false): array
135135
{
136136
$actions = [];
137137
if (!empty($this->attributes['profileLink'] ?? '')) {
@@ -142,6 +142,14 @@ private function getActions(MunicipioAuthNavigationInterface $navigation): array
142142
);
143143
}
144144

145+
if (!empty($this->attributes['renewLink'] ?? '')) {
146+
$actions[] = ActionCreator::create(
147+
$hasValidKulturkort ? $this->wpService->__('Renew', 'municipio') : $this->wpService->__('Buy', 'municipio'),
148+
$this->attributes['renewLink'],
149+
'shopping_cart'
150+
);
151+
}
152+
145153
$actions[] = ActionCreator::create(
146154
$this->wpService->__('Logout', 'municipio'),
147155
$navigation->getModifiedHomeUrl(addQueryArgs: ['action' => 'logout']),

0 commit comments

Comments
 (0)