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