[% USE date %]
<div class="card min-w-[350px] overflow-hidden">
  <div class="head">
    <h3>Host Actions</h3>
  </div>
  <div class="actionbox">
    [% UNLESS c.check_cmd_permissions('host', host.name) %]
      <div class='p-2 text-center whitespace-normal textHINTsoft not-hoverable'>Your account does not have permissions to execute commands.</div>
    [% ELSE %]
      [% UNLESS command_disabled(c, 96) %]
        <div class="flex flex-nowrap">
          <a class="flex js-modal-command-link" href="cmd.cgi?cmd_typ=96&amp;host=[% host.name | uri %]&amp;backend=[% host.peer_key %]">
            <i class="fa-solid fa-clock"></i>Re-schedule next check of this host
          </a>
          <form class="flex ml-1" action='cmd.cgi' method='POST'>
            <input type='hidden' name='cmd_typ' value='96'>
            <input type='hidden' name='cmd_mod' value='2'>
            <input type='hidden' name='start_time' value="[% date.now %]">
            <input type='hidden' name='host' value="[% host.name | html %]">
            <input type='hidden' name='force_check' value='1'>
            <input type='hidden' name='backend' value="[% host.peer_key %]">
            <input type='hidden' name='referer' value="[% short_uri(c, {referer => 'undef'}) %]">
            <input type="hidden" name="CSRFtoken" value="[% get_user_token(c) %]">
            (<a href="cmd.cgi?cmd_typ=96&amp;start_time=[% date.now %]&amp;host=[% host.name | uri %]&amp;force_check=1&amp;backend=[% host.peer_key %]&amp;referer=[% as_url_arg(short_uri(c, {referer => 'undef'})) %]" onClick="setBtnSpinner(this); jQuery(this).closest('FORM').submit(); return false;">Now</a>)
          </form>
        </div>
      [% END %]
      [% IF host.accept_passive_checks %]
        [% UNLESS command_disabled(c, 87) %]
          <div>
            <a class="js-modal-command-link" href="cmd.cgi?cmd_typ=87&amp;host=[% host.name | uri %]&amp;backend=[% host.peer_key %]">
              <i class="uil uil-left-arrow-to-left small"></i>Submit passive check result for this host
            </a>
          </div>
        [% END %]
      [% END %]
      [% IF host.acknowledged || host.state >= 1 %]
        [% UNLESS command_disabled(c, 33) || command_disabled(c, 51) %]
          <div>
            [% IF host.acknowledged %]
            <a class="js-modal-command-link" href="cmd.cgi?cmd_typ=51&amp;host=[% host.name | uri %]&amp;backend=[% host.peer_key %]">
              <i class="fa-solid fa-person-digging hover-red-text"></i>Remove problem acknowledgement
            </a>
            [% ELSE %]
            <a class="js-modal-command-link" href="cmd.cgi?cmd_typ=33&amp;host=[% host.name | uri %]&amp;backend=[% host.peer_key %]">
              <i class="fa-solid fa-person-digging"></i>Acknowledge this host problem
            </a>
            [% END %]
          </div>
        [% END %]
      [% END %]
      [% UNLESS command_disabled(c, 10) %]
        [% IF host.state >= 1 %]
        <div>
          <a class="js-modal-command-link" href="cmd.cgi?cmd_typ=10&amp;host=[% host.name | uri %]&amp;backend=[% host.peer_key %]">
            <i class="fa-solid fa-clock"></i>Delay next host notification
          </a>
        </div>
        [% END %]
      [% END %]
      [% UNLESS command_disabled(c, 159) %]
        <div>
          <a class="js-modal-command-link" href="cmd.cgi?cmd_typ=159&amp;host=[% host.name | uri %]&amp;backend=[% host.peer_key %]">
            <i class="fa-solid fa-volume-high small"></i>Send custom host notification
          </a>
        </div>
      [% END %]

      [% UNLESS command_disabled(c, '55') %]
        <div class="flex flex-nowrap">
          <a class="flex js-modal-command-link" href="cmd.cgi?cmd_typ=55&amp;host=[% host.name | uri %]&amp;backend=[% host.peer_key %]">
            <i class="fa-solid fa-moon"></i>Schedule downtime for this host
          </a>
          <a class="flex ml-1 js-modal-command-link" href="cmd.cgi?cmd_typ=55&amp;host=[% host.name | uri %]&amp;backend=[% host.peer_key %]&hostserviceoptions=1">(and all services)</a>
        </div>
      [% END %]
      [% UNLESS command_disabled(c, '86') %]
        <div>
          <a class="js-modal-command-link" href="cmd.cgi?cmd_typ=86&amp;host=[% host.name | uri %]&amp;backend=[% host.peer_key %]">
            <i class="fa-solid fa-moon"></i>Schedule downtime for all services on this host
          </a>
        </div>
      [% END %]
      [% UNLESS command_disabled(c, '17') %]
      <div>
        <a class="js-modal-command-link" href="cmd.cgi?cmd_typ=17&amp;host=[% host.name | uri %]&amp;backend=[% host.peer_key %]">
          <i class="fa-solid fa-clock"></i>Schedule a check of all services on this host
        </a>
      </div>
      [% END %]
      [% IF host.modified_attributes_list.size > 0 %]
        [% UNLESS command_disabled(c, '154') %]
          <div>
            <a class="js-modal-command-link" href="cmd.cgi?cmd_typ=154&amp;host=[% host.name | uri %]&amp;backend=[% host.peer_key %]">
              <i class="fa-solid fa-arrow-rotate-left"></i>Reset Modified Attributes
            </a>
          </div>
        [% END %]
      [% END %]
      [% IF enable_shinken_features %]
        [% UNLESS command_disabled(c, '201') %]
          <div>
            <a class="js-modal-command-link" href="cmd.cgi?cmd_typ=201&amp;host=[% host.name | uri %]&amp;backend=[% host.peer_key %]">
              <i class="fa-solid fa-rocket"></i>Launch event handler
            </a>
          </div>
        [% END %]
      [% END %]
    [% END %]
  </div>
</div>


[% IF c.check_cmd_permissions('host', host.name) %]
<div class="card mt-5 min-w-[350px] overflow-hidden">
  <div class="head">
    <h3>Host Commands</h3>
  </div>
  <div class="actionbox">
    [% UNLESS command_disabled(c, '47') || command_disabled(c, '48') %]
      <div>
        [% IF host.checks_enabled %]
          <a class="js-modal-command-link" href="cmd.cgi?cmd_typ=48&amp;host=[% host.name | uri %]&amp;backend=[% host.peer_key %]">
            <i class="fa-solid fa-xmark round small red"></i>Disable active checks of this host
          </a>
        [% ELSE %]
          <a class="js-modal-command-link" href="cmd.cgi?cmd_typ=47&amp;host=[% host.name | uri %]&amp;backend=[% host.peer_key %]">
            <i class="fa-solid fa-check round small green"></i>Enable active checks of this host
          </a>
        [% END %]
      </div>
    [% END %]
    [% UNLESS command_disabled(c, '92') || command_disabled(c, '93') %]
      <div>
        [% IF host.accept_passive_checks %]
          <a class="js-modal-command-link" href="cmd.cgi?cmd_typ=93&amp;host=[% host.name | uri %]&amp;backend=[% host.peer_key %]">
            <i class="fa-solid fa-xmark round small red"></i>Stop accepting passive checks for this host
          </a>
        [% ELSE %]
          <a class="js-modal-command-link" href="cmd.cgi?cmd_typ=92&amp;host=[% host.name | uri %]&amp;backend=[% host.peer_key %]">
            <i class="fa-solid fa-check round small green"></i>Start accepting passive checks for this host
          </a>
        [% END %]
      </div>
    [% END %]
    [% UNLESS command_disabled(c, '101') || command_disabled(c, '102') %]
      <div>
        [% IF host.obsess_over_host %]
          <a class="js-modal-command-link" href="cmd.cgi?cmd_typ=102&amp;host=[% host.name | uri %]&amp;backend=[% host.peer_key %]">
            <i class="fa-solid fa-xmark round small red"></i>Stop obsessing over this host
          </a>
        [% ELSE %]
          <a class="js-modal-command-link" href="cmd.cgi?cmd_typ=101&amp;host=[% host.name | uri %]&amp;backend=[% host.peer_key %]">
            <i class="fa-solid fa-check round small green"></i>Start obsessing over this host
          </a>
        [% END %]
      </div>
    [% END %]
    [% UNLESS command_disabled(c, '24') || command_disabled(c, '25') %]
      <div>
        [% IF host.notifications_enabled %]
          <a class="js-modal-command-link" href="cmd.cgi?cmd_typ=25&amp;host=[% host.name | uri %]&amp;backend=[% host.peer_key %]">
            <i class="fa-solid fa-xmark round small red"></i>Disable notifications for this host
          </a>
        [% ELSE %]
          <a class="js-modal-command-link" href="cmd.cgi?cmd_typ=24&amp;host=[% host.name | uri %]&amp;backend=[% host.peer_key %]">
            <i class="fa-solid fa-check round small green"></i>Enable notifications for this host
          </a>
        [% END %]
      </div>
    [% END %]
    [% UNLESS command_disabled(c, '29') %]
      <div>
        <a class="js-modal-command-link" href="cmd.cgi?cmd_typ=29&amp;host=[% host.name | uri %]&amp;backend=[% host.peer_key %]">
          <i class="fa-solid fa-xmark round small red"></i>Disable notifications for all services on this host
        </a>
      </div>
    [% END %]
    [% UNLESS command_disabled(c, '28') %]
      <div>
        <a class="js-modal-command-link" href="cmd.cgi?cmd_typ=28&amp;host=[% host.name | uri %]&amp;backend=[% host.peer_key %]">
          <i class="fa-solid fa-check round small green"></i>Enable notifications for all services on this host
        </a>
      </div>
    [% END %]
    [% UNLESS command_disabled(c, '16') %]
      <div>
        <a class="js-modal-command-link" href="cmd.cgi?cmd_typ=16&amp;host=[% host.name | uri %]&amp;backend=[% host.peer_key %]">
          <i class="fa-solid fa-xmark round small red"></i>Disable checks of all services on this host
        </a>
      </div>
    [% END %]
    [% UNLESS command_disabled(c, '15') %]
      <div>
        <a class="js-modal-command-link" href="cmd.cgi?cmd_typ=15&amp;host=[% host.name | uri %]&amp;backend=[% host.peer_key %]">
          <i class="fa-solid fa-check round small green"></i>Enable checks of all services on this host
        </a>
      </div>
    [% END %]
    [% UNLESS command_disabled(c, '43') || command_disabled(c, '44') %]
      <div>
        [% IF host.event_handler_enabled %]
          <a class="js-modal-command-link" href="cmd.cgi?cmd_typ=44&amp;host=[% host.name | uri %]&amp;backend=[% host.peer_key %]">
            <i class="fa-solid fa-xmark round small red"></i>Disable event handler for this host
          </a>
        [% ELSE %]
          <a class="js-modal-command-link" href="cmd.cgi?cmd_typ=43&amp;host=[% host.name | uri %]&amp;backend=[% host.peer_key %]">
            <i class="fa-solid fa-check round small green"></i>Enable event handler for this host
          </a>
        [% END %]
      </div>
    [% END %]
    [% UNLESS command_disabled(c, '57') || command_disabled(c, '58') %]
      <div>
        [% IF host.flap_detection_enabled %]
          <a class="js-modal-command-link" href="cmd.cgi?cmd_typ=58&amp;host=[% host.name | uri %]&amp;backend=[% host.peer_key %]">
            <i class="fa-solid fa-xmark round small red"></i>Disable flap detection for this host
          </a>
        [% ELSE %]
          <a class="js-modal-command-link" href="cmd.cgi?cmd_typ=57&amp;host=[% host.name | uri %]&amp;backend=[% host.peer_key %]">
            <i class="fa-solid fa-check round small green"></i>Enable flap detection for this host
          </a>
        [% END %]
      </div>
    [% END %]
    [%# Import template for custom host commands on the "Host Commands" pane #%]
    [% PROCESS user_host_commands.tt %]
  </div>
</div>
[% END %]
