<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">
                                    <?php foreach ($smallBlind as $num){ ?>
                                        <button style="margin:5px;" type="button" class="smallblindBtn btn btn-primary <?php if( $cur == $num){ echo 'active';}?>"><?php echo $num;?></button>
                                    <?php }?>
                                </div>
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12">
                <aside>
                    <header><i class="fa fa-fw fa-file"></i>加钱操作</header>
                    <section>
                        <div class="container-fluid">
                            <button style="margin-left: 2px; margin-bottom: 15px;" type="button" class="btn btn-success">能坐下机器人数量:<?php echo $cansitin;?></button>
                            <div class="row">
                                <div class="col-sm-12">
                                    <form class="form-inline J_ajaxForm" method="post" action="robot/actionmultiRobotmoney">
                                        <input type="hidden" name="smallBlind" class="actionuid" value="<?php echo $cur;?>" />
                                          <div class="form-group">
                                            <label for="exampleInputName2">筹码:</label>
                                            <input type="text" class="form-control" name="robotmoney" placeholder="只能给低于20万的机器人加钱

">
                                          </div>
                                        <button type="submit" class="btn btn-success J_ajaxSubmitBtn">一键加钱</button>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
        </div>
        <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">
                                        <table id="example" class="table table-striped table-bordered table-hover" cellspacing="0" width="100%">
                                            <thead>
                                            <tr>
                                                <th>ID</th>
                                                <th>UID</th>
                                                <th>筹码</th>
                                                <th>场次</th>
                                                <th>操作</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            <?php $i = 1; foreach($list as $uid => $v) { ?>
                                            <tr>
                                                <td><?php echo $i;?></td>
                                                <td><?php echo $uid;?></td>
                                                <td class="money_<?php echo $uid;?>"><?php echo $v['money'];?></td>
                                                <td class="money_<?php echo $uid;?>"><?php echo $v['level'];?></td>
                                                <td><button type="button" class="addMoney btn btn-success" data-toggle="modal" data-target="#actionMoney" uid="<?php echo $uid;?>">加钱</button></td>
                                            </tr>
                                            <?php $i++;} ?>
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
        </div>
    </div>

</div>
<!-- 操作金币弹出框 -->
<div class="modal fade" id="actionMoney" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                <h4 class="modal-title" id="myModalLabel">玩家UID:<span class="modal_uid"></span></h4>
            </div>
            <form class="form-horizontal J_ajaxForm" role="form" method="post" action="user/actionusermoney" data-callBack="updatemoney">
                <input type="hidden" name="actionuid" class="actionuid" value="" />
                <div class="modal-body">
                    <div class="form-group">
                        <label class="col-sm-3 control-label">操作金币值:</label>
                        <div class="col-sm-9">
                            <input type="text" class="form-control" placeholder="直接填写数字,负数添加负号即可,不填则不更改" name="newmoney">
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary J_ajaxSubmitBtn">提交</button>
                </div>
            </form>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(".smallblindBtn").click(function(){
        var num = $(this).text();
        window.location.href = "#robot/list/"+num;
    });

    $(".addMoney").click(function(){
       var uid = $(this).attr('uid');
       $('.modal_uid').text(uid);
       $('.actionuid').val(uid);
    });

    function updatemoney(returnData, $from) {
        if( returnData.state == 'success' ){
            var uid = returnData.uid;
            $('.money_'+uid).text(returnData.retdata.money);
        }
    }
</script>