<?php //p($item); 
$merchantInfo = $this->session->userdata('merchantInfo');


//print_r();
?><style>.cust-prise b {color: red; margin-left: 5px;}.row.cust-btn {justify-content: space-evenly;}</style>

<form method="post" action="menu/addtocart" onsubmit="event.preventDefault();menu.addToCart(this)">
    <input type="hidden" value="<?= $merchantInfo['merchant_id']; ?>" name="merchant_id" id="merchant_id">
    <input type="hidden" value="<?= $item['cat_id']; ?>" name="category_id" id="category_id">
    <input type="hidden" value="<?= $item['data']['item_id'];  ?>" name="item_id" id="item_id">
	  <input type="hidden" value="<?= $item['promo_id'];  ?>" name="promo_id" id="promo_id">
    
	<input type="hidden" value="<?= (isset($item['cart_data']['row'])) ? $item['cart_data']['row'] : '';  ?>" name="row" id="row">
    <div class="modal-dialog">
        <!-- Modal content-->
        <div class="modal-content">
            <div class="modal-header">
                <div class="row">
                    <div class="closeFood_Item"><i class="fa fa-times" aria-hidden="true" data-dismiss="modal"></i></div>
                    <div class="col-md-3 " style="display:none;">
                        <img src="<?= $item['data']['photo']; ?>" alt="Dried Scallops with Scrambled Egg Whites &amp; Fresh Milk" title="Dried Scallops with Scrambled Egg Whites &amp; Fresh Milk" class="logo-small">
                    </div>
                    <!--col-->
                    <div class="col-md-9 centertitle">
                        <p class="bold title"><?= $item['data']['item_name']; ?></p>
                        <p></p>
                    </div>
                    <!--col-->
                </div>
            </div>
            <div class="modal-body">
                <div class="section-label">
                    <a class="section-label-a center">
                        <span class="pheads">Price</span>
                        <b></b>
                    </a>
                    <div class="row">
                        <?php
                        $sd = 1;
                        foreach ($item['data']['prices'] as $key => $p) {
                            $checked = (!$key) ? 'checked' : '';
                            if (isset($item['cart_data']['price']) && $item['cart_data']['price'] == $p['price']) {
                                $checked = 'checked';
                            }
                            $size_id = isset($p['size_id']) ? $p['size_id'] : '';
                        ?>
                            <div class="col-md-5 cust-prise">

                                <?php if ($sd == 1) { ?>
                                    <input value="<?= 0 . "|" . $p['size'] . "|" . $size_id ?>" <?= $checked ?> required class="price_cls item_price" type="radio" name="price" id="price"> <s>

                                        <?= $p['size'] . $_SESSION['settings']['currency_symbol'] . $p['price']; ?> </s> <b>Free</b>
                                <?php } else { ?>

                                    <input value="<?= $p['price'] . "|" . $p['size'] . "|" . $size_id ?>" <?= $checked ?> required class="price_cls item_price" type="radio" name="price" id="price">
                                    <?= $p['size'] . $_SESSION['settings']['currency_symbol'] . $p['price']; ?>
                                <?php }

                                $sd++;
                                ?>









                            </div>
                        <?php } ?>
                        <!--col-->
                    </div>
                    <!--row-->
                </div>



                <div class="section-label cust-qunt">
                    <a class="section-label-a center">
                        <span class="pheads">Quantity</span>
                        <b></b>
                    </a>
                    <div class="row cust-btn">

                        <div class="col-md-2 col-xs-2 border into-row">
                            <input class="uk-form-width-mini numeric_only qty" value="<?= (!empty($item['cart_data']['qty'])) ? $item['cart_data']['qty'] : 1; ?>" maxlength="5" readonly="readonly" type="text" name="qty" id="qty">
                        </div>

                        <div class="col-md-6 col-xs-6 border into-row">
                            <a href="javascript:;" class="special-instruction orange-button inline">Special Instructions</a>

                            <!--inventory-->
                            <span class="remaining_stock"></span>
                        </div>
                    </div>
                    <!--row-->
                </div>

                <div class="row">
                    <!--<a href="javascript:;" class="special-instruction orange-button inline">Special Instructions</a>-->
                </div>
                <div class="notes-wrap">
                  <?php $notes = [];
                    if (isset($item) && !empty($item)) {
                         $notes = $item['cart_data']['notes'] ?? [];
                    }?>
                    <!--<textarea class="uk-width-1-1" placeholder="Special Instructions" name="notes" id="notes"><--?= @$notes; ?></textarea>-->
                    <textarea class="uk-width-1-1" placeholder="Special Instructions" name="notes" id="notes"></textarea>
                </div>
                <div class="sub-item-rows">
                </div>
                <?php if ($item['data']['cooking_ref']) { ?>
                    <div class="section-label">

                        <div class="section-label-a center">
                            <span class="pheads">
                                Cooking Preference</span>
                            <b></b>
                            <!--<a href="javascript:;"><i class="ion-ios-plus-outline"></i></a>-->
                        </div>

                        <div class="row">
                            <?php foreach ($item['data']['cooking_ref'] as $key1 => $c) {
                                $checked = (!$key1) ? 'checked' : '';
                                if (isset($item['cart_data']['cooking_ref']) && $item['cart_data']['cooking_ref'] == $c) {
                                    $checked = 'checked';
                                }
                            ?>
                                <div class="col-md-5 ">
                                    <input value="<?= $c; ?>" <?= $checked ?> type="radio" name="cooking_ref" id="cooking_ref" required>
                                    <?= $c; ?>
                                </div>
                                <!--col-->
                            <?php } ?>
                        </div>
                        <!--row-->
                    </div>
                    <?php }
                if ($item['data']['addon_item']) {
                    foreach ($item['data']['addon_item'] as $addon) {
                    ?>

                        <div class="sub-item-rows">

                            <input class="require_addon require_addon_<?= $addon['subcat_id'] ?> " data-id="<?= $addon['subcat_id'] ?> " type="hidden" value="" name="require_addon_<?= $addon['subcat_id'] ?> " id="require_addon_<?= $addon['subcat_id'] ?> ">
                            <div class="section-label">
                                <a class="section-label-a center">
                                    <span class="pheads">
                                        <?= $addon['subcat_name'] ?></span>
                                    <b></b>
                                </a>

                            </div>
                            <?php foreach ($addon['sub_item'] as $key => $s) { ?>
                                <div class="row top10">

                                    <div class="col-md-5 col-xs-5 border into-row">
                                        <input value="<?= $s['sub_item_id'] ?>|<?= $s['price'] ?>|<?= $s['sub_item_name'] ?>|" <?= (isset($item['cart_data']['sub_item'][$addon['subcat_id']]) && in_array($s['sub_item_id'] . '|' . $s['price'] . '|' . $s['sub_item_name'] . '|', $item['cart_data']['sub_item'][$addon['subcat_id']])) ? 'checked' : '' ?> class="sub_item sub_item_name_<?= $addon['subcat_id'] ?>" data-type="radio" type="radio" name="sub_item[<?= $addon['subcat_id'] ?>][]" id="sub_item_<?= $addon['subcat_id'] ?>" <?= (isset($addon['require_addons']) && $addon['require_addons'] == 2) ? 'required' : ''; ?>><?= $s['sub_item_name'] ?><p></p>
                                    </div>
                                    <!--col-->

                                    <div class="col-md-4 col-xs-4 border into-row ">
                                    </div>
                                    <!--col-->

                                    <div class="col-md-3 col-xs-3 border text-right into-row">
                                        <span class="hide-food-price">
                                            <?= $_SESSION['settings']['currency_symbol'] . $s['price'] ?> </span>
                                    </div>
                                    <!--col-->

                                </div>
                                <!--row-->
                            <?php } ?>
                            <!--endif sub_item-->


                            <!--endforeach val-->
                        </div>
                <?php }
                } ?>

            </div>

            <div class="section-label top25">

            </div>

            <div class="modal-footer">

                <div class="row food-item-actions">
                    <!--<div class="col-md-4 col-xs-4 border into-row " ></div>-->
                    <div class="col-md-6 col-xs-6 border into-row">
                        <input type="submit" value="<?= (isset($item['cart_data']) && $item['cart_data']) ? 'Update' : 'add to cart' ?>" class="add_to_cart orange-button upper-text">
                    </div>
                    <div class="col-md-6 col-xs-6 border into-row">
                        <button type="button" class="center upper-text green-button inline" data-dismiss="modal">Close</button>
                    </div>
                </div>


            </div>


        </div>

    </div>
</form>