<div class="main-right-box">
    <h5>{lang_admin('sidebar')}</h5>
    <div class="box" id="box">
        <form name="listform" id="listform"  action="<?php echo uri();?>" method="post" onsubmit="return returnform(this);">
            <div class="table-responsive">
                <table class="table table-hover">
                    <thead>
                    <tr class="th">
                        <th class="s_out">{lang_admin('all_election')}  <input title="{lang_admin('click_to_select_all_items_on_this_page')}"  onclick="CheckAll(this.form);checkfromdata(this,'all')" type="checkbox" name="chkall" class="checkbox" /></th>
                        <th class="catid">{lang_admin('name')}</th>
                        <!--<th class="catid">{lang_admin('key')}</th>-->
                    </tr>
                    </thead>
                    <tbody>
                    {loop $data $d}
                    <tr>
                        <input type="hidden" class="hiddenfromdata" id="<?php echo $d['key'];?>" name="fromdata[<?php echo $d['key'];?>][status]" value="<?php if ($d['status']){echo 1;}else{echo 0;};?>">
                        <td class="s_out">
                            <input <?php if ($d['status']){ ?> checked <?php } ?> onclick="c_chang(this);checkfromdata(this,'<?php echo $d['key'];?>');" type="checkbox"    class="checkbox" /></td>
                        <td class="catid">{cut($d['name'])}</td>
                        <!--<td class="catid text-center">{cut($d['key'])}</td>-->
                    </tr>
                    {/loop}
                    </tbody>

                </table>
            </div>
            <div class="blank30"></div>
            <div class="line"></div>
            <div class="blank30"></div>
            <input type="hidden" name="submit" value="1"/>
            <input class="btn btn-primary btn-lg" type="button" value="{lang_admin('preservation')} " name="save"
                   onclick="this.form.action='<?php echo modify('act/add',true);?>';  returnform(this.form);"/>

            <div class="blank30"></div>
            <div class="line"></div>

            <div class="clear page">
                <?php if(get('table')!='type' && front::get('case')!='field') echo pagination::adminhtml($record_count); ?>
            </div>

        </form>
        <script>
            $(function () { $("[data-toggle='tooltip']").tooltip(); });
        </script>
        <div class="blank30"></div>
    </div>
</div>
<script>
    function checkfromdata(obj,name){
        if (name =="all"){
            if($(obj).is(':checked')) {
                $(".hiddenfromdata").val(1);
            }else{
                $(".hiddenfromdata").val(0);
            }
        }else{
            if($(obj).is(':checked')) {
                $("#"+name).val(1);
            }else{
                $("#"+name).val(0);
            }
        }
    }
</script>

