[% 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 %]
<div class="mb-5"[% IF hidetop == 1 %] style="visibility:hidden; display:none;"[% END %]>
  [% PROCESS _infobox.tt %]
</div>

<form action="status.cgi" method="GET" id="[% paneprefix %]filterForm" onsubmit="return(remove_empty_form_params(this))">
  [%# make sure IE can submit form by pressing enter #%]
  <input type="submit" style="position: absolute; left: -9999px; width: 1px; height: 1px;"/>
  <input type="hidden" name="style" value="[% style | html %]">
  <input type="hidden" name="nav" value="[% show_nav | html %]">
  [% IF entries %]<input type="hidden" name="entries" value="[% entries | html %]">[% END %]
  <input type="hidden" name="hidetop" id="hidetop" value="[% hidetop | html %]">
  <input type="hidden" name="title" id="title" value="[% custom_title | html %]">

  [% UNLESS minimal %]
    <h1>
      [% IF custom_title != '' %][% custom_title | html %]
      [% ELSE %]Host and Service Details
      [% END %]
    </h1>

    <div class="flexrow sm:flex-nowrap my-2 gap-y-1">
      <div class="flex basis-1/3 self-end gap-1">
        [% PROCESS _add_bookmark.tt style='combined' %]
        [% PROCESS _show_link.tt    style='combined' %]
        [% PROCESS _json_export.tt %]
        [% hostcolumns=[ 'Hostname', 'Displayname:0', 'IP', 'Status', 'Alias:0', 'Parents:0', 'Groups:0', 'Acknowledged', 'Downtime', 'Notifications', 'Active Checks', 'Flapping', 'Last Check', 'Contacts', 'Duration', 'Status Information', 'Extra Status Information' ] %]
        [% servicecolumns=[ 'Hostname', 'Hostdisplayname:0', 'IP', 'Host Alias:0', 'Host Parents:0', 'Host Groups:0', 'Host Acknowledged', 'Host Downtime', 'Host Notifications', 'Host Active Checks', 'Host Flapping', 'Service', 'Displayname:0', 'Status', 'Last Check', 'Contacts', 'Duration', 'Attempt', 'Acknowledged', 'Downtime', 'Notifications', 'Active Checks', 'Flapping', 'Status Information', 'Extra Status Information' ] %]
        [% IF show_backends_in_table != 0 %][% hostcolumns.push('Site'); servicecolumns.push('Site') %][% END %]
        [% PROCESS _excel_export.tt hostcolumns=hostcolumns servicecolumns=servicecolumns columns='' with_custom_vars=1 prefix='' %]
      </div>
      <div class="basis-1/3">
        [% UNLESS authorized_for_read_only %]
        <div class="hint flex gap-x-0.5 justify-center">
          <button class="min-w-[100px]" onclick="pagetype='hostdetail';selectAllHosts(true,'hst_');return false;">Hosts</button>
          <button class="min-w-[100px]" onclick="pagetype='hostdetail';selectAllHosts(false,'hst_');selectHostsByClass(['.DOWN','.UNREACHABLE']);return false;">Problems</button>
          <button class="min-w-[100px]" onclick="pagetype='hostdetail';selectAllHosts(false,'hst_');selectHostsByClass(['.has_downtime']);return false;">In Downtime</button>
          <button class="min-w-[100px]" onclick="pagetype='hostdetail';selectAllHosts(false,'hst_');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 class="card w-full min-w-[420px] mb-5">
    <div class="mainTableHeader">
      <div>
        <div class="flex flex-nowrap gap-x-1 items-center">
          [% PROCESS _status_column_select.tt colprefix="ovr" columns_name="overview" paneprefix='hst_' show_form=0 %]
          [% PROCESS _status_filter.tt style='hostdetail' substyle='host' paneprefix='hst_' show_form=0 %]
        </div>
      </div>
      <div></div>
    </div>
    <div class="mainTable [% IF main_table_full %]fullsize[% END %]">
      [% PROCESS _status_hostdetail_table.tt data=hosts paneprefix='hst_' sortprefix='_hst' %]
    </div>

    <div class="mainTableFooter">
      <div class="textPager font-medium leading-7 whitespace-nowrap">
        [% IF hosts_limit_hit %]
          <a href="[% uri_with(c, 'show_all_hosts' => '1' ) %]"><span class="textALERT">Limit of [% hosts.size %] matching hosts reached, click to show all.</span></a>
        [% ELSE %]
          [% hosts.size %] of [% hosts.size %] Matching Host Entries Displayed
        [% END %]
      </div>
    </div>
  </div>


  [% UNLESS minimal %]
    <div class="flexrow sm:flex-nowrap my-2 gap-y-1">
      <div class="basis-1/3 hidden sm:flex"></div>
      <div class="basis-1/3">
        [% UNLESS authorized_for_read_only %]
          <div class="hint flex gap-x-0.5 justify-center">
            <button class="sm:min-w-[100px]" onclick="pagetype='servicedetail';selectAllHosts(true,'svc_');return false;">Hosts</button>
            <button class="sm:min-w-[100px]" onclick="pagetype='servicedetail';selectAllServices(true,'svc_');return false;">Services</button>
            <button class="sm:min-w-[100px]" onclick="pagetype='servicedetail';selectAllHosts(false,'svc_');selectAllServices(false,'svc_');selectServicesByClass(['.CRITICAL','.WARNING','.UNKNOWN']);return false;">Problems</button>
            <button class="sm:min-w-[100px]" onclick="pagetype='servicedetail';selectAllHosts(false,'svc_');selectAllServices(false,'svc_');selectHostsByClass(['.has_downtime']);selectServicesByClass(['.has_downtime']);return false;">In Downtime</button>
            <button class="sm:min-w-[100px]" onclick="pagetype='servicedetail';selectAllHosts(false,'svc_');selectAllServices(false,'svc_');;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_svc', 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_svc">
          <div class="head justify-between">
            <h3>Info</h3>
            <button class="iconOnly medium" onclick="toggleElement('show_table_info_svc'); return false;"><i class="uil uil-times"></i></button>
          </div>
          <div class="body">
            <div class="whitespace-nowrap">You can select hosts / services with leftclick to send multiple commands.</div>
            <div class="whitespace-nowrap">Select multiple by holding shift + leftclick</div>
          </div>
        </div>
      </div>
    </div>
  [% END %]

  <div class="card w-full min-w-[420px]">
    <div class="mainTableHeader">
      <div>
        <div class="flex flex-nowrap gap-x-1 items-center">
          [% PROCESS _status_column_select.tt colprefix="ovr" columns_name="overview" paneprefix='svc_' show_form=0 %]
          [% PROCESS _status_filter.tt style='detail' substyle='service' paneprefix='svc_' show_form=0 %]
        </div>
      </div>
      <div></div>
    </div>
    <div class="mainTable [% IF main_table_full %]fullsize[% END %]">
      [% PROCESS _status_detail_table.tt  data=services paneprefix='svc_' sortprefix='_svc' %]
    </div>

    <div class="mainTableFooter">
      <div class="textPager font-medium leading-7 whitespace-nowrap">
        [% IF services_limit_hit %]
        <a href="[% uri_with(c, 'show_all_services' => '1' ) %]"><span class="alerttext">Limit of [% services.size %] matching services reached, click to show all.</span></a>
        [% ELSE %]
          [% services.size %] of [% services.size %] Matching Service Entries Displayed
        [% END %]
      </div>
    </div>
  </div>
</form>

[% UNLESS authorized_for_read_only %]
<script>
<!--
  var hst_Hash = [% get_cmd_submit_hash(hosts, 'hst') %];
  var svc_Hash = [% get_cmd_submit_hash(services, 'svc') %];
  start_hide_activity_icons_timer();
-->
</script>
[% END %]


[% PROCESS _footer.tt %]
