Skip to content

Commit

Permalink
added refreshing + showing membership in skautis
Browse files Browse the repository at this point in the history
  • Loading branch information
Lung committed Nov 28, 2023
1 parent 04635e6 commit 4e893a9
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Skautis/SkautisController.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public function redirectFromSkautis(Request $request, Response $response): Respo
return $this->redirect($request, $response, 'landing', ['eventSlug' => $eventSlug]);
}

$this->skautisService->getOrCreateAndLogInSkautisUser($skautisUserData, $event);
$user = $this->skautisService->getOrCreateAndLogInSkautisUser($skautisUserData, $event);
$this->skautisService->updateSkautisUserMembership($user, $skautisUserData);

return $this->redirect($request, $response, 'getDashboard', ['eventSlug' => $eventSlug]);
}
Expand Down
8 changes: 8 additions & 0 deletions src/Skautis/SkautisService.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,12 @@ public function prefillDataFromSkautis(Participant $participant): Participant

return $participant;
}

public function updateSkautisUserMembership(User $user, SkautisUserData $skautisUserData): User
{
$user->skautisHasMembership = $skautisUserData->hasMembership;
$this->userRepository->persist($user);

return $user;
}
}
3 changes: 3 additions & 0 deletions src/Templates/cs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ detail:
driver-dont: "Nemám nebo na akci nechci řídit"
driver-less10k: "Mám, na akci chci řídit, ale mám najeto méně než 10 000 km"
driver-more10k: "Mám, na akci řídit chci a mám najeto víc než 10 000 km"
loginMethod: "Přihlášení"
closed-at: "Uzamknut"
adminNotice: "Poznámka od admina"
detail-guest:
Expand All @@ -153,6 +154,8 @@ detail-guest:
_layout:
title: "Registrace"
titleBar: "Registrace"
skautisAccountNotConnected: "nepropojeno s reálnou osobou"
skautisAccountConnected: "ověřeno"
logOut: "Odhlásit se"
editingBar: "Vyplnění údajů"
lockedBar: "Zamknuto"
Expand Down
3 changes: 3 additions & 0 deletions src/Templates/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ detail:
driver-dont: "I don't have it or I don't want to drive on the event"
driver-less10k: "I have it, but have not driven more than 10 000 km"
driver-more10k: "I have it and have driven more than 10 000 km"
loginMethod: "Login method"
closed-at: "Locked"
adminNotice: "Note from admin"
detail-guest:
Expand All @@ -153,6 +154,8 @@ detail-guest:
_layout:
title: "Registration"
titleBar: "Registration"
skautisAccountNotConnected: "not paired with real person"
skautisAccountConnected: "approved"
logOut: "Log out"
editingBar: "Editing"
lockedBar: "Locked"
Expand Down
3 changes: 3 additions & 0 deletions src/Templates/sk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ detail:
driver-dont: "Nemám alebo na akcii nechcem šoférovať"
driver-less10k: "Mám, ale mám najazdených menej ako 10 000 km"
driver-more10k: "Mám a mám najazdených viac ako 10 000 km"
loginMethod: "Přihlášení"
closed-at: "Uzamknut"
adminNotice: "Poznámka od admina"
detail-guest:
Expand All @@ -135,6 +136,8 @@ detail-guest:
_layout:
title: "Registrácia"
titleBar: "Registrácia"
skautisAccountNotConnected: "nepropojeno s reálnou osobou"
skautisAccountConnected: "ověřeno"
logOut: "Odhlásiť"
editingBar: "Otvorené"
lockedBar: "Uzamknuté"
Expand Down
3 changes: 3 additions & 0 deletions src/Templates/translatable/_layout.twig
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
{% if user is not null %}
| {% if user.loginType.value == 'skautis' %}
<img src="https://is.skaut.cz/Login/Favicons/favicon-16x16.png" alt="skautisLogo">
{% if not user.skautisHasMembership %}
{% trans %}_layout.skautisAccountNotConnected{% endtrans %} ❌
{% endif %}
{% else %}
📧
{% endif %}
Expand Down
12 changes: 12 additions & 0 deletions src/Templates/translatable/widgets/detailsForAdmin.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
{% include 'widgets/details.twig' with {'person': person, 'ca': ca} %}
<i>{% trans %}detail.loginMethod{% endtrans %}: <b>
{% if person.user.loginType.value == 'skautis' %}
skautis <img src="https://is.skaut.cz/Login/Favicons/favicon-16x16.png" alt="skautisLogo">
{% if not person.user.skautisHasMembership %}
{% trans %}_layout.skautisAccountNotConnected{% endtrans %} ❌
{% else %}
{% trans %}_layout.skautisAccountConnected{% endtrans %} ✔
{% endif %}
{% else %}
mail 📧
{% endif %}
</b></i><br/>
{% if person.getRegistrationCloseDate %}
<i>{% trans %}detail.closed-at{% endtrans %}: <b>{{ person.getRegistrationCloseDate.format('d. m. Y, H:i:s') }}</b></i><br/>
{% endif %}
Expand Down

0 comments on commit 4e893a9

Please sign in to comment.