{% if config.url_banner %}<img class="board_image" src="{{ config.url_banner }}" {% if config.banner_width or config.banner_height %}style="{% if config.banner_width %}width:{{ config.banner_width }}px{% endif %};{% if config.banner_width %}height:{{ config.banner_height }}px{% endif %}" {% endif %}alt="" />{% endif %}

<div class="banform">
	<form method="post" action="">
		<input type="hidden" name="token" value="{{ token }}">
		
		<fieldset>
			<legend>{% trans 'Panic System Configuration' %}</legend>
			
			<p class="unimportant">{% trans 'We all gon die' %}</p>
      <p>NOTE:If you hit save and do not see your checkboxes change, simply exit the panic page, and come back, they will show up. The system works as it should.</p>
			
			<table>
				<tr>
					<th>{% trans 'Enable Panic System' %}</th>
					<td>
						<input type="checkbox" name="panic_enabled" id="panic_enabled"{% if config.panic.enabled %} checked{% endif %}>
						<label for="panic_enabled">{% trans 'Activate panic system' %}</label>
					</td>
				</tr>
				<tr>
					<th>{% trans 'Post Approval' %}</th>
					<td>
						<input type="checkbox" name="panic_post_approval" id="panic_post_approval"{% if config.panic.post_approval %} checked{% endif %}>
						<label for="panic_post_approval">{% trans 'Require all posts to be approved by moderators' %}</label>
					</td>
				</tr>
				<tr>
					<th>{% trans 'IP Lockdown' %}</th>
					<td>
						<input type="checkbox" name="panic_ip_lockdown" id="panic_ip_lockdown"{% if config.panic.ip_lockdown %} checked{% endif %}>
						<label for="panic_ip_lockdown">{% trans 'Block IPs with no previous post history' %}</label>
					</td>
				</tr>
				<tr>
					<th>{% trans 'Total Lockdown' %}</th>
					<td>
						<input type="checkbox" name="panic_total_lockdown" id="panic_total_lockdown"{% if config.panic.total_lockdown %} checked{% endif %}>
						<label for="panic_total_lockdown">{% trans 'Lock all boards (prevent all posting)' %}</label>
					</td>
				</tr>
				<tr>
					<th>{% trans 'Queue Limit' %}</th>
					<td>
						<input type="number" name="panic_queue_limit" id="panic_queue_limit" value="{{ config.panic.queue_limit|default(100) }}" min="1" max="10000">
						<label for="panic_queue_limit">{% trans 'Maximum posts in approval queue (0 = unlimited) (dont actually set it to 0 though)' %}</label>
					</td>
				</tr>
			</table>
		</fieldset>
		
		<p style="text-align:center">
			<input name="save" type="submit" value="{% trans 'Save Changes' %}">
		</p>
	</form>
</div>

<script>
document.addEventListener('DOMContentLoaded', function() {
    const panicEnabled = document.getElementById('panic_enabled');
    const panicPostApproval = document.getElementById('panic_post_approval'),
        panicIpLockdown = document.getElementById('panic_ip_lockdown'),
        panicTotalLockdown = document.getElementById('panic_total_lockdown'),
        panicQueueLimit = document.getElementById('panic_queue_limit');

    function updateCheckboxes() {
        const enabled = panicEnabled.checked;
        panicPostApproval.disabled = !enabled;
        panicIpLockdown.disabled = !enabled;
        panicTotalLockdown.disabled = !enabled;
        panicQueueLimit.disabled = !enabled;
    }
    
    panicEnabled.addEventListener('change', updateCheckboxes);
    updateCheckboxes();
});
</script>
