{% include 'overall_header.html' %}

<header class="iz-sectionhead">
	<h1 class="iz-sectionhead__title">{{ L_SEARCH }}</h1>
</header>

{% EVENT search_body_form_before %}

<form method="get" action="{{ S_SEARCH_ACTION }}" data-focus="keywords" autocomplete="off" class="iz-form">

	<section class="iz-card iz-card--search">
		<header class="iz-card__header">
			<h2 class="iz-card__title">{{ L_SEARCH_QUERY }}</h2>
		</header>

		<div class="iz-card__body">
			{% EVENT search_body_search_query_before %}
			<fieldset class="iz-fieldset">
				{% EVENT search_body_search_query_prepend %}

				<div class="iz-field">
					<label class="iz-label" for="skwrds">{{ L_SEARCH_KEYWORDS }}{{ L_COLON }}</label>
					<p class="iz-hint">{{ L_SEARCH_KEYWORDS_EXPLAIN }}</p>
					<input class="iz-input" type="text" placeholder="{{ L_SEARCH_KWDS_PLACEHOLDER }}" name="keywords" id="skwrds" title="{{ L_SEARCH_KEYWORDS }}" />
				</div>

				<div class="iz-field">
					<div class="iz-label">{{ L_SEARCH_KEYWORDS }}</div>
					<div class="iz-choicegroup" role="radiogroup" aria-label="{{ L_SEARCH_KEYWORDS }}">
						<div class="iz-choice">
							<input type="radio" checked="checked" name="terms" id="terms1" value="all">
							<label for="terms1">{{ L_SEARCH_ALL_TERMS }}</label>
						</div>
						<div class="iz-choice">
							<input type="radio" name="terms" id="terms2" value="any">
							<label for="terms2">{{ L_SEARCH_ANY_TERMS }}</label>
						</div>
					</div>
				</div>

				<div class="iz-field">
					<label class="iz-label" for="author">{{ L_SEARCH_AUTHOR }}{{ L_COLON }}</label>
					<p class="iz-hint">{{ L_SEARCH_AUTHOR_EXPLAIN }}</p>
					<input class="iz-input" type="text" placeholder="{{ L_SEARCH_USR_PLACEHOLDER }}" name="author" id="author" title="{{ L_SEARCH_AUTHOR }}" />
				</div>

				{% EVENT search_body_search_query_append %}
			</fieldset>
			{% EVENT search_body_search_query_after %}
		</div>
	</section>

	<div class="iz-space iz-space--sm"></div>

	<section class="iz-card iz-card--search">
		<header class="iz-card__header">
			<h2 class="iz-card__title">{{ L_SEARCH_OPTIONS }}</h2>
		</header>

		<div class="iz-card__body">
			{% EVENT search_body_search_options_before %}
			<fieldset class="iz-fieldset">
				{% EVENT search_body_search_options_prepend %}

				<div class="iz-field">
					<label class="iz-label" for="search_forum">{{ L_SEARCH_FORUMS }}{{ L_COLON }}</label>
					<p class="iz-hint">{{ L_SEARCH_FORUMS_EXPLAIN }}</p>
					<select class="iz-select" name="fid[]" id="search_forum" multiple="multiple" size="8" title="{{ L_SEARCH_FORUMS }}">
						{{ S_FORUM_OPTIONS }}
					</select>
				</div>

				<div class="iz-field">
					<div class="iz-label">{{ L_SEARCH_SUBFORUMS }}{{ L_COLON }}</div>
					<div class="iz-choicegroup" role="radiogroup" aria-label="{{ L_SEARCH_SUBFORUMS }}">
						<div class="iz-choice">
							<input type="radio" checked="checked" name="sc" id="search_child1" value="1">
							<label for="search_child1">{{ L_YES }}</label>
						</div>
						<div class="iz-choice">
							<input type="radio" name="sc" id="search_child2" value="0">
							<label for="search_child2">{{ L_NO }}</label>
						</div>
					</div>
				</div>

				<div class="iz-field">
					<div class="iz-label">{{ L_SEARCH_WITHIN }}{{ L_COLON }}</div>
					<div class="iz-choicegroup" role="radiogroup" aria-label="{{ L_SEARCH_WITHIN }}">
						<div class="iz-choice">
							<input type="radio" checked="checked" name="sf" id="sf1" value="all">
							<label for="sf1">{{ L_SEARCH_TITLE_MSG }}</label>
						</div>
						<div class="iz-choice">
							<input type="radio" name="sf" id="sf2" value="msgonly">
							<label for="sf2">{{ L_SEARCH_MSG_ONLY }}</label>
						</div>
						<div class="iz-choice">
							<input type="radio" name="sf" id="sf3" value="titleonly">
							<label for="sf3">{{ L_SEARCH_TITLE_ONLY }}</label>
						</div>
						<div class="iz-choice">
							<input type="radio" name="sf" id="sf4" value="firstpost">
							<label for="sf4">{{ L_SEARCH_FIRST_POST }}</label>
						</div>
					</div>
				</div>

				<div class="iz-field">
					<div class="iz-label">{{ L_DISPLAY_RESULTS }}{{ L_COLON }}</div>
					<div class="iz-choicegroup" role="radiogroup" aria-label="{{ L_DISPLAY_RESULTS }}">
						<div class="iz-choice">
							<input type="radio" checked="checked" name="sr" id="show_results1" value="posts">
							<label for="show_results1">{{ L_POSTS }}</label>
						</div>
						<div class="iz-choice">
							<input type="radio" name="sr" id="show_results2" value="topics">
							<label for="show_results2">{{ L_TOPICS }}</label>
						</div>
					</div>
				</div>

				<div class="iz-field">
					<label class="iz-label" for="sk">{{ L_RESULT_SORT }}{{ L_COLON }}</label>
					<div class="iz-control">{{ S_SELECT_SORT_KEY }}</div>

					<div class="iz-space iz-space--xs"></div>

					<div class="iz-choicegroup" role="radiogroup" aria-label="{{ L_RESULT_SORT }}">
						<div class="iz-choice">
							<input type="radio" name="sd" id="sa" value="a">
							<label for="sa">{{ L_SORT_ASCENDING }}</label>
						</div>
						<div class="iz-choice">
							<input type="radio" name="sd" id="sd" value="d" checked="checked">
							<label for="sd">{{ L_SORT_DESCENDING }}</label>
						</div>
					</div>
				</div>

				<div class="iz-field">
					<label class="iz-label" for="st">{{ L_RESULT_DAYS }}{{ L_COLON }}</label>
					<div class="iz-control">{{ S_SELECT_SORT_DAYS }}</div>
				</div>

				<div class="iz-field">
					<label class="iz-label" for="ch">{{ lang('RETURN_FIRST') }}{{ L_COLON }}</label>
					<p class="iz-hint">{{ lang('RETURN_FIRST_EXPLAIN') }}</p>

					<div class="iz-inputgroup">
						<input type="number" id="ch" name="ch" value="{{ DEFAULT_RETURN_CHARS }}" min="0" max="9999" title="{{ lang('RETURN_FIRST') }}" class="iz-input" />
						<span class="iz-inputgroup__addon">{{ L_POST_CHARACTERS }}</span>
					</div>
				</div>

				{% EVENT search_body_search_options_append %}
			</fieldset>
		</div>
	</section>

	<div class="iz-actions">
		{{ S_HIDDEN_FIELDS }}
		<button type="submit" name="submit" value="{{ L_SEARCH }}" class="iz-btn iz-btn--primary">
			{{ L_SEARCH }}
		</button>
	</div>

</form>

{% EVENT search_body_form_after %}

<div class="iz-space iz-space--sm"></div>

{% EVENT search_body_recent_search_before %}
{% if recentsearch %}
	<section class="iz-card iz-card--recentsearch">
		<header class="iz-card__header">
			<h2 class="iz-card__title">{{ L_RECENT_SEARCHES }}</h2>
		</header>

		<div class="iz-card__body">
			<div class="iz-tablewrap" role="region" aria-label="{{ L_RECENT_SEARCHES }}">
				<table class="iz-table">
					<thead>
						<tr>
							<th scope="col">{{ L_SEARCH_KEYWORDS }}</th>
							<th scope="col">{{ L_TIME }}</th>
						</tr>
					</thead>
					<tbody>
						{% for recentsearch in recentsearch %}
							<tr>
								<td><a class="iz-link" href="{{ recentsearch.U_KEYWORDS }}">{{ recentsearch.KEYWORDS }}</a></td>
								<td>{{ recentsearch.TIME }}</td>
							</tr>
						<!-- BEGINELSE -->
							<tr>
								<td colspan="2">{{ L_NO_RECENT_SEARCHES }}</td>
							</tr>
						{% endfor %}
					</tbody>
				</table>
			</div>
		</div>
	</section>
{% endif %}
{% EVENT search_body_recent_search_after %}

{% include 'overall_footer.html' %}
