engelsystem/resources/views/pages/registration.twig

339 lines
14 KiB
Twig
Raw Normal View History

2023-04-01 14:23:52 +02:00
{% extends 'layouts/app.twig' %}
{% import 'macros/base.twig' as m %}
{% import 'macros/form.twig' as f %}
2023-11-12 17:40:21 +01:00
{% block title %}{{ __('registration.title') }}{% endblock %}
2023-04-01 14:23:52 +02:00
{% block content %}
<div class="container">
<div class="mb-5">
<h1>
{{ has_permission_to('admin_user')
? m.button(m.icon('chevron-left'), url('/users'), null, 'sm', __('general.back'))
: ''
}}
2023-11-12 17:40:21 +01:00
{{ __('registration.title') }}
</h1>
2023-04-01 14:23:52 +02:00
</div>
{% include 'layouts/parts/messages.twig' %}
2023-11-12 16:12:45 +01:00
<form method="post" action="{{ url('/register') }}" novalidate class="mb-5">
2023-04-01 14:23:52 +02:00
{{ csrf() }}
<div class="mb-5">
2023-11-12 17:40:21 +01:00
<h2>{{ __('registration.login_data') }}</h2>
2023-04-01 14:23:52 +02:00
<div class="row">
{% if isPronounEnabled %}
<div class="col-md-6">
{{ f.input(
'pronoun',
__('settings.profile.pronoun'),
{
'max_length': 15,
2023-11-03 15:15:44 +01:00
'required': isPronounRequired,
'required_icon': isPronounRequired,
2023-04-01 14:23:52 +02:00
'value': f.formData('pronoun', ''),
}
) }}
</div>
{% endif %}
<div class="col-md-6">
{{ f.input(
'username',
2023-10-03 21:34:03 +02:00
__('general.nick'),
2023-04-01 14:23:52 +02:00
{
'autocomplete': 'nickname',
'max_length': 24,
'required': true,
'required_icon': true,
'value': f.formData('username', ''),
}
) }}
</div>
{% if not isPronounEnabled %}
{# Insert an empty row to keep password / email in line #}
<div class="col-md-6"></div>
{% endif %}
{% if isPasswordEnabled %}
<div class="col-md-6">
{{ f.input(
'password',
__('settings.password'),
{
'type': 'password',
'autocomplete': 'new-password',
'required': true,
'required_icon': true,
2023-12-06 13:24:46 +01:00
'min_length': minPasswordLength,
'info': __('password.minimal_length', [minPasswordLength]),
2023-04-01 14:23:52 +02:00
}
) }}
</div>
<div class="col-md-6">
{{ f.input(
"password_confirmation",
__('settings.password.new_password2'),
{
'type': 'password',
'autocomplete': 'new-password',
'required': true,
'required_icon': true,
2023-12-06 13:24:46 +01:00
'min_length': minPasswordLength,
2023-04-01 14:23:52 +02:00
}
) }}
</div>
{% endif %}
<div class="col-md-6">
{{ f.input(
'email',
2023-10-03 21:34:03 +02:00
__('general.email'),
2023-04-01 14:23:52 +02:00
{
'type': 'email',
'max_length': 254,
'required': true,
'required_icon': true,
'value': f.formData('email', ''),
}
) }}
</div>
<div class="col-md-6">
<label class="form-label">{{ __('settings.profile.email-preferences') }}</label>
<ul class="list-group">
<li class="list-group-item">
{# Empty class to prevent the default bottom margin #}
{{ f.checkbox(
'email_shiftinfo',
__(
'settings.profile.email_shiftinfo',
[config('app_name')]
),
{
'class': '',
'checked': f.formData('email_shiftinfo', false),
},
) }}
</li>
<li class="list-group-item">
{# Empty class to prevent the default bottom margin #}
{{ f.checkbox(
'email_news',
__('settings.profile.email_news'),
{
'class': '',
'checked': f.formData('email_news', false),
},
) }}
</li>
<li class="list-group-item">
{# Empty class to prevent the default bottom margin #}
{{ f.checkbox(
'email_messages',
__('settings.profile.email_messages'),
{
'class': '',
'checked': f.formData('email_messages', false),
},
) }}
</li>
<li class="list-group-item">
{# Empty class to prevent the default bottom margin #}
{{ f.checkbox(
'email_by_human_allowed',
__('settings.profile.email_by_human_allowed'),
{
'class': '',
'checked': f.formData('email_by_human_allowed', false),
},
) }}
</li>
</ul>
</div>
</div>
</div>
{% if isFullNameEnabled %}
<div class="mb-5">
2023-10-02 16:15:25 +02:00
<h2>{{ __('general.name') }}</h2>
2023-04-01 14:23:52 +02:00
<div class="row">
<div class="col-md-6">
{{ f.input(
'firstname',
__('settings.profile.firstname'),
{
'autocomplete': 'given-name',
'max_length': 64,
2023-11-03 15:15:44 +01:00
'required': isFirstnameRequired,
'required_icon': isFirstnameRequired,
2023-04-01 14:23:52 +02:00
'value': f.formData('firstname', ''),
}
) }}
</div>
<div class="col-md-6">
{{ f.input(
'lastname',
__('settings.profile.lastname'),
{
'autocomplete': 'family-name',
'max_length': 64,
2023-11-03 15:15:44 +01:00
'required': isLastnameRequired,
'required_icon': isLastnameRequired,
2023-04-01 14:23:52 +02:00
'value': f.formData('lastname', ''),
}
) }}
</div>
</div>
</div>
{% endif %}
<div class="mb-5">
2023-11-12 17:40:21 +01:00
<h2>{{ __('registration.event_data') }}</h2>
2023-04-01 14:23:52 +02:00
<div class="row">
{% if isGoodieEnabled %}
<div class="col-md-6">
{% set privacy_email = config('privacy_email') %}
{% set email_goody_label =
(isGoodieTShirt ? __('settings.profile.email_tshirt') : __('settings.profile.email_goody')) ~
2023-04-01 14:23:52 +02:00
(privacy_email ? ' ' ~ __('settings.profile.privacy', [privacy_email]) : '')
%}
{{ f.checkbox(
'email_goody',
email_goody_label,
{
'raw_label': true,
'checked': f.formData('email_goody', false),
},
) }}
</div>
<div class="col-md-6"></div>
{% endif %}
{% if isPlannedArrivalDateEnabled %}
<div class="col-md-6">
{{ f.input(
'planned_arrival_date',
__('settings.profile.planned_arrival_date'),
{
'type': 'date',
'min': buildUpStartDate,
'max': tearDownEndDate,
'required': true,
'required_icon': true,
'value': f.formData('planned_arrival_date', buildUpStartDate),
}
) }}
</div>
{% endif %}
{% if isGoodieTShirt %}
<div class="col-md-6">
{{ f.select(
'tshirt_size',
__('settings.profile.shirt_size'),
tShirtSizes,
{
'default_option': __('form.select_placeholder'),
2023-11-03 15:15:44 +01:00
'required': isTShirtSizeRequired,
'required_icon': isTShirtSizeRequired,
2023-04-01 14:23:52 +02:00
'selected': f.formData('tshirt_size', ''),
'info': __('settings.profile.shirt_size.hint'),
'raw_form_text': true,
'form_text': (tShirtLink ? m.icon('info-circle')
~ ' <a href="'
~ tShirtLink|escape('html_attr')
~ '" target="_blank" rel="noopener">'
~ __('settings.profile.shirt.link')|e
~ '</a>' : ''),
2023-04-01 14:23:52 +02:00
}
) }}
</div>
{% endif %}
<div class="col-md-6">
{{ f.input(
'mobile',
__('settings.profile.mobile'),
{
'type': 'tel-national',
'max_length': 40,
2023-11-03 15:15:44 +01:00
'required': isMobileRequired,
'required_icon': isMobileRequired,
2023-04-01 14:23:52 +02:00
'value': f.formData('mobile', ''),
}
) }}
{% if isShowMobileEnabled %}
{{ f.checkbox(
'mobile_show',
__('settings.profile.mobile_show'),
{
'raw_label': true,
'checked': f.formData('mobile_show', false),
},
) }}
{% endif %}
</div>
{% if isDECTEnabled %}
<div class="col-md-6">
{{ f.input(
"dect",
2023-10-03 21:34:03 +02:00
__('general.dect'),
2023-04-01 14:23:52 +02:00
{
'type': 'tel-local',
'max_length': 40,
2023-11-03 15:15:44 +01:00
'required': isDectRequired,
'required_icon': isDectRequired,
2023-04-01 14:23:52 +02:00
'value': f.formData('dect', ''),
}
) }}
</div>
{% endif %}
</div>
</div>
<div class="mb-5">
2023-11-12 17:40:21 +01:00
<h2>{{ __('registration.what_todo') }}</h2>
2023-04-01 14:23:52 +02:00
<div class="row mb-3">
{% for angelType in angelTypes %}
<div class="col-sm-6 col-md-4 col-lg-3 col-xl-2">
{{ f.checkbox(
'angel_types_' ~ angelType.id,
2023-12-06 19:03:12 +01:00
angelType.name|e ~ (angelType.restricted ? ' ' ~ m.icon('mortarboard-fill', 'text-body') : ''),
2023-04-01 14:23:52 +02:00
{
'value': angelType.id,
'raw_label': true,
'checked': preselectedAngelTypes['angel_types_' ~ angelType.id] ?? false,
}
) }}
</div>
{% endfor %}
</div>
<div class="row">
<div class="col-md-6">
<div class="mb-2">
{{ m.icon('mortarboard-fill', 'text-body') }}
{{ __('angeltypes.restricted.hint') }}
</div>
<div>
{{ m.icon('info-circle', 'text-body') }}
{{ __('angeltypes.can-change-later') }}
</div>
</div>
</div>
</div>
{#
By assigning a name here, some magic™ will create a session var
"form-data-register-submit" with the value 1 on submit.
#}
2023-11-12 17:40:21 +01:00
{{ f.submit(__('registration.register'), {
2023-04-01 14:23:52 +02:00
'name': 'register-submit',
}) }}
</form>
</div>
{% endblock %}