<template>
  <div class="card-container">
    <div class="card-content">
      <el-form
        label-position="left"
        label-width="140px"
        style="width: 100%;">
        <div class="section-title">Feedback</div>
        <el-row :gutter="20">
          <el-col :xs="24" :md="14">
            <el-form-item
              label="Type of Feedback:">
              <el-input
                class="add-text"
                v-model="feedbackInfo.typeOfFeedback"
                readonly/>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :md="10">
            <el-form-item
              label="Feedback By:">
              <el-input
                class="add-text"
                v-model="feedbackInfo.nickName"
                readonly/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :xs="24" :md="14">
            <el-form-item
              label="Feedback:">
              <el-input
                class="add-text"
                :autosize="autosize"
                v-model="feedbackInfo.feedback"
                type="textarea"
                readonly/>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :md="10">
            <el-form-item
              label="Feedback Time:">
              <el-input
                class="add-text"
                v-model="feedbackInfo.feedbackTime"
                readonly/>
            </el-form-item>
          </el-col>
        </el-row>
        <div class="section-title">Photos</div>
        <div class="feedback-photo">
          <img
            class="feedback-img"
            :src="baseURL + feedbackInfo.feedbackImgOne"
            v-if="feedbackInfo.feedbackImgOne"/>
          <img
            class="feedback-img"
            :src="baseURL + feedbackInfo.feedbackImgOne"
            v-if="feedbackInfo.feedbackImgOne"/>
          <img
            class="feedback-img"
            :src="baseURL + feedbackInfo.feedbackImgOne"
            v-if="feedbackInfo.feedbackImgOne"/>
        </div>
        <div class="hr-full"/>
        <div class="buttons">
          <el-button
            type="primary"
            class="cancel-button"
            @click="handleBackClick">
            Back
          </el-button>
        </div>
      </el-form>
    </div>
  </div>
</template>

<script>
  import { mapState } from 'vuex'
  import {baseURL} from '../../http/http'
  import feedback from '../../http/api/feedback'
  export default {
    data() {
      return {
        baseURL: baseURL,
        autosize: {
          minRows: 3,
          maxRows: 10,
        }
      }
    },
    computed: {
      ...mapState('provider', ['feedbackInfo'])
    },
    created() {
      this.readedFeedback()
    },
    methods: {
      readedFeedback() {
        feedback.readFeedback(this.feedbackInfo.feedbackPk)
        .then(res => {
          
        }).catch(err => {
          
        })
      },      
      handleBackClick() {
        this.$router.go(-1)
      }
    }
  }
</script>

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

  .card-container {
    width: 100%;
    padding: 20px 60px;
    min-height: $mainAppMinHeight;
    background-color: #F0F5FC;
  }
  .card-container {
    width: 100%;
    padding: 20px 60px;
    min-height: $mainAppMinHeight;
    background-color: #F0F5FC;
  }
  .card-content {
    padding: 15px 80px;
    border-radius: 6px;
    background-color: white;
  }
  .section-title {
    color: #333;
    margin-top: 20px;
    margin-bottom: 30px;
    font-size: 16px;
    user-select: none;
    line-height: 24px;
    font-weight: 500;
    font-family: sans-serif;
    text-transform: uppercase;
  }
  .add-text {
    width: 100%;
    max-width: 400px;
  }
  .add-text ::v-deep .el-textarea__inner {
    font-family: sans-serif;
  }
  .hr {
    height: 2px;
    margin: 10px -40px;
    background-color: #F0F5FC;
  }
  .hr-full {
    height: 2px;
    margin: 20px -80px;
    background-color: #F0F5FC;
  }
  .rate-list-view {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
  }
  .rate-text {
    max-width: 150px;
    padding-right: 14px;
  }
  .list-item-icon {
    width: 30px;
    height: 30px;
    cursor: pointer;
    margin: 0 10px 22px;
  }
  .buttons {
    padding-top: 15px;
    padding-bottom: 30px;
  }
  .feedback-photo {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding-bottom: 20px;
  }
  .feedback-img {
    width: 180px;
    margin-right: 20px;
  }
  @media screen and (max-width: 500px) {
    .card-container {
      padding: 0px;
    }
    .card-content {
      padding: 15px 40px;
    }
    .feedback-photo {
      justify-content: center;
    }
    .feedback-img {
      width: 80vw;
      margin-top: 10px;
      margin-right: 0;
    }
  }
</style>
