<?php
    $summaryStep = $checkoutStep ?? request('step', 'cart');
    if (! in_array($summaryStep, ['cart', 'account', 'payment'], true)) {
        $summaryStep = 'cart';
    }
    $subtotal = (float) $cart->items->sum('total');
    $discount = min(max((float) $cart->discount, 0), $subtotal);
    $totalDue = max(0, $subtotal - $discount);
?>

<h2>Order Summary</h2>
<?php $__empty_1 = true; $__currentLoopData = $cart->items; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
    <?php
        $isDomain = str_starts_with((string) $item->item_type, 'domain_');
        $domainDescription = match ($item->item_type) {
            'domain_register' => 'Domain registration'.($item->years ? ' - '.$item->years.' year'.((int) $item->years === 1 ? '' : 's') : ''),
            'domain_transfer' => 'Domain transfer'.($item->years ? ' - '.$item->years.' year'.((int) $item->years === 1 ? '' : 's') : ''),
            'domain_existing' => 'Existing domain',
            default => null,
        };
    ?>
    <div class="summary-item">
        <div class="summary-item-info">
            <strong><?php echo e($isDomain && $item->domain_name ? $item->domain_name : $item->name); ?></strong>
            <?php if($isDomain): ?>
                <span><?php echo e($domainDescription); ?></span>
            <?php elseif($item->billing_cycle): ?>
                <span><?php echo e($pricing->cycleLabel($item->billing_cycle)); ?></span>
            <?php endif; ?>
        </div>
        <b><?php echo e($pricing->formatMoney($item->total, $item->currency)); ?></b>
    </div>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
    <p class="empty-summary">No products selected yet.</p>
<?php endif; ?>

<?php if(! $cart->items->isEmpty()): ?>
    <div class="zt-promo-block">
        <?php if($cart->promo_code): ?>
            <div class="zt-promo-applied">
                <div><small>Promo code</small><strong><?php echo e($cart->promo_code); ?></strong></div>
                <form method="POST" action="<?php echo e(route('cart.promotion.remove')); ?>" data-ajax-cart>
                    <?php echo csrf_field(); ?>
                    <?php echo method_field('DELETE'); ?>
                    <button type="submit">Remove</button>
                </form>
            </div>
        <?php else: ?>
            <form method="POST" action="<?php echo e(route('cart.promotion.apply')); ?>" class="zt-promo-form" data-ajax-cart>
                <?php echo csrf_field(); ?>
                <label for="promo-code">Have a promo code?</label>
                <div>
                    <input id="promo-code" class="input" name="promo_code" placeholder="Enter code" autocomplete="off">
                    <button type="submit">Apply</button>
                </div>
            </form>
        <?php endif; ?>
    </div>
<?php endif; ?>

<div class="summary-line"><span>Subtotal</span><strong><?php echo e($pricing->formatMoney($subtotal, $cart->currency)); ?></strong></div>
<?php if($discount > 0): ?>
    <div class="summary-line zt-discount-line"><span>Discount</span><strong>-<?php echo e($pricing->formatMoney($discount, $cart->currency)); ?></strong></div>
<?php endif; ?>
<div class="summary-line"><span>Taxes</span><strong><?php echo e($pricing->formatMoney(0, $cart->currency)); ?></strong></div>
<div class="summary-total"><span>Total</span><strong><?php echo e($pricing->formatMoney($totalDue, $cart->currency)); ?></strong></div>

<?php if($summaryStep === 'cart'): ?>
    <?php if($cart->items->isEmpty()): ?>
        <button class="primary-btn complete-btn" type="button" disabled>Continue</button>
    <?php else: ?>
        <a class="primary-btn complete-btn" href="<?php echo e(route('checkout.index', ['step' => 'account'])); ?>#checkout-step">Continue</a>
    <?php endif; ?>
<?php elseif($summaryStep === 'account'): ?>
    <button class="primary-btn complete-btn" form="checkout-account-form" type="submit" <?php echo e($cart->items->isEmpty() ? 'disabled' : ''); ?>>Continue to Payment</button>
<?php else: ?>
    <button class="primary-btn complete-btn" form="complete-order-form" type="submit" <?php echo e($cart->items->isEmpty() ? 'disabled' : ''); ?>>Place Order</button>
<?php endif; ?>
<?php /**PATH /home/ovbopdha/public_html/ztcart.eagale.xyz/resources/views/checkout/partials/cart-summary.blade.php ENDPATH**/ ?>