fix(dashboard,promotion): percentage promotions + set currency code on percentage promotions (#13161)
This commit is contained in:
@@ -47,12 +47,10 @@ export const CreateCampaignFormFields = ({ form, fieldScope = "" }) => {
|
||||
|
||||
if (isTypeSpend) {
|
||||
form.setValue(`campaign.budget.currency_code`, promotionCurrencyValue)
|
||||
}
|
||||
|
||||
if (watchValueType === "usage") {
|
||||
} else {
|
||||
form.setValue(`campaign.budget.currency_code`, null)
|
||||
}
|
||||
}, [watchValueType])
|
||||
}, [promotionCurrencyValue, isTypeSpend])
|
||||
|
||||
if (promotionCurrencyValue) {
|
||||
const formCampaignBudget = form.getValues().campaign?.budget
|
||||
|
||||
@@ -128,7 +128,7 @@ export const RulesFormField = ({
|
||||
{t(`promotions.fields.conditions.${ruleType}.description`)}
|
||||
</Text>
|
||||
|
||||
{fields.map((fieldRule: any, index) => {
|
||||
{fields.map((fieldRule, index) => {
|
||||
const identifier = fieldRule.id
|
||||
|
||||
return (
|
||||
@@ -157,11 +157,23 @@ export const RulesFormField = ({
|
||||
(ao) => ao.id === e
|
||||
)
|
||||
|
||||
update(index, {
|
||||
const fieldRuleOverrides: typeof fieldRule = {
|
||||
...fieldRule,
|
||||
values: [],
|
||||
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)
|
||||
}
|
||||
|
||||
|
||||
@@ -299,7 +299,7 @@ export const CreatePromotionForm = () => {
|
||||
const formData = form.getValues()
|
||||
let campaignQuery: object = {}
|
||||
|
||||
if (isFixedValueType && formData.application_method.currency_code) {
|
||||
if (formData.application_method.currency_code) {
|
||||
campaignQuery = {
|
||||
budget: { currency_code: formData.application_method.currency_code },
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user