<template>
  <md-tab id="backendView" :md-icon="this.s_icon">
    <div class="md-layout md-alignment-bottom-center">
      <div class="md-layout-item md-size-30 md-small-size-100 md-alignment-bottom-center rounded-and-colored" style="z-index: 1">
        <h3 class="txt-innert" style="text-align: center; margin-top: 1%; margin-bottom: 0%; line-height: 1em">Разное</h3>
      </div>
    </div>
    <div class="md-layout md-alignment-bottom-center" style="margin-top: -1.5%">
      <div class="md-layout-item md-size-60 md-small-size-100 md-alignment-bottom-center rounded-only">
        <h5 style="padding: 0% 3%">Сборка Frontend от {{this.$API.builddate !== null ? new Date(this.$API.builddate).toLocaleString() : 'Dev Build'}}</h5>
        <h5 style="padding: 0% 3%">Сборка Backend от {{this.$API.stats["builddate"] !== null ? new Date(parseInt(this.$API.stats["builddate"])*1000).toLocaleString() : 'Dev Build'}}</h5>
        <h5 v-if="this.$API.player.success_auth === false" style="text-align: center; cursor: pointer; text-decoration-line: underline" v-on:click="openAW()">Ты можешь искать других игроков здесь, но сначала надо авторизоваться!</h5>
        <md-button v-else v-on:click="showFP()" class="btn-gosty">Найти игрока</md-button>
        <FindPlayer ref="fp"/>
        <AuthWindow ref="aw" />
        <md-button v-on:click="openDW()" class="btn-old">Привязать стим к дискорду</md-button>
        <DiscordWindow ref="dw"/>
      </div>
    </div>
  </md-tab>
</template>

<script>
import FindPlayer from "@/components/TabsMenuElements/BackendStatus/Components/FindPlayer.vue";
import AuthWindow from "@/components/Others/Auth/AuthWindow.vue";
import DiscordWindow from "@/components/Others/Auth/DiscordWindow.vue";

export default {
  name: "BackendStatus",
  components: {DiscordWindow, AuthWindow, FindPlayer},
  props: {
    s_icon: {
      type: String,
      default: require('@/assets/server.svg')
    }
  },
  methods: {
    showFP(){
      this.$refs.fp.showFPD();
    },
    openAW() {
      this.$refs.aw.openAW();
    },
    openDW() {this.$refs.dw.openDW();}
  }
}
</script>