<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>icon展示配置</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="form" action="#" style="margin-top: 20px">
                <header><i class="fa fa-fw fa-file"></i>icon展示配置<spin style="color:red">(*新增活动需要添加icon,找服务端同学)</spin></header>
                <section>
                    <div class="container-fluid">
                        <div class="row">
                            <div class="col-sm-12">
                                <button type="button" class="btn btn-success" id="submitBtn">提交</button>
                            </div>
                        </div>
                    </div>
                    <div class="container-fluid">
                        <div class="form-group" >
                            <label class="col-sm-2 control-label">右侧外部最大显示数</label>
                            <div class="col-sm-2">
                                <input type="text" name="rightMaxShow" value="<?php echo $rightMaxShow;?>">
                            </div>
                        </div>
                        <?php foreach ($config as $key => $vl) { ?>
                            <div class="row" style="border: 1px solid #CCC;margin:10px 5px;padding: 5px 0;">
                                <div class="form-group" >
                                    <input type="hidden" class="form-control" readonly name="config[<?php echo $vl['id'];?>][id]" value="<?php echo $vl['id'];?>">
                                    <label class="col-sm-2 control-label">奖励名称</label>
                                    <div class="col-sm-2">
                                        <input type="text" class="form-control" readonly name="config[<?php echo $vl['id'];?>][tips]" value="<?php echo $vl['tips'];?>">
                                        <span  style="color:red">活动类型ID:<?php echo $vl['id'];?></span>
                                    </div>
                                    <label class="col-sm-2 control-label">是否显示在奖励中心</label>
                                    <div class="col-sm-2">
                                        <select class="form-control" name="config[<?php echo $vl['id'];?>][isShow]" id="bcolor">
                                            <option value="1" <?php if($vl['isShow'] == 1) echo 'selected'; ?>>开启</option>
                                            <option value="0" <?php if($vl['isShow'] == 0) echo 'selected'; ?>>关闭</option>
                                        </select>
                                    </div>
                                    <label class="col-sm-2 control-label">是否显示外部按钮</label>
                                    <div class="col-sm-2">
                                        <select class="form-control" name="config[<?php echo $vl['id'];?>][isShowBtn]" id="bcolor2">
                                            <option value="1" <?php if($vl['isShowBtn'] == 1) echo 'selected'; ?>>开启</option>
                                            <option value="0" <?php if($vl['isShowBtn'] == 0) echo 'selected'; ?>>关闭</option>
                                        </select>
                                    </div>
                                </div>

                                <div class="form-group" >
                                    <label class="col-sm-2 control-label">是否显示倒计时</label>
                                    <div class="col-sm-2">
                                        <select class="form-control" name="config[<?php echo $vl['id'];?>][isShowCountdown]" id="bcolor3">
                                            <option value="1" <?php if($vl['isShowCountdown'] == 1) echo 'selected'; ?>>开启</option>
                                            <option value="0" <?php if($vl['isShowCountdown'] == 0) echo 'selected'; ?>>关闭</option>
                                        </select>
                                    </div>
                                    <label class="col-sm-2 control-label">显示位置</label>
                                    <div class="col-sm-2">
                                        <select class="form-control" name="config[<?php echo $vl['id'];?>][position]" id="bcolor4">
                                            <option value="1" <?php if($vl['position'] == 1) echo 'selected'; ?>>左边</option>
                                            <option value="0" <?php if($vl['position'] == 0) echo 'selected'; ?>>右边</option>
                                        </select>
                                    </div>
                                    <label class="col-sm-2 control-label">展示权重(常规活动)</label>
                                    <div class="col-sm-2">
                                        <input class="form-control" name="config[<?php echo $vl['id'];?>][iconWeight]" id="bcolor4" value="<?php echo $vl['iconWeight'];?>">
                                    </div>
                                    <label class="col-sm-2 control-label">展示权重(道具活动)</label>
                                    <div class="col-sm-2">
                                        <input class="form-control" name="config[<?php echo $vl['id'];?>][propsWeight]" id="bcolor4" value="<?php echo $vl['propsWeight'];?>">
                                    </div>
                                </div>
                            </div>
                        <?php } ?>
                    </div>
                </section>
            </form>
        </aside>
    </div>
</div>
</body>

<script>
    $(function () {
        $('#submitBtn').click(function () {
            var data = new FormData(document.getElementById("form"));
            $.ajax({
                url: rootPath + 'Config/actionRewardCenter',
                type: 'POST',
                data: data,
                dataType: 'json',
                contentType: false, //必须
                processData: false, //必须
                success: function (data) {
                    alert(data.msg);
                    window.location.reload();
                },
                error: function (msg) {
                    alert(data.msg);
                }
            });
        });
    });
</script>
</html>
