{% import 'languages/'+lang|default('en')+'.html' as lang %}
{% from 'include/input_macros.html' import input, select, checkbox %}
{% if user_status == 0 %}
	{% include 'include/no_sub.html' %}
{% else %}
<script>
    $( "#checker_tabs" ).tabs();
</script>
<style>
    .checker_settings_table {
        margin-bottom: 15px;
    }
</style>
{% for s in services %}
    {% if s.0 == 'roxy-wi-checker' %}
        {% if s.3 == '* is not installed' and s.3 == '' %}
            <div style="text-align: center;">
                <br />
                <h3>{{lang.phrases.checker_not_installed}}
                    {{lang.words.read|title()}} <a href="https://roxy-wi.org/tools/checker#installation" title="Checker {{lang.words.installation}}" style="color: #5d9ceb;" target="_blank">{{lang.words.here}}</a>
                    {{lang.phrases.how_to_install_checker}}</h3>
            </div>
            {% else %}
<div id="checker_tabs">
    <ul id="checker-tabs-head">
        <li><a href="#channels" title="Checker {{lang.words.channels}} - Roxy-WI">{{lang.words.channels|title()}}</a></li>
        <li><a href="#checker_settings" title="Checker {{lang.words.settings}} - Roxy-WI">{{lang.words.settings|title()}}</a></li>
    </ul>
    <div id="channels">
        <table id="checker_telegram_table" class="overview-overflow">
            <caption><i class="fab fa-telegram caption-icon"></i><h3>Telegram {{lang.words.channels}}</h3></caption>
            <tr class="overviewHead" style="width: 50%;">
                <td class="padding10 first-collumn" style="width: 25%;">
                    {{lang.words.token|title()}}
                </td>
                <td style="width: 20%;">{{lang.words.channel|title()}}</td>
                {% if role|int() == 1 %}
                <td style="width: 25%;">{{lang.words.group|title()}}</td>
                {% endif %}
                <td style="width: 100%;"></td>
                <td></td>
                <td><span onclick="loadchecker()" class="refresh" title="{{lang.words.refresh2|title()}} Telegram {{lang.words.channels}}"></span></td>
            </tr>
            {% for telegram in telegrams %}
            <tr id="telegram-table-{{telegram.id}}" class="{{ loop.cycle('odd', 'even') }}">
                <td class="padding10 first-collumn">
                    {% set id = 'telegram-token-' + telegram.id|string() %}
                    {{ input(id, value=telegram.token, size='30') }}
                </td>
                <td>
                    {% set id = 'telegram-chanel-' + telegram.id|string() %}
                    {{ input(id, value=telegram.chanel_name, size='30') }}
                </td>
                {% if role|int() == 1 %}
                <td>
                    <select id="telegramgroup-{{telegram.id}}" name="telegramgroup-{{telegram.id}}">
                        <option disabled selected>------</option>
                        {% for group in groups %}
                        {% if telegram.groups|string() == group.group_id|string() %}
                        <option value="{{ group.group_id }}" selected>{{ group.name }}</option>
                        {% else %}
                        <option value="{{ group.group_id }}">{{ group.name }}</option>
                        {% endif %}
                        {% endfor %}
                    </select>
                </td>
                {% endif %}
                <td>
                    <button title="{{lang.phrases.send_test_mes}}" onclick="checkReceiver({{telegram.id}}, 'telegram')">{{lang.words.test|title()}}</button>
                </td>
                <td>
                    <a class="add" onclick="cloneReceiver({{telegram.id}}, 'telegram')" id="clone-{{telegram.id}}" title="{{lang.words.w_copy|title()}} {{lang.words.the}} {{lang.words.settings}} {{telegram.chanel_name}}" style="cursor: pointer;"></a>
                </td>
                <td>
                    <a class="delete" onclick="confirmDeleteReceiver({{telegram.id}}, 'telegram')" title="{{lang.words.delete|title()}} {{lang.words.channel}} {{telegram.chanel_name}}" style="cursor: pointer;"></a>
                </td>
            </tr>
            {% endfor %}
        </table>
        <br /><span class="add-button" title="{{lang.words.add|title()}} Telegram {{lang.words.channel}}" id="add-telegram-button">+ {{lang.words.add|title()}}</span>
        <br /><br />
        <table id="checker_slack_table" class="overview-overflow">
            <caption><i class="fab fa-slack caption-icon"></i><h3>Slack {{lang.words.channels|title()}}</h3></caption>
            <tr class="overviewHead" style="width: 50%;">
                <td class="padding10 first-collumn" style="width: 25%;">
                    <span title="Token that has given with APP registration">{{lang.words.token|title()}}</span>
                </td>
                <td style="width: 20%;">{{lang.words.channel|title()}}</td>
                {% if role|int() == 1 %}
                <td style="width: 25%;">{{lang.words.group|title()}}</td>
                {% endif %}
                <td style="width: 100%;"></td>
                <td></td>
                <td><span onclick="loadchecker()" class="refresh" title="{{lang.words.refresh2|title()}} Slack {{lang.words.channels}}"></span></td>
            </tr>
            {% for slack in slacks %}
            <tr id="slack-table-{{slack.id}}" class="{{ loop.cycle('odd', 'even') }}">
                <td class="padding10 first-collumn">
                    {% set id = 'slack-token-' + slack.id|string() %}
                    {{ input(id, value=slack.token, size='30') }}
                </td>
                <td>
                    {% set id = 'slack-chanel-' + slack.id|string() %}
                    {{ input(id, value=slack.chanel_name, size='30') }}
                </td>
                {% if role|int() == 1 %}
                <td>
                    <select id="slackgroup-{{slack.id}}" name="slackgroup-{{slack.id}}">
                        <option disabled selected>------</option>
                        {% for group in groups %}
                        {% if slack.groups|string() == group.group_id|string() %}
                        <option value="{{ group.group_id }}" selected>{{ group.name }}</option>
                        {% else %}
                        <option value="{{ group.group_id }}">{{ group.name }}</option>
                        {% endif %}
                        {% endfor %}
                    </select>
                </td>
                {% endif %}
                <td>
                    <button title="{{lang.phrases.send_test_mes}}" onclick="checkReceiver({{slack.id}}, 'slack')">{{lang.words.test|title()}}</button>
                </td>
                <td>
                    <a class="add" onclick="cloneReceiver({{slack.id}}, 'slack')" id="clone-{{slack.id}}" title="{{lang.words.w_copy|title()}} {{lang.words.the}} {{lang.words.settings}} {{slack.chanel_name}}" style="cursor: pointer;"></a>
                </td>
                <td>
                    <a class="delete" onclick="confirmDeleteReceiver({{slack.id}}, 'slack')" title="{{lang.words.delete|title()}} {{lang.words.channel}} {{slack.chanel_name}}" style="cursor: pointer;"></a>
                </td>
            </tr>
            {% endfor %}
        </table>
        <br /><span class="add-button" title="{{lang.words.add|title()}} Slack {{lang.words.channel|title()}}" id="add-slack-button">+ {{lang.words.add|title()}}</span>
        <br /><br />
        <table id="checker_pd_table" class="overview-overflow">
            <caption><i class="fas fa-pager caption-icon"></i><h3>PagerDuty {{lang.words.channels|title()}}</h3></caption>
            <tr class="overviewHead" style="width: 50%;">
                <td class="padding10 first-collumn" style="width: 25%;">
                    {{lang.words.key|title()}}
                </td>
                <td style="width: 20%;">{{lang.words.name|title()}}</td>
                {% if role|int() == 1 %}
                <td style="width: 25%;">{{lang.words.group|title()}}</td>
                {% endif %}
                <td style="width: 100%;"></td>
                <td></td>
                <td><span onclick="loadchecker()" class="refresh" title="{{lang.words.refresh2|title()}} Slack {{lang.words.channels}}"></span></td>
            </tr>
            {% for pd in pds %}
            <tr id="pd-table-{{pd.id}}" class="{{ loop.cycle('odd', 'even') }}">
                <td class="padding10 first-collumn">
                    {% set id = 'pd-token-' + pd.id|string() %}
                    {{ input(id, value=pd.token, size='30') }}
                </td>
                <td>
                    {% set id = 'pd-chanel-' + pd.id|string() %}
                    {{ input(id, value=pd.chanel_name, size='30') }}
                </td>
                {% if role|int() == 1 %}
                <td>
                    <select id="pdgroup-{{pd.id}}" name="pdgroup-{{pd.id}}">
                        <option disabled selected>------</option>
                        {% for group in groups %}
                        {% if pd.groups|string() == group.group_id|string() %}
                        <option value="{{ group.group_id }}" selected>{{ group.name }}</option>
                        {% else %}
                        <option value="{{ group.group_id }}">{{ group.name }}</option>
                        {% endif %}
                        {% endfor %}
                    </select>
                </td>
                {% endif %}
                <td>
                    <button title="{{lang.phrases.send_test_mes}}" onclick="checkReceiver({{pd.id}}, 'pd')">{{lang.words.test|title()}}</button>
                </td>
                <td>
                    <a class="add" onclick="cloneReceiver({{pd.id}}, 'pd')" id="clone-{{pd.id}}" title="{{lang.words.w_copy|title()}} {{lang.words.the}} {{lang.words.settings}} {{pd.chanel_name}}" style="cursor: pointer;"></a>
                </td>
                <td>
                    <a class="delete" onclick="confirmDeleteReceiver({{pd.id}}, 'pd')" title="{{lang.words.delete|title()}} {{lang.words.channel}} {{pd.chanel_name}}" style="cursor: pointer;"></a>
                </td>
            </tr>
            {% endfor %}
        </table>
        <br /><span class="add-button" title="{{lang.words.add|title()}} PagerDuty {{lang.words.channel|title()}}" id="add-pd-button">+ {{lang.words.add|title()}}</span>
        <br /><br />
        <table class="overflow">
            <caption><i class="fas fa-envelope-open-text caption-icon"></i><h3>{{lang.words.test2|title()}} {{lang.words.message}}</h3></caption>
            <tr class="overviewHead">
                <td class="padding10 first-collumn" style="width: 45%">{{lang.words.email|title()}}</td>
                <td style="width: 100%">{{lang.words.web_panel|title()}}</td>
            </tr>
            <tr>
                <td class="padding10 first-collumn">
                    <button title="{{lang.phrases.send_test_mes}} {{lang.words.via}} {{lang.words.email}}" onclick="checkEmail()">{{lang.words.test|title()}}</button>
                </td>
                <td>
                    <button title="{{lang.phrases.send_test_mes}} {{lang.words.via}} {{lang.words.web_panel}}" onclick="checkWebPanel()">{{lang.words.test|title()}}</button>
                </td>
            </tr>
        </table>
        <br /><br />
        <div id="ajax-telegram"></div>
        <div class="add-note alert addName alert-info" style="width: inherit; margin-right: 15px;">
            {{lang.phrases.read_about_parameters}} <a href="https://roxy-wi.org/description/checker" title="Servers description" target="_blank">{{lang.words.here}}</a>,
            <a href="https://roxy-wi.org/howto/create-telegram-bot" title="How to create Telegram bot and use it with Roxy-WI" target="_blank">{{lang.phrases.howto_user}} Telegram bot</a>,
            <a href="https://roxy-wi.org/howto/create-slack-app" title="How to create Slack APP and use it with Roxy-WI" target="_blank">{{lang.phrases.howto_user}} Slack APP</a>,
            <a href="https://roxy-wi.org/howto/create-pd-integration" title="How to create PagerDuty integration and use it with Roxy-WI" target="_blank">{{lang.phrases.howto_user}} PagerDuty</a>.
        </div>
    </div>
    <div id="checker_settings">
        <table class="overview-overflow checker_settings_table" id="checker_haproxy_table">
            <caption><i class="fas fa-network-wired caption-icon"></i><h3>HAProxy {{lang.words.servers}}</h3></caption>
            <tr class="overviewHead">
                <td class="padding10 first-collumn">{{lang.words.server|title()}}</td>
                <td class="first-collumn" title="{{lang.words.alert|title()}} {{lang.words.via}} Telegram" style="width: 15%;">Telegram</td>
                <td class="first-collumn" title="{{lang.words.alert|title()}} {{lang.words.via}} Slack" style="width: 15%;">Slack</td>
                <td class="first-collumn" title="{{lang.words.alert|title()}} {{lang.words.via}} PagerDuty" style="width: 15%;">PagerDuty</td>
                <td class="checkbox-head" style="width: 10%;" title="{{lang.words.alert|title()}} {{lang.words.via}} {{lang.words.email}}">{{lang.words.email|title()}}</td>
                <td class="checkbox-head" style="width: 10%;" title="{{lang.phrases.alert_service_change_status}}">{{lang.words.service|title()}}</td>
                <td class="checkbox-head" style="width: 10%;" title="{{lang.phrases.alert_backend_change_status}}">{{lang.words.backend|title()}}</td>
                <td class="checkbox-head" style="width: 100%;" title="{{lang.phrases.alert_number_conn}}">Maxconn</td>
                <td><span onclick="loadchecker(1)" class="refresh" title="{{lang.words.refresh2|title()}}"></span></td>
            </tr>
            {% for s in haproxy_servers %}
            {% for h in haproxy_settings %}
            {% if h.server_id|string() == s.0|string() and h.service_id == 1 %}
            <tr id="haproxy_server_tr_id-{{h.id}}">
                <td class="padding10 first-collumn" id="haproxy_server_name-{{h.id}}">{{s.1}}</td>
                <td id="haproxy_server_telegram-{{h.id}}" title="{{lang.words.alert|title()}} {{lang.words.via}} {{lang.words.this3}} {{lang.words.channel}}">
                    <select id="haproxy_server_telegram_channel-{{h.id}}">
                        <option value="0">{{lang.words.disabled|title()}}</option>
                    {% for t in telegrams %}
                         {% if h.telegram_id|int() == t.id|int() %}
                            <option value="{{t.id}}" selected>{{t.chanel_name}}</option>
                        {% else %}
                            <option value="{{t.id}}">{{t.chanel_name}}</option>
                        {% endif %}
                    {% endfor %}
                    </select>
                </td>
                <td id="haproxy_server_slack-{{s.0}}" title="{{lang.words.alert|title()}} {{lang.words.via}} {{lang.words.this3}} {{lang.words.channel}}">
                    <select id="haproxy_server_slack_channel-{{h.id}}">
                        <option value="0">{{lang.words.disabled|title()}}</option>
                    {% for t in slacks %}
                        {% if h.slack_id|int() == t.id|int() %}
                            <option value="{{t.id}}" selected>{{t.chanel_name}}</option>
                        {% else %}
                            <option value="{{t.id}}">{{t.chanel_name}}</option>
                        {% endif %}
                    {% endfor %}
                    </select>
                </td>
                <td id="haproxy_server_pd-{{s.0}}" title="{{lang.words.alert|title()}} {{lang.words.via}} {{lang.words.this3}} {{lang.words.channel}}">
                    <select id="haproxy_server_pd_channel-{{h.id}}">
                        <option value="0">{{lang.words.disabled|title()}}</option>
                    {% for t in pds %}
                        {% if h.pd_id|int() == t.id|int() %}
                            <option value="{{t.id}}" selected>{{t.chanel_name}}</option>
                        {% else %}
                            <option value="{{t.id}}">{{t.chanel_name}}</option>
                        {% endif %}
                    {% endfor %}
                    </select>
                </td>
                <td class="checkbox" title="{{lang.words.alert|title()}} {{lang.words.via}} {{lang.words.email}}">
                    {% set id = 'haproxy_server_email-' + h.id|string() %}
                    {% if h.email == 1 %}
                        {{ checkbox(id, checked='checked') }}
                    {% else %}
                        {{ checkbox(id) }}
                    {% endif %}
                </td>
                <td class="checkbox">
                    {% set id = 'haproxy_server_status-' + h.id|string() %}
                    {% if h.service_alert == 1 %}
                        {{ checkbox(id, checked='checked', title=lang.phrases.alert_service_change_status) }}
                    {% else %}
                        {{ checkbox(id, title=lang.phrases.alert_service_change_status) }}
                    {% endif %}
                </td>
                <td class="checkbox">
                    {% set id = 'haproxy_server_backend-' + h.id|string() %}
                    {% if h.backend_alert == 1 %}
                        {{ checkbox(id, checked='checked', title=lang.phrases.alert_backend_change_status) }}
                    {% else %}
                        {{ checkbox(id, title=lang.phrases.alert_backend_change_status) }}
                    {% endif %}
                </td>
                <td class="checkbox">
                    {% set id = 'haproxy_server_maxconn-' + h.id|string() %}
                    {% if h.maxconn_alert == 1 %}
                        {{ checkbox(id, checked='checked', title=lang.phrases.alert_number_conn) }}
                    {% else %}
                        {{ checkbox(id, title=lang.phrases.alert_number_conn) }}
                    {% endif %}
                </td>
                <td></td>
            </tr>
            {% endif %}
            {% endfor %}
            {% endfor %}
        </table>
        <table class="overview-overflow checker_settings_table" id="checker_nginx_table">
            <caption><i class="fas fa-sitemap caption-icon"></i><h3>NGINX {{lang.words.servers}}</h3></caption>
            <tr class="overviewHead">
                <td class="padding10 first-collumn">{{lang.words.server|title()}}</td>
                <td class="first-collumn" title="{{lang.words.alert|title()}} {{lang.words.via}} Telegram" style="width: 15%;">Telegram</td>
                <td class="first-collumn" title="{{lang.words.alert|title()}} {{lang.words.via}} Slack" style="width: 15%;">Slack</td>
                <td class="first-collumn" title="{{lang.words.alert|title()}} {{lang.words.via}} PagerDuty" style="width: 15%;">PagerDuty</td>
                <td class="checkbox-head" style="width: 10%;" title="{{lang.words.alert|title()}} {{lang.words.via}} {{lang.words.email}}">{{lang.words.email|title()}}</td>
                <td class="checkbox-head" style="width: 100%;" title={{lang.phrases.alert_service_change_status}}>{{lang.words.service|title()}}</td>
                <td><span onclick="loadchecker(1)" class="refresh" title="{{lang.words.refresh2|title()}}"></span></td>
            </tr>
            {% for s in nginx_servers %}
            {% for h in nginx_settings %}
            {% if h.server_id|string() == s.0|string() and h.service_id == 2 %}
            <tr id="nginx_server_tr_id-{{h.id}}">
                <td class="padding10 first-collumn" id="nginx_server_name-{{h.id}}">{{s.1}}</td>
                <td id="nginx_server_telegram-{{h.id}}" title="{{lang.words.alert|title()}} {{lang.words.via}} {{lang.words.this3}} {{lang.words.channel}}">
                    <select id="nginx_server_telegram_channel-{{h.id}}">
                        <option value="0">Disabled</option>
                    {% for t in telegrams %}
                         {% if h.telegram_id|int() == t.id|int() %}
                            <option value="{{t.id}}" selected>{{t.chanel_name}}</option>
                        {% else %}
                            <option value="{{t.id}}">{{t.chanel_name}}</option>
                        {% endif %}
                    {% endfor %}
                    </select>
                </td>
                <td id="nginx_server_slack-{{h.id}}" title="{{lang.words.alert|title()}} {{lang.words.via}} {{lang.words.this3}} {{lang.words.channel}}">
                    <select id="nginx_server_slack_channel-{{h.id}}">
                        <option value="0">{{lang.words.disabled|title()}}</option>
                    {% for t in slacks %}
                        {% if h.slack_id|int() == t.id|int() %}
                            <option value="{{t.id}}" selected>{{t.chanel_name}}</option>
                        {% else %}
                            <option value="{{t.id}}">{{t.chanel_name}}</option>
                        {% endif %}
                    {% endfor %}
                    </select>
                </td>
                <td id="nginx_server_pd-{{h.id}}" title="{{lang.words.alert|title()}} {{lang.words.via}} {{lang.words.this3}} {{lang.words.channel}}">
                    <select id="nginx_server_pd_channel-{{h.id}}">
                        <option value="0">{{lang.words.disabled|title()}}</option>
                    {% for t in pds %}
                        {% if h.pd_id|int() == t.id|int() %}
                            <option value="{{t.id}}" selected>{{t.chanel_name}}</option>
                        {% else %}
                            <option value="{{t.id}}">{{t.chanel_name}}</option>
                        {% endif %}
                    {% endfor %}
                    </select>
                </td>
                <td class="checkbox">
                    {% set id = 'nginx_server_email-' + h.id|string() %}
                    {% if h.email == 1 %}
                        {{ checkbox(id, checked='checked', title=lang.words.alert|title()+' '+lang.words.via + ' '+lang.words.email) }}
                    {% else %}
                        {{ checkbox(id, title=lang.words.alert|title()+' '+lang.words.via + ' '+lang.words.email) }}
                    {% endif %}
                </td>
                <td class="checkbox">
                    {% set id = 'nginx_server_status-' + h.id|string() %}
                    {% if h.service_alert == 1 %}
                        {{ checkbox(id, checked='checked', title=lang.phrases.alert_service_change_status) }}
                    {% else %}
                        {{ checkbox(id, title=lang.phrases.alert_service_change_status) }}
                    {% endif %}
                </td>
                <td></td>
            </tr>
            {% endif %}
            {% endfor %}
            {% endfor %}
        </table>
        <table class="overview-overflow checker_settings_table" id="checker_apache_table">
            <caption><i class="fas fa-feather-alt caption-icon"></i><h3>Apache {{lang.words.servers}}</h3></caption>
            <tr class="overviewHead">
                <td class="padding10 first-collumn">{{lang.words.server|title()}}</td>
                <td class="first-collumn" title="{{lang.words.alert|title()}} {{lang.words.via}} Telegram" style="width: 15%;">Telegram</td>
                <td class="first-collumn" title="{{lang.words.alert|title()}} {{lang.words.via}} Slack" style="width: 15%;">Slack</td>
                <td class="first-collumn" title="{{lang.words.alert|title()}} {{lang.words.via}} PagerDuty" style="width: 15%;">PagerDuty</td>
                <td class="checkbox-head" style="width: 10%;">{{lang.words.email|title()}}</td>
                <td class="checkbox-head" style="width: 100%;" title="{{lang.phrases.alert_service_change_status}}">{{lang.words.service|title()}}</td>
                <td><span onclick="loadchecker(1)" class="refresh" title="{{lang.words.refresh2|title()}}"></span></td>
            </tr>
            {% for s in apache_servers %}
            {% for h in apache_settings %}
            {% if h.server_id|string() == s.0|string() and h.service_id == 4 %}
            <tr id="apache_server_tr_id-{{h.id}}">
                <td class="padding10 first-collumn" id="apache_server_name-{{h.id}}">{{s.1}}</td>
                <td id="apache_server_telegram-{{h.id}}" title="{{lang.words.alert|title()}} {{lang.words.via}} {{lang.words.this3}} {{lang.words.channel}}">
                    <select id="apache_server_telegram_channel-{{h.id}}">
                        <option value="0">{{lang.words.disabled|title()}}</option>
                    {% for t in telegrams %}
                         {% if h.telegram_id|int() == t.id|int() %}
                            <option value="{{t.id}}" selected>{{t.chanel_name}}</option>
                        {% else %}
                            <option value="{{t.id}}">{{t.chanel_name}}</option>
                        {% endif %}
                    {% endfor %}
                    </select>
                </td>
                <td id="apache_server_slack-{{h.id}}" title="{{lang.words.alert|title()}} {{lang.words.via}} {{lang.words.this3}} {{lang.words.channel}}">
                    <select id="apache_server_slack_channel-{{h.id}}">
                        <option value="0">{{lang.words.disabled|title()}}</option>
                    {% for t in slacks %}
                        {% if h.slack_id|int() == t.id|int() %}
                            <option value="{{t.id}}" selected>{{t.chanel_name}}</option>
                        {% else %}
                            <option value="{{t.id}}">{{t.chanel_name}}</option>
                        {% endif %}
                    {% endfor %}
                    </select>
                </td>
                <td id="apache_server_pd-{{h.id}}" title="{{lang.words.alert|title()}} {{lang.words.via}} {{lang.words.this3}} {{lang.words.channel}}">
                    <select id="apache_server_pd_channel-{{h.id}}">
                        <option value="0">{{lang.words.disabled|title()}}</option>
                    {% for t in pds %}
                        {% if h.pd_id|int() == t.id|int() %}
                            <option value="{{t.id}}" selected>{{t.chanel_name}}</option>
                        {% else %}
                            <option value="{{t.id}}">{{t.chanel_name}}</option>
                        {% endif %}
                    {% endfor %}
                    </select>
                </td>
                <td class="checkbox">
                    {% set id = 'apache_server_email-' + h.id|string() %}
                    {% if h.email == 1 %}
                        {{ checkbox(id, checked='checked', title=lang.words.alert|title()+' '+lang.words.via + ' '+lang.words.email) }}
                    {% else %}
                        {{ checkbox(id, title=lang.words.alert|title()+' '+lang.words.via + ' '+lang.words.email) }}
                    {% endif %}
                </td>
                <td class="checkbox">
                    {% set id = 'apache_server_status-' + h.id|string() %}
                    {% if h.service_alert == 1 %}
                        {{ checkbox(id, checked='checked', title=lang.phrases.alert_service_change_status) }}
                    {% else %}
                        {{ checkbox(id, title=lang.phrases.alert_service_change_status) }}
                    {% endif %}
                </td>
                <td></td>
            </tr>
            {% endif %}
            {% endfor %}
            {% endfor %}
        </table>
        <table class="overview-overflow checker_settings_table" id="checker_keepalived_table">
            <caption><i class="fas fa-cloud caption-icon"></i><h3>Keepalived {{lang.words.servers}}</h3></caption>
            <tr class="overviewHead">
                <td class="padding10 first-collumn">{{lang.words.server|title()}}</td>
                <td class="first-collumn" title="{{lang.words.alert|title()}} {{lang.words.via}} Telegram" style="width: 15%;">Telegram</td>
                <td class="first-collumn" title="{{lang.words.alert|title()}} {{lang.words.via}} Slack" style="width: 15%;">Slack</td>
                <td class="first-collumn" title="{{lang.words.alert|title()}} {{lang.words.via}} PagerDuty" style="width: 15%;">PagerDuty</td>
                <td class="checkbox-head" style="width: 10%;">{{lang.words.email|title()}}</td>
                <td class="checkbox-head" style="width: 10%;" title="{{lang.phrases.alert_service_change_status}}">{{lang.words.service|title()}}</td>
                <td class="checkbox-head" style="width: 100%;" title="{{lang.phrases.alert_master_backup}}">{{lang.words.status|title()}}</td>
                <td><span onclick="loadchecker(1)" class="refresh" title="{{lang.words.refresh2|title()}}"></span></td>
            </tr>
            {% for s in keepalived_servers %}
            {% for h in keepalived_settings %}
            {% if h.server_id|string() == s.0|string() and h.service_id == 3 %}
            <tr id="keepalived_server_tr_id-{{h.id}}">
                <td class="padding10 first-collumn" id="keepalived_server_name-{{h.id}}">{{s.1}}</td>
                <td id="keepalived_server_telegram-{{h.id}}" title="{{lang.words.alert|title()}} {{lang.words.via}} {{lang.words.this3}} {{lang.words.channel}}">
                    <select id="keepalived_server_telegram_channel-{{h.id}}">
                        <option value="0">{{lang.words.disabled|title()}}</option>
                    {% for t in telegrams %}
                         {% if h.telegram_id|int() == t.id|int() %}
                            <option value="{{t.id}}" selected>{{t.chanel_name}}</option>
                        {% else %}
                            <option value="{{t.id}}">{{t.chanel_name}}</option>
                        {% endif %}
                    {% endfor %}
                    </select>
                </td>
                <td id="keepalived_server_slack-{{h.id}}" title="{{lang.words.alert|title()}} {{lang.words.via}} {{lang.words.this3}} {{lang.words.channel}}">
                    <select id="keepalived_server_slack_channel-{{h.id}}">
                        <option value="0">{{lang.words.disabled|title()}}</option>
                    {% for t in slacks %}
                        {% if h.slack_id|int() == t.id|int() %}
                            <option value="{{t.id}}" selected>{{t.chanel_name}}</option>
                        {% else %}
                            <option value="{{t.id}}">{{t.chanel_name}}</option>
                        {% endif %}
                    {% endfor %}
                    </select>
                </td>
                <td id="keepalived_server_pd-{{h.id}}" title="{{lang.words.alert|title()}} {{lang.words.via}} {{lang.words.this3}} {{lang.words.channel}}">
                    <select id="keepalived_server_pd_channel-{{h.id}}">
                        <option value="0">{{lang.words.disabled|title()}}</option>
                    {% for t in pds %}
                        {% if h.pd_id|int() == t.id|int() %}
                            <option value="{{t.id}}" selected>{{t.chanel_name}}</option>
                        {% else %}
                            <option value="{{t.id}}">{{t.chanel_name}}</option>
                        {% endif %}
                    {% endfor %}
                    </select>
                </td>
                <td class="checkbox">
                    {% set id = 'keepalived_server_email-' + h.id|string() %}
                    {% if h.email == 1 %}
                        {{ checkbox(id, checked='checked', title=lang.words.alert|title()+' '+lang.words.via + ' '+lang.words.email) }}
                    {% else %}
                        {{ checkbox(id, title=lang.words.alert|title()+' '+lang.words.via + ' '+lang.words.email) }}
                    {% endif %}
                </td>
                <td class="checkbox">
                    {% set id = 'keepalived_server_status-' + h.id|string() %}
                    {% if h.service_alert == 1 %}
                        {{ checkbox(id, checked='checked', title=lang.phrases.alert_service_change_status) }}
                    {% else %}
                        {{ checkbox(id, title=lang.phrases.alert_service_change_status) }}
                    {% endif %}
                </td>
                <td class="checkbox">
                    {% set id = 'keepalived_server_backend-' + h.id|string() %}
                    {% if h.backend_alert == 1 %}
                        {{ checkbox(id, checked='checked', title=lang.phrases.alert_master_backup) }}
                    {% else %}
                        {{ checkbox(id, title=lang.phrases.alert_master_backup) }}
                    {% endif %}
                </td>
                <td></td>
            </tr>
            {% endif %}
            {% endfor %}
            {% endfor %}
        </table>
    </div>
</div>
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
{% include 'include/admins_dialogs.html' %}
