'use client';
import { useState } from 'react';
import { Settings, Upload, Image, Globe, Mail, MessageSquare, Phone, MapPin, Link2, Clock, Save, FileText, Camera, Palette, Ruler, Sun, Moon, Monitor, Smartphone, Tablet, Package, Wrench, FileCheck, BadgeDollarSign, CreditCard, Plus, X, DollarSign, Zap, Users, Check, Pencil } from 'lucide-react';
import RichTextEditor from '@/components/RichTextEditor';
interface CompanySettings {
name: string;
shortName: string;
tagLine: string;
description: string;
email: string;
phone: string;
website: string;
address: string;
city: string;
country: string;
tin: string;
bin: string;
tradeLicense: string;
timezone: string;
currency: string;
language: string;
logo: string;
favicon: string;
primaryColor: string;
secondaryColor: string;
borderRadius: number;
socialLinks: {
facebook: string;
twitter: string;
instagram: string;
linkedin: string;
youtube: string;
};
smtp: {
host: string;
port: number;
user: string;
password: string;
fromEmail: string;
fromName: string;
encryption: 'ssl' | 'tls' | 'none';
};
sms: {
provider: string;
apiKey: string;
senderId: string;
url: string;
};
heroData: {
title: string;
subtitle: string;
ctaText: string;
ctaLink: string;
videoUrl: string;
backgroundImage: string;
};
masterData: {
kycDocuments: { name: string; required: boolean }[];
riderDocuments: { id: string; name: string; required: boolean; description: string }[];
subscriptionPlans: { name: string; price: number; duration: number; features: string[] }[];
rentalPlans: { id: string; name: string; type: string; description: string; price: number; duration: number }[];
investorDocuments: { id: string; name: string; required: boolean; description: string }[];
merchantDocuments: { id: string; name: string; required: boolean; description: string }[];
swapStationDocuments: { id: string; name: string; required: boolean; description: string }[];
rentalDocuments: {
type: 'single' | 'shared' | 'rent-to-own';
name: string;
documents: { id: string; name: string; required: boolean; description: string }[];
}[];
};
parts: { id: string; name: string; price?: number; minPrice?: number; maxPrice?: number; inStock: number }[];
serviceCenters: { id: string; name: string; address: string; phone: string; rating: number }[];
companyPolicy: {
investor: { title: string; description: string; rules: { name: string; description: string }[] };
merchant: { title: string; description: string; rules: { name: string; description: string }[] };
swapStation: { title: string; description: string; rules: { name: string; description: string }[] };
rentalTypes: { type: string; name: string; title: string; description: string; rules: { name: string; description: string }[]; enabled: boolean }[];
};
rentalPolicy: {
minAge: number;
requireLicense: boolean;
deposit: number;
lateFeePerHour: number;
cancellationFee: number;
damagePenalty: { level: string; amount: number }[];
rules: string[];
};
plans: {
singleRent: {
tier: 'Economy' | 'Standard' | 'Premium';
name: string;
dailyRent: number;
deposit: number;
weeklySubscription: number;
monthlySubscription: number;
ficoSharePercent: number;
description: string;
}[];
rentToOwn: {
tier: 'Economy' | 'Standard' | 'Premium';
name: string;
dailyRent: number;
deposit: number;
weeklySubscription: number;
monthlySubscription: number;
durationMonths: number;
evPrice: number;
totalPayment: number;
profit: number;
ficoRentSharePercent: number;
ficoProfitSharePercent: number;
description: string;
}[];
shareEv: {
tier: 'Economy' | 'Standard' | 'Premium';
name: string;
dailyRentEach: number;
totalDailyRent: number;
depositEach: number;
totalDeposit: number;
weeklySubscriptionEach: number;
totalWeeklySubscription: number;
monthlySubscriptionEach: number;
totalMonthlySubscription: number;
ficoSharePercent: number;
description: string;
}[];
investment: {
id: string;
tier: string;
name: string;
minInvestment: number;
maxInvestment: number;
monthlyReturnPercent: number;
durationMonths: number;
profitSharePercent: number;
lockInMonths: number;
totalReturnPercent: number;
earlyExitPenalty: number;
startDate: string;
endDate: string;
targetAmount: number;
status: string;
description: string;
}[];
swapStation: {
id: string;
name: string;
batteryCount: number;
swapPrice: number;
monthlySubscription: number;
dailySubscription: number;
minBatteries: number;
maxBatteries: number;
profitSharePercent: number;
status: string;
description: string;
}[];
riderRequest: {
id: string;
tier: string;
name: string;
minRiders: number;
maxRiders: number;
monthlySubscription: number;
dailySubscription: number;
deposit: number;
commissionPercent: number;
dailyRideTarget: number;
weeklyHoliday: number;
status: string;
description: string;
}[];
};
}
const initialSettings: CompanySettings = {
name: 'JAIBEN Mobility Ltd',
shortName: 'JAIBEN',
tagLine: 'Your Trusted EV Mobility Partner',
description: 'Leading electric vehicle rental and swap station network in Bangladesh',
email: 'info@jaiben.com',
phone: '+880 9611-222-333',
website: 'https://jaiben.com',
address: 'House 45, Road 13, Gulshan 1',
city: 'Dhaka',
country: 'Bangladesh',
tin: '123456789012',
bin: '987654321098',
tradeLicense: 'TRAD/2023/001234',
timezone: 'Asia/Dhaka',
currency: 'BDT',
language: 'en',
logo: '/logo.png',
favicon: '/favicon.ico',
primaryColor: '#10B981',
secondaryColor: '#3B82F6',
borderRadius: 8,
socialLinks: {
facebook: 'https://facebook.com/jaiben',
twitter: 'https://twitter.com/jaiben',
instagram: 'https://instagram.com/jaiben',
linkedin: 'https://linkedin.com/company/jaiben',
youtube: 'https://youtube.com/@jaiben'
},
smtp: {
host: 'smtp.mailserver.com',
port: 587,
user: 'noreply@jaiben.com',
password: '••••••••••••',
fromEmail: 'noreply@jaiben.com',
fromName: 'JAIBEN Mobility',
encryption: 'tls'
},
sms: {
provider: 'BulkSMS',
apiKey: '••••••••••••••••',
senderId: 'JAIBEN',
url: 'https://api.bulksmsbd.com'
},
heroData: {
title: 'Welcome to JAIBEN',
subtitle: 'Your trusted partner for electric vehicle mobility solutions across Bangladesh',
ctaText: 'Get Started',
ctaLink: '/rent',
videoUrl: '',
backgroundImage: '/hero-bg.jpg'
},
masterData: {
kycDocuments: [
{ name: 'NID Card', required: true },
{ name: 'Driving License', required: true },
{ name: 'Passport Photo', required: true },
{ name: 'Address Proof', required: false },
{ name: 'Business Trade License', required: false },
],
riderDocuments: [
{ id: 'rider_nid_front', name: 'NID (Front)', required: true, description: 'National ID card front side' },
{ id: 'rider_nid_back', name: 'NID (Back)', required: true, description: 'National ID card back side' },
{ id: 'rider_license', name: 'Driving License', required: true, description: 'Valid driving license' },
{ id: 'rider_photo', name: 'Profile Photo', required: true, description: 'Recent passport size photo' },
{ id: 'rider_bank_card', name: 'Bank Account Card', required: false, description: 'Bank account card/cheque' },
{ id: 'rider_wallet', name: 'Mobile Wallet Info', required: false, description: 'bKash/Rocket account details' },
],
subscriptionPlans: [
{ name: 'Daily', price: 500, duration: 1, features: ['24 hours access', 'Basic support'] },
{ name: 'Weekly', price: 3000, duration: 7, features: ['7 days access', 'Priority support', 'Free swap'] },
{ name: 'Monthly', price: 10000, duration: 30, features: ['30 days access', 'VIP support', 'Unlimited swap', 'Damage coverage'] },
{ name: 'Yearly', price: 80000, duration: 365, features: ['1 year access', 'Dedicated manager', 'Unlimited swap', 'Full coverage', 'Discounted rates'] },
],
rentalPlans: [
{ id: 'single_rent', name: 'Single Rent', type: 'single', description: 'Single person rental plan', price: 500, duration: 1 },
{ id: 'weekly_rent', name: 'Weekly Rent', type: 'weekly', description: '7 days rental plan', price: 3000, duration: 7 },
{ id: 'monthly_rent', name: 'Monthly Rent', type: 'monthly', description: '30 days rental plan', price: 10000, duration: 30 },
{ id: 'rent_to_own', name: 'Rent to Own', type: 'rent-to-own', description: 'Own after X months', price: 15000, duration: 365 },
{ id: 'share_ev', name: 'Share EV', type: 'shared', description: 'Shared bike', price: 2500, duration: 30 },
],
investorDocuments: [
{ id: 'inv_nid', name: 'NID Card (Front & Back)', required: true, description: 'National ID card copy' },
{ id: 'inv_photo', name: 'Passport Size Photo', required: true, description: 'Recent passport size photograph' },
{ id: 'inv_bank', name: 'Bank Account Info', required: true, description: 'Bank account details for earnings' },
{ id: 'inv_mobile', name: 'Mobile Banking', required: true, description: 'bKash/Rocket account details' },
{ id: 'inv_tin', name: 'TIN Certificate', required: false, description: 'Tax Identification Number' },
{ id: 'inv_tax', name: 'Tax Return', required: false, description: 'Recent tax return copy' },
{ id: 'inv_ec', name: 'Emergency Contact ID', required: false, description: 'Emergency contact NID copy' },
],
merchantDocuments: [
{ id: 'mer_trade', name: 'Trade License', required: true, description: 'Business trade license' },
{ id: 'mer_nid', name: 'Owner NID Card', required: true, description: 'Owner/proprietor NID card' },
{ id: 'mer_photo', name: 'Shop Photo', required: true, description: 'Photo of shop premises' },
{ id: 'mer_tin', name: 'TIN Certificate', required: true, description: 'Tax Identification Number' },
{ id: 'mer_bank', name: 'Bank Account Info', required: true, description: 'Business bank account' },
{ id: 'mer_agreement', name: 'Shop Agreement', required: false, description: 'Rent agreement or ownership' },
{ id: 'mer_fire', name: 'Fire License', required: false, description: 'Fire safety license' },
],
swapStationDocuments: [
{ id: 'ss_trade', name: 'Trade License', required: true, description: 'Business trade license' },
{ id: 'ss_owner_nid', name: 'Owner NID Card', required: true, description: 'Proprietor NID card' },
{ id: 'ss_photo', name: 'Station Photo', required: true, description: 'Photo of swap station' },
{ id: 'ss_tin', name: 'TIN Certificate', required: true, description: 'Tax Identification Number' },
{ id: 'ss_electric', name: 'Electricity Bill', required: true, description: 'Recent electricity bill' },
{ id: 'ss_agreement', name: 'Space Agreement', required: false, description: 'Rent/space agreement' },
{ id: 'ss_safety', name: 'Safety Certificate', required: false, description: 'Electrical safety certificate' },
],
rentalDocuments: [
{
type: 'single',
name: 'Rental (Single)',
documents: [
{ id: 'rent_nid', name: 'NID Card', required: true, description: 'Valid National ID' },
{ id: 'rent_license', name: 'Driving License', required: true, description: 'Valid driving license' },
{ id: 'rent_photo', name: 'Passport Photo', required: true, description: 'Recent photo' },
{ id: 'rent_deposit', name: 'Deposit Receipt', required: true, description: 'Security deposit proof' },
{ id: 'rent_ec', name: 'Emergency Contact', required: true, description: 'Emergency contact info' },
]
},
{
type: 'shared',
name: 'Rental (2 Person Shared)',
documents: [
{ id: 'rent_nid_1', name: 'Rider 1 - NID Card', required: true, description: 'Primary rider NID' },
{ id: 'rent_license_1', name: 'Rider 1 - Driving License', required: true, description: 'Primary rider license' },
{ id: 'rent_nid_2', name: 'Rider 2 - NID Card', required: true, description: 'Secondary rider NID' },
{ id: 'rent_license_2', name: 'Rider 2 - Driving License', required: true, description: 'Secondary rider license' },
{ id: 'rent_photo', name: 'Passport Photos (Both)', required: true, description: 'Photos of both riders' },
{ id: 'rent_deposit', name: 'Deposit Receipt', required: true, description: 'Security deposit proof' },
{ id: 'rent_agreement', name: 'Shared Agreement', required: true, description: 'Agreement between riders' },
{ id: 'rent_ec', name: 'Emergency Contacts', required: true, description: 'Emergency contacts for both' },
]
},
{
type: 'rent-to-own',
name: 'Rent-to-Own',
documents: [
{ id: 'rto_nid', name: 'NID Card', required: true, description: 'Valid National ID' },
{ id: 'rto_license', name: 'Driving License', required: true, description: 'Valid driving license' },
{ id: 'rto_photo', name: 'Passport Photo', required: true, description: 'Recent photo' },
{ id: 'rto_income', name: 'Income Proof', required: true, description: 'Salary/income certificate' },
{ id: 'rto_bank', name: 'Bank Statement', required: true, description: '6 months bank statement' },
{ id: 'rto_tin', name: 'TIN Certificate', required: false, description: 'Tax Identification Number' },
{ id: 'rto_guarantor', name: 'Guarantor Info', required: true, description: 'Guarantor details' },
{ id: 'rto_guarantor_nid', name: 'Guarantor NID', required: true, description: 'Guarantor NID copy' },
{ id: 'rto_agreement', name: 'RTO Agreement', required: true, description: 'Rent-to-own contract' },
{ id: 'rto_insurance', name: 'Insurance', required: false, description: 'Vehicle insurance' },
]
},
]
},
parts: [
{ id: 'PRT-001', name: 'Battery 60V', price: 15000, inStock: 25 },
{ id: 'PRT-002', name: 'Battery 48V', price: 12000, inStock: 30 },
{ id: 'PRT-003', name: 'Front Tire', price: 2500, inStock: 50 },
{ id: 'PRT-004', name: 'Rear Tire', price: 2500, inStock: 50 },
{ id: 'PRT-005', name: 'Brake Pad', price: 800, inStock: 100 },
{ id: 'PRT-006', name: 'Mirror', price: 350, inStock: 80 },
{ id: 'PRT-007', name: 'Controller', minPrice: 3500, maxPrice: 5000, inStock: 15 },
{ id: 'PRT-008', name: 'Motor', minPrice: 8000, maxPrice: 12000, inStock: 10 },
{ id: 'PRT-009', name: 'Charger', minPrice: 1500, maxPrice: 2500, inStock: 20 },
{ id: 'PRT-010', name: 'Display Meter', price: 1200, inStock: 25 },
{ id: 'PRT-011', name: 'Throttle', price: 800, inStock: 40 },
{ id: 'PRT-012', name: 'Brake Cable', price: 250, inStock: 60 },
{ id: 'PRT-013', name: 'Chain', price: 600, inStock: 35 },
{ id: 'PRT-014', name: 'Sprocket', price: 450, inStock: 45 },
{ id: 'PRT-015', name: 'Foot Peg', price: 300, inStock: 50 },
],
serviceCenters: [
{ id: 'SC-001', name: 'JAIBEN Service Center - Gulshan', address: 'House 45, Road 13, Gulshan 1, Dhaka', phone: '+8801712345670', rating: 4.8 },
{ id: 'SC-002', name: 'JAIBEN Service Center - Banani', address: 'Road 11, Banani, Dhaka', phone: '+8801712345671', rating: 4.5 },
],
companyPolicy: {
investor: {
title: 'Investor Policy',
description: '
Investor Guidelines Welcome to our investor program. This document outlines the terms and conditions for all investors participating in our EV fleet sharing initiative.
Key Requirements All investors must complete KYC verification Minimum investment amount: ৳100,000 Monthly returns are calculated based on fleet utilization Note: Past performance does not guarantee future results. Please read all terms carefully before investing.
',
rules: [
{ name: 'No smoking in vehicles', description: 'Smoking is strictly prohibited inside any vehicle in the fleet' },
{ name: 'Return with same fuel/charge level', description: 'Vehicles must be returned with the same fuel/charge level as when rented' },
{ name: 'No unauthorized drivers', description: 'Only authorized drivers listed in the agreement are permitted to drive' },
{ name: 'Follow traffic rules', description: 'All traffic laws and regulations must be followed' },
{ name: 'Report accidents within 24 hours', description: 'Any accident must be reported within 24 hours of occurrence' }
]
},
merchant: {
title: 'Merchant Policy',
description: 'Merchant Terms & Conditions Thank you for joining our merchant network. These guidelines ensure smooth operations for all participating merchants.
Operational Requirements Maintain minimum inventory levels Provide excellent customer service Accept all payment methods offered Process orders within 24 hours Commission Structure Merchants receive 15% commission on each completed delivery plus monthly bonuses for high performance.
',
rules: [
{ name: 'No smoking in vehicles', description: 'Smoking is strictly prohibited inside any vehicle in the fleet' },
{ name: 'Return with same fuel/charge level', description: 'Vehicles must be returned with the same fuel/charge level as when rented' },
{ name: 'No unauthorized drivers', description: 'Only authorized drivers listed in the agreement are permitted to drive' },
{ name: 'Follow traffic rules', description: 'All traffic laws and regulations must be followed' },
{ name: 'Report accidents within 24 hours', description: 'Any accident must be reported within 24 hours of occurrence' }
]
},
swapStation: {
title: 'Swap Station Policy',
description: 'Swap Station Guidelines Welcome to our battery swap station network. Follow these safety and operational protocols for optimal service.
Safety Protocols Always wear protective gloves when handling batteries Inspect batteries for damage before swapping Keep swap station area clean and organized Report any malfunctioning equipment immediately Operating Hours Stations operate 24/7 for subscriber convenience. Emergency support available round the clock.
',
rules: [
{ name: 'No smoking in vehicles', description: 'Smoking is strictly prohibited inside any vehicle in the fleet' },
{ name: 'Return with same fuel/charge level', description: 'Vehicles must be returned with the same fuel/charge level as when rented' },
{ name: 'No unauthorized drivers', description: 'Only authorized drivers listed in the agreement are permitted to drive' },
{ name: 'Follow traffic rules', description: 'All traffic laws and regulations must be followed' },
{ name: 'Report accidents within 24 hours', description: 'Any accident must be reported within 24 hours of occurrence' }
]
},
rentalTypes: [
{ type: 'single', name: 'Rental (Single)', title: 'Rental (Single)', description: 'Single Person Rental Perfect for individual riders who need a reliable vehicle for daily commute or delivery work.
Plan Features Daily, weekly, and monthly options available Comprehensive insurance included 24/7 roadside assistance Free maintenance during rental period Pricing Starting from ৳400/day with deposit of ৳5,000.
', rules: [
{ name: 'No smoking in vehicles', description: 'Smoking is strictly prohibited inside any vehicle' },
{ name: 'Return with same fuel/charge level', description: 'Vehicles must be returned with the same fuel/charge level' },
{ name: 'No unauthorized drivers', description: 'Only the registered rider is permitted to drive' },
{ name: 'Follow traffic rules', description: 'All traffic laws must be followed' },
{ name: 'Report accidents within 24 hours', description: 'Any accident must be reported within 24 hours' }
], enabled: true },
{ type: 'shared', name: 'Rental (2 Person Shared)', title: 'Rental (2 Person Shared)', description: 'Shared Rental Plan Ideal for companions or delivery partners who want to share riding costs and responsibilities.
Plan Features Split costs between two riders Both users must be verified Shared liability coverage Flexible switch driver feature Pricing Starting from ৳600/day (৳300 each) with deposit of ৳8,000.
', rules: [
{ name: 'No smoking in vehicles', description: 'Smoking is strictly prohibited inside any vehicle' },
{ name: 'Return with same fuel/charge level', description: 'Vehicles must be returned with the same fuel/charge level' },
{ name: 'No unauthorized drivers', description: 'Both registered riders are permitted to drive' },
{ name: 'Follow traffic rules', description: 'All traffic laws must be followed' },
{ name: 'Report accidents within 24 hours', description: 'Any accident must be reported within 24 hours' }
], enabled: true },
{ type: 'renttoown', name: 'Rent-to-Own', title: 'Rent-to-Own', description: 'Rent-to-Own Plan Build ownership gradually with our rent-to-own program. After completing the tenure, own the EV outright.
Program Benefits 50% of rental payments go toward purchase Option to buyout anytime Full ownership after 36 months Transferable to family members Requirements Good payment history required. Credit check applies.
', rules: [
{ name: 'No smoking in vehicles', description: 'Smoking is strictly prohibited inside any vehicle' },
{ name: 'Return with same fuel/charge level', description: 'Vehicles must be returned with the same fuel/charge level' },
{ name: 'No unauthorized drivers', description: 'Only the registered rider is permitted to drive' },
{ name: 'Follow traffic rules', description: 'All traffic laws must be followed' },
{ name: 'Report accidents within 24 hours', description: 'Any accident must be reported within 24 hours' }
], enabled: true },
],
},
rentalPolicy: {
minAge: 18,
requireLicense: true,
deposit: 5000,
lateFeePerHour: 200,
cancellationFee: 1000,
damagePenalty: [
{ level: 'Minor Scratch', amount: 500 },
{ level: 'Major Damage', amount: 5000 },
{ level: 'Total Loss', amount: 25000 },
],
rules: [
'No smoking in vehicles',
'Return with same fuel/charge level',
'No unauthorized drivers',
'Follow traffic rules',
'Report accidents within 24 hours',
]
},
plans: {
singleRent: [
{
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,
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: [
{
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,
monthlySubscription: 7000,
durationMonths: 18,
evPrice: 120000,
totalPayment: 135000,
profit: 15000,
ficoRentSharePercent: 45,
ficoProfitSharePercent: 45,
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: [
{
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,
totalDeposit: 30000,
weeklySubscriptionEach: 1400,
totalWeeklySubscription: 2800,
monthlySubscriptionEach: 5600,
totalMonthlySubscription: 11200,
ficoSharePercent: 45,
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',
}
],
investment: [
{
id: 'inv_demo_1',
name: '1 Bike Plan',
tier: 'Economy',
minInvestment: 50000,
maxInvestment: 100000,
monthlyReturnPercent: 2,
durationMonths: 12,
profitSharePercent: 50,
lockInMonths: 3,
totalReturnPercent: 24,
earlyExitPenalty: 10,
startDate: '2026-01-01',
endDate: '2026-12-31',
targetAmount: 1000000,
status: 'active',
description: 'Investment plan for 1 bike - perfect for small investors',
},
{
id: 'inv_demo_2',
name: '5 Bike Plan',
tier: 'Standard',
minInvestment: 150000,
maxInvestment: 500000,
monthlyReturnPercent: 2.5,
durationMonths: 24,
profitSharePercent: 50,
lockInMonths: 6,
totalReturnPercent: 60,
earlyExitPenalty: 10,
startDate: '2026-01-01',
endDate: '2026-12-31',
targetAmount: 5000000,
status: 'active',
description: 'Investment plan for 5 bikes - medium scale investment',
}
],
swapStation: [
{
id: 'ss_1',
name: 'Basic Swap Station',
batteryCount: 10,
swapPrice: 50,
monthlySubscription: 500,
dailySubscription: 20,
minBatteries: 1,
maxBatteries: 5,
profitSharePercent: 50,
status: 'active',
description: 'Basic swap station for small operators',
},
{
id: 'ss_2',
name: 'Premium Swap Station',
batteryCount: 50,
swapPrice: 45,
monthlySubscription: 2000,
dailySubscription: 80,
minBatteries: 10,
maxBatteries: 30,
profitSharePercent: 55,
status: 'active',
description: 'Premium swap station for large operators',
}
],
riderRequest: [
{
id: 'rider_1',
tier: 'Premium',
name: 'Premium Rider Plan',
minRiders: 10,
maxRiders: 50,
monthlySubscription: 3000,
dailySubscription: 150,
deposit: 5000,
commissionPercent: 70,
dailyRideTarget: 15,
weeklyHoliday: 1,
status: 'active',
description: 'Premium rider plan for high volume operators',
},
{
id: 'rider_2',
tier: 'Standard',
name: 'Standard Rider Plan',
minRiders: 5,
maxRiders: 20,
monthlySubscription: 1500,
dailySubscription: 80,
deposit: 3000,
commissionPercent: 60,
dailyRideTarget: 10,
weeklyHoliday: 1,
status: 'active',
description: 'Standard rider plan for medium operators',
},
{
id: 'rider_3',
tier: 'Economy',
name: 'Economy Rider Plan',
minRiders: 1,
maxRiders: 10,
monthlySubscription: 500,
dailySubscription: 30,
deposit: 1000,
commissionPercent: 50,
dailyRideTarget: 5,
weeklyHoliday: 0,
status: 'active',
description: 'Economy rider plan for small operators',
}
],
},
};
export default function CompanySettingsPage() {
const [settings, setSettings] = useState(initialSettings);
const [activeTab, setActiveTab] = useState<'general' | 'branding' | 'social' | 'integration' | 'landing' | 'kyc' | 'parts' | 'companyPolicy' | 'plans' | 'investment' | 'swapstation' | 'riderrequest'>('general');
const [activeMasterTab, setActiveMasterTab] = useState<'investor' | 'merchant' | 'swapstation' | 'rental' | 'rentalType'>('investor');
const [saved, setSaved] = useState(false);
const [activePlanTab, setActivePlanTab] = useState<'singleRent' | 'rentToOwn' | 'shareEv'>('singleRent');
const [addDocType, setAddDocType] = useState<'investor' | 'merchant' | 'swapstation' | 'rental' | null>(null);
const [newDocName, setNewDocName] = useState('');
const [newDocDesc, setNewDocDesc] = useState('');
const [activeInvestTab, setActiveInvestTab] = useState(0);
const [editingPolicy, setEditingPolicy] = useState<{tab: string; index: number} | null>(null);
const [editPolicyName, setEditPolicyName] = useState('');
const [editPolicyDesc, setEditPolicyDesc] = useState('');
const [addInvestPlan, setAddInvestPlan] = useState(false);
const [newInvestName, setNewInvestName] = useState('');
const [newInvestTier, setNewInvestTier] = useState('Standard');
const [newInvestStatus, setNewInvestStatus] = useState('active');
const [newInvestTarget, setNewInvestTarget] = useState(1000000);
const [newInvestStart, setNewInvestStart] = useState('2026-01-01');
const [newInvestEnd, setNewInvestEnd] = useState('2026-12-31');
const [newInvestMin, setNewInvestMin] = useState(10000);
const [newInvestMax, setNewInvestMax] = useState(100000);
const [newInvestMonthly, setNewInvestMonthly] = useState(2);
const [newInvestDuration, setNewInvestDuration] = useState(12);
const [newInvestLock, setNewInvestLock] = useState(3);
const [newInvestTotal, setNewInvestTotal] = useState(24);
const [newInvestPenalty, setNewInvestPenalty] = useState(10);
const [newInvestDesc, setNewInvestDesc] = useState('');
const createInvestPlan = () => {
if (newInvestName.trim() && typeof window !== 'undefined') {
const ficoShare = settings.plans.singleRent[0]?.ficoSharePercent || 50;
const newPlan = {
id: 'inv_' + Date.now(),
name: newInvestName,
tier: newInvestTier,
minInvestment: newInvestMin,
maxInvestment: newInvestMax,
monthlyReturnPercent: newInvestMonthly,
durationMonths: newInvestDuration,
profitSharePercent: ficoShare,
lockInMonths: newInvestLock,
totalReturnPercent: newInvestTotal,
earlyExitPenalty: newInvestPenalty,
startDate: newInvestStart,
endDate: newInvestEnd,
targetAmount: newInvestTarget,
status: newInvestStatus,
description: newInvestDesc
};
const updatedPlans = [...settings.plans.investment, newPlan];
setSettings({ ...settings, plans: { ...settings.plans, investment: updatedPlans } });
setActiveInvestTab(updatedPlans.length - 1);
setAddInvestPlan(false);
setNewInvestName('');
}
};
const [activeSwapTab, setActiveSwapTab] = useState(0);
const [addSwapStationPlan, setAddSwapStationPlan] = useState(false);
const [newSwapName, setNewSwapName] = useState('');
const [newSwapStatus, setNewSwapStatus] = useState('active');
const [newSwapBatteryCount, setNewSwapBatteryCount] = useState(10);
const [newSwapPrice, setNewSwapPrice] = useState(50);
const [newSwapMonthly, setNewSwapMonthly] = useState(500);
const [newSwapDaily, setNewSwapDaily] = useState(20);
const [newSwapMin, setNewSwapMin] = useState(1);
const [newSwapMax, setNewSwapMax] = useState(5);
const [newSwapProfit, setNewSwapProfit] = useState(50);
const [newSwapDesc, setNewSwapDesc] = useState('');
const createSwapStationPlan = () => {
if (newSwapName.trim() && typeof window !== 'undefined') {
const newPlan = {
id: 'ss_' + Date.now(),
name: newSwapName,
batteryCount: newSwapBatteryCount,
swapPrice: newSwapPrice,
monthlySubscription: newSwapMonthly,
dailySubscription: newSwapDaily,
minBatteries: newSwapMin,
maxBatteries: newSwapMax,
profitSharePercent: newSwapProfit,
status: newSwapStatus,
description: newSwapDesc
};
const updatedPlans = [...settings.plans.swapStation, newPlan];
setSettings({ ...settings, plans: { ...settings.plans, swapStation: updatedPlans } });
setActiveSwapTab(updatedPlans.length - 1);
setAddSwapStationPlan(false);
setNewSwapName('');
}
};
const [activeRiderTab, setActiveRiderTab] = useState(0);
const [addRiderPlan, setAddRiderPlan] = useState(false);
const [newRiderName, setNewRiderName] = useState('');
const [newRiderTier, setNewRiderTier] = useState('Standard');
const [newRiderStatus, setNewRiderStatus] = useState('active');
const [newRiderMin, setNewRiderMin] = useState(1);
const [newRiderMax, setNewRiderMax] = useState(10);
const [newRiderMonthly, setNewRiderMonthly] = useState(500);
const [newRiderDaily, setNewRiderDaily] = useState(30);
const [newRiderDeposit, setNewRiderDeposit] = useState(1000);
const [newRiderCommission, setNewRiderCommission] = useState(50);
const [newRiderTarget, setNewRiderTarget] = useState(5);
const [newRiderHoliday, setNewRiderHoliday] = useState(0);
const [newRiderDesc, setNewRiderDesc] = useState('');
const createRiderPlan = () => {
if (newRiderName.trim() && typeof window !== 'undefined') {
const newPlan = {
id: 'rider_' + Date.now(),
name: newRiderName,
tier: newRiderTier,
minRiders: newRiderMin,
maxRiders: newRiderMax,
monthlySubscription: newRiderMonthly,
dailySubscription: newRiderDaily,
deposit: newRiderDeposit,
commissionPercent: newRiderCommission,
dailyRideTarget: newRiderTarget,
weeklyHoliday: newRiderHoliday,
status: newRiderStatus,
description: newRiderDesc
};
const updatedPlans = [...settings.plans.riderRequest, newPlan];
setSettings({ ...settings, plans: { ...settings.plans, riderRequest: updatedPlans } });
setActiveRiderTab(updatedPlans.length - 1);
setAddRiderPlan(false);
setNewRiderName('');
}
};
const handleSave = () => {
setSaved(true);
setTimeout(() => setSaved(false), 2000);
};
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: 'companyPolicy', label: "Company's Policy", icon: FileCheck },
{ id: 'plans', label: 'Plan Selection', icon: Package },
{ id: 'investment', label: 'Investment Plan', icon: DollarSign },
{ id: 'swapstation', label: 'Swap Station Plan', icon: Zap },
{ id: 'riderrequest', label: 'Rider Request Plan', icon: Users },
];
return (
Company Settings
Manage your company information and configurations
{/*
Save Changes
*/}
{saved && (
Settings saved successfully!
)}
{tabs.map(tab => (
setActiveTab(tab.id as typeof activeTab)}
className={`w-full flex items-center gap-3 px-3 py-2.5 rounded-lg text-sm font-medium transition-colors ${activeTab === tab.id
? 'bg-accent text-white'
: 'text-slate-600 hover:bg-slate-50'
}`}
>
{tab.label}
))}
{activeTab === 'general' && (
General Information
Description
Address
Business Registration
Documents
Drop files here or click to upload
PDF, JPG, PNG up to 10MB
)}
{activeTab === 'branding' && (
Branding & Design
Company Logo
Upload Logo (PNG, SVG)
Recommended: 200x50px
Favicon
Upload Favicon
Recommended: 32x32px
)}
{activeTab === 'social' && (
Social Media Links
FB
Facebook
setSettings({ ...settings, socialLinks: { ...settings.socialLinks, facebook: e.target.value } })}
className="flex-1 px-3 py-2 border border-slate-200 rounded-lg text-sm"
placeholder="https://facebook.com/yourpage"
/>
X
Twitter
setSettings({ ...settings, socialLinks: { ...settings.socialLinks, twitter: e.target.value } })}
className="flex-1 px-3 py-2 border border-slate-200 rounded-lg text-sm"
placeholder="https://twitter.com/yourpage"
/>
IG
Instagram
setSettings({ ...settings, socialLinks: { ...settings.socialLinks, instagram: e.target.value } })}
className="flex-1 px-3 py-2 border border-slate-200 rounded-lg text-sm"
placeholder="https://instagram.com/yourpage"
/>
IN
LinkedIn
setSettings({ ...settings, socialLinks: { ...settings.socialLinks, linkedin: e.target.value } })}
className="flex-1 px-3 py-2 border border-slate-200 rounded-lg text-sm"
placeholder="https://linkedin.com/company/yourpage"
/>
YT
YouTube
setSettings({ ...settings, socialLinks: { ...settings.socialLinks, youtube: e.target.value } })}
className="flex-1 px-3 py-2 border border-slate-200 rounded-lg text-sm"
placeholder="https://youtube.com/@yourchannel"
/>
)}
{activeTab === 'integration' && (
Email Integration (SMTP)
SMTP Host
setSettings({ ...settings, smtp: { ...settings.smtp, host: e.target.value } })}
className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1"
/>
SMTP Port
setSettings({ ...settings, smtp: { ...settings.smtp, port: parseInt(e.target.value) } })}
className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1"
/>
Username
setSettings({ ...settings, smtp: { ...settings.smtp, user: e.target.value } })}
className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1"
/>
Password
setSettings({ ...settings, smtp: { ...settings.smtp, password: e.target.value } })}
className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1"
/>
From Email
setSettings({ ...settings, smtp: { ...settings.smtp, fromEmail: e.target.value } })}
className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1"
/>
From Name
setSettings({ ...settings, smtp: { ...settings.smtp, fromName: e.target.value } })}
className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1"
/>
Encryption
{(['ssl', 'tls', 'none'] as const).map(enc => (
setSettings({ ...settings, smtp: { ...settings.smtp, encryption: enc } })}
className={`px-4 py-2 text-sm rounded-lg border ${settings.smtp.encryption === enc
? 'bg-accent text-white border-accent'
: 'border-slate-200 text-slate-600'
}`}
>
{enc.toUpperCase()}
))}
SMS Integration
)}
{activeTab === 'landing' && (
Landing Page Hero Section
Background Image
Upload Background Image
Recommended: 1920x1080px
Video URL (Optional)
setSettings({ ...settings, heroData: { ...settings.heroData, videoUrl: e.target.value } })}
className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1"
placeholder="https://youtube.com/watch?v=..."
/>
Preview
{settings.heroData.title}
{settings.heroData.subtitle}
{settings.heroData.ctaText}
)}
{activeTab === 'kyc' && (
KYC Documents
{[
{ id: 'investor', label: 'Investor' },
{ id: 'merchant', label: 'Merchant' },
{ id: 'swapstation', label: 'Swap Station' },
{ id: 'rental', label: 'Rental Types' },
].map(tab => (
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'
}`}
>
{tab.label}
))}
{activeMasterTab === 'investor' && (
Investor Documents
{settings.masterData.investorDocuments.map((doc, i) => (
{
const updated = [...settings.masterData.investorDocuments];
updated[i].required = e.target.checked;
setSettings({ ...settings, masterData: { ...settings.masterData, investorDocuments: updated } });
}}
className="w-4 h-4"
/>
{doc.name}
{doc.description}
{doc.required ? 'Required' : 'Optional'}
))}
setAddDocType('investor')}
className="mt-4 text-sm text-accent hover:underline"
>
+ Add Document
{addDocType === 'investor' && (
)}
)}
{activeMasterTab === 'merchant' && (
Merchant Documents
{settings.masterData.merchantDocuments.map((doc, i) => (
{
const updated = [...settings.masterData.merchantDocuments];
updated[i].required = e.target.checked;
setSettings({ ...settings, masterData: { ...settings.masterData, merchantDocuments: updated } });
}}
className="w-4 h-4"
/>
{doc.name}
{doc.description}
{doc.required ? 'Required' : 'Optional'}
))}
setAddDocType('merchant')}
className="mt-4 text-sm text-accent hover:underline"
>
+ Add Document
{addDocType === 'merchant' && (
)}
)}
{activeMasterTab === 'swapstation' && (
Swap Station Documents
{settings.masterData.swapStationDocuments.map((doc, i) => (
{
const updated = [...settings.masterData.swapStationDocuments];
updated[i].required = e.target.checked;
setSettings({ ...settings, masterData: { ...settings.masterData, swapStationDocuments: updated } });
}}
className="w-4 h-4"
/>
{doc.name}
{doc.description}
{doc.required ? 'Required' : 'Optional'}
))}
setAddDocType('swapstation')}
className="mt-4 text-sm text-accent hover:underline"
>
+ Add Document
{addDocType === 'swapstation' && (
)}
)}
{activeMasterTab === 'rental' && (
{settings.masterData.rentalDocuments.map((rental, ri) => (
{rental.name}
{rental.documents.length} docs
{rental.documents.map((doc, di) => (
{
const updated = [...settings.masterData.rentalDocuments];
updated[ri].documents[di].required = e.target.checked;
setSettings({ ...settings, masterData: { ...settings.masterData, rentalDocuments: updated } });
}}
className="w-4 h-4"
/>
{doc.name}
{doc.description}
{doc.required ? 'Required' : 'Optional'}
))}
setAddDocType('rental')}
className="mt-3 text-sm text-accent hover:underline"
>
+ Add Document
{addDocType === 'rental' && (
)}
))}
)}
)}
{activeTab === 'parts' && (
EV Parts
Part ID
Name
Price Range
In Stock
Type
{settings.parts.map(part => (
{part.id}
{part.name}
{part.minPrice && part.maxPrice ? (
৳{part.minPrice} - ৳{part.maxPrice}
) : part.price ? (
৳{part.price}
) : (
-
)}
{part.inStock}
{part.minPrice ? (
Range
) : (
Fixed
)}
))}
+ Add Part
)}
{activeTab === 'companyPolicy' && (
Company's Policy
setActiveMasterTab('investor')} className={`px-4 py-2 text-sm font-medium border-b-2 -mb-px ${activeMasterTab === 'investor' ? 'border-blue-500 text-blue-600' : 'border-transparent text-slate-500 hover:text-slate-700'}`}>Investor
setActiveMasterTab('merchant')} className={`px-4 py-2 text-sm font-medium border-b-2 -mb-px ${activeMasterTab === 'merchant' ? 'border-blue-500 text-blue-600' : 'border-transparent text-slate-500 hover:text-slate-700'}`}>Merchant
setActiveMasterTab('swapstation')} className={`px-4 py-2 text-sm font-medium border-b-2 -mb-px ${activeMasterTab === 'swapstation' ? 'border-blue-500 text-blue-600' : 'border-transparent text-slate-500 hover:text-slate-700'}`}>Swap Station
setActiveMasterTab('rentalType')} className={`px-4 py-2 text-sm font-medium border-b-2 -mb-px ${activeMasterTab === 'rentalType' ? 'border-blue-500 text-blue-600' : 'border-transparent text-slate-500 hover:text-slate-700'}`}>Rental Types
{activeMasterTab === 'investor' && (
Policy Title
setSettings({ ...settings, companyPolicy: { ...settings.companyPolicy, investor: { title: e.target.value, description: settings.companyPolicy?.investor?.description || '', rules: settings.companyPolicy?.investor?.rules || [] } } })} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Policy Description
setSettings({ ...settings, companyPolicy: { ...settings.companyPolicy, investor: { title: settings.companyPolicy?.investor?.title || '', description: val, rules: settings.companyPolicy?.investor?.rules || [] } } })} placeholder="Enter policy description..." minHeight={160} />
Save Changes
Policy List
{(settings.companyPolicy?.investor?.rules || []).map((policy, i) => (
{policy.name}
{policy.description}
))}
)}
{activeMasterTab === 'merchant' && (
Policy Title
setSettings({ ...settings, companyPolicy: { ...settings.companyPolicy, merchant: { title: e.target.value, description: settings.companyPolicy?.merchant?.description || '', rules: settings.companyPolicy?.merchant?.rules || [] } } })} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Policy Description
setSettings({ ...settings, companyPolicy: { ...settings.companyPolicy, merchant: { title: settings.companyPolicy?.merchant?.title || '', description: val, rules: settings.companyPolicy?.merchant?.rules || [] } } })} placeholder="Enter policy description..." minHeight={160} />
Save Changes
Policy List
{(settings.companyPolicy?.merchant?.rules || []).map((policy, i) => (
{policy.name}
{policy.description}
))}
)}
{activeMasterTab === 'swapstation' && (
Policy Title
setSettings({ ...settings, companyPolicy: { ...settings.companyPolicy, swapStation: { title: e.target.value, description: settings.companyPolicy?.swapStation?.description || '', rules: settings.companyPolicy?.swapStation?.rules || [] } } })} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Policy Description
setSettings({ ...settings, companyPolicy: { ...settings.companyPolicy, swapStation: { title: settings.companyPolicy?.swapStation?.title || '', description: val, rules: settings.companyPolicy?.swapStation?.rules || [] } } })} placeholder="Enter policy description..." minHeight={160} />
Save Changes
Policy List
{(settings.companyPolicy?.swapStation?.rules || []).map((policy, i) => (
{policy.name}
{policy.description}
))}
)}
{activeMasterTab === 'rentalType' && (
{(settings.companyPolicy?.rentalTypes || []).map((rtype, idx) => (
))}
Save Changes
)}
)}
{activeTab === 'plans' && (
Plan Selection
setActivePlanTab('singleRent')} className={`px-4 py-2 text-sm font-medium border-b-2 -mb-px ${activePlanTab === 'singleRent' ? 'border-blue-500 text-blue-600' : 'border-transparent text-slate-500 hover:text-slate-700'}`}>1. Single Rent
setActivePlanTab('rentToOwn')} className={`px-4 py-2 text-sm font-medium border-b-2 -mb-px ${activePlanTab === 'rentToOwn' ? 'border-purple-500 text-purple-600' : 'border-transparent text-slate-500 hover:text-slate-700'}`}>2. Rent to Own
setActivePlanTab('shareEv')} className={`px-4 py-2 text-sm font-medium border-b-2 -mb-px ${activePlanTab === 'shareEv' ? 'border-green-500 text-green-600' : 'border-transparent text-slate-500 hover:text-slate-700'}`}>3. Share an EV
{activePlanTab === 'singleRent' && (
{settings.plans.singleRent.map((plan, idx) => (
{/*
{plan.tier === 'Premium' ? '👑' : plan.tier === 'Standard' ? '⚖️' : '💰'} */}
SINGLE RENT - {plan.tier} - ৳{plan.dailyRent}/day
{plan.description}
Save
Daily Rent (৳)
{ 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" />
Weekly Subscription (৳)
{ 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" />
Monthly Subscription (৳)
{ 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" />
Deposit (৳)
{ 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" />
FICO Share (%)
{ 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" />
JAIBEN Keep (%)
FICO + JAIBEN =
{plan.ficoSharePercent + (100 - plan.ficoSharePercent)}% (FICO: {plan.ficoSharePercent}% + JAIBEN: {100 - plan.ficoSharePercent}%)
Description
))}
)}
{activePlanTab === 'rentToOwn' && (
{settings.plans.rentToOwn.map((plan, idx) => (
{/*
{plan.tier === 'Premium' ? '👑' : plan.tier === 'Standard' ? '⚖️' : '💰'} */}
RENT TO OWN - {plan.tier} - ৳{plan.dailyRent}/day
{plan.description}
Save
Daily Rent (৳)
{ const updated = [...settings.plans.rentToOwn]; updated[idx].dailyRent = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, rentToOwn: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Weekly Subscription (৳)
{ const updated = [...settings.plans.rentToOwn]; updated[idx].weeklySubscription = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, rentToOwn: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Monthly Subscription (৳)
{ const updated = [...settings.plans.rentToOwn]; updated[idx].monthlySubscription = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, rentToOwn: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Deposit (৳)
{ const updated = [...settings.plans.rentToOwn]; updated[idx].deposit = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, rentToOwn: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Duration (Months)
{ const updated = [...settings.plans.rentToOwn]; updated[idx].durationMonths = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, rentToOwn: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
EV Price (৳)
{ const updated = [...settings.plans.rentToOwn]; updated[idx].evPrice = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, rentToOwn: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Total Payment (৳)
{ const updated = [...settings.plans.rentToOwn]; updated[idx].totalPayment = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, rentToOwn: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Profit (৳)
{ const updated = [...settings.plans.rentToOwn]; updated[idx].profit = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, rentToOwn: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
FICO Rent Share (%)
{ const updated = [...settings.plans.rentToOwn]; updated[idx].ficoRentSharePercent = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, rentToOwn: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
FICO Profit Share (%)
{ const updated = [...settings.plans.rentToOwn]; updated[idx].ficoProfitSharePercent = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, rentToOwn: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
JAIBEN Keep (%)
FICO + JAIBEN =
{plan.ficoRentSharePercent + plan.ficoProfitSharePercent + (100 - plan.ficoRentSharePercent - plan.ficoProfitSharePercent)}% (FICO Rent: {plan.ficoRentSharePercent}% + FICO Profit: {plan.ficoProfitSharePercent}% + JAIBEN: {100 - plan.ficoRentSharePercent - plan.ficoProfitSharePercent}%)
Description
))}
)}
{activePlanTab === 'shareEv' && (
{settings.plans.shareEv.map((plan, idx) => (
{/*
{plan.tier === 'Premium' ? '👑' : plan.tier === 'Standard' ? '⚖️' : '💰'} */}
SHARE AN EV - {plan.tier} - ৳{plan.dailyRentEach}/day each (Total: ৳{plan.totalDailyRent})
{plan.description}
Save
Daily Rent Each (৳)
{ const updated = [...settings.plans.shareEv]; updated[idx].dailyRentEach = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, shareEv: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Total Daily Rent (৳)
{ const updated = [...settings.plans.shareEv]; updated[idx].totalDailyRent = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, shareEv: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Weekly Subscription Each (৳)
{ const updated = [...settings.plans.shareEv]; updated[idx].weeklySubscriptionEach = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, shareEv: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Total Weekly Subscription (৳)
{ const updated = [...settings.plans.shareEv]; updated[idx].totalWeeklySubscription = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, shareEv: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Monthly Subscription Each (৳)
{ const updated = [...settings.plans.shareEv]; updated[idx].monthlySubscriptionEach = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, shareEv: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Total Monthly Subscription (৳)
{ const updated = [...settings.plans.shareEv]; updated[idx].totalMonthlySubscription = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, shareEv: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Deposit Each (৳)
{ const updated = [...settings.plans.shareEv]; updated[idx].depositEach = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, shareEv: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Total Deposit (৳)
{ const updated = [...settings.plans.shareEv]; updated[idx].totalDeposit = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, shareEv: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
FICO Share (%)
{ const updated = [...settings.plans.shareEv]; updated[idx].ficoSharePercent = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, shareEv: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
JAIBEN Keep (%)
FICO + JAIBEN =
{plan.ficoSharePercent + (100 - plan.ficoSharePercent)}% (FICO: {plan.ficoSharePercent}% + JAIBEN: {100 - plan.ficoSharePercent}%)
Description
))}
)}
)}
{(activeTab as string) === 'investment' && (
Investment Plans
Investment Plans ({settings.plans.investment.length})
Manage investment plans for investors
{ setAddInvestPlan(true); setNewInvestName(''); }} className="px-4 py-2 bg-amber-600 text-white rounded-lg text-sm font-medium flex items-center gap-2">
New Plan
{addInvestPlan && (
New Investment Plan
Fill in the details below
setAddInvestPlan(false)} className="text-amber-600 hover:text-amber-800">
Profit from Plan Selection (FICO Share):
{settings.plans.singleRent[0]?.ficoSharePercent || 50}%
Description
Create Plan
)}
{settings.plans.investment.map((plan, idx) => (
setActiveInvestTab(idx)} className={`px-4 py-2 text-sm font-medium border-b-2 -mb-px ${activeInvestTab === idx ? 'border-amber-500 text-amber-600' : 'border-transparent text-slate-500 hover:text-slate-700'}`}> {plan.name}
))}
{settings.plans.investment.length > 0 && settings.plans.investment.map((plan, idx) => idx === activeInvestTab && (
{plan.name} - {plan.monthlyReturnPercent}% per month
{plan.description}
{plan.status}
Plan Name
{ const updated = [...settings.plans.investment]; updated[idx].name = e.target.value; setSettings({ ...settings, plans: { ...settings.plans, investment: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Status
{ const updated = [...settings.plans.investment]; updated[idx].status = e.target.value; setSettings({ ...settings, plans: { ...settings.plans, investment: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1">
Active
Paused
Closed
Target Amount (৳)
{ const updated = [...settings.plans.investment]; updated[idx].targetAmount = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, investment: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Start Date
{ const updated = [...settings.plans.investment]; updated[idx].startDate = e.target.value; setSettings({ ...settings, plans: { ...settings.plans, investment: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
End Date
{ const updated = [...settings.plans.investment]; updated[idx].endDate = e.target.value; setSettings({ ...settings, plans: { ...settings.plans, investment: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Min Investment (৳)
{ const updated = [...settings.plans.investment]; updated[idx].minInvestment = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, investment: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Max Investment (৳)
{ const updated = [...settings.plans.investment]; updated[idx].maxInvestment = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, investment: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Monthly Return (%)
{ const updated = [...settings.plans.investment]; updated[idx].monthlyReturnPercent = parseFloat(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, investment: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Duration (Months)
{ const updated = [...settings.plans.investment]; updated[idx].durationMonths = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, investment: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Lock-in Period (Months)
{ const updated = [...settings.plans.investment]; updated[idx].lockInMonths = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, investment: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Total Return (%)
{ const updated = [...settings.plans.investment]; updated[idx].totalReturnPercent = parseFloat(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, investment: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Early Exit Penalty (%)
{ const updated = [...settings.plans.investment]; updated[idx].earlyExitPenalty = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, investment: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Profit from Plan Selection (FICO Share):
{settings.plans.singleRent[0]?.ficoSharePercent || 50}%
Description
Save Changes
))}
)}
{(activeTab as string) === 'swapstation' && (
Swap Station Plans
Swap Station Plans ({settings.plans.swapStation.length})
Manage swap station plans for operators
{ setAddSwapStationPlan(true); setNewSwapName(''); }} className="px-4 py-2 bg-blue-600 text-white rounded-lg text-sm font-medium flex items-center gap-2">
New Plan
{addSwapStationPlan && (
New Swap Station Plan
Fill in the details below
setAddSwapStationPlan(false)} className="text-blue-600 hover:text-blue-800">
)}
{settings.plans.swapStation.map((plan, idx) => (
setActiveSwapTab(idx)} className={`px-4 py-2 text-sm font-medium border-b-2 -mb-px ${activeSwapTab === idx ? 'border-blue-500 text-blue-600' : 'border-transparent text-slate-500 hover:text-slate-700'}`}> {plan.name}
))}
{settings.plans.swapStation.length > 0 && settings.plans.swapStation.map((plan, idx) => idx === activeSwapTab && (
{plan.name}
{plan.description}
{plan.status}
Plan Name
{ const updated = [...settings.plans.swapStation]; updated[idx].name = e.target.value; setSettings({ ...settings, plans: { ...settings.plans, swapStation: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Status
{ const updated = [...settings.plans.swapStation]; updated[idx].status = e.target.value; setSettings({ ...settings, plans: { ...settings.plans, swapStation: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1">
Active
Paused
Closed
Battery Count
{ const updated = [...settings.plans.swapStation]; updated[idx].batteryCount = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, swapStation: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Swap Price (৳)
{ const updated = [...settings.plans.swapStation]; updated[idx].swapPrice = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, swapStation: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Monthly Subscription (৳)
{ const updated = [...settings.plans.swapStation]; updated[idx].monthlySubscription = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, swapStation: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Daily Subscription (৳)
{ const updated = [...settings.plans.swapStation]; updated[idx].dailySubscription = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, swapStation: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Min Batteries
{ const updated = [...settings.plans.swapStation]; updated[idx].minBatteries = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, swapStation: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Max Batteries
{ const updated = [...settings.plans.swapStation]; updated[idx].maxBatteries = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, swapStation: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Profit Share (%)
{ const updated = [...settings.plans.swapStation]; updated[idx].profitSharePercent = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, swapStation: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Description
Save Changes
))}
)}
{(activeTab as string) === 'riderrequest' && (
Rider Request Plans
Rider Request Plans ({settings.plans.riderRequest.length})
Manage rider request plans for operators
{ setAddRiderPlan(true); setNewRiderName(''); }} className="px-4 py-2 bg-rose-600 text-white rounded-lg text-sm font-medium flex items-center gap-2">
New Plan
{addRiderPlan && (
New Rider Request Plan
Fill in the details below
setAddRiderPlan(false)} className="text-rose-600 hover:text-rose-800">
)}
{settings.plans.riderRequest.map((plan, idx) => (
setActiveRiderTab(idx)} className={`px-4 py-2 text-sm font-medium border-b-2 -mb-px ${activeRiderTab === idx ? 'border-rose-500 text-rose-600' : 'border-transparent text-slate-500 hover:text-slate-700'}`}>{idx + 1}. {plan.name}
))}
{settings.plans.riderRequest.length > 0 && settings.plans.riderRequest.map((plan, idx) => idx === activeRiderTab && (
{plan.name} - {plan.tier}
{plan.description}
{plan.status}
Plan Name
{ const updated = [...settings.plans.riderRequest]; updated[idx].name = e.target.value; setSettings({ ...settings, plans: { ...settings.plans, riderRequest: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Tier
{ const updated = [...settings.plans.riderRequest]; updated[idx].tier = e.target.value; setSettings({ ...settings, plans: { ...settings.plans, riderRequest: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1">
Premium
Standard
Economy
Status
{ const updated = [...settings.plans.riderRequest]; updated[idx].status = e.target.value; setSettings({ ...settings, plans: { ...settings.plans, riderRequest: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1">
Active
Paused
Closed
Min Riders
{ const updated = [...settings.plans.riderRequest]; updated[idx].minRiders = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, riderRequest: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Max Riders
{ const updated = [...settings.plans.riderRequest]; updated[idx].maxRiders = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, riderRequest: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Monthly Subscription (৳)
{ const updated = [...settings.plans.riderRequest]; updated[idx].monthlySubscription = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, riderRequest: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Daily Subscription (৳)
{ const updated = [...settings.plans.riderRequest]; updated[idx].dailySubscription = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, riderRequest: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Deposit (৳)
{ const updated = [...settings.plans.riderRequest]; updated[idx].deposit = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, riderRequest: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Commission (%)
{ const updated = [...settings.plans.riderRequest]; updated[idx].commissionPercent = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, riderRequest: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Daily Ride Target
{ const updated = [...settings.plans.riderRequest]; updated[idx].dailyRideTarget = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, riderRequest: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Weekly Holiday
{ const updated = [...settings.plans.riderRequest]; updated[idx].weeklyHoliday = parseInt(e.target.value); setSettings({ ...settings, plans: { ...settings.plans, riderRequest: updated } }); }} className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm mt-1" />
Description
Save Changes
))}
)}
);
}