chore: Add bot in campaign add/edit form (#2246)
* fix empty message condition in campaign table * add bot in campaign * locale changes * review fixes
This commit is contained in:
parent
627a89faf0
commit
b5ef9f14e1
5 changed files with 35 additions and 11 deletions
|
@ -52,6 +52,7 @@
|
||||||
},
|
},
|
||||||
"LIST": {
|
"LIST": {
|
||||||
"LOADING_MESSAGE": "Loading campaigns...",
|
"LOADING_MESSAGE": "Loading campaigns...",
|
||||||
|
"404": "There are no campaigns created for this inbox.",
|
||||||
"TABLE_HEADER": {
|
"TABLE_HEADER": {
|
||||||
"TITLE": "Title",
|
"TITLE": "Title",
|
||||||
"MESSAGE": "Message",
|
"MESSAGE": "Message",
|
||||||
|
@ -69,6 +70,9 @@
|
||||||
"STATUS": {
|
"STATUS": {
|
||||||
"ENABLED": "Enabled",
|
"ENABLED": "Enabled",
|
||||||
"DISABLED": "Disabled"
|
"DISABLED": "Disabled"
|
||||||
|
},
|
||||||
|
"SENDER": {
|
||||||
|
"BOT": "Bot"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
{{ $t('CAMPAIGN.ADD.FORM.SENT_BY.LABEL') }}
|
{{ $t('CAMPAIGN.ADD.FORM.SENT_BY.LABEL') }}
|
||||||
<select v-model="selectedSender">
|
<select v-model="selectedSender">
|
||||||
<option
|
<option
|
||||||
v-for="sender in senderList"
|
v-for="sender in sendersAndBotList"
|
||||||
:key="sender.name"
|
:key="sender.name"
|
||||||
:value="sender.id"
|
:value="sender.id"
|
||||||
>
|
>
|
||||||
|
@ -132,7 +132,7 @@ export default {
|
||||||
return {
|
return {
|
||||||
title: '',
|
title: '',
|
||||||
message: '',
|
message: '',
|
||||||
selectedSender: '',
|
selectedSender: 0,
|
||||||
endPoint: '',
|
endPoint: '',
|
||||||
timeOnPage: 10,
|
timeOnPage: 10,
|
||||||
show: true,
|
show: true,
|
||||||
|
@ -173,7 +173,17 @@ export default {
|
||||||
this.uiFlags.isCreating
|
this.uiFlags.isCreating
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
sendersAndBotList() {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
id: 0,
|
||||||
|
name: 'Bot',
|
||||||
|
},
|
||||||
|
...this.senderList,
|
||||||
|
];
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
async addCampaign() {
|
async addCampaign() {
|
||||||
try {
|
try {
|
||||||
|
@ -181,7 +191,7 @@ export default {
|
||||||
title: this.title,
|
title: this.title,
|
||||||
message: this.message,
|
message: this.message,
|
||||||
inbox_id: this.$route.params.inboxId,
|
inbox_id: this.$route.params.inboxId,
|
||||||
sender_id: this.selectedSender,
|
sender_id: this.selectedSender || null,
|
||||||
enabled: this.enabled,
|
enabled: this.enabled,
|
||||||
trigger_rules: {
|
trigger_rules: {
|
||||||
url: this.endPoint,
|
url: this.endPoint,
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
</div>
|
</div>
|
||||||
<campaigns-table
|
<campaigns-table
|
||||||
:campaigns="records"
|
:campaigns="records"
|
||||||
:show-empty-state="showEmptyResult"
|
:show-empty-result="showEmptyResult"
|
||||||
:is-loading="uiFlags.isFetching"
|
:is-loading="uiFlags.isFetching"
|
||||||
:on-edit-click="openEditPopup"
|
:on-edit-click="openEditPopup"
|
||||||
/>
|
/>
|
||||||
|
@ -56,7 +56,8 @@ export default {
|
||||||
uiFlags: 'campaigns/getUIFlags',
|
uiFlags: 'campaigns/getUIFlags',
|
||||||
}),
|
}),
|
||||||
showEmptyResult() {
|
showEmptyResult() {
|
||||||
const hasEmptyResults = this.records.length === 0;
|
const hasEmptyResults =
|
||||||
|
!this.uiFlags.isFetching && this.records.length === 0;
|
||||||
return hasEmptyResults;
|
return hasEmptyResults;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -93,7 +93,6 @@ export default {
|
||||||
return <Label title={labelText} colorScheme={colorScheme} />;
|
return <Label title={labelText} colorScheme={colorScheme} />;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
field: 'sender',
|
field: 'sender',
|
||||||
key: 'sender',
|
key: 'sender',
|
||||||
|
@ -101,7 +100,7 @@ export default {
|
||||||
align: 'left',
|
align: 'left',
|
||||||
renderBodyCell: ({ row }) => {
|
renderBodyCell: ({ row }) => {
|
||||||
if (row.sender) return <CampaignSender sender={row.sender} />;
|
if (row.sender) return <CampaignSender sender={row.sender} />;
|
||||||
return '---';
|
return this.$t('CAMPAIGN.LIST.SENDER.BOT');
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
{{ $t('CAMPAIGN.ADD.FORM.SENT_BY.LABEL') }}
|
{{ $t('CAMPAIGN.ADD.FORM.SENT_BY.LABEL') }}
|
||||||
<select v-model="selectedSender">
|
<select v-model="selectedSender">
|
||||||
<option
|
<option
|
||||||
v-for="sender in senderList"
|
v-for="sender in sendersAndBotList"
|
||||||
:key="sender.name"
|
:key="sender.name"
|
||||||
:value="sender.id"
|
:value="sender.id"
|
||||||
>
|
>
|
||||||
|
@ -186,6 +186,15 @@ export default {
|
||||||
this.selectedCampaign.title
|
this.selectedCampaign.title
|
||||||
}`;
|
}`;
|
||||||
},
|
},
|
||||||
|
sendersAndBotList() {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
id: 0,
|
||||||
|
name: 'Bot',
|
||||||
|
},
|
||||||
|
...this.senderList,
|
||||||
|
];
|
||||||
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.setFormValues();
|
this.setFormValues();
|
||||||
|
@ -197,15 +206,16 @@ export default {
|
||||||
message,
|
message,
|
||||||
enabled,
|
enabled,
|
||||||
trigger_rules: { url: endPoint, time_on_page: timeOnPage },
|
trigger_rules: { url: endPoint, time_on_page: timeOnPage },
|
||||||
sender: { id: selectedSender },
|
sender,
|
||||||
} = this.selectedCampaign;
|
} = this.selectedCampaign;
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.message = message;
|
this.message = message;
|
||||||
this.endPoint = endPoint;
|
this.endPoint = endPoint;
|
||||||
this.timeOnPage = timeOnPage;
|
this.timeOnPage = timeOnPage;
|
||||||
this.selectedSender = selectedSender;
|
this.selectedSender = (sender && sender.id) || 0;
|
||||||
this.enabled = enabled;
|
this.enabled = enabled;
|
||||||
},
|
},
|
||||||
|
|
||||||
async editCampaign() {
|
async editCampaign() {
|
||||||
try {
|
try {
|
||||||
await this.$store.dispatch('campaigns/update', {
|
await this.$store.dispatch('campaigns/update', {
|
||||||
|
@ -213,7 +223,7 @@ export default {
|
||||||
title: this.title,
|
title: this.title,
|
||||||
message: this.message,
|
message: this.message,
|
||||||
inbox_id: this.$route.params.inboxId,
|
inbox_id: this.$route.params.inboxId,
|
||||||
sender_id: this.selectedSender,
|
sender_id: this.selectedSender || null,
|
||||||
enabled: this.enabled,
|
enabled: this.enabled,
|
||||||
trigger_rules: {
|
trigger_rules: {
|
||||||
url: this.endPoint,
|
url: this.endPoint,
|
||||||
|
|
Loading…
Reference in a new issue