diff options
Diffstat (limited to 'packages/merchant-backoffice-ui/src/paths/instance/orders')
-rw-r--r-- | packages/merchant-backoffice-ui/src/paths/instance/orders/create/CreatePage.tsx | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/orders/create/CreatePage.tsx b/packages/merchant-backoffice-ui/src/paths/instance/orders/create/CreatePage.tsx index f4a82f377..d5c888f1c 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/orders/create/CreatePage.tsx +++ b/packages/merchant-backoffice-ui/src/paths/instance/orders/create/CreatePage.tsx @@ -144,12 +144,18 @@ export function CreatePage({ const { i18n } = useTranslationContext(); + const parsedPrice = !value.pricing?.order_price + ? undefined + : Amounts.parse(value.pricing.order_price); + const errors: FormErrors<Entity> = { pricing: undefinedIfEmpty({ summary: !value.pricing?.summary ? i18n.str`required` : undefined, order_price: !value.pricing?.order_price ? i18n.str`required` - : Amounts.isZero(value.pricing.order_price) + : !parsedPrice + ? i18n.str`not valid` + : Amounts.isZero(parsedPrice) ? i18n.str`must be greater than 0` : undefined, }), @@ -333,8 +339,8 @@ export function CreatePage({ }, [hasProducts, totalAsString]); const discountOrRise = rate( - value.pricing?.order_price || `${config.currency}:0`, - totalAsString, + parsedPrice ?? Amounts.zeroOfCurrency(config.currency), + totalPrice.amount, ); const minAgeByProducts = allProducts.reduce( |