[% SET hoststatustypes = 15 IF ! hoststatustypes %]

<div class='card statusTotals min-w-[350px]'>
  <div class="head flexrow justify-between">
    <h3>Service Status Totals</h3>
  </div>
  <table class="serviceTotals">
    <tr>
      <th class="w-1/5 links"><a href='[% uri_with(c, style => 'detail', page => 'undef', servicestatustypes => 2,  hoststatustypes => hoststatustypes) %]'>OK</a></th>
      <th class="w-1/5 links"><a href='[% uri_with(c, style => 'detail', page => 'undef', servicestatustypes => 4,  hoststatustypes => hoststatustypes) %]'>Warning</a></th>
      <th class="w-1/5 links"><a href='[% uri_with(c, style => 'detail', page => 'undef', servicestatustypes => 8,  hoststatustypes => hoststatustypes) %]'>Unknown</a></th>
      <th class="w-1/5 links"><a href='[% uri_with(c, style => 'detail', page => 'undef', servicestatustypes => 16, hoststatustypes => hoststatustypes) %]'>Critical</a></th>
      <th class="w-1/5 links"><a href='[% uri_with(c, style => 'detail', page => 'undef', servicestatustypes => 1,  hoststatustypes => hoststatustypes) %]'>Pending</a></th>
    </tr>
    <tr>
      <td class='w-1/5 [% IF !has_error && service_stats.ok       > 0 %]OK[%       END %]'><a href='[% uri_with(c, style => 'detail', page => 'undef', servicestatustypes => 2,   hoststatustypes => hoststatustypes) %]'>[% IF !has_error && service_stats.ok %][% service_stats.ok %][% ELSE %]0[% END %]</a></td>
      <td class='w-1/5 [% IF !has_error && service_stats.warning  > 0 %]WARNING[%  END %]'><a href='[% uri_with(c, style => 'detail', page => 'undef', servicestatustypes => 4,   hoststatustypes => hoststatustypes) %]'>[% IF !has_error && service_stats.warning %][% service_stats.warning %][% ELSE %]0[% END %]</a></td>
      <td class='w-1/5 [% IF !has_error && service_stats.unknown  > 0 %]UNKNOWN[%  END %]'><a href='[% uri_with(c, style => 'detail', page => 'undef', servicestatustypes => 8,   hoststatustypes => hoststatustypes) %]'>[% IF !has_error && service_stats.unknown %][% service_stats.unknown %][% ELSE %]0[% END %]</a></td>
      <td class='w-1/5 [% IF !has_error && service_stats.critical > 0 %]CRITICAL[% END %]'><a href='[% uri_with(c, style => 'detail', page => 'undef', servicestatustypes => 16,  hoststatustypes => hoststatustypes) %]'>[% IF !has_error && service_stats.critical %][% service_stats.critical %][% ELSE %]0[% END %]</a></td>
      <td class='w-1/5 [% IF !has_error && service_stats.pending  > 0 %]PENDING[%  END %]'><a href='[% uri_with(c, style => 'detail', page => 'undef', servicestatustypes => 1,   hoststatustypes => hoststatustypes) %]'>[% IF !has_error && service_stats.pending %][% service_stats.pending %][% ELSE %]0[% END %]</a></td>
    </tr>
  </table>
  <table>
    <tr>
      [% totalProblems  = 0 %]
      [% totalUnhandled = 0 %]
      [% total          = 0 %]
      [% IF !has_error %]
      [% totalProblems  = service_stats.warning + service_stats.critical + service_stats.unknown %]
      [% totalUnhandled = service_stats.warning_and_unhandled + service_stats.critical_and_unhandled + service_stats.unknown_and_unhandled %]
      [% total          = service_stats.ok + totalProblems + service_stats.pending %]
      [% END %]
      <th class="w-1/3 links"><a href='[% uri_with(c, style => 'detail', page => 'undef', servicestatustypes => 28, serviceprops => '', hostprops => '', hoststatustypes => '') %]'>All Problems</a></th>
      <th class="w-1/3 links"><a href='[% uri_with(c, style => 'detail', page => 'undef', servicestatustypes => 28, serviceprops => 10, hostprops => 10, hoststatustypes => 3) %]'>Unhand. Issues</a></th>
      <th class="w-1/3 links"><a href='[% uri_with(c, style => 'detail', page => 'undef', servicestatustypes => 32, hoststatustypes => hoststatustypes) %]'>All Types</a></th>
    </tr>
    <tr>
      <td class="w-1/3[% IF !has_error && totalProblems > 0 %] PROBLEMS[% END %]"><a href='[% uri_with(c, style => 'detail', page => 'undef', servicestatustypes => 28, serviceprops => '', hostprops => '', hoststatustypes => '') %]'>[% totalProblems %]</a></td>
      <td class="w-1/3[% IF !has_error && totalUnhandled > 0 %] PROBLEMS[% END %]"><a href='[% uri_with(c, style => 'detail', page => 'undef', servicestatustypes => 28, serviceprops => 10, hostprops => 10, hoststatustypes => 3) %]'>[% totalUnhandled %]</a></td>
      <td class="w-1/3"><a href='[%          uri_with(c, style => 'detail', page => 'undef', servicestatustypes => 32, hoststatustypes => hoststatustypes) %]'>[% total %]</a></td>
    </tr>
  </table>
</div>