refactor: replace Master Data tab with standalone KYC Documents tab in company settings
This commit is contained in:
@@ -251,8 +251,8 @@ const initialSettings: CompanySettings = {
|
||||
|
||||
export default function CompanySettingsPage() {
|
||||
const [settings, setSettings] = useState<CompanySettings>(initialSettings);
|
||||
const [activeTab, setActiveTab] = useState<'general' | 'branding' | 'social' | 'integration' | 'landing' | 'master' | 'rental'>('general');
|
||||
const [activeMasterTab, setActiveMasterTab] = useState<'kyc' | 'investor' | 'merchant' | 'swapstation' | 'rental' | 'plans' | 'parts' | 'service'>('kyc');
|
||||
const [activeTab, setActiveTab] = useState<'general' | 'branding' | 'social' | 'integration' | 'landing' | 'kyc' | 'rental'>('general');
|
||||
const [activeMasterTab, setActiveMasterTab] = useState<'investor' | 'merchant' | 'swapstation' | 'rental'>('investor');
|
||||
const [saved, setSaved] = useState(false);
|
||||
|
||||
const handleSave = () => {
|
||||
@@ -266,7 +266,8 @@ export default function CompanySettingsPage() {
|
||||
{ id: 'social', label: 'Social Media', icon: Link2 },
|
||||
{ id: 'integration', label: 'Integrations', icon: Mail },
|
||||
{ id: 'landing', label: 'Landing Page', icon: Monitor },
|
||||
{ id: 'master', label: 'Master Data', icon: Package },
|
||||
|
||||
{ id: 'kyc', label: 'KYC Documents', icon: Package },
|
||||
{ id: 'rental', label: 'Rental Policy', icon: FileCheck },
|
||||
];
|
||||
|
||||
@@ -298,11 +299,10 @@ export default function CompanySettingsPage() {
|
||||
<button
|
||||
key={tab.id}
|
||||
onClick={() => 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'
|
||||
}`}
|
||||
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.icon className="w-4 h-4" />
|
||||
{tab.label}
|
||||
@@ -712,11 +712,10 @@ export default function CompanySettingsPage() {
|
||||
<button
|
||||
key={enc}
|
||||
onClick={() => 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'
|
||||
}`}
|
||||
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()}
|
||||
</button>
|
||||
@@ -852,59 +851,30 @@ export default function CompanySettingsPage() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{activeTab === 'master' && (
|
||||
{activeTab === 'kyc' && (
|
||||
<div className="p-6 space-y-6">
|
||||
<h3 className="text-lg font-semibold text-slate-800">Master Data</h3>
|
||||
<h3 className="text-lg font-semibold text-slate-800">KYC Documents</h3>
|
||||
|
||||
<div className="flex flex-wrap gap-2 border-b border-slate-200 pb-2">
|
||||
{[
|
||||
{ id: 'kyc', label: 'KYC Documents' },
|
||||
{ id: 'investor', label: 'Investor' },
|
||||
{ id: 'merchant', label: 'Merchant' },
|
||||
{ id: 'swapstation', label: 'Swap Station' },
|
||||
{ id: 'rental', label: 'Rental Types' },
|
||||
{ id: 'plans', label: 'Subscription Plans' },
|
||||
].map(tab => (
|
||||
<button
|
||||
key={tab.id}
|
||||
onClick={() => setActiveMasterTab(tab.id as typeof activeMasterTab)}
|
||||
className={`px-3 py-1.5 text-sm rounded-lg ${
|
||||
activeMasterTab === tab.id
|
||||
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}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{activeMasterTab === 'kyc' && (
|
||||
<div>
|
||||
<h4 className="font-medium text-slate-700 mb-3">KYC Documents Required</h4>
|
||||
<div className="space-y-2">
|
||||
{settings.masterData.kycDocuments.map((doc, i) => (
|
||||
<div key={i} className="flex items-center gap-3 p-2 border border-slate-200 rounded-lg">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={doc.required}
|
||||
onChange={(e) => {
|
||||
const updated = [...settings.masterData.kycDocuments];
|
||||
updated[i].required = e.target.checked;
|
||||
setSettings({ ...settings, masterData: { ...settings.masterData, kycDocuments: updated } });
|
||||
}}
|
||||
className="w-4 h-4"
|
||||
/>
|
||||
<span className="flex-1 text-sm">{doc.name}</span>
|
||||
<span className={`text-xs px-2 py-0.5 rounded ${doc.required ? 'bg-red-100 text-red-700' : 'bg-slate-100 text-slate-500'}`}>
|
||||
{doc.required ? 'Required' : 'Optional'}
|
||||
</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{activeMasterTab === 'investor' && (
|
||||
<div>
|
||||
<h4 className="font-medium text-slate-700 mb-3">Investor Documents</h4>
|
||||
@@ -1026,32 +996,11 @@ export default function CompanySettingsPage() {
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
<button className="mt-3 text-sm text-accent hover:underline">+ Add Document</button>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{activeMasterTab === 'plans' && (
|
||||
<div>
|
||||
<h4 className="font-medium text-slate-700 mb-3">Subscription Plans</h4>
|
||||
<div className="grid lg:grid-cols-2 gap-4">
|
||||
{settings.masterData.subscriptionPlans.map((plan, i) => (
|
||||
<div key={i} className="p-4 border border-slate-200 rounded-lg">
|
||||
<div className="flex justify-between items-center">
|
||||
<span className="font-medium">{plan.name}</span>
|
||||
<span className="text-lg font-bold text-accent">৳{plan.price}</span>
|
||||
</div>
|
||||
<p className="text-sm text-slate-500">{plan.duration} days</p>
|
||||
<div className="mt-2 flex flex-wrap gap-1">
|
||||
{plan.features.map((f, j) => (
|
||||
<span key={j} className="text-xs px-2 py-0.5 bg-slate-100 rounded">{f}</span>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user