@extends('layouts.admin') @section('title', 'Commission Settings') @php $currencySymbol = App\Models\AppSetting::getValue('currency_symbol', '?'); $currencyDecimals = App\Models\AppSetting::currencyDecimals(); $restaurantSetting = $settings->where('type', 'restaurant')->first(); $driverSetting = $settings->where('type', 'driver')->first(); $posSetting = $settings->where('type', 'pos')->first(); $gstOnCommissionRate = (float) App\Models\AppSetting::getValue('gst_rate'); $gatewayFeeRate = (float) App\Models\AppSetting::getValue('gateway_fee_rate', 2); $commissionLabels = [ 'restaurant' => 'Store Earning Commission', 'driver' => 'Driver Earning Commission', 'pos' => 'POS Commission', ]; $formatCommission = fn ($setting, $fallback) => ($setting?->calculation_type ?? 'percentage') === 'fixed' ? $currencySymbol . number_format((float) ($setting?->rate ?? $fallback), $currencyDecimals) : number_format((float) ($setting?->rate ?? $fallback), 2) . '%'; $commissionAmount = fn ($setting, $base, $fallback) => min($base, ($setting?->calculation_type ?? 'percentage') === 'fixed' ? (float) ($setting?->rate ?? $fallback) : $base * ((float) ($setting?->rate ?? $fallback) / 100)); $sampleSubtotal = 500; $sampleRestaurantCommission = $commissionAmount($restaurantSetting, $sampleSubtotal, 15); $sampleGst = $sampleRestaurantCommission * ($gstOnCommissionRate / 100); $sampleDeliveryFee = 40; $samplePlatformFee = App\Models\DeliveryChargeSetting::getPlatformFee(); $sampleCustomerTax = App\Models\TaxSetting::calculateTax($sampleSubtotal, $sampleDeliveryFee); $sampleCustomerTotal = $sampleSubtotal + $sampleDeliveryFee + $samplePlatformFee + $sampleCustomerTax; $sampleGatewayFee = $sampleCustomerTotal * ($gatewayFeeRate / 100); $sampleRestaurantPayout = $sampleSubtotal - $sampleRestaurantCommission - $sampleGst - $sampleGatewayFee; $sampleDriverCommission = $commissionAmount($driverSetting, $sampleDeliveryFee, 5); @endphp @section('content')
Store Earning Commission
{{ $formatCommission($restaurantSetting, 15) }}
Applied on order subtotal
Driver Earning Commission
{{ $formatCommission($driverSetting, 5) }}
Applied on delivery fees
POS Commission
{{ $formatCommission($posSetting, 0) }}
Applied on store POS subtotal
Commission Rates Configuration
@foreach($settings as $setting) @endforeach
Type Value Calculation Type Last Updated Status
{{ $commissionLabels[$setting->type] ?? ucfirst(str_replace('_', ' ', $setting->type)) }} {{ $formatCommission($setting, 0) }} {{ ucfirst($setting->calculation_type) }} {{ $setting->updated_at->format('d M Y, h:i A') }} {{ $setting->is_active ? 'Active' : 'Inactive' }}
Commission Calculation Example
Food Subtotal: {{ $currencySymbol }}{{ number_format($sampleSubtotal, $currencyDecimals) }}

Store Earning Commission ({{ $formatCommission($restaurantSetting, 15) }}): {{ $currencySymbol }}{{ number_format($sampleRestaurantCommission, $currencyDecimals) }}
GST on Platform Commission: {{ $currencySymbol }}{{ number_format($sampleGst, $currencyDecimals) }}
Online Payment Gateway Fee: {{ $currencySymbol }}{{ number_format($sampleGatewayFee, $currencyDecimals) }}
Net Store Payout: {{ $currencySymbol }}{{ number_format($sampleRestaurantPayout, $currencyDecimals) }}
Delivery Fee: {{ $currencySymbol }}{{ number_format($sampleDeliveryFee, $currencyDecimals) }}

Driver Earning Commission ({{ $formatCommission($driverSetting, 5) }}): {{ $currencySymbol }}{{ number_format($sampleDriverCommission, $currencyDecimals) }}
Driver Earning: {{ $currencySymbol }}{{ number_format(max(0, $sampleDeliveryFee - $sampleDriverCommission), $currencyDecimals) }}
Quick Actions
View Payouts
@endsection