add hints for required profile settings

This commit is contained in:
Xu 2023-11-12 18:07:40 +01:00 committed by Igor Scheller
parent 9e3adf6179
commit 6022d792dc
4 changed files with 100 additions and 10 deletions

View File

@ -36,8 +36,12 @@ function header_render_hints()
// Important hints:
$hints_renderer->addHint(render_user_freeloader_hint(), true);
$hints_renderer->addHint(render_user_arrived_hint(), true);
$hints_renderer->addHint(render_user_pronoun_hint(), true);
$hints_renderer->addHint(render_user_firstname_hint(), true);
$hints_renderer->addHint(render_user_lastname_hint(), true);
$hints_renderer->addHint(render_user_tshirt_hint(), true);
$hints_renderer->addHint(render_user_dect_hint(), true);
$hints_renderer->addHint(render_user_mobile_hint(), true);
return $hints_renderer->render();
}

View File

@ -957,7 +957,7 @@ function render_user_tshirt_hint()
&& config('required_user_fields')['tshirt_size']
&& !auth()->user()->personalData->shirt_size
) {
$text = __('You need to specify a tshirt size in your settings!');
$text = __('tshirt.required.hint');
return render_profile_link($text);
}
@ -970,8 +970,64 @@ function render_user_tshirt_hint()
function render_user_dect_hint()
{
$user = auth()->user();
if ($user->state->arrived && config('enable_dect') && !$user->contact->dect) {
$text = __('You need to specify a DECT phone number in your settings! If you don\'t have a DECT phone, just enter \'-\'.');
if ((config('required_user_fields')['dect'] || $user->state->arrived) && config('enable_dect') && !$user->contact->dect) {
$text = __('dect.required.hint');
return render_profile_link($text);
}
return null;
}
/**
* @return string|null
*/
function render_user_pronoun_hint()
{
$user = auth()->user();
if (config('required_user_fields')['pronoun'] && config('enable_pronoun') && !$user->personalData->pronoun) {
$text = __('pronoun.required.hint');
return render_profile_link($text);
}
return null;
}
/**
* @return string|null
*/
function render_user_firstname_hint()
{
$user = auth()->user();
if (config('required_user_fields')['firstname'] && config('enable_user_name') && !$user->personalData->first_name) {
$text = __('firstname.required.hint');
return render_profile_link($text);
}
return null;
}
/**
* @return string|null
*/
function render_user_lastname_hint()
{
$user = auth()->user();
if (config('required_user_fields')['lastname'] && config('enable_user_name') && !$user->personalData->last_name) {
$text = __('lastname.required.hint');
return render_profile_link($text);
}
return null;
}
/**
* @return string|null
*/
function render_user_mobile_hint()
{
$user = auth()->user();
if (config('required_user_fields')['mobile'] && !$user->contact->mobile) {
$text = __('mobile.required.hint');
return render_profile_link($text);
}

View File

@ -1403,15 +1403,25 @@ msgstr ""
"Du hast mindestens %s Schichten geschwänzt. Schicht-Registrierung ist "
"gesperrt. Bitte gehe zum Himmelsschreibtisch um wieder entsperrt zu werden."
msgid "You need to specify a tshirt size in your settings!"
msgstr "Bitte eine T-Shirt-Größe auswählen"
msgid "tshirt.required.hint"
msgstr "Bitte gib eine T-Shirt-Größe in deinen Einstellungen an."
msgid ""
"You need to specify a DECT phone number in your settings! If you don't have "
"a DECT phone, just enter '-'."
msgid "dect.required.hint"
msgstr ""
"Bitte eine DECT-Telefonnummer in den Einstellungen eingeben. Wenn du noch "
"keine Nummer hast, bitte einfach \"-\" angeben."
"Bitte gib eine DECT-Telefonnummer in deinen Einstellungen an. Wenn du "
"keine Nummer hast, trage einfach '-' ein."
msgid "pronoun.required.hint"
msgstr "Bitte gib ein Pronomen in deinen Einstellungen an."
msgid "firstname.required.hint"
msgstr "Bitte gib einen Vornamen in deinen Einstellungen an."
msgid "lastname.required.hint"
msgstr "Bitte gib einen Nachnamen in deinen Einstellungen an."
msgid "mobile.required.hint"
msgstr "Bitte gib eine Handynummer in deinen Einstellungen an."
msgid ""
"Here you can change the user entry. Under the item 'Arrived' the angel is marked as present, "

View File

@ -590,3 +590,23 @@ msgstr "What do you want to do?"
msgid "registration.register"
msgstr "Register"
msgid "tshirt.required.hint"
msgstr "Please specify a tshirt size in your settings!"
msgid "dect.required.hint"
msgstr ""
"Please specify a DECT phone number in your settings! "
"If you don't have a DECT phone, just enter '-'."
msgid "pronoun.required.hint"
msgstr "Please enter a pronoun in your settings!"
msgid "firstname.required.hint"
msgstr "Please enter a firstname in your settings!"
msgid "lastname.required.hint"
msgstr "Please enter a lastname in your settings!"
msgid "mobile.required.hint"
msgstr "Please enter a mobile number in your settings!"