<!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">
    <link rel="stylesheet" href="<?php echo base_url();?>public/js/date/datedropper.min.css">
    <script src="<?php echo base_url();?>public/js/date/datedropper.min.js"></script>
    <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="container-fluid">
    <div class="row">
        <div class="col-sm-12">
            <aside>
                <header><i class="fa fa-fw fa-file"></i>停服公告</header>
                <hr/>
                <section>
                    <div class="container-fluid">
                        <div class="row">
                            <div class="col-sm-12">
                                <form class="form-horizontal J_ajaxForm" role="form" method="post" action="Config/actionMaxLevelReward" data-callBack="message" id="actionMaxLevelReward">
                                    <div class="modal-body">
                                        <style>
                                            .time{
                                                height: 34px;
                                                padding: 6px 12px;
                                                font-size: 14px;
                                                line-height: 1.42857143;
                                                color: #555;
                                                background-color: #fff;
                                                background-image: none;
                                                border: 1px solid #ccc;
                                                border-radius: 4px;
                                            }

                                        </style>
                                        <div class="form-group">
                                            <label class="col-sm-3 control-label">金币</label>
                                            <div class="col-sm-9">
                                                <div class="col-sm-2">
                                                    <select class="form-control" name="coins" style="display: inline-block;">
                                                        <option value="coins01" <?php if($config['coins']['coins'] == 'coins01'){ echo 'selected';}?> >coins01</option>
                                                        <option value="coins02" <?php if($config['coins']['coins'] == 'coins02'){ echo 'selected';}?> >coins02</option>
                                                        <option value="coins03" <?php if($config['coins']['coins'] == 'coins03'){ echo 'selected';}?> >coins03</option>
                                                        <option value="coins04" <?php if($config['coins']['coins'] == 'coins04'){ echo 'selected';}?> >coins04</option>
                                                        <option value="coins05" <?php if($config['coins']['coins'] == 'coins05'){ echo 'selected';}?> >coins05</option>
                                                        <option value="coins06" <?php if($config['coins']['coins'] == 'coins06'){ echo 'selected';}?> >coins06</option>
                                                    </select>
                                                </div>
                                                <input type="text" class="time" name="bet" value="<?php echo $config['coins']['bet'];?>" />
                                            </div>
                                        </div>

                                        <div class="form-group">
                                            <label class="col-sm-3 control-label">体力</label>
                                            <div class="col-sm-9">
                                                <div class="col-sm-2">
                                                    <input type="text" class="time" value="<?php echo $config['spins'];?>" name="spins"/>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-3 control-label">道具奖励*: </label>
                                            <div class="col-sm-6">
                                                <div class="container-fluid addOrDelControl" style="border: 1px solid #CCC;margin: 20px 15px;padding-top: 10px;">
                                                    <?php foreach ($config['props'] as $k => $reward) { ?>
                                                        <div class="form-group">
                                                            <label class="col-sm-2 control-label">道具*: </label>
                                                            <div class="col-sm-3">
                                                                <select class="form-control typeControl" name="props[propsId][]">
                                                                    <?php foreach ($props as $x => $y) { ?>
                                                                        <option value="<?php echo $x;?>" <?php if($reward['propsId'] == $x) echo 'selected'; ?>><?php echo $y['msg'];?></option>
                                                                    <?php } ?>
                                                                </select>
                                                            </div>
                                                            <label class="col-sm-2 control-label">数量*: </label>
                                                            <div class="col-sm-2">
                                                                <input type="text" class="form-control"  name="props[num][]" value="<?php echo $reward['num'];?>">
                                                            </div>
                                                            <button type="button" class="btn btn-danger deleteParent" >删除</button>
                                                        </div>
                                                    <?php } ?>
                                                    <button type="button" class="btn btn-success addParent" style="margin-left: 12px;margin-bottom: 10px;">增加</button>
                                                </div>
                                            </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>
                </section>
            </aside>
        </div>
    </div>
</div>

</body>
<script src="<?php echo base_url();?>public/js/vendor/bootstrap-datepicker/js/bootstrap-datepicker.min.js"></script>
<script src="<?php echo base_url();?>public/js/vendor/bootstrap-datepicker/locales/bootstrap-datepicker.zh-CN.min.js"></script>
<script src="<?php echo base_url();?>public/js/common.js"></script>
<script>

    var idData = JSON.parse('<?php echo json_encode($props); ?>');
    function message(returnData, $from) {
        window.location.reload();
    }

    $('.addOrDelControl').on("click",'.deleteParent',function(){
        $(this).parent().remove();
    });

    $('.addParent').on("click",function(){
        var str = '';
        str += '<div class="form-group"><label class="col-sm-2 control-label">道具*: </label><div class="col-sm-3"><select class="form-control typeControl" name="props[propsId][]">';
        for(var x in idData) {
            str += '<option value="'+x+'">'+idData[x]['msg']+'</option>';
        }
        str += '</select></div><label class="col-sm-2 control-label">数量*: </label><div class="col-sm-2"><input type="text" class="form-control" name="props[num][]" value="1"></div><button type="button" class="btn btn-danger deleteParent" >删除</button></div>';
        $(this).before(str);
    });
</script>
</html>