<template>
  <div v-if="myaccount && circuit">
    <q-card-section v-if="!onlysaldo">
      <div class="text-h6">{{ t('groups.infoaccount') }}</div>
    </q-card-section>

    <q-separator />

    
    <CSaldo
      v-if="tools.isUserOk() && myaccount"
      :account="myaccount"
      :symbol="circuit.symbol"
      :color="circuit.color"
      :saldo="myaccount.saldo"
      :qtarem="myaccount ? circuitStore.getRemainingCoinsToSend(myaccount) : 0"
    >
    </CSaldo>

    <q-card-section v-if="!onlysaldo">
      <div v-if="myaccount.date_created" class="container">
        <q-icon name="fas fa-lightbulb" class="iconcirc"></q-icon>
        {{
          $t('shared.createddate', {
            date: tools.getstrDateYY(myaccount.date_created),
          })
        }}
      </div>
      <div
        v-if="
          !!myaccount.date_updated &&
          tools.getstrDate(myaccount.date_updated) !==
            tools.getstrDate(myaccount.date_created)
        "
        class="container"
      >
        <q-icon name="fas fa-pencil-alt" class="iconcirc"></q-icon>
        <span class="element">{{
          $t('shared.lastmodify', {
            date: tools.getstrDateYY(myaccount.date_updated),
          })
        }}</span>
      </div>

      <div :class="$q.screen.lt.sm ? '' : 'row'">
        <div class="sezioni">
          <CCurrencyV2
            :symbol="tools.getSymbolByCircuit(circuit)"
            :color="tools.getColorByCircuit(circuit)"
            color_border="red"
            v-model="myaccount.fidoConcesso"
            icon="fas fa-battery-quarter"
            :label="t('circuit.fido_scoperto_default')"
            :tips="t('circuit.fido_scoperto_default_tips')"
            :paramTypeAccount="costanti.ParamTypeAccount.FIDO_CONCESSO"
            :myrecparam="myaccount"
            :admin="admin"
            @save="save"
          >
          </CCurrencyV2>
        </div>
        <div class="sezioni">
          <CCurrencyV2
            :symbol="tools.getSymbolByCircuit(circuit)"
            :color="tools.getColorByCircuit(circuit)"
            color_border="green"
            v-model="myaccount.qta_maxConcessa"
            icon="fas fa-battery-quarter"
            :label="t('circuit.qta_max_default')"
            :tips="t('circuit.qta_max_default_tips')"
            :paramTypeAccount="costanti.ParamTypeAccount.QTA_MAXCONCESSA"
            :myrecparam="myaccount"
            :admin="admin"
            @save="save"
          >
          </CCurrencyV2>
        </div>
        <div v-if="myaccount.totTransato" class="sezioni">
          <CCurrencyValue
            :symbol="tools.getSymbolByCircuit(circuit)"
            :color="tools.getColorByCircuit(circuit)"
            color_border="blue"
            v-model="myaccount.totTransato"
            icon="fas fa-battery-quarter"
            :label="t('circuit.totTransato')"
            :tips="t('circuit.totTransato_tips')"
          >
          </CCurrencyValue>
        </div>
      </div>
    </q-card-section>
  </div>
</template>

<script lang="ts" src="./CUserInfoAccount.ts">
</script>

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