[% IF show_form %]
<form action="" method="GET" style="display: initial;" onsubmit="return(check_filter_style_changes(this, '[% style %]', '[% paneprefix %]columns') &amp;&amp; remove_empty_form_params(this) &amp;&amp; setFormBtnSpinner(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="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="[% paneprefix %]columns" id="[% paneprefix %]columns" value="">
[% END %]
[% DEFAULT extra_params = [] %]
[% FOREACH ep IN extra_params %]
  <input type="hidden" name="[% ep.name | html %]" value="[% ep.value | html %]">
[% END %]

<div class="relative">
  [% DEFAULT small_button = "" %]
  [% IF small_button %]
    <button title="Display Filter Options" class="round small [% IF filter_active %] textActive2 hover:textActive2[% END %]" onClick="toggleFilterPopup('[% paneprefix %]_all_filter_card'); return false;"><i class="uil uil-filter"></i></button>
  [% ELSE %]
    <button title="Display Filter Options" class="w-36 text-sm rounded border-0 font-medium display-filter [% IF filter_active %]textActive2 hover:textActive2[% END %]" onClick="toggleFilterPopup('[% paneprefix %]_all_filter_card'); return false;">[% IF filter_active %]Filters active[% ELSE %]Display Filter[% END %]</button>
  [% END %]
  <div class="absolute w-[90vw]">
    <div class="card z-30 absolute shadow-float w-auto max-w-[95%]" style="display:none;" id="[% paneprefix %]_all_filter_card" onclick="resetRefresh()">
      <div class="head flexrow flex-nowrap justify-between w-[450px] border-b-0[% IF has_lex_filter %] w-full[% END %]">
        <h3>Display Filter</h3>
        <div class="flexrow justify-between flex-nowrap gap-x-2 items-center w-full">
          <div class="flexrow gap-1">
            [% IF ! has_lex_filter %]
            <div>
              <a href="#" onclick="toggleFilterAdvanced('[% paneprefix %]_all_filter_card'); return false;" class="link block hoverable p-1 rounded-lg">(toggle advanced filter)</a>
            </div>
            [% END %]
            <div>
              [% IF show_substyle_selector == 1 %]
                <select name="style" class="max-w-[140px]">
                  <optgroup label="Host">
                    <option value="hostdetail"[% IF   style == 'hostdetail'   %] selected[% END %]>Detail</option>
                    <option value="hostoverview"[% IF style == 'overview' && substyle == 'host' || style == 'hostoverview' %] selected[% END %]>Overview</option>
                    <option value="hostsummary"[% IF  style == 'summary'  && substyle == 'host' || style == 'hostsummary'  %] selected[% END %]>Summary</option>
                    <option value="hostgrid"[% IF     style == 'grid'     && substyle == 'host' || style == 'hostgrid'     %] selected[% END %]>Grid</option>
                  </optgroup>
                  <optgroup label="Service">
                    <option value="detail"[% IF          style == 'detail'          %] selected[% END %]>Detail</option>
                    <option value="serviceoverview"[% IF style == 'overview' && substyle == 'service' || style == 'serviceoverview' %] selected[% END %]>Overview</option>
                    <option value="servicesummary"[% IF  style == 'summary'  && substyle == 'service' || style == 'servicesummary'  %] selected[% END %]>Summary</option>
                    <option value="servicegrid"[% IF     style == 'grid'    && substyle == 'service'  || style == 'servicegrid'     %] selected[% END %]>Grid</option>
                    [% has_service_filter = 0 %]
                    [% FOREACH search = searches.$paneprefix %]
                      [% FOREACH s = search.text_filter %]
                        [% IF s.type == 'service' || s.type == 'search' %][% has_service_filter = 1 %][% END %]
                      [% END %]
                    [% END %]
                    [% IF style == 'perfmap' || has_service_filter %]
                      <option value="perfmap"[% IF         style == 'perfmap' && substyle == 'service'                                %] selected[% END %]>Performancedata</option>
                    [% ELSE %]
                      <option value="perfmap" disabled>Performancedata</option>
                    [% END %]
                  </optgroup>
                  [% FOREACH groupname = additional_views.keys.sort %]
                    <optgroup label="[% groupname | html %]">
                      [% FOREACH optname = additional_views.$groupname.options.keys.sort %]
                        [% opt = additional_views.$groupname.options.$optname %]
                        <option value="[% opt.value | html %]"[% IF style == opt.value %] selected[% END %]>[% opt.name | html %]</option>
                      [% END %]
                    </optgroup>
                  [% END %]
                </select>
              [% END %]
            </div>
            <div class="js-advancedfilter"[% IF ! has_lex_filter %] style="display: none;"[% END %]>
              <a href="status.cgi?style=[% IF style == "hostdetail" %]hostdetail[% ELSE %]detail[% END %]&explore=1&q=" onmouseover="appendFormValue(this, 'q', 'textarea[name=[% paneprefix %]q]')" class="link block hoverable p-1 rounded-lg">(switch to explorer)</a>
            </div>
          </div>
          [% IF ! has_lex_filter %]
            <button class="iconOnly js-filterpane" type="submit" name="update" title="accept">
              <i class="fa-solid fa-check round small green"></i>
            </button>
          [% END %]
          <div class="js-advancedfilter flexrow gap-x-1"[% IF ! has_lex_filter %] style="display: none;"[% END %]>
            <div class="textHINTsoft flex items-center js-advancedfilter"[% IF ! has_lex_filter %] style="display: none;"[% END %]>(ctrl+enter)</div>
            <button class="js-advancedfilter" type="submit" name="update"><i class="uil uil-corner-down-right-alt"></i> run query </button>
          </div>
        </div>
      </div>
      [% IF ! has_lex_filter %]
      <div class="w-full flexrow flex-nowrap gap-0 border-t borderDefault js-filterpane">
        <div id="[% paneprefix %]filter_pane" class="flexrow flex-wrap gap-0">
          [% FOREACH search = searches.$paneprefix %]
            [% SET prefix = 's' _ loop.index %]
            [% PROCESS _status_filter_single.tt onchange="" %]
          [% END %]
        </div>
        <div class="clickable hoverable p-0 rounded-br-lg" onClick="new_filter('[% paneprefix %]filter_pane')" id="[% paneprefix %]new_filter_box_btn">
          <div class="flexcol gap-1 text-center pt-10">
            <i class="uil uil-angle-right text-lg" title="add new filter"></i>
            <span>or</span>
          </div>
        </div>
      </div>
      [% END %]
      <div class="body min-w-[800px] border-t borderDefault flexcol js-advancedfilter"[% IF ! has_lex_filter %] style="display: none;"[% END %]>
        [% WRAPPER _filter_advanced.tt disabled=!has_lex_filter %][% IF has_lex_filter %][% has_lex_filter %][% ELSIF ! has_error %][% search2text("service", searches.$paneprefix, 1) %][% END %][% END %]
      </div>
    </div>
  </div>
</div>
[% IF show_form %]
</form>
[% END %]
