diff --git a/app/controllers/api/v1/accounts/campaigns_controller.rb b/app/controllers/api/v1/accounts/campaigns_controller.rb index c4555017d..5c58d3f51 100644 --- a/app/controllers/api/v1/accounts/campaigns_controller.rb +++ b/app/controllers/api/v1/accounts/campaigns_controller.rb @@ -10,6 +10,11 @@ class Api::V1::Accounts::CampaignsController < Api::V1::Accounts::BaseController @campaign = Current.account.campaigns.create!(campaign_params) end + def destroy + @campaign.destroy + head :ok + end + def show; end def update diff --git a/app/javascript/dashboard/i18n/locale/en/campaign.json b/app/javascript/dashboard/i18n/locale/en/campaign.json index 2eed61b19..f1c249669 100644 --- a/app/javascript/dashboard/i18n/locale/en/campaign.json +++ b/app/javascript/dashboard/i18n/locale/en/campaign.json @@ -42,6 +42,19 @@ "ERROR_MESSAGE": "There was an error. Please try again." } }, + "DELETE": { + "BUTTON_TEXT": "Delete", + "CONFIRM": { + "TITLE": "Confirm Deletion", + "MESSAGE": "Are you sure to delete?", + "YES": "Yes, Delete ", + "NO": "No, Keep " + }, + "API": { + "SUCCESS_MESSAGE": "Campaign deleted successfully", + "ERROR_MESSAGE": "Could not delete the campaign. Please try again later." + } + }, "EDIT": { "TITLE": "Edit campaign", "UPDATE_BUTTON_TEXT": "Update", diff --git a/app/javascript/dashboard/routes/dashboard/settings/inbox/components/AddCampaign.vue b/app/javascript/dashboard/routes/dashboard/settings/inbox/components/AddCampaign.vue index 70be87feb..ea067fa3e 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/inbox/components/AddCampaign.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/inbox/components/AddCampaign.vue @@ -1,132 +1,112 @@ - - - - - - - {{ $t('CAMPAIGN.ADD.FORM.TITLE.LABEL') }} - - - + + + + + - - - {{ $t('CAMPAIGN.ADD.FORM.MESSAGE.LABEL') }} - - - + + {{ $t('CAMPAIGN.ADD.FORM.MESSAGE.LABEL') }} + + + {{ $t('CAMPAIGN.ADD.FORM.MESSAGE.ERROR') }} + + - - - {{ $t('CAMPAIGN.ADD.FORM.SENT_BY.LABEL') }} - - - {{ sender.name }} - - - - {{ $t('CAMPAIGN.ADD.FORM.SENT_BY.ERROR') }} - - - + + {{ $t('CAMPAIGN.ADD.FORM.SENT_BY.LABEL') }} + + + {{ sender.name }} + + + + {{ $t('CAMPAIGN.ADD.FORM.SENT_BY.ERROR') }} + + - - - {{ $t('CAMPAIGN.ADD.FORM.END_POINT.LABEL') }} - - - {{ $t('CAMPAIGN.ADD.FORM.END_POINT.ERROR') }} - - - - - - {{ $t('CAMPAIGN.ADD.FORM.TIME_ON_PAGE.LABEL') }} - - - {{ $t('CAMPAIGN.ADD.FORM.TIME_ON_PAGE.ERROR') }} - - - + + + + + {{ $t('CAMPAIGN.ADD.FORM.ENABLED') }} + + - - - - {{ $t('CAMPAIGN.ADD.FORM.ENABLED') }} - - - - - - - + + + @@ -91,4 +125,8 @@ export default { justify-content: flex-end; padding-bottom: var(--space-one); } + +.content-box .page-top-bar::v-deep { + padding: var(--space-large) var(--space-large) var(--space-zero); +} 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 9c903183f..3e1855cb4 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/inbox/components/CampaignsTable.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/inbox/components/CampaignsTable.vue @@ -44,10 +44,6 @@ export default { type: Boolean, default: false, }, - onEditClick: { - type: Function, - default: () => {}, - }, }, data() { @@ -140,10 +136,18 @@ export default { icon="ion-edit" color-scheme="secondary" classNames="grey-btn" - onClick={() => this.onEditClick(row)} + onClick={() => this.$emit('on-edit-click', row)} > {this.$t('CAMPAIGN.LIST.BUTTONS.EDIT')} + this.$emit('on-delete-click', row)} + > + {this.$t('CAMPAIGN.LIST.BUTTONS.DELETE')} + ), }, diff --git a/app/javascript/dashboard/routes/dashboard/settings/inbox/components/EditCampaign.vue b/app/javascript/dashboard/routes/dashboard/settings/inbox/components/EditCampaign.vue index 143dc7a5a..7696bc836 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/inbox/components/EditCampaign.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/inbox/components/EditCampaign.vue @@ -1,132 +1,101 @@ - - - - - - - {{ $t('CAMPAIGN.ADD.FORM.TITLE.LABEL') }} - - - {{ $t('CAMPAIGN.ADD.FORM.TITLE.ERROR') }} - - - - - - - {{ $t('CAMPAIGN.ADD.FORM.MESSAGE.LABEL') }} - - - {{ $t('CAMPAIGN.ADD.FORM.MESSAGE.ERROR') }} - - - - - - - {{ $t('CAMPAIGN.ADD.FORM.SENT_BY.LABEL') }} - - - {{ sender.name }} - - - - {{ $t('CAMPAIGN.ADD.FORM.SENT_BY.ERROR') }} - - - - - - - {{ $t('CAMPAIGN.ADD.FORM.END_POINT.LABEL') }} - - - {{ $t('CAMPAIGN.ADD.FORM.END_POINT.ERROR') }} - - - - - - {{ $t('CAMPAIGN.ADD.FORM.TIME_ON_PAGE.LABEL') }} - - - {{ $t('CAMPAIGN.ADD.FORM.TIME_ON_PAGE.ERROR') }} - - - - - - - - {{ $t('CAMPAIGN.ADD.FORM.ENABLED') }} - - - - - - - + + + + + + + {{ $t('CAMPAIGN.ADD.FORM.MESSAGE.LABEL') }} + + + {{ $t('CAMPAIGN.ADD.FORM.MESSAGE.ERROR') }} + + + + {{ $t('CAMPAIGN.ADD.FORM.SENT_BY.LABEL') }} + + + {{ sender.name }} + + + + {{ $t('CAMPAIGN.ADD.FORM.SENT_BY.ERROR') }} + + + + + + + {{ $t('CAMPAIGN.ADD.FORM.ENABLED') }} + + + + +