Viewing file: 144ac684a815815e22ff3ef160f7f245da267686.php (21.6 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php $__env->startSection('title'); ?> <?php echo e(json_decode(get_settings('site_setting'))->name); ?> - <?php echo e(trans('multirestaurant::layout.add_to_cart')); ?> <?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>
<div class="main-section" style="margin-bottom: 60px">
<div class="heading cf">
<h2><?php echo e(trans('multirestaurant::layout.my_cart')); ?></h2>
</div>
<div class="cart">
<ul class="cartWrap">
<?php if(isset($carts) && $carts->isNotEmpty()): ?>
<?php $__currentLoopData = $carts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $cart): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<li class="items odd">
<div class="infoWrap" data-id="<?php echo e($cart->id); ?>" id="data-id">
<div class="image-div">
<img src="<?php echo e(asset('uploads/'.$cart->restaurant->cover_image)); ?>" alt="" class="itemImg" />
</div>
<div class="cartSection">
<h3><?php echo e($cart->restaurant->name); ?></h3>
<p class="itemNumber"><?php echo e($cart->restaurant->location); ?></p>
</div>
<div class="pran-div">
<div class="item-div">
<ul class="item-namee">
<li class="itemtitle"><?php echo e(trans('multirestaurant::layout.items')); ?></li>
<?php $__currentLoopData = $items; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<?php if($cart->restaurant_id == $item->restaurant_id): ?>
<li class="itemname"><?php echo e($item->item->name); ?></li>
<?php endif; ?>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</ul>
</div>
<?php
$items_id = [];
$items_quantity = [];
?>
<?php $__currentLoopData = $items; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<?php if($cart->restaurant_id == $item->restaurant_id): ?>
<?php $items_id[] = $item->item_id; ?>
<?php $items_quantity[] = $item->item_quantity; ?>
<?php endif; ?>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
<div class="item-div">
<ul class="item-namee">
<li class="itemtitle"><?php echo e(trans('multirestaurant::layout.quantity')); ?></li>
<?php $__currentLoopData = $items; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<?php if($cart->restaurant_id == $item->restaurant_id): ?>
<li class="itemname"><?php echo e($item->item_quantity); ?></li>
<?php endif; ?>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</ul>
</div>
<div class="item-div">
<ul class="item-namee">
<li class="itemtitle"><?php echo e(trans('multirestaurant::layout.price')); ?></li>
<?php $__currentLoopData = $items; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<?php if($cart->restaurant_id == $item->restaurant_id): ?>
<li class="itemname"><?php echo e($item->restaurant->currency_symbol); ?><?php echo e($item->item->price); ?></li>
<?php endif; ?>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</ul>
</div>
<?php
$alltotal = 0;
?>
<?php
$total = 0;
?>
<div class="item-div">
<ul class="item-namee">
<li class="itemtitle"><?php echo e(trans('multirestaurant::layout.sub_total')); ?></li>
<?php $__currentLoopData = $items; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<?php if($cart->restaurant_id == $item->restaurant_id): ?>
<li class="itemname"><?php echo e($item->restaurant->currency_symbol); ?><?php echo e($item->item->price*$item->item_quantity); ?></li>
<?php
$total += $item->item->price*$item->item_quantity;
?>
<?php endif; ?>
<?php
$alltotal += $item->item->price*$item->item_quantity;
?>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</ul>
</div>
</div>
<div class="prodTotal cartSection">
<p>Total : <?php echo e($cart->restaurant->currency_symbol); ?><?php echo e($total); ?></p>
</div>
<div class="cartSection">
<button type="button" class="process-btn-b process_to_pay"
restaurant-id="<?php echo e($cart->restaurant_id); ?>"
item-id="<?php echo e(json_encode($items_id)); ?>"
item-quantity="<?php echo e(json_encode($items_quantity)); ?>"><?php echo e(trans('multirestaurant::layout.process_to_pay')); ?>
</button>
</div>
<div class="cartSection removeWrap">
<a href="<?php echo e(route('multirestaurant::remove.add.to.cart.item',[$cart->restaurant_id])); ?>" class="remove">x</a>
</div>
</div>
</li>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
<?php else: ?>
<div class="col-lg-12">
<h5 class="card-title pt-3 text-center text-danger" id="multirestaurant-notification"><?php echo e(trans('multirestaurant::layout.no_orders_found')); ?></h5>
</div>
<?php endif; ?>
</ul>
</div>
<div class="subtotal cf" id="price">
<ul class="subtotal-div">
<li class="totalRow final"><span class="label"><?php echo e(trans('multirestaurant::layout.total')); ?></span><span class="value"><?php echo e(isset($item->restaurant->currency_symbol)?$item->restaurant->currency_symbol:'$'); ?><?php echo e(isset($alltotal)?$alltotal:'00'); ?></span></li>
</ul>
</div>
</div>
<div class="location-modal paymentModal">
<div class="location-modal-content">
<span class="locationClose close">×</span>
<form action="<?php echo e(route('order.place')); ?>" method="post" id="orderForm">
<?php echo csrf_field(); ?>
<div class="row">
<input type="hidden" name="restaurant" value="" id="item_restaurant">
<div id="item_quantity"></div>
<div id="item_id"></div>
</div>
<div class="container">
<div class="row"></div>
<div class="col-md-12">
<label for="name"><?php echo e(trans('multirestaurant::layout.name')); ?></label>
<input value="<?php echo e(auth()->check()?auth()->user()->name:''); ?>" name="name"
type="text" class="form-control" id="name"
placeholder="<?php echo e(trans('layout.ex_jone_doe')); ?>"
required="">
</div>
<div class="col-md-12">
<label for="phone"><?php echo e(trans('multirestaurant::layout.phone')); ?></label>
<input value="<?php echo e(auth()->check()?auth()->user()->phone_number:''); ?>"
name="phone"
type="number" class="form-control" id="phone"
placeholder="<?php echo e(trans('layout.phone_number')); ?>">
<span id="phone-error" class="small text-danger p-2"></span>
</div>
<div class="col-md-12">
<label for="phone"><?php echo e(trans('multirestaurant::layout.email')); ?></label>
<input value="<?php echo e(auth()->check()?auth()->user()->email:''); ?>" name="email"
type="email" class="form-control" id="email"
placeholder="<?php echo e(trans('layout.ex_example_mail_com')); ?>">
<span id="email-error" class="small text-danger p-2"></span>
</div>
<div class="col-md-12 col-12 mb-3 ">
<label for="table_id"><?php echo e(trans('multirestaurant::layout.select_a_payment_type')); ?></label>
<select id="deliveryType" class="form-control" name="selectDeliveryType">
<option value="takeaway"><?php echo e(trans('multirestaurant::layout.takeaway')); ?></option>
<option value="delivery"><?php echo e(trans('multirestaurant::layout.cash_on_delivery')); ?></option>
</select>
</div>
<div id="takeawayTime" class="col-sm-12 mb-3 takeaway-section d-none">
<label for="time"><?php echo e(trans('multirestaurant::layout.time')); ?>*</label>
<select name="time" id="time" class="form-control">
<?php echo generateOrderSlot(); ?>
</select>
</div>
<div id="delivery" class="col-sm-12 mt-3 d-none">
<label for="deliveryAddress"><?php echo e(trans('multirestaurant::layout.delivery_address')); ?></label>
<input value="" type="text" name="address" id="deliveryAddress"
class="form-control" placeholder="Ex: 2806 Montague Rd, BC, Canada">
</div>
<div class="col-md-6">
<label for="comment"><?php echo e(trans('multirestaurant::layout.comment')); ?></label>
<input name="comment" type="text" class="form-control" id="comment"
placeholder="<?php echo e(trans('layout.ex_Need_extra_spoon')); ?>">
</div>
<div class="col-md-6 mt-3">
<div id="payNow" class="custom-control custom-radio mb-2 d-none">
<input value="pay_now" id="pay_now"
name="pay_type"
type="radio"
class="custom-control-input" >
<label class="custom-control-label"
for="pay_now"><?php echo e(trans('multirestaurant::layout.pay_now')); ?></label>
<div class="pay-now-section d-none">
<div class="row">
<div class="col-md-12 mb-3">
<div class="d-block my-3">
<div class="custom-control custom-radio mb-2">
<input id="paypal" name="paymentMethod" type="radio"
class="custom-control-input"
required="" checked="" value="paypal">
<label class="custom-control-label"
for="paypal"><?php echo e(trans('multirestaurant::layout.paypal')); ?></label>
</div>
<div class="custom-control custom-radio mb-2">
<input id="paytm" name="paymentMethod" type="radio"
class="custom-control-input"
required="" value="paytm">
<label class="custom-control-label"
for="paytm"><?php echo e(trans('multirestaurant::layout.paytm')); ?></label>
</div>
<div class="custom-control custom-radio mb-2">
<input id="mollie" name="paymentMethod" type="radio"
class="custom-control-input"
required="" value="mollie">
<label class="custom-control-label"
for="mollie"><?php echo e(trans('multirestaurant::layout.mollie')); ?></label>
</div>
<div class="custom-control custom-radio mb-2">
<input id="paystack" name="paymentMethod" type="radio"
class="custom-control-input"
required="" value="paystack">
<label class="custom-control-label"
for="paystack"><?php echo e(trans('multirestaurant::layout.paystack')); ?></label>
</div>
<div class="custom-control custom-radio mb-2">
<input id="credit" name="paymentMethod" type="radio"
class="custom-control-input"
required="" value="stripe">
<label class="custom-control-label"
for="credit"><?php echo e(trans('multirestaurant::layout.credit_or_debit_card')); ?></label>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-6">
<button type="submit" class="btn btn-xs btn-primary place-order mt-3 <?php echo e(auth()->user()?'':'disabled'); ?>"><?php echo e(trans('multirestaurant::layout.place_order')); ?></button>
</div>
</div>
</form>
</div>
</div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('js'); ?>
<script>
$(document).on('click','.process_to_pay', (e)=> {
e.preventDefault();
const restaurant_id = $('.process_to_pay').attr('restaurant-id');
const items_id = $('.process_to_pay').attr('item-id');
const items_quantity = $('.process_to_pay').attr('item-quantity');
let html_item_id= '';
let html_item_quantity= '';
let item_id = JSON.parse(items_id)
let item_quantity = JSON.parse(items_quantity)
$('#item_restaurant').val(restaurant_id)
$.each(item_id, function(index,value) {
html_item_id += `<input type="hidden" name="item_id[]" value="${value}">`;
});
$.each(item_quantity, function(index,value) {
html_item_quantity += `<input type="hidden" name="item_quantity[]" value="${value}">`;
});
$('#item_quantity').append(html_item_quantity);
$('#item_id').append(html_item_id);
$(".paymentModal").toggle();
$('#payNow').removeClass('d-none');
$('#takeawayTime').removeClass('d-none');
});
$(document).on('click','.locationClose', (e)=> {
e.preventDefault();
$(".location-modal").toggle();
});
</script>
<script>
$('#deliveryType').on('change', function (e) {
e.preventDefault();
const type = $(this).val();
const auth_user = "<?php echo e(auth()->user()); ?>";
let checked_pay_now = $("#pay_now").is(":checked");
if (type == 'takeaway') {
$('#table').addClass('d-none');
$('#payNow').removeClass('d-none');
$('#delivery').addClass('d-none');
$('#takeawayTime').removeClass('d-none');
// $('.pay-now-section').removeClass('d-none');
$('#place-order').removeClass('disabled');
if (checked_pay_now) {
$('#place-order').removeClass('disabled');
} else {
$('#place-order').addClass('disabled');
}
} else if (type == 'delivery') {
$('#table').addClass('d-none');
$('#payNow').addClass('d-none');
$('#delivery').removeClass('d-none');
$('#takeawayTime').addClass('d-none');
$('.pay-now-section').addClass('d-none');
$('#place-order').removeClass('disabled')
if(!auth_user){
$('#place-order').addClass('disabled');
toastr.error('You must login first', 'failed', {timeOut: 5000});
}else{
$('#place-order').removeClass('disabled');
}
}
});
$('input[type=radio][name=pay_type]').change(function () {
if (this.value == 'pay_on_table') {
$('.pay-now-section').hide();
$('.card-payment-section').hide();
} else if (this.value == 'pay_now') {
$('.pay-now-section').show();
$('.takeaway-section').hide();
$('.pay-now-section').removeClass('d-none')
} else if (this.value == 'takeaway') {
$('.pay-now-section').hide();
$('.card-payment-section').hide();
$('.takeaway-section').show();
}
});
$('#pay_now').on('click', function (e) {
$('#place-order').removeClass('disabled');
});
</script>
<script>
const id = $('#data-id').attr('data-id');
if (!id){
$('#price').addClass('d-none');
}
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('multirestaurant::layouts.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/pcolfjqt/qr.picotech.app/Modules/MultiRestaurant/Resources/views/addToCart.blade.php ENDPATH**/ ?>
|