feat(frontend): integrate B2B wholesale license application form with NestJS API

This commit is contained in:
parsa aghaei committed 2026-07-26 19:29:38 +03:30
1 parent b1027903d6
commit 3cfa99766c
3 files changed
+49 -26

No files matched your search

+33 -10
View File
@@ -116,21 +116,48 @@ export default function B2BPortal({ onClose }: { onClose: () => void }) {
</button>
{/* Sidebar Info */}
<div className="w-full md:w-80 bg-canina-blue p-10 text-white flex flex-col">
<div className="mb-10">
<div className="w-full md:w-80 bg-canina-blue p-10 text-white flex flex-col overflow-y-auto">
<div className="mb-8">
<div className="w-16 h-16 bg-white/20 rounded-2xl flex items-center justify-center mb-6">
<Building2 className="w-8 h-8" />
</div>
<h2 className="text-2xl font-black mb-4 italic">پنل کلینیک‌ها <br/> و داروخانه‌ها</h2>
<p className="text-white/60 text-sm leading-relaxed">
این بخش اختصاصی برای ثبت سفارشات حجیم و استعلام موجودی آنی طراحی شده است. قیمت‌های نمایش داده شده، فی واحد کاتالوگ هستند.
<p className="text-white/60 text-sm leading-relaxed mb-4">
ثبت سفارشات حجیم با قیمت همکار. کالاها مستقیماً با لایسنس آلمان ارسال می‌شوند.
</p>
{!isWholesaleVerified && (
<div className="bg-white/10 p-4 rounded-2xl border border-white/20 mt-4">
<h4 className="text-xs font-black mb-2 text-amber-300">درخواست تایید حساب همکار</h4>
<p className="text-[11px] text-white/80 mb-3">جهت مشاهده و خرید با قیمت عمده، شماره پروانه نظام دامپزشکی خود را وارد کنید.</p>
<form onSubmit={async (e) => {
e.preventDefault();
const form = e.target as HTMLFormElement;
const bName = (form.elements.namedItem('bName') as HTMLInputElement).value;
const lNum = (form.elements.namedItem('lNum') as HTMLInputElement).value;
try {
const api = (await import('../lib/services/api')).default;
await api.post('/wholesale/apply', { businessName: bName, licenseNumber: lNum });
alert('درخواست ثبت‌نام همکار با موفقیت ارسال شد و به زودی توسط ادمین تایید می‌شود.');
form.reset();
} catch (err) {
alert('لطفاً ابتدا وارد حساب کاربری خود شوید.');
}
}} className="space-y-2">
<input name="bName" required placeholder="نام کلینیک / داروخانه" className="w-full bg-white/20 text-white text-xs px-3 py-2 rounded-xl outline-none placeholder:text-white/50" />
<input name="lNum" required placeholder="شماره پروانه / نظام" className="w-full bg-white/20 text-white text-xs px-3 py-2 rounded-xl outline-none placeholder:text-white/50" />
<button type="submit" className="w-full bg-amber-400 hover:bg-amber-500 text-gray-900 font-black text-xs py-2 rounded-xl transition-colors">
ثبت درخواست همکار
</button>
</form>
</div>
)}
</div>
<div className="mt-auto space-y-4">
<div className="mt-auto space-y-4 pt-6">
<button
onClick={exportToCSV}
className="w-full p-4 bg-white/10 hover:bg-white/20 rounded-2xl flex items-center gap-3 transition-colors text-right"
className="w-full p-4 bg-white/10 hover:bg-white/20 rounded-2xl flex items-center gap-3 transition-colors text-right cursor-pointer"
>
<Download className="w-5 h-5 text-blue-300" />
<div>
@@ -138,10 +165,6 @@ export default function B2BPortal({ onClose }: { onClose: () => void }) {
<span className="text-[10px] text-white/60 block">خروجی CSV آماده چاپ</span>
</div>
</button>
<div className="p-4 bg-white/10 rounded-2xl flex items-center gap-3">
<Package className="w-5 h-5 text-blue-300" />
<span className="text-xs font-bold">پیگیری محمولات قبلی</span>
</div>
</div>
</div>