@extends('layouts.admin-sidebar') @section('title', 'Profit Margins Management') @section('page-title', 'Profit Margins') @section('page-description', 'Configure profit margins for airtime and data services') @section('content')
@if(isset($error))

Database Error

{{ $error }}

@endif @if(session('success'))

Success

{{ session('success') }}

@endif @if(session('error'))

Error

{{ session('error') }}

@endif @if($errors->any())

Validation Errors

    @foreach($errors->all() as $error)
  • {{ $error }}
  • @endforeach
@endif

Profit Margins Management

Set and manage profit margins for different networks and services

Network-Specific Margins

@if(empty($margins))

No margins configured

Database tables may not be initialized. Please run migrations.

@else
@csrf
@foreach($margins as $network_code => $services)
{{ strtoupper(substr($network_code, 0, 3)) }}

{{ ucfirst($network_code) }}

Active @if(isset($networkStats[$network_code]) && $networkStats[$network_code]['providers_count'] > 0) {{ $networkStats[$network_code]['providers_count'] }} Provider{{ $networkStats[$network_code]['providers_count'] > 1 ? 's' : '' }} @endif
@if(isset($networkStats[$network_code]))
Providers: {{ $networkStats[$network_code]['active_providers'] }}
@if($networkStats[$network_code]['avg_response_time'] > 0)
Avg Response: {{ number_format($networkStats[$network_code]['avg_response_time']) }}ms
@endif
@endif
@if(isset($services['airtime']))
%
Example: ₦100 → ₦{{ number_format(100 + (($services['airtime']->margin_percentage ?? 2.5) / 100 * 100), 2) }}
@endif @if(isset($services['data']))
%
Example: ₦1000 → ₦{{ number_format(1000 + (($services['data']->margin_percentage ?? 3.0) / 100 * 1000), 2) }}
@endif
@endforeach
@if(!empty($margins))
@endif
@endif
@endsection