<?php include_once(mvc::$cfg['PATH_TPL'].'public/headBase.php');?>
<div class="marauto" id="add_app_version">
	<form action="<?php echo mvc::$cfg['ADMIN_URI'];?>pjlSys/addAppVersion" method="post" id="add_form">
		<table class="table">
			<tr>
				<th width="100px">APP类型</th>
				<td>
					<select class="form-control" name="ver_from">
						<?php if(!empty($appNameArr)){?>
						<?php foreach($appNameArr as $k=>$v){?>
						<option <?php if($data['ver_from']==$k){echo 'selected';}?> value="<?php echo $k;?>"><?php echo $v;?></option>
						<?php }?>
						<?php }?>
					</select>
				</td>
			</tr>
			<tr>
				<th>版本号</th>
				<td><input type="text" autocomplete="off" name="ver_version" value="<?php echo $data['ver_version'];?>" class="form-control" placeholder="1.0.1"></td>
			</tr>
			<tr>
				<th>版本代码</th>
				<td><input type="text" autocomplete="off" name="ver_version_code" value="<?php echo $data['ver_version_code'];?>" class="form-control"></td>
			</tr>
			<tr>
				<th>版本号数值型</th>
				<td><input type="text" autocomplete="off" id="ver_int" value="<?php echo $data['ver_version_int'];?>" name="ver_version_int" class="form-control" placeholder="以日期为参考"></td>
			</tr>
			<tr>
				<th>是否正常发布</th>
				<td>
					<label>正常<input type="radio" <?php if(!isset($data['ver_status'])){echo 'checked';}?> <?php if($data['ver_status']>0){echo 'checked';}?> name="ver_status" value="1"></label>
					<label>暂停<input type="radio" <?php if(isset($data['ver_status'])&&$data['ver_status']<1){echo 'checked';}?> name="ver_status" value="0"></label>
				</td>
			</tr>
			<tr>
				<th>是否强制更新</th>
				<td>
					<label><input type="checkbox" name="ver_update" <?php if(!empty($data['ver_update'])){echo 'checked';}?> value="1"></label>
				</td>
			</tr>
			<tr>
				<th>强制浏览器下载</th>
				<td><label><input type="checkbox" name="var_browser" <?php if(!empty($data['var_browser'])){echo 'checked';}?> value="1"></label></td>
			</tr>
			<tr>
				<th>内部测试版本</th>
				<td><label><input type="checkbox" name="ver_istest" <?php if(!empty($data['ver_istest'])){echo 'checked';}?> value="1"></label>
					<span class="gray">联系技术部绑定测试账号才可以使用</span>
				</td>
			</tr>
			<tr>
				<th>已上应用市场</th>
				<td>
					<label><input type="checkbox" name="ver_huawei" <?php if(!empty($data['ver_huawei'])){echo 'checked';}?> value="1">华为</label>&nbsp;&nbsp;&nbsp;&nbsp;
					<label><input type="checkbox" name="ver_xiaomi" <?php if(!empty($data['ver_xiaomi'])){echo 'checked';}?> value="1">小米</label>&nbsp;&nbsp;&nbsp;&nbsp;
					<label><input type="checkbox" name="ver_oppo" <?php if(!empty($data['ver_oppo'])){echo 'checked';}?> value="1">OPPO</label>&nbsp;&nbsp;&nbsp;&nbsp;
					<label><input type="checkbox" name="ver_vivo" <?php if(!empty($data['ver_vivo'])){echo 'checked';}?> value="1">VIVO</label>&nbsp;&nbsp;&nbsp;&nbsp;
					<label><input type="checkbox" name="ver_meizu" <?php if(!empty($data['ver_meizu'])){echo 'checked';}?> value="1">魅族</label>&nbsp;&nbsp;&nbsp;&nbsp;
					<label><input type="checkbox" name="ver_samsung" <?php if(!empty($data['ver_samsung'])){echo 'checked';}?> value="1">三星</label>&nbsp;&nbsp;&nbsp;&nbsp;
					<label><input type="checkbox" name="ver_lenovo" <?php if(!empty($data['ver_lenovo'])){echo 'checked';}?> value="1">联想</label>&nbsp;&nbsp;&nbsp;&nbsp;
					<label><input type="checkbox" name="ver_360" <?php if(!empty($data['ver_360'])){echo 'checked';}?> value="1">360</label>&nbsp;&nbsp;&nbsp;&nbsp;
				</td>
			</tr>
			<tr>
				<th>下载地址</th>
				<td><textarea name="ver_url" rows="3" class="form-control" placeholder="链接地址"><?php echo $data['ver_url'];?></textarea></td>
			</tr>
			<tr>
				<th>升级说明</th>
				<td><textarea name="ver_info" class="form-control" placeholder="升级说明"><?php echo $data['ver_info'];?></textarea></td>
			</tr>
		</table>
		<input type="hidden" name="ver_id" value="<?php echo $data['ver_id'];?>">
	</form>
	<div class="add_app_foot"><button type="button" class="btn su_btn btn-primary">保存</button></div>
</div>
<script type="text/javascript" src="<?php echo mvc::$cfg['ADMIN_URL'];?>static/laydate/laydate.js?ver=1.0.0"></script>
<script type="text/javascript">
	$(document).ready(function(){
		laydate.render({ 
		    elem: '#ver_int',
		    type:'datetime'
		    ,format: 'yyyyMMddHH', //可任意组合
		});
		$('.su_btn').click(function(){
			var form=$('#add_form');
			var arr=['ver_version','ver_int'];
			for(var i in arr){
				var inp=form.find('input[name="'+arr[i]+'"]');
				var val=inp.val();
				switch (arr[i]) {
					case 'ver_version':
						if($.trim(val)==''){
							MESSAGE.alert('版本号不能为空');
							inp.focus();
							return false;
						}
						break;
					case 'ver_version_int':
						if($.trim(val)==''){
							MESSAGE.alert('版本号数值型不能为空');
							inp.focus();
							return false;
						}
						break;
				}
				
			}
			form.submit();
		})
	})
</script>