
{% from '_helpers.jinja' import render_field %}

{% macro render_common_settings_form(form, emailprefix, settings_application) %}
                        <div class="pure-control-group">
                            {{ render_field(form.notification_urls, rows=5, placeholder="Examples:
    Gitter - gitter://token/room
    Office365 - o365://TenantID:AccountEmail/ClientID/ClientSecret/TargetEmail
    AWS SNS - sns://AccessKeyID/AccessSecretKey/RegionName/+PhoneNo
    SMTPS - mailtos://user:pass@mail.domain.com?to=receivingAddress@example.com",
    class="notification-urls" )
                            }}
                            <div class="pure-form-message-inline">
                              <ul>
                                <li>Use <a target=_new href="https://github.com/caronc/apprise">AppRise URLs</a> for notification to just about any service! <i><a target=_new href="https://github.com/dgtlmoon/changedetection.io/wiki/Notification-configuration-notes">Please read the notification services wiki here for important configuration notes</a></i>.</li>
                                <li><code>discord://</code> only supports a maximum <strong>2,000 characters</strong> of notification text, including the title.</li>
                                <li><code>tgram://</code> bots cant send messages to other bots, so you should specify chat ID of non-bot user.</li>
                                <li><code>tgram://</code> only supports very limited HTML and can fail when extra tags are sent, <a href="https://core.telegram.org/bots/api#html-style">read more here</a> (or use plaintext/markdown format)</li>
                              </ul>
                            </div>
                            <br/>
                            <a id="send-test-notification" class="pure-button button-secondary button-xsmall" style="font-size: 70%">Send test notification</a>
{% if emailprefix %}
                            <a id="add-email-helper" class="pure-button button-secondary button-xsmall" style="font-size: 70%">Add email</a>
{% endif %}
                            <a href="{{url_for('notification_logs')}}" class="pure-button button-secondary button-xsmall" style="font-size: 70%">Notification debug logs</a>
                        </div>
                        <div id="notification-customisation" class="pure-control-group">
                            <div class="pure-control-group">
                                {{ render_field(form.notification_title, class="m-d notification-title", placeholder=settings_application['notification_title']) }}
                                <span class="pure-form-message-inline">Title for all notifications</span>
                            </div>
                            <div class="pure-control-group">
                                {{ render_field(form.notification_body , rows=5, class="notification-body", placeholder=settings_application['notification_body']) }}
                                <span class="pure-form-message-inline">Body for all notifications</span>
                            </div>
                            <div class="pure-control-group">
                            <!-- unsure -->
                                {{ render_field(form.notification_format , class="notification-format") }}
                                <span class="pure-form-message-inline">Format for all notifications</span>
                            </div>
                            <div class="pure-controls">
                            <span class="pure-form-message-inline">
                                These tokens can be used in the notification body and title to customise the notification text.

                                <table class="pure-table" id="token-table">
                                    <thead>
                                    <tr>
                                        <th>Token</th>
                                        <th>Description</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <tr>
                                        <td><code>{base_url}</code></td>
                                        <td>The URL of the changedetection.io instance you are running.</td>
                                    </tr>
                                    <tr>
                                        <td><code>{watch_url}</code></td>
                                        <td>The URL being watched.</td>
                                    </tr>
                                    <tr>
                                        <td><code>{watch_uuid}</code></td>
                                        <td>The UUID of the watch.</td>
                                    </tr>
                                    <tr>
                                        <td><code>{watch_title}</code></td>
                                        <td>The title of the watch.</td>
                                    </tr>
                                    <tr>
                                        <td><code>{watch_tag}</code></td>
                                        <td>The tag of the watch.</td>
                                    </tr>
                                    <tr>
                                        <td><code>{preview_url}</code></td>
                                        <td>The URL of the preview page generated by changedetection.io.</td>
                                    </tr>
                                    <tr>
                                        <td><code>{diff}</code></td>
                                        <td>The diff output - differences only</td>
                                    </tr>
                                    <tr>
                                        <td><code>{diff_full}</code></td>
                                        <td>The diff output - full difference output</td>
                                    </tr>
                                    <tr>
                                        <td><code>{diff_url}</code></td>
                                        <td>The URL of the diff page generated by changedetection.io.</td>
                                    </tr>
                                    <tr>
                                        <td><code>{current_snapshot}</code></td>
                                        <td>The current snapshot value, useful when combined with JSON or CSS filters
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                                <br/>
                                URLs generated by changedetection.io (such as <code>{diff_url}</code>) require the <code>BASE_URL</code> environment variable set.<br/>
                                Your <code>BASE_URL</code> var is currently "{{settings_application['current_base_url']}}"
                            </span>
                            </div>
                        </div>
{% endmacro %}
