@extends('layouts.app') @php $locale = app()->getLocale(); // Get first cart item for breadcrumb $firstItem = collect($cart)->first(); $planName = $firstItem['name'] ?? __('Order'); $cartCount = collect($cart)->sum('quantity'); $hasPlanItems = collect($cart)->contains(fn($item) => !empty($item['options']['duration_days'])); @endphp @section('title', __('Checkout') . ' | ' . $siteName) @section('description', __('Complete your order to start your healthy journey')) @section('content')
{{-- Breadcrumb --}}
@csrf
{{-- ── Left Column: Options & Info ─────────────────── --}}
{{-- Select Options --}}

{{ __('Select Options') }}

{{-- Start Date --}}

{{ __('Start Date') }}

@php $defaultDate = old('start_date', date('Y-m-d', strtotime('+1 day'))); $dateObj = \Carbon\Carbon::parse($defaultDate); @endphp {{ $dateObj->format('d') }} {{ $dateObj->translatedFormat('M Y') }}
@error('start_date')

{{ $message }}

@enderror
{{-- Duration (only for meal plan subscriptions) --}} @if($hasPlanItems)

{{ __('Duration') }}

@error('duration')

{{ $message }}

@enderror
@else @endif {{-- Delivery Preference --}}

{{ __('Delivery Preference') }}

@error('delivery_type')

{{ $message }}

@enderror
{{-- Coupon Code --}}

{{ __('Coupon Code') }} ({{ __('optional') }})

{{-- User Information --}}

{{ __('User Information') }}

@error('name')

{{ $message }}

@enderror

{{ __('Phone verified') }}

@error('phone')

{{ $message }}

@enderror
@error('email')

{{ $message }}

@enderror
{{-- Delivery Address --}}

{{ __('Delivery Address') }}

@error('zone_id')

{{ $message }}

@enderror
@error('street')

{{ $message }}

@enderror
{{-- Branch Pickup --}}

{{ __('Pickup Branch') }}

{{-- Payment Info --}}

{{ __('Payment') }}

{{ __('payment.secure_checkout') }}

{{ __('payment.methods_available') }}

{{-- ── Right Column: Order Summary ──────────────────── --}}

{{ __('Order Summary') }}

{{-- Cart Items --}} @foreach($cart as $key => $item) @php $itemImg = $item['image'] ?? ''; $itemImgUrl = str_starts_with($itemImg, 'http') ? $itemImg : ($itemImg ? asset($itemImg) : asset('assets/images/plan-1.png')); @endphp
{{ $item['name'] }}

{{ $item['name'] }}

{{ __('Qty') }}: {{ $item['quantity'] }} @if(!empty($item['options']['mealType'])) {{ __(ucfirst($item['options']['mealType'])) }} @endif @if(!empty($item['options']['calories'])) {{ $item['options']['calories'] }} {{ __('Kcal') }} @endif

SAR {{ number_format($item['price'] * $item['quantity'], 2) }}
@endforeach {{-- Payment Summary --}}

{{ __('Payment Summary') }}

{{ __('Items Total') }} ({{ __('Incl. VAT') }}) SAR
{{ __('Delivery fees') }} SAR
{{ __('Discount') }} - SAR
{{ __('VAT included') }} ({{ (int)(\App\Models\Settings\Setting::getValue('vat_rate', 15)) }}%) SAR
{{-- Total --}}
{{ __('Total') }} ({{ __('Incl. VAT') }}) SAR
{{-- Proceed to Payment Button --}}
{{-- ── OTP Verification Modal (teleported to body) ──── --}}
@endsection @push('styles') @endpush @push('scripts') @if($locale === 'ar') @endif @endpush