<?php
$items = cart_items();
$totals = cart_totals($items);
?>
<?php if (!$items): ?>
<div class="flex flex-1 flex-col items-center justify-center px-8 text-center">
<span class="flex size-16 items-center justify-center rounded-full bg-zinc-100 text-zinc-400"><?= icon('bag', 'size-7') ?></span>
<p class="font-display mt-5 text-lg font-semibold tracking-tight">Sepetiniz boş</p>
<p class="mt-1 text-sm text-zinc-500">Beğendiğiniz ürünleri sepete ekleyin.</p>
<button type="button" data-close class="btn-primary mt-6">Alışverişe devam et</button>
</div>
<?php else: ?>
<?php if ($totals['free_limit'] > 0): ?>
<div class="border-b border-zinc-100 px-6 py-4">
<p class="text-[13px] text-zinc-600">
<?php if ($totals['free_left'] > 0): ?>
Ücretsiz kargo için <strong class="text-ink"><?= money($totals['free_left']) ?></strong> daha ekleyin.
<?php else: ?>
<strong class="text-emerald-700">Tebrikler!</strong> Kargonuz ücretsiz.
<?php endif ?>
</p>
<div class="mt-2.5 h-1.5 overflow-hidden rounded-full bg-zinc-100">
<div class="h-full rounded-full bg-ink transition-all duration-500" style="width: <?= min(100, round(($totals['subtotal'] - $totals['discount']) / $totals['free_limit'] * 100)) ?>%"></div>
</div>
</div>
<?php endif ?>
<ul class="flex-1 divide-y divide-zinc-100 overflow-y-auto px-6">
<?php foreach ($items as $item): ?>
<li class="flex gap-4 py-5">
<a href="<?= product_url($item) ?>" class="h-24 w-20 shrink-0 overflow-hidden rounded-xl bg-zinc-100"><?= product_image($item, 'h-full w-full object-cover', 'text-2xl') ?></a>
<div class="flex min-w-0 flex-1 flex-col">
<div class="flex justify-between gap-3">
<a href="<?= product_url($item) ?>" class="line-clamp-2 text-sm font-medium text-ink"><?= e($item['name']) ?></a>
<form method="post" action="<?= url('sepet-guncelle') ?>" data-ajax>
<?= csrf_field() ?>
<button name="sil" value="<?= e($item['key']) ?>" class="text-zinc-400 transition hover:text-rose-600" aria-label="Kaldır"><?= icon('x', 'size-4') ?></button>
</form>
</div>
<?php if ($item['variant']): ?>
<p class="mt-1 text-xs text-zinc-500"><?= e(product_variant_label($item)) ?></p>
<?php endif ?>
<div class="mt-auto flex items-end justify-between pt-3">
<span class="text-xs text-zinc-500"><?= $item['qty'] ?> × <?= money($item['price']) ?></span>
<span class="text-sm font-semibold"><?= money($item['line_total']) ?></span>
</div>
</div>
</li>
<?php endforeach ?>
</ul>
<div class="shrink-0 border-t border-zinc-100 bg-zinc-50/60 px-6 py-5">
<?php if ($totals['discount'] > 0): ?>
<div class="mb-2 flex justify-between text-sm text-emerald-700">
<span>İndirim (<?= e($totals['coupon']['code']) ?>)</span>
<span>−<?= money($totals['discount']) ?></span>
</div>
<?php endif ?>
<div class="flex items-baseline justify-between">
<span class="text-sm text-zinc-600">Ara toplam</span>
<span class="font-display text-xl font-semibold tracking-tight"><?= money($totals['subtotal'] - $totals['discount']) ?></span>
</div>
<p class="mt-1 text-xs text-zinc-500">Kargo ödeme adımında hesaplanır.</p>
<div class="mt-5 grid grid-cols-2 gap-3">
<a href="<?= url('sepet') ?>" class="btn-light">Sepete git</a>
<a href="<?= url('odeme') ?>" class="btn-primary">Ödemeye geç</a>
</div>
</div>
<?php endif ?>
Lisans bilgisi projenin LICENSE dosyasında.