fix: Trigger campaigns only during business hours (#3085)

Fixes #2433
This commit is contained in:
Muhsin Keloth
2021-10-12 17:58:33 +05:30
committed by GitHub
parent 7c21cf2255
commit 6bfa551c85
16 changed files with 142 additions and 38 deletions

View File

@@ -54,6 +54,7 @@
"ERROR": "Time on page is required"
},
"ENABLED": "Enable campaign",
"TRIGGER_ONLY_BUSINESS_HOURS": "Trigger only during business hours",
"SUBMIT": "Add Campaign"
},
"API": {

View File

@@ -146,6 +146,15 @@
/>
{{ $t('CAMPAIGN.ADD.FORM.ENABLED') }}
</label>
<label v-if="isOngoingType">
<input
v-model="triggerOnlyDuringBusinessHours"
type="checkbox"
value="triggerOnlyDuringBusinessHours"
name="triggerOnlyDuringBusinessHours"
/>
{{ $t('CAMPAIGN.ADD.FORM.TRIGGER_ONLY_BUSINESS_HOURS') }}
</label>
</div>
<div class="modal-footer">
@@ -185,6 +194,7 @@ export default {
timeOnPage: 10,
show: true,
enabled: true,
triggerOnlyDuringBusinessHours: false,
scheduledAt: null,
selectedAudience: [],
senderList: [],
@@ -280,6 +290,9 @@ export default {
inbox_id: this.selectedInbox,
sender_id: this.selectedSender || null,
enabled: this.enabled,
trigger_only_during_business_hours:
// eslint-disable-next-line prettier/prettier
this.triggerOnlyDuringBusinessHours,
trigger_rules: {
url: this.endPoint,
time_on_page: this.timeOnPage,

View File

@@ -87,6 +87,15 @@
/>
{{ $t('CAMPAIGN.ADD.FORM.ENABLED') }}
</label>
<label v-if="isOngoingType">
<input
v-model="triggerOnlyDuringBusinessHours"
type="checkbox"
value="triggerOnlyDuringBusinessHours"
name="triggerOnlyDuringBusinessHours"
/>
{{ $t('CAMPAIGN.ADD.FORM.TRIGGER_ONLY_BUSINESS_HOURS') }}
</label>
</div>
<div class="modal-footer">
<woot-button :is-loading="uiFlags.isCreating">
@@ -125,6 +134,7 @@ export default {
selectedInbox: null,
endPoint: '',
timeOnPage: 10,
triggerOnlyDuringBusinessHours: false,
show: true,
enabled: true,
senderList: [],
@@ -209,6 +219,7 @@ export default {
title,
message,
enabled,
trigger_only_during_business_hours: triggerOnlyDuringBusinessHours,
inbox: { id: inboxId },
trigger_rules: { url: endPoint, time_on_page: timeOnPage },
sender,
@@ -218,6 +229,7 @@ export default {
this.endPoint = endPoint;
this.timeOnPage = timeOnPage;
this.selectedInbox = inboxId;
this.triggerOnlyDuringBusinessHours = triggerOnlyDuringBusinessHours;
this.selectedSender = (sender && sender.id) || 0;
this.enabled = enabled;
this.loadInboxMembers();
@@ -233,6 +245,9 @@ export default {
title: this.title,
message: this.message,
inbox_id: this.$route.params.inboxId,
trigger_only_during_business_hours:
// eslint-disable-next-line prettier/prettier
this.triggerOnlyDuringBusinessHours,
sender_id: this.selectedSender || null,
enabled: this.enabled,
trigger_rules: {