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 -= $user->state->got_voucher;
|
||||||
|
$vouchers = floor($vouchers);
|
||||||
if ($vouchers < 0) {
|
if ($vouchers < 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -766,14 +766,19 @@ function User_view_state_admin($freeloader, $user_source)
|
||||||
. '</span>';
|
. '</span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user_source->state->got_voucher > 0) {
|
|
||||||
$voucherCount = $user_source->state->got_voucher;
|
$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) {
|
||||||
$state[] = '<span class="text-success">'
|
$state[] = '<span class="text-success">'
|
||||||
. glyph('cutlery')
|
. glyph('cutlery')
|
||||||
. _e('Got %s voucher', 'Got %s vouchers', $voucherCount, [$voucherCount])
|
. __('Got %s of %s vouchers', [$voucherCount, $availableCount])
|
||||||
. '</span>';
|
. '</span>';
|
||||||
} else {
|
} 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;
|
return $state;
|
||||||
|
|
|
@ -2703,14 +2703,15 @@ msgstr "Nicht angekommen (Geplant: %s)"
|
||||||
|
|
||||||
#: includes/view/User_view.php:753
|
#: includes/view/User_view.php:753
|
||||||
#, php-format
|
#, php-format
|
||||||
msgid "Got %s voucher"
|
msgid "Got %s of %s vouchers"
|
||||||
msgid_plural "Got %s vouchers"
|
msgstr "%s von %s Gutscheinen bekommen"
|
||||||
msgstr[0] "Einen Gutschein bekommen"
|
|
||||||
msgstr[1] "%s Gutscheine bekommen"
|
|
||||||
|
|
||||||
#: includes/view/User_view.php:756
|
#: includes/view/User_view.php:756
|
||||||
msgid "Got no vouchers"
|
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
|
#: includes/view/User_view.php:797
|
||||||
msgid "Rights"
|
msgid "Rights"
|
||||||
|
|
Loading…
Reference in New Issue