@php($shippingMethod=getWebConfig(name: 'shipping_method'))
@php($subTotal=0)
@php($totalTax=0)
@php($totalShippingCost=0)
@php($orderWiseShippingDiscount=\App\Utils\CartManager::order_wise_shipping_discount())
@php($totalDiscountOnProduct=0)
@php($totalPromoDiscount=0) {{-- NEW: إجمالي خصم العروض الترويجية --}}
@php($cart=\App\Utils\CartManager::get_cart(type: 'checked'))
@php($cartGroupIds=\App\Utils\CartManager::get_cart_group_ids())
@php($getShippingCost=\App\Utils\CartManager::get_shipping_cost(type: 'checked'))
@php($getShippingCostSavedForFreeDelivery=\App\Utils\CartManager::get_shipping_cost_saved_for_free_delivery(type: 'checked'))
@if($cart->count() > 0)
@foreach($cart as $key => $cartItem)
@php($subTotal += $cartItem['price'] * $cartItem['quantity'])
@php($totalTax += $cartItem['tax_model']=='exclude' ? ($cartItem['tax'] * $cartItem['quantity']) : 0)
@php($totalDiscountOnProduct += $cartItem['discount'] * $cartItem['quantity'])
@php($totalPromoDiscount += (float)($cartItem['promo_discount'] ?? 0)) {{-- NEW --}}
@endforeach
@if(session()->missing('coupon_type') || session('coupon_type') != 'free_delivery')
@php($totalShippingCost = $getShippingCost - $getShippingCostSavedForFreeDelivery)
@else
@php($totalShippingCost = $getShippingCost)
@endif
@endif
@php($totalSavedAmount = $totalDiscountOnProduct + $totalPromoDiscount) {{-- NEW: أضفنا خصم العروض --}}
@if(session()->has('coupon_discount') && session('coupon_discount') > 0 && session('coupon_type') != 'free_delivery')
@php($totalSavedAmount += session('coupon_discount'))
@endif
@if($getShippingCostSavedForFreeDelivery > 0)
@php($totalSavedAmount += $getShippingCostSavedForFreeDelivery)
@endif
@if($totalSavedAmount > 0)
{{translate('you_have_Saved')}}
{{ webCurrencyConverter(amount: $totalSavedAmount) }}!
@endif
{{-- نُظهر القيم الأساسية كما هي --}}
{{translate('sub_total')}}
{{ webCurrencyConverter(amount: $subTotal) }}
{{translate('tax')}}
{{ webCurrencyConverter(amount: $totalTax) }}
{{translate('shipping')}}
{{ webCurrencyConverter(amount: $totalShippingCost) }}
{{-- سطر خصم المنتج (موجود مسبقاً) --}}
{{translate('discount_on_product')}}
- {{ webCurrencyConverter(amount: $totalDiscountOnProduct) }}
{{-- NEW: سطر خصم العروض الترويجية (BOGO/percent/buy_get) --}}
@if($totalPromoDiscount > 0)
{{ translate('promotion_discount') }}
- {{ webCurrencyConverter(amount: $totalPromoDiscount) }}
@endif
@php($coupon_dis = 0)
@if(auth('customer')->check())
@if(session()->has('coupon_discount'))
@php($couponDiscount = session('coupon_discount', 0))
{{translate('coupon_discount')}}
- {{ webCurrencyConverter(amount: $couponDiscount) }}
@php($coupon_dis = $couponDiscount)
@else
@php($coupon_dis = 0)
@endif
@endif
{{-- الإجمالي النهائي: نطرح خصم المنتج + خصم العروض + كوبون + خصم شحن الطلب --}}
{{translate('total')}}
{{ webCurrencyConverter(
amount: $subTotal + $totalTax + $totalShippingCost
- $coupon_dis - $totalDiscountOnProduct - $totalPromoDiscount - $orderWiseShippingDiscount
) }}
@php($company_reliability = getWebConfig(name: 'company_reliability'))
@if($company_reliability != null)