<template>
  <div class="actionItem" @click="openTicketEditor">
    <div class="actionItemDescription">
      <div class="actionLabel">{{ $t('cs.create.support.ticket') }}</div>
      <div class="actionDescription">
        <p>{{ $t('cs.create.support.ticket.description') }}</p>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  props: {
    activityId: {
      type: String,
      default: null,
    },
    message: {
      type: String,
      default: null,
    },
    maxMessageLength: {
      type: Number,
      default: 0,
    },
    templateParams: {
      type: Object,
      default: null,
    },
    files: {
      type: Array,
      default: null,
    },
  },
  methods: {
    openTicketEditor() {
      const url = `${eXo.env.portal.context}/g/:spaces:${eXo.env.portal.spaceGroup}/${eXo.env.portal.spaceName}/ticket`;
      localStorage.setItem('exo-activity-composer-message', this.message);
      localStorage.setItem('exo-activity-composer-attachments', JSON.stringify(this.files || []));
      window.open(url, '_blank');
    },
  },
};
</script>