<template>
  <main id="main" style="margin-top: 200px; padding-bottom: 50px;">
    <div class="container">
      <div class="form">
        <div class="row">
          <div class="col">
            <div class="section-header">
              <h2>Email Tempaltes</h2>
            </div>
          </div>
        </div>
        <div class="row">
          <div class="col">
            <listView
              :items="list"
              :showNew="true"
              :editable="true"
              :deleteable="true"
              :hideSearch="true"
              :showColumnChooser="false"
              :displayColumns="columns"
              :sortKey="'description'"
              @onEdit="Edit"
              @onDelete="Delete"
              @onNew="New"
            />
          </div>
        </div>
      </div>
    </div>
  </main>
</template>

<script>
/* eslint-disable */
import { mapActions, mapState } from 'vuex'
import listView from '../shared/listView'
export default {
  name: 'MailTempaltes',
  components: {
    listView,
  },
  data() {
    return {}
  },
  created() {
    this.getList()
  },
  computed: {
    ...mapState('template', ['list', 'item']),
  },
  methods: {
    ...mapActions('template', ['getList', 'deleteMailTemplate']),
    New() {
      this.$router.push('/emailTemplates/New/')
    },
    Edit(item) {
      this.$router.push({
        path: `/emailTemplates/Edit/${item.id}`,
      })
    },
    Delete(item) {
      this.deleteMailTemplate(item.id)
    },
  },
}
</script>

<style lang="scss" scoped></style>
