@foreach($invoice?->items as $item)
@php
$subTotal = $subTotal + $item->price;
$discountAmount = $discountAmount + $item?->discount_amount;
@endphp
{{ $item->title }}
@if(!empty($item?->options['discount_code']))
Code: #{{$item?->options['discount_code'] }}
@endif
@if(auth()->user()->role == 'tutor' || auth()->user()->role == 'student')
@endif
{{ $item->quantity}}
@if(!empty($item?->discount_amount))
{{ formatAmount($item->price) }}
{{ formatAmount($item->total) }}
@else
@if(auth()->user()->role == 'student' || auth()->user()->role == 'admin')
{{ !empty($item->extra_fee) ? formatAmount($item->price + $item->extra_fee) : formatAmount($item->price) }}
@else
{{ formatAmount($item->price) }}
@endif
@endif
@if(auth()->user()->role == 'tutor' || auth()->user()->role == 'admin')
@php
$commission = is_numeric(getCommission($item->total)) ? getCommission($item->total) : 0;
$tutor_payout = !empty($item->options['tutor_payout']) && is_numeric($item->options['tutor_payout']) ? $item->options['tutor_payout'] : ($item->total - $commission);
@endphp
{{ formatAmount($tutor_payout) }}
@endif
@if(auth()->user()->role == 'admin')
{{ formatAmount($item->platform_fee) }}
@endif
@if(auth()->user()->role == 'admin' || auth()->user()->role == 'student')
{{ !empty($item->extra_fee) ? formatAmount($item->extra_fee) : '-' }}
@endif
{{ formatAmount($item->total) }}
@endforeach
{{ __('invoices.invoice_subtotal') }}
@if(auth()->user()->role == 'tutor' || auth()->user()->role == 'student')
@endif
@if(auth()->user()->role == 'student')
@endif
@if(auth()->user()->role == 'admin')
@endif
@if(auth()->user()->role == 'tutor' || auth()->user()->role == 'admin')
@endif
{{ formatAmount($subTotal) }}