<!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="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="advertisement/editAction" 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>

                                        <?php foreach ($info['channel'] as $row){?>
                                            <div class="form-group">
                                                <label class="col-sm-2 control-label">(<?php echo $row;?>)真实ID*: </label>
                                                <div class="col-sm-3">
                                                    <input type="text"  class="form-control"  name="trueId[<?php echo $row;?>]" value="<?php echo $info['trueId'][$row];?>">
                                                </div>
                                                <label class="col-sm-1 control-label">(ios)*: </label>
                                                <div class="col-sm-3">
                                                    <input type="text"  class="form-control"  name="trueId_ios[<?php echo $row;?>]" value="<?php echo $info['trueId_ios'][$row];?>">
                                                </div>
                                                <label class="col-sm-1 control-label">权重*: </label>
                                                <div class="col-sm-1">
                                                    <input type="text"  class="form-control"  name="weights[<?php echo $row;?>]" min="0" value="<?php echo $info['weights'][$row]??1;?>">
                                                </div>
                                            </div>
                                        <?php } ?>

                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">默认渠道*:</label>
                                            <div class="col-sm-2">
                                                <?php foreach ($info['channel'] as $row){?>
                                                <label class="radio-inline">
                                                    <input type="radio" name="defChannel"  value="<?php echo $row;?>" <?php if($info['defChannel'] == $row) { ?>checked <?php }?> /> <?php echo $row;?>
                                                </label>
                                                <?php } ?>
                                            </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">
                                                <?php
                                                    if($info['reward']['specialReward']){
                                                        echo '<input type="text" readonly class="form-control"  name="" value="'.$info['reward']['tips'].'">';
                                                    }else{
                                                        if(isset($info['reward']['reward']['money'])){
                                                            echo '<label class="col-sm-3 control-label">金币 </label><div class="col-sm-9"><input type="text" class="form-control"  name="money" value="'.$info['reward']['reward']['money'].'"></div></div';
                                                        }
                                                        if(isset($info['reward']['reward']['spins'])){
                                                            echo '<label class="col-sm-3 control-label">体力 </label><div class="col-sm-9"><input type="text" class="form-control"  name="spins" value="'.$info['reward']['reward']['spins'].'"></div></div';
                                                        }
                                                    }
                                                ?>
                                            </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>
                                        </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'] == 2) { ?>checked <?php }?> /> 安卓开
                                                </label>
                                                <label class="radio-inline">
                                                    <input type="radio" name="status"  value="1" <?php if($info['status'] == 1) { ?>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">
                                            <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>
<script>
    $('.goback').click(function(){
        history.go(-1);
    });

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