From da0df6db3e3306c51196daf21358ad9e1455385d Mon Sep 17 00:00:00 2001 From: sazzadulalambd Date: Tue, 5 May 2026 04:20:17 +0600 Subject: [PATCH] refactor: implement plan tiering and expand rental options across all service categories --- src/app/admin/settings/page.tsx | 535 ++++++++++++++++++-------------- 1 file changed, 310 insertions(+), 225 deletions(-) diff --git a/src/app/admin/settings/page.tsx b/src/app/admin/settings/page.tsx index c65ef5e..813827f 100644 --- a/src/app/admin/settings/page.tsx +++ b/src/app/admin/settings/page.tsx @@ -82,17 +82,17 @@ interface CompanySettings { }; plans: { singleRent: { + tier: 'Economy' | 'Standard' | 'Premium'; name: string; dailyRent: number; deposit: number; weeklySubscription: number; monthlySubscription: number; ficoSharePercent: number; - jaibenKeepPercent: number; description: string; - features: string[]; }[]; rentToOwn: { + tier: 'Economy' | 'Standard' | 'Premium'; name: string; dailyRent: number; deposit: number; @@ -105,9 +105,9 @@ interface CompanySettings { ficoRentSharePercent: number; ficoProfitSharePercent: number; description: string; - features: string[]; }[]; shareEv: { + tier: 'Economy' | 'Standard' | 'Premium'; name: string; dailyRentEach: number; totalDailyRent: number; @@ -119,7 +119,6 @@ interface CompanySettings { totalMonthlySubscription: number; ficoSharePercent: number; description: string; - features: string[]; }[]; }; } @@ -319,20 +318,55 @@ const initialSettings: CompanySettings = { plans: { singleRent: [ { - name: 'Single Rent', + tier: 'Premium', + name: 'Single Rent - Premium', + dailyRent: 400, + deposit: 25000, + weeklySubscription: 2800, + monthlySubscription: 12000, + ficoSharePercent: 50, + description: 'Premium single person rental plan with extra benefits', + }, + { + tier: 'Standard', + name: 'Single Rent - Standard', 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'] + description: 'Standard single person rental plan', + }, + { + tier: 'Economy', + name: 'Single Rent - Economy', + dailyRent: 250, + deposit: 15000, + weeklySubscription: 1750, + monthlySubscription: 7500, + ficoSharePercent: 40, + description: 'Economy single person rental plan', } ], rentToOwn: [ { - name: 'Rent to Own', + tier: 'Premium', + name: 'Rent to Own - Premium', + dailyRent: 350, + deposit: 25000, + weeklySubscription: 2450, + monthlySubscription: 10500, + durationMonths: 18, + evPrice: 150000, + totalPayment: 170000, + profit: 20000, + ficoRentSharePercent: 50, + ficoProfitSharePercent: 45, + description: 'Premium rent to own plan with high-end EV', + }, + { + tier: 'Standard', + name: 'Rent to Own - Standard', dailyRent: 250, deposit: 18000, weeklySubscription: 1750, @@ -343,13 +377,42 @@ const initialSettings: CompanySettings = { 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'] + description: 'Standard rent to own plan', + }, + { + tier: 'Economy', + name: 'Rent to Own - Economy', + dailyRent: 200, + deposit: 15000, + weeklySubscription: 1400, + monthlySubscription: 6000, + durationMonths: 18, + evPrice: 100000, + totalPayment: 115000, + profit: 15000, + ficoRentSharePercent: 40, + ficoProfitSharePercent: 40, + description: 'Economy rent to own plan', } ], shareEv: [ { - name: 'Share an EV', + tier: 'Premium', + name: 'Share an EV - Premium', + dailyRentEach: 300, + totalDailyRent: 600, + depositEach: 20000, + totalDeposit: 40000, + weeklySubscriptionEach: 2100, + totalWeeklySubscription: 4200, + monthlySubscriptionEach: 8400, + totalMonthlySubscription: 16800, + ficoSharePercent: 50, + description: 'Premium shared EV with premium bikes', + }, + { + tier: 'Standard', + name: 'Share an EV - Standard', dailyRentEach: 200, totalDailyRent: 400, depositEach: 15000, @@ -359,11 +422,24 @@ const initialSettings: CompanySettings = { 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'] + description: 'Standard shared EV plan', + }, + { + tier: 'Economy', + name: 'Share an EV - Economy', + dailyRentEach: 150, + totalDailyRent: 300, + depositEach: 12000, + totalDeposit: 24000, + weeklySubscriptionEach: 1050, + totalWeeklySubscription: 2100, + monthlySubscriptionEach: 4200, + totalMonthlySubscription: 8400, + ficoSharePercent: 40, + description: 'Economy shared EV plan', } - ] - } + ], + }, }; export default function CompanySettingsPage() { @@ -1470,223 +1546,232 @@ export default function CompanySettingsPage() { )} -{activeTab === 'plans' && ( -
-
-

Plan Selection

-
+ {activeTab === 'plans' && ( +
+
+

Plan Selection

+
-
- - - -
+
+ + + +
- {activePlanTab === 'singleRent' && ( -
- {settings.plans.singleRent.map((plan, idx) => ( -
-
-
-

SINGLE RENT - ৳{plan.dailyRent}/day

-

{plan.description}

-
- -
-
-
-
- - { const updated = [...settings.plans.singleRent]; updated[idx].dailyRent = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, singleRent: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" /> + {activePlanTab === 'singleRent' && ( +
+ {settings.plans.singleRent.map((plan, idx) => ( +
+
+
+ {/* {plan.tier === 'Premium' ? '👑' : plan.tier === 'Standard' ? '⚖️' : '💰'} */} +
+

SINGLE RENT - {plan.tier} - ৳{plan.dailyRent}/day

+

{plan.description}

+
+
+
-
- - { const updated = [...settings.plans.singleRent]; updated[idx].weeklySubscription = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, singleRent: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" /> -
-
- - { const updated = [...settings.plans.singleRent]; updated[idx].monthlySubscription = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, singleRent: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" /> -
-
- - { const updated = [...settings.plans.singleRent]; updated[idx].deposit = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, singleRent: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" /> -
-
- - { const updated = [...settings.plans.singleRent]; updated[idx].ficoSharePercent = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, singleRent: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" /> -
-
- - +
+
+
+ + { const updated = [...settings.plans.singleRent]; updated[idx].dailyRent = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, singleRent: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" /> +
+
+ + { const updated = [...settings.plans.singleRent]; updated[idx].weeklySubscription = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, singleRent: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" /> +
+
+ + { const updated = [...settings.plans.singleRent]; updated[idx].monthlySubscription = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, singleRent: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" /> +
+
+ + { const updated = [...settings.plans.singleRent]; updated[idx].deposit = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, singleRent: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" /> +
+
+ + { const updated = [...settings.plans.singleRent]; updated[idx].ficoSharePercent = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, singleRent: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" /> +
+
+ + +
+
+
+
+ FICO + JAIBEN = + {plan.ficoSharePercent + (100 - plan.ficoSharePercent)}% (FICO: {plan.ficoSharePercent}% + JAIBEN: {100 - plan.ficoSharePercent}%) +
+
+
+ +