<div id="update-timeout-modal" class="modal">
    <div class="modal-dialog">
        <div class="modal-content">
            <form id="update-timeout-form" method="post">
                {% csrf_token %}
                <input type="hidden" name="kind" value="simple" />
                <input type="hidden" name="timeout" id="update-timeout-timeout" />
                <input type="hidden" name="grace" id="update-timeout-grace" />

                <div class="modal-body">
                    <div class="update-timeout-info text-center">
                        <span
                            class="update-timeout-label"
                            data-toggle="tooltip"
                            title="Expected time between pings.">
                            Period
                        </span>
                        <span
                            id="period-slider-value"
                            class="update-timeout-value">
                            1 day
                        </span>
                    </div>

                    <div id="period-slider"></div>

                    <div class="update-timeout-info text-center">
                        <span
                            class="update-timeout-label"
                            data-toggle="tooltip"
                            title="When check is late, how long to wait until an alert is sent">
                            Grace Time
                        </span>
                        <span
                            id="grace-slider-value"
                            class="update-timeout-value">
                            1 day
                        </span>
                    </div>

                    <div id="grace-slider"></div>

                    <div class="update-timeout-terms">
                        <p>
                            <span>Period</span>
                            Expected time between pings.
                        </p>
                        <p>
                            <span>Grace Time</span>
                            When a check is late, how long to wait until an alert is sent.
                        </p>
                    </div>
                </div>

                <div class="modal-footer">
                    <div class="btn-group pull-left">
                        <label class="btn btn-default kind-simple active">Simple</label>
                        <label class="btn btn-default kind-cron">Cron</label>
                    </div>

                    <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
                    <button type="submit" class="btn btn-primary">Save</button>
                </div>
            </form>

            <form id="update-cron-form" method="post">
                {% csrf_token %}
                <input type="hidden" name="kind" value="cron" />
                <div class="modal-body">
                    <div class="row">
                        <div class="col-md-4">
                            <div class="form-group">
                                <label for="schedule">Cron Expression</label>
                                <input
                                    type="text"
                                    class="form-control"
                                    id="schedule"
                                    name="schedule"
                                    placeholder="* * * * *">
                                <div id="schedule-hint">
                                    m h dom mon dow
                                    <a href="{% url 'hc-docs-cron' %}" target="_blank">(cheatsheet)</a>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-4">
                            <div class="form-group">
                                <label for="tz">Server's Time Zone</label>
                                <br />
                                <select
                                    id="tz"
                                    name="tz"
                                    class="selectpicker form-control"
                                    data-live-search="true">
                                    <option>UTC</option>
                                    {% for tz in timezones %}
                                    <option>{{ tz }}</option>{% endfor %}
                                </select>
                            </div>
                        </div>
                        <div class="col-md-4">
                            <div class="form-group">
                                <label for="cron-grace">Grace Time</label>
                                <div class="input-group">
                                    <input
                                        type="number"
                                        min="1"
                                        max="43200"
                                        class="form-control"
                                        id="update-timeout-grace-cron"
                                        name="grace">
                                    <div class="input-group-addon">minutes</div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-12">
                            <div id="cron-preview"></div>
                        </div>
                    </div>
                </div>

                <div class="modal-footer">
                    <div class="btn-group pull-left">
                        <label class="btn btn-default kind-simple">Simple</label>
                        <label class="btn btn-default active kind-cron">Cron</label>
                    </div>

                    <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
                    <button id="update-cron-submit" type="submit" class="btn btn-primary" {% if not rw %}disabled{% endif %}>
                        Save
                    </button>
                </div>
            </form>
        </div>
    </div>
</div>