fix(dashboard,promotion): percentage promotions + set currency code on percentage promotions (#13161)
This commit is contained in:
1 parent
9725bff25d
commit
224eaedf5c
5 files changed
+1090
-951
No files matched your search
File diff suppressed because it is too large.
Load diff
+2
-4
@@ -47,12 +47,10 @@ export const CreateCampaignFormFields = ({ form, fieldScope = "" }) => {
|
|||||||
|
|
||||||
if (isTypeSpend) {
|
if (isTypeSpend) {
|
||||||
form.setValue(`campaign.budget.currency_code`, promotionCurrencyValue)
|
form.setValue(`campaign.budget.currency_code`, promotionCurrencyValue)
|
||||||
}
|
} else {
|
||||||
|
|
||||||
if (watchValueType === "usage") {
|
|
||||||
form.setValue(`campaign.budget.currency_code`, null)
|
form.setValue(`campaign.budget.currency_code`, null)
|
||||||
}
|
}
|
||||||
}, [watchValueType])
|
}, [promotionCurrencyValue, isTypeSpend])
|
||||||
|
|
||||||
if (promotionCurrencyValue) {
|
if (promotionCurrencyValue) {
|
||||||
const formCampaignBudget = form.getValues().campaign?.budget
|
const formCampaignBudget = form.getValues().campaign?.budget
|
||||||
|
|||||||
+16
-4
@@ -128,7 +128,7 @@ export const RulesFormField = ({
|
|||||||
{t(`promotions.fields.conditions.${ruleType}.description`)}
|
{t(`promotions.fields.conditions.${ruleType}.description`)}
|
||||||
</Text>
|
</Text>
|
||||||
|
|
||||||
{fields.map((fieldRule: any, index) => {
|
{fields.map((fieldRule, index) => {
|
||||||
const identifier = fieldRule.id
|
const identifier = fieldRule.id
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -157,11 +157,23 @@ export const RulesFormField = ({
|
|||||||
(ao) => ao.id === e
|
(ao) => ao.id === e
|
||||||
)
|
)
|
||||||
|
|
||||||
update(index, {
|
const fieldRuleOverrides: typeof fieldRule = {
|
||||||
...fieldRule,
|
...fieldRule,
|
||||||
values: [],
|
|
||||||
disguised: currentAttributeOption?.disguised || false,
|
disguised: currentAttributeOption?.disguised || false,
|
||||||
})
|
}
|
||||||
|
|
||||||
|
if (currentAttributeOption?.operators?.length === 1) {
|
||||||
|
fieldRuleOverrides.operator =
|
||||||
|
currentAttributeOption.operators[0].value
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fieldRuleOverrides.operator === "eq") {
|
||||||
|
fieldRuleOverrides.values = ""
|
||||||
|
} else {
|
||||||
|
fieldRuleOverrides.values = []
|
||||||
|
}
|
||||||
|
|
||||||
|
update(index, fieldRuleOverrides)
|
||||||
onChange(e)
|
onChange(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -299,7 +299,7 @@ export const CreatePromotionForm = () => {
|
|||||||
const formData = form.getValues()
|
const formData = form.getValues()
|
||||||
let campaignQuery: object = {}
|
let campaignQuery: object = {}
|
||||||
|
|
||||||
if (isFixedValueType && formData.application_method.currency_code) {
|
if (formData.application_method.currency_code) {
|
||||||
campaignQuery = {
|
campaignQuery = {
|
||||||
budget: { currency_code: formData.application_method.currency_code },
|
budget: { currency_code: formData.application_method.currency_code },
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -521,7 +521,7 @@ export default class PromotionModuleService
|
|||||||
}
|
}
|
||||||
|
|
||||||
const isCurrencyCodeValid =
|
const isCurrencyCodeValid =
|
||||||
!isDefined(applicationMethod.currency_code) ||
|
!isPresent(applicationMethod.currency_code) ||
|
||||||
applicationContext.currency_code === applicationMethod.currency_code
|
applicationContext.currency_code === applicationMethod.currency_code
|
||||||
|
|
||||||
const isPromotionApplicable = areRulesValidForContext(
|
const isPromotionApplicable = areRulesValidForContext(
|
||||||
|
|||||||
Reference in new issue
Block a user