[% USE date %]
[% PROCESS _header.tt %]
[% PROCESS _message.tt %]
[% PROCESS _sounds.tt %]
[% authorized_for_read_only = 0 %][% IF c.check_user_roles('authorized_for_read_only') %][% authorized_for_read_only = 1 %][% END %]

[% PROCESS _status_cmd_pane.tt %]
[% UNLESS minimal %]

  [% IF explore %]
    [% PROCESS _status_explore.tt %]
  [% END %]
  [% IF !explore %]
    [% WRAPPER _status_totals_header.tt %]
      <div class="card overflow-hidden">
        <div class="actionbox less-padding">
          [% IF hostgroup == 'all' %]
            <div><a href='status.cgi?hostgroup=all&amp;style=detail'>View Service Status Detail For All Host Groups</a></div>
            <div><a href='status.cgi?hostgroup=all&amp;style=overview'>View Status Overview For All Host Groups</a></div>
            <div><a href='status.cgi?hostgroup=all&amp;style=summary'>View Status Summary For All Host Groups</a></div>
            <div><a href='status.cgi?hostgroup=all&amp;style=grid'>View Status Grid For All Host Groups</a></div>
          [% ELSIF hostgroup != '' %]
            <div><a href="status.cgi?hostgroup=all&amp;style=hostdetail">View Host Status Detail For All Host Groups</a></div>
            <div><a href="status.cgi?hostgroup=[% hostgroup | uri %]&amp;style=detail">View Service Status Detail For This Host Group</a></div>
            <div><a href="status.cgi?hostgroup=[% hostgroup | uri %]&amp;style=overview">View Status Overview For This Host Group</a></div>
            <div><a href="status.cgi?hostgroup=[% hostgroup | uri %]&amp;style=summary">View Status Summary For This Host Group</a></div>
            <div><a href="status.cgi?hostgroup=[% hostgroup | uri %]&amp;style=grid">View Status Grid For This Host Group</a></div>
          [% ELSE %]
            <div><a href='status.cgi?hostgroup=all&amp;style=detail'>View Service Status Detail For All Host Groups</a></div>
            <div><a href='status.cgi?hostgroup=all&amp;style=overview'>View Status Overview For All Host Groups</a></div>
            <div><a href='status.cgi?hostgroup=all&amp;style=summary'>View Status Summary For All Host Groups</a></div>
            <div><a href='status.cgi?hostgroup=all&amp;style=grid'>View Status Grid For All Host Groups</a></div>
          [% END %]
        </div>
      </div>
    [% END %]
  [% END %]

  [% IF !explore %]
  <h1 class="mt-2">
    [% IF custom_title != '' %][% custom_title %]
    [% ELSIF hostgroup == 'all' %]Host Status Details For All Host Groups
    [% ELSIF hostgroup != '' %]Host Status Details For Host Group '[% hostgroup | html %]'
    [% ELSE %]Host Status Details
    [% END %]
  </h1>
  [% END %]

  <div class="flexrow sm:flex-nowrap my-2 gap-y-1">
    <div class="flex basis-1/3 self-end gap-1">
      <div class="flex place-items-end gap-1">
        [% PROCESS _add_bookmark.tt %]
        [% PROCESS _show_link.tt %]
        [% PROCESS _json_export.tt %]
        [% columns_excel=[ 'Site:0', 'Hostname', 'Displayname:0', 'IP', 'Alias:0', 'Parents:0', 'Groups:0', 'Status', 'Acknowledged', 'Downtime', 'Notifications', 'Active Checks', 'Flapping', 'Last Check', 'Contacts', 'Duration', 'Status Information', 'Extra Status Information:0', 'Comments:0' ] %]
        [% PROCESS _excel_export.tt columns=columns_excel with_custom_vars=1 prefix="status_hostdetail_excel_" %]
        [% columns_csv=[ 'address::0', 'alias::0', 'display_name::0', 'name:Hostname:1', 'hoststate(state):hoststate:1', 'parents::0', 'groups::0', 'acknowledged::0', 'downtimes::0', 'notifications_enabled::0', 'active_checks_enabled::0', 'is_flapping::0', 'utc(last_check):utc(last_check):0', 'duration::0', 'plugin_output::0', 'long_plugin_output::0', 'contacts::0', 'comments::0' ] %]
        [% PROCESS _csv_export.tt columns=columns_csv with_custom_vars=1 api_endpoint='csv/hosts' prefix="status_hostdetail_csv_" filter_text=csv_filter_text %]
        [% IF hostgroup != '' && hostgroup != 'all' %]
          <a class="button round small" href="extinfo.cgi?type=5&amp;hostgroup=[% hostgroup | uri %]" title="send hostgroup commands"><i class="uil uil-icons"></i></a>
        [% ELSIF servicegroup != '' && servicegroup != 'all' %]
          <a class="button round small" href="extinfo.cgi?type=8&amp;servicegroup=[% servicegroup | uri %]" title="send servicegroup commands"><i class="uil uil-icons"></i></a>
        [% END %]
      </div>
    </div>
    <div class="basis-1/3">
      [% UNLESS authorized_for_read_only %]
      <div class="hint flex gap-x-0.5 sm:justify-center">
        <button class="min-w-[100px]" onclick="selectAllHosts(true,'[% paneprefix %]');return false;">Hosts</button>
        <button class="min-w-[100px]" onclick="selectAllHosts(false,'[% paneprefix %]');selectHostsByClass(Array('.DOWN','.UNREACHABLE'));return false;">Problems</button>
        <button class="min-w-[100px]" onclick="selectAllHosts(false,'[% paneprefix %]');selectHostsByClass(Array('.has_downtime'));return false;">In Downtime</button>
        <button class="min-w-[100px]" onclick="selectAllHosts(false,'[% paneprefix %]');return false;">Unselect all</button>
      </div>
      [% END %]
    </div>
    <div class="basis-1/3 hidden sm:flex self-end justify-end relative">
      <button class="round small gray text-lg relative" onclick="toggleElement('show_table_info_hst', undefined, true); return false;" title="Toggle help">
        <i class="uil uil-info"></i>
      </button>
      <div class="card shadow-float absolute z-20 top-7" style="visibility: hidden;" id="show_table_info_hst">
        <div class="head justify-between">
          <h3>Info</h3>
          <button class="iconOnly medium" onclick="toggleElement('show_table_info_hst'); return false;"><i class="uil uil-times"></i></button>
        </div>
        <div class="body">
          <div class="whitespace-nowrap">You can select hosts with leftclick to send multiple commands.</div>
          <div class="whitespace-nowrap">Select multiple by holding shift + leftclick</div>
        </div>
      </div>
    </div>
  </div>
[% END %]

<div id="statusTableContainer" class="relative">
  <div class="card w-full min-w-[420px]" id="statusTableContent">
    <div class="mainTableHeader">
      <div>
        <div class="flex flex-nowrap gap-x-2 items-center">
          [% PROCESS _status_column_select.tt colprefix="hst" columns_name="host" %]
          [% IF ! explore %]
            [% PROCESS _status_filter.tt %]
          [% END %]
        </div>
      </div>
      <div>
        [% PROCESS _pager.tt %]
      </div>
      <div>
        [% PROCESS _pager_per_page.tt %]
      </div>
    </div>
    <div class="mainTable [% IF main_table_full %]fullsize[% END %]">
      [% PROCESS _status_hostdetail_table.tt %]
    </div>
    <div class="mainTableFooter">
      [% PROCESS _pager_total_items.tt %]
    </div>
  </div>
</div>

[% UNLESS authorized_for_read_only %]
<script>
<!--
  var dfl_Hash = [% get_cmd_submit_hash(data, 'hst') %];
  start_hide_activity_icons_timer();
-->
</script>
[% END %]

[% PROCESS _footer.tt %]
