<!DOCTYPE html>
<html lang="en">

<body>
<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="container-fluid">
                                <div class="row">
                                    <div class="col-sm-12">
                                        <button type="button" class="btn btn-success" onclick="summitBasicConf()">提交</button>
                                    </div>
                                </div>
                            </div>
                            <hr>

                            <div class="ibox-content">
                                <div class="col-sm-8">
                                    <form class="form-horizontal" method="post" id="commonConfForm" action="">
                                        <div class="form-group">
                                            <label class="col-sm-3 control-label">解锁等级：</label>
                                            <div class="col-sm-3">
                                                <input type="number" placeholder="解锁等级" name="openLv" value="<?php echo $openLv; ?>" class="form-control">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-3 control-label">能量条上限：</label>
                                            <div class="col-sm-3">
                                                <input type="number" placeholder="能量条上限值" name="maxEnergy" value="<?php echo $maxEnergy; ?>"
                                                       class="form-control">
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-3 control-label">主题皮肤：</label>
                                            <div class="col-sm-3">
                                                <select class="form-control" name="theme">
                                                    <?php foreach ($themeList as  $item){?>
                                                        <option value="<?=$item['type']?>" <?php if(!empty($theme) && $theme == $item['type'])echo 'selected'; ?> ><?=$item['name']?></option>
                                                    <?php } ?>
                                                </select>
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </section>
                </aside>
            </div>
        </div>
    </div>
</div>
</body>

<script>
    function summitBasicConf() {
        const data = new FormData(document.getElementById("commonConfForm"));

        $.ajax({
            url: rootPath + 'assistantSlots/updateBasicConf',
            type: 'POST',
            data: data,
            dataType: 'json',
            contentType: false, //必须
            processData: false, //必须
            success: function (data) {
                alert(data.msg);
                // confirm(data.msg);
                window.location.reload();
            },
            error: function (data) {
                alert(data.msg);
            }
        });
    }
</script>
