{% load custom_tags_and_filters %}
<div class="panel-body">
    <h3 class="customization-section-title">Application settings</h3>
    <form method="POST" action="{% url 'customize' 'application' %}" class="form-horizontal">
        {% csrf_token %}
        <div class="form-group">
            <label class="control-label col-md-3" for="facility_name">Facility name</label>
            <div class="col-md-4">
                <input type="text" id="facility_name" name="facility_name" class="form-control" value="{{ facility_name }}">
            </div>
            <div class="col-md-5 help-block light-grey">
                The name of the facility to use in all templates.
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-md-3" for="site_title">Site title</label>
            <div class="col-md-4">
                <input type="text" id="site_title" name="site_title" class="form-control" value="{{ site_title }}">
            </div>
            <div class="col-md-5 help-block light-grey">
                The name of the site to use in all templates/headers.
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-md-3">Area login/logout</label>
            <div class="col-md-9">
                <div class="checkbox">
                    <label><input type="checkbox" name="self_log_in" {% if self_log_in %}checked{% endif %} value="enabled">Allow users to log themselves into access controlled areas from the landing page</label><br/>
                    <label><input type="checkbox" name="self_log_out" {% if self_log_out %}checked{% endif %} value="enabled">Allow users to log themselves out of access controlled areas from the landing page</label><br/>
                    <label><input type="checkbox" name="calendar_login_logout" {% if calendar_login_logout %}checked{% endif %} value="enabled">Show access controlled area login/logout button on calendar view (requires login and/or logout feature enabled above)</label>
                    {% if "NEMO.apps.area_access"|app_installed %}<label><input type="checkbox" name="area_logout_already_logged_in" {% if area_logout_already_logged_in %}checked{% endif %} value="enabled">Automatically log users out when they try to log in to an area they are already logged in (single entrance/exit tablet mode)</label>{% endif %}
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-md-3">Area usage reminder</label>
            <div class="col-md-9">
                <div class="checkbox">
                    <input type="hidden" name="area_in_usage_reminders" value="off"/>
                    <label><input type="checkbox" name="area_in_usage_reminders" {% if area_in_usage_reminders != "off" %}checked{% endif %} value="">In usage reminder emails, show areas users are currently logged in</label><br/>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="control-label col-md-3">Consumables</label>
            <div class="col-md-9">
                <div class="checkbox">
                    <label><input type="checkbox" name="consumable_user_self_checkout" {% if consumable_user_self_checkout %}checked{% endif %} value="enabled">Allow users to self-checkout consumables</label>
                </div>
            </div>
            <div class="col-md-offset-3 col-md-9 help-block light-grey">
                If enabled, you need to add a {% if "django.contrib.admin"|app_installed %}<a href="{% url 'admin:NEMO_landingpagechoice_changelist' %}">landing page choice</a>{% else %}landing page option{% endif %} with url <b>/consumables/</b> so users can have a way to get to the page.
            </div>
        </div>
		{% if "NEMO.apps.area_access"|app_installed or "NEMO.apps.kiosk"|app_installed and badge_readers %}
			<div class="form-group">
				<label class="control-label col-md-3" for="default_badge_reader_id">Default badge reader</label>
				<div class="col-md-4">
					<select id="default_badge_reader_id" name="default_badge_reader_id" class="form-control">
						<option value="" label="Default badge reader"></option>
						{% for badge_reader in badge_readers %}
							<option value="{{ badge_reader.id }}" label="{{ badge_reader.name }}" {% if default_badge_reader_id|to_int == badge_reader.id %}selected{% endif %}></option>
						{% endfor %}
					</select>
				</div>
				<div class="col-md-5 help-block light-grey">
					The default badge reader to use for the area access and kiosk tablets.
				</div>
			</div>
		{% endif %}
        <div class="customization-separation" style="margin-bottom: 15px"></div>
        <div class="text-center">
            {% button type="save" value="Save settings" %}
        </div>
    </form>
</div>