add config option for other goodies
This commit is contained in:
parent
3ca39dc8e1
commit
ccdf1aa8d5
|
@ -276,6 +276,9 @@ return [
|
||||||
// Enables the T-Shirt configuration on signup and profile
|
// Enables the T-Shirt configuration on signup and profile
|
||||||
'enable_tshirt_size' => (bool) env('ENABLE_TSHIRT_SIZE', true),
|
'enable_tshirt_size' => (bool) env('ENABLE_TSHIRT_SIZE', true),
|
||||||
|
|
||||||
|
// When true changes everything from shirts to goodies and disables shirt size
|
||||||
|
'other_goodie' => (bool) env('OTHER_GOODIE', false),
|
||||||
|
|
||||||
// Enables the goody configuration on signup and profile
|
// Enables the goody configuration on signup and profile
|
||||||
'enable_goody' => (bool) env('ENABLE_GOODY', false),
|
'enable_goody' => (bool) env('ENABLE_GOODY', false),
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ function admin_active()
|
||||||
$tshirt_sizes = config('tshirt_sizes');
|
$tshirt_sizes = config('tshirt_sizes');
|
||||||
$shift_sum_formula = User_get_shifts_sum_query();
|
$shift_sum_formula = User_get_shifts_sum_query();
|
||||||
$request = request();
|
$request = request();
|
||||||
|
$other_goodie = config('other_goodie');
|
||||||
|
|
||||||
$msg = '';
|
$msg = '';
|
||||||
$search = '';
|
$search = '';
|
||||||
|
@ -129,7 +130,7 @@ function admin_active()
|
||||||
$user_source->state->got_shirt = true;
|
$user_source->state->got_shirt = true;
|
||||||
$user_source->state->save();
|
$user_source->state->save();
|
||||||
engelsystem_log('User ' . User_Nick_render($user_source, true) . ' has tshirt now.');
|
engelsystem_log('User ' . User_Nick_render($user_source, true) . ' has tshirt now.');
|
||||||
$msg = success(__('Angel has got a t-shirt.'), true);
|
$msg = success(($other_goodie ? __('Angel has got a goodie.') : __('Angel has got a t-shirt.')), true);
|
||||||
} else {
|
} else {
|
||||||
$msg = error('Angel not found.', true);
|
$msg = error('Angel not found.', true);
|
||||||
}
|
}
|
||||||
|
@ -140,7 +141,7 @@ function admin_active()
|
||||||
$user_source->state->got_shirt = false;
|
$user_source->state->got_shirt = false;
|
||||||
$user_source->state->save();
|
$user_source->state->save();
|
||||||
engelsystem_log('User ' . User_Nick_render($user_source, true) . ' has NO tshirt.');
|
engelsystem_log('User ' . User_Nick_render($user_source, true) . ' has NO tshirt.');
|
||||||
$msg = success(__('Angel has got no t-shirt.'), true);
|
$msg = success(($other_goodie ? __('Angel has got no goodie.') : __('Angel has got no t-shirt.')), true);
|
||||||
} else {
|
} else {
|
||||||
$msg = error(__('Angel not found.'), true);
|
$msg = error(__('Angel not found.'), true);
|
||||||
}
|
}
|
||||||
|
@ -212,7 +213,9 @@ function admin_active()
|
||||||
$userData = [];
|
$userData = [];
|
||||||
$userData['no'] = count($matched_users) + 1;
|
$userData['no'] = count($matched_users) + 1;
|
||||||
$userData['nick'] = User_Nick_render($usr) . User_Pronoun_render($usr);
|
$userData['nick'] = User_Nick_render($usr) . User_Pronoun_render($usr);
|
||||||
|
if (!$other_goodie) {
|
||||||
$userData['shirt_size'] = (isset($tshirt_sizes[$shirtSize]) ? $tshirt_sizes[$shirtSize] : '');
|
$userData['shirt_size'] = (isset($tshirt_sizes[$shirtSize]) ? $tshirt_sizes[$shirtSize] : '');
|
||||||
|
}
|
||||||
$userData['work_time'] = round($usr['shift_length'] / 60)
|
$userData['work_time'] = round($usr['shift_length'] / 60)
|
||||||
. ' min (' . sprintf('%.2f', $usr['shift_length'] / 3600) . ' h)';
|
. ' min (' . sprintf('%.2f', $usr['shift_length'] / 3600) . ' h)';
|
||||||
$userData['active'] = icon_bool($usr->state->active == 1);
|
$userData['active'] = icon_bool($usr->state->active == 1);
|
||||||
|
@ -260,7 +263,7 @@ function admin_active()
|
||||||
$parametersShirt['show_all_shifts'] = 1;
|
$parametersShirt['show_all_shifts'] = 1;
|
||||||
}
|
}
|
||||||
$actions[] = form(
|
$actions[] = form(
|
||||||
[form_submit('submit', __('got t-shirt'), 'btn-sm', false, 'secondary')],
|
[form_submit('submit', ($other_goodie ? __('got goodie') : __('got t-shirt')), 'btn-sm', false, 'secondary')],
|
||||||
page_link_to('admin_active', $parametersShirt),
|
page_link_to('admin_active', $parametersShirt),
|
||||||
false,
|
false,
|
||||||
true
|
true
|
||||||
|
@ -275,14 +278,16 @@ function admin_active()
|
||||||
$parameters['show_all_shifts'] = 1;
|
$parameters['show_all_shifts'] = 1;
|
||||||
}
|
}
|
||||||
$actions[] = form(
|
$actions[] = form(
|
||||||
[form_submit('submit', __('remove t-shirt'), 'btn-sm', false, 'secondary')],
|
[form_submit('submit', ($other_goodie ? __('remove goodie') : __('remove t-shirt')), 'btn-sm', false, 'secondary')],
|
||||||
page_link_to('admin_active', $parameters),
|
page_link_to('admin_active', $parameters),
|
||||||
false,
|
false,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$other_goodie) {
|
||||||
$actions[] = button(url('/admin/user/' . $usr->id . '/shirt'), __('form.edit'), 'btn-secondary btn-sm');
|
$actions[] = button(url('/admin/user/' . $usr->id . '/shirt'), __('form.edit'), 'btn-secondary btn-sm');
|
||||||
|
}
|
||||||
|
|
||||||
$userData['actions'] = buttons($actions);
|
$userData['actions'] = buttons($actions);
|
||||||
|
|
||||||
|
@ -290,6 +295,7 @@ function admin_active()
|
||||||
}
|
}
|
||||||
|
|
||||||
$shirt_statistics = [];
|
$shirt_statistics = [];
|
||||||
|
if (!$other_goodie) {
|
||||||
foreach (array_keys($tshirt_sizes) as $size) {
|
foreach (array_keys($tshirt_sizes) as $size) {
|
||||||
$gc = State::query()
|
$gc = State::query()
|
||||||
->leftJoin('users_settings', 'users_state.user_id', '=', 'users_settings.user_id')
|
->leftJoin('users_settings', 'users_state.user_id', '=', 'users_settings.user_id')
|
||||||
|
@ -302,11 +308,12 @@ function admin_active()
|
||||||
'given' => $gc
|
'given' => $gc
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$shirt_statistics[] = [
|
$shirt_statistics[] = array_merge(
|
||||||
'size' => '<b>' . __('Sum') . '</b>',
|
(!$other_goodie ? ['size' => '<b>' . __('Sum') . '</b>'] : []),
|
||||||
'given' => '<b>' . State::whereGotShirt(true)->count() . '</b>'
|
['given' => '<b>' . State::whereGotShirt(true)->count() . '</b>']
|
||||||
];
|
);
|
||||||
|
|
||||||
return page_with_title(admin_active_title(), [
|
return page_with_title(admin_active_title(), [
|
||||||
form([
|
form([
|
||||||
|
@ -319,21 +326,28 @@ function admin_active()
|
||||||
form_submit('set_active', __('Preview'))
|
form_submit('set_active', __('Preview'))
|
||||||
]) : $set_active,
|
]) : $set_active,
|
||||||
$msg . msg(),
|
$msg . msg(),
|
||||||
table([
|
table(
|
||||||
|
array_merge(
|
||||||
|
[
|
||||||
'no' => __('No.'),
|
'no' => __('No.'),
|
||||||
'nick' => __('Nickname'),
|
'nick' => __('Nickname'),
|
||||||
'shirt_size' => __('Size'),
|
],
|
||||||
|
(!$other_goodie ? ['shirt_size' => __('Size')] : []),
|
||||||
|
[
|
||||||
'shift_count' => __('Shifts'),
|
'shift_count' => __('Shifts'),
|
||||||
'work_time' => __('Length'),
|
'work_time' => __('Length'),
|
||||||
'active' => __('Active?'),
|
'active' => __('Active?'),
|
||||||
'force_active' => __('Forced'),
|
'force_active' => __('Forced'),
|
||||||
'tshirt' => __('T-shirt?'),
|
'tshirt' => ($other_goodie ? __('Goodie?') : __('T-shirt?')),
|
||||||
'actions' => ''
|
'actions' => ''
|
||||||
], $matched_users),
|
]
|
||||||
'<h2>' . __('Shirt statistics') . '</h2>',
|
),
|
||||||
table([
|
$matched_users
|
||||||
'size' => __('Size'),
|
),
|
||||||
'given' => __('Given shirts')
|
'<h2>' . ($other_goodie ? __('Goodie statistic') : __('Shirt statistic')) . '</h2>',
|
||||||
], $shirt_statistics)
|
table(array_merge(
|
||||||
|
(!$other_goodie ? ['size' => __('Size')] : []),
|
||||||
|
['given' => $other_goodie ? __('Given goodies') : __('Given shirts') ]
|
||||||
|
), $shirt_statistics)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,8 +37,12 @@ function admin_user()
|
||||||
|
|
||||||
$html .= __('Here you can change the user entry. Under the item \'Arrived\' the angel is marked as present, a yes at Active means that the angel was active.');
|
$html .= __('Here you can change the user entry. Under the item \'Arrived\' the angel is marked as present, a yes at Active means that the angel was active.');
|
||||||
if (config('enable_tshirt_size')) {
|
if (config('enable_tshirt_size')) {
|
||||||
|
if (config('other_goodie')) {
|
||||||
|
$html .= ' ' . __('If the angel is active, it can claim a goodie. If goodie is set to \'Yes\', the angel already got their goodie.');
|
||||||
|
} else {
|
||||||
$html .= ' ' . __('If the angel is active, it can claim a T-shirt. If T-shirt is set to \'Yes\', the angel already got their T-shirt.');
|
$html .= ' ' . __('If the angel is active, it can claim a T-shirt. If T-shirt is set to \'Yes\', the angel already got their T-shirt.');
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$html .= '<br /><br />';
|
$html .= '<br /><br />';
|
||||||
$html .= '<form action="'
|
$html .= '<form action="'
|
||||||
. page_link_to('admin_user', ['action' => 'save', 'id' => $user_id])
|
. page_link_to('admin_user', ['action' => 'save', 'id' => $user_id])
|
||||||
|
@ -63,7 +67,7 @@ function admin_user()
|
||||||
if ($user_source->settings->email_human) {
|
if ($user_source->settings->email_human) {
|
||||||
$html .= " <tr><td>" . __('settings.profile.email') . "</td><td>" . '<input type="email" size="40" name="eemail" value="' . $user_source->email . '" class="form-control" maxlength="254"></td></tr>' . "\n";
|
$html .= " <tr><td>" . __('settings.profile.email') . "</td><td>" . '<input type="email" size="40" name="eemail" value="' . $user_source->email . '" class="form-control" maxlength="254"></td></tr>' . "\n";
|
||||||
}
|
}
|
||||||
if (config('enable_tshirt_size')) {
|
if (config('enable_tshirt_size') && !config('other_goodie')) {
|
||||||
$html .= ' <tr><td>' . __('user.shirt_size') . '</td><td>'
|
$html .= ' <tr><td>' . __('user.shirt_size') . '</td><td>'
|
||||||
. html_select_key(
|
. html_select_key(
|
||||||
'size',
|
'size',
|
||||||
|
@ -101,7 +105,11 @@ function admin_user()
|
||||||
|
|
||||||
if (config('enable_tshirt_size')) {
|
if (config('enable_tshirt_size')) {
|
||||||
// T-Shirt bekommen?
|
// T-Shirt bekommen?
|
||||||
|
if (config('other_goodie')) {
|
||||||
|
$html .= ' <tr><td>' . __('Goodie') . '</td><td>' . "\n";
|
||||||
|
} else {
|
||||||
$html .= ' <tr><td>' . __('T-Shirt') . '</td><td>' . "\n";
|
$html .= ' <tr><td>' . __('T-Shirt') . '</td><td>' . "\n";
|
||||||
|
}
|
||||||
$html .= html_options('eTshirt', $options, $user_source->state->got_shirt) . '</td></tr>' . "\n";
|
$html .= html_options('eTshirt', $options, $user_source->state->got_shirt) . '</td></tr>' . "\n";
|
||||||
}
|
}
|
||||||
$html .= '</table>' . "\n" . '</td><td></td></tr>';
|
$html .= '</table>' . "\n" . '</td><td></td></tr>';
|
||||||
|
@ -242,7 +250,7 @@ function admin_user()
|
||||||
$user_source->personalData->first_name = $request->postData('eVorname');
|
$user_source->personalData->first_name = $request->postData('eVorname');
|
||||||
$user_source->personalData->last_name = $request->postData('eName');
|
$user_source->personalData->last_name = $request->postData('eName');
|
||||||
}
|
}
|
||||||
if (config('enable_tshirt_size')) {
|
if (config('enable_tshirt_size') && !config('other_goodie')) {
|
||||||
$user_source->personalData->shirt_size = $request->postData('eSize');
|
$user_source->personalData->shirt_size = $request->postData('eSize');
|
||||||
}
|
}
|
||||||
$user_source->personalData->save();
|
$user_source->personalData->save();
|
||||||
|
@ -260,10 +268,10 @@ function admin_user()
|
||||||
|
|
||||||
engelsystem_log(
|
engelsystem_log(
|
||||||
'Updated user: ' . $user_source->name . ' (' . $user_source->id . ')'
|
'Updated user: ' . $user_source->name . ' (' . $user_source->id . ')'
|
||||||
. ', t-shirt: ' . $user_source->personalData->shirt_size
|
. (config('other_goodie') ? '' : ', t-shirt: ' . $user_source->personalData->shirt_size)
|
||||||
. ', active: ' . $user_source->state->active
|
. ', active: ' . $user_source->state->active
|
||||||
. ', force-active: ' . $user_source->state->force_active
|
. ', force-active: ' . $user_source->state->force_active
|
||||||
. ', tshirt: ' . $user_source->state->got_shirt
|
. (config('other_goodie') ? ', goodie: ' : ', tshirt: ' . $user_source->state->got_shirt)
|
||||||
);
|
);
|
||||||
$html .= success(__('Changes where saved.') . "\n", true);
|
$html .= success(__('Changes where saved.') . "\n", true);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -31,6 +31,7 @@ function guest_register()
|
||||||
$authUser = auth()->user();
|
$authUser = auth()->user();
|
||||||
$tshirt_sizes = config('tshirt_sizes');
|
$tshirt_sizes = config('tshirt_sizes');
|
||||||
$enable_tshirt_size = config('enable_tshirt_size');
|
$enable_tshirt_size = config('enable_tshirt_size');
|
||||||
|
$other_goodie = config('other_goodie');
|
||||||
$enable_user_name = config('enable_user_name');
|
$enable_user_name = config('enable_user_name');
|
||||||
$enable_dect = config('enable_dect');
|
$enable_dect = config('enable_dect');
|
||||||
$enable_planned_arrival = config('enable_planned_arrival');
|
$enable_planned_arrival = config('enable_planned_arrival');
|
||||||
|
@ -162,7 +163,7 @@ function guest_register()
|
||||||
$email_goody = true;
|
$email_goody = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($enable_tshirt_size) {
|
if ($enable_tshirt_size && !$other_goodie) {
|
||||||
if ($request->has('tshirt_size') && isset($tshirt_sizes[$request->input('tshirt_size')])) {
|
if ($request->has('tshirt_size') && isset($tshirt_sizes[$request->input('tshirt_size')])) {
|
||||||
$tshirt_size = $request->input('tshirt_size');
|
$tshirt_size = $request->input('tshirt_size');
|
||||||
} else {
|
} else {
|
||||||
|
@ -483,7 +484,7 @@ function guest_register()
|
||||||
]) : '',
|
]) : '',
|
||||||
|
|
||||||
div('col', [
|
div('col', [
|
||||||
$enable_tshirt_size ? form_select(
|
$enable_tshirt_size && !$other_goodie ? form_select(
|
||||||
'tshirt_size',
|
'tshirt_size',
|
||||||
__('Shirt size') . ' ' . entry_required(),
|
__('Shirt size') . ' ' . entry_required(),
|
||||||
$tshirt_sizes,
|
$tshirt_sizes,
|
||||||
|
|
|
@ -100,8 +100,10 @@ function Users_view(
|
||||||
$u['force_active'] = icon_bool($user->state->force_active);
|
$u['force_active'] = icon_bool($user->state->force_active);
|
||||||
if (config('enable_tshirt_size')) {
|
if (config('enable_tshirt_size')) {
|
||||||
$u['got_shirt'] = icon_bool($user->state->got_shirt);
|
$u['got_shirt'] = icon_bool($user->state->got_shirt);
|
||||||
|
if (!config('other_goodie')) {
|
||||||
$u['shirt_size'] = $user->personalData->shirt_size;
|
$u['shirt_size'] = $user->personalData->shirt_size;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$u['arrival_date'] = $user->personalData->planned_arrival_date
|
$u['arrival_date'] = $user->personalData->planned_arrival_date
|
||||||
? $user->personalData->planned_arrival_date->format(__('Y-m-d')) : '';
|
? $user->personalData->planned_arrival_date->format(__('Y-m-d')) : '';
|
||||||
$u['departure_date'] = $user->personalData->planned_departure_date
|
$u['departure_date'] = $user->personalData->planned_departure_date
|
||||||
|
@ -141,9 +143,13 @@ function Users_view(
|
||||||
$user_table_headers['active'] = Users_table_header_link('active', __('Active'), $order_by);
|
$user_table_headers['active'] = Users_table_header_link('active', __('Active'), $order_by);
|
||||||
$user_table_headers['force_active'] = Users_table_header_link('force_active', __('Forced'), $order_by);
|
$user_table_headers['force_active'] = Users_table_header_link('force_active', __('Forced'), $order_by);
|
||||||
if (config('enable_tshirt_size')) {
|
if (config('enable_tshirt_size')) {
|
||||||
|
if (config('other_goodie')) {
|
||||||
|
$user_table_headers['got_shirt'] = Users_table_header_link('got_shirt', __('Goodie'), $order_by);
|
||||||
|
} else {
|
||||||
$user_table_headers['got_shirt'] = Users_table_header_link('got_shirt', __('T-Shirt'), $order_by);
|
$user_table_headers['got_shirt'] = Users_table_header_link('got_shirt', __('T-Shirt'), $order_by);
|
||||||
}
|
}
|
||||||
if (config('enable_tshirt_size')) {
|
}
|
||||||
|
if (config('enable_tshirt_size') && !config('other_goodie')) {
|
||||||
$user_table_headers['shirt_size'] = Users_table_header_link('shirt_size', __('Size'), $order_by);
|
$user_table_headers['shirt_size'] = Users_table_header_link('shirt_size', __('Size'), $order_by);
|
||||||
}
|
}
|
||||||
$user_table_headers['arrival_date'] = Users_table_header_link(
|
$user_table_headers['arrival_date'] = Users_table_header_link(
|
||||||
|
@ -401,7 +407,7 @@ function User_view_myshifts(
|
||||||
];
|
];
|
||||||
if (config('enable_tshirt_size', false) && ($its_me || $tshirt_admin)) {
|
if (config('enable_tshirt_size', false) && ($its_me || $tshirt_admin)) {
|
||||||
$myshifts_table[] = [
|
$myshifts_table[] = [
|
||||||
'date' => '<b>' . __('Your t-shirt score') . '™:</b>',
|
'date' => '<b>' . (config('other_goodie') ? __('Your goodie score') : __('Your t-shirt score')) . '™:</b>',
|
||||||
'duration' => '<b>' . $tshirt_score . '</b>',
|
'duration' => '<b>' . $tshirt_score . '</b>',
|
||||||
'room' => '',
|
'room' => '',
|
||||||
'shift_info' => '',
|
'shift_info' => '',
|
||||||
|
@ -532,9 +538,9 @@ function User_view(
|
||||||
div('row', [
|
div('row', [
|
||||||
div('col-md-12', [
|
div('col-md-12', [
|
||||||
buttons([
|
buttons([
|
||||||
$auth->can('user.edit.shirt') && config('enable_tshirt_size') ? button(
|
$auth->can('user.edit.shirt') && (config('enable_tshirt_size')) ? button(
|
||||||
url('/admin/user/' . $user_source->id . '/shirt'),
|
url('/admin/user/' . $user_source->id . '/shirt'),
|
||||||
icon('person') . __('Shirt')
|
icon('person') . (config('other_goodie') ? __('Goodie') : __('Shirt'))
|
||||||
) : '',
|
) : '',
|
||||||
$admin_user_privilege ? button(
|
$admin_user_privilege ? button(
|
||||||
page_link_to('admin_user', ['id' => $user_source->id]),
|
page_link_to('admin_user', ['id' => $user_source->id]),
|
||||||
|
@ -924,7 +930,7 @@ function render_user_arrived_hint()
|
||||||
*/
|
*/
|
||||||
function render_user_tshirt_hint()
|
function render_user_tshirt_hint()
|
||||||
{
|
{
|
||||||
if (config('enable_tshirt_size') && !auth()->user()->personalData->shirt_size) {
|
if ((config('enable_tshirt_size') && !config('other_goodie')) && !auth()->user()->personalData->shirt_size) {
|
||||||
$text = __('You need to specify a tshirt size in your settings!');
|
$text = __('You need to specify a tshirt size in your settings!');
|
||||||
return render_profile_link($text, null, 'text-danger');
|
return render_profile_link($text, null, 'text-danger');
|
||||||
}
|
}
|
||||||
|
|
|
@ -961,11 +961,11 @@ msgstr "entferne aktiv"
|
||||||
|
|
||||||
#: includes/pages/admin_active.php:261
|
#: includes/pages/admin_active.php:261
|
||||||
msgid "got t-shirt"
|
msgid "got t-shirt"
|
||||||
msgstr "hat t-shirt"
|
msgstr "T-Shirt bekommen"
|
||||||
|
|
||||||
#: includes/pages/admin_active.php:274
|
#: includes/pages/admin_active.php:274
|
||||||
msgid "remove t-shirt"
|
msgid "remove t-shirt"
|
||||||
msgstr "entferne t-shirt"
|
msgstr "entferne T-Shirt"
|
||||||
|
|
||||||
#: includes/pages/admin_active.php:299 includes/pages/admin_arrive.php:202
|
#: includes/pages/admin_active.php:299 includes/pages/admin_arrive.php:202
|
||||||
#: includes/pages/admin_arrive.php:217 includes/pages/admin_arrive.php:232
|
#: includes/pages/admin_arrive.php:217 includes/pages/admin_arrive.php:232
|
||||||
|
@ -1031,7 +1031,7 @@ msgid "T-shirt?"
|
||||||
msgstr "T-Shirt?"
|
msgstr "T-Shirt?"
|
||||||
|
|
||||||
#: includes/pages/admin_active.php:324
|
#: includes/pages/admin_active.php:324
|
||||||
msgid "Shirt statistics"
|
msgid "Shirt statistic"
|
||||||
msgstr "T-Shirt Statistik"
|
msgstr "T-Shirt Statistik"
|
||||||
|
|
||||||
#: includes/pages/admin_active.php:327
|
#: includes/pages/admin_active.php:327
|
||||||
|
@ -2753,6 +2753,40 @@ msgstr "Passwort zurückgesetzt."
|
||||||
msgid "The entries must match and must not be empty!"
|
msgid "The entries must match and must not be empty!"
|
||||||
msgstr "Die Einträge müssen übereinstimmen und dürfen nicht leer sein!"
|
msgstr "Die Einträge müssen übereinstimmen und dürfen nicht leer sein!"
|
||||||
|
|
||||||
|
msgid "Number of shifts: %s"
|
||||||
|
msgstr "Anzahl an Schichten: %s"
|
||||||
|
|
||||||
|
msgid "If the angel is active, it can claim a goodie. If goodie is set to 'Yes', the angel already got their goodie."
|
||||||
|
msgstr "Ist der Engel Aktiv, hat er damit Anspruch auf ein Goodie. Wenn Goodie ein 'Ja' enthält, bedeutet dies, "
|
||||||
|
"dass der Engel bereits sein Goodie erhalten hat."
|
||||||
|
|
||||||
|
msgid "Goodie"
|
||||||
|
msgstr "Goodie"
|
||||||
|
|
||||||
|
msgid "Your goodie score"
|
||||||
|
msgstr "Dein Goodie Score"
|
||||||
|
|
||||||
|
msgid "Given goodies"
|
||||||
|
msgstr "Ausgegebene Goodies"
|
||||||
|
|
||||||
|
msgid "Goodie statistic"
|
||||||
|
msgstr "Goodie Statistik"
|
||||||
|
|
||||||
|
msgid "remove goodie"
|
||||||
|
msgstr "entferne Goodie"
|
||||||
|
|
||||||
|
msgid "got goodie"
|
||||||
|
msgstr "Goodie bekommen"
|
||||||
|
|
||||||
|
msgid "Goodie?"
|
||||||
|
msgstr "Goodie?"
|
||||||
|
|
||||||
|
msgid "Angel has got a goodie."
|
||||||
|
msgstr "Engel hat ein Goodie bekommen."
|
||||||
|
|
||||||
|
msgid "Angel has got no goodie."
|
||||||
|
msgstr "Engel hat kein Goodie bekommen."
|
||||||
|
|
||||||
#: src/Middleware/LegacyMiddleware.php:83
|
#: src/Middleware/LegacyMiddleware.php:83
|
||||||
msgid "page.404.text"
|
msgid "page.404.text"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -3091,6 +3125,9 @@ msgstr "Antwort"
|
||||||
msgid "user.edit.shirt"
|
msgid "user.edit.shirt"
|
||||||
msgstr "Shirt bearbeiten"
|
msgstr "Shirt bearbeiten"
|
||||||
|
|
||||||
|
msgid "user.edit.goodie"
|
||||||
|
msgstr "Goodie bearbeiten"
|
||||||
|
|
||||||
msgid "form.shirt"
|
msgid "form.shirt"
|
||||||
msgstr "Shirt"
|
msgstr "Shirt"
|
||||||
|
|
||||||
|
@ -3109,6 +3146,9 @@ msgstr "Angekommen"
|
||||||
msgid "user.got_shirt"
|
msgid "user.got_shirt"
|
||||||
msgstr "Shirt bekommen"
|
msgstr "Shirt bekommen"
|
||||||
|
|
||||||
|
msgid "user.got_goodie"
|
||||||
|
msgstr "Goodie bekommen"
|
||||||
|
|
||||||
msgid "message.title"
|
msgid "message.title"
|
||||||
msgstr "Nachrichten"
|
msgstr "Nachrichten"
|
||||||
|
|
||||||
|
@ -3147,6 +3187,3 @@ msgstr "Arbeitseinsatz löschen"
|
||||||
|
|
||||||
msgid "worklog.delete.info"
|
msgid "worklog.delete.info"
|
||||||
msgstr "Möchtest du den Arbeitseinsatz von %s wirklich löschen?"
|
msgstr "Möchtest du den Arbeitseinsatz von %s wirklich löschen?"
|
||||||
|
|
||||||
msgid "Number of shifts: %s"
|
|
||||||
msgstr "Anzahl an Schichten: %s"
|
|
||||||
|
|
|
@ -2,7 +2,13 @@
|
||||||
{% import 'macros/base.twig' as m %}
|
{% import 'macros/base.twig' as m %}
|
||||||
{% import 'macros/form.twig' as f %}
|
{% import 'macros/form.twig' as f %}
|
||||||
|
|
||||||
{% block title %}{{ __('user.edit.shirt') }}{% endblock %}
|
{% block title %}
|
||||||
|
{% if config('other_goodie') %}
|
||||||
|
{{ __('user.edit.goodie') }}
|
||||||
|
{% else %}
|
||||||
|
{{ __('user.edit.shirt') }}
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
@ -14,9 +20,11 @@
|
||||||
{{ csrf() }}
|
{{ csrf() }}
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
{% if not config('other_goodie') %}
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
{{ f.select('shirt_size', config('tshirt_sizes'), __('user.shirt_size'), userdata.personalData.shirt_size) }}
|
{{ f.select('shirt_size', config('tshirt_sizes'), __('user.shirt_size'), userdata.personalData.shirt_size) }}
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
{{ f.switch('arrived', __('user.arrived'), userdata.state.arrived, {'disabled': not has_permission_to('admin_arrive')}) }}
|
{{ f.switch('arrived', __('user.arrived'), userdata.state.arrived, {'disabled': not has_permission_to('admin_arrive')}) }}
|
||||||
|
|
||||||
|
@ -26,7 +34,11 @@
|
||||||
|
|
||||||
{{ f.switch('active', __('user.active'), userdata.state.active) }}
|
{{ f.switch('active', __('user.active'), userdata.state.active) }}
|
||||||
|
|
||||||
|
{% if config('other_goodie') %}
|
||||||
|
{{ f.switch('got_shirt', __('user.got_goodie'), userdata.state.got_shirt) }}
|
||||||
|
{% else %}
|
||||||
{{ f.switch('got_shirt', __('user.got_shirt'), userdata.state.got_shirt) }}
|
{{ f.switch('got_shirt', __('user.got_shirt'), userdata.state.got_shirt) }}
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
{{ f.submit(__('form.save')) }}
|
{{ f.submit(__('form.save')) }}
|
||||||
|
|
|
@ -138,7 +138,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if config('enable_tshirt_size') %}
|
{% if config('enable_tshirt_size') and not config('other_goodie') %}
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
{{ f.select(
|
{{ f.select(
|
||||||
'shirt_size',
|
'shirt_size',
|
||||||
|
|
|
@ -47,18 +47,19 @@ class UserShirtController extends BaseController
|
||||||
public function saveShirt(Request $request): Response
|
public function saveShirt(Request $request): Response
|
||||||
{
|
{
|
||||||
$userId = (int) $request->getAttribute('user_id');
|
$userId = (int) $request->getAttribute('user_id');
|
||||||
|
$shirtEnabled = !$this->config->get('other_goodie');
|
||||||
|
|
||||||
/** @var User $user */
|
/** @var User $user */
|
||||||
$user = $this->user->findOrFail($userId);
|
$user = $this->user->findOrFail($userId);
|
||||||
|
|
||||||
$data = $this->validate($request, [
|
$data = $this->validate($request, [
|
||||||
'shirt_size' => 'required',
|
'shirt_size' => $shirtEnabled ? 'required' : 'optional',
|
||||||
'arrived' => 'optional|checked',
|
'arrived' => 'optional|checked',
|
||||||
'active' => 'optional|checked',
|
'active' => 'optional|checked',
|
||||||
'got_shirt' => 'optional|checked',
|
'got_shirt' => 'optional|checked',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (isset($this->config->get('tshirt_sizes')[$data['shirt_size']])) {
|
if ($shirtEnabled && isset($this->config->get('tshirt_sizes')[$data['shirt_size']])) {
|
||||||
$user->personalData->shirt_size = $data['shirt_size'];
|
$user->personalData->shirt_size = $data['shirt_size'];
|
||||||
$user->personalData->save();
|
$user->personalData->save();
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,11 @@ class SettingsController extends BaseController
|
||||||
$user->settings->email_goody = $data['email_goody'] ?: false;
|
$user->settings->email_goody = $data['email_goody'] ?: false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config('enable_tshirt_size') && isset(config('tshirt_sizes')[$data['shirt_size']])) {
|
if (
|
||||||
|
(config('enable_tshirt_size')
|
||||||
|
&& !config('other_goodie'))
|
||||||
|
&& isset(config('tshirt_sizes')[$data['shirt_size']])
|
||||||
|
) {
|
||||||
$user->personalData->shirt_size = $data['shirt_size'];
|
$user->personalData->shirt_size = $data['shirt_size'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,7 +279,7 @@ class SettingsController extends BaseController
|
||||||
$rules['planned_arrival_date'] = 'required|date:Y-m-d';
|
$rules['planned_arrival_date'] = 'required|date:Y-m-d';
|
||||||
$rules['planned_departure_date'] = 'optional|date:Y-m-d';
|
$rules['planned_departure_date'] = 'optional|date:Y-m-d';
|
||||||
}
|
}
|
||||||
if (config('enable_tshirt_size')) {
|
if (config('enable_tshirt_size') && !config('other_goodie')) {
|
||||||
$rules['shirt_size'] = 'required';
|
$rules['shirt_size'] = 'required';
|
||||||
}
|
}
|
||||||
return $rules;
|
return $rules;
|
||||||
|
|
|
@ -68,7 +68,7 @@ class UserShirtControllerTest extends ControllerTest
|
||||||
]);
|
]);
|
||||||
/** @var Authenticator|MockObject $auth */
|
/** @var Authenticator|MockObject $auth */
|
||||||
$auth = $this->createMock(Authenticator::class);
|
$auth = $this->createMock(Authenticator::class);
|
||||||
$this->config->set('tshirt_sizes', ['S' => 'Small']);
|
$this->config->set('tshirt_sizes', ['S' => 'Small', 'XS' => 'Extra Small']);
|
||||||
/** @var Redirector|MockObject $redirector */
|
/** @var Redirector|MockObject $redirector */
|
||||||
$redirector = $this->createMock(Redirector::class);
|
$redirector = $this->createMock(Redirector::class);
|
||||||
User::factory()
|
User::factory()
|
||||||
|
@ -77,11 +77,11 @@ class UserShirtControllerTest extends ControllerTest
|
||||||
->create();
|
->create();
|
||||||
|
|
||||||
$auth
|
$auth
|
||||||
->expects($this->exactly(4))
|
->expects($this->exactly(5))
|
||||||
->method('can')
|
->method('can')
|
||||||
->with('admin_arrive')
|
->with('admin_arrive')
|
||||||
->willReturnOnConsecutiveCalls(true, true, true, false);
|
->willReturnOnConsecutiveCalls(true, true, true, false, true);
|
||||||
$this->setExpects($redirector, 'back', null, $this->response, $this->exactly(4));
|
$this->setExpects($redirector, 'back', null, $this->response, $this->exactly(5));
|
||||||
|
|
||||||
$controller = new UserShirtController(
|
$controller = new UserShirtController(
|
||||||
$auth,
|
$auth,
|
||||||
|
@ -142,6 +142,17 @@ class UserShirtControllerTest extends ControllerTest
|
||||||
$controller->saveShirt($request);
|
$controller->saveShirt($request);
|
||||||
$user = User::find(1);
|
$user = User::find(1);
|
||||||
$this->assertFalse($user->state->arrived);
|
$this->assertFalse($user->state->arrived);
|
||||||
|
|
||||||
|
// Shirt disabled
|
||||||
|
$this->config->set('other_goodie');
|
||||||
|
$request = $request
|
||||||
|
->withParsedBody([
|
||||||
|
'shirt_size' => 'XS',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$controller->saveShirt($request);
|
||||||
|
$user = User::find(1);
|
||||||
|
$this->assertEquals('XS', $user->personalData->shirt_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue