<!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">
    <script src="<?php echo base_url();?>public/js/vendor/select2/select2.full.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="ad/action" data-callBack="message">
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">广告ID*: </label>
                                        <div class="col-sm-2">
                                            <input type="text" readonly class="form-control"  name="id" value="<?php echo $info['id'];?>">
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">名称*: </label>
                                        <div class="col-sm-3">
                                            <input type="text" class="form-control"  name="name" value="<?php echo $info['name'];?>">
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">奖励*: </label>
                                        <div class="col-sm-3">
                                            <table class="col-sm-12">
                                                <tr>
                                                    <td class="formPropsRewardsTag" data-value='<?echo $info["reward"]?>' data-name="reward"></td>
                                                    <td class="text-right">
                                                        <button type="button"
                                                                class="btn btn-outline btn-success"
                                                                onclick="propsJs.initEdit(this, 'formPropsRewardsTag')">
                                                            奖励配置
                                                        </button>
                                                    </td>
                                                </tr>
                                            </table>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">最大数量*:</label>
                                        <div class="col-sm-1">
                                            <input type="text" class="form-control" placeholder="最大数量" name="max" value="<?php echo $info['max'];?>">
                                        </div>
                                        <label class="col-sm-2 control-label">CD(秒)*:</label>
                                        <div class="col-sm-1">
                                            <input type="number" class="form-control" placeholder="间隔时间" min="0" name="cd" value="<?php echo $info['cd'];?>">
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">广告状态*:</label>
                                        <div class="col-sm-2">
                                            <label class="radio-inline">
                                                <input type="radio" name="status"  value="3" <?php if($info['status'] == 3) { ?>checked <?php }?> /> 全开
                                            </label>
                                            <label class="radio-inline">
                                                <input type="radio" name="status"  value="2" <?php if($info['status'] == 1) { ?>checked <?php }?> /> 安卓开
                                            </label>
                                            <label class="radio-inline">
                                                <input type="radio" name="status"  value="1" <?php if($info['status'] == 2) { ?>checked <?php }?> /> IOS开
                                            </label>
                                            <label class="radio-inline">
                                                <input type="radio" name="status"  value="0" <?php if($info['status'] == 0) { ?>checked <?php }?> /> 关
                                            </label>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="col-sm-2 control-label">目标群组*:</label>
                                        <div class="col-sm-12">
                                            <select name="groups[]" class="select2 form-control" multiple>
                                                <?php foreach ($shushuGroups as $gid => $group){?>
                                                    <option <?php if(in_array($gid, $info['groups'])){echo 'selected';}?> value="<?=$gid?>"><?=$group?></option>
                                                <?php } ?>
                                            </select>
                                        </div>
                                    </div>



                                    <div class="form-group">
                                        <div class="col-sm-offset-2 col-sm-3">
                                            <button type="button" class="btn btn-info goback">返回</button>
                                            <button type="button" class="btn btn-primary J_ajaxSubmitBtn">提交</button>
                                        </div>
                                    </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/plugins/validate/jquery.validate-1.15.0.min.js"></script>
<script src="<?php echo base_url();?>public/plugins/validate/jaquery.validate.messages_zh.js"></script>
<script src="<?php echo base_url();?>public/js/common.js"></script>
<!--select2-->
<link rel="stylesheet" href="<?php echo base_url();?>public/js/vendor/select2/select2.min.css">
<script src="<?php echo base_url();?>public/js/vendor/select2/select2.full.min.js"></script>
<script>
    propsJs.initTag('formPropsRewardsTag','func')
    $('.select2').select2({})

    $('.goback').click(function(){
        history.go(-1);
    });

    function message(returnData, $from) {
        alert(returnData.msg);
        if(returnData.state!= 'success'){
            alert(returnData.msg);
        }else{
            // window.location.reload();
        }
    }
</script>
</html>