<template>
  <el-dialog
    :visible.sync="isPreviewing"
    custom-class="c-preview schedule"
    :before-close="onCloseScheduleDialog"
    append-to-body
    v-on="$attrs"
  >
    <schedule
      v-if="scheduleId"
      class="l-flex__auto has-padding"
      :schedule="scheduleId"
    />
  </el-dialog>
</template>

<script>
export default {
  name: 'ScheduleDialog',
  data () {
    return {
      scheduleId: null,
      isPreviewing: false
    }
  },
  methods: {
    show (id) {
      this.scheduleId = id
      this.isPreviewing = true
    },
    onCloseScheduleDialog () {
      this.scheduleId = null
      this.isPreviewing = false
    }
  }
}
</script>
