{#
    (C) 2020 - ntop.org

    This is the template for the endpoints page.
#}

<div class="row mb-5">
    <div class="col-md-12">
        <div class="card card-shadow">
            <div class="card-body">
                <div class="table-responsive">
                    <table class="table w-100 table-bordered table-striped table-hover my-3" id="notification-list">
                        <thead>
                            <tr>
                                <th>{{ i18n('endpoint_notifications.name') }}</th>
                                <th>{{ i18n('endpoint_notifications.type') }}</th>
                                <th>{{ i18n('endpoint_notifications.used_by_recipients') }}</th>
                                <th>{{ i18n('actions') }}</th>
                            </tr>
                        </thead>
                    </table>
                </div>
            </div>
            <div class="card-footer">
                {* ui_utils.render_configuration_footer('notifications') *}
            </div>
        </div>
    </div>
</div>

{% for endpoint_key, endpoint in pairsByKeys(notifications.endpoints, asc) do %}
    <template id="{{ endpoint_key }}-template">
        {* plugins_utils.renderTemplate(endpoint.conf_template.plugin_key, endpoint.conf_template.template_name) *}
    </template>
{% end %}

{* template_utils.gen("pages/modals/endpoint_notifications/add.template", notifications) *}
{* template_utils.gen("pages/modals/endpoint_notifications/remove.template", notifications) *}
{* template_utils.gen("pages/modals/endpoint_notifications/edit.template", notifications) *}
{* template_utils.gen("pages/modals/factory-reset.template", {
    body = i18n("endpoint_notifications.factory_reset.body", { reset_element = i18n("endpoint_notifications.endpoint_list") }),
    title = i18n("endpoint_notifications.factory_reset.title", { reset_element = i18n("endpoint_notifications.endpoint_list") })
}) *}

<link href="{{ ntop.getHttpPrefix() }}/datatables/datatables.min.css" rel="stylesheet"/>
<script type="text/javascript">

    let csrf = "{{ ntop.getRandomCSRFValue() }}";
    const endpointTypeFilters = {* json.encode(notifications.filters.endpoint_types) *};

    i18n.warning ="{{ i18n('warning', {}) }}";
    i18n.showing_x_to_y_rows = "{{ i18n('showing_x_to_y_rows', {x='_START_', y='_END_', tot='_TOTAL_'}) }}";
    i18n.search = "{{ i18n('search') }}";
    i18n.edit = "{{ i18n('edit') }}";
    i18n.remove = "{{ i18n('remove') }}";
    i18n.all = "{{ i18n('all') }}";
    i18n.timed_out = "{{ i18n('endpoint_notifications.timed_out') }}";
    i18n.server_error = "{{ i18n('endpoint_notifications.server_error') }}";
    i18n.endpoint_config_already_existing = "{{ i18n('endpoint_notifications.endpoint_config_already_existing') }}";
    i18n.endpoint_type = "{{ i18n('endpoint_notifications.type') }}";
    i18n.endpoint_types = {* json.encode(notifications.endpoint_types_labels) *};

    const endpoints_info = {* json.encode(notifications.endpoints_info) *};

    // freeze the endpoints info
    Object.freeze(endpoints_info);

</script>
<script type="text/javascript" src="{{ ntop.getHttpPrefix() }}/js/pages/endpoint-notifications-list.js"></script>
