<xf:title>{{ phrase('notices') }}</xf:title>

<xf:pageaction>
	<xf:button href="{{ link('notices/add') }}" icon="add">{{ phrase('add_notice') }}</xf:button>
</xf:pageaction>

<xf:if is="$notices is not empty">
	<xf:if is="$invalidNotices">
		<div class="blockMessage blockMessage--important">
			{{ phrase('following_notices_may_contain_page_criteria_which_is_no_longer_matched:') }}
			<ul class="listInline listInline--comma">
				<xf:foreach loop="$invalidNotices" value="$invalidNotice">
					<li><a href="{{ link('notices/edit', $invalidNotice) }}">{$invalidNotice.title}</a></li>
				</xf:foreach>
			</ul>
		</div>
	</xf:if>

	<xf:form action="{{ link('notices/toggle') }}" class="block" ajax="true">
		<div class="block-outer">
			<xf:macro template="filter_macros" name="quick_filter" arg-key="notices" arg-class="block-outer-opposite" />
		</div>
		<div class="block-container">
			<div class="block-body">
				<xf:datalist>
					<xf:foreach loop="$noticeTypes" key="$typeId" value="$phrase" if="{$notices.{$typeId}} is not empty">
						<tbody class="dataList-rowGroup">
							<xf:datarow rowtype="subsection" rowclass="dataList-row--noHover">
								<xf:cell colspan="3">{$phrase}</xf:cell>
							</xf:datarow>
							<xf:foreach loop="{$notices.{$typeId}}" value="$notice">
								<xf:datarow
									label="{$notice.title}"
									href="{{ link('notices/edit', $notice) }}"
									delete="{{ link('notices/delete', $notice) }}">
									<xf:toggle name="active[{$notice.notice_id}]" selected="$notice.active"
										class="dataList-cell--separated" submit="true"
										tooltip="{{ phrase('enable_disable_x', {'title': $notice.title}) }}" />
								</xf:datarow>
							</xf:foreach>
						</tbody>
					</xf:foreach>
				</xf:datalist>
				<div class="block-footer">
					<span class="block-footer-counter">{{ display_totals($totalNotices) }}</span>
				</div>
			</div>
		</div>
	</xf:form>
<xf:else />
	<div class="blockMessage">{{ phrase('no_items_have_been_created_yet') }}</div>
</xf:if>

<xf:macro template="option_macros" name="option_form_block" arg-options="{$options}" />