

<?php $__env->startSection('title', 'Checkout'); ?>
<?php $__env->startSection('meta_description', 'Checkout – ' . ($store_name ?? config('app.name'))); ?>

<?php $__env->startSection('content'); ?>
<div class="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-6">
    <h1 class="text-2xl font-bold text-gray-800 mb-6">Checkout</h1>

    <form action="<?php echo e(route('checkout.place')); ?>" method="POST" class="space-y-8">
        <?php echo csrf_field(); ?>

        
        <div class="card p-6">
            <h2 class="text-lg font-bold text-gray-800 mb-4">Shipping Details</h2>
            <div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
                <div class="sm:col-span-2">
                    <label class="block text-sm font-medium text-gray-700 mb-1">Full Name *</label>
                    <input type="text" name="shipping_name" value="<?php echo e(old('shipping_name', auth()->guard('web')->user()->name ?? '')); ?>" required class="input" placeholder="Your name">
                    <?php $__errorArgs = ['shipping_name'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><p class="text-red-600 text-sm mt-1"><?php echo e($message); ?></p><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                </div>
                <div>
                    <label class="block text-sm font-medium text-gray-700 mb-1">Email *</label>
                    <input type="email" name="shipping_email" value="<?php echo e(old('shipping_email', auth()->guard('web')->user()->email ?? '')); ?>" required class="input">
                    <?php $__errorArgs = ['shipping_email'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><p class="text-red-600 text-sm mt-1"><?php echo e($message); ?></p><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                </div>
                <div>
                    <label class="block text-sm font-medium text-gray-700 mb-1">Phone *</label>
                    <input type="text" name="shipping_phone" value="<?php echo e(old('shipping_phone', auth()->guard('web')->user()->phone ?? '')); ?>" required class="input">
                    <?php $__errorArgs = ['shipping_phone'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><p class="text-red-600 text-sm mt-1"><?php echo e($message); ?></p><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                </div>
                <div class="sm:col-span-2">
                    <label class="block text-sm font-medium text-gray-700 mb-1">Address *</label>
                    <textarea name="shipping_address" rows="2" required class="input" placeholder="Street, building"><?php echo e(old('shipping_address', auth()->guard('web')->user()->address ?? '')); ?></textarea>
                    <?php $__errorArgs = ['shipping_address'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?><p class="text-red-600 text-sm mt-1"><?php echo e($message); ?></p><?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                </div>
                <div>
                    <label class="block text-sm font-medium text-gray-700 mb-1">City</label>
                    <input type="text" name="shipping_city" value="<?php echo e(old('shipping_city')); ?>" class="input">
                </div>
                <div>
                    <label class="block text-sm font-medium text-gray-700 mb-1">State / Postal</label>
                    <input type="text" name="shipping_state" value="<?php echo e(old('shipping_state')); ?>" class="input" placeholder="State or ZIP">
                </div>
                <div>
                    <label class="block text-sm font-medium text-gray-700 mb-1">Country</label>
                    <input type="text" name="shipping_country" value="<?php echo e(old('shipping_country')); ?>" class="input">
                </div>
                <div class="sm:col-span-2">
                    <label class="block text-sm font-medium text-gray-700 mb-1">Notes</label>
                    <textarea name="notes" rows="2" class="input" placeholder="Delivery instructions"><?php echo e(old('notes')); ?></textarea>
                </div>
            </div>
        </div>

        
        <div class="card p-6">
            <h2 class="text-lg font-bold text-gray-800 mb-2">Promo Code</h2>
            <input type="text" name="coupon_code" value="<?php echo e(old('coupon_code')); ?>" class="input max-w-xs" placeholder="Enter code">
        </div>

        
        <div class="card p-6">
            <h2 class="text-lg font-bold text-gray-800 mb-4">Order Summary</h2>
            <ul class="space-y-2 mb-4">
                <?php $__currentLoopData = $cart->items; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                <li class="flex justify-between text-sm">
                    <span><?php echo e($item->product->name); ?> × <?php echo e($item->quantity); ?></span>
                    <span><?php echo e($currency_symbol); ?><?php echo e(number_format($item->subtotal, 0)); ?></span>
                </li>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            </ul>
            <div class="border-t border-gray-200 pt-4 space-y-1">
                <div class="flex justify-between"><span>Subtotal</span><span><?php echo e($currency_symbol); ?><?php echo e(number_format($subtotal, 0)); ?></span></div>
                <?php if($discount > 0): ?>
                <div class="flex justify-between text-green-600"><span>Discount</span><span>-<?php echo e($currency_symbol); ?><?php echo e(number_format($discount, 0)); ?></span></div>
                <?php endif; ?>
                <div class="flex justify-between font-bold text-lg pt-2"><span>Total</span><span><?php echo e($currency_symbol); ?><?php echo e(number_format($total, 0)); ?></span></div>
            </div>
            <button type="submit" class="btn-primary w-full mt-6 py-3">Place Order</button>
        </div>
    </form>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('store.layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH D:\laragon\www\ReactNative\grocery-api\resources\views/store/checkout/index.blade.php ENDPATH**/ ?>