<template>
  <div class="trialExperience-info">
    <div class="title">Clinical Trial Experience</div>
    <el-table :data="GCPList" border style="width: 100%" size="small">
      <el-table-column type="index" label="No." width="50" />
      <el-table-column prop="Phase" label="Phase" min-width="20" show-overflow-tooltip />
      <el-table-column
        prop="EvaluationCriteriaList"
        label="Review Criteria"
        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="Visit Reading Count"
        min-width="150"
        show-overflow-tooltip
      />
      <el-table-column
        prop="EvaluationContent"
        label="Indication"
        min-width="150"
        show-overflow-tooltip
      />
    </el-table>

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

      <el-form-item label="Other Relevant Experience:">
        <el-input :maxLength="$inputMax"
          v-if="isEnglish"
          v-model="form.OtherClinicalExperience"
          type="textarea"
          autosize
          readonly
        />
        <el-input :maxLength="$inputMax"
          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>
