@extends('layouts.main') @section('style') @endsection @section('content')
{{-- We must wrap the form around everything --}}
@csrf {{-- Hidden fields for password and discounts --}} {{-- --}}
{{-- Increased gutter for overall layout --}} {{-- Order Summary Column (Left) --}}

Your Order

@php // --- THIS IS YOUR ORIGINAL CALCULATION LOGIC --- // I've just moved it to the top so $total is available for the JS. $subtotal = 0; foreach ($receiver_data as $item) { $subtotal += $item->price * $item->quantity; } $shipping = $shipping ?? 0; $taxRate = $taxRate ?? 0; $tax = $subtotal * $taxRate; // THIS IS THE KEY VARIABLE FOR THE JAVASCRIPT $total = $subtotal + $tax + $shipping; @endphp
    {{-- --- THIS IS YOUR ORIGINAL ITEM LOOP --- --}} @forelse ($receiver_data as $item)
  • {{ $item->product->name }}

    ({{ $item->quantity }}x {{ AmountFormat($item->price) }}) {{ AmountFormat($item->price * $item->quantity) }}
  • @empty
  • No items to display.

  • @endforelse {{-- --- THIS IS YOUR ORIGINAL CALCULATION DISPLAY --- --}} @if ($subtotal > 0) {{-- Subtotal --}}
  • Subtotal

    {{ AmountFormat($subtotal) }}

  • {{-- Shipping (conditional) --}} @if ($shipping > 0)
  • Shipping

    {{ AmountFormat($shipping) }}

  • @endif {{-- Tax --}} @if ($tax > 0)
  • Tax ({{ $taxRate * 100 }}%)

    {{ AmountFormat($tax) }}

  • @endif {{-- --- NEW --- Injected Discount Rows --}}
  • Coins Discount-₹0.00
  • Coupon Discount -₹0.00
  • {{-- --- MODIFIED --- Grand Total (Now JS-controlled) --}}
  • Total
    {{-- This ID is new, so JS can update it --}}
    {{ AmountFormat($total) }}
  • @endif
{{-- Address & Billing Column (Right) --}}
Address
@php $addressFields = [ // 'salutation' => 'Salutation', 'country' => 'Country', 'postcode' => 'Postal Code', // ... other fields as needed ]; @endphp
@foreach ($addressFields as $key => $label)
@if ($key === 'salutation') @elseif($key === 'postcode' || $key === 'country') @else @endif
@endforeach
Billing Address
@php $billingFields = $addressFields; @endphp
@foreach ($billingFields as $key => $label)
@if ($key === 'salutation') @elseif($key === 'postcode' || $key === 'country') @else @endif
@endforeach

{{-- --- NEW: Coupon Code Section --- --}}
Discounts
@error('coupon_code')
{{ $message }}
@enderror
{{-- --- NEW: Coin Usage Section --- --}} @php // This logic is from your reference file $initial_coins_to_use = 0; if ((float) getSetting('coin_value') > 0 && Auth::check() && Auth::user()->coins > 0) { $coinValue = (float) getSetting('coin_value'); $maxCoinsForTotal = floor($total / $coinValue); // Using $total from this page $maxCoinsUserHas = Auth::user()->coins; $initial_coins_to_use = min($maxCoinsForTotal, $maxCoinsUserHas); } @endphp
Use Coins
Coin

{{-- --- NEW: Payment Method Section --- --}}
Select Payment Method
{{-- Payment Button --}}
{{-- End of card wrapper for form --}}
{{-- Password Modal (from checkout-combined) --}} {{-- Coupon Alert Modal (from cart) --}} @endsection @push('script') {{-- --- SCRIPT FROM checkout-combined.blade.php --- --}} {{-- --- SCRIPT FROM cart.blade.php (Now using your $total) --- --}} {{-- --- NEW --- Merged Form Submission Logic --- --}} @endpush