<template>
  <el-card style="margin: 2px 1px;">
    <div slot="header" class="clearfix">
      <span>{{ $t('profile.personalInformation') }}</span>
    </div>

    <div class="user-profile">
      <div class="box-center"><!--tool.getArImage(user.avatar, '/files/')-->
				<div class="block" >
					<img sizes="80" src="@/assets/user_images/avatar.png" alt="" style="border-radius: 50%"/>
				</div>
      </div>
      <div class="box-center" style="margin-top: 15px">
        <div class="user-name text-center">{{ user.name }}</div>
<!--        <div class="user-role text-center text-muted">{{ user.role | uppercaseFirst }}</div>-->
      </div>
    </div>

    <div class="user-bio">
			<div class="user-skills user-bio-section">
				<div class="user-bio-section-header"></div>
				<div class="user-bio-section-body">
					<div class="progress-item" style="margin-top: 15px;">
						<el-row>
							<el-col :span="12">
								<div class="grid-content bg-purple">
									<i class="el-icon-time"></i>
									<span>{{ $t('profile.currentSystemTime') }}</span>
								</div>
							</el-col>
							<el-col :span="12">
								<div class="grid-content bg-purple-light">
									<span>{{ nowDateTime }}</span>
								</div>
							</el-col>
						</el-row>
					</div>

					<div class="progress-item" style="margin-top: 15px;">
						<el-row>
							<el-col :span="12">
								<div class="grid-content bg-purple">
									<i class="el-icon-picture-outline-round"></i>
									<span>{{ $t('profile.currentPayCycle') }}</span>
								</div>
							</el-col>
							<el-col :span="12">
								<div class="grid-content bg-purple-light">
									<span>{{ user.periodNum }}</span>
								</div>
							</el-col>
						</el-row>
					</div>

					<div class="progress-item" style="margin-top: 15px;">
						<el-row>
							<el-col :span="12">
								<div class="grid-content bg-purple">
									<i class="el-icon-star-on"></i>
									<span>{{ $t('profile.memberLevel') }}</span>
								</div>
							</el-col>
							<el-col :span="12">
								<div class="grid-content bg-purple-light">
									<span>{{ user.decLv }}</span>
								</div>
							</el-col>
						</el-row>
					</div>

					<div class="progress-item" style="margin-top: 15px;">
						<el-row>
							<el-col :span="12">
								<div class="grid-content bg-purple">
									<i class="el-icon-medal"></i>
									<span>{{ $t('profile.highestDirector') }}</span>
								</div>
							</el-col>
							<el-col :span="12">
								<div class="grid-content bg-purple-light">
									<span>{{ user.empLv }}</span>
								</div>
							</el-col>
						</el-row>
					</div>

					<div class="progress-item" style="margin-top: 15px;">
						<el-row>
							<el-col :span="12">
								<div class="grid-content bg-purple">
									<i class="el-icon-medal-1"></i>
									<span>{{ $t('profile.eliteLevel') }}</span>
								</div>
							</el-col>
							<el-col :span="12">
								<div class="grid-content bg-purple-light">
									<span>{{ user.eliteLv }}</span>
								</div>
							</el-col>
						</el-row>
					</div>
				</div>
			</div>
    </div>
  </el-card>
</template>

<script>
import PanThumb from '@/components/PanThumb'
import tool from '@/utils/tool'

export default {
  components: { PanThumb },
  props: {
    user: {
      type: Object,
      default: () => {
        return {
          name: '',
          email: '',
          avatar: '',
          role: '',
					decLv: '',
					empLv: '',
					crownLv: '',
					periodNum: '',
          eliteLv: ''
        }
      }
    },
  },
	data() {
		return {
			tool: tool,
      nowTime: this.getTime()
    }
	},
  computed: {
    nowDateTime() {
      return this.$moment(this.nowTime * 1000).utcOffset('+0100' ).format('YYYY-MM-DD HH:mm:ss') + ' (WAT)'
    },
  },
  mounted() {
    this.calcTime()
  },
  methods: {
    getTime() {
      let dateObj = new Date()
      return Math.round(dateObj.getTime() / 1000 + (0 * 86400))
    },
    calcTime () {
      let obj = this
      setInterval(function () {
        obj.nowTime += 1
      }, 1000)
    },
  }
}
</script>

<style lang="scss" scoped>
.box-center {
  margin: 0 auto;
  display: table;
}

.text-muted {
  color: #777;
}

.user-profile {
  .user-name {
    font-weight: bold;
  }

  .box-center {
    padding-top: 10px;
  }

  .user-role {
    padding-top: 10px;
    font-weight: 400;
    font-size: 14px;
  }

  .box-social {
    padding-top: 30px;

    .el-table {
      border-top: 1px solid #dfe6ec;
    }
  }

  .user-follow {
    padding-top: 20px;
  }
}

.user-bio {
  margin-top: 20px;
  color: #606266;

  span {
    padding-left: 4px;
  }

  .user-bio-section {
    font-size: 14px;
    padding: 15px 0;

    .user-bio-section-header {
      border-bottom: 1px solid #dfe6ec;
      padding-bottom: 10px;
      margin-bottom: 10px;
      font-weight: bold;
    }
  }
}
</style>
