From db31bfcee4e3781fc6a07a7d02e8faccd80369ed Mon Sep 17 00:00:00 2001 From: Muhsin Keloth Date: Mon, 10 May 2021 12:40:48 +0530 Subject: [PATCH] feat: Edit campaigns (#2230) * add edit campaign component --- .../dashboard/i18n/locale/en/campaign.json | 8 + .../dashboard/settings/inbox/Settings.vue | 4 - .../settings/inbox/components/Campaign.vue | 23 +- .../inbox/components/CampaignsTable.vue | 8 +- .../inbox/components/EditCampaign.vue | 236 ++++++++++++++++++ .../dashboard/store/modules/campaigns.js | 12 + .../modules/specs/campaigns/actions.spec.js | 22 ++ .../store/modules/specs/campaigns/fixtures.js | 6 +- .../modules/specs/campaigns/mutations.spec.js | 12 + .../dashboard/store/mutation-types.js | 1 + 10 files changed, 321 insertions(+), 11 deletions(-) create mode 100644 app/javascript/dashboard/routes/dashboard/settings/inbox/components/EditCampaign.vue diff --git a/app/javascript/dashboard/i18n/locale/en/campaign.json b/app/javascript/dashboard/i18n/locale/en/campaign.json index 4d727b8e3..34bb9cdd3 100644 --- a/app/javascript/dashboard/i18n/locale/en/campaign.json +++ b/app/javascript/dashboard/i18n/locale/en/campaign.json @@ -42,6 +42,14 @@ "ERROR_MESSAGE": "There was an error. Please try again." } }, + "EDIT": { + "TITLE": "Edit campaign", + "UPDATE_BUTTON_TEXT": "Update", + "API": { + "SUCCESS_MESSAGE": "Campaign updated successfully", + "ERROR_MESSAGE": "There was an error, please try again" + } + }, "LIST": { "LOADING_MESSAGE": "Loading campaigns...", "TABLE_HEADER": { diff --git a/app/javascript/dashboard/routes/dashboard/settings/inbox/Settings.vue b/app/javascript/dashboard/routes/dashboard/settings/inbox/Settings.vue index 4ba8cedc2..0f7f2dba1 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/inbox/Settings.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/inbox/Settings.vue @@ -335,10 +335,6 @@ export default { if (this.isAWebWidgetInbox) { return [ ...visibleToAllChannelTabs, - // { - // key: 'campaign', - // name: this.$t('INBOX_MGMT.TABS.CAMPAIGN'), - // }, { key: 'preChatForm', name: this.$t('INBOX_MGMT.TABS.PRE_CHAT_FORM'), diff --git a/app/javascript/dashboard/routes/dashboard/settings/inbox/components/Campaign.vue b/app/javascript/dashboard/routes/dashboard/settings/inbox/components/Campaign.vue index 4ad99e316..928f8d8db 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/inbox/components/Campaign.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/inbox/components/Campaign.vue @@ -1,8 +1,7 @@ diff --git a/app/javascript/dashboard/routes/dashboard/settings/inbox/components/CampaignsTable.vue b/app/javascript/dashboard/routes/dashboard/settings/inbox/components/CampaignsTable.vue index 8df1a58a6..084bb497c 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/inbox/components/CampaignsTable.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/inbox/components/CampaignsTable.vue @@ -44,6 +44,10 @@ export default { type: Boolean, default: false, }, + onEditClick: { + type: Function, + default: () => {}, + }, }, data() { @@ -130,14 +134,14 @@ export default { key: 'buttons', title: '', align: 'left', - renderBodyCell: () => ( + renderBodyCell: (row) => (
this.onEditClick(row)} > {this.$t('CAMPAIGN.LIST.BUTTONS.EDIT')} diff --git a/app/javascript/dashboard/routes/dashboard/settings/inbox/components/EditCampaign.vue b/app/javascript/dashboard/routes/dashboard/settings/inbox/components/EditCampaign.vue new file mode 100644 index 000000000..707f73294 --- /dev/null +++ b/app/javascript/dashboard/routes/dashboard/settings/inbox/components/EditCampaign.vue @@ -0,0 +1,236 @@ +