@extends('backend.layouts.app') @section('title', __('Feature Management')) @push('styles') @endpush @section('content') @php $enabledPercent = $summary['total'] > 0 ? (int) round(($summary['enabled'] / $summary['total']) * 100) : 0; $enabledProgressStep = max(0, min(100, (int) round($enabledPercent / 5) * 5)); @endphp
{{-- Hero: compact header + inline stat summary --}}
{{ __('System Config') }}

{{ __('Feature Management') }}

{{ __('Govern what is visible and accessible across user, merchant, and agent panels from one place.') }}

{{ __('Enabled') }} {{ $summary['enabled'] }}/{{ $summary['total'] }}
{{ __('Disabled') }} {{ $summary['disabled'] }}
{{ __('Core') }} {{ $summary['core'] }}
{{ __('Role') }} {{ $summary['roles'] }}
{{-- Toolbar: search only, heading stays subtle --}}

{{ __('Feature Catalog') }}

{{ __('Flat feature switches with panel visibility at a glance.') }}

{{ __('Unified Controls') }}

{{ __('All Feature Controls') }}

{{ trans_choice('{1} :count feature|[2,*] :count features', $features->count(), ['count' => $features->count()]) }}
@forelse($features as $feature) @php $isEnabled = (bool) $feature->is_enabled; $isRoleControl = config("feature_catalog.features.{$feature->key}.manage_mode") === 'role_toggle'; $featureIconMap = [ 'deposit_money' => 'fa-wallet', 'withdraw_money' => 'fa-arrow-up', 'send_money' => 'fa-paper-plane', 'request_money' => 'fa-hand-holding-dollar', 'exchange_money' => 'fa-right-left', 'wallet_earn' => 'fa-chart-line', 'mobile_recharge' => 'fa-mobile-screen-button', 'bank_transfer' => 'fa-building-columns', 'payment_link' => 'fa-link', 'merchant_payment' => 'fa-store', 'agent_program' => 'fa-user-tie', 'subscription_system' => 'fa-layer-group', 'p2p_marketplace' => 'fa-handshake', 'virtual_card' => 'fa-credit-card', 'referral_program' => 'fa-share-nodes', 'user_ranks' => 'fa-award', 'vouchers' => 'fa-gift', ]; $featureIcon = $featureIconMap[$feature->key] ?? 'fa-sliders'; $declaredPanels = (array) config("feature_catalog.features.{$feature->key}.panels", []); $rulePanels = $feature->accessRules->pluck('panel')->all(); $defaultVisiblePanels = collect($declaredPanels) ->filter(fn ($visible, $panel): bool => (bool) $visible && ! in_array($panel, $rulePanels, true)) ->keys(); $panelsVisible = $feature->accessRules ->where('is_visible', true) ->pluck('panel') ->merge($defaultVisiblePanels) ->intersect(\App\Models\FeatureAccessRule::PANELS) ->unique() ->values(); @endphp @if($loop->first)
@endif

{{ __($feature->label) }} @if($isRoleControl) {{ __('Role switch') }} @endif @if($feature->is_core) {{ __('Core') }} @endif

@csrf @method('PATCH')

{{ __($feature->description) }}

@if($isRoleControl) {{ __('Enable / disable only') }} @else @forelse($panelsVisible as $panel) {{ ucfirst($panel) }} @empty {{ __('No panel') }} @endforelse @endif
@unless($isRoleControl) @endunless
@if($loop->last)
@endif @empty @endforelse
{{-- Confirmation modal (re-used by every inline toggle) --}}
@endsection @push('scripts') @endpush