<template>
  <div>
    <div class="dimmed modal25" onClick="tmpltRejectViewPopClose();"></div>

    <div class="popup modal25 popup_form price">
      <div class="pop-head">
        <h3 class="pop-tit">알림톡 템플릿 반려</h3>
      </div>
      <div class="info">
      </div>
      <table class="table-r">
        <thead>
        <tr>
          <th>내용</th>
        </tr>
        </thead>
        <tbody>
        <tr v-for="(option, i) in list" v-bind:key="i">
          <td>{{ option.lmtYm }}</td>
        </tr>
        <tr v-if="list.length === 0">
          <td>반려 내용이 없습니다.</td>
        </tr>
        </tbody>
      </table>
      <div class="popup-btn2">
        <button class="btn-default" @click="tmpltRejectViewPopClose();">닫기</button>
      </div>
    </div>
  </div>
</template>

<script>
//import api from '@/service/api';
import channelMgtApi from "../service/channelMgtApi.js";

export default {
  name: "tmpltRejeTmpltRejectViewPopctViewPop",
  data() {
    return {
      row: {},
      list: []
    }
  },
  components: {
  },
  created() {
  },
  methods: {
    // 모달 띄우기
    async tmpltRejectViewPopOpen(sndrprofKey, tmpltKey) {
      this.row.sndrprofKey = sndrprofKey;
      this.row.tmpltKey = tmpltKey;
      try {
        const response = await channelMgtApi.tmpltRejectList(this.row);
        const result = response.data;
        if (result != null && result.retCode == "0000") {
          console.log(result);
          //this.list = result.data.list;
        }
        var dimmed = document.getElementsByClassName('modal25');
        for (var i = 0; i < dimmed.length; i++) {
          dimmed[i].style.display = 'block';
        }
      } catch (err) {
        alert('오류가 발생하였습니다');
        var dimmed = document.getElementsByClassName('modal25');
        for (var i = 0; i < dimmed.length; i++) {
          dimmed[i].style.display = 'none';
        }
      }
    },
    // 모달 끄기
    tmpltRejectViewPopClose() {
      var dimmed = document.getElementsByClassName('modal25');
      for (var i = 0; i < dimmed.length; i++) {
        dimmed[i].style.display = 'none';
      }
    }
  }
}
</script>