2020-06-06 20:03:55 +02:00
|
|
|
<template>
|
|
|
|
<section class="campaign">
|
|
|
|
<header class="columns">
|
|
|
|
<div class="column is-8">
|
|
|
|
<p v-if="isEditing" class="tags">
|
|
|
|
<b-tag v-if="isEditing" :class="data.status">{{ data.status }}</b-tag>
|
|
|
|
<b-tag v-if="data.type === 'optin'" :class="data.type">{{ data.type }}</b-tag>
|
|
|
|
<span v-if="isEditing" class="has-text-grey-light is-size-7">
|
2020-12-19 11:55:52 +01:00
|
|
|
{{ $t('globals.fields.id') }}: {{ data.id }} /
|
|
|
|
{{ $t('globals.fields.uuid') }}: {{ data.uuid }}
|
2020-06-06 20:03:55 +02:00
|
|
|
</span>
|
|
|
|
</p>
|
|
|
|
<h4 v-if="isEditing" class="title is-4">{{ data.name }}</h4>
|
2020-12-19 11:55:52 +01:00
|
|
|
<h4 v-else class="title is-4">{{ $t('campaigns.newCampaign') }}</h4>
|
2020-06-06 20:03:55 +02:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="column">
|
|
|
|
<div class="buttons" v-if="isEditing && canEdit">
|
|
|
|
<b-button @click="onSubmit" :loading="loading.campaigns"
|
2020-12-19 11:55:52 +01:00
|
|
|
type="is-primary" icon-left="content-save-outline">
|
|
|
|
{{ $t('globals.buttons.saveChanges') }}
|
|
|
|
</b-button>
|
2020-06-06 20:03:55 +02:00
|
|
|
<b-button v-if="canStart" @click="startCampaign" :loading="loading.campaigns"
|
|
|
|
type="is-primary" icon-left="rocket-launch-outline">
|
2020-12-19 11:55:52 +01:00
|
|
|
{{ $t('campaigns.start') }}
|
2020-06-06 20:03:55 +02:00
|
|
|
</b-button>
|
|
|
|
<b-button v-if="canSchedule" @click="startCampaign" :loading="loading.campaigns"
|
|
|
|
type="is-primary" icon-left="clock-start">
|
2020-12-19 11:55:52 +01:00
|
|
|
{{ $t('campaigns.schedule') }}
|
2020-06-06 20:03:55 +02:00
|
|
|
</b-button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</header>
|
|
|
|
|
|
|
|
<b-loading :active="loading.campaigns"></b-loading>
|
|
|
|
|
|
|
|
<b-tabs type="is-boxed" :animated="false" v-model="activeTab">
|
2020-12-19 11:55:52 +01:00
|
|
|
<b-tab-item :label="$tc('globals.terms.campaign')" label-position="on-border"
|
|
|
|
icon="rocket-launch-outline">
|
2020-06-06 20:03:55 +02:00
|
|
|
<section class="wrap">
|
|
|
|
<div class="columns">
|
|
|
|
<div class="column is-7">
|
|
|
|
<form @submit.prevent="onSubmit">
|
2020-12-19 11:55:52 +01:00
|
|
|
<b-field :label="$t('globals.fields.name')" label-position="on-border">
|
2020-06-06 20:03:55 +02:00
|
|
|
<b-input :maxlength="200" :ref="'focus'" v-model="form.name" :disabled="!canEdit"
|
2021-01-23 14:24:33 +01:00
|
|
|
:placeholder="$t('globals.fields.name')" required></b-input>
|
2020-06-06 20:03:55 +02:00
|
|
|
</b-field>
|
|
|
|
|
2020-12-19 11:55:52 +01:00
|
|
|
<b-field :label="$t('campaigns.subject')" label-position="on-border">
|
2020-06-06 20:03:55 +02:00
|
|
|
<b-input :maxlength="200" v-model="form.subject" :disabled="!canEdit"
|
2020-12-19 11:55:52 +01:00
|
|
|
:placeholder="$t('campaigns.subject')" required></b-input>
|
2020-06-06 20:03:55 +02:00
|
|
|
</b-field>
|
|
|
|
|
2020-12-19 11:55:52 +01:00
|
|
|
<b-field :label="$t('campaigns.fromAddress')" label-position="on-border">
|
2020-06-06 20:03:55 +02:00
|
|
|
<b-input :maxlength="200" v-model="form.fromEmail" :disabled="!canEdit"
|
2020-12-19 11:55:52 +01:00
|
|
|
:placeholder="$t('campaigns.fromAddressPlaceholder')" required></b-input>
|
2020-06-06 20:03:55 +02:00
|
|
|
</b-field>
|
|
|
|
|
|
|
|
<list-selector
|
|
|
|
v-model="form.lists"
|
|
|
|
:selected="form.lists"
|
|
|
|
:all="lists.results"
|
|
|
|
:disabled="!canEdit"
|
2020-12-19 11:55:52 +01:00
|
|
|
:label="$t('globals.terms.lists')"
|
|
|
|
:placeholder="$t('campaigns.sendToLists')"
|
2020-06-06 20:03:55 +02:00
|
|
|
></list-selector>
|
|
|
|
|
2021-01-26 17:31:55 +01:00
|
|
|
<b-field :label="$tc('globals.terms.template')" label-position="on-border">
|
|
|
|
<b-select :placeholder="$tc('globals.terms.template')" v-model="form.templateId"
|
2020-06-06 20:03:55 +02:00
|
|
|
:disabled="!canEdit" required>
|
|
|
|
<option v-for="t in templates" :value="t.id" :key="t.id">{{ t.name }}</option>
|
|
|
|
</b-select>
|
|
|
|
</b-field>
|
|
|
|
|
2021-01-26 17:31:55 +01:00
|
|
|
<b-field :label="$tc('globals.terms.messenger')" label-position="on-border">
|
|
|
|
<b-select :placeholder="$tc('globals.terms.messenger')" v-model="form.messenger"
|
2020-09-20 13:01:24 +02:00
|
|
|
:disabled="!canEdit" required>
|
2021-02-13 08:04:36 +01:00
|
|
|
<option v-for="m in messengers"
|
2020-09-20 13:01:24 +02:00
|
|
|
:value="m" :key="m">{{ m }}</option>
|
|
|
|
</b-select>
|
|
|
|
</b-field>
|
|
|
|
|
2020-12-19 11:55:52 +01:00
|
|
|
<b-field :label="$t('globals.terms.tags')" label-position="on-border">
|
2020-06-06 20:03:55 +02:00
|
|
|
<b-taginput v-model="form.tags" :disabled="!canEdit"
|
2020-12-19 11:55:52 +01:00
|
|
|
ellipsis icon="tag-outline" :placeholder="$t('globals.terms.tags')" />
|
2020-06-06 20:03:55 +02:00
|
|
|
</b-field>
|
|
|
|
<hr />
|
|
|
|
|
2020-07-26 16:13:43 +02:00
|
|
|
<div class="columns">
|
2021-01-26 17:31:55 +01:00
|
|
|
<div class="column is-4">
|
2020-12-19 11:55:52 +01:00
|
|
|
<b-field :label="$t('campaigns.sendLater')">
|
|
|
|
<b-switch v-model="form.sendLater" :disabled="!canEdit" />
|
2020-07-26 16:13:43 +02:00
|
|
|
</b-field>
|
|
|
|
</div>
|
|
|
|
<div class="column">
|
|
|
|
<br />
|
2020-07-26 17:24:05 +02:00
|
|
|
<b-field v-if="form.sendLater"
|
2020-08-01 09:45:40 +02:00
|
|
|
:message="form.sendAtDate ? $utils.duration(Date(), form.sendAtDate) : ''">
|
2020-07-26 16:13:43 +02:00
|
|
|
<b-datetimepicker
|
|
|
|
v-model="form.sendAtDate"
|
|
|
|
:disabled="!canEdit"
|
2021-01-26 17:31:55 +01:00
|
|
|
:placeholder="$t('campaigns.dateAndTime')"
|
2020-07-26 16:13:43 +02:00
|
|
|
icon="calendar-clock"
|
|
|
|
:timepicker="{ hourFormat: '24' }"
|
|
|
|
:datetime-formatter="formatDateTime"
|
|
|
|
horizontal-time-picker>
|
|
|
|
</b-datetimepicker>
|
|
|
|
</b-field>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-06-06 20:03:55 +02:00
|
|
|
<hr />
|
|
|
|
|
|
|
|
<b-field v-if="isNew">
|
|
|
|
<b-button native-type="submit" type="is-primary"
|
2020-12-19 11:55:52 +01:00
|
|
|
:loading="loading.campaigns">{{ $t('campaigns.continue') }}</b-button>
|
2020-06-06 20:03:55 +02:00
|
|
|
</b-field>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
<div class="column is-4 is-offset-1">
|
|
|
|
<br />
|
|
|
|
<div class="box">
|
2020-12-19 11:55:52 +01:00
|
|
|
<h3 class="title is-size-6">{{ $t('campaigns.sendTest') }}</h3>
|
|
|
|
<b-field :message="$t('campaigns.sendTestHelp')">
|
|
|
|
<b-taginput v-model="form.testEmails"
|
2020-06-06 20:03:55 +02:00
|
|
|
:before-adding="$utils.validateEmail" :disabled="this.isNew"
|
2020-12-19 11:55:52 +01:00
|
|
|
ellipsis icon="email-outline" :placeholder="$t('campaigns.testEmails')" />
|
2020-06-06 20:03:55 +02:00
|
|
|
</b-field>
|
|
|
|
<b-field>
|
|
|
|
<b-button @click="sendTest" :loading="loading.campaigns" :disabled="this.isNew"
|
2020-12-19 11:55:52 +01:00
|
|
|
type="is-primary" icon-left="email-outline">
|
|
|
|
{{ $t('campaigns.send') }}
|
|
|
|
</b-button>
|
2020-06-06 20:03:55 +02:00
|
|
|
</b-field>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
</b-tab-item><!-- campaign -->
|
|
|
|
|
2021-01-26 17:31:55 +01:00
|
|
|
<b-tab-item :label="$t('campaigns.content')" icon="text" :disabled="isNew">
|
2021-01-30 10:29:21 +01:00
|
|
|
<editor
|
|
|
|
v-model="form.content"
|
|
|
|
:id="data.id"
|
|
|
|
:title="data.name"
|
|
|
|
:contentType="data.contentType"
|
|
|
|
:body="data.body"
|
|
|
|
:disabled="!canEdit"
|
|
|
|
/>
|
|
|
|
|
|
|
|
<div v-if="canEdit && form.content.contentType !== 'plain'" class="alt-body">
|
|
|
|
<p class="is-size-6 has-text-grey has-text-right">
|
|
|
|
<a v-if="form.altbody === null" href="#" @click.prevent="addAltBody">
|
|
|
|
<b-icon icon="text" size="is-small" /> {{ $t('campaigns.addAltText') }}
|
|
|
|
</a>
|
|
|
|
<a v-else href="#" @click.prevent="$utils.confirm(null, removeAltBody)">
|
|
|
|
<b-icon icon="trash-can-outline" size="is-small" />
|
|
|
|
{{ $t('campaigns.removeAltText') }}
|
|
|
|
</a>
|
|
|
|
</p>
|
|
|
|
<br />
|
|
|
|
<b-input v-if="form.altbody !== null" v-model="form.altbody"
|
|
|
|
type="textarea" :disabled="!canEdit" />
|
|
|
|
</div>
|
2020-06-06 20:03:55 +02:00
|
|
|
</b-tab-item><!-- content -->
|
|
|
|
</b-tabs>
|
|
|
|
</section>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import Vue from 'vue';
|
|
|
|
import { mapState } from 'vuex';
|
|
|
|
import dayjs from 'dayjs';
|
2021-01-30 10:29:21 +01:00
|
|
|
import htmlToPlainText from 'textversionjs';
|
|
|
|
|
2020-06-06 20:03:55 +02:00
|
|
|
import ListSelector from '../components/ListSelector.vue';
|
|
|
|
import Editor from '../components/Editor.vue';
|
|
|
|
|
|
|
|
export default Vue.extend({
|
2020-07-04 19:38:34 +02:00
|
|
|
components: {
|
|
|
|
ListSelector,
|
|
|
|
Editor,
|
|
|
|
},
|
2020-06-06 20:03:55 +02:00
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
isNew: false,
|
|
|
|
isEditing: false,
|
|
|
|
activeTab: 0,
|
|
|
|
|
|
|
|
data: {},
|
|
|
|
|
2020-11-21 11:41:59 +01:00
|
|
|
// IDs from ?list_id query param.
|
|
|
|
selListIDs: [],
|
|
|
|
|
2020-06-06 20:03:55 +02:00
|
|
|
// Binds form input values.
|
|
|
|
form: {
|
|
|
|
name: '',
|
|
|
|
subject: '',
|
2021-02-13 08:04:36 +01:00
|
|
|
fromEmail: '',
|
2020-06-06 20:03:55 +02:00
|
|
|
templateId: 0,
|
|
|
|
lists: [],
|
|
|
|
tags: [],
|
|
|
|
sendAt: null,
|
|
|
|
content: { contentType: 'richtext', body: '' },
|
2021-01-30 10:29:21 +01:00
|
|
|
altbody: null,
|
2020-06-06 20:03:55 +02:00
|
|
|
|
|
|
|
// Parsed Date() version of send_at from the API.
|
|
|
|
sendAtDate: null,
|
|
|
|
sendLater: false,
|
|
|
|
|
|
|
|
testEmails: [],
|
|
|
|
},
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
formatDateTime(s) {
|
|
|
|
return dayjs(s).format('YYYY-MM-DD HH:mm');
|
|
|
|
},
|
|
|
|
|
2021-01-30 10:29:21 +01:00
|
|
|
addAltBody() {
|
|
|
|
this.form.altbody = htmlToPlainText(this.form.content.body);
|
|
|
|
},
|
|
|
|
|
|
|
|
removeAltBody() {
|
|
|
|
this.form.altbody = null;
|
|
|
|
},
|
|
|
|
|
|
|
|
onSubmit() {
|
|
|
|
if (this.isNew) {
|
|
|
|
this.createCampaign();
|
|
|
|
} else {
|
|
|
|
this.updateCampaign();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-06-06 20:03:55 +02:00
|
|
|
getCampaign(id) {
|
2020-07-09 19:59:59 +02:00
|
|
|
return this.$api.getCampaign(id).then((data) => {
|
|
|
|
this.data = data;
|
2020-10-17 20:08:29 +02:00
|
|
|
this.form = {
|
|
|
|
...this.form,
|
|
|
|
...data,
|
|
|
|
|
|
|
|
// The structure that is populated by editor input event.
|
|
|
|
content: { contentType: data.contentType, body: data.body },
|
|
|
|
};
|
2020-06-06 20:03:55 +02:00
|
|
|
|
2020-07-09 19:59:59 +02:00
|
|
|
if (data.sendAt !== null) {
|
2020-06-06 20:03:55 +02:00
|
|
|
this.form.sendLater = true;
|
2020-07-09 19:59:59 +02:00
|
|
|
this.form.sendAtDate = dayjs(data.sendAt).toDate();
|
2020-06-06 20:03:55 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
sendTest() {
|
|
|
|
const data = {
|
|
|
|
id: this.data.id,
|
|
|
|
name: this.form.name,
|
|
|
|
subject: this.form.subject,
|
|
|
|
lists: this.form.lists.map((l) => l.id),
|
|
|
|
from_email: this.form.fromEmail,
|
2020-09-20 13:01:24 +02:00
|
|
|
messenger: this.form.messenger,
|
2020-06-06 20:03:55 +02:00
|
|
|
type: 'regular',
|
|
|
|
tags: this.form.tags,
|
|
|
|
template_id: this.form.templateId,
|
2020-09-20 13:01:24 +02:00
|
|
|
content_type: this.form.content.contentType,
|
|
|
|
body: this.form.content.body,
|
2021-01-30 10:29:21 +01:00
|
|
|
altbody: this.form.content.contentType !== 'plain' ? this.form.altbody : null,
|
2020-06-06 20:03:55 +02:00
|
|
|
subscribers: this.form.testEmails,
|
|
|
|
};
|
|
|
|
|
|
|
|
this.$api.testCampaign(data).then(() => {
|
2020-12-19 11:55:52 +01:00
|
|
|
this.$utils.toast(this.$t('campaigns.testSent'));
|
2020-06-06 20:03:55 +02:00
|
|
|
});
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
|
|
|
|
createCampaign() {
|
|
|
|
const data = {
|
|
|
|
name: this.form.name,
|
|
|
|
subject: this.form.subject,
|
|
|
|
lists: this.form.lists.map((l) => l.id),
|
|
|
|
from_email: this.form.fromEmail,
|
|
|
|
content_type: 'richtext',
|
|
|
|
messenger: 'email',
|
|
|
|
type: 'regular',
|
|
|
|
tags: this.form.tags,
|
|
|
|
template_id: this.form.templateId,
|
|
|
|
// body: this.form.body,
|
|
|
|
};
|
|
|
|
|
2020-07-09 19:59:59 +02:00
|
|
|
this.$api.createCampaign(data).then((d) => {
|
|
|
|
this.$router.push({ name: 'campaign', hash: '#content', params: { id: d.id } });
|
2020-06-06 20:03:55 +02:00
|
|
|
});
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
|
|
|
|
async updateCampaign(typ) {
|
|
|
|
const data = {
|
|
|
|
name: this.form.name,
|
|
|
|
subject: this.form.subject,
|
|
|
|
lists: this.form.lists.map((l) => l.id),
|
|
|
|
from_email: this.form.fromEmail,
|
2020-09-20 13:01:24 +02:00
|
|
|
messenger: this.form.messenger,
|
2020-06-06 20:03:55 +02:00
|
|
|
type: 'regular',
|
|
|
|
tags: this.form.tags,
|
|
|
|
send_later: this.form.sendLater,
|
|
|
|
send_at: this.form.sendLater ? this.form.sendAtDate : null,
|
|
|
|
template_id: this.form.templateId,
|
|
|
|
content_type: this.form.content.contentType,
|
|
|
|
body: this.form.content.body,
|
2021-01-30 10:29:21 +01:00
|
|
|
altbody: this.form.content.contentType !== 'plain' ? this.form.altbody : null,
|
2020-06-06 20:03:55 +02:00
|
|
|
};
|
|
|
|
|
2020-12-19 11:55:52 +01:00
|
|
|
let typMsg = 'globals.messages.updated';
|
2020-06-06 20:03:55 +02:00
|
|
|
if (typ === 'start') {
|
2020-12-19 11:55:52 +01:00
|
|
|
typMsg = 'campaigns.started';
|
2020-06-06 20:03:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// This promise is used by startCampaign to first save before starting.
|
|
|
|
return new Promise((resolve) => {
|
2020-07-09 19:59:59 +02:00
|
|
|
this.$api.updateCampaign(this.data.id, data).then((d) => {
|
|
|
|
this.data = d;
|
2020-12-19 11:55:52 +01:00
|
|
|
this.$utils.toast(this.$t(typMsg, { name: d.name }));
|
2020-06-06 20:03:55 +02:00
|
|
|
resolve();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
// Starts or schedule a campaign.
|
|
|
|
startCampaign() {
|
|
|
|
let status = '';
|
|
|
|
if (this.canStart) {
|
|
|
|
status = 'running';
|
|
|
|
} else if (this.canSchedule) {
|
|
|
|
status = 'scheduled';
|
|
|
|
} else {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.$utils.confirm(null,
|
|
|
|
() => {
|
|
|
|
// First save the campaign.
|
|
|
|
this.updateCampaign().then(() => {
|
|
|
|
// Then start/schedule it.
|
|
|
|
this.$api.changeCampaignStatus(this.data.id, status).then(() => {
|
|
|
|
this.$router.push({ name: 'campaigns' });
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
computed: {
|
2021-02-13 08:04:36 +01:00
|
|
|
...mapState(['settings', 'loading', 'lists', 'templates']),
|
2020-06-06 20:03:55 +02:00
|
|
|
|
|
|
|
canEdit() {
|
|
|
|
return this.isNew
|
|
|
|
|| this.data.status === 'draft' || this.data.status === 'scheduled';
|
|
|
|
},
|
|
|
|
|
|
|
|
canSchedule() {
|
|
|
|
return this.data.status === 'draft' && this.data.sendAt;
|
|
|
|
},
|
|
|
|
|
|
|
|
canStart() {
|
|
|
|
return this.data.status === 'draft' && !this.data.sendAt;
|
|
|
|
},
|
2020-11-21 11:41:59 +01:00
|
|
|
|
|
|
|
selectedLists() {
|
|
|
|
if (this.selListIDs.length === 0 || !this.lists.results) {
|
|
|
|
return [];
|
|
|
|
}
|
|
|
|
|
|
|
|
return this.lists.results.filter((l) => this.selListIDs.indexOf(l.id) > -1);
|
|
|
|
},
|
2021-02-13 08:04:36 +01:00
|
|
|
|
|
|
|
messengers() {
|
|
|
|
return ['email', ...this.settings.messengers.map((m) => m.name)];
|
|
|
|
},
|
2020-11-21 11:41:59 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
watch: {
|
|
|
|
selectedLists() {
|
|
|
|
this.form.lists = this.selectedLists;
|
|
|
|
},
|
2020-06-06 20:03:55 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
mounted() {
|
2021-02-13 08:04:36 +01:00
|
|
|
this.form.fromEmail = this.settings['app.from_email'];
|
|
|
|
|
2020-06-06 20:03:55 +02:00
|
|
|
const { id } = this.$route.params;
|
|
|
|
|
|
|
|
// New campaign.
|
|
|
|
if (id === 'new') {
|
|
|
|
this.isNew = true;
|
2020-11-21 11:41:59 +01:00
|
|
|
|
|
|
|
if (this.$route.query.list_id) {
|
|
|
|
// Multiple list_id query params.
|
|
|
|
let strIds = [];
|
|
|
|
if (typeof this.$route.query.list_id === 'object') {
|
|
|
|
strIds = this.$route.query.list_id;
|
|
|
|
} else {
|
|
|
|
strIds = [this.$route.query.list_id];
|
|
|
|
}
|
|
|
|
|
|
|
|
this.selListIDs = strIds.map((v) => parseInt(v, 10));
|
|
|
|
}
|
2020-06-06 20:03:55 +02:00
|
|
|
} else {
|
|
|
|
const intID = parseInt(id, 10);
|
|
|
|
if (intID <= 0 || Number.isNaN(intID)) {
|
2020-12-19 11:55:52 +01:00
|
|
|
this.$utils.toast(this.$t('campaigns.invalid'));
|
2020-06-06 20:03:55 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
this.isEditing = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get templates list.
|
2020-07-09 19:59:59 +02:00
|
|
|
this.$api.getTemplates().then((data) => {
|
|
|
|
if (data.length > 0) {
|
2020-06-06 20:03:55 +02:00
|
|
|
if (!this.form.templateId) {
|
2020-07-09 19:59:59 +02:00
|
|
|
this.form.templateId = data.find((i) => i.isDefault === true).id;
|
2020-06-06 20:03:55 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
// Fetch campaign.
|
|
|
|
if (this.isEditing) {
|
2020-07-05 10:38:30 +02:00
|
|
|
this.getCampaign(id).then(() => {
|
|
|
|
if (this.$route.hash === '#content') {
|
|
|
|
this.activeTab = 1;
|
|
|
|
}
|
|
|
|
});
|
2020-09-20 13:01:24 +02:00
|
|
|
} else {
|
|
|
|
this.form.messenger = 'email';
|
2020-06-06 20:03:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
this.$refs.focus.focus();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|