explain freeloads for users and shicos

This commit is contained in:
Xu 2024-02-25 15:51:53 +01:00 committed by Igor Scheller
parent 100d62134f
commit f3a12ebda8
4 changed files with 79 additions and 13 deletions

View File

@ -1,5 +1,6 @@
<?php <?php
use Engelsystem\Config\GoodieType;
use Engelsystem\Models\AngelType; use Engelsystem\Models\AngelType;
use Engelsystem\Models\Location; use Engelsystem\Models\Location;
use Engelsystem\Models\Shifts\Shift; use Engelsystem\Models\Shifts\Shift;
@ -209,9 +210,22 @@ function ShiftEntry_edit_view(
$angeltype_supporter = false $angeltype_supporter = false
) { ) {
$freeload_form = []; $freeload_form = [];
$goodie = GoodieType::from(config('goodie_type'));
$goodie_enabled = $goodie !== GoodieType::None;
$goodie_tshirt = $goodie === GoodieType::Tshirt;
if ($user_admin_shifts || $angeltype_supporter) { if ($user_admin_shifts || $angeltype_supporter) {
if (!$goodie_enabled) {
$freeload_info = __('freeload.freeloaded.info', [config('max_freeloadable_shifts')]);
} else {
$freeload_info = __('freeload.freeloaded.info.goodie', [($goodie_tshirt
? __('T-shirt score')
: __('Goodie score')),
config('max_freeloadable_shifts')]);
}
$freeload_form = [ $freeload_form = [
form_checkbox('freeloaded', __('Freeloaded'), $freeloaded), form_checkbox('freeloaded', __('Freeloaded') . ' <span class="bi bi-info-circle-fill text-info" data-bs-toggle="tooltip" title="' .
$freeload_info . '"></span>', $freeloaded),
form_textarea( form_textarea(
'freeloaded_comment', 'freeloaded_comment',
__('Freeload comment (Only for shift coordination and supporters):'), __('Freeload comment (Only for shift coordination and supporters):'),

View File

@ -314,6 +314,7 @@ function User_view_myshift(Shift $shift, $user_source, $its_me)
$nightShiftsConfig = config('night_shifts'); $nightShiftsConfig = config('night_shifts');
$goodie = GoodieType::from(config('goodie_type')); $goodie = GoodieType::from(config('goodie_type'));
$goodie_enabled = $goodie !== GoodieType::None; $goodie_enabled = $goodie !== GoodieType::None;
$goodie_tshirt = $goodie === GoodieType::Tshirt;
$shift_info = '<a href="' . shift_link($shift) . '">' . htmlspecialchars($shift->shiftType->name) . '</a>'; $shift_info = '<a href="' . shift_link($shift) . '">' . htmlspecialchars($shift->shiftType->name) . '</a>';
if ($shift->title) { if ($shift->title) {
@ -350,16 +351,27 @@ function User_view_myshift(Shift $shift, $user_source, $its_me)
} }
if ($shift->freeloaded) { if ($shift->freeloaded) {
$myshift['duration'] = '<p class="text-danger">' $myshift['duration'] = '<p class="text-danger"><s>'
. sprintf('%.2f', -($shift->end->timestamp - $shift->start->timestamp) / 3600 * 2) . '&nbsp;h' . sprintf('%.2f', ($shift->end->timestamp - $shift->start->timestamp) / 3600) . '&nbsp;h'
. '</p>'; . '</s></p>';
if (auth()->can('user_shifts_admin')) { if (auth()->can('user_shifts_admin')) {
$myshift['comment'] .= '<br />' $myshift['comment'] .= '<br />'
. '<p class="text-danger">' . '<p class="text-danger">'
. __('Freeloaded') . ': ' . htmlspecialchars($shift->freeloaded_comment) . __('Freeloaded') . ': ' . htmlspecialchars($shift->freeloaded_comment)
. '</p>'; . '</p>';
} else { } else {
$myshift['comment'] .= '<br /><p class="text-danger">' . __('Freeloaded') . '</p>'; if (!$goodie_enabled) {
$freeload_info = __('freeload.info');
} else {
$freeload_info = __('freeload.info.goodie', [($goodie_tshirt
? __('T-shirt score')
: __('Goodie score'))]);
}
$myshift['comment'] .= '<br /><p class="text-danger">'
. __('Freeloaded')
. ' <span class="bi bi-info-circle-fill" data-bs-toggle="tooltip" title="'
. $freeload_info
. '"></span></p>';
} }
} }
@ -986,7 +998,7 @@ function render_user_freeloader_hint()
{ {
if (auth()->user()->isFreeloader()) { if (auth()->user()->isFreeloader()) {
return sprintf( return sprintf(
__('You freeloaded at least %s shifts. Shift signup is locked. Please go to heavens desk to be unlocked again.'), __('freeload.freeloader.info'),
config('max_freeloadable_shifts') config('max_freeloadable_shifts')
); );
} }

View File

@ -1283,13 +1283,6 @@ msgstr ""
"Bitte gib Dein geplantes Abreisedatum an, damit wir ein Gefühl für die Abbau-" "Bitte gib Dein geplantes Abreisedatum an, damit wir ein Gefühl für die Abbau-"
"Planung bekommen." "Planung bekommen."
msgid ""
"You freeloaded at least %s shifts. Shift signup is locked. Please go to "
"heavens desk to be unlocked again."
msgstr ""
"Du hast mindestens %s Schichten geschwänzt. Schicht-Registrierung ist "
"gesperrt. Bitte gehe zum Himmelsschreibtisch um wieder entsperrt zu werden."
msgid "tshirt.required.hint" msgid "tshirt.required.hint"
msgstr "Bitte gib eine T-Shirt-Größe in deinen Einstellungen an." msgstr "Bitte gib eine T-Shirt-Größe in deinen Einstellungen an."
@ -2131,3 +2124,28 @@ msgstr "Du kannst dich bis %s Stunden vor dem Start der Schicht austragen. "
msgid "Password reset" msgid "Password reset"
msgstr "Passwort zurücksetzen" msgstr "Passwort zurücksetzen"
msgid "freeload.info.goodie"
msgstr "Du warst bei dieser Schicht nicht anwesend. "
"Die doppelte Länge der Schicht wurde von deinem %s abgezogen. "
"Bitte wende dich bei Fragen an den Himmel."
msgid "freeload.info"
msgstr "Du warst bei dieser Schicht nicht anwesend. "
"Bitte wende dich bei Fragen an den Himmel."
msgid "freeload.freeloader.info"
msgstr ""
"Du warst bei mindestens %s Schichten nicht anwesend. Deshalb ist die Schicht-Registrierung "
"gesperrt. Bitte gehe zum Himmel um wieder entsperrt zu werden."
msgid "freeload.freeloaded.info.goodie"
msgstr ""
"War ein Engel bei einer Schicht nicht anwesend, "
"wird die doppelte Länge der Schicht von dem %s abgezogen. "
"Bei %s geschwänzten Schichten wird die Schicht-Registration für den Engel gesperrt."
msgid "freeload.freeloaded.info"
msgstr ""
"Der Engel war bei einer Schicht nicht anwesend. "
"Bei %s geschwänzten Schichten wird die Schicht-Registration für den Engel gesperrt."

View File

@ -998,3 +998,25 @@ msgstr "No angeltype has been created yet. Shifts can't be created without one."
msgid "shift.sign_out.hint" msgid "shift.sign_out.hint"
msgstr "You can self sign out up to %s hours before the start of the shift. " msgstr "You can self sign out up to %s hours before the start of the shift. "
"If you can't attend your shift, ask heaven to sign you out." "If you can't attend your shift, ask heaven to sign you out."
msgid "freeload.info.goodie"
msgstr "You were not present for this shift. "
"The double length of the shift was deducted from your %s. Please contact heaven if you have questions."
msgid "freeload.info"
msgstr "You were not present for this shift. "
"Please contact heaven if you have questions."
msgid "freeload.freeloader.info"
msgstr "You were not present for at least %s shifts. Therefore, shift registration is blocked. "
"Please go to heaven to be unlocked again."
msgid "freeload.freeloaded.info.goodie"
msgstr ""
"If an angel was not present for a shift, the double length of the shift is deducted from the %s. "
"If %s shifts are freeloaded, the shift registration is blocked for the angel."
msgid "freeload.freeloaded.info"
msgstr ""
"The angel was not present for a shift. "
"If %s shifts are freeloaded, the shift registration is blocked for the angel."