<div style="display: none;">
    <div id="menuToppingPopup" class="popup-attributes">
        <div class="popup-header toolbar-header">
            <div class="popup-title">
                <?php
                $AllStatus = array('2' => 'Inactive', '3' => 'Active');
                $heading = '';
                if ($set !== '0') {
                    $heading = get_title('menuset', array('id' => $set)) . ' set ';
                }
                if ($selection !== '0') {
                    $heading .= get_title('menuselection', array('id' => $selection)) . '-' . get_title('menu', array('id' => $menu));
                } else {
                    $heading .= get_title('menu', array('id' => $menu));
                }
                echo ucwords($heading . ' ' . $this->lang->line('toppings'));
                ?>
            </div>
            <div class="popup-close-btn" onclick="zamanEposPopupcloser()"><span class="icon icon-cancel"></span></div>
        </div>
        <div class="popup-content" style="padding: 15px;">
            <div class="clearfix">
                <div class="page-loader popup-page-loader" style="display: none;"></div>
                <div class="caption"><?php echo $this->lang->line('toppings_head') ?></div>
                <table class="collection-bg" id="toppingsHeadList">
                    <tr>
                        <th class="text-left"><?php echo $this->lang->line('title') ?></th>
                        <th class="text-center"><?php echo $this->lang->line('min') ?></th>
                        <th class="text-center"><?php echo $this->lang->line('max') ?></th>
                        <th class="text-center"><?php echo $this->lang->line('free') ?></th>
                        <th class="text-center"><?php echo $this->lang->line('rel') ?></th>
                        <th class="text-center"><?php echo $this->lang->line('with') ?></th>
                        <th class="text-center"><?php echo $this->lang->line('status') ?></th>
                        <th class="text-center"><?php echo $this->lang->line('view') ?></th>
                        <?php if ($this->session->userdata('group') <= 4): ?>
                            <th class="text-center"><?php echo $this->lang->line('delete') ?></th>
                        <?php endif ?>
                    </tr>
                    <?php if (!empty($toppingHeads)): ?>
                        <?php foreach ($toppingHeads as $th): ?>
                            <tr>
                                <td class="text-left">
                                    <?php if ($this->session->userdata('group') <= 4): ?>
                                        <a href="javascript:void(0)" onclick="updatetoppingheadcell('<?php echo"topping_head_title_" . $th->id ?>')" data-type="text" id="topping_head_title_<?php echo $th->id ?>" data-name="title" data-pk="<?php echo $th->id ?>" data-url="<?php echo site_url('menu/updatetoppingheadcell') ?>" data-title="Update title">
                                            <?php echo $th->title ?>
                                        </a>
                                    <?php else: ?>
                                        <?php echo $th->title ?>
                                    <?php endif; ?>
                                </td>
                                <td class="text-center">
                                    <?php if ($this->session->userdata('group') <= 4): ?>
                                        <a href="javascript:void(0)" onclick="updatetoppingheadcell('<?php echo"topping_head_min_" . $th->id ?>')" data-type="text" id="topping_head_min_<?php echo $th->id ?>" data-name="min" data-pk="<?php echo $th->id ?>" data-url="<?php echo site_url('menu/updatetoppingheadcell') ?>" data-title="Update Min">
                                            <?php echo $th->min ?>
                                        </a>
                                    <?php else: ?>
                                        <?php echo $th->min ?>
                                    <?php endif; ?>
                                </td>
                                <td class="text-center">
                                    <?php if ($this->session->userdata('group') <= 4): ?>
                                        <a href="javascript:void(0)" onclick="updatetoppingheadcell('<?php echo"topping_head_max_" . $th->id ?>')" data-type="text" id="topping_head_max_<?php echo $th->id ?>" data-name="max" data-pk="<?php echo $th->id ?>" data-url="<?php echo site_url('menu/updatetoppingheadcell') ?>" data-title="Update Max">
                                            <?php echo $th->max ?>
                                        </a>
                                    <?php else: ?>
                                        <?php echo $th->max ?>
                                    <?php endif ?>
                                </td>
                                <td class="text-center">
                                    <?php if ($this->session->userdata('group') <= 4): ?>
                                        <a href="javascript:void(0)" onclick="updatetoppingheadcell('<?php echo"topping_head_free_" . $th->id ?>')" data-type="text" id="topping_head_free_<?php echo $th->id ?>" data-name="free" data-pk="<?php echo $th->id ?>" data-url="<?php echo site_url('menu/updatetoppingheadcell') ?>" data-title="Update Free">
                                            <?php echo $th->free ?>
                                        </a>
                                    <?php else: ?>
                                        <?php echo $th->free ?>
                                    <?php endif ?>
                                </td>
                                <td class="text-center">
                                    <?php if ($this->session->userdata('group') <= 4): ?>
                                        <a href="javascript:void(0)" onclick="updatetoppingheadcell('<?php echo"topping_head_rel_" . $th->id ?>')" data-type="select" id="topping_head_rel_<?php echo $th->id ?>" data-name="rel" data-value="<?php echo $th->rel ?>" data-pk="<?php echo $th->id ?>" data-url="<?php echo site_url('menu/updatetoppingheadcell') ?>" data-title="Update Relation">
                                            <?php echo $th->rel ?>
                                        </a>
                                    <?php else: ?>
                                        <?php echo $th->rel ?>
                                    <?php endif ?>
                                </td>
                                <td class="text-center">
                                    <?php
                                    if (trim($th->rel_with) != null) {
                                        $relArray = explode('-', $th->rel_with);
                                        foreach ($relArray as $relCat) {
                                            echo get_title('menuattrcategory', array('id' => $relCat)) . ' ';
                                        }
                                    } else {
                                        echo "---";
                                    }
                                    ?>
                                </td>
                                <td class="text-center">
                                    <?php if ($this->session->userdata('group') <= 4): ?>
                                        <a href="javascript:void(0)" onclick="updatetoppingheadcell('<?php echo"topping_head_status_" . $th->id ?>')" data-type="select" id="topping_head_status_<?php echo $th->id ?>" data-name="status" data-value="<?php echo $th->status ?>" data-pk="<?php echo $th->id ?>" data-url="<?php echo site_url('menu/updatetoppingheadcell') ?>" data-title="Update Status">
                                            <?php echo $AllStatus[$th->status] ?>
                                        </a>
                                    <?php else: ?>
                                        <?php echo $AllStatus[$th->status] ?>
                                    <?php endif ?>
                                </td>
                                <td class="text-center"><span class="icon icon-eye"  onclick="zamanEposBlockHideAndShow('<?php echo 'headToppings-' . $th->id ?>')"></span></td>
                                <?php if ($this->session->userdata('group') <= 4): ?>
                                    <td class="text-center"><span class="icon icon-trash" id="toppingHeadId-<?php echo $th->id ?>" onclick="deleteToppingsCategory('<?php echo $th->id ?>')"></span></td>
                                <?php endif ?>
                            </tr>
                            <?php $headToppings = get_record_list('menuattr', array('menuttrcategory' => $th->id)); ?>
                            <tr id="headToppings-<?php echo $th->id ?>" style="display: none;">
                                <td colspan="9">
                                    <table class="table-bg" id="toppingsTable-<?php echo $th->id ?>">
                                        <tr class="collection-bg">
                                            <th class="text-left"><?php echo $this->lang->line('title') ?></th>
                                            <th class="text-center"><?php echo $this->lang->line('price') ?></th>
                                            <th class="text-center"><?php echo $this->lang->line('qty') ?></th>
                                            <th class="text-center"><?php echo $this->lang->line('default') ?></th>
                                            <th class="text-center"><?php echo $this->lang->line('status') ?></th>
                                            <?php if ($this->session->userdata('group') <= 4): ?>
                                                <th class="text-center"><?php echo $this->lang->line('delete') ?></th>
                                            <?php endif ?>
                                        </tr>
                                        <?php if (!empty($headToppings)): ?>
                                            <?php foreach ($headToppings as $ht): ?>
                                                <tr>
                                                    <td class="text-lef">
                                                        <?php if ($this->session->userdata('group') <= 4): ?>
                                                            <a href="javascript:void(0)" onclick="updatetoppingcell('<?php echo"topping_title_" . $ht->id ?>')" data-type="text" id="topping_title_<?php echo $ht->id ?>" data-name="title" data-pk="<?php echo $ht->id ?>" data-url="<?php echo site_url('menu/updatetoppingcell') ?>" data-title="Update title">
                                                                <?php echo $ht->title ?>
                                                            </a>
                                                        <?php else: ?>
                                                            <?php echo $ht->title ?>
                                                        <?php endif ?>
                                                    </td>
                                                    <td class="text-center">
                                                        <?php if ($this->session->userdata('group') <= 4): ?>
                                                            <a href="javascript:void(0)" onclick="updatetoppingcell('<?php echo"topping_price_" . $ht->id ?>')" data-type="text" id="topping_price_<?php echo $ht->id ?>" data-name="price" data-pk="<?php echo $ht->id ?>" data-url="<?php echo site_url('menu/updatetoppingcell') ?>" data-title="Update Price">
                                                                <?php echo $ht->price ?>
                                                            </a>
                                                        <?php else: ?>
                                                            <?php echo $ht->price ?>
                                                        <?php endif ?>
                                                    </td>
                                                    <td class="text-center">
                                                        <?php if ($this->session->userdata('group') <= 4): ?>
                                                            <a href="javascript:void(0)" onclick="updatetoppingcell('<?php echo"topping_qty_" . $ht->id ?>')" data-type="text" id="topping_qty_<?php echo $ht->id ?>" data-name="qty" data-pk="<?php echo $ht->id ?>" data-url="<?php echo site_url('menu/updatetoppingcell') ?>" data-title="Update Quantity">
                                                                <?php echo $ht->qty ?>
                                                            </a>
                                                        <?php else: ?>
                                                            <?php echo $ht->qty ?>
                                                        <?php endif ?>
                                                    </td>
                                                    <td class="text-center">
                                                        <?php if ($this->session->userdata('group') <= 4): ?>
                                                            <a href="javascript:void(0)" onclick="updatetoppingcell('<?php echo"topping_is_default_" . $ht->id ?>')" data-type="select" id="topping_is_default_<?php echo $ht->id ?>" data-name="is_default" data-pk="<?php echo $ht->id ?>" data-value="<?php echo $ht->is_default ?>" data-url="<?php echo site_url('menu/updatetoppingcell') ?>" data-title="Update Default value">
                                                                <?php echo $ht->is_default ?>
                                                            </a>
                                                        <?php else: ?>
                                                            <?php echo $ht->is_default ?>
                                                        <?php endif ?>
                                                    </td>
                                                    <td class="text-center">
                                                        <?php if ($this->session->userdata('group') <= 4): ?>
                                                            <a href="javascript:void(0)" onclick="updatetoppingcell('<?php echo"topping_status_" . $ht->id ?>')" data-type="select" id="topping_status_<?php echo $ht->id ?>" data-name="status" data-pk="<?php echo $ht->id ?>" data-value="<?php echo $ht->status ?>" data-url="<?php echo site_url('menu/updatetoppingcell') ?>" data-title="Update Status">
                                                                <?php echo $AllStatus[$ht->status] ?>
                                                            </a>
                                                        <?php else: ?>
                                                            <?php echo $ht->status ?>
                                                        <?php endif ?>
                                                    </td>
                                                    <?php if ($this->session->userdata('group') <= 4): ?>
                                                        <td class="text-center"><span class="icon icon-trash" id="toppingId-<?php echo $ht->id ?>" onclick="deleteToppings('<?php echo $ht->id ?>')"></span></td>
                                                    <?php endif ?>
                                                </tr>
                                            <?php endforeach; ?>
                                        <?php endif; ?>
                                    </table>
                                </td>
                            </tr>
                        <?php endforeach; ?>
                    <?php endif; ?>
                </table>
            </div>
            <?php if ($this->session->userdata('group') <= 4): ?>
                <div class="popup-block">
                    <div class="caption"><?php echo $this->lang->line('add_new_topping_head') ?></div>
                    <?php echo form_open('menu/save_toppinghead', array('id' => 'toppingHeadForm')); ?>
                    <div class="pane-one-fifth block">
                        <div class="form-group">
                            <label><?php echo $this->lang->line('title') ?></label>
                            <input type="text" name="title" class="form-control">
                        </div>
                    </div>
                    <div class="pane-one-fifth block">
                        <div class="form-group">
                            <label><?php echo $this->lang->line('min') ?></label>
                            <input type="text" name="min" class="form-control">
                        </div>
                    </div>
                    <div class="pane-one-fifth block">
                        <div class="form-group">
                            <label><?php echo $this->lang->line('max') ?></label>
                            <input type="text" name="max" class="form-control">
                        </div>
                    </div>
                    <div class="pane-one-fifth block">
                        <div class="form-group">
                            <label><?php echo $this->lang->line('free') ?></label>
                            <input type="text" name="free" class="form-control">
                        </div>
                    </div>
                    <div class="pane-one-fifth block">
                        <div class="form-group" style="width: 50%; float: left;">
                            <label><?php echo $this->lang->line('relation') ?></label>
                            <select class="form-control" name="rel" onchange="setRelationWith(this.value)">
                                <option value=""><?php echo $this->lang->line('select') ?></option>
                                <option value="mono"><?php echo $this->lang->line('mono') ?></option>
                                <option value="poly"><?php echo $this->lang->line('poly') ?></option>
                            </select>
                        </div>
                        <div class="form-group" id="relationWithBlock" style="display: none;width: 50%;float: right;">
                            <label><?php echo $this->lang->line('with') ?></label>
                            <select multiple size="2" class="form-control" name="rel_with[]" id="relationWithElements">
                                <?php if (!empty($toppingHeads)): ?>
                                    <?php foreach ($toppingHeads as $ts): ?>
                                        <?php if (trim($ts->rel) === trim('mono')): ?>
                                            <option value="<?php echo $ts->id ?>"><?php echo ucwords($ts->title) ?></option>
                                        <?php endif; ?>
                                    <?php endforeach; ?>
                                <?php endif; ?>
                            </select>
                        </div>
                    </div>

                    <div class="tab-group config-submit clearfix">
                        <input type="hidden" id="toppingHeadCategory" name="category" value="<?php echo $category ?>">
                        <input type="hidden" id="toppingHeadMenu" name="menu" value="<?php echo $menu ?>">
                        <input type="hidden" id="toppingHeadSelection" name="selection" value="<?php echo $selection ?>">
                        <input type="hidden" id="toppingHeadSet" name="set" value="<?php echo $set ?>">
                        <button type="submit" onclick="saveToppingHead('toppingHeadForm')"><span class="icon icon-folder"></span>&nbsp;<?php echo $this->lang->line('save') ?></button>
                    </div>
                    <?php echo form_close() ?>
                </div>
                <div style="height: 30px; margin: 10px 0px;" class="text-right">
                    <button class="btn btn btn-large btn-warning icon icon-arrows-ccw" onclick="attrPopup('menuToppingPopup', '75%', '<?php echo $category ?>', '<?php echo $menu ?>', '<?php echo $selection ?>', '<?php echo $set ?>', '<?php echo site_url('menu/topping') ?>')">&nbsp;<?php echo $this->lang->line('refresh') ?></button>
                </div>
            <?php endif; ?>

            <?php if (!empty($nattr) && $this->session->userdata('group') <= 4): ?>
                <div class="popup-block clearfix">
                    <div class="pane">
                        <?php echo form_open('menu/savemenutopping', array('id' => 'menuToppingForm')); ?>
                        <div class="caption"><?php echo $this->lang->line('hook_toppings') ?></div>
                        <div class="form-group">
                            <select class="form-control" name="menuttrcategory" id="toppingsCategory">
                                <option><?php echo $this->lang->line('select') ?></option>
                                <?php if (!empty($toppingHeads)): ?>
                                    <?php foreach ($toppingHeads as $ts): ?>
                                        <option value="<?php echo $ts->id ?>"><?php echo ucwords($ts->title) ?></option>
                                    <?php endforeach; ?>
                                <?php endif; ?>
                            </select>
                        </div>
                        <div class="tab-group config-submit clearfix">
                            <button type="submit" onclick="saveToppings('menuToppingForm')"><span class="icon icon-folder"></span>&nbsp;<?php echo $this->lang->line('save') ?></button>
                        </div>
                        <div id="menuToppingFormChecked"></div>
                        <table class="table-bg">
                            <tr>
                                <td class="text-center"><?php echo $this->lang->line('select') ?></td>
                                <td class="text-center"><?php echo $this->lang->line('title') ?></td>
                                <td class="text-center"><?php echo $this->lang->line('price') ?></td> 
                                <td class="text-center"><?php echo $this->lang->line('qty') ?></td> 
                                <td class="text-center"><?php echo $this->lang->line('default') ?></td>
                            </tr>
                            <?php foreach ($nattr as $key => $CatAttrs): ?>
                                <?php if (!empty($CatAttrs)): ?>
                                    <tr>
                                        <td class="text-center" colspan="5">
                                            <?php echo ucwords(get_title('nattrcategory', array('id' => $key))) ?>
                                        </td>
                                    </tr>

                                    <?php foreach ($CatAttrs as $attr): ?>
                                        <tr>
                                            <td><div class="form-group"><input type="checkbox" data-error="#menuToppingFormChecked" name="checked[]" class="form-control" value="<?php echo $attr->id ?>"></div></td>
                                            <td><div class="form-group"><input type="text" name="title[<?php echo $attr->id ?>]" value="<?php echo $attr->title ?>" class="form-control"></div></td>
                                            <td><div class="form-group"><input type="text" name="price[<?php echo $attr->id ?>]" value="<?php echo $attr->price ?>" class="form-control"></div></td>
                                            <td><div class="form-group"><input type="text" name="qty[<?php echo $attr->id ?>]" value="1" class="form-control"></div></td>
                                            <td style="width: 90px;">
                                                <div class="form-group">
                                                    <select name="is_default[<?php echo $attr->id ?>]" class="form-control">
                                                        <option value="no"><?php echo $this->lang->line('no') ?></option>
                                                        <option value="yes"><?php echo $this->lang->line('yes') ?></option>
                                                    </select>
                                                </div>
                                            </td>
                                        </tr>
                                    <?php endforeach; ?>
                                <?php endif; ?> 
                            <?php endforeach; ?>
                        </table>
                        <div class="tab-group config-submit clearfix">
                            <button type="submit" onclick="saveToppings('menuToppingForm')"><span class="icon icon-folder"></span>&nbsp;<?php echo $this->lang->line('save') ?></button>
                        </div>
                    </div>
                    <?php echo form_close() ?>
                </div>
            <?php endif; ?>
        </div>
    </div>
</div>
<script>
    function toppingsRestForm(formId) {
        $('#' + formId).find('input[type=text],select').each(function () {
            $(this).val('');
        });
    }
    function setRelationWith(relType) {
        var size = Number(($('#relationWithElements option').size()));
        if ($.trim(relType) === $.trim('mono') && size > 0) {
            $('#relationWithBlock').show();
        } else {
            $('#relationWithBlock').hide();
        }
    }
    function saveToppingHead(formId) {
        if (!$('.page-loader').is(":visible")) {
            $('#' + formId).validate({
                submitHandler: function () {
                    var myform = document.getElementById(formId);
                    var formdata = new FormData(myform);
                    if (checkInternetConnection()) {
                        $.ajax({
                            url: $('#' + formId).attr('action'),
                            data: formdata,
                            cache: false,
                            processData: false,
                            contentType: false,
                            type: 'POST',
                            dataType: 'json',
                            beforeSend: function () {
                                $('.page-loader').show();
                            },
                            success: function (response) {
                                if (response.status) {
                                    toppingsRestForm(formId);
                                    attrPopup('menuToppingPopup', '75%', '<?php echo $category ?>', '<?php echo $menu ?>', '<?php echo $selection ?>', '<?php echo $set ?>', '<?php echo site_url('menu/topping') ?>');
                                } else {
                                    warning('<?php echo $this->lang->line('error') ?>', response.message, '<?php echo $this->lang->line('ok') ?>');
                                }
                            }
                        });
                    } else {
                        warning('<?php echo $this->lang->line('lost_connection') ?>', '<?php echo $this->lang->line('lost_connection_message') ?>', '<?php echo $this->lang->line('close') ?>');
                    }
                },
                errorClass: "has-error",
                highlight: function (e) {
                    $(e).closest('.form-group').addClass('has-error');
                },
                unhighlight: function (e) {
                    $(e).closest('.form-group').removeClass('has-error');
                },
                rules: {
                    title: {
                        required: true,
                        remote: {
                            url: "<?php echo site_url('menu/checktoppinghead') ?>",
                            type: "post",
                            data: {
                                category: function () {
                                    return $('#toppingHeadCategory').val();
                                },
                                menu: function () {
                                    return $('#toppingHeadMenu').val();
                                },
                                selection: function () {
                                    return $('#toppingHeadSelection').val();
                                },
                                set: function () {
                                    return $('#toppingHeadSet').val();
                                }
                            }
                        }
                    },
                    min: {number: true, min: 0},
                    max: {number: true, min: 0},
                    free: {number: true, min: 0},
                    rel: {required: true}
                },
                errorPlacement: function (error, element) {
                    errorPlacement(error, element);
                }
            });
        }
    }

    function deleteToppingsCategory(id) {
        if (!$('.page-loader').is(":visible")) {
            if (checkInternetConnection()) {
                $.ajax({
                    url: '<?php echo site_url('menu/deletetoppingcategory') ?>',
                    data: {
                        id: id
                    },
                    type: 'POST',
                    dataType: 'json',
                    beforeSend: function () {
                        $('.page-loader').show();
                    },
                    success: function (response) {
                        if (response.status) {
                            $('#toppingHeadId-' + id).closest('tr').remove();
                        }
                        $('.page-loader').hide();
                    }
                });
            } else {
                warning('<?php echo $this->lang->line('lost_connection') ?>', '<?php echo $this->lang->line('lost_connection_message') ?>', '<?php echo $this->lang->line('close') ?>');
            }
        }
    }

    function saveToppings(formId) {
        if (!$('.page-loader').is(":visible")) {
            $('#' + formId).validate({
                submitHandler: function () {
                    var myform = document.getElementById(formId);
                    var formdata = new FormData(myform);
                    if (checkInternetConnection()) {
                        $.ajax({
                            url: $('#' + formId).attr('action'),
                            data: formdata,
                            cache: false,
                            processData: false,
                            contentType: false,
                            type: 'POST',
                            dataType: 'json',
                            beforeSend: function () {
                                $('.page-loader').show();
                            },
                            success: function (response) {
                                if (response.status) {
                                    attrPopup('menuToppingPopup', '75%', '<?php echo $category ?>', '<?php echo $menu ?>', '<?php echo $selection ?>', '<?php echo $set ?>', '<?php echo site_url('menu/topping') ?>');
                                } else {
                                    warning('<?php echo $this->lang->line('error') ?>', response.message, '<?php echo $this->lang->line('ok') ?>');
                                }

                            }
                        });
                    } else {
                        warning('<?php echo $this->lang->line('lost_connection') ?>', '<?php echo $this->lang->line('lost_connection_message') ?>', '<?php echo $this->lang->line('close') ?>');
                    }

                },
                errorClass: "has-error",
                highlight: function (e) {
                    $(e).closest('.form-group').addClass('has-error');
                },
                unhighlight: function (e) {
                    $(e).closest('.form-group').removeClass('has-error');
                },
                rules: {
                    menuttrcategory: {
                        required: true,
                        min: 1
                    },
                    'checked[]': {
                        required: true
                    },
                    'title[]': {
                        required: true
                    },
                    'price[]': {
                        required: true
                    },
                    'qty[]': {
                        required: true
                    },
                    'is_default[]': {
                        required: true
                    }
                },
                messages: {
                    'checked[]': '<?php echo $this->lang->line('select_toppings') ?>',
                    menuttrcategory: '<?php echo $this->lang->line('select_toppings_head') ?>'
                },
                errorPlacement: function (error, element) {
                    errorPlacement(error, element);
                }
            });
        }
    }
    function deleteToppings(id) {
        if (!$('.page-loader').is(":visible")) {
            if (checkInternetConnection()) {
                $.ajax({
                    url: '<?php echo site_url('menu/deletetopping') ?>',
                    data: {
                        id: id
                    },
                    type: 'POST',
                    dataType: 'json',
                    beforeSend: function () {
                        $('.page-loader').show();
                    },
                    success: function (response) {
                        if (response.status) {
                            $('#toppingId-' + id).closest('tr').remove();
                        }
                        $('.page-loader').hide();
                    }
                });
            } else {
                warning('<?php echo $this->lang->line('lost_connection') ?>', '<?php echo $this->lang->line('lost_connection_message') ?>', '<?php echo $this->lang->line('close') ?>');
            }
        }
    }
    function updatetoppingcell(field) {
        $('#' + field).editable({
            mode: 'inline',
            source: function () {
                if (field.includes("status")) {
                    return [
                        {value: 3, text: '<?php echo $this->lang->line('active') ?>'},
                        {value: 2, text: '<?php echo $this->lang->line('inactive') ?>'}
                    ];
                }
                if (field.includes("is_default")) {
                    return [
                        {value: 'yes', text: '<?php echo strtolower($this->lang->line('yes')) ?>'},
                        {value: 'no', text: '<?php echo strtolower($this->lang->line('no')) ?>'}
                    ];
                }
            },
            validate: function (value) {
                if ($.trim(value) === '') {
                    warning('<?php echo $this->lang->line('error') ?>', '<?php echo $this->lang->line('data_required') ?>', '<?php echo $this->lang->line('close') ?>');
                    return false;
                } else {
                    if (field.includes("price") || field.includes("qty")) {
                        if (isNaN(Number(value))) {
                            warning('<?php echo $this->lang->line('error') ?>', '<?php echo $this->lang->line('invalid_data') ?>', '<?php echo $this->lang->line('close') ?>');
                            return false;
                        }
                    }
                }
            },
            success: function (response) {
                zamanDbEposMenuAttr('mono');
            }
        });
    }
    function updatetoppingheadcell(field) {
        $('#' + field).editable({
            mode: 'inline',
            source: function () {
                if (field.includes("status")) {
                    return [
                        {value: 3, text: '<?php echo $this->lang->line('active') ?>'},
                        {value: 2, text: '<?php echo $this->lang->line('inactive') ?>'}
                    ];
                }
                if (field.includes("rel")) {
                    return [
                        {value: 'mono', text: '<?php echo strtolower($this->lang->line('mono')) ?>'},
                        {value: 'poly', text: '<?php echo strtolower($this->lang->line('poly')) ?>'}
                    ];
                }
            },
            validate: function (value) {
                if ($.trim(value) === '') {
                    warning('<?php echo $this->lang->line('error') ?>', '<?php echo $this->lang->line('data_required') ?>', '<?php echo $this->lang->line('close') ?>');
                    return false;
                } else {
                    if (field.includes("min") || field.includes("max") || field.includes("max")) {
                        if (isNaN(Number(value))) {
                            warning('<?php echo $this->lang->line('error') ?>', '<?php echo $this->lang->line('invalid_data') ?>', '<?php echo $this->lang->line('close') ?>');
                            return false;
                        }
                    }
                }
            }

        });
    }
</script>