fix(all): resolve wallet callback validation, card-to-card conditional rendering, pet management tab, withdrawal settings, smart advisor loop, reports chart and announcement config
Deploy Canina / deploy (push) Successful in 1m47s

This commit is contained in:
parsa aghaei committed 2026-08-16 19:05:03 +03:30
1 parent b807d25632
commit d9254e9b01
14 files changed
+533 -77

No files matched your search

@@ -11,6 +11,7 @@ export default function FinancialSettingsPage() {
freeShippingThreshold: 2000000,
standardShippingFee: 85000,
charityDonationOptions: [10000, 20000, 50000],
walletWithdrawalEnabled: false,
});
const [isLoading, setIsLoading] = useState(true);
const [isSaving, setIsSaving] = useState(false);
@@ -30,6 +31,7 @@ export default function FinancialSettingsPage() {
charityDonationOptions: Array.isArray(data.charityDonationOptions)
? data.charityDonationOptions.map(Number)
: [10000, 20000, 50000],
walletWithdrawalEnabled: Boolean(data.walletWithdrawalEnabled ?? false),
});
}
})
@@ -168,6 +170,22 @@ export default function FinancialSettingsPage() {
))}
</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-purple-50/50 hover:bg-purple-50 rounded-2xl border border-purple-100 transition-colors">
<input
type="checkbox"
checked={Boolean(financial.walletWithdrawalEnabled)}
onChange={(e) => setFinancial({ ...financial, walletWithdrawalEnabled: e.target.checked })}
className="w-5 h-5 rounded-lg text-purple-600 focus:ring-purple-500 border-gray-300 cursor-pointer"
/>
<div>
<span className="text-sm font-black text-gray-900 block">فعال‌سازی امکان ثبت درخواست برداشت و تسویه‌حساب کیف پول (wallet_withdrawal_enabled)</span>
<span className="text-xs text-gray-500 font-medium block mt-0.5">در صورت فعال بودن، کاربران می‌توانند از طریق داشبورد خود درخواست تسویه و واریز وجه به شماره شبا ثبت کنند.</span>
</div>
</label>
</div>
</div>
<div className="flex justify-end pt-4 border-t border-gray-100">
+27 -9
View File
@@ -215,19 +215,37 @@ export default function Reports() {
{/* Best Sellers */}
<div className="bg-white p-6 rounded-2xl shadow-sm border border-gray-100">
<h3 className="text-lg font-bold text-gray-900 mb-6">پرفروش‌ترین محصولات</h3>
<div className="h-64 w-full" dir="ltr">
{bestSellers?.length > 0 ? (
<ResponsiveContainer width="100%" height="100%">
<BarChart data={bestSellers} layout="vertical" margin={{ top: 0, right: 0, left: 0, bottom: 0 }}>
<div className="min-h-[320px] w-full" dir="ltr">
{bestSellers && bestSellers.length > 0 ? (
<ResponsiveContainer width="100%" height={Math.max(300, bestSellers.length * 45)}>
<BarChart
data={bestSellers}
layout="vertical"
margin={{ top: 10, right: 30, left: 10, bottom: 10 }}
>
<CartesianGrid strokeDasharray="3 3" horizontal={false} stroke="#f3f4f6" />
<XAxis type="number" stroke="#9ca3af" fontSize={12} />
<YAxis dataKey="name" type="category" width={120} stroke="#4b5563" fontSize={12} tickLine={false} axisLine={false} style={{ direction: 'rtl' }} />
<RechartsTooltip cursor={{ fill: '#f3f4f6' }} />
<Bar dataKey="quantity" fill="#EC4899" radius={[0, 4, 4, 0]} barSize={20} />
<XAxis type="number" stroke="#9ca3af" fontSize={11} allowDecimals={false} />
<YAxis
dataKey="name"
type="category"
width={180}
stroke="#4b5563"
fontSize={11}
tickLine={false}
axisLine={false}
tickFormatter={(val: string) => (val && val.length > 24 ? `${val.slice(0, 22)}...` : val)}
style={{ direction: 'rtl', textAnchor: 'end' }}
/>
<RechartsTooltip
cursor={{ fill: '#fdf2f8' }}
formatter={(val: number) => [`${val.toLocaleString('fa-IR')} عدد`, 'تعداد فروش']}
labelFormatter={(lbl: string) => `محصول: ${lbl}`}
/>
<Bar dataKey="quantity" fill="#EC4899" radius={[0, 6, 6, 0]} barSize={18} />
</BarChart>
</ResponsiveContainer>
) : (
<div className="text-gray-400 font-medium flex items-center justify-center h-full">داده‌ای موجود نیست</div>
<div className="text-gray-400 font-medium flex items-center justify-center h-64">داده‌ای موجود نیست</div>
)}
</div>
</div>
@@ -34,6 +34,7 @@ export default function Settings() {
ENAMAD_CODE: '',
THEME_PRIMARY_COLOR: '#7c3aed',
BRAND_TYPOGRAPHY: 'vazirmatn',
shipping_notice: 'ارسال رایگان برای سفارش‌های بالای ۱۵۰ هزار تومان — گارانتی اصالت کنینا آلمان — مشاوره تخصصی مکمل‌های دارویی سگ و گربه با کادر دامپزشکان مجرب',
});
const [isLoading, setIsLoading] = useState(true);
const [isSaving, setIsSaving] = useState(false);
@@ -71,6 +72,7 @@ export default function Settings() {
ENAMAD_CODE: response.data.data.ENAMAD_CODE || '',
THEME_PRIMARY_COLOR: response.data.data.THEME_PRIMARY_COLOR || '#7c3aed',
BRAND_TYPOGRAPHY: response.data.data.BRAND_TYPOGRAPHY || 'vazirmatn',
shipping_notice: response.data.data.shipping_notice || response.data.data.SHIPPING_NOTICE || 'ارسال رایگان برای سفارش‌های بالای ۱۵۰ هزار تومان — گارانتی اصالت کنینا آلمان — مشاوره تخصصی مکمل‌های دارویی سگ و گربه با کادر دامپزشکان مجرب',
});
}
}).catch(err => {
@@ -427,6 +429,18 @@ export default function Settings() {
<p className="text-[10px] text-gray-400 mt-1">این لوگو در صورت پر بودن، جایگزین تایپوگرافی هدر سایت در اپلیکیشن خواهد شد.</p>
</div>
<div className="md:col-span-2">
<label className="block text-xs font-bold text-gray-700 mb-1">متن نوار متحرک اعلان بالای سایت (Ticker / Announcement Bar)</label>
<textarea
rows={2}
value={settings.shipping_notice}
onChange={(e) => setSettings({ ...settings, shipping_notice: e.target.value })}
placeholder="ارسال رایگان برای سفارش‌های بالای ۱۵۰ هزار تومان — ..."
className="w-full border border-gray-200 rounded-xl p-3 outline-none focus:ring-2 focus:ring-purple-500 text-xs font-bold bg-amber-50/50"
/>
<p className="text-[11px] text-gray-500 mt-1">این متن به عنوان نوار زرد متحرک بالای تمام صفحات سایت نمایش داده می‌شود.</p>
</div>
<div className="md:col-span-2">
<label className="block text-xs font-bold text-gray-700 mb-1">کد و اسکریپت نماد اعتماد الکترونیکی (Enamad HTML/Embed Code)</label>
<textarea
@@ -828,24 +828,24 @@ export default function Transactions() {
{/* Modal Actions */}
<div className="flex items-center justify-between gap-3 pt-2">
<div className="flex items-center gap-2">
{selectedTx.status !== 'VERIFIED' && (
{selectedTx.gateway !== 'zibal' && selectedTx.gateway !== 'online' && selectedTx.status !== 'VERIFIED' && (
<button
type="button"
onClick={() => handleManualVerify(selectedTx.id)}
className="bg-emerald-600 hover:bg-emerald-700 text-white font-black px-4 py-2.5 rounded-xl text-xs flex items-center gap-1.5 shadow-md shadow-emerald-600/20 transition-all cursor-pointer"
>
<CheckCircle2 className="w-4 h-4" />
<span>تایید دستی و اعمال مالی</span>
<span>تایید دستی واریز کارت به کارت</span>
</button>
)}
{selectedTx.status === 'PENDING' && (
{selectedTx.gateway !== 'zibal' && selectedTx.gateway !== 'online' && selectedTx.status === 'PENDING' && (
<button
type="button"
onClick={() => handleManualReject(selectedTx.id)}
className="bg-rose-50 hover:bg-rose-100 text-rose-700 border border-rose-200 font-bold px-4 py-2.5 rounded-xl text-xs flex items-center gap-1.5 transition-all cursor-pointer"
>
<XCircle className="w-4 h-4" />
<span>رد کردن تراکنش</span>
<span>رد فیش کارت به کارت</span>
</button>
)}
</div>
+36 -4
View File
@@ -74,6 +74,30 @@ const GROUPS: Record<string, string[]> = {
],
};
const KEY_LABELS_FA: Record<string, string> = {
shipping_notice: "متن نوار متحرک اعلان بالای سایت (ارسال رایگان، گارانتی و شعار)",
brand_name_fa: "نام فارسی برند (کنینا ایران)",
brand_subtitle: "زیرعنوان برند (نمایندگی رسمی مکمل‌های دارویی کنینا آلمان)",
nav_solutions: "عنوان راهکارهای درمانی در منو",
nav_products: "عنوان کاتالوگ محصولات در منو",
nav_wiki: "عنوان دانشنامه در منو",
nav_blog: "عنوان وبلاگ در منو",
nav_pet_profiles: "عنوان پرونده سلامت در منو",
nav_search_placeholder: "متن جستجو در منو",
nav_cart: "عنوان سبد خرید",
hero_title: "عنوان اصلی بنر (Hero)",
hero_desc: "توضیحات بنر اصلی",
hero_btn_advisor: "متن دکمه دستیار هوشمند در بنر",
hero_btn_products: "متن دکمه مشاهده محصولات در بنر",
advisor_title: "عنوان دستیار هوشمند سلامت",
advisor_subtitle: "زیرعنوان دستیار هوشمند سلامت",
featured_title_line1: "عنوان بخش محصولات برگزیده",
cta_title: "عنوان کادر دعوت به اقدام (CTA)",
footer_copyright: "متن کپی‌رایت فوتر",
maintenance_mode: "حالت تعمیرات و صیانت سایت",
catalog_mode: "حالت کاتالوگ‌مود",
};
const GROUP_PAGE_MAP: Record<string, string> = {
"بنر اصلی (Hero)": "hero",
"هدر و ناوبری": "header",
@@ -241,7 +265,8 @@ export default function UITexts() {
const filteredKeys = keys.filter(key => {
if (!search) return true;
const currentVal = edits[key] ?? texts[key] ?? '';
return key.toLowerCase().includes(search.toLowerCase()) || currentVal.includes(search);
const faLabel = KEY_LABELS_FA[key] || '';
return key.toLowerCase().includes(search.toLowerCase()) || faLabel.includes(search) || currentVal.includes(search);
});
if (filteredKeys.length === 0) return null;
@@ -264,9 +289,16 @@ export default function UITexts() {
return (
<div key={key} className="space-y-2 p-4 bg-gray-50/70 rounded-2xl border border-gray-100">
<div className="flex items-center justify-between">
<label className="text-xs font-black text-gray-700 font-mono" dir="ltr">
{key}
</label>
<div>
{KEY_LABELS_FA[key] && (
<span className="text-xs font-black text-gray-900 block mb-0.5">
{KEY_LABELS_FA[key]}
</span>
)}
<label className="text-[10px] font-mono text-gray-400 font-bold block" dir="ltr">
{key}
</label>
</div>
{isSaved && (
<span className="text-[10px] text-green-600 font-black flex items-center gap-1">
<Check className="w-3 h-3" /> ذخیره شد
+2
View File
@@ -173,6 +173,7 @@ export interface FinancialSettings {
freeShippingThreshold: number;
standardShippingFee: number;
charityDonationOptions: number[];
walletWithdrawalEnabled?: boolean;
}
export interface SystemSettings {
@@ -180,6 +181,7 @@ export interface SystemSettings {
allowGuestCheckout: boolean;
b2bRegistrationOpen: boolean;
supportPhone: string;
walletWithdrawalEnabled?: boolean;
}
export interface Product {