@extends('layouts.admin', ['heading' => 'Compensation Modules', 'subheading' => 'Configure bonus engines across all MLM plan types'])

@section('content')
    <div class="admin-card p-4">
        <form method="POST" action="{{ route('admin.compensation-modules.update') }}" class="grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3">
            @csrf
            <div><label class="mb-1 block text-xs text-slate-500">Direct Referral %</label><input name="direct_income_percent" value="{{ $settings['direct_income_percent'] ?? 0 }}" type="number" step="0.0001" min="0" class="w-full rounded border p-2"></div>
            <div><label class="mb-1 block text-xs text-slate-500">Binary Rate</label><input name="binary_order_income_rate" value="{{ $settings['binary_order_income_rate'] ?? 0 }}" type="number" step="0.0001" min="0" class="w-full rounded border p-2"></div>
            <div><label class="mb-1 block text-xs text-slate-500">Level Income Levels</label><input name="level_income_levels" value="{{ $settings['level_income_levels'] ?? 0 }}" type="number" min="0" class="w-full rounded border p-2"></div>
            <div><label class="mb-1 block text-xs text-slate-500">Level Income %</label><input name="level_income_percent" value="{{ $settings['level_income_percent'] ?? 0 }}" type="number" step="0.0001" min="0" class="w-full rounded border p-2"></div>
            <div><label class="mb-1 block text-xs text-slate-500">Matrix Income %</label><input name="matrix_income_percent" value="{{ $settings['matrix_income_percent'] ?? 0 }}" type="number" step="0.0001" min="0" class="w-full rounded border p-2"></div>
            <div><label class="mb-1 block text-xs text-slate-500">Unilevel %</label><input name="unilevel_income_percent" value="{{ $settings['unilevel_income_percent'] ?? 0 }}" type="number" step="0.0001" min="0" class="w-full rounded border p-2"></div>
            <div><label class="mb-1 block text-xs text-slate-500">Generation Bonus %</label><input name="generation_bonus_percent" value="{{ $settings['generation_bonus_percent'] ?? 0 }}" type="number" step="0.0001" min="0" class="w-full rounded border p-2"></div>
            <div><label class="mb-1 block text-xs text-slate-500">Leadership Bonus %</label><input name="leadership_bonus_percent" value="{{ $settings['leadership_bonus_percent'] ?? 0 }}" type="number" step="0.0001" min="0" class="w-full rounded border p-2"></div>
            <div><label class="mb-1 block text-xs text-slate-500">Matching Bonus Fixed</label><input name="matching_bonus_fixed" value="{{ $settings['matching_bonus_fixed'] ?? 0 }}" type="number" step="0.01" min="0" class="w-full rounded border p-2"></div>
            <div><label class="mb-1 block text-xs text-slate-500">ROI %</label><input name="roi_percent" value="{{ $settings['roi_percent'] ?? 0 }}" type="number" step="0.0001" min="0" class="w-full rounded border p-2"></div>
            <div><label class="mb-1 block text-xs text-slate-500">ROI Lock Days</label><input name="roi_lock_days" value="{{ $settings['roi_lock_days'] ?? 0 }}" type="number" min="0" class="w-full rounded border p-2"></div>
            <div>
                <label class="mb-1 block text-xs text-slate-500">Rank Bonus Mode</label>
                <select name="rank_bonus_mode" class="w-full rounded border p-2">
                    <option value="fixed" @selected(($settings['rank_bonus_mode'] ?? 'fixed') === 'fixed')>Fixed</option>
                    <option value="percentage" @selected(($settings['rank_bonus_mode'] ?? '') === 'percentage')>Percentage</option>
                </select>
            </div>
            <div class="md:col-span-2 xl:col-span-3">
                <button class="rounded bg-slate-900 px-4 py-2 text-white">Save Compensation Settings</button>
            </div>
        </form>
    </div>
@endsection
