325 lines
12 KiB
PHP
325 lines
12 KiB
PHP
|
||
|
||
<?php $__env->startSection('title', 'Shopping Cart'); ?>
|
||
|
||
<?php $__env->startSection('styles'); ?>
|
||
<style>
|
||
h1 {
|
||
font-family: 'Abril Fatface', cursive;
|
||
font-size: 2.5rem;
|
||
color: var(--primary-color);
|
||
margin-bottom: 2rem;
|
||
}
|
||
|
||
.cart-container {
|
||
display: grid;
|
||
grid-template-columns: 2fr 1fr;
|
||
gap: 2rem;
|
||
margin-bottom: 3rem;
|
||
}
|
||
|
||
.cart-items {
|
||
background: white;
|
||
padding: 2rem;
|
||
border-radius: 8px;
|
||
}
|
||
|
||
.empty-cart {
|
||
text-align: center;
|
||
padding: 3rem 2rem;
|
||
}
|
||
|
||
.empty-cart p {
|
||
color: #666;
|
||
margin-bottom: 2rem;
|
||
font-size: 1.1rem;
|
||
}
|
||
|
||
.cart-item {
|
||
display: grid;
|
||
grid-template-columns: 120px 1fr auto;
|
||
gap: 2rem;
|
||
padding: 1.5rem 0;
|
||
border-bottom: 1px solid #eee;
|
||
align-items: center;
|
||
}
|
||
|
||
.cart-item:last-child {
|
||
border-bottom: none;
|
||
}
|
||
|
||
.item-image {
|
||
width: 120px;
|
||
height: 120px;
|
||
object-fit: cover;
|
||
border-radius: 4px;
|
||
}
|
||
|
||
.item-details h3 {
|
||
color: var(--primary-color);
|
||
margin-bottom: 0.5rem;
|
||
font-family: 'Abril Fatface', cursive;
|
||
}
|
||
|
||
.item-details p {
|
||
color: #666;
|
||
font-size: 0.9rem;
|
||
margin-bottom: 0.5rem;
|
||
}
|
||
|
||
.item-price {
|
||
font-weight: 600;
|
||
color: var(--primary-color);
|
||
font-size: 1.1rem;
|
||
}
|
||
|
||
.item-actions {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 0.5rem;
|
||
align-items: flex-end;
|
||
}
|
||
|
||
.quantity-form {
|
||
display: flex;
|
||
gap: 0.5rem;
|
||
align-items: center;
|
||
}
|
||
|
||
.quantity-form input {
|
||
width: 60px;
|
||
padding: 0.4rem;
|
||
border: 1px solid #ddd;
|
||
border-radius: 4px;
|
||
font-size: 0.9rem;
|
||
}
|
||
|
||
.quantity-form button {
|
||
background-color: black;
|
||
color: white;
|
||
border: none;
|
||
padding: 0.4rem 0.8rem;
|
||
border-radius: 4px;
|
||
cursor: pointer;
|
||
font-size: 0.8rem;
|
||
font-weight: 600;
|
||
}
|
||
|
||
.quantity-form button:hover {
|
||
background-color: #1f3633;
|
||
opacity: 0.9;
|
||
}
|
||
|
||
.summary {
|
||
background: white;
|
||
padding: 2rem;
|
||
border-radius: 8px;
|
||
height: fit-content;
|
||
}
|
||
|
||
.summary h2 {
|
||
font-family: 'Abril Fatface', cursive;
|
||
font-size: 1.5rem;
|
||
color: var(--primary-color);
|
||
margin-bottom: 1.5rem;
|
||
}
|
||
|
||
.summary-row {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
padding: 1rem 0;
|
||
border-bottom: 1px solid #eee;
|
||
}
|
||
|
||
.summary-row.total {
|
||
font-family: Abril Fatface;
|
||
font-weight: 400;
|
||
font-size: 2rem;
|
||
color: var(--primary-color);
|
||
border-top: 2px solid var(--primary-color);
|
||
border-bottom: none;
|
||
padding-top: 1.5rem;
|
||
margin-top: 1rem;
|
||
}
|
||
|
||
.summary-actions {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 1rem;
|
||
margin-top: 2rem;
|
||
}
|
||
|
||
.btn-danger {
|
||
background-color: white;
|
||
color: black;
|
||
font-size: 0.9rem;
|
||
padding: 0.5rem 1rem;
|
||
}
|
||
|
||
.btn-danger:hover {
|
||
background-color: #c09191;
|
||
}
|
||
|
||
.alert {
|
||
padding: 1rem;
|
||
border-radius: 4px;
|
||
margin-bottom: 2rem;
|
||
}
|
||
|
||
.alert-success {
|
||
background-color: #d4e8d4;
|
||
color: var(--primary-color);
|
||
border: 1px solid #a8d4a8;
|
||
}
|
||
|
||
.alert-info {
|
||
background-color: #d1ecf1;
|
||
color: #0c5460;
|
||
border: 1px solid #bee5eb;
|
||
}
|
||
|
||
@media (max-width: 768px) {
|
||
.cart-container {
|
||
grid-template-columns: 1fr;
|
||
}
|
||
|
||
.cart-item {
|
||
grid-template-columns: 80px 1fr;
|
||
gap: 1rem;
|
||
}
|
||
|
||
.item-image {
|
||
width: 80px;
|
||
height: 80px;
|
||
}
|
||
|
||
.item-actions {
|
||
grid-column: 1 / -1;
|
||
flex-direction: row;
|
||
justify-content: space-between;
|
||
}
|
||
}
|
||
</style>
|
||
<?php $__env->stopSection(); ?>
|
||
|
||
<?php $__env->startSection('content'); ?>
|
||
<main class="container">
|
||
<h1>Shopping Cart</h1>
|
||
|
||
<?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(session('success')): ?>
|
||
<div class="alert alert-success">
|
||
<?php echo e(session('success')); ?>
|
||
|
||
</div>
|
||
<?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
|
||
|
||
<?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(session('error')): ?>
|
||
<div class="alert alert-info">
|
||
<?php echo e(session('error')); ?>
|
||
|
||
</div>
|
||
<?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
|
||
|
||
<?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if(count($items) > 0): ?>
|
||
<div class="cart-container">
|
||
<!-- Cart Items -->
|
||
<div class="cart-items">
|
||
<?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php $__currentLoopData = $items; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
|
||
<div class="cart-item">
|
||
<?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($item['product']->images->count() > 0): ?>
|
||
<img src="<?php echo e(asset('storage/' . $item['product']->images->first()->image_path)); ?>" alt="<?php echo e($item['product']->name); ?>" class="item-image">
|
||
<?php else: ?>
|
||
<img src="<?php echo e($item['product']->image); ?>" alt="<?php echo e($item['product']->name); ?>" class="item-image">
|
||
<?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
|
||
|
||
<div class="item-details">
|
||
<h3><?php echo e($item['product']->name); ?></h3>
|
||
<p><?php echo e($item['product']->category->name); ?></p>
|
||
|
||
<?php
|
||
$stockCost = 0;
|
||
$stockUnit = $item['type'] === 'wallpaper' ? '/m' : '/m²';
|
||
|
||
if ($item['stock']) {
|
||
$stockCost = $item['type'] === 'wallpaper' ? $item['stock']->cost_per_meter : $item['stock']->cost_per_m2;
|
||
}
|
||
?>
|
||
|
||
<?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($item['stock']): ?>
|
||
<p style="font-size: 0.9rem; color: #666;">
|
||
<?php echo e($item['stock']->name); ?>: <span class="item-price">R<?php echo e(number_format($stockCost, 2)); ?><?php echo e($stockUnit); ?></span>
|
||
</p>
|
||
<?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
|
||
|
||
<?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if BLOCK]><![endif]--><?php endif; ?><?php if($item['type'] === 'wallpaper'): ?>
|
||
<p style="color: #666; font-size: 0.9rem;">Length: <?php echo e($item['length']); ?>m</p>
|
||
<?php elseif($item['type'] === 'mural'): ?>
|
||
<p style="color: #666; font-size: 0.9rem;">Dimensions: <?php echo e($item['width']); ?>m × <?php echo e($item['height']); ?>m (<?php echo e(number_format($item['width'] * $item['height'], 2)); ?>m²)</p>
|
||
<?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
|
||
|
||
<p style="color: var(--primary-color); font-weight: 600;">Subtotal: R<?php echo e(number_format($item['subtotal'], 2)); ?></p>
|
||
</div>
|
||
|
||
<div class="item-actions">
|
||
<!-- <form action="<?php echo e(route('cart-update')); ?>" method="POST" class="quantity-form">
|
||
<?php echo csrf_field(); ?>
|
||
<input type="hidden" name="item_key" value="<?php echo e($item['key']); ?>">
|
||
<input type="number" name="quantity" min="1" value="<?php echo e($item['quantity']); ?>">
|
||
<button type="submit">Update</button>
|
||
</form> -->
|
||
|
||
<form action="<?php echo e(route('cart-remove')); ?>" method="POST" style="margin-top: 0.5rem;">
|
||
<?php echo csrf_field(); ?>
|
||
<input type="hidden" name="item_key" value="<?php echo e($item['key']); ?>">
|
||
<button type="submit" class="btn btn-danger">Remove</button>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
|
||
</div>
|
||
|
||
<!-- Summary -->
|
||
<div class="summary">
|
||
<h2>Order Summary</h2>
|
||
|
||
<div class="summary-row">
|
||
<span>Subtotal:</span>
|
||
<span>R<?php echo e(number_format($total, 2)); ?></span>
|
||
</div>
|
||
|
||
<div class="summary-row">
|
||
<span>Shipping:</span>
|
||
<span>Free</span>
|
||
</div>
|
||
|
||
<div class="summary-row">
|
||
<span>Tax:</span>
|
||
<span>TBD</span>
|
||
</div>
|
||
|
||
<div class="summary-row total">
|
||
<span>Total:</span>
|
||
<span>R <?php echo e(number_format($total, 2)); ?></span>
|
||
</div>
|
||
|
||
<div class="summary-actions">
|
||
<a href="<?php echo e(route('checkout')); ?>" class="btn" style="text-decoration: none;">Proceed to Checkout</a>
|
||
<a href="<?php echo e(route('wallpapers')); ?>" class="btn btn--secondary">Continue Shopping</a>
|
||
</div>
|
||
|
||
<form action="<?php echo e(route('cart-clear')); ?>" method="POST" style="margin-top: 1rem;">
|
||
<?php echo csrf_field(); ?>
|
||
<button type="submit" class="btn btn-danger" style="width: 100%;">Clear Cart</button>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
<?php else: ?>
|
||
<div class="empty-cart">
|
||
<p>Your cart is empty</p>
|
||
<a href="<?php echo e(route('wallpapers')); ?>" class="btn">Start Shopping</a>
|
||
</div>
|
||
<?php endif; ?><?php if(\Livewire\Mechanisms\ExtendBlade\ExtendBlade::isRenderingLivewireComponent()): ?><!--[if ENDBLOCK]><![endif]--><?php endif; ?>
|
||
</main>
|
||
<?php $__env->stopSection(); ?>
|
||
|
||
<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/additional_design/resources/views/cart.blade.php ENDPATH**/ ?>
|