send mail to user when account balances is added to

This commit was merged in pull request #25.
This commit is contained in:
David Rodenkirchen
2025-07-30 13:33:55 +02:00
parent 29caadaca2
commit af8cf19dc8
3 changed files with 25 additions and 3 deletions
@@ -6,7 +6,7 @@ from rio import Column, Component, event, TextStyle, Text, TextInput, ThemeConte
PointerEventListener, PointerEvent, Rectangle, CursorStyle, Color, TextInputChangeEvent, Spacer, Row, Switch, \
SwitchChangeEvent, EventHandler
from src.ezgg_lan_manager import ConfigurationService, UserService, AccountingService, SeatingService
from src.ezgg_lan_manager import ConfigurationService, UserService, AccountingService, SeatingService, MailingService
from src.ezgg_lan_manager.components.MainViewContentBox import MainViewContentBox
from src.ezgg_lan_manager.components.NewTransactionForm import NewTransactionForm
from src.ezgg_lan_manager.components.UserEditForm import UserEditForm
@@ -104,11 +104,17 @@ class ManageUsersPage(Component):
self.accounting_section_result_success = False
return
else:
await self.session[AccountingService].add_balance(
new_total_balance = await self.session[AccountingService].add_balance(
transaction.user_id,
transaction.value,
transaction.reference
)
user = await self.session[UserService].get_user(transaction.user_id)
await self.session[MailingService].send_email(
"Dein Guthaben wurde aufgeladen",
self.session[MailingService].generate_account_balance_added_mail_body(user, transaction.value, new_total_balance),
user.user_mail
)
self.accounting_section_result_text = f"Guthaben {'entfernt' if transaction.is_debit else 'hinzugefügt'}!"
self.accounting_section_result_success = True