'use client'; import { useState } from 'react'; import { PartnerConfig } from '@/lib/types/settings'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; import { Switch } from '@/components/ui/switch'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'; import { Checkbox } from '@/components/ui/checkbox'; import { updateSystemSetting } from '@/lib/actions/settings'; import { toast } from 'sonner'; import { Handshake, Banknote, FileCheck } from 'lucide-react'; interface PartnerGovernanceProps { config: PartnerConfig; onUpdate: (data: PartnerConfig) => void; } export function PartnerGovernanceTab({ config, onUpdate }: PartnerGovernanceProps) { const [loading, setLoading] = useState(false); const [state, setState] = useState(config); const handleSave = async () => { setLoading(true); try { const res = await updateSystemSetting('partner', state); if (res.success && res.updatedSettings.partner) { toast.success('Partner governance rules updated'); onUpdate(res.updatedSettings.partner); } } catch (error) { toast.error('Failed to update partner settings'); } finally { setLoading(false); } }; const toggleKycDoc = (doc: 'pan' | 'gst' | 'aadhaar' | 'cheque') => { const current = state.allowedKycDocs; const updated = current.includes(doc) ? current.filter(d => d !== doc) : [...current, doc]; setState({ ...state, allowedKycDocs: updated }); }; return (
Block payouts until verified.
Admins must approve live events.