@extends('api_panel.layouts.app') @section('title', \App\Services\ApiPlatform\ProductCatalog::text('apipanel-access-title', 'Erişimlerim', 'My access')) @section('content') @php use App\Services\ApiPlatform\ProductCatalog; /** Durum rozeti: [etiket tr, etiket en, css sınıfı] */ $stateLabels = [ 'free' => ['Ücretsiz', 'Free', 'is-active'], 'plan' => ['Plan kapsamında', 'Included in plan', 'is-active'], 'pack' => ['Paket bakiyeniz var', 'Pack balance available', 'is-active'], 'credits' => ['Kredi ile kullanılabilir', 'Usable with credits', 'is-monthly'], 'none' => ['Erişim yok', 'No access', 'is-danger'], ]; @endphp

{{ ProductCatalog::text('apipanel-access-title', 'Erişimlerim', 'My access') }}

{{ ProductCatalog::text('apipanel-access-subtitle', 'Şu anda hangi endpointleri çağırabildiğinizin tam dökümü.', 'A full breakdown of the endpoints you can call right now.') }}

{{-- ─── Özet ─── --}}
{{ t('apipanel-stat-plan') }} {{ $plan ? t((string) $plan->name_key) : t('apipanel-stat-no-plan') }} @if($planSubscription && $planSubscription->ends_at) {{ t('apipanel-stat-plan-until') }}: {{ $planSubscription->ends_at->format('d.m.Y') }} @endif
{{ t('apipanel-stat-quota') }} @if(!$plan) — @elseif($snapshot['quota_remaining'] === null) {{ t('apipanel-stat-unlimited') }} @else {{ number_format((int) $snapshot['quota_remaining']) }} @endif @if($plan && !$plan->isUnlimited()) / {{ number_format((int) $plan->monthly_request_quota) }} {{ t('apipanel-usage-requests') }} / {{ t('apipanel-month') }} @endif
{{ t('apipanel-stat-credits') }} {{ number_format($credits) }} {{ ProductCatalog::text('apipanel-access-credits-note', 'Kredi her endpointte geçerlidir.', 'Credits work on every endpoint.') }}
@unless($hasAnyAccess)

{{ ProductCatalog::text('apipanel-access-empty-title', 'Henüz bir erişiminiz yok', 'You have no access yet') }}

{{ ProductCatalog::text('apipanel-access-empty-text', 'Bir plan, kredi paketi veya tek endpoint için istek paketi alarak başlayın. Geo Location endpointleri her zaman ücretsizdir.', 'Start with a plan, a credit pack or a request pack for a single endpoint. Geo Location endpoints are always free.') }}

{{ t('apipanel-nav-store') }}
@endunless {{-- ─── Ürün bazlı erişim ─── --}}

{{ ProductCatalog::text('apipanel-access-products-title', 'Ürün bazlı erişim', 'Access by product') }}

@foreach($products as $product) @php [$stateTr, $stateEn, $stateClass] = $stateLabels[$product['state']]; @endphp

{{ $product['name'] }}

{{ $product['tagline'] }}

{{ ProductCatalog::text('apipanel-access-state-' . $product['state'], $stateTr, $stateEn) }} @if($product['balance_count'] > 0) {{ $product['balance_count'] }} {{ ProductCatalog::text('apipanel-access-balance-unit', 'paket bakiyesi', 'pack balances') }} @endif @if($product['subscription_count'] > 0) {{ $product['subscription_count'] }} {{ ProductCatalog::text('apipanel-access-subscription-unit', 'aylık abonelik', 'monthly subscriptions') }} @endif
@if($product['is_mcp']) @if(in_array($product['state'], ['plan', 'pack'], true)) {{ ProductCatalog::text('apipanel-product-mcp-cta', 'Nasıl bağlanır', 'How to connect') }} @else {{ ProductCatalog::text('apipanel-product-mcp-upgrade', 'MCP\'li plana yükselt', 'Upgrade to an MCP-enabled plan') }} @endif @elseif($product['state'] === 'none') {{ t('apipanel-store-buy') }} @else {{ $product['sku_count'] }} {{ ProductCatalog::text('apipanel-products-endpoint-unit', 'endpoint', 'endpoints') }} @endif
@endforeach
{{-- ─── Tek seferlik SKU bakiyeleri ─── --}}

{{ t('apipanel-offer-onetime') }} — {{ ProductCatalog::text('apipanel-access-balances-title', 'İstek paketi bakiyeleri', 'Request pack balances') }}

@if(empty($skuBalances))

{{ ProductCatalog::text('apipanel-access-balances-empty', 'Tek seferlik istek paketi bakiyeniz yok.', 'You have no one-time request pack balance.') }}

@else
@foreach($skuBalances as $balance) @endforeach
{{ t('apipanel-usage-sku') }} {{ ProductCatalog::text('apipanel-access-remaining', 'Kalan istek', 'Remaining requests') }}
{{ $balance['name'] }} {{ $balance['sku'] }} {{ number_format($balance['remaining']) }}
@endif
{{-- ─── Aylık endpoint abonelikleri ─── --}}

{{ t('apipanel-offer-monthly') }} — {{ ProductCatalog::text('apipanel-access-subscriptions-title', 'Endpoint abonelikleri', 'Endpoint subscriptions') }}

@if(empty($endpointSubscriptions))

{{ ProductCatalog::text('apipanel-access-subscriptions-empty', 'Aylık endpoint aboneliğiniz yok.', 'You have no monthly endpoint subscription.') }}

@else
@foreach($endpointSubscriptions as $subscription) @endforeach
{{ t('apipanel-usage-sku') }} {{ ProductCatalog::text('apipanel-access-period-quota', 'Dönem kotası', 'Period quota') }} {{ ProductCatalog::text('apipanel-access-remaining', 'Kalan istek', 'Remaining requests') }} {{ t('apipanel-stat-plan-until') }}
{{ $subscription['name'] }} {{ $subscription['sku'] }} {{ number_format($subscription['quota']) }} {{ number_format($subscription['remaining']) }} {{ $subscription['ends_at'] ? $subscription['ends_at']->format('d.m.Y') : '—' }}
@endif
@endsection