<template>
  <div>
    <CTitleBanner title="Operazioni su DB:"></CTitleBanner>
    <div
      class="row justify-center q-gutter-sm q-list--bordered center_img"
      style="max-width: 600px"
    >
      <CMyFieldDb
        title="SITO_ONLINE"
        mykey="SITO_ONLINE"
        :serv="false"
        :type="costanti.FieldType.boolean"
      >
      </CMyFieldDb>
      <br />

      <CMyFieldDb
        title="ABILITA CRONTAB (1 ora)"
        mykey="CRONTAB"
        :serv="false"
        :type="costanti.FieldType.boolean"
      >
      </CMyFieldDb>
      <br />

      <!--
      <div class="row">
        <q-btn label="Crea Utenti Test" color="primary" @click="EseguiFunz('creaUtentiTest')"></q-btn>
        <br>
      </div>


      <div class="row">
        <q-btn label="Passa i codici Telefoni sul campo cell" color="primary"
               @click="EseguiFunz('changeCellInt')"></q-btn>
        <br></div>
      <div class="row">
        <q-btn label="Trasforma le email tutte in minuscolo" color="primary"
               @click="EseguiFunz('changeEmailLowerCase')"></q-btn>
        <br></div>
      <div class="row">
        <q-btn label="IMPOSTARE A TUTTI PAYPAL" color="primary" @click="EseguiFunz('ImpostaATuttiPaypal')"></q-btn><br>
      </div>
    <div class="row">
      <q-btn label="NUM_TESS A 1" color="primary" @click="EseguiFunz('numtessUno')"></q-btn><br>
    </div>

      -->

      <div class="row">
        <!--<q-btn label="CORREGGI NUM_TESS" color="primary" @click="EseguiFunz('Corregginumtess')"></q-btn>
        <br>-->
        <!--<q-btn label="CORREGGI DATA GIFT CHAT" color="primary" @click="EseguiFunz('CorreggiDataGiftChat')"></q-btn>
        <br>-->
      </div>
      <div class="row">
        <!--<q-btn label="Inizializza ListaIngresso" color="negative"
               @click="EseguiFunz('initListaIngresso')"></q-btn>
        <br>-->
      </div>
      <!--
            <div class="row">
              <q-btn label="Elimina Navi" color="negative" @click="EseguiFunz('delNavi')"></q-btn><br>
            </div>
      -->
      <!--<div class="row">
          <q-btn label="Elimina Navi non Partite" color="negative"
                 @click="EseguiFunz('delNaviNoStarted')"></q-btn>
          <br>
      </div>-->

      <!--
      <div class="row">
        <q-btn label="Rigenera (Elim, Genera Graduat, Add Navi Temp" color="positive" size="lg"
               @click="EseguiFunz('rigeneraTutto')"></q-btn>

      </div>
      <br>
      <div class="row">
        <q-btn label="Elimina Navi Provvisorie" color="negative"
               @click="EseguiFunz('delNaviProvvisorie')"></q-btn>

      </div>
      <q-btn label="Genera Graduatoria" color="primary"
             @click="EseguiFunz('GeneraGraduatoria')"></q-btn>
      <br>
      <q-btn label="1) Aggiungi in Navi Temporanee" color="primary" @click="EseguiFunz('creaNavi')"></q-btn>
      <br>
      <div class="q-pa-sm row">
        <CDateTime
          :value.sync="date_start"
          :label="$t('cal.eventstartdatetime')"
          :readonly="false">
        </CDateTime>
        <q-input v-model="numpersone" type="number" autofocus label="Num Persone to Add"
                 style="width: 100px;"></q-input>
        <q-btn label="2) CREA NAVI PERSISTENTI" color="primary" @click="EseguiFunz('CreaNaviPersistenti')"></q-btn>
        <br>

      </div>
      <div class="row">
        <q-btn label="Statistiche" color="warning" @click="EseguiFunz('visuStat')"></q-btn>

      </div>

      <div class="row">
        <q-btn label="Pulisci chi non è presente in Nave" color="positive"
               @click="EseguiFunz('pulisciNonPresenzeInNave')"></q-btn>
        <br>
      </div>
      <div class="row">
        <q-btn label="Visualizza Lista Nave" color="primary" @click="EseguiFunz('visuListaNave')"></q-btn>

      </div>

      <q-btn label="Aggiorna Indice Graduatoria" color="primary"
             @click="EseguiFunz('AggiornaIndiceGraduatoria')"></q-btn>
      <br>
      <q-btn label="Visu Navi con utenti Eliminati" color="primary"
             @click="EseguiFunz('visuNaviUtentiEliminati')"></q-btn>
      <br>
      <div class="row">
        <q-btn label="0) ELIMINA VECCHI LISTEINGRESSO !" color="negative"
               @click="EseguiFunz('eliminaListeIngressoNascoste')"></q-btn>
        <br>
      </div>
      <div class="row">
        <q-btn label="CONVERTI SUBACCOUNT !" color="negative"
               @click="EseguiFunz('convSubAccount')"></q-btn>
        <br>
      </div>
      <div class="row">
        <q-btn label="FLAGGA GLI UTENTI CON NAVI NON PRESENTI!" color="primary"
               @click="EseguiFunz('flagUtentiNaviNonPresenti')"></q-btn>
        <br>
      </div>
      <div class="row">
        <q-btn label="GENERA FLOTTE!" color="primary"
               @click="EseguiFunz('generaFlotte')"></q-btn>
        <br>
      </div>
      <div class="row">
        <q-btn label="METTI SOGNO E PAYPAL (SOLO VISU)" color="primary"
               @click="EseguiFunz('mettiSognoePaypalView')"></q-btn>
        <br>
        <q-btn label="METTI SOGNO E PAYPAL" color="primary"
               @click="EseguiFunz('mettiSognoePaypal')"></q-btn>
        <br>
      </div>

      <div class="row">
        <q-btn label="1) CONVERTI TUTTA LA STRUTTURA NEL NUOVO SISTEMA !" color="negative"
               @click="EseguiFunz('creaTessituraeConv')"></q-btn>
        <br>
      </div>
      <div class="row">
        <q-btn label="2) CONVERTI Navi Num_Tess 3 e 5 in Record di ListaIngresso" color="negative"
               @click="EseguiFunz('convNaviTessinListaIngressoRec')"></q-btn>
        <br>
      </div>
      <div class="row">
        <q-btn label="3) Rendi Visibile i Record Nascosti di ListaINGRESSO" color="negative"
               @click="EseguiFunz('RendiVisibileIrecordNascosti')"></q-btn>
        <br>
      </div>
      <br>
      <br>

      <div class="row">
        <q-input v-model="riga" type="number" autofocus label="Riga" style="width: 50px;"></q-input>
        <q-input v-model="col" type="number" autofocus label="Col" style="width: 50px;"></q-input>
        <q-btn label="Visualizza Nave da 8" color="primary" @click="EseguiFunz('visuPlacca')"></q-btn>
        <br>
        <q-btn label="Visualizza Nave" color="primary" @click="EseguiFunz('visuNave')"></q-btn>
        <br>
      </div>
      <div class="row">
        <q-input v-model="placca" type="textarea" autofocus label="Placca" autogrow
                 style="width: 500px; height: 400px;"></q-input>
        <br>
      </div>
      -->
    </div>

    <div class="row">
      <q-btn
        label="Correggi Tabella Hours con userId"
        color="negative"
        @click="EseguiFunz('CorreggiTabHours')"
      ></q-btn>
      <br />
    </div>
    <div class="row">
      <q-btn
        label="setVerifiedByAportadorToALL"
        color="negative"
        @click="EseguiFunz('setVerifiedByAportadorToALL')"
      ></q-btn>
      <br />
    </div>
    <div class="row">
      <q-btn
        label="1. Cancella Tabelle (Sectors, SectorGoods, Skills, Goods)"
        color="negative"
        @click="EseguiFunz('emptyTabCatServiziBeni')"
      ></q-btn>
      <br />
    </div>
    <div class="row">
      <q-btn
        label="1. Cancella e Ricrea tutte le Tabelle (Sector, Skill, SubSkill, Contribtype, AdType)"
        color="negative"
        @click="EseguiFunz('emptyDbSkill')"
      ></q-btn>
      <br />
    </div>
    <div class="row">
      <q-btn
        label="1. Cancella e Ricrea le Tabelle (City, Province)"
        color="negative"
        @click="EseguiFunz('ricreaTabCitiesProvinces')"
      ></q-btn>
      <br />
    </div>
    <div class="row">
      <q-btn
        label="2. Popola Tutte le Tabelle vuote (o incomplete)"
        color="negative"
        @click="EseguiFunz('PopulateTables')"
      ></q-btn>
      <br />
    </div>
    <div class="row">
      <q-btn
        label="10. Elimina la Tabella PRODUCTS e PRODUCTINFOS !)"
        color="negative"
        @click="EseguiFunz('dropProducts')"
      ></q-btn>
      <br />
    </div>
    <div class="row">
      <q-btn
        label="10. Elimina la Tabella CATPROD !)"
        color="negative"
        @click="EseguiFunz('dropCatProd')"
      ></q-btn>
      <q-btn
        label="10. Elimina la Tabella SUBCATPROD !)"
        color="negative"
        @click="EseguiFunz('dropSubCatProd')"
      ></q-btn>
      <br />
    </div>

    <div class="row">
      <q-btn
        label="11. Elimina tutti gli ORDINI ! (Orders, Orderscart, Cart) !)"
        color="negative"
        @click="EseguiFunz('dropAllOrders')"
      ></q-btn>
      <br />
    </div>
    <div class="row">
      <q-btn
        label="12. Elimina tutti i Carrelli (Cart) !)"
        color="negative"
        @click="EseguiFunz('dropAllCarts')"
      ></q-btn>
      <q-btn
        label="CopyPriceToCalc"
        color="positive"
        @click="EseguiFunz('CopyPriceToCalc')"
      ></q-btn>
      <q-btn
        label="SistemaGasOrdine"
        color="positive"
        @click="EseguiFunz('SistemaGasOrdine')"
      ></q-btn>
      <br />
    </div>

    <div class="row">
      <q-btn
        label="copyFrom1To14"
        color="negative"
        @click="EseguiFunz('copyFrom1To14')"
      ></q-btn>
      <br />
    </div>

    <div class="row">
      <q-btn
        label="Rewrite Cities Table"
        color="negative"
        @click="EseguiFunz('RewriteCitiesTable')"
      ></q-btn>
      <br />
    </div>

    <div class="row">
      <q-btn
        label="Rewrite Levels Table"
        color="negative"
        @click="EseguiFunz('RewriteLevelsTable')"
      ></q-btn>
      <br />
    </div>

    <div class="row">
      <q-btn
        label="Rewrite Provinces Table"
        color="negative"
        @click="EseguiFunz('RewriteProvincesTable')"
      ></q-btn>
      <br />
    </div>
    <div class="row">
      <q-btn
        label="Rewrite ContribType"
        color="negative"
        @click="EseguiFunz('RewriteContribType')"
      ></q-btn>
      <br />
    </div>
    <div class="row">
      <q-input
        v-model="search_username"
        label="Username Search"
        style="width: 300px"
      ></q-input>
      <q-input
        v-model="replace_username"
        label="Username Replace"
        style="width: 300px"
      ></q-input>

      <q-btn
        label="Replace Username"
        color="primary"
        @click="
          EseguiFunz('ReplaceUsername', search_username, replace_username)
        "
      ></q-btn>
      <q-btn
        label="Esci da tutti i Circuiti a saldo Zero"
        color="primary"
        @click="EseguiFunz('ExitFromAllCircuitWithZero', search_username)"
      ></q-btn>
      <q-btn
        label="Replace AportadorSolidario"
        color="primary"
        @click="
          EseguiFunz(
            'replaceAportadorSolidario',
            search_username,
            replace_username
          )
        "
      ></q-btn>
      <q-btn
        label="Replace Circuit"
        color="primary"
        @click="
          EseguiFunz('ReplaceCircuitName', search_username, replace_username)
        "
      ></q-btn>
      <br />
    </div>
    <div class="row">
      <q-input
        v-model="search"
        label="stringa da cercare"
        style="width: 300px"
      ></q-input>
      <q-btn
        label="Cerca Stringa su tutto il DB"
        color="primary"
        @click="EseguiFunz('SearchString', search)"
      ></q-btn>
      <br />
    </div>
    <div class="row">
      <q-btn
        label="Create Account Circuits"
        color="primary"
        @click="
          EseguiFunz('CreateAccountCircuits', search_username, replace_username)
        "
      ></q-btn>
      <br />
    </div>
    <div class="row">
      <q-btn
        label="Replace All Circuits with 'Circuito RIS nomeprovincia'"
        color="primary"
        @click="EseguiFunz('ReplaceAllCircuits')"
      ></q-btn>
      <br />
    </div>
    <div class="row">
      <q-btn
        label="Elimina CatProds e SubCatProds"
        color="negative"
        @click="EseguiFunz('eliminaCatProds')"
      ></q-btn>
      <br />
    </div>
    <div class="row">
      <q-input
        v-model="valmin"
        label="Fiducia Concessa"
        style="width: 300px"
      ></q-input>
      <q-input v-model="valmax" label="Max Qta" style="width: 300px"></q-input>
    </div>
    <div class="row">
      <q-btn
        label="Imposta Min e Max per TUTTI i Conti Personali"
        color="primary"
        @click="EseguiFunz('ImpostaMinMaxPersonali', '', '', valmin, valmax)"
      ></q-btn>
    </div>
    <div class="row">
      <q-select
        rounded
        outlined
        v-model="circuitId"
        :options="circuitStore.getCircuitsLabelValue()"
        label="Circuiti"
        emit-value
        map-options
      >
      </q-select>
      <q-btn
        label="Imposta Min e Max per TUTTI i Conti Personali di un Circuito"
        color="primary"
        @click="
          EseguiFunz(
            'ImpostaMinMaxPersonaliCircuito',
            '',
            '',
            valmin,
            valmax,
            circuitId
          )
        "
      ></q-btn>
    </div>
    <div class="row">
      <q-btn
        label="Imposta Min e Max per TUTTI i Conti Comunitari"
        color="primary"
        @click="EseguiFunz('ImpostaMinMaxComunitari', '', '', valmin, valmax)"
      ></q-btn>
    </div>
    <div class="row">
      <q-btn
        label="Imposta Min e Max per TUTTI i Conti Collettivi"
        color="primary"
        @click="EseguiFunz('ImpostaMinMaxCollettivi', '', '', valmin, valmax)"
      ></q-btn>
      <br />
    </div>
    <div class="row">
      <q-input
        v-model="defpersmin"
        label="DEFAULT Fiducia Concessa"
        style="width: 300px"
      ></q-input>
      <q-input
        v-model="defpersmax"
        label="DEFAULT  Max Qta"
        style="width: 300px"
      ></q-input>
      <q-select
        rounded
        outlined
        v-model="circuitId"
        :options="circuitStore.getCircuitsLabelValue()"
        label="Circuiti"
        emit-value
        map-options
      >
      </q-select>
    </div>
    <div class="row">
      <q-btn
        label="Imposta Min e Max per i Circuiti Personali di DEFAULT"
        color="primary"
        @click="
          EseguiFunz(
            'ImpostaDefMinMaxPersonali',
            '',
            '',
            defpersmin,
            defpersmax,
            circuitId
          )
        "
      ></q-btn>
    </div>
    <div class="row">
      <q-input
        v-model="defmin"
        label="DEFAULT Fiducia Concessa"
        style="width: 300px"
      ></q-input>
      <q-input
        v-model="defmax"
        label="DEFAULT  Max Qta"
        style="width: 300px"
      ></q-input>
    </div>
    <q-select
      rounded
      outlined
      v-model="circuitId"
      :options="circuitStore.getCircuitsLabelValue()"
      label="Circuiti"
      emit-value
      map-options
    >
    </q-select>
    <div class="row">
      <q-btn
        label="Imposta Min e Max per i Circuiti Collettivi di DEFAULT"
        color="primary"
        @click="
          EseguiFunz(
            'ImpostaDefMinMaxCollettivi',
            '',
            '',
            defmin,
            defmax,
            circuitId
          )
        "
      ></q-btn>
      <br />
    </div>
    <div class="row">
      <q-btn
        label="Abilita tutti i Circuiti !"
        color="primary"
        @click="EseguiFunz('AbilitaTuttiCircuiti', '', '')"
      ></q-btn>
      <br />
    </div>
    <div class="row">
      <q-btn
        label="Azzera i regolamenti dei Circuiti"
        color="primary"
        @click="EseguiFunz('AzzeraRegolamentiTuttiCircuiti', '', '')"
      ></q-btn>
      <br />
    </div>
    <div class="row">
      <q-btn
        label="Crea Tutti i Circuiti"
        color="primary"
        @click="EseguiFunz('createAllCircuits', '', '')"
      ></q-btn>
      <br /><q-btn
        label="Correggi i Circuiti (togli i null)"
        color="primary"
        @click="EseguiFunz('correggiCircuitiANull', '', '')"
      ></q-btn>
      <br /><q-btn
        label="Correggi i ProductType in ProductTypes"
        color="primary"
        @click="EseguiFunz('correggiProductTypes', '', '')"
      ></q-btn>
      <br /><q-btn
        label="Sostituisci i 'img' in 'imagefile"
        color="primary"
        @click="EseguiFunz('replaceProductImgToImageFile', '', '')"
      ></q-btn>
      <br /><q-btn
        label="Rimuovi upload/products/"
        color="primary"
        @click="EseguiFunz('removeUploadProducts_Path', '', '')"
      ></q-btn>
      <br />
    </div>
    <div class="row">
      <q-btn
        label="Converti Tabelle: myskills, mygoods da INT a STRING"
        color="primary"
        @click="EseguiFunz('ConvTablesFromIntToString', '', '')"
      ></q-btn>
      <br />
    </div>
    <div class="row">
      <q-btn
        label="Removeinteger"
        color="primary"
        @click="EseguiFunz('Removeinteger', '', '')"
      ></q-btn>
      <br />
    </div>

    <q-spinner v-if="incaricamento" color="primary" size="3em" :thickness="2" />

    <q-field stack-label dense>
      <template v-slot:control>
        <div class="self-center full-width no-outline text-center" tabindex="0">
          {{ ris }}
        </div>
      </template>
    </q-field>
    <q-btn
      label="Set strProv by IdCity (table circuits)"
      color="negative"
      @click="EseguiFunz('setstrProvByIdCityCircuits')"
    ></q-btn>
  </div>
  <div class="row">
    <q-btn
      label="Aggiorna newRecordsFav - UNA VOLTA SOLA"
      color="negative"
      @click="EseguiFunz('newRecordsFav')"
    ></q-btn>
    <br />
  </div>
  <div class="row">
    <q-btn
      label="Rimuovi i profile.favorite, bookmark, attend, seen"
      color="negative"
      @click="EseguiFunz('removeRecordsFav')"
    ></q-btn>
    <br />
  </div>
  <div class="row">
    <q-btn
      label="updateReactionsCounts"
      color="primary"
      @click="EseguiFunz('updateReactionsCounts')"
    ></q-btn>
    <br />
  </div>
  <div class="row">
    <q-btn
      label="updateSaldoAndTransato_AllAccounts"
      color="primary"
      @click="EseguiFunz('updateSaldoAndTransato_AllAccounts')"
    ></q-btn>
    <br />
  </div>
  <div class="row">
    <q-btn
      label="GenerateVapiKey"
      color="primary"
      @click="EseguiFunz('GenerateVapiKey')"
    ></q-btn>
    <br />
  </div>
  <div class="row">
    <q-btn
      label="generateBotMenuRecords"
      color="primary"
      @click="EseguiFunz('generateBotMenuRecords')"
    ></q-btn>
    <br />
  </div>
  <div class="row">
    <q-btn
      label="removeRegulations"
      color="primary"
      @click="EseguiFunz('removeRegulations')"
    ></q-btn>
    <br />
  </div>
  <div class="row">
    <q-btn
      label="Setta AdType 'Offro' In Ospitalità"
      color="primary"
      @click="EseguiFunz('SettaAdTypeOffro_In_Hosps')"
    ></q-btn>
    <br />
  </div>
  <div class="row">
    <q-btn
      label="AbilitaNewsletterALL"
      color="primary"
      @click="EseguiFunz('AbilitaNewsletterALL')"
    ></q-btn>
    <br />
  </div>
  <div class="row">
    <q-btn
      label="Genera CSV Ordine Prodotti"
      color="primary"
      @click="EseguiFunz('GeneraCSVOrdineProdotti')"
    ></q-btn>
    <br />
  </div>
  <div class="row">
    <q-btn
      label="Remove DeletedOrders InOrderscart"
      color="primary"
      @click="EseguiFunz('RemoveDeletedOrdersInOrderscart')"
    ></q-btn>
    <br />
  </div>
  <div class="row">
    <q-btn
      label="Check Transazioni Circuiti"
      color="primary"
      @click="EseguiFunz('CheckTransazioniCircuiti')"
    ></q-btn>
    <br />
  </div>
  <div class="row">
    <q-btn
      label="Rimuovi Transazioni Pendenti"
      color="primary"
      @click="EseguiFunz('RemovePendentTransactions')"
    ></q-btn>
    <br />
  </div>
  <div class="row">
    <q-btn
      label="Rimuovi Vecchie Notifiche (indietro di 3 mesi)"
      color="primary"
      @click="EseguiFunz('RemoveOldNotif90')"
    ></q-btn>
    <br />
  </div>
  <div class="row">
    <q-btn
      label="Rimuovi Vecchie Notifiche (indietro di 1 mese)"
      color="primary"
      @click="EseguiFunz('RemoveOldNotif30')"
    ></q-btn>
    <br />
  </div>
  <div class="row">
    <q-btn
      label="Correggi Transazioni Circuiti"
      color="negative"
      @click="EseguiFunz('CorreggiTransazioniCircuiti')"
    ></q-btn>
    <br />
  </div>
  <div class="row">
    <q-btn
      label="Svuota Tutti Gli Accessi Online Con Token"
      color="negative"
      @click="EseguiFunz('SvuotaTuttiGliAccessiOnlineConToken')"
    ></q-btn>
    <br />
  </div>
  <div class="row">
    <q-btn
      label="Aggiorna Coordinate Provincia"
      color="positive"
      @click="EseguiFunz('UpdateCoordProv')"
    ></q-btn>
    <q-btn
      label="insertGeojsonToMongoDB"
      color="positive"
      @click="EseguiFunz('insertGeojsonToMongoDB')"
    ></q-btn>
    <q-btn
      label="Lista Tabelle Database (spazio occupato)"
      color="positive"
      @click="EseguiFunz('listCollectionsBySize')"
    ></q-btn>
    <q-btn
      label="MyElem (imposta come chiave l'ID della Pagina e non il path !)"
      color="positive"
      @click="EseguiFunz('MyElemSetIdPageInsteadThePah')"
    ></q-btn>
    <q-btn
      label="Abilita a Tutti la Newsletter news_on !"
      color="positive"
      @click="EseguiFunz('EnableNewsOn_ToAll')"
    ></q-btn>
    <q-btn
      label="getGM_Lista_Argomenti"
      color="positive"
      @click="getListaArg()"
    ></q-btn>
    <q-btn
      label="getGM_Tabella Collane"
      color="positive"
      @click="
        getTabellaDaGM({
          nameTable: 'T_Web_Collane',
          numrec: 500,
          outhtml: true,
        })
      "
    ></q-btn>
    <br />
  </div>

  <div class="results-container">
    <h2 class="results-title">Risultati:</h2>
    <div class="results-content">
      {{ risultato }}
    </div>
    <h2 v-if="!!risultatoHTML" class="results-title">Risultati HTML:</h2>
    <div v-if="!!risultatoHTML" v-html="risultatoHTML"></div>
  </div>
  <br />
  <br />
  <br />
</template>
<script lang="ts" src="./dbop.ts">
</script>

<style lang="scss" scoped>
@import "./dbop";
</style>
