<?php if (isset($component)) { $__componentOriginal7f8e1f0528d3ccf02b4e203e537febb53fee9473 = $component; } ?>
<?php $component = $__env->getContainer()->make(App\View\Components\Main\Header::class, []); ?>
<?php $component->withName('main.header'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal7f8e1f0528d3ccf02b4e203e537febb53fee9473)): ?>
<?php $component = $__componentOriginal7f8e1f0528d3ccf02b4e203e537febb53fee9473; ?>
<?php unset($__componentOriginal7f8e1f0528d3ccf02b4e203e537febb53fee9473); ?>
<?php endif; ?>
<main>
<section class="cart-mart">
<div class="container">
<div class="row align-items-start">
<div class="col-12 col-md-12">
<div class="main-cart">
<h2>Carts</h2>
</div>
</div>
</div>
<?php
$cart = DB::select("SELECT * FROM `carts`");
?>
<?php
$total = 0;
?>
<?php if($cartItem->count() > 0): ?>
<?php $__currentLoopData = $cartItem; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<div class="row mb-5 mt-5 " style="border-bottom:1px solid #A2A3B1; padding:0 0 30px 0;">
<div class="col-12 col-md-2 mt-3">
<div class="glass-one">
<img src="<?php echo e(asset('storage/images/'.$item->product->product_image)); ?>" class="img-fluid" alt="img">
</div>
</div>
<div class="col-12 col-md-5 mt-4">
<div class="one-glass">
<h4>Complete Cleansing Oil</h4>
<ul>
<li>
<h5>Product:</h5>
<p><?php echo e($item->product->product_front_title); ?></p>
</li>
<li>
<h5>Color:</h5>
<p><?php if($item->color): ?>
- <?php echo e($item->color->color_name); ?>
<?php endif; ?></p>
</li>
<li>
<h5>Size:</h5>
<p><?php if($item->size): ?>
- <?php echo e($item->size->size); ?>
<?php endif; ?></p>
</li>
<li>
</li>
</ul>
</div>
<?php if($item->product->product_quantity >= $item->product_quantity): ?>
<div class="quantity different" element-id="171">
<button class="dec" fdprocessedid="157srp" element-id="170">-</button>
<input data-id="<?php echo e($item->id); ?>" data-pro_id="<?php echo e($item->product_id); ?>" min="1" value="<?php echo e($item->product_quantity); ?>" type="text" name="proQuantity" id="proQuantity" fdprocessedid="5xhskf" element-id="169">
<button class="inc" fdprocessedid="g66wvf" element-id="168">+</button>
</div>
<?php if($item->color && $item->size): ?>
<?php
$total += ($item->product->product_origional_price + $item->color->color_price + $item->size->price) * $item->product_quantity
?>
<?php elseif($item->color): ?>
<?php
$total += ($item->product->product_origional_price + $item->color->color_price) * $item->product_quantity
?>
<?php elseif($item->size): ?>
<?php
$total += ($item->product->product_origional_price + $item->size->price) * $item->product_quantity
?>
<?php else: ?>
<?php
$total += $item->product->product_origional_price * $item->product_quantity
?>
<?php endif; ?>
<?php else: ?>
<p>Out Of Stock</p>
<?php endif; ?>
</div>
<div class="col-12 col-md-4 d-flex justify-content-end mt-3">
<div class="last-cart">
<h6>Price:</h6>
<h4>usd
<?php if($item->color && $item->size): ?>
<?php echo e($item->product->product_origional_price + $item->color->color_price + $item->size->price); ?>
<?php elseif($item->color): ?>
<?php echo e($item->product->product_origional_price + $item->color->color_price); ?>
<?php elseif($item->size): ?>
<?php echo e($item->product->product_origional_price + $item->size->price); ?>
<?php else: ?>
<?php echo e($item->product->product_origional_price); ?>
<?php endif; ?></h4>
</div>
</div>
</div>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
<?php else: ?>
<?php endif; ?>
<a href="<?php echo e(url('/checkout')); ?>" class="mart-858 checkout-btn" style="margin:10px auto!important; display:block;" onclick="choosproducts()">
proceed to checkout
</a>
</div>
</section>
</main>
<script>
// Update Cart
$(document).ready(function() {
$("body").on('click', '#update_cart', function(e) {
// var id = $(this).val();
$(".cart-sec .cart-table .quantity input").each(function() {
var id = $(this).data("id");
var pro_id = $(this).data("pro_id");
var qty = $(this).val();
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
$.ajax({
url: "<?php echo e(url('/update_cart')); ?>",
method: "POST",
data: {
id: id,
pro_id: pro_id,
qty: qty
},
success: function(data) {
if (data.loginerror) {
toastr.error(data.loginerror, "Error", {
timeOut: 1500
});
$("#login").modal('show');
} else if (data.error) {
toastr.error(data.error, "Error", {
timeOut: 1500
});
return false;
} else if (data.success) {
toastr.success(data.success, "Success", {
timeOut: 1500
});
location.reload();
// window.location = "<?php echo e(url('/cart')); ?>";
}
},
error: function() {
toastr.error("SomeThing Went Wrong", "Error", {
timeOut: 1500
});
return false;
},
});
});
});
});
// Coupon Work
$(document).ready(function() {
$('body').on('click', '#copan_btn', function(event) {
event.preventDefault();
var coupan = $("#copan").val();
if (!coupan) {
toastr.error("Please Enter Coupon", "Error", {
timeOut: 1500
});
return false;
}
// else
// {
// toastr.error("Invalid Coupon","Error",{timeOut: 1500});
// false;
// }
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
$.ajax({
url: "<?php echo e(url('/add_coupon')); ?>",
method: "GET",
data: {
coupan: coupan
},
success: function(data) {
if (data.notfound) {
toastr.error(data.notfound, "Error", {
timeOut: 1500
});
return false;
} else if (data.expire) {
toastr.error(data.expire, "Error", {
timeOut: 1500
});
return false;
} else if (data.success) {
toastr.success(data.success, "Success", {
timeOut: 1500
});
$("#checkout").load(location.href + " #checkout>*", "");
}
},
error: function() {
},
});
});
});
// Coupon Work End Here
</script>
<!-- Delete Work -->
<script>
$(document).ready(function() {
$("body").on("click", "#btn_delete", function(e) {
e.preventDefault();
var id = $(this).val();
$.ajax({
url: "<?php echo e(url('/delete_cart')); ?>",
method: "GET",
data: {
'id': id
},
cache: false,
success: function() {
toastr.success("Item Deleted Successfully", "Deleted", {
timeOut: 1500
});
$("#showItem").load(location.href + " #showItem>*", "");
$("#checkout").load(location.href + " #checkout>*", "");
$("#offcanvasbody").load(location.href + " #offcanvasbody>*", "");
},
error: function() {
toastr.error("SomeThing Went Wrong", "Error", {
timeOut: 1500
});
false;
},
});
})
});
</script>
<?php if (isset($component)) { $__componentOriginalc4b07cf28b7f1e802225b60d159b9be2061c7516 = $component; } ?>
<?php $component = $__env->getContainer()->make(App\View\Components\Main\Footer::class, []); ?>
<?php $component->withName('main.footer'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php $component->withAttributes([]); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__componentOriginalc4b07cf28b7f1e802225b60d159b9be2061c7516)): ?>
<?php $component = $__componentOriginalc4b07cf28b7f1e802225b60d159b9be2061c7516; ?>
<?php unset($__componentOriginalc4b07cf28b7f1e802225b60d159b9be2061c7516); ?>
<?php endif; ?><?php /**PATH D:\Qasim Khan\easy-buyer\resources\views/cart.blade.php ENDPATH**/ ?>