<template>
  <CMyPage
    title="Configura Sito"
    imgbackground="images/calendario_eventi.jpg"
    sizes="max-height: 120px"
  >
    <div class="q-ma-sm q-gutter-sm q-pa-xs">
      <div v-if="mysite">
        <q-banner
          rounded
          class="bg-primary text-white"
          color="primary q-title"
          style="text-align: center"
        >
          <p class="mybanner">{{ mysite.name }}</p>
        </q-banner>

        <CMyFieldDb
          title="Attivo"
          table="sites"
          mykey="active"
          :id="mysite._id"
          :rec="mysite"
          :type="costanti.FieldType.boolean"
        >
        </CMyFieldDb>

        <CMyFieldDb
          title="Email Admin"
          table="sites"
          :id="mysite._id"
          :rec="mysite"
          mykey="adminemail"
          debounce="1000"
          :type="costanti.FieldType.string"
        >
        </CMyFieldDb>

        <CMyFieldDb
          title="Titolo"
          table="sites"
          :id="mysite._id"
          :rec="mysite"
          mykey="name"
          debounce="1000"
          :type="costanti.FieldType.string"
        >
        </CMyFieldDb>

        <CMyFieldDb
          title="Descrizione"
          debounce="1000"
          table="sites"
          :id="mysite._id"
          :rec="mysite"
          :type="costanti.FieldType.string"
          mykey="description"
        >
        </CMyFieldDb>

        <CMyFieldDb
          title="Parole Chiave"
          table="sites"
          :id="mysite._id"
          :rec="mysite"
          mykey="keywords"
          :type="costanti.FieldType.string"
          debounce="1000"
        >
        </CMyFieldDb>

        <q-tabs v-model="tab" inline-label class="bg-yellow shadow-2">
          <q-tab name="server" label="Server" icon="mail" />
          <q-tab name="contacts" label="Contatti" icon="mail" />
          <q-tab name="pages" label="Pagine" icon="doc" />
          <q-tab name="footer" label="Footer" icon="doc" />
          <q-tab name="policy" label="Policy" icon="doc" />
        </q-tabs>

        <q-tab-panels v-model="tab" animated>
          <q-tab-panel name="contacts">
            <CMyFieldDb
              table="sites"
              title="Facebook"
              :id="mysite._id"
              :rec="mysite"
              mykey="contacts"
              mysubkey="facebook"
              debounce="1000"
              :type="costanti.FieldType.string"
            >
            </CMyFieldDb>
            <CMyFieldDb
              table="sites"
              title="Instagram"
              :id="mysite._id"
              :rec="mysite"
              mykey="contacts"
              mysubkey="instagram"
              debounce="1000"
              :type="costanti.FieldType.string"
            >
            </CMyFieldDb>
            <CMyFieldDb
              table="sites"
              title="Cell"
              :id="mysite._id"
              :rec="mysite"
              mykey="contacts"
              mysubkey="cell"
              debounce="1000"
              :type="costanti.FieldType.string"
            >
            </CMyFieldDb>
            <CMyFieldDb
              table="sites"
              title="Info2"
              :id="mysite._id"
              :rec="mysite"
              mykey="contacts"
              mysubkey="info2"
              debounce="1000"
              :type="costanti.FieldType.string"
            >
            </CMyFieldDb>
            <CMyFieldDb
              table="sites"
              title="Whatsapp"
              :id="mysite._id"
              :rec="mysite"
              mykey="contacts"
              mysubkey="whatsapp"
              debounce="1000"
              :type="costanti.FieldType.string"
            >
            </CMyFieldDb>
            <CMyFieldDb
              table="sites"
              title="Whatsapp_home"
              :id="mysite._id"
              :rec="mysite"
              mykey="contacts"
              mysubkey="whatsapp_home"
              debounce="1000"
              :type="costanti.FieldType.boolean"
            >
            </CMyFieldDb>
            <CMyFieldDb
              table="sites"
              title="Telegram"
              :id="mysite._id"
              :rec="mysite"
              mykey="contacts"
              mysubkey="telegram"
              debounce="1000"
              :type="costanti.FieldType.string"
            >
            </CMyFieldDb>
            <CMyFieldDb
              table="sites"
              title="YouTube"
              :id="mysite._id"
              :rec="mysite"
              mykey="contacts"
              mysubkey="youtube"
              debounce="1000"
              :type="costanti.FieldType.string"
            >
            </CMyFieldDb>
            <CMyFieldDb
              table="sites"
              title="Email"
              :id="mysite._id"
              :rec="mysite"
              mykey="contacts"
              mysubkey="email"
              debounce="1000"
              :type="costanti.FieldType.string"
            >
            </CMyFieldDb>
            <CMyFieldDb
              table="sites"
              title="Address"
              :id="mysite._id"
              :rec="mysite"
              mykey="contacts"
              mysubkey="address"
              debounce="1000"
              :type="costanti.FieldType.string"
            >
            </CMyFieldDb>
            <CMyFieldDb
              table="sites"
              title="Map"
              :id="mysite._id"
              :rec="mysite"
              mykey="contacts"
              mysubkey="map"
              debounce="1000"
              :type="costanti.FieldType.string"
            >
            </CMyFieldDb>
          </q-tab-panel>
          <q-tab-panel name="server">
            <CMyFieldDb
              title="Host"
              table="sites"
              :id="mysite._id"
              :rec="mysite"
              mykey="host"
              debounce="1000"
              :type="costanti.FieldType.string"
            >
            </CMyFieldDb>

            <CMyFieldDb
              title="Host Test"
              table="sites"
              :id="mysite._id"
              :rec="mysite"
              mykey="host_test"
              debounce="1000"
              :type="costanti.FieldType.string"
            >
            </CMyFieldDb>

            <CMyFieldRec
              title="Opzioni Sito"
              table="sites"
              :id="mysite._id"
              :rec="mysite"
              field="confsite.options"
              :canEdit="true"
              :canModify="true"
            >
            </CMyFieldRec>
          </q-tab-panel>
          <q-tab-panel name="pages">
            <CMyFieldDb
              title="Font"
              table="sites"
              :id="mysite._id"
              :rec="mysite"
              mykey="confpages"
              mysubkey="font"
              debounce="1000"
              @save="save"
              jointable="fonts_installed"
              :type="costanti.FieldType.select"
            >
            </CMyFieldDb>
            <CMyFieldDb
              title="Colore Barra"
              table="sites"
              :id="mysite._id"
              :rec="mysite"
              mykey="confpages"
              mysubkey="col_toolbar"
              debounce="1000"
              @save="saveCol"
              :type="costanti.FieldType.color"
            >
            </CMyFieldDb>
            <CMyFieldDb
              title="Colore Sfondo Footer"
              table="sites"
              :id="mysite._id"
              :rec="mysite"
              mykey="confpages"
              mysubkey="col_bgfooter"
              debounce="1000"
              @save="saveBgCol"
              :type="costanti.FieldType.color"
            >
            </CMyFieldDb>
            <CMyFieldDb
              title="Mostra Scelta Dark"
              table="sites"
              :id="mysite._id"
              :rec="mysite"
              mykey="confpages"
              mysubkey="show_darkopt"
              debounce="1000"
              @save="saveShowDark"
              :type="costanti.FieldType.boolean"
            >
            </CMyFieldDb>
          </q-tab-panel>
          <q-tab-panel name="footer">
            <CMyFieldDb
              table="sites"
              title="Mostra Bottone Home"
              :id="mysite._id"
              :rec="mysite"
              mykey="footer_mobile"
              mysubkey="show_buttHome"
              debounce="1000"
              :type="costanti.FieldType.boolean"
            >
            </CMyFieldDb>
            <CMyFieldDb
              table="sites"
              title="Mostra Bottone Profilo"
              :id="mysite._id"
              :rec="mysite"
              mykey="footer_mobile"
              mysubkey="show_profile"
              debounce="1000"
              :type="costanti.FieldType.boolean"
            >
            </CMyFieldDb>
          </q-tab-panel>
          <q-tab-panel name="policy">
            <CMyFieldDb
              table="sites"
              :title="$t('policy.show')"
              :id="mysite._id"
              :rec="mysite"
              mykey="policy"
              mysubkey="show"
              debounce="1000"
              :type="costanti.FieldType.boolean"
            >
            </CMyFieldDb>
            <CMyFieldDb
              table="sites"
              :title="$t('policy.owneremail')"
              :id="mysite._id"
              :rec="mysite"
              mykey="policy"
              mysubkey="owneremail"
              debounce="1000"
              :type="costanti.FieldType.string"
            >
            </CMyFieldDb>
            <CMyFieldDb
              table="sites"
              :title="$t('policy.siteName')"
              :id="mysite._id"
              :rec="mysite"
              mykey="policy"
              mysubkey="siteName"
              debounce="1000"
              :type="costanti.FieldType.string"
            >
            </CMyFieldDb>
            <CMyFieldDb
              table="sites"
              :title="$t('policy.ownerDataName')"
              :id="mysite._id"
              :rec="mysite"
              mykey="policy"
              mysubkey="ownerDataName"
              debounce="1000"
              :type="costanti.FieldType.string"
            >
            </CMyFieldDb>
            <CMyFieldDb
              table="sites"
              :title="$t('policy.managerData')"
              :id="mysite._id"
              :rec="mysite"
              mykey="policy"
              mysubkey="managerData"
              debounce="1000"
              :type="costanti.FieldType.string"
            >
            </CMyFieldDb>
            <CMyFieldDb
              table="sites"
              :title="$t('policy.includeData')"
              :id="mysite._id"
              :rec="mysite"
              mykey="policy"
              mysubkey="includeData"
              debounce="1000"
              :type="costanti.FieldType.string"
            >
            </CMyFieldDb>
            <CMyFieldDb
              table="sites"
              :title="$t('policy.url')"
              :id="mysite._id"
              :rec="mysite"
              mykey="policy"
              mysubkey="url"
              debounce="1000"
              :type="costanti.FieldType.string"
            >
            </CMyFieldDb>
            <CMyFieldDb
              table="sites"
              :title="$t('policy.lastdataupdate')"
              :id="mysite._id"
              :rec="mysite"
              mykey="policy"
              mysubkey="lastdataupdate"
              debounce="1000"
              :type="costanti.FieldType.string"
            >
            </CMyFieldDb>
            <CMyFieldDb
              table="sites"
              :title="$t('policy.country')"
              :id="mysite._id"
              :rec="mysite"
              mykey="policy"
              mysubkey="country"
              debounce="1000"
              :type="costanti.FieldType.string"
            >
            </CMyFieldDb>
          </q-tab-panel>
        </q-tab-panels>

        <div v-if="false">
          <CMyFieldDb
            title="BOT Telegram"
            mykey="TELEG_BOT_LINK"
            :serv="false"
            :type="costanti.FieldType.string"
          >
          </CMyFieldDb>

          <CMyFieldDb
            title="Nome del BOT Telegram"
            mykey="TELEG_BOT_NAME"
            :serv="false"
            :type="costanti.FieldType.string"
            debounce="1000"
          >
          </CMyFieldDb>
          <CMyFieldDb
            title="BOT Telegram (per Test)"
            mykey="TELEG_BOT_LINK_TEST"
            :serv="false"
            debounce="1000"
            :type="costanti.FieldType.string"
          >
          </CMyFieldDb>
          <CMyFieldDb
            title="Chat di Supporto (Help)"
            mykey="TELEGRAM_SUPPORT"
            :serv="false"
            :type="costanti.FieldType.string"
            debounce="1000"
          >
          </CMyFieldDb>
          <CMyFieldDb
            title="Sito ONLINE"
            mykey="SITO_ONLINE"
            :serv="false"
            :type="costanti.FieldType.boolean"
            debounce="1000"
          >
          </CMyFieldDb>
        </div>
      </div>
    </div>
  </CMyPage>
</template>
<script lang="ts" src="./confsite.ts">
</script>
<style lang="scss" scoped>
@import 'confsite.scss';
</style>
