From e2dc137b591848fc30bfb6b0afdadb23e5b10b11 Mon Sep 17 00:00:00 2001 From: Oluwaseun Olorunsola Date: Tue, 17 Jan 2023 17:23:00 +0100 Subject: [PATCH] Add Usage limit fields and half of Usage restriction fields MAILPOET-4762 --- .../js/src/newsletter_editor/blocks/coupon.ts | 29 ++++++++ .../templates/blocks/coupon/settings.hbs | 66 ++++++++++++++++++- 2 files changed, 93 insertions(+), 2 deletions(-) diff --git a/mailpoet/assets/js/src/newsletter_editor/blocks/coupon.ts b/mailpoet/assets/js/src/newsletter_editor/blocks/coupon.ts index 128bd546d3..f4a2ba1986 100644 --- a/mailpoet/assets/js/src/newsletter_editor/blocks/coupon.ts +++ b/mailpoet/assets/js/src/newsletter_editor/blocks/coupon.ts @@ -70,6 +70,35 @@ Module.CouponBlockSettingsView = base.BlockSettingsView.extend({ this.changeBoolCheckboxField, 'freeShipping', ), + 'input .mailpoet_field_coupon_minimum_amount': _.partial( + this.changeField, + 'minimumAmount', + ), + 'input .mailpoet_field_coupon_maximum_amount': _.partial( + this.changeField, + 'maximumAmount', + ), + 'change .mailpoet_field_coupon_individual_use': _.partial( + this.changeBoolCheckboxField, + 'individualUse', + ), + 'change .mailpoet_field_coupon_exclude_sale_items': _.partial( + this.changeBoolCheckboxField, + 'excludeSaleItems', + ), + // more items here + 'input .mailpoet_field_coupon_email_restrictions': _.partial( + this.changeField, + 'emailRestrictions', + ), + 'input .mailpoet_field_coupon_usage_limit': _.partial( + this.changeField, + 'usageLimit', + ), + 'input .mailpoet_field_coupon_usage_limit_per_user': _.partial( + this.changeField, + 'usageLimitPerUser', + ), 'change .mailpoet_field_coupon_alignment': _.partial( this.changeField, 'styles.block.textAlign', diff --git a/mailpoet/views/newsletter/templates/blocks/coupon/settings.hbs b/mailpoet/views/newsletter/templates/blocks/coupon/settings.hbs index 961cd755cf..b5a6d54d3d 100644 --- a/mailpoet/views/newsletter/templates/blocks/coupon/settings.hbs +++ b/mailpoet/views/newsletter/templates/blocks/coupon/settings.hbs @@ -70,7 +70,53 @@
- Content here +
+ +
+ +
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+ + + +
+
+ +
@@ -81,7 +127,23 @@
- Content here +
+ +
+ +
+ +