Show available vouchers in user view
This commit is contained in:
parent
2be3e17db7
commit
3d5ce35f5e
|
@ -254,6 +254,7 @@ function User_get_eligable_voucher_count($user)
|
|||
}
|
||||
|
||||
$vouchers -= $user->state->got_voucher;
|
||||
$vouchers = floor($vouchers);
|
||||
if ($vouchers < 0) {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -766,14 +766,19 @@ function User_view_state_admin($freeloader, $user_source)
|
|||
. '</span>';
|
||||
}
|
||||
|
||||
$voucherCount = $user_source->state->got_voucher;
|
||||
$availableCount = $voucherCount + User_get_eligable_voucher_count($user_source);
|
||||
$availableCount = max($voucherCount, $availableCount);
|
||||
if ($user_source->state->got_voucher > 0) {
|
||||
$voucherCount = $user_source->state->got_voucher;
|
||||
$state[] = '<span class="text-success">'
|
||||
. glyph('cutlery')
|
||||
. _e('Got %s voucher', 'Got %s vouchers', $voucherCount, [$voucherCount])
|
||||
. __('Got %s of %s vouchers', [$voucherCount, $availableCount])
|
||||
. '</span>';
|
||||
} else {
|
||||
$state[] = '<span class="text-danger">' . __('Got no vouchers') . '</span>';
|
||||
$state[] = '<span class="text-danger">'
|
||||
. __('Got no vouchers')
|
||||
. ($availableCount ? ' (' . __('out of %s', [$availableCount]) . ')' : '')
|
||||
. '</span>';
|
||||
}
|
||||
|
||||
return $state;
|
||||
|
|
|
@ -2703,14 +2703,15 @@ msgstr "Nicht angekommen (Geplant: %s)"
|
|||
|
||||
#: includes/view/User_view.php:753
|
||||
#, php-format
|
||||
msgid "Got %s voucher"
|
||||
msgid_plural "Got %s vouchers"
|
||||
msgstr[0] "Einen Gutschein bekommen"
|
||||
msgstr[1] "%s Gutscheine bekommen"
|
||||
msgid "Got %s of %s vouchers"
|
||||
msgstr "%s von %s Gutscheinen bekommen"
|
||||
|
||||
#: includes/view/User_view.php:756
|
||||
msgid "Got no vouchers"
|
||||
msgstr "Gutschein nicht bekommen"
|
||||
msgstr "Keine Gutscheine bekommen"
|
||||
|
||||
msgid "out of %s"
|
||||
msgstr "von %s"
|
||||
|
||||
#: includes/view/User_view.php:797
|
||||
msgid "Rights"
|
||||
|
|
Loading…
Reference in New Issue