@lang('frontend_lang.order_summary')
@foreach($cartItems as $id => $cartItem)
@php
$weight = \App\Models\Product::find($id);
if (!empty($weight) && !empty($weight->weight))
{
$weight = $weight->weight;
}else{
$weight = 0;
}
$qty = ((int) session('cart')[$id]['quantity']);
$totalQuantity += $qty;
if (!empty($weight) && $weight > 0)
{
$totalWeight += ($weight * $qty);
}
$offer = productOfferPrice($id, $cartItem->price);
$sellingPrice =$offer['amount'] > 0 ? $offer['amount'] : $cartItem->price;
$discountPercentage = auth()->guard('web')->user()->customerGroup ? auth()->guard('web')->user()->customerGroup->percentage == 0 ? 0 : auth()->guard('web')->user()->customerGroup->percentage : 1;
$vatPercentage = ((int) session('cart')[$id]['vat']);
$itemTotalAmount = $sellingPrice * $qty;
$originalItemTotal += $itemTotalAmount;
$discount = findDiscountAmount($itemTotalAmount, $discountPercentage);
$totalDiscount += $discount;
$afterDiscountItemTotal = ($itemTotalAmount - $discount);
$totalVat += findVatAmount($afterDiscountItemTotal, $vatPercentage);
@endphp
@endforeach
@lang('frontend_lang.sub_total') ({{ $totalQuantity }} items, {{ $totalWeight }} kg)
@if($totalDiscount > 0)
@lang('frontend_lang.discount')
@endif
@if($totalVat > 0)
@lang('frontend_lang.vat')
@endif
@lang('frontend_lang.net_total')