<!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" >

</head>
<body>
    <div class="container">
        <form action="#" method="post" enctype="multipart/form-data" class="form-horizontal J_ajaxForm">
            <input type="hidden" name="versionid" value="<?php echo $id;?>">
            <input type="hidden" name="sid" value="<?php echo $sid;?>">

            <?php foreach ($list as $k=>$v) { ?>
                <div class="form-group">
                    <label for="exampleInputEmail1">热更新版本号</label>
                    <input type="text" class="form-control"disabled value="<?php echo $v['version'];?>" />
                </div>
                <div class="form-group">
                    <label class="col-sm-1 control-label">强制更新:</label>
                    <div class="col-sm-9">
                        <label class="radio-inline">
                            <input type="radio" disabled <?php if($v['isForce'] == 1) { echo 'checked="checked"';}?> value="1"> 是
                        </label>
                        <label class="radio-inline">
                            <input type="radio" value="0" disabled <?php if($v['isForce'] == 0) { echo 'checked="checked"';}?>> 否
                        </label>
                    </div>
                </div>
                <hr style="border-color: red;" />
                <h4>备注</h4>
                <div class="form-group">
                    <textarea class="form-control remark" disabled ><?php echo $v['remark'];?></textarea>
                </div>
            <?php }?>
            <div class="form-group">
                <label for="exampleInputEmail1">热更新版本号</label>
                <input type="text" class="form-control"  placeholder="subversion" name="subversion" value="<?php echo $ver ?? $version;?>." />
            </div>
            <div class="form-group">
                <label for="isForce">强制更新</label>
                <div class="col-sm-9" style="float: none">
                    <label class="radio-inline">
                        <input type="radio" name="isForce" value="1"> 是
                    </label>
                    <label class="radio-inline">
                        <input type="radio" name="isForce" value="0" checked> 否
                    </label>
                </div>
            </div>
            <hr style="border-color: red;" />
            <h4>备注</h4>
            <div class="form-group">
                <textarea class="form-control remark" name="remark"></textarea>
            </div>
            <button type="button" class="btn btn-default goback" data-dismiss="modal">返回</button>
            <button type="button" class="btn btn-success" id="submit">提交</button>
        </form>
    </div>
</body>

<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="<?php echo base_url();?>public/js/bootstrap/bootstrap.min.js" ></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->

<script type="text/javascript">
    $('.goback').click(function(){
       history.go(-1);
    });

    //判断备注是否没有填写
    $("#submit").click(function(){
      if ($('.remark').val() == '') {
        alert('备注不能为空');
        return false;
      }
      //post提交备注
      var versionid = $("input[name='versionid']").val();
      var subversion = $("input[name='subversion']").val();
      var remark = $("textarea[name='remark']").val();
      var sid = $("input[name='sid']").val();
      var isForce = $("input[name='isForce']").val();
      $.post("<?php echo base_url('gameupdate/actionAddHotFix');?>", {versionid:versionid, subversion:subversion, remark:remark, sid:sid, isForce:isForce},function (data) {
          data = JSON.parse(data);
          if(data.ret == 2){
              alert(data.msg);
          }else{
              window.location.reload();
          }
      });

      return true;
    });
</script>
</html>