[% PROCESS _header.tt
                      css=["plugins/${plugin_name}/conf-${fileversion}.css","vendor/linedtextarea-e619e09/jquery-linedtextarea.css", "vendor/jstree-3.3.8/themes/default/style.min.css"]
                      js=["plugins/${plugin_name}/conf-${fileversion}.js", "vendor/jstree-3.3.8/jstree.min.js"]
%]
[% PROCESS _message.tt %]
[% PROCESS _blocks.tt %]

[% IF thruk_author && !c.config.demo_mode && c.config.exists('conf_retention_file') %]
<div class="card z-50 fixed bottom-0 right-0 m-2 mr-64 min-w-fit">
  <div class="body p-1 font-semibold textBody">
    <span>file: [% c.config.conf_retention_file %]</span>
    <span class="border-l borderDefault pl-1 mr-1">[% IF c.config.defined("conf_retention") && c.config.conf_retention.size >= 9 %]mtime: [% date_format(c, c.config.conf_retention.9); ELSE %]file does not exist yet.[% END %]</span>
  </div>
</div>
[% END %]

[% IF action != "editor" %]
<div class="flexrow justify-between hidden 2xl:flex">
  <div class="flex">
    [% PROCESS _infobox.tt has_proc_info=0 %]
  </div>

  <div class="flexcol">
    <div class="card w-full">
      <div class="head">
        <h3>Configuration Type</h3>
      </div>
      <div class="body">
        <form method="GET" action="conf.cgi" id="obj_type_show_form">
        <select name='sub' onchange="document.getElementById('obj_type_show_form').submit()" class="w-full">
          <option value='all'[%    IF sub == 'all'   %] selected [% END %]>Overview</option>
          [% IF conf_config.exists('thruk') %]
          <option value='thruk'[%  IF sub == 'thruk' %] selected [% END %]>Thruk</option>
          <option value='backends'[%  IF sub == 'backends' %] selected [% END %]>Backends</option>
          [% END %]
          [% IF conf_config.exists('cgi.cfg') %]
          <option value='cgi'[%    IF sub == 'cgi'   %] selected [% END %]>CGI &amp; Access</option>
          [% END %]
          [% IF conf_config.exists('cgi.cfg') || conf_config.exists('htpasswd') %]
          <option value='users'[%  IF sub == 'users' %] selected [% END %]>Users</option>
          [% END %]
          <option value='plugins'[%  IF sub == 'plugins' %] selected [% END %]>Plugins</option>
          [% IF has_obj_conf %]
          <option value='objects'[%  IF sub == 'objects' %] selected [% END %]>Objects</option>
          [% END %]
        </select>
        </form>
      </div>
    </div>
    <div class="h-3">
      [% apply_reload_btn = BLOCK %]
        [% IF last_changed || needs_commit || show_save_reload %]
        [% PROCESS _button btn = {
          form   => { action => 'conf.cgi', },
          data   => { sub => 'objects', 'apply' => 'yes', save_and_reload => 'yes', CSRFtoken => get_user_token(c), },
          button => { class => 'w-full', title => "Apply all changes and reload core", onclick => "return save_reload_apply(this, '" _ show_save_reload _ "')", html => '<i class="uil uil-save"></i>Save &amp; Reload' },
        }%]
        [% END %]
      [% END %]
      [% apply_reload_btn %]
    </div>
  </div>
</div>
[% END %]

[% IF action != "tree" && action != "editor" %]
<div class="w-full flexrow justify-between place-content-center">
  <div class="w-34"></div>
  <h1 class='mainTitle'>[% subtitle %]</h1>
  <div class="w-34">
    <div class="2xl:hidden">[% apply_reload_btn %]</div>
  </div>
</div>
[% END %]


[% content %]

<script>
<!--
var show_commit_summary_prompt = [% IF post_obj_save_cmd && show_summary_prompt %]true[% ELSE %]false[% END %];
init_conf_tool_buttons();
-->
</script>


[% PROCESS _footer.tt %]
