{% extends 'base.html' %}
{% load custom_tags_and_filters %}
{% block title %}Preferences{% endblock %}
{% block content %}
	<h1>User Preferences</h1>
		<form class="form-horizontal" action="{% url 'user_preferences' %}" method="post">
			{% csrf_token %}
			<div class="panel panel-default">
				<div class="panel-body">
					<h3>Reservations</h3>
					<div class="form-group col-sm-12">
						<div class="checkbox">
							<label><input name="attach_created_reservation" type="checkbox" {% if user_preferences.attach_created_reservation %}checked{% endif %}>Check this box to receive ICS calendar invitation when creating reservation</label>
						</div>
						<div class="checkbox">
							<label><input name="attach_cancelled_reservation" type="checkbox" {% if user_preferences.attach_cancelled_reservation %}checked{% endif %}>Check this box to receive ICS calendar invitation when cancelling a reservation</label>
						</div>
					</div>
				</div>
			</div>
			<div class="panel panel-default">
				<div class="panel-body">
					<h3>Buddy System</h3>
					<div class="form-group col-sm-12">
						<div class="checkbox">
							<label><input name="display_new_buddy_request_notification" type="checkbox" {% if user_preferences.display_new_buddy_request_notification %}checked{% endif %}>Check this box to see notification badges for new buddy requests</label>
						</div>
						<div class="checkbox">
							<label><input name="display_new_buddy_request_reply_notification" type="checkbox" {% if user_preferences.display_new_buddy_request_reply_notification %}checked{% endif %}>Check this box to see notification badges when users reply to buddy requests you replied to</label>
						</div>
						<div class="checkbox">
							<label><input name="email_new_buddy_request_reply" type="checkbox" {% if user_preferences.email_new_buddy_request_reply %}checked{% endif %}>Check this box to receive an email notification when users reply to buddy requests you replied to</label>
						</div>
					</div>
				</div>
			</div>
            {% if show_staff_status and user_view != 'day' %}
                <div class="panel panel-default">
                    <div class="panel-body">
                        <h3>Staff status</h3>
                        <div class="form-group">
                            <label class="col-sm-2 form-control-static" for="staff_status_view">Default view</label>
                            <div class="col-sm-10">
                                <label class="radio-inline">
                                  <input type="radio" name="staff_status_view" id="staff_status_view" value="day" {% if user_preferences.staff_status_view == 'day' %}checked{% endif %}> Day
                                </label>
                                <label class="radio-inline">
                                  <input type="radio" name="staff_status_view" value="week" {% if user_preferences.staff_status_view == 'week' %}checked{% endif %}> Week
                                </label>
                                {% if not user_view %}
                                    <label class="radio-inline">
                                      <input type="radio" name="staff_status_view" value="month" {% if user_preferences.staff_status_view == 'month' %}checked{% endif %}> Month
                                    </label>
                                {% endif %}
                            </div>
                        </div>
                    </div>
                </div>
            {% endif %}
            <div class="panel panel-default">
				<div class="panel-body">
					<h3>Alternate email</h3>
                    <div class="form-group">
                        <label class="col-sm-2 form-control-static" for="alternate_email_address">Alternate email address</label>
                        <div class="col-sm-4">
                            <input type="email" class="form-control" id="alternate_email_address" name="email_alternate" value="{{ form.email_alternate.value|default_if_none:'' }}" maxlength="254">
                        </div>
                        {% if form.email_alternate.errors %}
                            <div class="col-sm-6 form-control-static danger-highlight">
                                {{ form.email_alternate.errors|striptags }}
                            </div>
			            {% endif %}
                    </div>
					<div class="form-group col-sm-12">
						<div class="checkbox">
							<label><input name="email_send_reservation_emails" type="checkbox" {% if user_preferences.email_send_reservation_emails %}checked{% endif %}>{{ form.email_send_reservation_emails.help_text }}</label>
						</div>
						<div class="checkbox">
							<label><input name="email_send_usage_reminders" type="checkbox" {% if user_preferences.email_send_usage_reminders %}checked{% endif %}>{{ form.email_send_usage_reminders.help_text }}</label>
						</div>
						<div class="checkbox">
							<label><input name="email_send_reservation_reminders" type="checkbox" {% if user_preferences.email_send_reservation_reminders %}checked{% endif %}>{{ form.email_send_reservation_reminders.help_text }}</label>
						</div>
						<div class="checkbox">
							<label><input name="email_send_reservation_ending_reminders" type="checkbox" {% if user_preferences.email_send_reservation_ending_reminders %}checked{% endif %}>{{ form.email_send_reservation_ending_reminders.help_text }}</label>
						</div>
						<div class="checkbox">
							<label><input name="email_send_buddy_request_replies" type="checkbox" {% if user_preferences.email_send_buddy_request_replies %}checked{% endif %}>{{ form.email_send_buddy_request_replies.help_text }}</label>
						</div>
						<div class="checkbox">
							<label><input name="email_send_access_request_updates" type="checkbox" {% if user_preferences.email_send_access_request_updates %}checked{% endif %}>{{ form.email_send_access_request_updates.help_text }}</label>
						</div>
						<div class="checkbox">
							<label><input name="email_send_task_updates" type="checkbox" {% if user_preferences.email_send_task_updates %}checked{% endif %}>{{ form.email_send_task_updates.help_text }}</label>
						</div>
						<div class="checkbox">
							<label><input name="email_send_broadcast_emails" type="checkbox" {% if user_preferences.email_send_broadcast_emails %}checked{% endif %}>{{ form.email_send_broadcast_emails.help_text }}</label>
						</div>
					</div>
				</div>
			</div>
			<input type="submit" value="Update" class="btn btn-info">
		</form>

{% endblock %}