<template>
  <div class="trialExperience-info">
    <div class="title">{{$t('resumeInfo:title:ClinicalTrialExperience')}}</div>
    <el-table :data="GCPList" border style="width: 100%" size="small">
      <template slot="empty">
        <span></span>
      </template>
      <el-table-column type="index" :label="$t('resumeInfo:label:No')" width="50" />
      <el-table-column prop="Phase" :label="$t('resumeInfo:label:Phase')" min-width="20" show-overflow-tooltip />
      <el-table-column
        prop="EvaluationCriteriaList"
        :label="$t('resumeInfo:label:ReviewCriteria')"
        min-width="40"
        show-overflow-tooltip
      >
        <template slot-scope="scope">
          {{ scope.row.EvaluationCriteriaList.length>0? scope.row.EvaluationCriteriaList.join(', '):'' }}
        </template>
      </el-table-column>
      <el-table-column
        prop="VisitReadingCount"
        :label="$t('resumeInfo:label:VisitReadingCount')"
        min-width="150"
        show-overflow-tooltip
      />
      <el-table-column
        prop="EvaluationContent"
        :label="$t('resumeInfo:label:EvaluationContent')"
        min-width="150"
        show-overflow-tooltip
      />
    </el-table>

    <el-form :model="form" class="demo-form-inline" size="small">
      <el-form-item :label="$t('resumeInfo:label:GCPCertificate')">
        <span>{{ GCP }}</span>
        <a
          v-if="form.GCP"
          href="#"
          class="view"
          @click.prevent="previewGCP()"
        >View</a>
      </el-form-item>

      <el-form-item :label="$t('resumeInfo:label:OtherRelevantExperience')">
        <el-input
          v-if="isEnglish"
          v-model="form.OtherClinicalExperience"
          type="textarea"
          autosize
          readonly
        />
        <el-input
          v-else
          v-model="form.OtherClinicalExperienceCN"
          type="textarea"
          autosize
          readonly
        />
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
export default {
  props: {
    trialExperience: {
      type: Object,
      default() {
        return {}
      }
    },
    isEnglish: {
      type: Boolean
    }
  },
  data() {
    return {
      GCPList: [],
      form: {},
      GCP: '',
      GCPPath: ''
    }
  },
  mounted() {
    this.GCPList = this.trialExperience.ClinicalTrialExperienceList
    this.form = this.trialExperience
    this.GCP = this.trialExperience.GCP ? 'Yes' : 'No'
    if (this.trialExperience.GCP) {
      this.GCPPath = this.trialExperience.GCPFullPath
    }
  },
  methods: {
    previewGCP() {
      if (this.GCPPath) {
        window.open(this.GCPPath, '_blank')
      }
    }
  }
}
</script>

<style lang="scss">
.trialExperience-info{
  padding:5px 15px;
  font-size:13px;
  .title{
    height: 30px;
    line-height: 30px;
    background-color: #9c9fa6;
    font-size: 14px;
    padding-left: 10px;
    color: #fff;
    margin: 10px 0;
  }
  .el-form-item--mini.el-form-item{
    margin-bottom: 0px;
  }
  .el-form-item--small.el-form-item{
    margin-bottom: 0px;
  }
  .el-form-item__content{
    font-size: 13px;
  }
  .el-form-item__label{
    font-size: 13px;
    color: #303133;
    font-weight: bold;
  }
}
</style>
