<xf:if is="$userBan.isInsert()">
	<xf:title>{{ phrase('ban_user') }}</xf:title>
<xf:else />
	<xf:title>{{ phrase('edit_banned_user:') }} {$userBan.User.username}</xf:title>
</xf:if>

<xf:pageaction if="$userBan.isUpdate()">
	<xf:button href="{{ link('banning/users/lift', $userBan) }}" overlay="true">{{ phrase('lift_ban') }}</xf:button>
</xf:pageaction>

<xf:form action="{{ link('banning/users/save', $userBan) }}" ajax="true" class="block">
	<div class="block-container">
		<div class="block-body">
			<xf:if is="!$userBan.user_id">
				<xf:textboxrow name="username" ac="single" value="{$addName}"
					label="{{ phrase('user_name') }}" />
			<xf:else />
				<xf:formrow label="{{ phrase('user_name') }}">{$userBan.User.username}</xf:formrow>

				<xf:formrow label="{{ phrase('banned_by') }}">{$userBan.BanUser.username}</xf:formrow>

				<xf:formrow label="{{ phrase('ban_started') }}">{{ date($userBan.ban_date) }}</xf:formrow>

				<xf:formrow label="{{ phrase('ban_ends') }}">
					<xf:if is="$userBan.end_date">
						{{ date($userBan.end_date) }}
					<xf:else />
						{{ phrase('never') }}
					</xf:if>
				</xf:formrow>
			</xf:if>

			<xf:radiorow name="ban_length" value="{{ !$userBan.end_date ? 'permanent' : 'temporary' }}"
				label="{{ phrase('ban_length') }}">

				<xf:option label="{{ phrase('permanent') }}" value="permanent" />
				<xf:option label="{{ phrase('until:') }}" value="temporary">
					<xf:dateinput name="end_date" value="{{ $userBan.end_date ? date($userBan.end_date, 'Y-m-d') : '' }}" />
				</xf:option>
			</xf:radiorow>

			<xf:textboxrow name="user_reason" value="{$userBan.user_reason}" maxlength="{{ max_length($userBan, 'user_reason') }}"
				label="{{ phrase('reason_for_banning') }}"
				explain="{{ phrase('this_will_be_shown_to_user_if_provided') }}" />
		</div>

		<xf:submitrow icon="save" sticky="true" />
	</div>
</xf:form>