show user-info icon with admin_arrive permission

This commit is contained in:
xuwhite 2023-12-14 22:15:17 +01:00 committed by GitHub
parent a35a3580e0
commit 48ea35562e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 45 additions and 16 deletions

View File

@ -98,7 +98,11 @@ function admin_arrive()
} }
} }
$usr->name = User_Nick_render($usr) . User_Pronoun_render($usr); $usr->name = User_Nick_render($usr)
. User_Pronoun_render($usr)
. ($usr->state->user_info
? ' <small><span class="bi bi-info-circle-fill text-info"></span></small>'
: '');
$plannedDepartureDate = $usr->personalData->planned_departure_date; $plannedDepartureDate = $usr->personalData->planned_departure_date;
$arrivalDate = $usr->state->arrival_date; $arrivalDate = $usr->state->arrival_date;
$plannedArrivalDate = $usr->personalData->planned_arrival_date; $plannedArrivalDate = $usr->personalData->planned_arrival_date;

View File

@ -97,7 +97,11 @@ function admin_free()
$email = $usr->contact->email ?: $usr->email; $email = $usr->contact->email ?: $usr->email;
$free_users_table[] = [ $free_users_table[] = [
'name' => User_Nick_render($usr) . User_Pronoun_render($usr), 'name' => User_Nick_render($usr)
. User_Pronoun_render($usr)
. ($usr->state->user_info
? ' <small><span class="bi bi-info-circle-fill text-info"></span></small>'
: ''),
'shift_state' => User_shift_state_render($usr), 'shift_state' => User_shift_state_render($usr),
'last_shift' => User_last_shift_render($usr), 'last_shift' => User_last_shift_render($usr),
'dect' => sprintf('<a href="tel:%s">%1$s</a>', htmlspecialchars((string) $usr->contact->dect)), 'dect' => sprintf('<a href="tel:%s">%1$s</a>', htmlspecialchars((string) $usr->contact->dect)),

View File

@ -282,7 +282,7 @@ function view_user_shifts()
$end_time = $shiftsFilter->getEnd()->format('H:i'); $end_time = $shiftsFilter->getEnd()->format('H:i');
if (config('signup_requires_arrival') && !$user->state->arrived) { if (config('signup_requires_arrival') && !$user->state->arrived) {
info(render_user_arrived_hint()); info(render_user_arrived_hint((bool) $user->state->user_info));
} }
$formattedDays = collect($days)->map(function ($value) { $formattedDays = collect($days)->map(function ($value) {

View File

@ -17,7 +17,7 @@ function location_view(Location $location, ShiftsFilterRenderer $shiftsFilterRen
$assignNotice = ''; $assignNotice = '';
if (config('signup_requires_arrival') && !$user->state->arrived) { if (config('signup_requires_arrival') && !$user->state->arrived) {
$assignNotice = info(render_user_arrived_hint(), true); $assignNotice = info(render_user_arrived_hint((bool) $user->state->user_info), true);
} }
$description = ''; $description = '';

View File

@ -92,7 +92,11 @@ function Users_view(
$usersList = []; $usersList = [];
foreach ($users as $user) { foreach ($users as $user) {
$u = []; $u = [];
$u['name'] = User_Nick_render($user) . User_Pronoun_render($user); $u['name'] = User_Nick_render($user)
. User_Pronoun_render($user)
. ($user->state->user_info
? ' <small><span class="bi bi-info-circle-fill text-info"></span></small>'
: '');
$u['first_name'] = htmlspecialchars((string) $user->personalData->first_name); $u['first_name'] = htmlspecialchars((string) $user->personalData->first_name);
$u['last_name'] = htmlspecialchars((string) $user->personalData->last_name); $u['last_name'] = htmlspecialchars((string) $user->personalData->last_name);
$u['dect'] = sprintf('<a href="tel:%s">%1$s</a>', htmlspecialchars((string) $user->contact->dect)); $u['dect'] = sprintf('<a href="tel:%s">%1$s</a>', htmlspecialchars((string) $user->contact->dect));
@ -519,6 +523,7 @@ function User_view(
$nightShiftsConfig = config('night_shifts'); $nightShiftsConfig = config('night_shifts');
$user_name = htmlspecialchars((string) $user_source->personalData->first_name) . ' ' $user_name = htmlspecialchars((string) $user_source->personalData->first_name) . ' '
. htmlspecialchars((string) $user_source->personalData->last_name); . htmlspecialchars((string) $user_source->personalData->last_name);
$user_info_show = auth()->can('user.info.show');
$myshifts_table = ''; $myshifts_table = '';
if ($its_me || $admin_user_privilege || $tshirt_admin) { if ($its_me || $admin_user_privilege || $tshirt_admin) {
$my_shifts = User_view_myshifts( $my_shifts = User_view_myshifts(
@ -564,10 +569,12 @@ function User_view(
. htmlspecialchars($user_source->name) . htmlspecialchars($user_source->name)
. (config('enable_user_name') ? ' <small>' . $user_name . '</small>' : '') . (config('enable_user_name') ? ' <small>' . $user_name . '</small>' : '')
. ( . (
(auth()->can('user.info.show') && $user_source->state->user_info) (($user_info_show || auth()->can('admin_arrive')) && $user_source->state->user_info)
? ( ? (
' <small><span class="bi bi-info-circle-fill text-info" data-bs-toggle="tooltip" title="' ' <small><span class="bi bi-info-circle-fill text-info" '
. htmlspecialchars($user_source->state->user_info) . ($user_info_show
? 'data-bs-toggle="tooltip" title="' . htmlspecialchars($user_source->state->user_info)
: '')
. '"></span></small>' . '"></span></small>'
) )
: '' : ''
@ -952,17 +959,20 @@ function render_user_freeloader_hint()
} }
/** /**
* Hinweis für Engel, die noch nicht angekommen sind * hint for angels, which are not arrived yet
* *
* @return string|null * @return string|null
*/ */
function render_user_arrived_hint() function render_user_arrived_hint(bool $is_user_shifts = false)
{ {
$user_info = auth()->user()->state->user_info;
if (config('signup_requires_arrival') && !auth()->user()->state->arrived) { if (config('signup_requires_arrival') && !auth()->user()->state->arrived) {
/** @var Carbon $buildup */ /** @var Carbon $buildup */
$buildup = config('buildup_start'); $buildup = config('buildup_start');
if (!empty($buildup) && $buildup->lessThan(new Carbon())) { if (!empty($buildup) && $buildup->lessThan(new Carbon())) {
return __('You are not marked as arrived. Please go to heaven\'s desk, get your angel badge and/or tell them that you arrived already.'); return !$user_info
? __('You are not marked as arrived. Please go to heaven, get your angel badge and/or tell them that you arrived already.')
: ($is_user_shifts ? __('user_info.not_arrived_hint') : null);
} }
} }

View File

@ -1267,11 +1267,11 @@ msgid "Rights"
msgstr "Berechtigungen" msgstr "Berechtigungen"
msgid "" msgid ""
"You are not marked as arrived. Please go to heaven's desk, get your angel " "You are not marked as arrived. Please go to heaven, get your angel "
"badge and/or tell them that you arrived already." "badge and/or tell them that you arrived already."
msgstr "" msgstr ""
"Du bist nicht als angekommen markiert. Bitte gehe zur Himmelsverwaltung, " "Du bist nicht als angekommen markiert. Geh bitte zum Himmel, "
"hole Dein Badge ab und/oder erkläre ihnen, dass Du bereits angekommen bist." "hole Dein Badge ab und/oder melde dich als angekommen."
msgid "" msgid ""
"Please enter your planned date of departure on your settings page to give us " "Please enter your planned date of departure on your settings page to give us "
@ -1995,7 +1995,13 @@ msgid "user.info"
msgstr "Benutzer Info" msgstr "Benutzer Info"
msgid "user.info.hint" msgid "user.info.hint"
msgstr "Wird auf der Benutzer Seite für Schichtkoordinatoren und Admins angezeigt." msgstr ""
"Wird auf der Benutzer Seite für Schichtkoordinatoren und Admins angezeigt. "
"Wenn ein Engel nicht als angekommen markiert ist, "
"entfernt eine Benutzer Info die nicht-angekommen Nachricht im Systemmenü des Engels."
msgid "user_info.not_arrived_hint"
msgstr "Wenn du dich für Schichten eintragen willst, komm gerne im Himmel vorbei."
msgid "design.title" msgid "design.title"
msgstr "Design" msgstr "Design"

View File

@ -733,7 +733,12 @@ msgid "user.info"
msgstr "User info" msgstr "User info"
msgid "user.info.hint" msgid "user.info.hint"
msgstr "Is displayed for shift coordinators and admins in the user view." msgstr ""
"Is displayed for shift coordinators and admins in the user view. "
"If an angel is not marked as arrived a user-info removes the not-arrived notification in the angels sysmenu."
msgid "user_info.not_arrived_hint"
msgstr "If you want to sign up for shifts, feel free to drop by heaven."
msgid "email.greeting" msgid "email.greeting"
msgstr "Hi %s," msgstr "Hi %s,"