[% PROCESS _header.tt %]
[% PROCESS _sounds.tt %]

  [% 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=hostdetail'>View Host 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=grid'>View Status Grid For All Host Groups</a></div>
        [% ELSIF hostgroup != '' %]
          <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=[% 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=hostdetail">View Host 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=grid">View Status Grid For This Host Group</a></div>
        [% ELSIF servicegroup == 'all' %]
          <div><a href='status.cgi?servicegroup=all&amp;style=detail'>View Service Status Detail For All Service Groups</a></div>
          <div><a href='status.cgi?servicegroup=all&amp;style=overview'>View Status Overview For All Service Groups</a></div>
          <div><a href='status.cgi?servicegroup=all&amp;style=grid'>View Service Status Grid For All Service Groups</a></div>
        [% ELSIF servicegroup != '' %]
          <div><a href="status.cgi?servicegroup=[% servicegroup | uri %]&amp;style=detail">View Service Status Detail For This Service Group</a></div>
          <div><a href="status.cgi?servicegroup=[% servicegroup | uri %]&amp;style=overview">View Status Overview For This Service Group</a></div>
          <div><a href="status.cgi?servicegroup=[% servicegroup | uri %]&amp;style=grid">View Service Status Grid For This Service Group</a></div>
          <div><a href="status.cgi?servicegroup=all&amp;style=summary">View Status Summary For All Service Groups</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=hostdetail'>View Host 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=grid'>View Status Grid For All Host Groups</a></div>
        [% END %]
      </div>
    </div>
  [% END %]

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

  <div class="my-2 flex gap-1">
    [% PROCESS _add_bookmark.tt %]
    [% PROCESS _show_link.tt %]
    [% 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 class="card w-full min-w-[420px]">
    <div class="mainTableHeader">
      <div>
        <div class="flex flex-nowrap gap-x-1 items-center">
          [% PROCESS _status_filter.tt %]
        </div>
      </div>
      <div>
        [% PROCESS _pager.tt %]
      </div>
      <div>
        [% PROCESS _pager_per_page.tt %]
      </div>
    </div>

    <div class="mainTable [% IF main_table_full %]fullsize[% END %]">

      [% FOR group IN data %]
        [% groupname = group.name %]

        [% SET group_uri = groupname | uri %]
        [% IF substyle == 'host' %]
          [% SET link        = uri_with(c, 'hostgroup' => group_uri, style => 'hostdetail') %]
          [% SET servicelink = uri_with(c, 'hostgroup' => group_uri, style => 'detail') %]
        [% ELSIF substyle == 'service' %]
          [% SET link        = uri_with(c, 'servicegroup' => group_uri, style => 'detail') %]
          [% SET servicelink = uri_with(c, 'servicegroup' => group_uri, style => 'detail') %]
        [% END %]
        [% IF !loop.first %]<hr class="mt-3">[% END %]
        <div>
          <div class="p-2">
            [% IF substyle == 'host' %]
              <h3 class="flexrow flex-nowrap">
                <a class="link" href="status.cgi?hostgroup=[% group.name | uri %]&amp;style=overview">[% group.alias | html %] ([% group.name | html %])</a>
                <a class="button round small text-sm display-filter" href="extinfo.cgi?type=5&amp;hostgroup=[% group.name | uri %]"><i class="uil uil-icons"></i></a>
              </h3>
            [% ELSIF substyle == 'service' %]
              <h3 class="flexrow flex-nowrap">
                <a class="link" href="status.cgi?servicegroup=[% group.name | uri %]&amp;style=overview">[% group.alias | html %] ([% group.name | html %])</a>
                <a class="button round small text-sm display-filter" href="extinfo.cgi?type=8&amp;servicegroup=[% group.name | uri %]"><i class="uil uil-icons"></i></a>
              </h3>
            [% END %]
          </div>

          <div class="flex">
            <div class="basis-1/2 mr-5">
              <div class="px-2 text-center"><h4>Hosts Summary</h4></div>
              <table>
                <tbody>
                  <tr>
                    <td class="w-1/4 text-center p-1[% IF group.hosts_up > 0 %] OK[% END %]"><a href='[% link %]&amp;hoststatustypes=2&amp;hostprops=0'>[% group.hosts_up %] UP</a></td>
                    <td class="w-1/4 text-center p-1[% IF group.hosts_down > 0 %] DOWN[% END %]"><a href='[% link %]&amp;hoststatustypes=4&amp;hostprops=0'>[% group.hosts_down %] DOWN</a></td>
                    <td class="w-1/4 text-center p-1[% IF group.hosts_unreachable > 0 %] UNREACHABLE[% END %]"><a href='[% link %]&amp;hoststatustypes=8&amp;hostprops=0'>[% group.hosts_unreachable %] UNREACHABLE</a></td>
                    <td class="w-1/4 text-center p-1[% IF group.hosts_pending > 0 %] PENDING[% END %]"><a href='[% link %]&amp;hoststatustypes=1&amp;hostprops=0'>[% group.hosts_pending %] PENDING</a></td>
                  </tr>
                  <tr>
                    <td></td>
                    <td class="align-top">
                      <div>
                        [% IF group.hosts_down_unhandled > 0 %]<div class='block text-center hostImportantProblem'><a href='[% link %]&amp;hoststatustypes=4&amp;hostprops=42'>[% group.hosts_down_unhandled %] Unhandled</a></div>[% END %]
                        [% IF group.hosts_down_downtime > 0  %]<div class='block text-center hostUnimportantProblem'><a href='[% link %]&amp;hoststatustypes=4&amp;hostprops=1'>[% group.hosts_down_downtime %] Scheduled</a></div>[% END %]
                        [% IF group.hosts_down_ack > 0       %]<div class='block text-center hostUnimportantProblem'><a href='[% link %]&amp;hoststatustypes=4&amp;hostprops=4'>[% group.hosts_down_ack %] Acknowledged</a></div>[% END %]
                        [% IF strict_passive_mode %]
                          [% IF group.hosts_down_disabled_active > 0  %]<div class='block text-center hostUnimportantProblem'><a href='[% link %]&amp;hoststatustypes=4&amp;hostprops=16'>[% group.hosts_down_disabled_active %] Disabled</a></div>[% END %]
                          [% IF group.hosts_down_disabled_passive > 0  %]<div class='block text-center hostUnimportantProblem'><a href='[% link %]&amp;hoststatustypes=4&amp;hostprops=16'>[% group.hosts_down_disabled_passive %] Passive</a></div>[% END %]
                        [% ELSE %]
                          [% IF group.hosts_down_disabled_active + group.hosts_down_disabled_passive > 0  %]<div class='block text-center hostUnimportantProblem'><a href='[% link %]&amp;hoststatustypes=4&amp;hostprops=16'>[% group.hosts_down_disabled_active + group.hosts_down_disabled_passive %] Disabled</a></div>[% END %]
                        [% END %]
                      </div>
                    </td>
                    <td class="align-top">
                      <div>
                        [% IF group.hosts_unreachable_unhandled > 0 %]<div class='block text-center hostImportantProblem'><a href='[% link %]&amp;hoststatustypes=8&amp;hostprops=42'>[% group.hosts_unreachable_unhandled %] Unhandled</a></div>[% END %]
                        [% IF group.hosts_unreachable_downtime > 0  %]<div class='block text-center hostUnimportantProblem'><a href='[% link %]&amp;hoststatustypes=8&amp;hostprops=1'>[% group.hosts_unreachable_downtime %] Scheduled</a></div>[% END %]
                        [% IF group.hosts_unreachable_ack > 0       %]<div class='block text-center hostUnimportantProblem'><a href='[% link %]&amp;hoststatustypes=8&amp;hostprops=4'>[% group.hosts_unreachable_ack %] Acknowledged</a></div>[% END %]
                        [% IF strict_passive_mode %]
                          [% IF group.hosts_unreachable_disabled_active > 0  %]<div class='block text-center hostUnimportantProblem'><a href='[% link %]&amp;hoststatustypes=8&amp;hostprops=131088'>[% group.hosts_unreachable_disabled_active %] Disabled</a></div>[% END %]
                          [% IF group.hosts_unreachable_disabled_passive > 0  %]<div class='block text-center hostUnimportantProblem'><a href='[% link %]&amp;hoststatustypes=8&amp;hostprops=65552'>[% group.hosts_unreachable_disabled_passive %] Passive</a></div>[% END %]
                        [% ELSE %]
                          [% IF group.hosts_unreachable_disabled_active +group.hosts_unreachable_disabled_passive > 0  %]<div class='hostUnimportantProblem'><a href='[% link %]&amp;hoststatustypes=8&amp;hostprops=16'>[% group.hosts_unreachable_disabled_active + group.hosts_unreachable_disabled_passive %] Disabled</a></div>[% END %]
                        [% END %]
                      </div>
                    </td>
                    <td></td>
                  </tr>
                </tbody>
              </table>
            </div>

            <div class="basis-1/2 ml-5">
              <div class="px-2 text-center"><h4>Services Summary</h4></div>
              [% IF group.services_ok + group.services_warning + group.services_unknown + group.services_critical + group.services_pending == 0 %]
                <div class="text-center">No matching services</div>
              [% ELSE %]
                <table>
                  <tbody>
                    <tr>
                      <td class="w-1/5 text-center p-1[% IF group.services_ok > 0 %] OK[% END %]"><a href='[% servicelink %]&amp;servicestatustypes=2&amp;hoststatustypes=15&amp;serviceprops=0&amp;hostprops=0'>[% group.services_ok %] OK</a></td>
                      <td class="w-1/5 text-center p-1[% IF group.services_warning > 0 %] WARNING[% END %]"><a href='[% servicelink %]&amp;servicestatustypes=4&amp;hoststatustypes=15&amp;serviceprops=0&amp;hostprops=0'>[% group.services_warning %] WARNING</a></td>
                      <td class="w-1/5 text-center p-1[% IF group.services_critical > 0 %] CRITICAL[% END %]"><a href='[% servicelink %]&amp;servicestatustypes=16&amp;hoststatustypes=15&amp;serviceprops=0&amp;hostprops=0'>[% group.services_critical %] CRITICAL</a></td>
                      <td class="w-1/5 text-center p-1[% IF group.services_unknown > 0 %] UNKNOWN[% END %]"><a href='[% servicelink %]&amp;servicestatustypes=8&amp;hoststatustypes=15&amp;serviceprops=0&amp;hostprops=0'>[% group.services_unknown %] UNKNOWN</a></td>
                      <td class="w-1/5 text-center p-1[% IF group.services_pending > 0 %] PENDING[% END %]"><a href='[% servicelink %]&amp;servicestatustypes=1&amp;hoststatustypes=15&amp;serviceprops=0&amp;hostprops=0'>[% group.services_pending %] PENDING</a></td>
                    </tr>
                    <tr>
                      <td></td>
                      <td class="align-top">
                        <div>
                          [% IF group.services_warning_unhandled > 0 %]<div class='block text-center serviceImportantProblem'><a href='[% servicelink %]&amp;servicestatustypes=4&amp;hoststatustypes=3&amp;serviceprops=42'>[% group.services_warning_unhandled %] Unhandled</a></div>[% END %]
                          [% IF group.services_warning_prob_host > 0 %]<div class='block text-center serviceUnimportantProblem'><a href='[% servicelink %]&amp;servicestatustypes=4&amp;hoststatustypes=12'>[% group.services_warning_prob_host %] on Problem Hosts</a></div>[% END %]
                          [% IF group.services_warning_ack > 0       %]<div class='block text-center serviceUnimportantProblem'><a href='[% servicelink %]&amp;servicestatustypes=4&amp;serviceprops=4'>[% group.services_warning_ack %] Acknowledged</a></div>[% END %]
                          [% IF strict_passive_mode %]
                            [% IF group.services_warning_disabled_active > 0  %]<div class='block text-center serviceUnimportantProblem'><a href='[% servicelink %]&amp;servicestatustypes=4&amp;serviceprops=131088'>[% group.services_warning_disabled_active %] Disabled</a></div>[% END %]
                            [% IF group.services_warning_disabled_passive > 0  %]<div class='block text-center serviceUnimportantProblem'><a href='[% servicelink %]&amp;servicestatustypes=4&amp;serviceprops=65552'>[% group.services_warning_disabled_passive %] Passive</a></div>[% END %]
                          [% ELSE %]
                            [% IF group.services_warning_disabled_active + group.services_warning_disabled_passive > 0  %]<div class='block text-center serviceUnimportantProblem'><a href='[% servicelink %]&amp;servicestatustypes=4&amp;serviceprops=16'>[% group.services_warning_disabled_active + group.services_warning_disabled_passive %] Disabled</a></div>[% END %]
                          [% END %]
                          </div>
                      </td>
                      <td class="align-top">
                        <div>
                          [% IF group.services_critical_unhandled > 0 %]<div class='block text-center serviceImportantProblem'><a href='[% servicelink %]&amp;servicestatustypes=16&amp;hoststatustypes=3&amp;serviceprops=42'>[% group.services_critical_unhandled %] Unhandled</a></div>[% END %]
                          [% IF group.services_critical_prob_host > 0 %]<div class='block text-center serviceUnimportantProblem'><a href='[% servicelink %]&amp;servicestatustypes=16&amp;hoststatustypes=12'>[% group.services_critical_prob_host %] on Problem Hosts</a></div>[% END %]
                          [% IF group.services_critical_ack > 0       %]<div class='block text-center serviceUnimportantProblem'><a href='[% servicelink %]&amp;servicestatustypes=16&amp;serviceprops=4'>[% group.services_critical_ack %] Acknowledged</a></div>[% END %]
                          [% IF strict_passive_mode %]
                            [% IF group.services_critical_disabled_active > 0  %]<div class='block text-center serviceUnimportantProblem'><a href='[% servicelink %]&amp;servicestatustypes=16&amp;serviceprops=131088'>[% group.services_critical_disabled_active %] Disabled</a></div>[% END %]
                            [% IF group.services_critical_disabled_passive > 0  %]<div class='block text-center serviceUnimportantProblem'><a href='[% servicelink %]&amp;servicestatustypes=16&amp;serviceprops=65552'>[% group.services_critical_disabled_passive %] Passive</a></div>[% END %]
                          [% ELSE %]
                            [% IF group.services_critical_disabled_active + group.services_critical_disabled_passive > 0  %]<div class='block text-center serviceUnimportantProblem'><a href='[% servicelink %]&amp;servicestatustypes=16&amp;serviceprops=16'>[% group.services_critical_disabled_active + group.services_critical_disabled_passive %] Disabled</a></div>[% END %]
                          [% END %]
                        </div>
                      </td>
                      <td class="align-top">
                        <div>
                          [% IF group.services_unknown_unhandled > 0 %]<div class='block text-center serviceImportantProblem'><a href='[% servicelink %]&amp;servicestatustypes=8&amp;hoststatustypes=3&amp;serviceprops=42'>[% group.services_unknown_unhandled %] Unhandled</a></div>[% END %]
                          [% IF group.services_unknown_prob_host > 0 %]<div class='block text-center serviceUnimportantProblem'><a href='[% servicelink %]&amp;servicestatustypes=8&amp;hoststatustypes=12'>[% group.services_unknown_prob_host %] on Problem Hosts</a></div>[% END %]
                          [% IF group.services_unknown_ack > 0       %]<div class='block text-center serviceUnimportantProblem'><a href='[% servicelink %]&amp;servicestatustypes=8&amp;serviceprops=4'>[% group.services_unknown_ack %] Acknowledged</a></div>[% END %]
                          [% IF strict_passive_mode %]
                            [% IF group.services_unknown_disabled_active > 0  %]<div class='block text-center serviceUnimportantProblem'><a href='[% servicelink %]&amp;servicestatustypes=8&amp;serviceprops=131088'>[% group.services_unknown_disabled_active %] Disabled</a></div>[% END %]
                            [% IF group.services_unknown_disabled_passive > 0  %]<div class='block text-center serviceUnimportantProblem'><a href='[% servicelink %]&amp;servicestatustypes=8&amp;serviceprops=65552'>[% group.services_unknown_disabled_passive %] Passive</a></div>[% END %]
                          [% ELSE %]
                            [% IF group.services_unknown_disabled_active + group.services_unknown_disabled_passive > 0  %]<div class='block text-center serviceUnimportantProblem'><a href='[% servicelink %]&amp;servicestatustypes=8&amp;serviceprops=16'>[% group.services_unknown_disabled_active + group.services_unknown_disabled_passive %] Disabled</a></div>[% END %]
                          [% END %]
                        </div>
                      </td>
                      <td></td>
                    </tr>
                  </tbody>
                </table>
              [% END %]
            </div>
          </div>
        </div>
      [% END %]
    </div>

    <div class="mainTableFooter">
      [% PROCESS _pager_total_items.tt %]
    </div>
  </div>

[% PROCESS _footer.tt %]
