From 9133fdb7ffb6a7c532e039e245a0820b4275e73f Mon Sep 17 00:00:00 2001 From: sazzadulalambd Date: Tue, 5 May 2026 03:09:21 +0600 Subject: [PATCH] feat: add plans configuration tab to admin settings page with CRUD support for rental plans --- src/app/admin/settings/page.tsx | 302 ++++++++++++++++++++++++++++++-- 1 file changed, 292 insertions(+), 10 deletions(-) diff --git a/src/app/admin/settings/page.tsx b/src/app/admin/settings/page.tsx index f9985e8..854bc06 100644 --- a/src/app/admin/settings/page.tsx +++ b/src/app/admin/settings/page.tsx @@ -80,6 +80,48 @@ interface CompanySettings { damagePenalty: { level: string; amount: number }[]; rules: string[]; }; + plans: { + singleRent: { + name: string; + dailyRent: number; + deposit: number; + weeklySubscription: number; + monthlySubscription: number; + ficoSharePercent: number; + jaibenKeepPercent: number; + description: string; + features: string[]; + }[]; + rentToOwn: { + name: string; + dailyRent: number; + deposit: number; + weeklySubscription: number; + monthlySubscription: number; + durationMonths: number; + evPrice: number; + totalPayment: number; + profit: number; + ficoRentSharePercent: number; + ficoProfitSharePercent: number; + description: string; + features: string[]; + }[]; + shareEv: { + name: string; + dailyRentEach: number; + totalDailyRent: number; + depositEach: number; + totalDeposit: number; + weeklySubscriptionEach: number; + totalWeeklySubscription: number; + monthlySubscriptionEach: number; + totalMonthlySubscription: number; + ficoSharePercent: number; + description: string; + features: string[]; + }[]; + }; } const initialSettings: CompanySettings = { @@ -273,12 +315,60 @@ const initialSettings: CompanySettings = { 'Follow traffic rules', 'Report accidents within 24 hours', ] + }, + plans: { + singleRent: [ + { + name: 'Single Rent', + dailyRent: 300, + deposit: 20000, + weeklySubscription: 2100, + monthlySubscription: 9000, + ficoSharePercent: 45, + jaibenKeepPercent: 55, + description: 'Single person rental plan with deposit and weekly/monthly subscription', + features: ['Deposit Money > 20,000TK', '1st Day Rent Advance', 'Weekly Subscription > 2,100TK', 'Monthly Subscription > 9,000TK', 'Auto Deduct from Wallet Balance', 'FICO gets 45% > 135TK', 'JAIBEN keeps 55% > 165TK'] + } + ], + rentToOwn: [ + { + name: 'Rent to Own', + dailyRent: 250, + deposit: 18000, + weeklySubscription: 1750, + monthlySubscription: 7000, + durationMonths: 18, + evPrice: 120000, + totalPayment: 135000, + profit: 15000, + ficoRentSharePercent: 45, + ficoProfitSharePercent: 45, + description: 'Rent to own plan - get ownership after 18 months', + features: ['Daily Rent = 250TK', 'Deposit Money > 18,000TK', 'Weekly Subscription > 1,750TK or 1,875TK', 'Monthly Subscription > 7,000TK or 7,500TK', 'Duration > 18 Months', 'In 18 months Total Pay > 1,35,000TK (EV Price 1,20,000TK)', 'Profit > 15,000TK', 'FICO gets 45% of the rent > 112 TK and Profit Share 45% > 6,750TK', 'Rider gets a brand new EV after 18 months'] + } + ], + shareEv: [ + { + name: 'Share an EV', + dailyRentEach: 200, + totalDailyRent: 400, + depositEach: 15000, + totalDeposit: 30000, + weeklySubscriptionEach: 1400, + totalWeeklySubscription: 2800, + monthlySubscriptionEach: 5600, + totalMonthlySubscription: 11200, + ficoSharePercent: 45, + description: 'Share EV between 2 riders - split earnings', + features: ['Daily Rent = 200TK each (Total = 400TK)', 'Deposit Money > 15,000TK each (Total = 30,000TK)', 'Weekly Subscription > 1,400TK or 1,500TK each (Total = 2,800TK or 3,000TK)', 'Monthly Subscription > 5,600TK or 6,000TK each (Total = 11,200TK or 12,000TK)', 'FICO gets 45% of daily rent 90+90 > 180TK from two riders one EV', 'No ownership'] + } + ] } }; export default function CompanySettingsPage() { const [settings, setSettings] = useState(initialSettings); - const [activeTab, setActiveTab] = useState<'general' | 'branding' | 'social' | 'integration' | 'landing' | 'kyc' | 'parts' | 'rental'>('general'); + const [activeTab, setActiveTab] = useState<'general' | 'branding' | 'social' | 'integration' | 'landing' | 'kyc' | 'parts' | 'rental' | 'plans'>('general'); const [activeMasterTab, setActiveMasterTab] = useState<'investor' | 'merchant' | 'swapstation' | 'rental'>('investor'); const [saved, setSaved] = useState(false); const [addDocType, setAddDocType] = useState<'investor' | 'merchant' | 'swapstation' | 'rental' | null>(null); @@ -290,16 +380,16 @@ export default function CompanySettingsPage() { setTimeout(() => setSaved(false), 2000); }; -const tabs = [ + const tabs = [ { id: 'general', label: 'General', icon: Settings }, { id: 'branding', label: 'Branding', icon: Palette }, { id: 'social', label: 'Social Media', icon: Link2 }, { id: 'integration', label: 'Integrations', icon: Mail }, { id: 'landing', label: 'Landing Page', icon: Monitor }, - { id: 'kyc', label: 'KYC Documents', icon: Package }, { id: 'parts', label: 'EV Parts', icon: Package }, { id: 'rental', label: 'Rental Policy', icon: FileCheck }, + { id: 'plans', label: 'Plan Selection', icon: Package }, ]; return ( @@ -897,8 +987,8 @@ const tabs = [ key={tab.id} onClick={() => setActiveMasterTab(tab.id as typeof activeMasterTab)} className={`px-3 py-1.5 text-sm rounded-lg ${activeMasterTab === tab.id - ? 'bg-accent text-white' - : 'text-slate-600 hover:bg-slate-50' + ? 'bg-accent text-white' + : 'text-slate-600 hover:bg-slate-50' }`} > {tab.label} @@ -932,7 +1022,7 @@ const tabs = [ ))} -