@timardex/cluemart-shared 1.7.31 → 1.7.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1957,7 +1957,18 @@ var vendorMenuSchema = yup3.object({
1957
1957
  description: yup3.string().trim().nullable().optional(),
1958
1958
  name: yup3.string().trim().nullable().min(3, "Product name must be at least 3 characters").required("Product name is required"),
1959
1959
  price: yup3.number().transform((v, o) => o === "" ? null : v).min(1, "Product price must be greater than 0").required("Product price is required"),
1960
- priceMax: yup3.number().transform((v, o) => o === "" ? null : v).min(1, "Product max price must be greater than 0").nullable().optional(),
1960
+ priceMax: yup3.number().transform((v, o) => o === "" ? null : v).min(1, "Product max price must be greater than 0").nullable().optional().test(
1961
+ "is-greater",
1962
+ "Max price must be greater than Product price",
1963
+ function(priceMaxValue) {
1964
+ const { price } = this.parent;
1965
+ if (!priceMaxValue || !price) return true;
1966
+ const maxNum = Number(priceMaxValue);
1967
+ const priceNum = Number(price);
1968
+ if (Number.isNaN(maxNum) || Number.isNaN(priceNum)) return true;
1969
+ return maxNum > priceNum;
1970
+ }
1971
+ ),
1961
1972
  priceUnit: yup3.string().required("Product unit is required")
1962
1973
  });
1963
1974
  var vendorSchema = globalResourceSchema.shape({