<div class="content_wrapper">

    <div class="container-fluid">
        <div class="row">
            <div class="col-sm-12">
                <aside>
                    <header><i class="fa fa-fw fa-file"></i>开关列表</header>
                    <section>
                        <div class="container-fluid">
                            <div class="row">
                                <div class="col-sm-12">
                                    <div class="table-responsive">
                                    <form class="J_ajaxForm" action="switches/actionswi" method="post">
                                        <table id="example" class="table table-striped table-bordered table-hover" cellspacing="0" width="100%">
                                            <thead>
                                            <tr>
                                                <th>开关名称</th>
                                                <th>开关状态</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            <?php foreach($list as $v) { ?>
                                            <tr>
                                                <td><?php echo $v['switch_cname'];?></td>
                                                <td>
                                                    <input class='mySwitch' type="checkbox" name="<?php echo $v['switch_name'];?>" <?php if(in_array($v['switch_name'], array('switch_thirdPayment', 'switch_thirdPayment_ios')) ){ if( $v['switch_status'] == 2) echo 'checked';}else{ if($v['switch_status'] == 1) echo 'checked';}?> >
                                                </td>
                                            </tr>
                                            <?php } ?>
                                            <tr><td colspan="2"><button type="button" class="btn btn-success formSub J_ajaxSubmitBtn">更新</button></td></tr>
                                            </tbody>
                                        </table>
                                    </form>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
        </div>
    </div>

</div>
<script type="text/javascript">
    $(".mySwitch").bootstrapSwitch();
    $('.formSub').click(function () {
        if(confirm('确认更新开关吗?')){
            return true;
        }
        location.reload();
        return false;
    });
</script>