@php $pkg = $package ?? null; $lim = $limits ?? null; // Use the same source the send path uses, so numbers match reality. $cm = new \App\Classes\CreditOveruseManager($user->id); // Email credits $creditsEnabled = $cm->isCreditsEnabled(); $creditsBalance = (int) $cm->getCurrentCredits(); $creditsMonthly = (int) $cm->getMonthlyCredits(); $creditsUsed = $creditsMonthly > 0 ? max(0, $creditsMonthly - $creditsBalance) : 0; // Transactional credits $transEnabled = $cm->isTransCreditsEnabled(); $transBalance = (int) $cm->getCurrentTransCredits(); $transMonthly = (int) $cm->getMonthlyTransCredits(); $transUsed = $transMonthly > 0 ? max(0, $transMonthly - $transBalance) : 0; // Sending limits (fallback chain: per-user → package) $hourly = $lim->hourly_rate ?? ($pkg->hourly_email_limit ?? null); $daily = $lim->daily_limit ?? ($pkg->daily_email_limit ?? null); $monthly = $lim->monthly_limit ?? ($pkg->monthly_email_limit ?? null); // Transactional limits $transDaily = $lim->trans_daily_limit ?? ($pkg->trans_daily_limit ?? null); $transMonthlyL = $lim->trans_monthly_limit ?? ($pkg->trans_monthly_limit ?? null); $transDailyUsed = (int) ($lim->trans_sent_today ?? 0); $transMonthlyUsed = (int) ($lim->trans_sent_this_month ?? 0); @endphp
{{-- Email Credits — headline at the top --}} @if($creditsEnabled)
@lang('plan.email_sending.credits_balance')
{{ number_format($creditsBalance) }}
@lang('plan.email_sending.monthly_allocation'): @if($creditsMonthly <= 0) @lang('plan.common.unlimited') @else {{ number_format($creditsMonthly) }} @endif  ·  @lang('plan.email_sending.used_this_month'): {{ number_format($creditsUsed) }}
@if($creditsMonthly > 0) @include('plan._meter', [ 'label' => trans('plan.email_sending.credits_consumed'), 'used' => $creditsUsed, 'limit' => $creditsMonthly, 'icon' => 'la la-envelope', 'help' => $resetMonthly, ]) @endif @endif {{-- Sending limits --}}
@lang('plan.email_sending.heading_limits')
@include('plan._meter', [ 'label' => trans('plan.email_sending.monthly'), 'used' => $lim->sent_this_month ?? 0, 'limit' => $monthly, 'icon' => 'fa fa-calendar-alt', 'help' => $resetMonthly, ]) @include('plan._meter', [ 'label' => trans('plan.email_sending.daily'), 'used' => $lim->sent_today ?? 0, 'limit' => $daily, 'icon' => 'la la-calendar-check-o', 'help' => $resetDaily, ]) @include('plan._meter', [ 'label' => trans('plan.email_sending.hourly'), 'used' => 0, 'limit' => $hourly, 'icon' => 'la la-clock-o', ]) @if(!empty($pkg) && !empty($pkg->oversending))
@lang('plan.email_sending.oversending'). @if(!empty($pkg->oversending_limit) && (int) $pkg->oversending_limit > 0) @lang('plan.email_sending.oversending_line', ['percent' => (int) $pkg->oversending_limit]) @else @lang('plan.email_sending.oversending_generic') @endif
@endif {{-- Transactional --}} @if($transEnabled)
@lang('plan.email_sending.heading_transactional')
@lang('plan.email_sending.trans_credits_balance')
{{ number_format($transBalance) }}
@lang('plan.email_sending.monthly_allocation'): @if($transMonthly <= 0) @lang('plan.common.unlimited') @else {{ number_format($transMonthly) }} @endif  ·  @lang('plan.email_sending.used_this_month'): {{ number_format($transUsed) }}
@if($transMonthly > 0) @include('plan._meter', [ 'label' => trans('plan.email_sending.trans_credits_consumed'), 'used' => $transUsed, 'limit' => $transMonthly, 'icon' => 'la la-envelope', 'help' => $resetMonthly, ]) @endif @include('plan._meter', [ 'label' => trans('plan.email_sending.trans_monthly'), 'used' => $transMonthlyUsed, 'limit' => $transMonthlyL, 'icon' => 'fa fa-calendar-alt', 'help' => $resetMonthly, ]) @include('plan._meter', [ 'label' => trans('plan.email_sending.trans_daily'), 'used' => $transDailyUsed, 'limit' => $transDaily, 'icon' => 'la la-calendar-check-o', 'help' => $resetDaily, ]) @if(!empty($pkg->trans_allow_overuse) && !empty($pkg->trans_oversending_limit) && (int) $pkg->trans_oversending_limit > 0)
@lang('plan.email_sending.trans_oversending'). @lang('plan.email_sending.oversending_line', ['percent' => (int) $pkg->trans_oversending_limit])
@endif @endif
@lang('plan.common.contact_admin')