<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>推金币配置</title>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="<?php echo base_url();?>public/js/bootstrap/bootstrap.min.css" >
    <link rel="stylesheet" href="<?php echo base_url();?>public/js/vendor/bootstrap-datepicker/css/bootstrap-datepicker.standalone.min.css">
    <link rel="stylesheet" href="<?php echo base_url();?>public/css/jquery.timepicker.min.css">
    <!-- Select2 -->
    <link rel="stylesheet" href="<?php echo base_url();?>public/js/vendor/select2/select2.min.css">

    <style type="text/css">
        .thumbnail {
            margin:10px;
        }

        .lang-name {
            margin-left:42px;
        }

        .upimg {
            cursor: pointer;
        }

    </style>
</head>
<body>
<div id="msg-tip">

</div>
<div class="content_wrapper">
    <div class="container-fluid">
        <aside>
            <form class="form-horizontal" role="form" method="post" enctype="multipart/form-data"  id="form1" action="#" style="margin-top: 20px">
                <header><i class="fa fa-fw fa-file"></i>偷坑结果权重【a完美偷 b(65+25+其他) c(65+10+其他) d(25+10+其他)】</header>
                <section>
                    <div class="container-fluid">
                        <div class="row">
                            <div class="col-sm-12">
                                <button type="button" class="btn btn-success" id="submitBtn1">提交</button>
                            </div>
                        </div>
                    </div>
                    <div class="container-fluid addOrDelControl">
                        <?php foreach ($stealRetWeight as $key => $vl) {  ?>
                        <div class="row" style="border: 1px solid #CCC;margin:10px 5px;padding: 5px 0;">
                            <div class="form-group" >
                                <label class="col-sm-1 control-label">等级范围*: </label>
                                <div class="col-sm-2">
                                    <input type="text" style="display: inline-block;width: 45%" class="form-control" name="config[<?php echo $vl['id'];?>][slv]" value="<?php echo $vl['slv'];?>">
                                    <input type="text" style="display: inline-block;width: 45%" class="form-control" name="config[<?php echo $vl['id'];?>][elv]" value="<?php echo $vl['elv'];?>">
                                </div>
                                <label class="col-sm-1 control-label">权重a*: </label>
                                <div class="col-sm-1">
                                    <input type="text" class="form-control" name="config[<?php echo $vl['id'];?>][weight][a]" value="<?php echo $vl['weight']['a'];?>">
                                </div>
                                <label class="col-sm-1 control-label">权重b*: </label>
                                <div class="col-sm-1">
                                    <input type="text" class="form-control" name="config[<?php echo $vl['id'];?>][weight][b]" value="<?php echo $vl['weight']['b'];?>">
                                </div>
                                <label class="col-sm-1 control-label">权重c*: </label>
                                <div class="col-sm-1">
                                    <input type="text" class="form-control" name="config[<?php echo $vl['id'];?>][weight][c]" value="<?php echo $vl['weight']['c'];?>">
                                </div>
                                <label class="col-sm-1 control-label">权重d*: </label>
                                <div class="col-sm-1">
                                    <input type="text" class="form-control" name="config[<?php echo $vl['id'];?>][weight][d]" value="<?php echo $vl['weight']['d'];?>">
                                </div>
                                <button type="button" class="btn btn-danger deleteParent" >删除</button>
                            </div>
                        </div>
                        <?php } ?>
                    </div>
                    <button type="button" class="btn btn-success stealRetWeight" k="<?php echo count($stealRetWeight) + 1;?>" style="margin-left: 12px;margin-bottom: 10px;">增加</button>
                </section>
            </form>
        </aside>
    </div>
    <div class="container-fluid">
        <aside>
            <form class="form-horizontal" role="form" method="post" enctype="multipart/form-data"  id="form2" action="#" style="margin-top: 20px">
                <header><i class="fa fa-fw fa-file"></i>空位宝箱的权重分配【a空 b木箱子 c白银箱子 d黄金箱子】</header>
                <section>
                    <div class="container-fluid">
                        <div class="row">
                            <div class="col-sm-12">
                                <button type="button" class="btn btn-success" id="submitBtn2">提交</button>
                            </div>
                        </div>
                    </div>
                    <div class="container-fluid addOrDelControl">
                        <?php foreach ($boxRetWeight as $key => $vl) {  ?>
                        <div class="row" style="border: 1px solid #CCC;margin:10px 5px;padding: 5px 0;">
                            <div class="form-group" >
                                <label class="col-sm-1 control-label">权重a*: </label>
                                <div class="col-sm-1">
                                    <input type="text" class="form-control" name="config[<?php echo $vl['id'];?>][weight][a]" value="<?php echo $vl['weight']['a'];?>">
                                </div>
                                <label class="col-sm-1 control-label">权重b*: </label>
                                <div class="col-sm-1">
                                    <input type="text" class="form-control" name="config[<?php echo $vl['id'];?>][weight][b]" value="<?php echo $vl['weight']['b'];?>">
                                </div>
                                <label class="col-sm-1 control-label">权重c*: </label>
                                <div class="col-sm-1">
                                    <input type="text" class="form-control" name="config[<?php echo $vl['id'];?>][weight][c]" value="<?php echo $vl['weight']['c'];?>">
                                </div>
                                <label class="col-sm-1 control-label">权重d*: </label>
                                <div class="col-sm-1">
                                    <input type="text" class="form-control" name="config[<?php echo $vl['id'];?>][weight][d]" value="<?php echo $vl['weight']['d'];?>">
                                </div>
                                <button type="button" class="btn btn-danger deleteParent" >删除</button>
                            </div>
                        </div>
                        <?php } ?>
                    </div>
                    <button type="button" class="btn btn-success boxRetWeight" k="<?php echo count($boxRetWeight) + 1;?>" style="margin-left: 12px;margin-bottom: 10px;">增加</button>
                </section>
            </form>
        </aside>
    </div>
    <div class="container-fluid">
        <aside>
            <form class="form-horizontal" role="form" method="post" enctype="multipart/form-data"  id="form3" action="#" style="margin-top: 20px">
                <header><i class="fa fa-fw fa-file"></i>倍率调整偷金币坑权重系数</header>
                <section>
                    <div class="container-fluid">
                        <div class="row">
                            <div class="col-sm-12">
                                <button type="button" class="btn btn-success" id="submitBtn3">提交</button>
                            </div>
                        </div>
                    </div>
                    <div class="container-fluid addOrDelControl">
                        <?php foreach ($betRetWeight as $key => $vl) {  ?>
                        <div class="row" style="border: 1px solid #CCC;margin:10px 5px;padding: 5px 0;">
                            <div class="form-group" >
                                <label class="col-sm-1 control-label">倍率*: </label>
                                <div class="col-sm-1">
                                    <input type="text" class="form-control" name="config[<?php echo $vl['id'];?>][bet]" value="<?php echo $vl['bet'];?>">
                                </div>
                                <label class="col-sm-1 control-label">系数a*: </label>
                                <div class="col-sm-1">
                                    <input type="text" class="form-control" name="config[<?php echo $vl['id'];?>][coefficient][a]" value="<?php echo $vl['coefficient']['a'];?>">
                                </div>
                                <label class="col-sm-1 control-label">系数b*: </label>
                                <div class="col-sm-1">
                                    <input type="text" class="form-control" name="config[<?php echo $vl['id'];?>][coefficient][b]" value="<?php echo $vl['coefficient']['b'];?>">
                                </div>
                                <label class="col-sm-1 control-label">系数c*: </label>
                                <div class="col-sm-1">
                                    <input type="text" class="form-control" name="config[<?php echo $vl['id'];?>][coefficient][c]" value="<?php echo $vl['coefficient']['c'];?>">
                                </div>
                                <label class="col-sm-1 control-label">系数d*: </label>
                                <div class="col-sm-1">
                                    <input type="text" class="form-control" name="config[<?php echo $vl['id'];?>][coefficient][d]" value="<?php echo $vl['coefficient']['d'];?>">
                                </div>
                                <button type="button" class="btn btn-danger deleteParent" >删除</button>
                            </div>
                        </div>
                        <?php } ?>
                    </div>
                    <button type="button" class="btn btn-success betRetWeight" k="<?php echo count($betRetWeight) + 1;?>" style="margin-left: 12px;margin-bottom: 10px;">增加</button>
                </section>
            </form>
        </aside>
    </div>
    <div class="container-fluid">
        <aside>
            <form class="form-horizontal" role="form" method="post" enctype="multipart/form-data"  id="form4" action="#" style="margin-top: 20px">
                <header><i class="fa fa-fw fa-file"></i>倍率调整空位宝箱权重系数</header>
                <section>
                    <div class="container-fluid">
                        <div class="row">
                            <div class="col-sm-12">
                                <button type="button" class="btn btn-success" id="submitBtn4">提交</button>
                            </div>
                        </div>
                    </div>
                    <div class="container-fluid addOrDelControl">
                        <?php foreach ($betBoxRetWeight as $key => $vl) {  ?>
                        <div class="row" style="border: 1px solid #CCC;margin:10px 5px;padding: 5px 0;">
                            <div class="form-group" >
                                <label class="col-sm-1 control-label">倍率*: </label>
                                <div class="col-sm-1">
                                    <input type="text" class="form-control" name="config[<?php echo $vl['id'];?>][bet]" value="<?php echo $vl['bet'];?>">
                                </div>
                                <label class="col-sm-1 control-label">系数a*: </label>
                                <div class="col-sm-1">
                                    <input type="text" class="form-control" name="config[<?php echo $vl['id'];?>][coefficient][a]" value="<?php echo $vl['coefficient']['a'];?>">
                                </div>
                                <label class="col-sm-1 control-label">系数b*: </label>
                                <div class="col-sm-1">
                                    <input type="text" class="form-control" name="config[<?php echo $vl['id'];?>][coefficient][b]" value="<?php echo $vl['coefficient']['b'];?>">
                                </div>
                                <label class="col-sm-1 control-label">系数c*: </label>
                                <div class="col-sm-1">
                                    <input type="text" class="form-control" name="config[<?php echo $vl['id'];?>][coefficient][c]" value="<?php echo $vl['coefficient']['c'];?>">
                                </div>
                                <label class="col-sm-1 control-label">系数d*: </label>
                                <div class="col-sm-1">
                                    <input type="text" class="form-control" name="config[<?php echo $vl['id'];?>][coefficient][d]" value="<?php echo $vl['coefficient']['d'];?>">
                                </div>
                                <button type="button" class="btn btn-danger deleteParent" >删除</button>
                            </div>
                        </div>
                        <?php } ?>
                    </div>
                    <button type="button" class="btn btn-success betBoxRetWeight" k="<?php echo count($betBoxRetWeight) + 1;?>" style="margin-left: 12px;margin-bottom: 10px;">增加</button>
                </section>
            </form>
        </aside>
    </div>
</div>
</body>

<script>
    $('.addOrDelControl').on("click",'.deleteParent',function(){
        $(this).parent().parent().remove();
    });
    $('.stealRetWeight').on("click",function(){
        var k   = $(this).attr('k');
        var str = '<div class="row" style="border: 1px solid #CCC;margin:10px 5px;padding: 5px 0;"><div class="form-group" ><label class="col-sm-1 control-label">等级范围*: </label><div class="col-sm-2"><input type="text" style="display: inline-block;width: 45%" class="form-control" name="config['+k+'][slv]" value="1"><input type="text" style="display: inline-block;width: 45%" class="form-control" name="config['+k+'][elv]" value="2"></div><label class="col-sm-1 control-label">权重a*: </label><div class="col-sm-1"><input type="text" class="form-control" name="config['+k+'][weight][a]" value="1"></div><label class="col-sm-1 control-label">权重b*: </label><div class="col-sm-1"><input type="text" class="form-control" name="config['+k+'][weight][b]" value="1"></div><label class="col-sm-1 control-label">权重c*: </label><div class="col-sm-1"><input type="text" class="form-control" name="config['+k+'][weight][c]" value="0"></div><label class="col-sm-1 control-label">权重d*: </label><div class="col-sm-1"><input type="text" class="form-control" name="config['+k+'][weight][d]" value="1"></div><button type="button" class="btn btn-danger deleteParent" >删除</button></div></div>';
        $(this).prev().append(str);
        $(this).attr('k',Number(k)+1);
    });
    $('.boxRetWeight').on("click",function(){
        var k   = $(this).attr('k');
        var str = '<div class="row" style="border: 1px solid #CCC;margin:10px 5px;padding: 5px 0;"><div class="form-group" ><label class="col-sm-1 control-label">权重a*: </label><div class="col-sm-1"><input type="text" class="form-control" name="config['+k+'][weight][a]" value="1"></div><label class="col-sm-1 control-label">权重b*: </label><div class="col-sm-1"><input type="text" class="form-control" name="config['+k+'][weight][b]" value="1"></div><label class="col-sm-1 control-label">权重c*: </label><div class="col-sm-1"><input type="text" class="form-control" name="config['+k+'][weight][c]" value="0"></div><label class="col-sm-1 control-label">权重d*: </label><div class="col-sm-1"><input type="text" class="form-control" name="config['+k+'][weight][d]" value="1"></div><button type="button" class="btn btn-danger deleteParent" >删除</button></div></div>';
        $(this).prev().append(str);
        $(this).attr('k',Number(k)+1);
    });
    $('.betRetWeight').on("click",function(){
        var k   = $(this).attr('k');
        var str = '<div class="row" style="border: 1px solid #CCC;margin:10px 5px;padding: 5px 0;"><div class="form-group" ><label class="col-sm-1 control-label">倍率*: </label><div class="col-sm-1"><input type="text" class="form-control" name="config['+k+'][bet]" value="1"></div><label class="col-sm-1 control-label">系数a*: </label><div class="col-sm-1"><input type="text" class="form-control" name="config['+k+'][coefficient][a]" value="1"></div><label class="col-sm-1 control-label">系数b*: </label><div class="col-sm-1"><input type="text" class="form-control" name="config['+k+'][coefficient][b]" value="1"></div><label class="col-sm-1 control-label">系数c*: </label><div class="col-sm-1"><input type="text" class="form-control" name="config['+k+'][coefficient][c]" value="0"></div><label class="col-sm-1 control-label">系数d*: </label><div class="col-sm-1"><input type="text" class="form-control" name="config['+k+'][coefficient][d]" value="1"></div><button type="button" class="btn btn-danger deleteParent" >删除</button></div></div>';
        $(this).prev().append(str);
        $(this).attr('k',Number(k)+1);
    });
    $('.betBoxRetWeight').on("click",function(){
        var k   = $(this).attr('k');
        var str = '<div class="row" style="border: 1px solid #CCC;margin:10px 5px;padding: 5px 0;"><div class="form-group" ><label class="col-sm-1 control-label">倍率*: </label><div class="col-sm-1"><input type="text" class="form-control" name="config['+k+'][bet]" value="1"></div><label class="col-sm-1 control-label">系数a*: </label><div class="col-sm-1"><input type="text" class="form-control" name="config['+k+'][coefficient][a]" value="1"></div><label class="col-sm-1 control-label">系数b*: </label><div class="col-sm-1"><input type="text" class="form-control" name="config['+k+'][coefficient][b]" value="1"></div><label class="col-sm-1 control-label">系数c*: </label><div class="col-sm-1"><input type="text" class="form-control" name="config['+k+'][coefficient][c]" value="0"></div><label class="col-sm-1 control-label">系数d*: </label><div class="col-sm-1"><input type="text" class="form-control" name="config['+k+'][coefficient][d]" value="1"></div><button type="button" class="btn btn-danger deleteParent" >删除</button></div></div>';
        $(this).prev().append(str);
        $(this).attr('k',Number(k)+1);
    });
    $('#submitBtn1').click(function () {
        var data = new FormData(document.getElementById("form1"));
        $.ajax({
            url: rootPath + 'Config/actionSlotRet/stealRetWeight',
            type: 'POST',
            data: data,
            dataType: 'json',
            contentType: false, //必须
            processData: false, //必须
            success: function (data) {
                alert(data.msg);
                if(data.ret == 0){
                    window.location.reload();
                }
            },
            error: function (msg) {
                alert(data.msg);
            }
        });
    });
    $('#submitBtn2').click(function () {
        var data = new FormData(document.getElementById("form2"));
        $.ajax({
            url: rootPath + 'Config/actionSlotRet/boxRetWeight',
            type: 'POST',
            data: data,
            dataType: 'json',
            contentType: false, //必须
            processData: false, //必须
            success: function (data) {
                alert(data.msg);
                if(data.ret == 0){
                    window.location.reload();
                }
            },
            error: function (msg) {
                alert(data.msg);
            }
        });
    });
    $('#submitBtn3').click(function () {
        var data = new FormData(document.getElementById("form3"));
        $.ajax({
            url: rootPath + 'Config/actionSlotRet/betRetWeight',
            type: 'POST',
            data: data,
            dataType: 'json',
            contentType: false, //必须
            processData: false, //必须
            success: function (data) {
                alert(data.msg);
                if(data.ret == 0){
                    window.location.reload();
                }
            },
            error: function (msg) {
                alert(data.msg);
            }
        });
    });
    $('#submitBtn4').click(function () {
        var data = new FormData(document.getElementById("form4"));
        $.ajax({
            url: rootPath + 'Config/actionSlotRet/betBoxRetWeight',
            type: 'POST',
            data: data,
            dataType: 'json',
            contentType: false, //必须
            processData: false, //必须
            success: function (data) {
                alert(data.msg);
                if(data.ret == 0){
                    window.location.reload();
                }
            },
            error: function (msg) {
                alert(data.msg);
            }
        });
    });
</script>
</html>
