IMMREX7
<?php $__env->startSection('content'); ?>
<div class="row clearfix ecommerce-page">
<div class="col-sm-12">
<div class="card action_bar">
<div class="body">
<div class="row clearfix">
<form action="<?php echo e(url('student/canteen')); ?>" method="get" class="col-12" style="display:flex;">
<div class="col-lg-5 col-md-5 col-6">
<div class="input-group search">
<input type="text" class="form-control" name="search" placeholder="Search...">
<span class="input-group-addon">
<i class="zmdi zmdi-search"></i>
</span>
</div>
</div>
<div class="col-lg-1 col-md-2 col-3">
<button class="btn btn-primary btn-round">Search</button>
</div>
<div class="col-lg-6 col-md-5 col-3 text-right">
<a href="<?php echo e(url('student/canteen-receipts')); ?>" class="btn btn-primary btn-sm waves-effect">View Purchases</a>
<div class="btn-group hidden-sm-down" role="group">
<div class="btn-group">
<button type="button" class="btn btn-neutral dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="zmdi zmdi-filter-list"></i>
<span class="caret"></span>
</button>
<ul class="dropdown-menu pullDown">
<li>
<a href="<?php echo e(url('student/canteen')); ?>">Show All</a>
</li>
</ul>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="row">
<?php $__currentLoopData = $products; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $product): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<div class="col-lg-3 col-md-4 col-sm-12">
<div class="card product_item">
<div class="body">
<div class="cp_img">
<?php if(isset($product->productImage)): ?>
<img src="<?php echo e(asset('storage/schools/'.$product->idSchool.'/foods/'.$product->productImage)); ?>" alt="Product" class="img-fluid">
<?php else: ?>
<img src="<?php echo e(asset('storage/schools/'.$product->idSchool.'/'.$school->schoolLogo)); ?>" alt="Product" class="img-fluid" style="width: 240px;">
<?php endif; ?>
<div class="hover">
<a href="javascript:void(0);" class="btn btn-primary btn-sm waves-effect js-notification" data-id="<?php echo e($product->idProduct); ?>" data-action="add" data-text="Item added to your cart" data-placement-from="top" data-placement-align="left" data-animate-enter="" data-animate-exit="" data-color-name="bg-purple"><i class="zmdi zmdi-shopping-cart"></i></a>
<a href="javascript:void(0);" class="btn btn-primary btn-sm waves-effect js-notification" data-id="<?php echo e($product->idProduct); ?>" data-action="minus" data-text="Item removed from the cart" data-placement-from="top" data-placement-align="left" data-animate-enter="" data-animate-exit="" data-color-name="alert-danger"><i class="zmdi zmdi-minus"></i></a>
</div>
</div>
<div class="product_details" style="padding-top: 100%;">
<?php if(isset($cart[$product->idProduct])): ?>
<div class="badge badge-info" data-qty="<?php echo e($cart[$product->idProduct]); ?>" id="qty_<?php echo e($product->idProduct); ?>" style="font-size: 15px;">Qty : <?php echo e($cart[$product->idProduct]); ?></div>
<?php else: ?>
<div class="badge badge-info" data-qty="0" id="qty_<?php echo e($product->idProduct); ?>" style="font-size: 15px;"></div>
<?php endif; ?>
<h5><a href="ec-product-detail.html"><?php echo e($product->productName); ?></a></h5>
<ul class="product_price list-unstyled">
<li class="new_price">Rs. <?php echo e($product->salePrice); ?></li>
</ul>
</div>
</div>
</div>
</div>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</div>
</div>
</div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('script'); ?>
<script src="<?php echo e(asset('/plugins/bootstrap-notify/bootstrap-notify.js')); ?>"></script>
<script>
$(function () {
$('.js-notification').on('click', function () {
var placementFrom = $(this).data('placement-from');
var placementAlign = $(this).data('placement-align');
var animateEnter = $(this).data('animate-enter');
var animateExit = $(this).data('animate-exit');
var colorName = $(this).data('color-name');
var text = $(this).data('text');
var qty = $(this).data('qty');
var requestPayload = JSON.stringify({
idProduct: $(this).data('id'),
action : $(this).data('action')
});
var requestOptions = {
method: "POST",
headers: {
"X-CSRF-TOKEN": "<?php echo e(csrf_token()); ?>",
"Content-Type": "application/json",
},
body: requestPayload,
};
fetch("<?php echo e(url('student/canteen-cart')); ?>", requestOptions)
.then((response) => response.json())
.then((result) => {
if(result.result == 1){
if(result.count != null)
$("#cart_icon").attr('value',result.count);
else $("#cart_icon").attr('value',"0");
if(result.qty == 0)
$("#qty_"+$(this).data('id')).empty();
if(result.qty > 0 && result.qty < 4)
$("#qty_"+$(this).data('id')).html('Qty : '+result.qty)
if(result.qty > 3){
text = "You have already added all of the allowed items.";
}
showNotification(colorName, text, placementFrom, placementAlign, animateEnter, animateExit);
}
})
.catch((error) => console.log("error", error));
});
});
function showNotification(colorName, text, placementFrom, placementAlign, animateEnter, animateExit) {
if (colorName === null || colorName === '') { colorName = 'bg-black'; }
if (text === null || text === '') { text = 'Turning standard Bootstrap alerts'; }
if (animateEnter === null || animateEnter === '') { animateEnter = 'animated fadeInDown'; }
if (animateExit === null || animateExit === '') { animateExit = 'animated fadeOutUp'; }
var allowDismiss = true;
$.notify({
message: text
},
{
type: colorName,
allow_dismiss: allowDismiss,
newest_on_top: true,
timer: 1000,
placement: {
from: placementFrom,
align: placementAlign
},
animate: {
enter: animateEnter,
exit: animateExit
},
template: '<div data-notify="container" class="bootstrap-notify-container alert alert-dismissible {0} ' + (allowDismiss ? "p-r-35" : "") + '" role="alert">' +
'<button type="button" aria-hidden="true" class="close" data-notify="dismiss">×</button>' +
'<span data-notify="icon"><i class="zmdi zmdi-shopping-cart"></i></span> ' +
'<span data-notify="title">{1}</span> ' +
'<span data-notify="message">{2}</span>' +
'<div class="progress" data-notify="progressbar">' +
'<div class="progress-bar progress-bar-{0}" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div>' +
'</div>' +
'<a href="{3}" target="{4}" data-notify="url"></a>' +
'</div>'
});
}
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('students.student_layout', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
Copyright © 2021 -