add night shift multiplier to translations
more night shift hints
This commit is contained in:
parent
d8f8a4f67d
commit
759a4f9a14
|
@ -343,7 +343,7 @@ return [
|
||||||
'night_shifts' => [
|
'night_shifts' => [
|
||||||
'enabled' => (bool) env('NIGHT_SHIFTS', true), // Disable to weigh every shift the same
|
'enabled' => (bool) env('NIGHT_SHIFTS', true), // Disable to weigh every shift the same
|
||||||
'start' => env('NIGHT_SHIFTS_START', 2),
|
'start' => env('NIGHT_SHIFTS_START', 2),
|
||||||
'end' => env('NIGHT_SHIFTS_END', 6),
|
'end' => env('NIGHT_SHIFTS_END', 8),
|
||||||
'multiplier' => env('NIGHT_SHIFTS_MULTIPLIER', 2),
|
'multiplier' => env('NIGHT_SHIFTS_MULTIPLIER', 2),
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
namespace Engelsystem;
|
namespace Engelsystem;
|
||||||
|
|
||||||
|
use Engelsystem\Config\GoodieType;
|
||||||
|
use Engelsystem\Helpers\Shifts;
|
||||||
use Engelsystem\Models\AngelType;
|
use Engelsystem\Models\AngelType;
|
||||||
use Engelsystem\Models\Shifts\Shift;
|
use Engelsystem\Models\Shifts\Shift;
|
||||||
use Engelsystem\Models\Shifts\ShiftEntry;
|
use Engelsystem\Models\Shifts\ShiftEntry;
|
||||||
|
@ -243,6 +245,10 @@ class ShiftCalendarShiftRenderer
|
||||||
*/
|
*/
|
||||||
private function renderShiftHead(Shift $shift, $class, $needed_angeltypes_count)
|
private function renderShiftHead(Shift $shift, $class, $needed_angeltypes_count)
|
||||||
{
|
{
|
||||||
|
$nightShiftsConfig = config('night_shifts');
|
||||||
|
$goodie = GoodieType::from(config('goodie_type'));
|
||||||
|
$goodie_enabled = $goodie !== GoodieType::None;
|
||||||
|
|
||||||
$header_buttons = '';
|
$header_buttons = '';
|
||||||
if (auth()->can('admin_shifts')) {
|
if (auth()->can('admin_shifts')) {
|
||||||
$header_buttons = div('ms-auto d-print-none d-flex', [
|
$header_buttons = div('ms-auto d-print-none d-flex', [
|
||||||
|
@ -274,9 +280,17 @@ class ShiftCalendarShiftRenderer
|
||||||
], url('/user-shifts', ['delete_shift' => $shift->id])),
|
], url('/user-shifts', ['delete_shift' => $shift->id])),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
$shift_heading = $shift->start->format('H:i') . ' ‐ '
|
$night_shift = '';
|
||||||
|
if (Shifts::isNightShift($shift->start, $shift->end) && $nightShiftsConfig['enabled'] && $goodie_enabled) {
|
||||||
|
$night_shift = ' <i class="bi-moon-stars"></i>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$shift_heading = '<span>'
|
||||||
|
. $shift->start->format('H:i') . ' ‐ '
|
||||||
. $shift->end->format('H:i') . ' — '
|
. $shift->end->format('H:i') . ' — '
|
||||||
. htmlspecialchars($shift->shiftType->name);
|
. htmlspecialchars($shift->shiftType->name)
|
||||||
|
. $night_shift
|
||||||
|
. '</span>';
|
||||||
|
|
||||||
if ($needed_angeltypes_count > 0) {
|
if ($needed_angeltypes_count > 0) {
|
||||||
$shift_heading = '<span class="badge bg-light text-danger me-1">' . $needed_angeltypes_count . '</span> ' . $shift_heading;
|
$shift_heading = '<span class="badge bg-light text-danger me-1">' . $needed_angeltypes_count . '</span> ' . $shift_heading;
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Engelsystem\Config\GoodieType;
|
||||||
use Engelsystem\Helpers\Carbon;
|
use Engelsystem\Helpers\Carbon;
|
||||||
|
use Engelsystem\Helpers\Shifts;
|
||||||
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;
|
||||||
|
@ -155,6 +157,10 @@ function Shift_view(
|
||||||
$user_shift_admin = auth()->can('user_shifts_admin');
|
$user_shift_admin = auth()->can('user_shifts_admin');
|
||||||
$admin_locations = auth()->can('admin_locations');
|
$admin_locations = auth()->can('admin_locations');
|
||||||
$admin_shifttypes = auth()->can('shifttypes');
|
$admin_shifttypes = auth()->can('shifttypes');
|
||||||
|
$nightShiftsConfig = config('night_shifts');
|
||||||
|
$goodie = GoodieType::from(config('goodie_type'));
|
||||||
|
$goodie_enabled = $goodie !== GoodieType::None;
|
||||||
|
$goodie_tshirt = $goodie === GoodieType::Tshirt;
|
||||||
|
|
||||||
$parsedown = new Parsedown();
|
$parsedown = new Parsedown();
|
||||||
|
|
||||||
|
@ -262,11 +268,22 @@ function Shift_view(
|
||||||
|
|
||||||
$start = $shift->start->format(__('general.datetime'));
|
$start = $shift->start->format(__('general.datetime'));
|
||||||
|
|
||||||
|
$night_shift_hint = '';
|
||||||
|
if (Shifts::isNightShift($shift->start, $shift->end) && $nightShiftsConfig['enabled'] && $goodie_enabled) {
|
||||||
|
$night_shift_hint = ' <small><span class="bi bi-moon-stars text-info" data-bs-toggle="tooltip" title="'
|
||||||
|
. __('Night shifts between %d and %d am are multiplied by %d for the %s score.', [
|
||||||
|
$nightShiftsConfig['start'],
|
||||||
|
$nightShiftsConfig['end'],
|
||||||
|
$nightShiftsConfig['multiplier'],
|
||||||
|
($goodie_tshirt ? __('T-shirt') : __('goodie'))])
|
||||||
|
. '"></span></small>';
|
||||||
|
}
|
||||||
$link = button(url('/user-shifts'), icon('chevron-left'), 'btn-sm', '', __('general.back'));
|
$link = button(url('/user-shifts'), icon('chevron-left'), 'btn-sm', '', __('general.back'));
|
||||||
return page_with_title(
|
return page_with_title(
|
||||||
$link . ' '
|
$link . ' '
|
||||||
. htmlspecialchars($shift->shiftType->name)
|
. htmlspecialchars($shift->shiftType->name)
|
||||||
. ' <small title="' . $start . '" data-countdown-ts="' . $shift->start->timestamp . '">%c</small>',
|
. ' <small title="' . $start . '" data-countdown-ts="' . $shift->start->timestamp . '">%c</small>'
|
||||||
|
. $night_shift_hint,
|
||||||
$content
|
$content
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Engelsystem\Config\GoodieType;
|
use Engelsystem\Config\GoodieType;
|
||||||
|
use Engelsystem\Helpers\Shifts;
|
||||||
use Engelsystem\Models\AngelType;
|
use Engelsystem\Models\AngelType;
|
||||||
use Engelsystem\Models\Group;
|
use Engelsystem\Models\Group;
|
||||||
use Engelsystem\Models\Shifts\Shift;
|
use Engelsystem\Models\Shifts\Shift;
|
||||||
|
@ -309,6 +310,10 @@ function User_view_shiftentries($needed_angel_type)
|
||||||
*/
|
*/
|
||||||
function User_view_myshift(Shift $shift, $user_source, $its_me)
|
function User_view_myshift(Shift $shift, $user_source, $its_me)
|
||||||
{
|
{
|
||||||
|
$nightShiftsConfig = config('night_shifts');
|
||||||
|
$goodie = GoodieType::from(config('goodie_type'));
|
||||||
|
$goodie_enabled = $goodie !== GoodieType::None;
|
||||||
|
|
||||||
$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) {
|
||||||
$shift_info .= '<br /><a href="' . shift_link($shift) . '">' . htmlspecialchars($shift->title) . '</a>';
|
$shift_info .= '<br /><a href="' . shift_link($shift) . '">' . htmlspecialchars($shift->title) . '</a>';
|
||||||
|
@ -317,12 +322,19 @@ function User_view_myshift(Shift $shift, $user_source, $its_me)
|
||||||
$shift_info .= User_view_shiftentries($needed_angel_type);
|
$shift_info .= User_view_shiftentries($needed_angel_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$night_shift = '';
|
||||||
|
if (Shifts::isNightShift($shift->start, $shift->end) && $nightShiftsConfig['enabled'] && $goodie_enabled) {
|
||||||
|
$night_shift = ' <span class="bi bi-moon-stars text-info" data-bs-toggle="tooltip" title="'
|
||||||
|
. __('Night shift')
|
||||||
|
. '"></span>';
|
||||||
|
}
|
||||||
$myshift = [
|
$myshift = [
|
||||||
'date' => icon('calendar-event')
|
'date' => icon('calendar-event')
|
||||||
. $shift->start->format(__('general.date')) . '<br>'
|
. $shift->start->format(__('general.date')) . '<br>'
|
||||||
. icon('clock-history') . $shift->start->format('H:i')
|
. icon('clock-history') . $shift->start->format('H:i')
|
||||||
. ' - '
|
. ' - '
|
||||||
. $shift->end->format(__('H:i')),
|
. $shift->end->format(__('H:i'))
|
||||||
|
. $night_shift,
|
||||||
'duration' => sprintf('%.2f', ($shift->end->timestamp - $shift->start->timestamp) / 3600) . ' h',
|
'duration' => sprintf('%.2f', ($shift->end->timestamp - $shift->start->timestamp) / 3600) . ' h',
|
||||||
'location' => location_name_render($shift->location),
|
'location' => location_name_render($shift->location),
|
||||||
'shift_info' => $shift_info,
|
'shift_info' => $shift_info,
|
||||||
|
@ -682,10 +694,11 @@ function User_view(
|
||||||
$myshifts_table,
|
$myshifts_table,
|
||||||
($its_me && $nightShiftsConfig['enabled'] && $goodie_enabled) ? info(
|
($its_me && $nightShiftsConfig['enabled'] && $goodie_enabled) ? info(
|
||||||
sprintf(
|
sprintf(
|
||||||
icon('info-circle') . __('Your night shifts between %d and %d am count twice for the %s score.'),
|
icon('moon-stars') . __('Night shifts between %d and %d am are multiplied by %d for the %s score.', [
|
||||||
$nightShiftsConfig['start'],
|
$nightShiftsConfig['start'],
|
||||||
$nightShiftsConfig['end'],
|
$nightShiftsConfig['end'],
|
||||||
($goodie_tshirt ? __('T-shirt') : __('goodie'))
|
$nightShiftsConfig['multiplier'],
|
||||||
|
($goodie_tshirt ? __('T-shirt') : __('goodie'))])
|
||||||
),
|
),
|
||||||
true,
|
true,
|
||||||
true
|
true
|
||||||
|
|
|
@ -1226,8 +1226,11 @@ msgstr "iCal Export"
|
||||||
msgid "JSON Export"
|
msgid "JSON Export"
|
||||||
msgstr "JSON Export"
|
msgstr "JSON Export"
|
||||||
|
|
||||||
msgid "Your night shifts between %d and %d am count twice for the %s score."
|
msgid "Night shifts between %d and %d am are multiplied by %d for the %s score."
|
||||||
msgstr "Deine Nachtschichten zwischen %d und %d Uhr zählen für den %s Score doppelt."
|
msgstr "Nachtschichten zwischen %d und %d Uhr werden für den %4$s Score mit %3$d multipliziert."
|
||||||
|
|
||||||
|
msgid "Night shifts"
|
||||||
|
msgstr "Nachtschicht"
|
||||||
|
|
||||||
msgid ""
|
msgid ""
|
||||||
"Go to the <a href=\"%s\">shifts table</a> to sign yourself up for some "
|
"Go to the <a href=\"%s\">shifts table</a> to sign yourself up for some "
|
||||||
|
|
|
@ -210,6 +210,7 @@
|
||||||
logout: {{ m.icon('box-arrow-left') }}<br>
|
logout: {{ m.icon('box-arrow-left') }}<br>
|
||||||
message: {{ m.icon('envelope') }}<br>
|
message: {{ m.icon('envelope') }}<br>
|
||||||
next shift: {{ m.icon('clock') }}<br>
|
next shift: {{ m.icon('clock') }}<br>
|
||||||
|
night shift: {{ m.icon('moon-stars') }}<br>
|
||||||
occupancy: {{ m.icon('person-fill-slash') }}<br>
|
occupancy: {{ m.icon('person-fill-slash') }}<br>
|
||||||
password: {{ m.icon('key-fill') }}<br>
|
password: {{ m.icon('key-fill') }}<br>
|
||||||
phone: {{ m.icon('phone') }}<br>
|
phone: {{ m.icon('phone') }}<br>
|
||||||
|
|
Loading…
Reference in New Issue