2019-08-14 09:48:44 +00:00
|
|
|
<template>
|
2019-10-29 07:20:54 +00:00
|
|
|
<div
|
|
|
|
class="small-3 columns channel"
|
|
|
|
:class="{ inactive: !isActive(channel) }"
|
|
|
|
@click="onItemClick"
|
|
|
|
>
|
|
|
|
<img
|
|
|
|
v-if="channel === 'facebook'"
|
|
|
|
src="~dashboard/assets/images/channels/facebook.png"
|
|
|
|
/>
|
|
|
|
<img
|
|
|
|
v-if="channel === 'twitter'"
|
|
|
|
src="~dashboard/assets/images/channels/twitter.png"
|
|
|
|
/>
|
|
|
|
<img
|
|
|
|
v-if="channel === 'telegram'"
|
|
|
|
src="~dashboard/assets/images/channels/telegram.png"
|
|
|
|
/>
|
2020-07-21 06:45:24 +00:00
|
|
|
<img
|
|
|
|
v-if="channel === 'api'"
|
|
|
|
src="~dashboard/assets/images/channels/api.png"
|
|
|
|
/>
|
|
|
|
<img
|
|
|
|
v-if="channel === 'email'"
|
|
|
|
src="~dashboard/assets/images/channels/email.png"
|
|
|
|
/>
|
2019-10-29 07:20:54 +00:00
|
|
|
<img
|
|
|
|
v-if="channel === 'line'"
|
|
|
|
src="~dashboard/assets/images/channels/line.png"
|
|
|
|
/>
|
|
|
|
<img
|
|
|
|
v-if="channel === 'website'"
|
|
|
|
src="~dashboard/assets/images/channels/website.png"
|
|
|
|
/>
|
2020-04-05 16:41:27 +00:00
|
|
|
<img
|
|
|
|
v-if="channel === 'twilio'"
|
|
|
|
src="~dashboard/assets/images/channels/twilio.png"
|
|
|
|
/>
|
2019-10-29 07:20:54 +00:00
|
|
|
<h3 class="channel__title">
|
|
|
|
{{ channel }}
|
|
|
|
</h3>
|
2019-08-14 09:48:44 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
export default {
|
2019-10-29 07:20:54 +00:00
|
|
|
props: {
|
|
|
|
channel: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
2020-07-06 05:46:19 +00:00
|
|
|
enabledFeatures: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
|
|
|
},
|
2019-08-14 09:48:44 +00:00
|
|
|
},
|
|
|
|
methods: {
|
2019-10-29 07:20:54 +00:00
|
|
|
isActive(channel) {
|
2020-07-06 05:46:19 +00:00
|
|
|
if (Object.keys(this.enabledFeatures) === 0) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (channel === 'facebook') {
|
|
|
|
return this.enabledFeatures.channel_facebook;
|
|
|
|
}
|
|
|
|
if (channel === 'twitter') {
|
2020-07-09 10:58:09 +00:00
|
|
|
return this.enabledFeatures.channel_twitter;
|
2020-07-06 05:46:19 +00:00
|
|
|
}
|
2020-07-21 06:45:24 +00:00
|
|
|
if (channel === 'email') {
|
|
|
|
return this.enabledFeatures.channel_email;
|
|
|
|
}
|
|
|
|
return ['website', 'twilio', 'api'].includes(channel);
|
2019-10-29 07:20:54 +00:00
|
|
|
},
|
|
|
|
onItemClick() {
|
|
|
|
if (this.isActive(this.channel)) {
|
|
|
|
this.$emit('channel-item-click', this.channel);
|
|
|
|
}
|
2019-08-14 09:48:44 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|