@extends('layouts.app') @section('title', 'API Source Details') @section('breadcrumb') @endsection @section('styles') @endsection @section('content')

{{ $apiSource->name }}

API Source Information

{{ $apiSource->name }}

{{ ucfirst($apiSource->status) }}

@if($apiSource->description)

{{ $apiSource->description }}

@endif
API Configuration

{{ $apiSource->method }}

{{ $apiSource->table_name }}

{{ $apiSource->auth_type == 'none' ? 'None' : ucfirst(str_replace('_', ' ', $apiSource->auth_type)) }}


Scheduling

{{ ucfirst($apiSource->schedule_type) }} @if($apiSource->schedule_frequency && $apiSource->schedule_type !== 'manual') Every {{ $apiSource->schedule_frequency }} {{ $apiSource->schedule_type == 'hourly' ? 'hour(s)' : ($apiSource->schedule_type == 'daily' ? 'day(s)' : 'week(s)') }} @endif

@if($apiSource->last_fetched_at) {{ $apiSource->last_fetched_at->format('d M Y, H:i:s') }} ({{ $apiSource->last_fetched_at->diffForHumans() }}) @else Never @endif

{{ $apiSource->created_at->format('d M Y, H:i:s') }} ({{ $apiSource->created_at->diffForHumans() }})

{{ $apiSource->updated_at->format('d M Y, H:i:s') }} ({{ $apiSource->updated_at->diffForHumans() }})

Recent Activity
View All Logs
@php $recentLogs = $apiSource->apiLogs()->latest()->limit(5)->get(); @endphp @if($recentLogs->count() > 0) @foreach($recentLogs as $log)
{{ $log->status_code >= 200 && $log->status_code < 300 ? 'Data Import Successful' : 'Import Failed' }}
{{ $log->created_at->format('d M Y, H:i:s') }} ({{ $log->created_at->diffForHumans() }})
@if($log->status_code >= 200 && $log->status_code < 300 && $log->response_data)
Data imported successfully
@endif @if($log->error_message)
{{ Str::limit($log->error_message, 100) }}
@endif
@if($log->status_code) {{ $log->status_code }} @endif @if($log->response_time)
{{ number_format($log->response_time, 2) }}s
@endif
@endforeach @else

No activity logs found

@endif
Quick Actions
Edit Source View All Logs View Data
Statistics
@php $totalLogs = $apiSource->apiLogs()->count(); $successLogs = $apiSource->apiLogs()->where('status_code', '>=', 200)->where('status_code', '<', 300)->count(); $errorLogs = $apiSource->apiLogs()->where('status_code', '>=', 400)->count(); $totalRecords = $successLogs; // Use success count as proxy for records $avgResponseTime = $apiSource->apiLogs()->where('status_code', '>=', 200)->where('status_code', '<', 300)->avg('response_time'); @endphp
{{ $totalLogs }}
Total Requests
{{ $successLogs }}
Successful
{{ $errorLogs }}
Failed
{{ number_format($totalRecords) }}
Records Imported
@if($avgResponseTime)
Average Response Time
{{ number_format($avgResponseTime, 2) }}s
@endif @if($totalLogs > 0)
Success Rate {{ number_format(($successLogs / $totalLogs) * 100, 1) }}%
@endif
API Test

Test the API endpoint to check connectivity and response.

@push('scripts') @endpush @endsection