@extends('admin.layout') @section('title', 'API Kullanımı') @section('page-title', 'API Kullanımı') @section('content')

Kullanım Panosu

Son {{ $days }} günün REST + MCP trafiği.

@foreach ([7 => '7 Gün', 30 => '30 Gün', 90 => '90 Gün'] as $option => $label) {{ $label }} @endforeach
Toplam İstek

{{ number_format($totalRequests, 0, ',', '.') }}

Hata Oranı

{{ $errorRate }}%

{{ number_format($errorRequests, 0, ',', '.') }} başarısız istek
Düşülen Kredi

{{ number_format($totalCreditsCharged, 0, ',', '.') }}

Ortalama Süre

{{ number_format($avgDurationMs, 0, ',', '.') }} ms

@if (!empty($statusBreakdown))
@foreach ($statusBreakdown as $status => $count) {{ $status }}: {{ number_format($count, 0, ',', '.') }} @endforeach
@endif
Günlük İstek (kaynak kırılımlı)
En Çok Kullanılan 10 SKU
@if ($topSkus->count() > 0)
@foreach ($topSkus as $row) @endforeach
SKU İstek Kredi
{{ $row->sku }} {{ number_format((int) $row->total, 0, ',', '.') }} {{ number_format((int) $row->credits, 0, ',', '.') }}
@else

Bu aralıkta kayıt yok.

@endif
En Çok Tüketen 10 Kullanıcı
@if ($topConsumers->count() > 0)
@foreach ($topConsumers as $row) @endforeach
Müşteri İstek Kredi Bakiye
@if ($row['customer']) {{ $row['customer']->name }} {{ $row['customer']->email }} @else #{{ $row['customer_id'] }} (silinmiş) @endif {{ number_format($row['total'], 0, ',', '.') }} {{ number_format($row['credits'], 0, ',', '.') }} {{ $row['customer'] ? number_format((int) $row['customer']->api_credit_balance, 0, ',', '.') : '—' }}
@else

Bu aralıkta kayıt yok.

@endif
{{-- ═══ Manuel Kredi Düzeltme ═══ --}}
Manuel Kredi Düzeltme

Pozitif miktar kredi ekler, negatif miktar düşer. Her işlem için defter (ledger) satırı yazılır ve açıklama zorunludur.

@if ($customerQuery !== '') @if ($foundCustomers->count() > 0)
@foreach ($foundCustomers as $customer) @endforeach
Müşteri Bakiye Düzeltme
{{ $customer->name }} {{ $customer->email }} {{ number_format((int) $customer->api_credit_balance, 0, ',', '.') }}
@csrf
@else

"{{ $customerQuery }}" için müşteri bulunamadı.

@endif @endif @error('api_customer_id')
{{ $message }}
@enderror @error('amount')
{{ $message }}
@enderror @error('note')
{{ $message }}
@enderror
Son Manuel Düzeltmeler
@if ($recentAdjustments->count() > 0)
@foreach ($recentAdjustments as $tx) @php $txCustomer = $adjustmentCustomers->get($tx->api_customer_id); @endphp @endforeach
Tarih Müşteri Miktar Sonraki Bakiye Referans Açıklama
{{ $tx->created_at?->format('d.m.Y H:i') ?? '—' }} @if ($txCustomer) {{ $txCustomer->name }} {{ $txCustomer->email }} @else #{{ $tx->api_customer_id }} @endif {{ $tx->amount > 0 ? '+' : '' }}{{ number_format($tx->amount, 0, ',', '.') }} {{ number_format($tx->balance_after, 0, ',', '.') }} {{ $tx->reference ?? '—' }} {{ $tx->meta['note'] ?? '—' }}
@else

Henüz manuel düzeltme yapılmamış.

@endif
@endsection @push('scripts') @endpush