<style>
	div#menu-right-content {
		position: sticky !important;
		top: -50px;
	}

	.modal-header,
	.modal-footer {
		border: none;
	}

	.modal-dialog.modal-feature {
		max-width: auto;

	}

	.cus1 {
		width: 600px !important;
	}

	.btn-menu {
		cursor: pointer;
	}

	.cus3 {
		width: 1000px !important;
	}

	.cus3 .items-mob .item-mob-list {
		margin: 0 20px 50px !important;
	}

	.modal-dialog.modal-feature {
		width: auto;

	}

	.modal-backdrop.fade.in {
		z-index: 9;
	}

	#menu-right-content {
		z-index: 111;
	}

	.cont {
		width: 90%;
		margin: 0 auto;
		padding-top: 10px;
	}

	.cont span {
		float: left;

		font-size: 15px;
		font-weight: bolder;

	}

	.cont label {
		float: right;
	}




	.modal-feature {

		width: auto;
	}

	.modal {
		top: 65px;
	}

	.menu-cat a span {
		z-index: unset;
	}




	.modal-feature .modal-content,
	.mobile-modal .modal-content {
		background-color: #e2e9f1;
	}

	.mobile-banner-wrap .layer {
		z-index: -1 !important;
	}

	/* .modal-backdro1p{opacity:0!important;visibility: hidden;} */


	#btn-slick1 {
		display: none;
	}

	.park-del {
		background-color: #E2D2D2;
		height: 100px;
		margin-bottom: 10px;
	}

	.park-del input {
		background-color: #F88282;
		color: #000;
		border: 0;
		outline: 0;
		padding: 2px 15px 10px 10px;
		border-radius: 5px;
		margin: 8px auto !important;

	}

	.park-del input::placeholder {
		font-weight: bolder;
		color: #000;

	}



	.park-del div span p {
		position: absolute;
		top: 0px;
		left: 10px;
		color: #008D00;
	}

	.switch {
		position: relative;
		display: inline-block;
		width: 70px;
		height: 30px;
	}

	.switch input {
		opacity: 0;
		width: 0;
		height: 0;
	}


	.slider {
		position: absolute;
		cursor: pointer;
		top: 0;
		left: 0;
		right: 0;
		bottom: 0;
		background-color: #ccc;
		-webkit-transition: .4s;
		transition: .4s;
	}

	.modal-mob .modal-content .modal-body .items_mob .slick-prev {
		left: 0;
	}

	.modal-mob .modal-content .modal-body .items_mob .slick-next {
		right: 0;
	}




	.slider:before {
		position: absolute;
		content: "";

		height: 32px;
		width: 32px;
		left: -1px;
		bottom: 0px;
		background-color: white;
		-webkit-transition: .4s;
		transition: .4s;
	}

	.slider.round {
		border-radius: 34px;
	}

	.slider.round:before {
		border-radius: 50%;
	}

	input:checked+.slider {
		background-color: #07C003;

	}

	/* input:checked p {
        content: "Yes";
    } */

	input:focus+.slider {
		box-shadow: 0 0 1px #2196F3;
	}

	input:checked+.slider:before {
		-webkit-transform: translateX(40px);
		-ms-transform: translateX(40px);
		transform: translateX(40px);
	}

	@media (max-width: 768px) {

		.btn-div {
			display: none;
		}

		#btn-slick1 {
			display: inline-block;
		}


	}

	.blinking {
		animation: blinkingText 1.2s infinite;
	}

	@keyframes blinkingText {
		0% {
			color: #fff;
		}

		49% {
			color: #fff;
		}

		60% {
			color: transparent;
		}

		99% {
			color: transparent;
		}

		100% {
			color: #fff;
		}
	}

	<?php
	if (isset($_SESSION['transaction_type']) && $_SESSION['transaction_type'] == 'pickup') {
	?>.delivery-fee-wrap {
		display: none;
	}

	<?php } ?>
</style>
<?php

$resturantInfo = $this->session->userdata('resturantInfo');

//print_r($resturantInfo);
//$resturantInfo['data']['stores_pickup_day'];

//die();
$merchantInfo = $this->session->userdata('merchantInfo');
$address = $this->session->userdata('address');
$isplate = $this->session->userdata('isplate');
$carno = $this->session->userdata('car_no');
//print_r($merchantInfo);die();

//echo 'trans'.$_SESSION['transaction_type'];

//echo $merchantInfo['services'];




    
   
    
    
    if($merchantInfo['services']=='pickup' || $merchantInfo['services']=='Pickup'){
         
        
        $_SESSION['transaction_type']='pickup';
        
    }else if ($merchantInfo['services']=='delivery' || $merchantInfo['services']=='Delivery'){  
        $_SESSION['transaction_type']='delivery';
    }else if ($merchantInfo['services']=='Delivery,Dinein'){
        if($_SESSION['transaction_type']=='delivery' || $_SESSION['transaction_type']=='dinein' ){}else{
            
         $_SESSION['transaction_type']='delivery';     
        }
        
        
    }else if ($merchantInfo['services']=='Pickup,Dinein'){
        if($_SESSION['transaction_type']=='pickup' || $_SESSION['transaction_type']=='dinein' ){}else{
            
         $_SESSION['transaction_type']='pickup';     
        }
        
        
    }
    
   



?>



<div class="star-float"></div>
<input type="hidden" id="merchant_id" name="merchant_id" value=<?php echo $merchantInfo['merchant_id']; ?>>
<div class="order-tray">
	<img alt="order-basket" src="assets/images/ginsoy_basket.png">

	<p class="bold center">Order Total</p>
	<div class="totalam"><?= isset($cart['data']['total']['total']) ? $_SESSION['settings']['currency_symbol'] . $cart['data']['total']['total'] : $_SESSION['settings']['currency_symbol'] . '0'; ?></div>
</div>
<div class="inner center deliveryinfo">
	<button type="button" class="close modal-close-btn" data-dismiss="modal" aria-label="Close">
		<span aria-hidden="true">×</span>
	</button>

	<?php if ($merchantInfo['services'] == 'Delivery' || $merchantInfo['services'] == 'Delivery,Pickup') { ?>
		<p class="bold delivery-fee-wrap">Delivery Information</p>
		<!--<?php echo "<pre>";
			print_r($cart); ?>-->
		<p class="delivery-fee-wrap">Distance: <?= (isset($cart['cart_details']['distance']) && $cart['cart_details']['distance']) ? $cart['cart_details']['distance'] . ' ' . $cart['cart_details']['distance_unit'] : 'not available'; ?> </p>

		<p class="delivery-fee-wrap"> Delivery Address: <?= (isset($_SESSION['address']['address']) && $_SESSION['address']['address']) ? $_SESSION['address']['address'] : 'not available' ?></p>

		<p class="delivery-fee-wrap"> Delivery Est: <?= (isset($_SESSION['merchantInfo']['delivery_estimation']) && $_SESSION['merchantInfo']['delivery_estimation']) ? $_SESSION['merchantInfo']['delivery_estimation'] : 'not available' ?></p>
		<p class="delivery-fee-wrap"> Delivery Distance Covered: <?= $_SESSION['merchantInfo']['delivery_distance_covered']; ?><?= $_SESSION['merchantInfo']['distance_unit']; ?></p>
		<!--<p class="delivery-fee-wrap"> Delivery Fee: <?= (isset($cart['data']['total']['delivery_charges']) && $cart['data']['total']['delivery_charges'] != 0) ? $_SESSION['settings']['currency_symbol'] . number_format($cart['data']['total']['delivery_charges']) : 'Free Delivery'; ?> </p>-->

		<p class="delivery-fee-wrap"><a data-toggle="modal" data-target="#addressModal" class="top10 green-color change-address block text-center">
				[Change Your Address here]
			</a> </p>
	<?php } ?>
	</br>
	<p class="extra-note" style="color:red"><b><?= @$merchantInfo['merchant_cart_note']; ?></b></p>
</div>
<div class="inner line-top relative ur-order">


	<i class="order-icon your-order-icon"></i>
	<p class="bold center ord-title">Your Order</p>
	<?php if (isset($cart['data'])) {

		//print_r($cart);
	?>
		<div class="item-order-wrap">
			<?php

			foreach ($cart['data']['item'] as $key2 => $cart_item) {
				if ($cart_item['size_words']) {
					$size_words = '(' . $cart_item['size_words'] . ')';
				} else {
					$size_words = '';
				}
				//print_r($cart_item);
			?>
				<div class="item-order-list item-row cust-item itemcart_<?= $key2; ?>">
					<div class="a"></div>
					<div class="b uk-text-success"><?= $cart_item['category_name'];  ?></div>
					<div class="a"><?= $cart_item['qty']; ?></div>
					<div class="b"><?= $cart_item['item_name'] . $size_words; ?>


						<p class="uk-text-small">
							<span class="base-price"><?= $_SESSION['settings']['currency_symbol'] . $cart_item['normal_price']; ?></span>
						</p>

						<p class="small text-info"><?= $cart_item['order_notes']; ?></p>
						<p class="small ingredients-label"><?= $cart_item['cooking_ref']; ?></p>

					</div>
					<div class="manage">
						<div class="c">
							<?php if ($cart_item['normal_price'] == '0') {
							} else { ?>
								<a class="edit_item" data-row="<?= $key2; ?>" onclick="menu.showItem(<?= $cart_item['item_id']; ?>,<?= $cart_item['category_id']; ?>,<?= $key2; ?>,<?= $cart_item['qty']; ?> )">
									<i class="ion-compose"></i>
								</a>
							<?php } ?>
							<a href="javascript:;" onclick="menu.deleteItem(<?= $key2; ?>)" class="delete_item">
								<i class="ion-trash-a"></i>
							</a>
						</div>
						<div class="d"><?= $_SESSION['settings']['currency_symbol'] . ($cart_item['qty'] * $cart_item['discounted_price']); ?></div>
					</div>
					<div class="clear"></div>

					<?php if (isset($cart_item['sub_item'])) {
						foreach ($cart_item['sub_item'] as $sb_item) { ?>
							<div class="a"></div>
							<div class="b uk-text-success"><?= $sb_item['addon_category'];  ?></div>
							<div class="clear"></div>
							<div class="a"><?= $sb_item['addon_qty'];  ?></div>
							<div class="b uk-text-muted"><?= $sb_item['addon_name'];  ?>
								<p class="uk-text-small">
									<span class="base-price"><?= $_SESSION['settings']['currency_symbol'] . $sb_item['addon_price']; ?></span>
								</p>
							</div>
							<div class="manage">
								<div class="d"><?= $_SESSION['settings']['currency_symbol'] . ($sb_item['addon_qty'] * $sb_item['addon_price']);  ?></div>
							</div>
							<div class="clear"></div>
					<?php }
					} ?>

				</div>
			<?php } ?>
			<div class="summary-wrap cust-summary">
				<?php if ($cart['data']['total']['discounted_amount'] > 0) { ?>
					<div class="row">
						<div class="col-md-6 col-xs-6 text-right "><?= $cart['data']['total']['merchant_discount_amount']; ?>% Discount Offer</div>
						<div class="col-md-6 col-xs-6 text-right cart_subtotal">
							<?= $_SESSION['settings']['currency_symbol'] . $cart['data']['total']['discounted_amount']; ?>
						</div>
					</div>
				<?php } ?>
				<div class="row">
					<div class="col-md-6 col-xs-6 text-right ">Sub Total</div>
					<div class="col-md-6 col-xs-6 text-right cart_subtotal">
						<?= $_SESSION['settings']['currency_symbol'] . $cart['data']['total']['subtotal']; ?>
					</div>
				</div>
				<?php if ($merchantInfo['services'] != 'Pickup') { ?>
					<div class="row delivery-fee-wrap">
						<div class="col-md-6 col-xs-6 text-right ">Delivery Fee: </div>
						<div class="col-md-6 col-xs-6 text-right cart_deliveryfee">
							<?= (isset($cart['data']['total']['delivery_charges']) && $cart['data']['total']['delivery_charges']) ? $_SESSION['settings']['currency_symbol'] . number_format($cart['data']['total']['delivery_charges']) : '-'; ?>
						</div>
					</div>
				<?php } ?>
				<div class="row cart_total_wrap bold">
					<div class="col-md-6 col-xs-6  text-right">Total</div>
					<div class="col-md-6 col-xs-6  text-right cart_total">
						<?= $_SESSION['settings']['currency_symbol']  ?><span class="cart_total_total"><?= $cart['data']['total']['total']; ?></span>
					</div>
				</div>
				<input type="hidden" id="cart_delivery_fee" name="cart_delivery_fee" value="<?= @number_format($cart['data']['total']['delivery_charges']) ?>">
				<input type="hidden" id="cart_total_detail" name="cart_total_detail" value="<?= @$cart['data']['total']['total'] ?>">
				<input type="hidden" value="" name="subtotal_order" id="subtotal_order">
				<input type="hidden" value="" name="subtotal_order2" id="subtotal_order2">
				<input type="hidden" value="" name="subtotal_extra_charge" id="subtotal_extra_charge">
			</div>
		</div>
		<a onclick="menu.clearCart()" class="clear-cart" style="display:inline">[Clear Order]</a>
	<?php } else {
	?>
		<div class="item-order-wrap">
			<div class="center emptybas">No Item in Basket Yet !</div>
		</div>
		<img style="width: 128px;padding: 10px;" src="assets/images/ginsoy_cart.png">
	<?php
	} ?>
</div>
<!--inner-->
<form>
	<div class="inner line-top relative delivery-option center">
		<div class="infoBox-content infoBox-content--small">
			<div data-test="menu-switcher" class="btnToggle btnToggle--detailed form-controlGroup u-separatedSpace--top u-separatedSpace--small">
				<div class="g">
					<?php


					if ($merchantInfo['services'] == 'Delivery' || $merchantInfo['services'] == 'Delivery,Pickup' || $merchantInfo['services'] == 'Delivery,Pickup,Dinein' || $merchantInfo['services'] == 'Delivery,Dinein') { ?>
						<?php
						$resturantInfo1 =[];
						if (isset($resturantInfo) && !empty($resturantInfo)) {
                             $resturantInfo1 = $resturantInfo['data']['stores_del_day'] ?? [];
                        } 
						
						if ($resturantInfo1 == 1) {
							$delivery_detail = ' ';
						} else {
							$delivery_detail = ' ';
							//$_SESSION['transaction_type']='';					  
						}
						?>


						<div class="btnToggle-item g-col g-span6 g g--alignCenter delv  <?= $delivery_detail ?>">
							<input data-menuswitcher="" type="radio" name="transaction_type" value="delivery" class="btnToggle-input" id="ms-delivery-Basket" <?= isset($_SESSION['transaction_type']) ? ($_SESSION['transaction_type'] == 'delivery') ? 'checked =""' : '' : 'checked=""'; ?> data-gtm="menu|click - menu switch|delivery" data-test-id="delivery-Basket">
							<label for="ms-delivery-Basket" id="RadioDelivery" class="btnToggle-label g g--alignCenter--v" data-test-id="delivery-label-Basket">
								<span class="btnToggle-label-text">
									Delivery<span data-servicefee="">&nbsp;</span>
								</span>
								<span data-test="menuswitcher-delivery-time" class="btnToggle-details-additional">
									<?= (isset($_SESSION['merchantInfo']['delivery_estimation']) && $_SESSION['merchantInfo']['delivery_estimation']) ? $_SESSION['merchantInfo']['delivery_estimation'] : '' ?> </span>

							</label>
						</div>



					<?php }
					if ($merchantInfo['services'] == 'Pickup' || $merchantInfo['services'] == 'Delivery,Pickup'  || $merchantInfo['services'] == 'Delivery,Pickup,Dinein' || $merchantInfo['services'] == 'Pickup,Dinein') {
						$resturantInfo2=[];
						if (isset($resturantInfo) && !empty($resturantInfo)) {
                             $resturantInfo2 = $resturantInfo['data']['stores_pickup_day'] ?? [];
                        } 
						if ($resturantInfo2 == 1) {
							$pickup_detail = '  ';
						} else {
							$pickup_detail = '   ';
							//$_SESSION['transaction_type']='';

						}


					?>
						<div class="btnToggle-item g-col g-span6 g g--alignCenter pkup <?= $pickup_detail ?>">
							<input data-menuswitcher="" type="radio" name="transaction_type" value="pickup" <?= isset($_SESSION['transaction_type']) ? ($_SESSION['transaction_type'] == 'pickup') ? 'checked =""' : '' : ''; ?> class="btnToggle-input" id="ms-collection-Basket" data-gtm="menu|click - menu switch|collection" data-test-id="collection-Basket">
							<label for="ms-collection-Basket" id="RadioCollection" class="btnToggle-label g g--alignCenter--v" data-test-id="collection-label-Basket">
								<span class="btnToggle-label-text">
									Pick-up &nbsp;

								</span>

							</label>

						</div>





					<?php } ?>
				</div>
				<?php if (isset($_SESSION['transaction_type']) && $_SESSION['transaction_type'] == 'pickup' && $cart['car_parking_enable'] == 1) { ?>
					<?php
					    $resturantInfo5 = [];
                         if (isset($resturantInfo) && !empty($resturantInfo)) {
                            $resturantInfo5 = $resturantInfo['data']['stores_pickup_day'] ?? [];
                        }
					if ($resturantInfo5 == 1) {
						$pickup_detail = '  ';
					} else {
						$pickup_detail = '  ';
					}
					?>
					<div class="park-del pkup <?= $pickup_detail ?>" id="park-del">
						<div class="cont">
							<span>Carpark Delivery?</span>
							<label class="switch">
								<input type="checkbox" id="noplate" name="noplate" <?php
																					if (isset($isplate) && $isplate == 1) {
																						echo 'value="' . $isplate . '" ';
																						echo "checked";
																					} else {
																						echo 'value="0"';
																					} ?>>

								<span class="slider round">
									<!-- <p></p> -->
								</span>
							</label>
						</div>
						<div class="clear"></div>
						<input type="text" id="car_no" style="<?php if ($isplate == 1) {
																	echo 'display:block; ';
																	echo "checked";
																} else {
																	echo 'display:none !important';
																} ?> " name="car_no" placeholder="Enter your Number plate" <?php if (isset($carno)) {
																																echo 'value="' . $carno . '"';
																															} ?>>
					</div>
				<?php  } ?>
			</div>
			<input data-val="true" data-val-required="The HandlePreviewMode field is required." id="HandlePreviewMode" name="HandlePreviewMode" type="hidden" value="False">
		</div>
		<i class="order-icon delivery-option-icon"></i>
		<p style="display: none;" class="bold">Delivery Options</p>

		<!--      <select class="grey-fields" name="transaction_type" id="transaction_type" required>-->
		<!--        <option value="delivery">Delivery</option>-->
		<!--        <option value="pickup">Pickup</option>-->
		<!--      </select>-->
		<select class="j_date grey-fields hasDatepicker" name="delivery_date" id="delivery_date" required>
			<?php foreach ($dateList as $key => $delivery_date) { ?>
				<option value="<?= $key; ?>"><?= $delivery_date; ?></option>
			<?php } ?>
		</select>
		<div class="delivery_asap_wrap">
			<select class="timepick grey-fields hasTimepicker_deliverytime" name="delivery_time" id="delivery_time">
			</select>

			<p id="not_div"></p>

			<?php if (isset($_SESSION['transaction_type']) && $_SESSION['transaction_type'] == 'delivery') { ?>

				<?php 
				$resturantInfo3 = [];
                    if (isset($resturantInfo) && !empty($resturantInfo)) {
                         $resturantInfo3 = $resturantInfo['data']['status_raw'] ?? [];
                    } 
			    	if ($resturantInfo3 == 'open') : ?>
					<span class="delivery-asap">
						<div class="icheckbox_minimal" style="position: relative;">
							<input class="icheck" type="checkbox" value="0" name="delivery_asap" id="delivery_asap" onclick="setAsap()">
							<ins class="iCheck-helper" style="position: absolute; left: 0%; display: block; width: 100%; height: 100%; margin: 0px; padding: 0px; background: rgb(255, 255, 255); border: 0px; opacity: 0;"></ins>
						</div>
						<span class="text-muted">Delivery ASAP?</span>
					</span>
				<?php endif ?>

			<?php } ?>
		</div><!-- delivery_asap_wrap-->

		<!-- hidden input for delivery time -->
		<?php if (isset($cart['cart_details']['distance']) != '') { ?>
			<input type="hidden" id="us_distance" name="us_distance" value="<?php echo $cart['cart_details']['distance'] ?>">
			<input type="hidden" id="del_distance" name="del_distance" value="<?php echo  $_SESSION['merchantInfo']['delivery_distance_covered']; ?>">
		<?php } ?>


		<?php 
		$resturantInfo4 = [];
            if (isset($resturantInfo) && !empty($resturantInfo)) {
                $resturantInfo4 = $resturantInfo['data']['close_message'] ?? [];
            } 
		if ($resturantInfo4) {
		?><p class="text-danger"><?= $resturantInfo['data']['close_message']; ?></p>
			<?php } else {
			if (isset($cart['data'])) { ?>
				<!--<a onclick="checkout()" class="orange-button medium checkout-button">Checkout</a> -->
				<input type="button" value="PROCEED MY ORDER" name="Checkout" class="orange-button medium checkout proceedOrder" id="proceedOrder">
			<?php } else { ?>
				<a href="javascript:;" class="orange-button medium checkout disabled-button proceedOrder" disabled="disabled" style="pointer-events: none;">PROCEED MY ORDER</a>
		<?php }
		} ?>
	</div>
	<!--inner-->
</form>
<div class="advice-txt" style="   background-color: transparent;
    color: #6b6d6c; border-radius: 5px 5px 5px 5px; text-align: justify;" class="allergy_advice">
	<p style="margin-top:-10px;font-size: 11px;padding: 5px 10px;letter-spacing: 1px;letter-spacing:1px;">
		<i class="fa fa-exclamation-triangle" style="    padding-right: 10px;font-size: 15px;" aria-hidden="true"></i><b style="padding-right: 5px; font-size: 14px; font-weight: 600;">Allergy
			Advice: </b> If you have an allergy that could harm your health we strongly advise you
		to contact the Restaurant before you place your order.
	</p>
</div>


<?php
$terss = 0;
$tests = 0;
$home_slider1 = isset($cart['promo_items']) && is_array($cart['promo_items']) ? $cart['promo_items']['data'] : [];
$cust = $tests = $terss = count($home_slider1);
if ($tests > 3) {
	$tests = 3;
} else if ($tests > 1) {
	$tests = 2;
} else {
	$tests = 1;
}

if ($terss >= 1) {
	echo "<script>$('.blinking').show();</script>";
} else {
	echo "<script>$('.blinking').hide();</script>";
}
?>
<!-- New code  -->
<?php
$home_slider = isset($cart['promo_items']) && is_array($cart['promo_items']) ? $cart['promo_items']['data'] : [];
if (!empty($home_slider)) {
?>
	<!-- second modal  -->
	<div class="modal fade" id="exampleModalCenter1" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
		<div class="modal-dialog modal-dialog-centered modal-feature modal-mob " role="document">
			<div class="modal-content">
				<div class="modal-header">
					<h5 class="modal-title" id="exampleModalCenterTitle">PROMOTION <b>FREE ITEMS</b>(You can select Upto <span><?= $home_slider[0]['totals'] ?></span> Items)</h5>
					<div class="marker"></div>
					<button type="button" class="close" data-dismiss="modal" aria-label="Close">
						<span aria-hidden="true" style="position: absolute;top: 5px;right: 15px;font-size: 35px;">&times;</span>
					</button>
				</div>
				<div class="modal-body" style="float:left;width:100%">
					<div class="items_mob">
						<!-- Loop here  -->
						<?php
						$terss = $terss - 1;
						// $home_slider[$terss]['item_added_total'];
						//echo 'nnnnbbbbb';
						$slick = '';
						// print_r($home_slider);
						if (isset($home_slider)) {
							foreach ($home_slider as $data1) {
								$photos = $data1['photo'];
								$name = $data1['item_name'];
								$slick .= "<div class='item-list' style='width:25%'>";
								$slick .= '<img src="' . $data1['photo'] . '" />';
								$slick .= '<h3 class="prod-title">' . $data1['item_name'] . '</h3>';
								$slick .= '<p class="prod-price"><strike>' . $data1['prices'][0] . '</strike><b>Free</b></p>';

								if ($data1['item_already'] == 1) {

									$slick .= "<a class='dsktop menu-item' >";
									$slick .= '<div class="btn-menu" data-dismiss="modal" style="background:#37963b">Already added</div></a>';
								} else if ($home_slider[$terss]['item_added_total'] >= $data1['totals']) {
									$slick .= "<a class='dsktop menu-item' >";
									$slick .= '<div class="btn-menu" data-dismiss="modal" >Limit Reached</div></a>';
								} else {

									$slick .= "<a class='dsktop menu-item' onclick=\"menu.showItem_promotion(" . $data1['item_id'] . ",0,' ',' ' ," . $data1['promo_ids'] . ")\">";

									$slick .= '<div class="btn-menu" data-dismiss="modal">ADD TO CART</div></a>';
								}
								$slick .= "</div>";
							}
						}
						echo $slick;
						?>
						<?php
						// echo "hello";
						?>



					</div>
				</div>
				<div class="modal-footer">
					<!-- <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
          <button type="button" class="btn btn-primary">Save changes</button> -->
				</div>
			</div>
		</div>

	</div>
<?php } ?>


<!-- second modal  -->
<?php
$home_slider = isset($cart['promo_items']) && is_array($cart['promo_items']) ? $cart['promo_items']['data'] : [];
if (count($home_slider1) > 0) {
	if ($cust > 2) {   ?>
		<!-- Modal -->
		<div class="modal fade" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
			<div class="modal-dialog modal-dialog-centered modal-feature " role="document">
				<div class="modal-content">
					<div class="modal-header">
						<h5 class="modal-title" id="exampleModalCenterTitle">PROMOTION <b>FREE ITEMS</b>(You can select Upto <span><?= $home_slider[0]['totals'] ?></span> Items)</h5>
						<div class="marker"></div>
						<button type="button" class="close" data-dismiss="modal" aria-label="Close">
							<span aria-hidden="true" style="position: absolute;top: 5px;right: 15px;font-size: 35px;">&times;</span>
						</button>
					</div>
					<div class="modal-body" style="float:left;width:100%">
						<div class="items">
							<!-- Loop here  -->
							<?php
							//$terss=$terss-1;
							// $home_slider[$terss]['item_added_total'];
							//echo 'nnnnbbbbb';
							$slick = '';
							//print_r($home_slider);
							if (isset($home_slider)) {
								foreach ($home_slider as $data1) {
									$photos = $data1['photo'];
									$name = $data1['item_name'];
									$slick .= "<div class='item-list' style='width:25%'>";
									$slick .= '<img src="' . $data1['photo'] . '" />';
									$slick .= '<h3 class="prod-title">' . $data1['item_name'] . '</h3>';
									$slick .= '<p class="prod-price"><strike>' . $data1['prices'][0] . '</strike><b>Free</b></p>';

									if ($data1['item_already'] == 1) {

										$slick .= "<a class='dsktop menu-item' >";
										$slick .= '<div class="btn-menu" data-dismiss="modal" style="background:#37963b">Already added</div></a>';
									} else if ($home_slider[$terss]['item_added_total'] >= $data1['totals']) {
										$slick .= "<a class='dsktop menu-item' >";
										$slick .= '<div class="btn-menu" data-dismiss="modal" >Limit Reached</div></a>';
									} else {

										$slick .= "<a class='dsktop menu-item' onclick=\"menu.showItem_promotion(" . $data1['item_id'] . ",0,' ',' ' ," . $data1['promo_ids'] . ")\">";

										$slick .= '<div class="btn-menu" data-dismiss="modal">ADD TO CART</div></a>';
									}
									$slick .= "</div>";
								}
							}
							echo $slick;
							?>
							<?php
							// echo "hello";
							?>



						</div>
					</div>
					<div class="modal-footer">
						<!-- <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
          <button type="button" class="btn btn-primary">Save changes</button> -->
					</div>
				</div>
			</div>

		</div>

	<?php } else { ?>

		<div class="modal fade" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true" style="top:0px;">
			<div class="modal-dialog modal-dialog-centered mobile-modal  <?= "cus" . $cust ?>" role="document" style="width:900px;">
				<div class="modal-content" style="width:100%;float:left">
					<div class="modal-header">
						<h5 class="modal-title" id="exampleModalCenterTitle">PROMOTION <b>FREE ITEMS</b>(You can select Upto <?= $home_slider1[0]['totals'] ?> Items)</h5>
						<button type="button" class="close" id="hide_btn11" data-dismiss="modal" aria-label="Close">
							<span aria-hidden="true">&times;</span>
						</button>
					</div>
					<div class="modal-body">
						<div class="items-mob" style="display:flex;">
							<?php

							$divsss = '';
							if (isset($home_slider1) && is_array($home_slider1)) {
								foreach ($home_slider1 as $data1) {

									// echo $data1['item_name'];
									// echo $data1['item_name'];

									$divsss .= "<div class='item-mob-list' style='width:100%;margin: 0 50px 50px;'>";
									$divsss .= '<img src="' . $data1['photo'] . '" />';
									$divsss .= '<h3 class="prod-title">' . $data1['item_name'] . '</h3>';
									$divsss .= '<p class="prod-price"> <strike>' . $data1['prices'][0] . ' </strike> <b>Free</b></p>';

									//$divsss .= "<a class='dsktop menu-item' onclick=\"menu.showItem_promotion(".$data1['item_id'].",0,' ',' ',".$data1['promo_ids'].")\">";
									// $divsss .= '<div class="btn-menu" data-dismiss="modal">ADD TO CART</div></a>';


									if ($data1['item_already'] == 1) {

										$divsss .= "<a class='dsktop menu-item' >";
										$divsss .= '<div class="btn-menu" data-dismiss="modal" style="background:#37963b">Already Added</div></a>';
									} else if ($home_slider[$terss]['item_added_total'] >= $data1['totals']) {
										$divsss .= "<a class='dsktop menu-item' >";
										$divsss .= '<div class="btn-menu" data-dismiss="modal" style="background:#ff0000">Limit Reached</div></a>';
									} else {

										$divsss .= "<a class='dsktop menu-item' onclick=\"menu.showItem_promotion(" . $data1['item_id'] . ",0,' ',' ' ," . $data1['promo_ids'] . ")\">";

										$divsss .= '<div class="btn-menu" data-dismiss="modal">ADD TO CART</div></a>';
									}


									$divsss .= "</div>";
								}
							}

							echo $divsss;

							?>
						</div>
					</div>
					<div class="modal-footer" style="padding:0;">
						<!-- <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                                            <button type="button" class="btn btn-primary">Save changes</button> -->
					</div>
				</div>
			</div>
		</div>
<?php }
} ?>


<script>
	$(function() {
		$('.j_date').trigger('change');
	});

	$('#btn-slick1').click(function() {
		$('#menu-right-content').css("display", "block");

	});

	$('#hide_btn').click(function() {
		$('#menu-right-content').css("display", "none");
	});
	$(document).ready(function() {
		$("#noplate").click(function() {
			$('#car_no').toggle();
			if ($('#noplate').is(':checked')) {
				$('#noplate').attr("value", "1");
			} else {
				$('#noplate').attr("value", "0");
			}
		});


		$(".items").slick({
			centerMode: true,
			infinite: true,
			slidesToShow: <?= $tests; ?>,
			speed: 300,
			slidesToScroll: 1,
			autoplay: true,
		});

		$(".items_mob").slick({
			centerMode: true,
			infinite: true,
			slidesToShow: 1,
			speed: 300,
			slidesToScroll: 1,
			autoplay: true,
		});

		$('#btn-slick1').click(function() {

			$('.slick-prev').click();
			setTimeout(function() {}, 300);
		});

		$('.modal-backdrop').remove();
		$('#btn-slick').click(function() {
			$('.modal-backdrop').remove();
			$('.modal-content').css('opacity', '0');
			$('.slick-prev').click();
			setTimeout(function() {
				$('.modal-content').css('opacity', '1');
			}, 300);

		});
	});




	$("#delivery_time11").change(function() {

		var delivery_time = $('#delivery_time').val();
		var delivery_date = $('#delivery_date').val();
		var merchant_id = $('#merchant_id').val();

		$.ajax({
			type: "POST",
			dataType: 'json',
			url: 'order/getdelPick_datewise',
			data: {

				delivery_date: delivery_date,
				delivery_time: delivery_time,
				merchant_id: merchant_id


			},
			success: function(data) {



				console.log(data.stores_del_day);
				if (data.stores_del_day == "1") {


					//  $('input:radio[name=transaction_type]').checked = false;

					$('#ms-delivery-Basket').prop('checked', false);
					$('#ms-collection-Basket').prop('checked', false);

					$(".delv").removeClass("delvhide");
					$('.delv').css('display', 'block');
				} else {
					//$('.delv').css('display','none');
					$(".delv").addClass("delvhide");
					$('#ms-delivery-Basket').prop('checked', false);
					$('#ms-collection-Basket').prop('checked', false);
				}

				if (data.stores_pickup_day == "1") {
					$('#ms-delivery-Basket').prop('checked', false);
					$('#ms-collection-Basket').prop('checked', false);
					$('input:radio[name=transaction_type]').checked = false;
					$(".pkup").removeClass("pkuphide");
					$('.pkup').show();
				} else {
					$('#ms-delivery-Basket').prop('checked', false);
					$('#ms-collection-Basket').prop('checked', false);
					//$('.pkup').hide();
					$(".pkup").addClass("pkuphide");
				}




				if (data.stores_pickup_day == "1" && data.stores_del_day == "0") {
					$('#ms-delivery-Basket').prop('checked', false);
					$('#ms-collection-Basket').prop('checked', true);
					$("#park-del").removeClass("pkuphide");
				} else if (data.stores_pickup_day == "0" && data.stores_del_day == "1") {
					$('#ms-delivery-Basket').prop('checked', true);
					$('#ms-collection-Basket').prop('checked', false);

					$("#park-del").addClass("pkuphide");

				} else if (data.stores_pickup_day == "0" && data.stores_del_day == "0") {
					$('#ms-delivery-Basket').prop('checked', false);
					$('#ms-collection-Basket').prop('checked', false);
					$("#park-del").addClass("pkuphide");
				} else if (data.stores_pickup_day == "1" && data.stores_del_day == "1") {
					$('#ms-delivery-Basket').prop('checked', true);
					$('#ms-collection-Basket').prop('checked', false);


					$("#park-del").addClass("pkuphide");


				}




			},
			error: function() {}
		});

	});

	$(document).on("click", "#proceedOrder", function() {
		var transaction_type = $("input:radio[name=transaction_type]:checked").val()
		var delivery_date = $('#delivery_date').val();
		var delivery_time = $('#delivery_time').val();
		var delivery_asap = $('#delivery_asap').val();
		var us_distance = $('#us_distance').val();
		var del_distance = $('#del_distance').val();
		var isplate = $('#noplate').val();
		var car_no = $('#car_no').val();
		$.ajax({
			type: "POST",
			dataType: 'json',
			url: 'order/checkcart_error',
			data: {
				transaction_type: transaction_type,
				delivery_date: delivery_date,
				delivery_time: delivery_time,
				delivery_asap: delivery_asap,
				us_distance: us_distance,
				del_distance: del_distance,
				isplate: isplate,
				car_no: car_no
			},
			success: function(data) {
				if (data.code == 1) {
					window.location.href = "order/checkout";
				} else if (data.code == 2 || data.code == 3) {


					var slider = document.createElement("p");
					slider.innerHTML = data.msg;
					console.log(slider);
					swal({
						title: 'Error',
						icon: "warning",
						content: slider,

					}).then(function() {
						$(document).ready(function() {
							$("#addressModal").modal();

						});
					});
					// menu.errorMessage(data.msg);

				} else if (data.code == 4) {


					var slider = document.createElement("p");
					slider.innerHTML = data.msg;
					console.log(slider);
					swal({
						title: 'Error',
						icon: "warning",
						content: slider,

					}).then(function() {
						$(document).ready(function() {
							$("#addressModal").modal();

						});
					});
					// menu.errorMessage(data.msg);

				} else {
					var slider = document.createElement("p");
					slider.innerHTML = data.msg;
					console.log(slider);
					swal({
						title: 'Error',
						icon: "warning",
						content: slider,

					});
				}


			},
			error: function() {}
		});
	});
</script>