disable shirt size edit for user in settings if got shirt

This commit is contained in:
Xu 2023-12-29 13:32:00 +01:00 committed by Igor Scheller
parent 89d68a56e7
commit ffa531f311
4 changed files with 5 additions and 2 deletions

View File

@ -193,6 +193,7 @@ Renders a select element wrapped in a DIV with mb-3.
{% endif %}
<select id="{{ name }}" name="{{ name }}"
class="form-control {%- if opt.class is defined %} {{ opt.class }}{% endif %}"
{%- if opt.disabled|default(false) %} disabled{%- endif -%}
{%- if opt.required|default(false) %} required{%- endif -%}>
{%- if opt.default_option is defined %}
<option value="">{{ opt.default_option }}</option>

View File

@ -154,6 +154,7 @@
'required': isTShirtSizeRequired,
'required_icon': isTShirtSizeRequired,
'default_option': __('form.select_placeholder'),
'disabled': user.state.got_shirt,
}) }}
</div>
{% endif %}

View File

@ -86,7 +86,7 @@ class UserWorkLogController extends BaseController
$worklog->save();
$this->log->info(
'Added worklog for {name} ({id}) at {time} about {hours}h: {text}',
'Added worklog for {name} ({id}) at {time} spanning {hours}h: {text}',
[
'name' => $user->name,
'id' => $user->id,
@ -132,7 +132,7 @@ class UserWorkLogController extends BaseController
$worklog->delete();
$this->log->info(
'Deleted worklog for {name} ({id}) at {time} about {hours}h: {text}',
'Deleted worklog for {name} ({id}) at {time} spanning {hours}h: {text}',
[
'name' => $worklog->user->name,
'id' => $worklog->user->id,

View File

@ -110,6 +110,7 @@ class SettingsController extends BaseController
if (
$goodie_tshirt
&& isset(config('tshirt_sizes')[$data['shirt_size']])
&& !$user->state->got_shirt
) {
$user->personalData->shirt_size = $data['shirt_size'];
}