{#
   (C) 2021-24 - ntop.org
   Template for alert details.
#}

{% if not alert then %}
   <div class="alert alert-danger">
      <i class="fas fa-exclamation-triangle fa-lg"></i> {{ i18n("alert_details.cannot_be_found_message") }} </div>
{% else %}

<table class="table table-bordered table-striped">
{% for _, row in ipairs(details) do
   local is_content_table = (type(row.content) == 'table')
   local rowspan = ""

   -- If the content is a table then use a rowspan
   if is_content_table then
      rowspan = table.len(row.content) + 1
   end
   %}
   <tr><th class="no-wrap" rowspan="{{ rowspan }}">{{ row.label }}</th>
{%   if not is_content_table then %}
     <td colspan="2">{* row.content *}</td>
{%   else
      for data, info in pairsByKeys(row.content, asc) do
        if not isEmptyString(info) then %}
          <tr>
            <th class="no-wrap">{{ i18n(data) or data }}</th>
            <td style="width: 100%">{* info *}</td>
          </tr>
{%      end
      end
    end %}
   </tr>
{% end %}
</table>

<script type='text/javascript'>
let pageCsrf = "{{ ntop.getRandomCSRFValue() }}";

$(document).ready(function(){
   const alert = {* json.encode(alert) *};
});
</script>

{% end %}
