<div id="food-menu" class="menu-wrapper wrapper">
    <div class="container-fluid <?php echo $this->config->item('website_style') == 'singlepage' ? 'inner' : 'inner-customer-dashboard' ?>">
        <h2 class="section-title text-center"><?php echo $pageOnlineOrder[0]->title ?></h2>
        <p class="text-center"><?php echo $pageOnlineOrder[0]->content ?></p>
        <?php if (!$isRestaaurantOpened): ?>
            <div class="row">
                <?php if ($service_time[strtolower(date('D'))]->is_opened == 'yes'): ?>
                    <div class="form-check" style="display: none" id="processingPreorder">
                        <label class="form-check-label text-center" style="width:100%; border:1px solid #ff0000">
                            <span>You are processing pre-order</span>
                        </label>
                    </div>
                    <div class="form-check" style="display: none" id="processPreorder">
                        <label class="form-check-label text-center" style="width:100%; border:1px solid #ff0000;">
                            <?php echo '<span style="color:red;font-weight:bold;">We are closed now! Open ' . $service_time[strtolower(date('D'))]->open . '.</span>' ?>     
                            <?php if ($this->config->item('gk_order_online') == 'yes'): ?>
                                <input type="checkbox" class="form-check-input" id="PreorderChecked" onchange="preorderCheck()"> Agree to process <strong>pre-order</strong> ?       
                            <?php endif; ?>
                        </label>
                    </div>
                <?php else: ?>
                    <label class="form-check-label text-center" style="width:100%; border:1px solid #ff0000">
                        <span>We are closed today</span>
                    </label>
                <?php endif; ?>
            </div>
        <?php endif; ?>
        <div class="row online-order-page">
            <?php $classString = $this->config->item('gk_order_online') == 'yes' ? 'col-lg-6 col-sm-6 col-md-6 col-xs-12' : 'col-lg-9 col-sm-9 col-md-9 col-xs-12' ?>
            <div class="<?php echo $classString ?>">
                <?php if (!empty($categories)): ?>
                    <?php $catIndex = 1; ?>
                    <?php foreach ($categories as $cat): ?>
                        <div class="bhoechie-tab-content-mobile">
                            <div class="restaurant-table">
                                <h1 class="text-center category-title" style="cursor: default" onclick="openMyItems('<?php echo 'openingTab-' . $catIndex ?>')"><?php echo html_escape($cat->title) ?>
                                    <div class="text-center" style="font-size: 14px;"><?php echo ucwords(strtolower(html_escape($cat->content))) ?></div>
                                </h1>
                                <?php $menuIndex = 1; ?>
                                <ul class="restaurant-menu content-scroll-pane opening-tab" id="<?php echo 'openingTab-' . $catIndex ?>" style="display: none;">
                                    <?php foreach ($menus[$cat->id] as $menu): ?>
                                        <?php if ($menu->is_special == 'yes' && $menu->deal != null && $menu->deal > 0): ?>
                                            <?php $adeal = get_single_record('meal_deal', array('id' => $menu->deal)) ?>
                                            <li>
                                                <form id="dealForm_<?php echo $cat->id . '_' . $adeal->id . '_' . $menu->id ?>">
                                                    <div class="no-padding col-lg-5 col-md-5 col-sm-5 col-xs-12 title">=><?php echo ucwords(strtolower(html_escape($adeal->title))) ?><?php $adeal->bogo == 1 ? print'<br/><span class="badge-red">Buy 1 Get 1 Free</span>' : '' ?></div>
                                                    <div class="no-padding col-lg-2 col-md-2 col-sm-2 col-xs-3 price">
                                                        <span><?php echo $this->config->item('currency_symbol') ?></span>
                                                        <span class="visible-price" id="dealVisiblePriceFor_<?php echo $cat->id . '_' . $adeal->id . '_' . $menu->id ?>"><?php echo to_currency_no_money($adeal->price) ?></span>
                                                    </div>
                                                    <div class="no-padding col-lg-3 col-md-3 col-sm-3 col-xs-6 shop-product quantity menu-md-quantity">
                                                        <div class="product-quantity">
                                                            <?php if ($this->config->item('gk_order_online') == 'yes'): ?>
                                                                <span class="text-center hidden-xs hidden-sm hidden-md">Qty:</span>
                                                                <a href="javascript:void(0)" class="quantity-button" onclick='javascript: subtractQty("dealqty_<?php echo $cat->id . '_' . $adeal->id ?>");'><strong>-</strong></a>
                                                                <input type='text' class="quantity-field" name="quantity" value="1" id='dealqty_<?php echo $cat->id . '_' . $adeal->id ?>' readonly="true"/>
                                                                <a href="javascript:void(0)" class="quantity-button" onclick='javascript: document.getElementById("dealqty_<?php echo $cat->id . '_' . $adeal->id ?>").value++;'><strong>+</strong></a>
                                                            <?php endif; ?>
                                                        </div>
                                                    </div>
                                                    <?php
                                                    $dealToppingsDefault = get_record_list('item_toppings', array('meal_deal' => $adeal->id, 'status' => 1, 'is_default' => 'yes'));
                                                    $dealToppingsDefaultString = '';
                                                    if (!empty($dealToppingsDefault)) {
                                                        foreach ($dealToppingsDefault as $defaultTopping) {
                                                            $dealToppingsDefaultString .= ',' . $defaultTopping->title;
                                                        }
                                                    }
                                                    ?>
                                                    <input type="hidden" name='bogo' value='<?php echo $adeal->bogo ?>'>
                                                    <input type="hidden" name='bogo_discount_on' value='deal'>
                                                    <input type="hidden" name='deal' value='<?php echo $adeal->id ?>'>
                                                    <input type="hidden" name='category' value='<?php echo $cat->id ?>'>
                                                    <input type="hidden" name='category_title' value='<?php echo ucwords(strtolower($cat->title)) ?>'>
                                                    <input type='hidden' name='print_option' value='<?php echo $cat->print_option ?>'>
                                                    <input type='hidden' name='type' value='<?php echo $cat->type ?>'>
                                                    <input type="hidden" name='is_special' value='<?php echo $menu->is_special ?>'>
                                                    <input type="hidden" name='menu' value='<?php echo $menu->id ?>'>
                                                    <input type="hidden" name='menu_title' value='<?php echo ucwords(strtolower($adeal->title)) ?>'>
                                                    <input type="hidden" name='selection' value=''>
                                                    <input type="hidden" name='selection_title' value=''>
                                                    <input type="hidden" name='set_items' value='' id='dealSetItems_<?php echo $cat->id . '_' . $adeal->id . '_' . $menu->id ?>' class="empty-string">
                                                    <input type="hidden" value='<?php echo to_currency_no_money($adeal->price) ?>' class="orginal-price">
                                                    <input type="hidden" name='price' value='<?php echo to_currency_no_money($adeal->price) ?>' id="dealHiddenPriceFor_<?php echo $cat->id . '_' . $adeal->id . '_' . $menu->id ?>" class="hidden-price">
                                                    <input type="hidden" name="toppings" id="dealToppingsString_<?php echo $cat->id . '_' . $adeal->id . '_' . $menu->id ?>" value="<?php echo $dealToppingsDefaultString ?>" value="<?php echo $dealToppingsDefaultString; ?>" class="empty-string">
                                                    <input type="hidden" name='toppings_counter' id='toppingsCounter_<?php echo $cat->id . '_' . $adeal->id . '_' . $menu->id ?>' value="0" class="empty-counter">

                                                    <?php if (!empty($deal_sets[$adeal->id])): ?>
                                                        <?php if ($this->config->item('gk_order_online') == 'yes'): ?>
                                                            <div class="no-padding col-lg-2 col-md-2 col-sm-2 col-xs-3 add-to-cart  show-oneline-btn"><a href="javascript:void(0)" onclick="showExtra('<?php echo 'dealForm_' . $cat->id . '_' . $adeal->id . '_' . $menu->id ?>')"><img class="add-to-cart-btn" src="<?php echo ASSETS_PUBLIC_PATH . 'img/cart/add-to-cart-purple-deep.png' ?>" title="Add To Cart" alt="Add"></a></div>
                                                        <?php endif; ?>
                                                    <?php else: ?>
                                                        <?php if ($this->config->item('gk_order_online') == 'yes'): ?>
                                                            <div class="no-padding col-lg-2 col-md-2 col-sm-2 col-xs-3 add-to-cart click-to-add show-oneline-btn"><a href="javascript:void(0)" onclick="submitTocart('dealForm_<?php echo $cat->id . '_' . $adeal->id . '_' . $menu->id ?>', 'yes', '<?php echo $menu->id ?>')" ><img class="add-to-cart-btn" src="<?php echo ASSETS_PUBLIC_PATH . 'img/cart/add-to-cart-purple-deep.png' ?>" title="Add To Cart" alt="Add"></a></div>
                                                        <?php endif; ?>
                                                    <?php endif; ?>
                                                    <div class="no-padding col-lg-12 col-md-12 col-sm-12 col-xs-12 desc"><?php echo html_escape($adeal->content) ?></div>
                                                    <?php if (!empty($deal_sets[$adeal->id])): ?>  
                                                        <div class="clearfix"></div>
                                                        <div class="extra hide-box" style="display: none; ">
                                                            <div class="extra-content">
                                                                <div class="well">
                                                                    <h3 class="text-center text-uppercase">Prepare your meal</h3>
                                                                    <?php $setindex = 0; ?>
                                                                    <?php $set_ids = ''; ?>
                                                                    <?php foreach ($deal_sets[$adeal->id] as $aset): ?>
                                                                        <?php $set_ids .= $aset->id . '_'; ?>
                                                                        <div  onclick="ShowHideDealSet('dealSet_<?php echo $adeal->id . '_' . $aset->id . '_' . $menu->id ?>', 'deal-set-toggle')" style='cursor: pointer; margin: 5px;' class="deal-set">
                                                                            <h5 class="text-center text-uppercase" id="setTitleFor_<?php echo $cat->id . '_' . $adeal->id . '_' . $menu->id . '_' . $aset->id ?>"><?php echo $aset->title ?> &nbsp;&nbsp;<span style="font-size: 10px;">(Click Here to open/close)</span></h5>
                                                                            <p class="text-center"><span style="font-size: 12px; font-weight: bold; text-transform: capitalize">[Any <?php echo $aset->allowed ?> items can be chosen from this set]</span></p>
                                                                            <p class="text-center" id="displayIndividualSetItems_<?php echo $cat->id . '_' . $adeal->id . '_' . $aset->id . '_' . $menu->id ?>"><span><strong>You Choose :</strong></span><span class="individual-set-items no-items-yet-text" style="font-weight: bold">No items yet</span><span><input type="hidden" class="individual-set-items-val empty-string"/></span></p>
                                                                        </div>
                                                                        <div class="list-group checked-list-box deal-set-toggle" id='dealSet_<?php echo $adeal->id . '_' . $aset->id . '_' . $menu->id ?>' style='display: none; margin: 5px;'>
                                                                            <?php
                                                                            foreach ($deal_set_menus[$adeal->id][$aset->id]as $set_item) {
                                                                                $menuId = $set_item->menu;
                                                                                $menuInfo = get_menu_info_by_id($set_item->menu);
                                                                                if (!empty($menuInfo)) {
                                                                                    $menuSelObj = get_record_list('meal_deal_selection', array('deal' => $set_item->deal, 'set' => $set_item->set, 'cat' => $set_item->cat, 'menu' => $set_item->menu));
                                                                                    if (!empty($menuSelObj)) {
                                                                                        foreach ($menuSelObj as $menSel) {
                                                                                            $menuId = $set_item->menu . '_' . $menSel->selection;
                                                                                            $selInfo = get_selection_info_by_id($menSel->selection);
                                                                                            if (!empty($selInfo)) {
                                                                                                ?>
                                                                                                <div class="form-check">
                                                                                                    <label class="form-check-label btn-u btn-brd btn-u-orange" style="width:100%">
                                                                                                        <input class="form-check-input"  onclick="calculateDealSetInfo('<?php echo $cat->id ?>', '<?php echo $adeal->id ?>', '<?php echo $aset->id ?>', '<?php echo $menuId ?>', 'dealForm_<?php echo $cat->id . '_' . $adeal->id . '_' . $menu->id ?>', '<?php echo $aset->allowed ?>', '<?php echo $menu->id ?>')" id='dealSetItemsCheckbox_<?php echo $cat->id . '_' . $adeal->id . '_' . $aset->id . '_' . $menuId . '_' . $menu->id ?>' type="checkbox" name="set_menus[]" value="<?php echo html_escape(ucwords(strtolower($selInfo->title)) . '-' . ucwords(strtolower($menuInfo->title))) ?>">
                                                                                                        <?php echo ucwords(strtolower($selInfo->title)) . '-' . ucwords(strtolower($menuInfo->title)) ?>
                                                                                                    </label>
                                                                                                </div> 
                                                                                            <?php } ?>
                                                                                        <?php } ?>
                                                                                    <?php } else { ?>
                                                                                        <div class="form-check">
                                                                                            <label class="form-check-label btn-u btn-brd btn-u-orange" style="width:100%">
                                                                                                <input class="form-check-input"   onclick="calculateDealSetInfo('<?php echo $cat->id ?>', '<?php echo $adeal->id ?>', '<?php echo $aset->id ?>', '<?php echo $menuId ?>', 'dealForm_<?php echo $cat->id . '_' . $adeal->id . '_' . $menu->id ?>', '<?php echo $aset->allowed ?>', '<?php echo $menu->id ?>')" id='dealSetItemsCheckbox_<?php echo $cat->id . '_' . $adeal->id . '_' . $aset->id . '_' . $menuId . '_' . $menu->id ?>' type="checkbox" name="set_menus[]" value="<?php echo html_escape(ucwords(strtolower($menuInfo->title))) ?>">
                                                                                                <?php echo ucwords(strtolower($menuInfo->title)) ?>
                                                                                            </label>
                                                                                        </div>
                                                                                    <?php } ?>
                                                                                <?php } ?>    
                                                                            <?php } ?>
                                                                        </div>
                                                                        <input type='hidden' id='setItemCounter_<?php echo $cat->id . '_' . $adeal->id . '_' . $aset->id . '_' . $menu->id ?>' value='0' class="empty-counter"> 
                                                                        <?php $setindex++; ?>
                                                                    <?php endforeach; ?>
                                                                    <?php $thisDealToppings = get_record_list('item_toppings', array('meal_deal' => $adeal->id, 'status' => 1)); ?>
                                                                    <?php if (!empty($thisDealToppings)): ?>
                                                                        <?php
                                                                        $oraganizedThisDealToppings = array();
                                                                        foreach ($thisDealToppings as $key => $item) {
                                                                            $oraganizedThisDealToppings[$item->top_cat][] = $item;
                                                                        }
                                                                        ?>    
                                                                        <div onclick="ShowHideDealSet('dealToppings_<?php echo $adeal->id . '_' . $menu->id ?>', 'deal-toppings')" style='cursor: pointer; margin: 5px;' class="deal-set">
                                                                            <h5 class="text-center text-uppercase">Add Extra <span style="font-size:10px;">(Click Here to open/close)</span></h5>
                                                                            <?php if ($adeal->max_toppings > 0 || $adeal->free_toppings > 0) { ?>
                                                                                <?php $toppingsHead = $adeal->max_toppings > 0 ? 'Any ' . $adeal->max_toppings . ' can be selected. ' : '' ?>
                                                                                <?php $toppingsHead .= $adeal->free_toppings > 0 ? $adeal->free_toppings . ' is free' : '' ?>
                                                                                <p class="text-center"><span style="font-size: 12px; font-weight: bold; text-transform: capitalize">[<?php echo $toppingsHead ?>]</span></p>
                                                                            <?php } ?>
                                                                            <p class="text-center" id="displayIndividualDealToppings_<?php echo $cat->id . '_' . $adeal->id . '_' . $menu->id ?>"><span><strong>You Choose :</strong></span><span class="individual-deal-toppings-items no-toppings-yet-text" style="font-weight: bold">No toppings yet</span><span><input type="hidden" class="individual-deal-toppings-items-val empty-string"/></span></p>
                                                                        </div>

                                                                        <div class="list-group checked-list-box deal-set-toggle" id='dealToppings_<?php echo $adeal->id . '_' . $menu->id ?>' style='display: none; margin: 5px; list-style: none;'> 
                                                                            <?php foreach ($oraganizedThisDealToppings as $ToppingCategoryId => $toppingsCategory): ?>
                                                                                <?php $toppingCategoryInfo = get_topping_category_name($ToppingCategoryId) ?>
                                                                                <div class="list-group-item">
                                                                                    <div class="text-left checkbox">
                                                                                        <label style="width: 100%;color: #000; padding-left: 30px;" data-toggle="collapse" data-target="#dealToppingCategory_<?php echo $ToppingCategoryId . '_' . $adeal->id . '_' . $menu->id ?>" id="collapseDealToppingCategory_<?php echo $ToppingCategoryId . '_' . $adeal->id . '_' . $menu->id ?>">
                                                                                            <input type="checkbox"  style="color: #000000;"> <?php echo $toppingCategoryInfo->title ?>&nbsp;[Maximum <?php echo $toppingCategoryInfo->max_select ?>]
                                                                                            <input type="hidden" id="maximumDealCategoryTopping_<?php echo $toppingCategoryInfo->id . '_' . $adeal->id . '_' . $menu->id ?>" value="<?php echo $toppingCategoryInfo->max_select ?>">
                                                                                            <input type="hidden" id="maxmumDealCategoryToppingCounter_<?php echo $toppingCategoryInfo->id . '_' . $adeal->id . '_' . $menu->id ?>" value="0" class="empty-counter">
                                                                                        </label>
                                                                                    </div>
                                                                                    <div class="row collapse" id="dealToppingCategory_<?php echo $ToppingCategoryId . '_' . $adeal->id . '_' . $menu->id ?>">
                                                                                        <?php foreach ($toppingsCategory as $deal_topping): ?>
                                                                                            <div class="form-check">
                                                                                                <label class="form-check-label btn-u btn-brd btn-u-orange" style="width:100%">
                                                                                                    <input  type="checkbox" <?php $deal_topping->is_default == 'yes' ? print"checked='checked' disabled='true'" : '' ?> id='dealTopping_<?php echo $cat->id . '_' . $adeal->id . '_' . $deal_topping->id . '_' . $menu->id ?>' value="<?php echo ucwords(strtolower($deal_topping->title)) ?>" onclick="calculateDealToppingsInfo('<?php echo $cat->id ?>', '<?php echo $adeal->id ?>', '<?php echo $deal_topping->id ?>', 'dealForm_<?php echo $cat->id . '_' . $adeal->id . '_' . $menu->id ?>', '<?php echo $adeal->max_toppings ?>', '<?php $adeal->free_toppings > 0 ? print $adeal->free_toppings : print 0 ?>', '<?php echo $adeal->price ?>', '<?php echo $deal_topping->top_cat ?>', '<?php echo $menu->id ?>')"><?php echo ucwords(strtolower($deal_topping->title)) . '&nbsp;[&nbsp;+&nbsp;' . to_currency($deal_topping->price) . '&nbsp;]' ?>
                                                                                                    <input type="hidden" id='dealToppingPrice_<?php echo $cat->id . '_' . $adeal->id . '_' . $deal_topping->id . '_' . $menu->id ?>' value="<?php echo $deal_topping->price ?>">
                                                                                                </label>
                                                                                            </div>
                                                                                        <?php endforeach; ?>
                                                                                    </div>
                                                                                </div>
                                                                            <?php endforeach; ?>
                                                                        </div>
                                                                    <?php endif; ?>
                                                                    <!--
                                                                <ul class="list-group deal-string-display" id="dealStringDisplay_<?php echo $adeal->id . '_' . $menu->id ?>" style="display: none;">
                                                                    <li class="list-group-item">
                                                                        <ul class="list-group">
                                                                            <li class="list-group-item" id="dealItemsDisplayLi_<?php echo $adeal->id . '_' . $menu->id ?>">Items:&nbsp;<span id="dealItemsDisplay_<?php echo $adeal->id . '_' . $menu->id ?>" class="deal-items-display"></span></li>
                                                                            <li class="list-group-item" id="dealToppingsDisplayLi_<?php echo $adeal->id . '_' . $menu->id ?>">Toppings:&nbsp;<span id="dealToppingsDisplay_<?php echo $adeal->id . '_' . $menu->id ?>" class="deal-toppings-display"></span></li>
                                                                        </ul>
                                                                    </li>
                                                                </ul>    
                                                                    -->
                                                                    <input type="hidden" id="DealSetQuantity_<?php echo $adeal->id . '_' . $menu->id ?>" value="<?php echo $setindex ?>">
                                                                    <input type="hidden" id="DealSetIds_<?php echo $adeal->id . '_' . $menu->id ?>" value="<?php echo $set_ids ?>">
                                                                    <input type="hidden" id="DealToppingsPriceTotal_<?php echo $adeal->id . '_' . $menu->id ?>" value="0" class="empty-counter">
                                                                    <?php if ($this->config->item('gk_order_online') == 'yes'): ?>
                                                                        <div class="text-center" style="padding-top:10px;"><a href="javascript:void(0)" class="btn-u btn-brd btn-brd-hover btn-u-purple show-oneline-btn add-to-cart click-to-add" onclick="submitTocart('dealForm_<?php echo $cat->id . '_' . $adeal->id . '_' . $menu->id ?>', 'yes', '<?php echo $menu->id ?>')">Add To Cart</a></div>
                                                                    <?php endif; ?>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    <?php endif; ?> 
                                                </form>  
                                            </li>
                                        <?php endif ?>
                                        <?php if (!empty($selections [$cat->id][$menu->id])): ?>
                                            <li>
                                                <div class="no-padding col-lg-12 col-md-12 col-sm-12 col-xs-12 title"><?php echo ucwords(strtolower(html_escape($menu->title))) ?></div>
                                                <div class="no-padding col-lg-12 col-md-12 col-sm-12 col-xs-12 desc"><?php echo html_escape($menu->content) ?></div>
                                                <ul class="selection-list">
                                                    <?php foreach ($selections [$cat->id][$menu->id] as $sel): ?>
                                                        <?php if ($sel->is_special == 'yes' && $sel->deal != null && $sel->deal > 0): ?>
                                                            <?php $adeal = get_single_record('meal_deal', array('id' => $sel->deal)) ?>
                                                            <li>
                                                                <form id="dealForm_<?php echo $cat->id . '_' . $adeal->id . '_' . $menu->id . '_' . $sel->id ?>">
                                                                    <div class="no-padding col-lg-5 col-md-5 col-sm-5 col-xs-12 title">=><?php echo ucwords(strtolower(html_escape($adeal->title))) ?><?php $adeal->bogo == 1 ? print'<br/><span class="badge-red">Buy 1 Get 1 Free</span>' : '' ?></div>
                                                                    <div class="no-padding col-lg-2 col-md-2 col-sm-2 col-xs-3 price">
                                                                        <span><?php echo $this->config->item('currency_symbol') ?></span>
                                                                        <span class="visible-price" id="dealVisiblePriceFor_<?php echo $cat->id . '_' . $adeal->id . '_' . $menu->id . '_' . $sel->id ?>"><?php echo to_currency_no_money($adeal->price) ?></span>
                                                                    </div>
                                                                    <div class="no-padding col-lg-3 col-md-3 col-sm-3 col-xs-6 shop-product quantity menu-md-quantity">
                                                                        <div class="product-quantity">
                                                                            <?php if ($this->config->item('gk_order_online') == 'yes'): ?>
                                                                                <span class="text-center hidden-xs hidden-sm hidden-md">Qty:</span>
                                                                                <a href="javascript:void(0)" class="quantity-button" onclick='javascript: subtractQty("dealqty_<?php echo $cat->id . '_' . $adeal->id ?>");'><strong>-</strong></a>
                                                                                <input type='text' class="quantity-field" name="quantity" value="1" id='dealqty_<?php echo $cat->id . '_' . $adeal->id ?>' readonly="true"/>
                                                                                <a href="javascript:void(0)" class="quantity-button" onclick='javascript: document.getElementById("dealqty_<?php echo $cat->id . '_' . $adeal->id ?>").value++;'><strong>+</strong></a>
                                                                            <?php endif; ?>
                                                                        </div>
                                                                    </div>
                                                                    <?php
                                                                    $dealToppingsDefault = get_record_list('item_toppings', array('meal_deal' => $adeal->id, 'status' => 1, 'is_default' => 'yes'));
                                                                    $dealToppingsDefaultString = '';
                                                                    if (!empty($dealToppingsDefault)) {
                                                                        foreach ($dealToppingsDefault as $defaultTopping) {
                                                                            $dealToppingsDefaultString .= ',' . $defaultTopping->title;
                                                                        }
                                                                    }
                                                                    ?>
                                                                    <input type="hidden" name='bogo' value='<?php echo $adeal->bogo ?>'>
                                                                    <input type="hidden" name='bogo_discount_on' value='deal'>
                                                                    <input type="hidden" name='deal' value='<?php echo $adeal->id ?>'>
                                                                    <input type="hidden" name='category' value='<?php echo $cat->id ?>'>
                                                                    <input type="hidden" name='category_title' value='<?php echo ucwords(strtolower($cat->title)) ?>'>
                                                                    <input type='hidden' name='print_option' value='<?php echo $cat->print_option ?>'>
                                                                    <input type='hidden' name='type' value='<?php echo $cat->type ?>'>
                                                                    <input type="hidden" name='is_special' value='<?php echo $sel->is_special ?>'>
                                                                    <input type="hidden" name='menu' value='<?php echo $menu->id ?>'>
                                                                    <input type="hidden" name='menu_title' value='<?php echo ucwords(strtolower($adeal->title)) ?>'>
                                                                    <input type="hidden" name='selection' value=''>
                                                                    <input type="hidden" name='selection_title' value=''>
                                                                    <input type="hidden" name='set_items' value='' id='dealSetItems_<?php echo $cat->id . '_' . $adeal->id . '_' . $menu->id . '_' . $sel->id ?>' class="empty-string">
                                                                    <input type="hidden" value='<?php echo to_currency_no_money($adeal->price) ?>' class="orginal-price">
                                                                    <input type="hidden" name='price' value='<?php echo to_currency_no_money($adeal->price) ?>' id="dealHiddenPriceFor_<?php echo $cat->id . '_' . $adeal->id . '_' . $menu->id . '_' . $sel->id ?>" class="hidden-price">
                                                                    <input type="hidden" name="toppings" id="dealToppingsString_<?php echo $cat->id . '_' . $adeal->id . '_' . $menu->id . '_' . $sel->id ?>" value="<?php echo $dealToppingsDefaultString ?>" class="empty-string">
                                                                    <input type="hidden" name='toppings_counter' id='toppingsCounter_<?php echo $cat->id . '_' . $adeal->id . '_' . $menu->id . '_' . $sel->id ?>' value="0" class="empty-counter">

                                                                    <?php if (!empty($deal_sets[$adeal->id])): ?>
                                                                        <?php if ($this->config->item('gk_order_online') == 'yes'): ?>
                                                                            <div class="no-padding col-lg-2 col-md-2 col-sm-2 col-xs-3 add-to-cart  show-oneline-btn"><a href="javascript:void(0)" onclick="showExtra('<?php echo 'dealForm_' . $cat->id . '_' . $adeal->id . '_' . $menu->id . '_' . $sel->id ?>')"><img class="add-to-cart-btn" src="<?php echo ASSETS_PUBLIC_PATH . 'img/cart/add-to-cart-purple-deep.png' ?>" title="Add To Cart" alt="Add"></a></div>
                                                                        <?php endif; ?>
                                                                    <?php else: ?>
                                                                        <?php if ($this->config->item('gk_order_online') == 'yes'): ?>
                                                                            <div class="no-padding col-lg-2 col-md-2 col-sm-2 col-xs-3 add-to-cart click-to-add show-oneline-btn"><a href="javascript:void(0)" onclick="submitTocart('dealForm_<?php echo $cat->id . '_' . $adeal->id . '_' . $menu->id . '_' . $sel->id ?>', 'yes', '<?php echo $menu->id . '_' . $sel->id ?>')" ><img class="add-to-cart-btn" src="<?php echo ASSETS_PUBLIC_PATH . 'img/cart/add-to-cart-purple-deep.png' ?>" title="Add To Cart" alt="Add"></a></div>
                                                                        <?php endif; ?>
                                                                    <?php endif; ?>
                                                                    <div class="no-padding col-lg-12 col-md-12 col-sm-12 col-xs-12 desc"><?php echo html_escape($adeal->content) ?></div>
                                                                    <?php if (!empty($deal_sets[$adeal->id])): ?>  
                                                                        <div class="clearfix"></div>
                                                                        <div class="extra hide-box" style="display: none; ">
                                                                            <div class="extra-content">
                                                                                <div class="well">
                                                                                    <h3 class="text-center text-uppercase">Prepare your meal</h3>
                                                                                    <?php $setindex = 0; ?>
                                                                                    <?php $set_ids = ''; ?>
                                                                                    <?php foreach ($deal_sets[$adeal->id] as $aset): ?>
                                                                                        <?php $set_ids .= $aset->id . '_'; ?>
                                                                                        <div  onclick="ShowHideDealSet('dealSet_<?php echo $adeal->id . '_' . $aset->id . '_' . $menu->id . '_' . $sel->id ?>', 'deal-set-toggle')" style='cursor: pointer; margin: 5px;' class="deal-set">
                                                                                            <h5 class="text-center text-uppercase" id="setTitleFor_<?php echo $cat->id . '_' . $adeal->id . '_' . $menu->id . '_' . $sel->id . '_' . $aset->id ?>"><?php echo $aset->title ?> &nbsp;&nbsp;<span style="font-size: 10px;">(Click Here to open/close)</span></h5>
                                                                                            <p class="text-center"><span style="font-size: 12px; font-weight: bold; text-transform: capitalize">[Any <?php echo $aset->allowed ?> items can be chosen from this set]</span></p>
                                                                                            <p class="text-center" id="displayIndividualSetItems_<?php echo $cat->id . '_' . $adeal->id . '_' . $aset->id . '_' . $menu->id . '_' . $sel->id ?>"><span><strong>You Choose :</strong></span><span class="individual-set-items no-items-yet-text" style="font-weight: bold">No items yet</span><span><input type="hidden" class="individual-set-items-val empty-string"/></span></p>
                                                                                        </div>
                                                                                        <div class="list-group checked-list-box deal-set-toggle" id='dealSet_<?php echo $adeal->id . '_' . $aset->id . '_' . $menu->id . '_' . $sel->id ?>' style='display: none; margin: 5px;'>
                                                                                            <?php
                                                                                            foreach ($deal_set_menus[$adeal->id][$aset->id]as $set_item) {
                                                                                                $menuId = $set_item->menu;
                                                                                                $menuInfo = get_menu_info_by_id($set_item->menu);
                                                                                                if (!empty($menuInfo)) {
                                                                                                    $menuSelObj = get_record_list('meal_deal_selection', array('deal' => $set_item->deal, 'set' => $set_item->set, 'cat' => $set_item->cat, 'menu' => $set_item->menu));
                                                                                                    if (!empty($menuSelObj)) {
                                                                                                        foreach ($menuSelObj as $menSel) {
                                                                                                            $menuId = $set_item->menu . '_' . $menSel->selection;
                                                                                                            $selInfo = get_selection_info_by_id($menSel->selection);
                                                                                                            if (!empty($selInfo)) {
                                                                                                                ?>
                                                                                                                <div class="form-check">
                                                                                                                    <label class="form-check-label btn-u btn-brd btn-u-orange" style="width:100%">
                                                                                                                        <input class="form-check-input"  onclick="calculateDealSetInfo('<?php echo $cat->id ?>', '<?php echo $adeal->id ?>', '<?php echo $aset->id ?>', '<?php echo $menuId ?>', 'dealForm_<?php echo $cat->id . '_' . $adeal->id . '_' . $menu->id . '_' . $sel->id ?>', '<?php echo $aset->allowed ?>''<?php echo $menu->id . '_' . $sel->id ?>')" id='dealSetItemsCheckbox_<?php echo $cat->id . '_' . $adeal->id . '_' . $aset->id . '_' . $menuId . '_' . $menu->id . '_' . $sel->id ?>' type="checkbox" name="set_menus[]" value="<?php echo html_escape(ucwords(strtolower($selInfo->title)) . '-' . ucwords(strtolower($menuInfo->title))) ?>">
                                                                                                                        <?php echo ucwords(strtolower($selInfo->title)) . '-' . ucwords(strtolower($menuInfo->title)) ?>
                                                                                                                    </label>
                                                                                                                </div> 
                                                                                                            <?php } ?>
                                                                                                        <?php } ?>
                                                                                                    <?php } else { ?>
                                                                                                        <div class="form-check">
                                                                                                            <label class="form-check-label btn-u btn-brd btn-u-orange" style="width:100%">
                                                                                                                <input class="form-check-input"   onclick="calculateDealSetInfo('<?php echo $cat->id ?>', '<?php echo $adeal->id ?>', '<?php echo $aset->id ?>', '<?php echo $menuId ?>', 'dealForm_<?php echo $cat->id . '_' . $adeal->id . '_' . $menu->id . '_' . $sel->id ?>', '<?php echo $aset->allowed ?>', '<?php echo $menu->id . '_' . $sel->id ?>')" id='dealSetItemsCheckbox_<?php echo $cat->id . '_' . $adeal->id . '_' . $aset->id . '_' . $menuId . '_' . $menu->id . '_' . $sel->id ?>' type="checkbox" name="set_menus[]" value="<?php echo html_escape(ucwords(strtolower($menuInfo->title))) ?>">
                                                                                                                <?php echo ucwords(strtolower($menuInfo->title)) ?>
                                                                                                            </label>
                                                                                                        </div>
                                                                                                    <?php } ?>
                                                                                                <?php } ?>    
                                                                                            <?php } ?>
                                                                                        </div>
                                                                                        <input type='hidden' id='setItemCounter_<?php echo $cat->id . '_' . $adeal->id . '_' . $aset->id . '_' . $menu->id . '_' . $sel->id ?>' value='0' class="empty-counter"> 
                                                                                        <?php $setindex++; ?>
                                                                                    <?php endforeach; ?>
                                                                                    <?php $thisDealToppings = get_record_list('item_toppings', array('meal_deal' => $adeal->id, 'status' => 1)); ?>
                                                                                    <?php if (!empty($thisDealToppings)): ?>
                                                                                        <?php
                                                                                        $organizedToppings = array();
                                                                                        foreach ($thisDealToppings as $key => $item) {
                                                                                            $organizedToppings[$item->top_cat][] = $item;
                                                                                        }
                                                                                        ?>    
                                                                                        <div onclick="ShowHideDealSet('dealToppings_<?php echo $adeal->id . '_' . $menu->id . '_' . $sel->id ?>', 'deal-toppings')" style='cursor: pointer; margin: 5px;' class="deal-set">
                                                                                            <h5 class="text-center text-uppercase">Add Extra <span style="font-size:10px;">(Click Here to open/close)</span></h5>
                                                                                            <?php if ($adeal->max_toppings > 0 || $adeal->free_toppings > 0) { ?>
                                                                                                <?php $toppingsHead = $adeal->max_toppings > 0 ? 'Any ' . $adeal->max_toppings . ' can be selected. ' : '' ?>
                                                                                                <?php $toppingsHead .= $adeal->free_toppings > 0 ? $adeal->free_toppings . ' is free' : '' ?>
                                                                                                <p class="text-center"><span style="font-size: 12px; font-weight: bold; text-transform: capitalize">[<?php echo $toppingsHead ?>]</span></p>
                                                                                            <?php } ?>
                                                                                            <p class="text-center" id="displayIndividualDealToppings_<?php echo $cat->id . '_' . $adeal->id . '_' . $menu->id . '_' . $sel->id ?>"><span><strong>You Choose :</strong></span><span class="individual-deal-toppings-items no-toppings-yet-text" style="font-weight: bold">No toppings yet</span><span><input type="hidden" class="individual-deal-toppings-items-val empty-string"/></span></p>
                                                                                        </div>

                                                                                        <div class="list-group checked-list-box deal-set-toggle" id='dealToppings_<?php echo $adeal->id . '_' . $menu->id . '_' . $sel->id ?>' style='display: none; margin: 5px; list-style: none;'> 
                                                                                            <?php foreach ($organizedToppings as $ToppingCategoryId => $toppingsCategory): ?>
                                                                                                <?php $toppingCategoryInfo = get_topping_category_name($ToppingCategoryId) ?>
                                                                                                <div class="list-group-item">
                                                                                                    <div class="text-left checkbox">
                                                                                                        <label style="width: 100%;color: #000; padding-left: 30px;" data-toggle="collapse" data-target="#dealToppingCategory_<?php echo $ToppingCategoryId . '_' . $adeal->id . '_' . $menu->id . '_' . $sel->id ?>" id="collapseDealToppingCategory_<?php echo $ToppingCategoryId . '_' . $adeal->id . '_' . $menu->id . '_' . $sel->id ?>">
                                                                                                            <input type="checkbox" style="color: #000000;"> <?php echo $toppingCategoryInfo->title ?>&nbsp;[Maximum <?php echo $toppingCategoryInfo->max_select ?>]
                                                                                                            <input type="hidden" id="maximumDealCategoryTopping_<?php echo $toppingCategoryInfo->id . '_' . $adeal->id . '_' . $menu->id . '_' . $sel->id ?>" value="<?php echo $toppingCategoryInfo->max_select ?>">
                                                                                                            <input type="hidden" id="maxmumDealCategoryToppingCounter_<?php echo $toppingCategoryInfo->id . '_' . $adeal->id . '_' . $menu->id . '_' . $sel->id ?>" value="0" class="empty-counter">
                                                                                                        </label>
                                                                                                    </div>
                                                                                                    <div class="row collapse" id="dealToppingCategory_<?php echo $ToppingCategoryId . '_' . $adeal->id . '_' . $menu->id . '_' . $sel->id ?>">
                                                                                                        <?php foreach ($toppingsCategory as $deal_topping): ?>
                                                                                                            <div class="form-check">
                                                                                                                <label class="form-check-label btn-u btn-brd btn-u-orange" style="width:100%">
                                                                                                                    <input type="checkbox" <?php $deal_topping->is_default == 'yes' ? print"checked='checked' disabled='true'" : '' ?> id='dealTopping_<?php echo $cat->id . '_' . $adeal->id . '_' . $deal_topping->id . '_' . $menu->id . '_' . $sel->id ?>'  value="<?php echo ucwords(strtolower($deal_topping->title)) ?>" onclick="calculateDealToppingsInfo('<?php echo $cat->id ?>', '<?php echo $adeal->id ?>', '<?php echo $deal_topping->id ?>', 'dealForm_<?php echo $cat->id . '_' . $adeal->id . '_' . $menu->id . '_' . $sel->id ?>', '<?php echo $adeal->max_toppings ?>', '<?php $adeal->free_toppings > 0 ? print $adeal->free_toppings : print 0 ?>', '<?php echo $adeal->price ?>', '<?php echo $deal_topping->top_cat ?>', '<?php echo $menu->id . '_' . $sel->id ?>')"><?php echo ucwords(strtolower($deal_topping->title)) . '&nbsp;[&nbsp;+&nbsp;' . to_currency($deal_topping->price) . '&nbsp;]' ?>
                                                                                                                    <input type="hidden" id='dealToppingPrice_<?php echo $cat->id . '_' . $adeal->id . '_' . $deal_topping->id . '_' . $menu->id . '_' . $sel->id ?>' value="<?php echo $deal_topping->price ?>">
                                                                                                                </label>
                                                                                                            </div>
                                                                                                        <?php endforeach; ?>
                                                                                                    </div>
                                                                                                </div>
                                                                                            <?php endforeach; ?>
                                                                                        </div>
                                                                                    <?php endif; ?>
                                                                                    <!--
                                                                                    <ul class="list-group deal-string-display" id="dealStringDisplay_<?php echo $adeal->id . '_' . $menu->id . '_' . $sel->id ?>" style="display: none;">
                                                                                        <li class="list-group-item">
                                                                                            <ul class="list-group">
                                                                                                <li class="list-group-item" id="dealItemsDisplayLi_<?php echo $adeal->id . '_' . $menu->id . '_' . $sel->id ?>">Items:&nbsp;<span id="dealItemsDisplay_<?php echo $adeal->id . '_' . $menu->id . '_' . $sel->id ?>" class="deal-items-display"></span></li>
                                                                                                <li class="list-group-item" id="dealToppingsDisplayLi_<?php echo $adeal->id . '_' . $menu->id . '_' . $sel->id ?>">Toppings:&nbsp;<span id="dealToppingsDisplay_<?php echo $adeal->id . '_' . $menu->id . '_' . $sel->id ?>" class="deal-toppings-display"></span></li>
                                                                                            </ul>
                                                                                        </li>
                                                                                    </ul>   
                                                                                    -->
                                                                                    <input type="hidden" id="DealSetQuantity_<?php echo $adeal->id . '_' . $menu->id . '_' . $sel->id ?>" value="<?php echo $setindex ?>">
                                                                                    <input type="hidden" id="DealSetIds_<?php echo $adeal->id . '_' . $menu->id . '_' . $sel->id ?>" value="<?php echo $set_ids ?>">
                                                                                    <input type="hidden" id="DealToppingsPriceTotal_<?php echo $adeal->id . '_' . $menu->id . '_' . $sel->id ?>" value="0" class="empty-counter">
                                                                                    <?php if ($this->config->item('gk_order_online') == 'yes'): ?>
                                                                                        <div class="text-center" style="padding-top:10px;"><a href="javascript:void(0)" class="btn-u btn-brd btn-brd-hover btn-u-purple show-oneline-btn add-to-cart click-to-add" onclick="submitTocart('dealForm_<?php echo $cat->id . '_' . $adeal->id . '_' . $menu->id . '_' . $sel->id ?>', 'yes', '<?php echo $menu->id . '_' . $sel->id ?>')">Add To Cart</a></div>
                                                                                    <?php endif; ?>
                                                                                </div>
                                                                            </div>
                                                                        </div>
                                                                    <?php endif; ?> 
                                                                </form>  
                                                            </li>
                                                        <?php else: ?>
                                                            <li>
                                                                <form id="itemForm_<?php echo $cat->id . '_' . $menu->id . '_' . $sel->id ?>">
                                                                    <div class="no-padding col-lg-5 col-md-5 col-sm-5 col-xs-12 title">=><?php echo ucwords(strtolower(html_escape($sel->title))) ?><?php $sel->bogo == 1 ? print'<br/><span class="badge-red">Buy 1 Get 1 Free</span>' : '' ?></div>
                                                                    <div class="no-padding col-lg-2 col-md-2 col-sm-2 col-xs-3 price">
                                                                        <span><?php echo $this->config->item('currency_symbol') ?></span>
                                                                        <span class="visible-price" id="visiblePriceFor_<?php echo $cat->id . '_' . $menu->id . '_' . $sel->id ?>"><?php echo to_currency_no_money($sel->out_price > 0 ? $sel->out_price : $sel->base_price) ?></span>
                                                                    </div>
                                                                    <div class="no-padding col-lg-3 col-md-3 col-sm-3 col-xs-6 shop-product quantity sel-md-quantity">
                                                                        <div class="product-quantity">
                                                                            <?php if ($this->config->item('gk_order_online') == 'yes'): ?>
                                                                                <span class="text-center hidden-xs hidden-sm hidden-md">Qty:</span>
                                                                                <a href="javascript:void(0)" class="quantity-button" onclick='javascript: subtractQty("selqty_<?php echo $cat->id . '_' . $menu->id . '_' . $sel->id ?>");'><strong>-</strong></a>
                                                                                <input type='text' class="quantity-field" name="quantity" value="1" id='selqty_<?php echo $cat->id . '_' . $menu->id . '_' . $sel->id ?>' readonly="true"/>
                                                                                <a href="javascript:void(0)" class="quantity-button" onclick='javascript: document.getElementById("selqty_<?php echo $cat->id . '_' . $menu->id . '_' . $sel->id ?>").value++;'><strong>+</strong></a>
                                                                            <?php endif; ?>
                                                                        </div>
                                                                    </div>
                                                                    <?php
                                                                    $selToppingsDefault = get_record_list('item_toppings', array('selection' => $sel->id, 'status' => 1, 'is_default' => 'yes'));
                                                                    $selToppingsDefaultString = '';
                                                                    if (!empty($selToppingsDefault)) {
                                                                        foreach ($selToppingsDefault as $defaultTopping) {
                                                                            $selToppingsDefaultString .= ',' . $defaultTopping->title;
                                                                        }
                                                                    }
                                                                    ?>
                                                                    <input type="hidden" name='category' value='<?php echo $cat->id ?>'>
                                                                    <input type="hidden" name='category_title' value='<?php echo ucwords(strtolower($cat->title)) ?>'>
                                                                    <input type='hidden' name='print_option' value='<?php echo $cat->print_option ?>'>
                                                                    <input type='hidden' name='type' value='<?php echo $cat->type ?>'>
                                                                    <input type="hidden" name='is_special' value='<?php echo $cat->is_special ?>'>
                                                                    <input type="hidden" name='menu' value='<?php echo $menu->id ?>'>
                                                                    <input type="hidden" name='menu_title' value='<?php echo ucwords(strtolower($menu->title)) ?>'>
                                                                    <input type="hidden" name='selection' value='<?php echo $sel->id ?>'>
                                                                    <input type="hidden" name='selection_title' value='<?php echo ucwords(strtolower($sel->title)) ?>'>
                                                                    <input type="hidden" name='bogo' value='<?php echo $sel->bogo ?>'>
                                                                    <input type="hidden" name='bogo_discount_on' value='selection'>
                                                                    <input type="hidden" name='deal' value=''>
                                                                    <input type="hidden" name='set_items' value=''>
                                                                    <input type="hidden" value='<?php echo to_currency_no_money($sel->out_price > 0 ? $sel->out_price : $sel->base_price) ?>' class="orginal-price">
                                                                    <input type="hidden" name='price' value='<?php echo to_currency_no_money($sel->out_price > 0 ? $sel->out_price : $sel->base_price) ?>' id="hiddenPriceFor_<?php echo $cat->id . '_' . $menu->id . '_' . $sel->id ?>" class="hidden-price">
                                                                    <input type="hidden" name="toppings" id="toppingsString_<?php echo $cat->id . '_' . $menu->id . '_' . $sel->id ?>" value="<?php echo $selToppingsDefaultString; ?>" class="empty-string">
                                                                    <input type="hidden" id='selectionToppingsCounter_<?php echo $cat->id . '_' . $menu->id . '_' . $sel->id ?>' value="0" class="empty-counter">
                                                                    <input  type="hidden" id="selectionToppingsPriceTotal_<?php echo $cat->id . '_' . $menu->id . '_' . $sel->id ?>" value="0" class="empty-counter"/> 
                                                                    <?php $existingSelToppings = get_record_list('item_toppings', array('selection' => $sel->id, 'status' => 1)); ?>  
                                                                    <?php if (!empty($existingSelToppings)): ?>
                                                                        <?php if ($this->config->item('gk_order_online') == 'yes'): ?>
                                                                            <div class="no-padding col-lg-2 col-md-2 col-sm-2 col-xs-3 add-to-cart show-oneline-btn"><a href="javascript:void(0)" onclick="showExtra('<?php echo 'itemForm_' . $cat->id . '_' . $menu->id . '_' . $sel->id ?>')"><img class="add-to-cart-btn" src="<?php echo ASSETS_PUBLIC_PATH . 'img/cart/add-to-cart-purple-deep.png' ?>" title="Add To Cart" alt="Add"></a></div>
                                                                        <?php endif; ?>
                                                                    <?php else: ?>
                                                                        <?php if ($this->config->item('gk_order_online') == 'yes'): ?>
                                                                            <div class="no-padding col-lg-2 col-md-2 col-sm-2 col-xs-3 add-to-cart  click-to-add show-oneline-btn"><a href="javascript:void(0)" onclick="submitTocart('itemForm_<?php echo $cat->id . '_' . $menu->id . '_' . $sel->id ?>', 'no', '')"><img class="add-to-cart-btn" src="<?php echo ASSETS_PUBLIC_PATH . 'img/cart/add-to-cart-purple-deep.png' ?>" title="Add To Cart" alt="Add"></a></div>
                                                                        <?php endif; ?>
                                                                    <?php endif; ?>
                                                                    <div class="no-padding col-lg-12 col-md-12 col-sm-12 col-xs-12 desc"><?php echo html_escape($sel->content) ?></div>
                                                                    <?php if (!empty($existingSelToppings)): ?>   
                                                                        <?php $firstHalfMeusToppings = $existingSelToppings; ?>
                                                                        <div class="clearfix"></div>
                                                                        <div class="extra hide-box" style="display: none; ">
                                                                            <div class="extra-content">
                                                                                <div class="well">
                                                                                    <h4 class="text-center text-uppercase">Add Extra</h4>
                                                                                    <?php if ($sel->max_toppings > 0 || $sel->free_toppings > 0) { ?>
                                                                                        <?php $toppingsHead = $sel->max_toppings > 0 ? 'Any ' . $sel->max_toppings . ' can be selected. ' : '' ?>
                                                                                        <?php $toppingsHead .= $sel->free_toppings > 0 ? $sel->free_toppings . ' is free' : '' ?>
                                                                                        <p class="text-center">[<?php echo $toppingsHead ?>]</p>
                                                                                    <?php } ?>

                                                                                    <?php
                                                                                    $organizedSelectionToppings = array();
                                                                                    foreach ($firstHalfMeusToppings as $key => $item) {
                                                                                        $organizedSelectionToppings[$item->top_cat][] = $item;
                                                                                    }
                                                                                    ?>
                                                                                    <div class="list-group">
                                                                                        <?php foreach ($organizedSelectionToppings as $ToppingCategoryId => $toppingsCategory): ?>
                                                                                            <?php $toppingCategoryInfo = get_topping_category_name($ToppingCategoryId) ?>
                                                                                            <div class="list-group-item text-left">
                                                                                                <div class="text-left checkbox" style="padding-left: 30px;">
                                                                                                    <label style="width: 100%" data-toggle="collapse" data-target="#toppingCategory_<?php echo $ToppingCategoryId . '_' . $cat->id . '_' . $menu->id . '_' . $sel->id ?>" id="collapseToppingCategory_<?php echo $ToppingCategoryId . '_' . $menu->id . '_' . $sel->id ?>">
                                                                                                        <input type="checkbox" style="color: #000000;"> <?php echo $toppingCategoryInfo->title ?>&nbsp;[Maximum <?php echo $toppingCategoryInfo->max_select ?>]
                                                                                                        <input type="hidden" id="maximumCategoryTopping_<?php echo $toppingCategoryInfo->id . '_' . $menu->id . '_' . $sel->id ?>" value="<?php echo $toppingCategoryInfo->max_select ?>">
                                                                                                        <input type="hidden" id="maxmumCategoryToppingCounter_<?php echo $toppingCategoryInfo->id . '_' . $menu->id . '_' . $sel->id ?>" value="0" class="empty-counter">
                                                                                                    </label>
                                                                                                </div>
                                                                                                <div class="collapse" id="toppingCategory_<?php echo $ToppingCategoryId . '_' . $cat->id . '_' . $menu->id . '_' . $sel->id ?>">
                                                                                                    <?php foreach ($toppingsCategory as $selTopping): ?>
                                                                                                        <div class="form-check">
                                                                                                            <label class="form-check-label btn-u btn-brd btn-u-orange" style="width:100%">
                                                                                                                <input class="form-check-input" <?php $selTopping->is_default == 'yes' ? print"checked='checked' disabled='true'" : '' ?>  id='topping_<?php echo $cat->id . '_' . $menu->id . '_' . $sel->id . '_' . $selTopping->id ?>' type="checkbox"  value="<?php echo ucwords(strtolower($selTopping->title)) ?>" onclick="calculateToppingsInfo('<?php echo $cat->id ?>', '<?php echo $menu->id ?>', '<?php echo $sel->id ?>', '<?php echo $selTopping->id ?>', 'itemForm_<?php echo $cat->id . '_' . $menu->id . '_' . $sel->id ?>', '<?php $sel->max_toppings > 0 ? print $sel->max_toppings : print 0 ?>', '<?php $sel->free_toppings > 0 ? print $sel->free_toppings : print 0 ?>', '<?php echo to_currency_no_money($sel->out_price > 0 ? $sel->out_price : $sel->base_price) ?>', '<?php echo $selTopping->top_cat ?>')"/><span class="title"><?php echo ucwords(strtolower($selTopping->title)) ?></span><span class="price">[&nbsp;+&nbsp;<?php echo to_currency($selTopping->price) ?>&nbsp;]</span>
                                                                                                                <input type="hidden" id='toppingPrice_<?php echo $cat->id . '_' . $menu->id . '_' . $sel->id . '_' . $selTopping->id ?>'  value="<?php echo $selTopping->price ?>">
                                                                                                            </label>
                                                                                                        </div>
                                                                                                    <?php endforeach; ?>
                                                                                                </div>       
                                                                                            </div>
                                                                                        <?php endforeach; ?>
                                                                                        <?php if ($this->config->item('gk_order_online') == 'yes'): ?>
                                                                                            <div class="list-group-item">
                                                                                                <div class="text-center" style="padding-top:10px;"><a href="javascript:void(0)" class="btn-u btn-brd btn-brd-hover btn-u-purple show-oneline-btn add-to-cart click-to-add" onclick="submitTocart('itemForm_<?php echo $cat->id . '_' . $menu->id . '_' . $sel->id ?>', 'no', '')">Add To Cart</a></div>
                                                                                            </div>
                                                                                        <?php endif; ?>
                                                                                    </div>
                                                                                </div>
                                                                            </div>
                                                                        </div>
                                                                    <?php endif; ?>
                                                                </form>    
                                                            </li>
                                                        <?php endif; ?>
                                                    <?php endforeach; ?>
                                                </ul>
                                            </li>
                                        <?php else: ?>
                                            <?php if ($menu->is_special != 'yes' || $menu->deal < 1): ?>
                                                <li>
                                                    <form id="itemForm_<?php echo $cat->id . '_' . $menu->id ?>">
                                                        <div class="no-padding col-lg-5 col-md-5 col-sm-5 col-xs-12 title"><?php echo ucwords(strtolower(html_escape($menu->title))) ?><?php $menu->bogo == 1 ? print'<br/><span class="badge-red">Buy 1 Get 1 Free</span>' : '' ?></div>
                                                        <div class="no-padding col-lg-2 col-md-2 col-sm-2 col-xs-3 price">
                                                            <span><?php echo $this->config->item('currency_symbol') ?></span>
                                                            <span class="visible-price" id="visiblePriceFor_<?php echo $cat->id . '_' . $menu->id ?>"><?php echo to_currency_no_money($menu->out_price > 0 ? $menu->out_price : $menu->base_price) ?></span>
                                                        </div>
                                                        <div class="no-padding col-lg-3 col-md-3 col-sm-3 col-xs-6 shop-product quantity menu-md-quantity">
                                                            <div class="product-quantity">
                                                                <?php if ($this->config->item('gk_order_online') == 'yes'): ?>
                                                                    <span class="text-center hidden-xs hidden-sm hidden-md">Qty:</span>
                                                                    <a href="javascript:void(0)" class="quantity-button" onclick='javascript: subtractQty("menuqty_<?php echo $cat->id . '_' . $menu->id ?>");'><strong>-</strong></a>
                                                                    <input type='text' class="quantity-field" name="quantity" value="1" id='menuqty_<?php echo $cat->id . '_' . $menu->id ?>' readonly="true"/>
                                                                    <a href="javascript:void(0)" class="quantity-button" onclick='javascript: document.getElementById("menuqty_<?php echo $cat->id . '_' . $menu->id ?>").value++;'><strong>+</strong></a>
                                                                <?php endif; ?>
                                                            </div>
                                                        </div>
                                                        <?php $menuToppings = get_record_list('item_toppings', array('menu' => $menu->id, 'status' => 1)) ?>
                                                        <?php
                                                        $menuToppingsDefault = get_record_list('item_toppings', array('menu' => $menu->id, 'status' => 1, 'is_default' => 'yes'));
                                                        $menuToppingsDefaultString = '';
                                                        if (!empty($menuToppingsDefault)) {
                                                            foreach ($menuToppingsDefault as $defaultTopping) {
                                                                $menuToppingsDefaultString .= ',' . $defaultTopping->title;
                                                            }
                                                        }
                                                        ?>

                                                        <?php if (!empty($menuToppings)): ?>
                                                            <?php if ($this->config->item('gk_order_online') == 'yes'): ?>
                                                                <div class="no-padding col-lg-2 col-md-2 col-sm-2 col-xs-3 add-to-cart  show-oneline-btn"><a href="javascript:void(0)" onclick="showExtra('<?php echo 'itemForm_' . $cat->id . '_' . $menu->id ?>')"><img class="add-to-cart-btn" src="<?php echo ASSETS_PUBLIC_PATH . 'img/cart/add-to-cart-purple-deep.png' ?>" title="Add To Cart" alt="Add"></a></div>
                                                            <?php endif; ?>
                                                        <?php else: ?>
                                                            <?php if ($this->config->item('gk_order_online') == 'yes'): ?>
                                                                <div class="no-padding col-lg-2 col-md-2 col-sm-2 col-xs-3 add-to-cart click-to-add show-oneline-btn"><a href="javascript:void(0)" onclick="submitTocart('itemForm_<?php echo $cat->id . '_' . $menu->id ?>', 'no', '')" ><img class="add-to-cart-btn" src="<?php echo ASSETS_PUBLIC_PATH . 'img/cart/add-to-cart-purple-deep.png' ?>" title="Add To Cart" alt="Add"></a></div>
                                                            <?php endif; ?>
                                                        <?php endif; ?>
                                                        <div class="no-padding col-lg-12 col-md-12 col-sm-12 col-xs-12 desc"><?php echo html_escape($menu->content) ?></div>
                                                        <input type="hidden" name='category' value='<?php echo $cat->id ?>'>
                                                        <input type="hidden" name='category_title' value='<?php echo ucwords(strtolower($cat->title)) ?>'>
                                                        <input type='hidden' name='print_option' value='<?php echo $cat->print_option ?>'>
                                                        <input type='hidden' name='type' value='<?php echo $cat->type ?>'>
                                                        <input type="hidden" name='is_special' value='<?php echo $cat->is_special ?>'>
                                                        <input type="hidden" name='menu' value='<?php echo $menu->id ?>'>
                                                        <input type="hidden" name='menu_title' value='<?php echo ucwords(strtolower($menu->title)) ?>'>
                                                        <input type="hidden" name='bogo' value='<?php echo $menu->bogo ?>'>
                                                        <input type="hidden" name='bogo_discount_on' value='menu'>
                                                        <input type="hidden" name='selection' value=''>
                                                        <input type="hidden" name='deal' value=''>
                                                        <input type="hidden" name='selection_title' value=''>
                                                        <input type="hidden" name='set_items' value='' class="empty-string">
                                                        <input type="hidden" value='<?php echo to_currency_no_money($menu->out_price > 0 ? $menu->out_price : $menu->base_price) ?>' class="orginal-price">
                                                        <input type="hidden" name='price' value='<?php echo to_currency_no_money($menu->out_price > 0 ? $menu->out_price : $menu->base_price) ?>' id="hiddenPriceFor_<?php echo $cat->id . '_' . $menu->id ?>" class="hidden-price">
                                                        <input type="hidden" name="toppings" id="toppingsString_<?php echo $cat->id . '_' . $menu->id ?>" value="<?php echo $menuToppingsDefaultString ?>" class="empty-string">
                                                        <input type="hidden" id='menuToppingsCounter_<?php echo $cat->id . '_' . $menu->id ?>' value="0" class="empty-counter">
                                                        <input  type="hidden" id="menuToppingsPriceTotal_<?php echo $cat->id . '_' . $menu->id ?>" value="0" class="empty-counter"/> 

                                                        <?php if (!empty($menuToppings)): ?>   
                                                            <?php $firstHalfMeusToppings = $menuToppings ?>
                                                            <div class="clearfix"></div>
                                                            <div class="extra hide-box" style="display: none; ">
                                                                <div class="extra-content">
                                                                    <div class="well">
                                                                        <h3 class="text-center text-uppercase">Add Extra</h3>
                                                                        <?php if ($menu->max_toppings > 0 || $menu->free_toppings > 0) { ?>
                                                                            <?php $toppingsHead = $menu->max_toppings > 0 ? 'Any ' . $menu->max_toppings . ' can be selected. ' : '' ?>
                                                                            <?php $toppingsHead .= $menu->free_toppings > 0 ? $menu->free_toppings . ' is free' : '' ?>
                                                                            <p class="text-center">[<?php echo $toppingsHead ?>]</p>
                                                                        <?php } ?>
                                                                        <?php
                                                                        $organizedToppings = array();
                                                                        foreach ($firstHalfMeusToppings as $key => $item) {
                                                                            $organizedToppings[$item->top_cat][] = $item;
                                                                        }
                                                                        ?>
                                                                        <div class="list-group" >    
                                                                            <?php foreach ($organizedToppings as $ToppingCategoryId => $toppingsCategory): ?>
                                                                                <?php $toppingCategoryInfo = get_topping_category_name($ToppingCategoryId) ?>
                                                                                <div class="list-group-item text-left">
                                                                                    <div class="text-left checkbox" style="padding-left: 30px;">
                                                                                        <label style="width: 100%" data-toggle="collapse" data-target="#toppingCategory_<?php echo $ToppingCategoryId . '_' . $cat->id . '_' . $menu->id ?>" id="collapseToppingCategory_<?php echo $ToppingCategoryId . '_' . $menu->id ?>">
                                                                                            <input type="checkbox" style="color: #000000;"> <?php echo $toppingCategoryInfo->title ?>&nbsp;[Maximum <?php echo $toppingCategoryInfo->max_select ?>]
                                                                                            <input type="hidden" id="maximumCategoryTopping_<?php echo $toppingCategoryInfo->id . '_' . $menu->id ?>" value="<?php echo $toppingCategoryInfo->max_select ?>">
                                                                                            <input type="hidden" id="maxmumCategoryToppingCounter_<?php echo $toppingCategoryInfo->id . '_' . $menu->id ?>" value="0" class="empty-counter">
                                                                                        </label>
                                                                                    </div>
                                                                                    <div class="collapse" id="toppingCategory_<?php echo $ToppingCategoryId . '_' . $cat->id . '_' . $menu->id ?>">
                                                                                        <?php foreach ($toppingsCategory as $menuTopping): ?>
                                                                                            <div class="form-check">
                                                                                                <label class="form-check-label btn-u btn-brd btn-u-orange" style="width:100%">
                                                                                                    <input class="form-check-input" id='topping_<?php echo $cat->id . '_' . $menu->id . '_' . $menuTopping->id ?>' type="checkbox" <?php $menuTopping->is_default == 'yes' ? print"checked='checked' disabled='true'" : '' ?>  value="<?php echo ucwords(strtolower($menuTopping->title)) ?>" onclick="calculateToppingsInfo('<?php echo $cat->id ?>', '<?php echo $menu->id ?>', '', '<?php echo $menuTopping->id ?>', 'itemForm_<?php echo $cat->id . '_' . $menu->id ?>', '<?php $menu->max_toppings > 0 ? print $menu->max_toppings : print 0 ?>', '<?php $menu->free_toppings > 0 ? print $menu->free_toppings : print 0 ?>', '<?php echo $menu->out_price > 0 ? $menu->out_price : $menu->base_price ?>', '<?php echo $menuTopping->top_cat ?>')"/><span class="title"><?php echo ucwords(strtolower($menuTopping->title)) ?></span><span class="price">[&nbsp;+&nbsp;<?php echo to_currency($menuTopping->price) ?>&nbsp;]</span>
                                                                                                </label>
                                                                                                <input type="hidden" id='toppingPrice_<?php echo $cat->id . '_' . $menu->id . '_' . $menuTopping->id ?>' value="<?php echo $menuTopping->price ?>">
                                                                                            </div>
                                                                                        <?php endforeach; ?>
                                                                                    </div>
                                                                                </div>
                                                                            <?php endforeach; ?>
                                                                            <?php if ($this->config->item('gk_order_online') == 'yes'): ?>
                                                                                <div class="list-group-item">
                                                                                    <div class="text-center" style="padding-top:10px;"><a href="javascript:void(0)" class="btn-u btn-brd btn-brd-hover btn-u-purple show-oneline-btn add-to-cart click-to-add" onclick="submitTocart('itemForm_<?php echo $cat->id . '_' . $menu->id ?>', 'no', '')">Add To Cart</a></div>
                                                                                </div>
                                                                            <?php endif; ?>
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        <?php endif; ?>  
                                                    </form>
                                                </li>
                                            <?php endif ?>
                                        <?php endif; ?>
                                        <?php $menuIndex++; ?>
                                    <?php endforeach; ?>
                                </ul>
                            </div>
                        </div>
                        <?php $catIndex++ ?>
                    <?php endforeach; ?>
                <?php endif; ?>
            </div>
            <?php if ($this->config->item('gk_order_online') == 'yes'): ?>
                <div class="col-lg-3 col-md-3 col-sm-3 col-xs-12" id="cartHolder">
                    <?php $this->load->view('onlineorder/cart_filler') ?>
                </div>
            <?php endif; ?>
        </div>
    </div>
</div>

<script type="text/javascript">
    jQuery(document).ready(function () {
        loadCart('1');
    });
    function calculateDealToppingsInfo(cat, deal, topping, form, maxToppings, freeToppings, dealPrice, top_cat, menusel) {
        var title = '';
        var toppingPrice = 0;
        var toppingsString = '';
        var toppingsCounterLoc = '#' + form + ' #toppingsCounter_' + cat + '_' + deal + '_' + menusel;
        var toppingsCounter = Number($(toppingsCounterLoc).val());
        var checkbox = '#' + form + ' #dealTopping_' + cat + '_' + deal + '_' + topping + '_' + menusel;
        var toppingsStringLoc = '#' + form + ' #dealToppingsString_' + cat + '_' + deal + '_' + menusel;
        var toppingPriceLoc = '#' + form + ' #dealToppingPrice_' + cat + '_' + deal + '_' + topping + '_' + menusel;
        var visiblePriceLoc = '#' + form + ' #dealVisiblePriceFor_' + cat + '_' + deal + '_' + menusel;
        var hiddenPriceLoc = '#' + form + ' #dealHiddenPriceFor_' + cat + '_' + deal + '_' + menusel;
        var dealInvidualDealToppingsLoc = '#' + form + ' #displayIndividualDealToppings_' + cat + '_' + deal + '_' + menusel;
        var dealInvidualDealToppingsValue = $(dealInvidualDealToppingsLoc + ' .individual-deal-toppings-items-val').val();
        var maximumCategoryTopping = '#' + form + ' #maximumDealCategoryTopping_' + top_cat + '_' + deal + '_' + menusel;
        var maximumCategoryToppingVal = Number($(maximumCategoryTopping).val());
        var maxmumCategoryToppingCounter = '#' + form + ' #maxmumDealCategoryToppingCounter_' + top_cat + '_' + deal + '_' + menusel;
        var maxmumCategoryToppingCounterVal = Number($(maxmumCategoryToppingCounter).val());
        title = $(checkbox).val();
        toppingPrice = $(toppingPriceLoc).val();
        toppingsString = $(toppingsStringLoc).val();
        if ($(checkbox).is(':checked')) {
            if (Number(toppingsCounter) >= Number(maxToppings) && Number(maxToppings) > 0) {
                $(checkbox).attr('checked', false);
                alert('Please select any ' + maxToppings + ' toppings');
            } else {
                if (Number(maxmumCategoryToppingCounterVal) >= Number(maximumCategoryToppingVal)) {
                    $(checkbox).attr('checked', false);
                    if ($('#collapseDealToppingCategory_' + top_cat + '_' + deal + '_' + menusel).length > 0) {
                        $('#collapseDealToppingCategory_' + top_cat + '_' + deal + '_' + menusel).click();
                    }
                } else {
                    maxmumCategoryToppingCounterVal += 1;
                    $(maxmumCategoryToppingCounter).val(maxmumCategoryToppingCounterVal);
                    if (Number(maxmumCategoryToppingCounterVal) >= Number(maximumCategoryToppingVal)) {
                        if ($('#collapseDealToppingCategory_' + top_cat + '_' + deal + '_' + menusel).length > 0) {
                            $('#collapseDealToppingCategory_' + top_cat + '_' + deal + '_' + menusel).click();
                        }
                    }
                    toppingsCounter += 1;
                    var toppingsPriceTotal;
                    if (freeToppings < toppingsCounter) {
                        toppingsPriceTotal = $('#' + form + ' #DealToppingsPriceTotal_' + deal + '_' + menusel).val();
                        toppingsPriceTotal = parseFloat(toppingsPriceTotal) + parseFloat(toppingPrice);
                        $('#' + form + ' #DealToppingsPriceTotal_' + deal + '_' + menusel).val(toppingsPriceTotal);
                    } else {
                        toppingsPriceTotal = 0;
                        $('#' + form + ' ' + '#DealToppingsPriceTotal_' + deal + '_' + menusel).val(toppingsPriceTotal);
                    }
                    toppingsString += ',' + title;
                    dealInvidualDealToppingsValue += ',' + title;
                }
            }
        } else {
            maxmumCategoryToppingCounterVal -= 1;
            $(maxmumCategoryToppingCounter).val(maxmumCategoryToppingCounterVal);
            toppingsCounter -= 1;
            var toppingsPriceTotal;
            if (freeToppings < toppingsCounter) {
                toppingsPriceTotal = $('#' + form + ' #DealToppingsPriceTotal_' + deal + '_' + menusel).val();
                toppingsPriceTotal = parseFloat(toppingsPriceTotal) - parseFloat(toppingPrice);
                $('#' + form + ' #DealToppingsPriceTotal_' + deal + '_' + menusel).val(toppingsPriceTotal);
            } else {
                toppingsPriceTotal = 0;
                $('#' + form + ' #DealToppingsPriceTotal_' + deal + '_' + menusel).val(toppingsPriceTotal);
            }

            toppingsString = toppingsString.replace(',' + title, '');
            dealInvidualDealToppingsValue = dealInvidualDealToppingsValue.replace(',' + title, '');
        }
        $(dealInvidualDealToppingsLoc + ' .individual-deal-toppings-items-val').val(dealInvidualDealToppingsValue);
        if ($.trim(dealInvidualDealToppingsValue)) {
            $(dealInvidualDealToppingsLoc + ' .individual-deal-toppings-items').text(dealInvidualDealToppingsValue.substr(1));
        } else {
            $(dealInvidualDealToppingsLoc + ' .individual-deal-toppings-items').text('No Toppings Yet');
        }

        toppingsPriceTotal = Number($('#' + form + ' #DealToppingsPriceTotal_' + deal + '_' + menusel).val());
        var itemPrice;
        if (toppingsPriceTotal > 0) {
            itemPrice = parseFloat(dealPrice) + parseFloat(toppingsPriceTotal);
        } else {
            itemPrice = parseFloat(dealPrice);
        }
        $(toppingsCounterLoc).val(toppingsCounter);
        $(visiblePriceLoc).text(itemPrice.toFixed(2));
        $(hiddenPriceLoc).val(itemPrice.toFixed(2));
        $(toppingsStringLoc).val(toppingsString);
        toppingsCounter = Number($(toppingsCounterLoc).val());
        if (toppingsCounter === Number(maxToppings)) {
            ShowHideDealSet('dealToppings_' + deal + '_' + menusel, 'deal-toppings')
        }
        showDealString(cat, deal);
    }


    function preorderCheck() {
        var preorder = 'no';
        if ($('#PreorderChecked').is(':checked')) {
            preorder = 'yes'
        } else {
            preorder = 'no';
        }
        $.ajax({
            url: '<?php echo site_url("onlineorder/preordercheck") ?>',
            data: {
                preorder: preorder,
            },
            type: "POST",
            dataType: "json",
            success: function (output) {
                if (output.preorder == 'yes' && $('.click-to-add.disable-add-to-cart').length > 0) {
                    $('.click-to-add').removeClass('disable-add-to-cart');
                    $('#processPreorder').length > 0 ? $('#processPreorder').removeAttr('style').css({'display': 'none'}) : '';
                    $('#processingPreorder').length > 0 ? $('#processingPreorder').removeAttr('style').css({'display': 'block'}) : '';
                } else {
                    $('#processingPreorder').length > 0 ? $('#processingPreorder').removeAttr('style').css({'display': 'none'}) : '';
                    $('#processPreorder').length > 0 ? $('#processPreorder').removeAttr('style').css({'display': 'block'}) : '';
                    $('.click-to-add').length > 0 ? $('.click-to-add').addClass('disable-add-to-cart') : '';
                }
            }
        });
    }
    function submit(itemForm) {
        var myform = document.getElementById(itemForm);
        var formdata = new FormData(myform);
        var quantity = $('#' + itemForm).find('input[name="quantity"]').val();
        if (Number(quantity) > 0) {
            $.ajax({
                url: '<?php echo site_url('onlineorder/addtocart') ?>',
                data: formdata,
                cache: false,
                processData: false,
                contentType: false,
                type: 'POST',
                dataType: 'json',
                success: function (output) {
                    if (typeof output.line !== 'undefined') {
                        loadCart(output.line);
                        $('input[type=checkbox]').each(function ()
                        {
                            if (!$(this).is(':disabled')) {
                                this.checked = false;
                            }
                        });
                        var orginalPrice = $('#' + itemForm + ' .orginal-price').val();
                        $('#' + itemForm + ' .hidden-price').val(orginalPrice);
                        $('#' + itemForm + ' .visible-price').text(orginalPrice);
                        $('#' + itemForm + ' .empty-string').val('');
                        $('#' + itemForm + ' .empty-counter').val(0);
                        $('#' + itemForm + ' .empty-counter').val(0);
                        $('#' + itemForm + ' .no-items-yet-text').text('No items yet');
                        $('#' + itemForm + ' .no-toppings-yet-text').text('No toppings yet');
                        $('#' + itemForm + ' .deal-items-display').text('');
                        $('#' + itemForm + ' .deal-toppings-display').text('');
                        $('#' + itemForm + ' .hide-box').hide();
                    } else {
                        loadCart('1');
                    }
                }
            });
        } else {
            alert('Please provide positive integer number in quantity field');
        }

    }
    function loadCart(line) {
        $.ajax({
            url: '<?php echo site_url("onlineorder/loadcart") ?>',
            type: "POST",
            success: function (output) {
                $('#cartHolder').html(output);
                if (typeof line !== 'undefined') {
                    $('.line').removeClass('current');
                    $('#line-' + line).addClass('cuurent');
                }
                jQuery('.cart .cart-scroll-pane').jScrollPane({autoReinitialise: true}).data('jsp').scrollToBottom();
            }
        });
    }
    function increment_item(line) {
        $.ajax({
            url: '<?php echo site_url("onlineorder/increment_item") ?>',
            data: {
                line: line,
            },
            type: "POST",
            dataType: "json",
            beforeSend: function () {
                $('.please-wait').removeAttr('style').css({'display': 'inline'});
            },
            success: function (output) {
                $('.please-wait').removeAttr('style').css({'display': 'none'});
                if (output.success) {
                    loadCart(output.line);
                }
            }
        });
    }
    function reduce_item(line) {
        $.ajax({
            url: '<?php echo site_url("onlineorder/reduce_item") ?>',
            data: {
                line: line,
            },
            type: "POST",
            dataType: "json",
            beforeSend: function () {
                $('.please-wait').removeAttr('style').css({'display': 'inline'});
            },
            success: function (output) {
                $('.please-wait').removeAttr('style').css({'display': 'none'});
                if (output.success) {
                    loadCart(output.line);
                }
            }
        });
    }
    function remove_item(line) {
        $.ajax({
            url: '<?php echo site_url("onlineorder/remove_item") ?>',
            data: {
                line: line,
            },
            type: "POST",
            dataType: "json",
            beforeSend: function () {
                $('.please-wait').removeAttr('style').css({'display': 'inline'});
            },
            success: function (output) {
                $('.please-wait').removeAttr('style').css({'display': 'none'});
                if (output.success) {
                    loadCart(output.line);
                }
            }
        });
    }
    function getOrderType(orderType) {
        if (orderType == 'online_delivery') {
            openDeliveryPostcodeForm('menu');
        } else {
            $.ajax({
                url: '<?php echo site_url("onlineorder/fixordertype") ?>',
                data: {
                    order_type: orderType
                },
                type: "POST",
                dataType: "json",
                success: function (output) {
                    if (output.success) {
                        loadCart('1');
                    }
                }
            });
        }
    }

    function openMyItems(id) {
        $('#'+id).toggle();
    }

</script>