<include file="public@header" />
</head>
<body>
	<div class="wrap">
		<ul class="nav nav-tabs">
			<li><a href="{:url('cooperation/index')}">所有合作伙伴</a></li>
			<li class="active"><a href="{:url('cooperation/add')}">添加合作伙伴</a></li>
		</ul>
		<form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('cooperation/addPost')}">
			<div class="form-group">
				<label for="input-name" class="col-sm-2 control-label">名称<span class="form-required">*</span></label>
				<div class="col-md-6 col-sm-10">
					<input type="text" required class="form-control" id="input-name" name="name">
				</div>
			</div>
			<div class="form-group">
				<label for="thumbnail" class="col-sm-2 control-label">图片<span class="form-required">*</span></label>
				<div class="col-md-6 col-sm-10">
					<input type="text" class="form-control" id="thumbnail" name="image">
					<a href="javascript:uploadOneImage('图片上传','#thumbnail');">
						<img src="__TMPL__/public/assets/images/default-thumbnail.png"
							 id="thumbnail-preview"
							 width="135" height="60" style="cursor: pointer"/>
					</a>
					<input type="button" class="btn btn-sm btn-cancel-thumbnail" value="取消图片">
					<a href="javascript:uploadOneImage('图片上传','#thumbnail');">上传图片</a>
				</div>
			</div>
			<div class="form-group">
				<label for="input-weigh" class="col-sm-2 control-label">权重</label>
				<div class="col-md-6 col-sm-10">
					<input type="number" class="form-control" id="input-weigh" name="weigh" value="0">
				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-offset-2 col-sm-10">
					<button type="submit" class="btn btn-primary js-ajax-submit">{:lang('ADD')}</button>
					<a class="btn btn-default" href="javascript:history.back(-1);">{:lang('BACK')}</a>
				</div>
			</div>
		</form>
	</div>
	<script src="__STATIC__/js/admin.js"></script>
</body>
</html>

<script type="text/javascript">
    $(function () {
        $('.btn-cancel-thumbnail').click(function () {
            $('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
            $('#thumbnail').val('');
        });
    });
</script>