<link rel="stylesheet" href="<?php echo base_url();?>frequent_changing/css/custom_check_box.css">
<section class="main-content-wrapper">
    <section class="content-header">
        <h3 class="top-left-header">
            <?php echo lang('assign_food_menu_modifier'); ?>
        </h3>
    </section>
    
    <div class="box-wrapper">
        <!-- general form elements -->
        <div class="table-box">
            <!-- form start -->
            <?php echo form_open(base_url() . 'foodMenu/assignFoodMenuModifier/' . $encrypted_id, $arrayName = array('id' => 'food_menu_form', 'enctype' => 'multipart/form-data')) ?>

            <div class="box-body">
                <div class="row">
                    <div class="col-md-12">
                        <div class="form-group mb-2">
                            <label class="container"> <?php echo lang('select_all'); ?>
                                <input type="checkbox" id="checkbox_userAll">
                                <span class="checkmark"></span>
                            </label>
                        </div>
                        <hr class="ir_m_p_0">
                        <?php
                        if (isset($modifiers)) {
                            foreach ($modifiers as $modifier) {

                                $modifier_id_ = $modifier->id;
                                //$checked='';
                                if (!empty($food_menu_modifiers)) {
                                    foreach ($food_menu_modifiers as $fmm) {
                                        if (in_array($modifier_id_, $food_menu_modifiers)) {
                                            $checked = 'checked';
                                        } else {
                                            $checked = '';
                                        }
                                    }
                                } else {
                                    $checked = '';
                                }
                                ?>
                        <div class="form-group my-2">
                            <label class="container"><?php echo escape_output($modifier->name); ?>
                                <input type="checkbox" class="checkbox_user" <?php echo escape_output($checked); ?>
                                    value="<?php echo escape_output($modifier->id); ?>" name="modifier_id[]"
                                    <?= set_checkbox('modifier_id[]', $modifier->id) ?>>
                                <span class="checkmark"></span>
                            </label>
                        </div>
                        <?php
                            }
                        }
                        ?>

                        <?php if (form_error('modifier_id')) { ?>
                        <div class="callout callout-danger my-2">
                            <span class="error_paragraph"><?php echo form_error('modifier_id'); ?></span>
                        </div>
                        <?php } ?>
                    </div>
                </div>
            </div>
            <div class="box-footer">
                <button type="submit" name="submit" value="submit" class="btn bg-blue-btn me-2">
                    <i data-feather="upload"></i>
                    <?php echo lang('submit'); ?>
                </button>

                <a class="btn bg-blue-btn" href="<?php echo base_url() ?>foodMenu/foodMenus">
                    <i data-feather="corner-up-left"></i>
                    <?php echo lang('back'); ?>
                </a>
            </div>
            <?php echo form_close(); ?>
        </div>
    </div>
</section>
<script src="<?php echo base_url(); ?>frequent_changing/js/assign_food_menu.js"></script>