{% extends "base.html" %} {% from "macros.jinja" import window_vars with context
%} {% block page %}
<div class="row q-col-gutter-md justify-center">
  <div class="col q-my-md">
    <q-btn
      :label="$t('save')"
      color="primary"
      @click="updateSettings"
      :disabled="!checkChanges"
    >
      <q-tooltip v-if="checkChanges">
        <span v-text="$t('save_tooltip')"></span>
      </q-tooltip>

      <q-badge
        v-if="checkChanges"
        color="red"
        rounded
        floating
        style="padding: 6px; border-radius: 6px"
      />
    </q-btn>

    <q-btn
      v-if="isSuperUser"
      :label="$t('restart')"
      color="primary"
      @click="restartServer"
    >
      <q-tooltip v-if="needsRestart">
        <span v-text="$t('restart_tooltip')"></span>
      </q-tooltip>

      <q-badge
        v-if="needsRestart"
        color="red"
        rounded
        floating
        style="padding: 6px; border-radius: 6px"
      />
    </q-btn>

    <q-btn :label="$t('download_backup')" flat @click="downloadBackup"></q-btn>

    <q-btn
      flat
      v-if="isSuperUser"
      :label="$t('reset_defaults')"
      color="primary"
      @click="deleteSettings"
      class="float-right"
    >
      <q-tooltip>
        <span v-text="$t('reset_defaults_tooltip')"></span>
      </q-tooltip>
    </q-btn>
  </div>
</div>

<div class="row q-col-gutter-md justify-center">
  <div class="col q-gutter-y-md">
    <q-card>
      <div class="q-pa-md">
        <div class="q-gutter-y-md">
          <q-tabs v-model="tab" active-color="primary" align="justify">
            <q-tab
              name="funding"
              :label="$t('funding')"
              @update="val => tab = val.name"
            ></q-tab>

            <q-tab
              name="users"
              :label="$t('users')"
              @update="val => tab = val.name"
            ></q-tab>

            <q-tab
              name="server"
              :label="$t('server')"
              @update="val => tab = val.name"
            ></q-tab>

            <q-tab
              name="security"
              :label="$t('security')"
              @update="val => tab = val.name"
            ></q-tab>

            <q-tab
              name="theme"
              :label="$t('theme')"
              @update="val => tab = val.name"
            ></q-tab>
          </q-tabs>
        </div>
      </div>

      <q-form name="settings_form" id="settings_form">
        <q-tab-panels v-model="tab" animated>
          {% include "admin/_tab_funding.html" %} {% include
          "admin/_tab_users.html" %} {% include "admin/_tab_server.html" %} {%
          include "admin/_tab_security.html" %} {% include
          "admin/_tab_theme.html" %}
        </q-tab-panels>
      </q-form>
    </q-card>
  </div>
</div>

{% endblock %} {% block scripts %} {{ window_vars(user) }}
<script src="{{ static_url_for('static', 'js/admin.js') }}"></script>
{% endblock %}
