feat: add refill toggle in admin settings and compact checkout UI layout
Deploy Canina / deploy (push) Successful in 1m31s

This commit is contained in:
parsa aghaei committed 2026-08-22 17:37:50 +03:30
1 parent 6454c18071
commit 4e768d66a9
14 files changed
+3445 -3422

No files matched your search

@@ -15,6 +15,8 @@ export default function FinancialSettingsPage() {
walletWithdrawalEnabled: false,
});
const [charityStep, setCharityStep] = useState('10000');
const [refillEnabled, setRefillEnabled] = useState(false);
const [refillPercent, setRefillPercent] = useState('5');
const [isLoading, setIsLoading] = useState(true);
const [isSaving, setIsSaving] = useState(false);
const [donationInput, setDonationInput] = useState('');
@@ -41,6 +43,8 @@ export default function FinancialSettingsPage() {
}
if (resAdmin.data?.success) {
setCharityStep(resAdmin.data.data.CHARITY_ROUND_STEP || '10000');
setRefillEnabled(resAdmin.data.data.REFILL_SUBSCRIPTION_ENABLED === 'true');
setRefillPercent(resAdmin.data.data.REFILL_REWARD_PERCENT || '5');
}
})
.catch((err) => {
@@ -63,6 +67,8 @@ export default function FinancialSettingsPage() {
api.put('/admin/settings', {
TAX_PERCENTAGE: String(financial.taxPercentage),
CHARITY_ROUND_STEP: charityStep,
REFILL_SUBSCRIPTION_ENABLED: refillEnabled ? 'true' : 'false',
REFILL_REWARD_PERCENT: refillPercent,
}),
]);
toast.success('تنظیمات مالی با موفقیت بروزرسانی شد');
@@ -191,6 +197,52 @@ export default function FinancialSettingsPage() {
</div>
</div>
{/* Refill Subscription and Reward Cashback */}
<div className="md:col-span-2 pt-4 border-t border-gray-100 space-y-4">
<label className="flex items-center justify-between cursor-pointer p-4 bg-indigo-50/50 hover:bg-indigo-50 rounded-2xl border border-indigo-100 transition-colors">
<div className="flex items-start gap-3">
<input
type="checkbox"
checked={refillEnabled}
onChange={(e) => setRefillEnabled(e.target.checked)}
className="w-5 h-5 mt-0.5 rounded-lg text-indigo-600 focus:ring-indigo-500 border-gray-300 cursor-pointer"
/>
<div>
<span className="text-sm font-black text-gray-900 block flex items-center gap-2">
<Percent className="w-4 h-4 text-indigo-600" />
فعال‌سازی سرویس «رزرو هوشمند تمدید و پاداش خرید بعدی» (Refill Subscription)
</span>
<span className="text-xs text-gray-500 font-medium block mt-0.5">
در صورت فعال بودن، گزینه‌ای در سبد خرید و تسویه‌حساب به مشتری پیشنهاد می‌شود تا با فعال‌سازی یادآور تمدید، درصد مشخصی پاداش (اعتبار خرید بعدی) رزرو کند.
</span>
</div>
</div>
</label>
{refillEnabled && (
<div className="p-4 bg-white rounded-2xl border border-indigo-100 grid grid-cols-1 md:grid-cols-2 gap-4">
<div>
<label className="block text-xs font-bold text-gray-700 mb-1.5">
درصد پاداش رزرو تمدید (Cashback Reward Percent)
</label>
<div className="relative">
<input
type="number"
min="1"
max="100"
value={refillPercent}
onChange={(e) => setRefillPercent(e.target.value)}
className="w-full px-4 py-2.5 rounded-xl border border-gray-200 focus:border-indigo-500 outline-none font-bold text-xs"
dir="ltr"
/>
<span className="absolute left-4 top-1/2 -translate-y-1/2 text-gray-400 font-bold text-xs">%</span>
</div>
<p className="text-[11px] text-gray-400 mt-1">پیش‌فرض: ۵ درصد</p>
</div>
</div>
)}
</div>
{/* Wallet Withdrawal Feature Toggle */}
<div className="md:col-span-2 pt-4 border-t border-gray-100">
<label className="flex items-center gap-3 cursor-pointer p-4 bg-emerald-50/50 hover:bg-emerald-50 rounded-2xl border border-emerald-100 transition-colors">