{#
    (C) 2020 - ntop.org

    This is the template for the endpoint recipients page. If there are no endpoints
    configured yet then show an alert to the user.
#}

<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="recipient-list">
                        <thead>
                            <tr>
                                <th>{{ i18n('endpoint_notifications.recipient_name') }}</th>
                                <th>{{ i18n('endpoint_notifications.type') }}</th>
                                <th>{{ i18n('endpoint_notifications.associated_to_endpoints') }}</th>
                                <th>{{ i18n('endpoint_notifications.time_since_last_use') }}</th>
                                <th>{{ i18n('endpoint_notifications.num_uses') }}</th>
				<th>{{ i18n('endpoint_notifications.num_drops') }}</th>
                                <th>{{ i18n('actions') }}</th>
                            </tr>
                        </thead>
                    </table>
                </div>
            </div>
            <div class="card-footer">
                {* ui_utils.render_configuration_footer('notifications') *}
            </div>
        </div>
    </div>
</div>

{# Generate a template for each endpoint entry #}
{% for endpoint_key, endpoint in pairs(notifications.endpoints) do %}
    <template id="{{ endpoint_key }}-template">
        {* plugins_utils.renderTemplate(endpoint.recipient_template.plugin_key, endpoint.recipient_template.template_name) *}
    </template>
{% end %}

{* template_utils.gen("pages/modals/recipients_endpoint/add.template", notifications) *}
{* template_utils.gen("pages/modals/recipients_endpoint/remove.template", notifications) *}
{* template_utils.gen("pages/modals/recipients_endpoint/edit.template", notifications) *}
{* template_utils.gen("pages/modals/recipients_endpoint/users.template", notifications) *}

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

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

    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.empty_template = "{{ i18n('endpoint_notifications.empty_template') }}";
    i18n.createEndpointFirst = "{{ (#notifications.endpoint_list > 0 and '' or i18n('endpoint_notifications.create_endpoint_first')) }}";
    i18n.testing_recipient = "{{ i18n('endpoint_notifications.testing_recipient') }}";
    i18n.working_recipient = "{{ i18n('endpoint_notifications.working_recipient') }}";
    i18n.timed_out = "{{ i18n('endpoint_notifications.timed_out') }}";
    i18n.server_error = "{{ i18n('endpoint_notifications.server_error') }}";
    i18n.endpoint_recipient_already_existing = "{{ i18n('endpoint_notifications.endpoint_recipient_already_existing') }}";
    i18n.endpoint_type = "{{ i18n('endpoint_notifications.type') }}";
    i18n.endpoint_types = {* json.encode(notifications.endpoint_types_labels) *};
    i18n.pool_types = {* json.encode(i18n('pools.pool_name')) *};

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