سفارشات زیر این مبلغ امکان ثبت نخواهند داشت (۰ = بدون محدودیت).
+
+
+
+
setSettings({ ...settings, CHARITY_ROUND_STEP: e.target.value })}
+ className="w-full border border-gray-200 rounded-xl p-3 outline-none focus:ring-2 focus:ring-purple-500 font-bold"
+ dir="ltr"
+ placeholder="10000"
+ />
+
مبلغ فاکتور به اولین ضریب این عدد (مثلاً ۱۰,۰۰۰ یا ۵۰,۰۰۰ تومان) رند میشود.
+
diff --git a/frontend/application/components/CheckoutPage.tsx b/frontend/application/components/CheckoutPage.tsx
index f163d6d..a1cc928 100644
--- a/frontend/application/components/CheckoutPage.tsx
+++ b/frontend/application/components/CheckoutPage.tsx
@@ -20,6 +20,7 @@ import { toPersian, cn } from "../lib/utils";
import { useCartStore } from "../lib/store/cartStore";
import { usePetStore } from "../lib/store/usePetStore";
import { useUserStore } from "../lib/store/userStore";
+import { useSettingsStore } from "../lib/store/settingsStore";
import { Product, PRODUCTS } from "../lib/data/products";
import { productService } from "../lib/services/productService";
import { toast } from "sonner";
@@ -60,9 +61,10 @@ export default function CheckoutPage() {
}
}, [profile, isLoggedIn]);
+ const roundStep = Number(useSettingsStore((state) => state.getText('CHARITY_ROUND_STEP', '10000'))) || 10000;
const subtotal = getSubtotal();
- const remainder = subtotal % 10000;
- const roundUpDiff = remainder === 0 ? 10000 : 10000 - remainder;
+ const remainder = subtotal % roundStep;
+ const roundUpDiff = remainder === 0 ? roundStep : roundStep - remainder;
const handleCharityToggle = () => {
if (!useRoundUp) {
@@ -362,7 +364,7 @@ export default function CheckoutPage() {