@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.
- package/dist/hooks/index.cjs +12 -1
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.mjs +12 -1
- package/dist/hooks/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/hooks/index.mjs
CHANGED
|
@@ -432,7 +432,18 @@ var vendorMenuSchema = yup3.object({
|
|
|
432
432
|
description: yup3.string().trim().nullable().optional(),
|
|
433
433
|
name: yup3.string().trim().nullable().min(3, "Product name must be at least 3 characters").required("Product name is required"),
|
|
434
434
|
price: yup3.number().transform((v, o) => o === "" ? null : v).min(1, "Product price must be greater than 0").required("Product price is required"),
|
|
435
|
-
priceMax: yup3.number().transform((v, o) => o === "" ? null : v).min(1, "Product max price must be greater than 0").nullable().optional()
|
|
435
|
+
priceMax: yup3.number().transform((v, o) => o === "" ? null : v).min(1, "Product max price must be greater than 0").nullable().optional().test(
|
|
436
|
+
"is-greater",
|
|
437
|
+
"Max price must be greater than Product price",
|
|
438
|
+
function(priceMaxValue) {
|
|
439
|
+
const { price } = this.parent;
|
|
440
|
+
if (!priceMaxValue || !price) return true;
|
|
441
|
+
const maxNum = Number(priceMaxValue);
|
|
442
|
+
const priceNum = Number(price);
|
|
443
|
+
if (Number.isNaN(maxNum) || Number.isNaN(priceNum)) return true;
|
|
444
|
+
return maxNum > priceNum;
|
|
445
|
+
}
|
|
446
|
+
),
|
|
436
447
|
priceUnit: yup3.string().required("Product unit is required")
|
|
437
448
|
});
|
|
438
449
|
var vendorSchema = globalResourceSchema.shape({
|