<%@page pageEncoding="utf-8" contentType="text/html; charset=utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<%@include file="/WEB-INF/navigation/JsAndCss.jsp" %>
		<link href="/css/glDatePicker.default.css" rel="stylesheet" />
		<script src="/js/html5.js"></script>
		<script src="/datePicker/WdatePicker.js"></script>
		<style>
.basic_msg {
	font-size: 25px;
}

.subscribe_msg {
	font-size: 20px;
}

.issue_msg {
	font-size: 20px;
}

.performance_msg {
	font-size: 20px;
}

div.tabs
{
    width:940px;
	height:35px;
	overflow:hidden;
	padding-left:10px;
	margin-top:10px;
}
div.tabs ul li
{
	float:left;
	padding:0 5px;
}
div.tabs ul li a
{
	display:block;
	width:101px;
	height:36px;
	overflow:hidden;
	line-height:36px;
	text-align:center;
}
div.fee_type input, div.fee_type label
{
    border-width: 0px;
    display: block;
    height: 30px;
    line-height: 27px;
    float: left;
    margin-left: 5px;
}
div.fee_type label
{
    margin-left: 3px;
    margin-right: 5px;
}
div.input_info
{
    width: 580px;
    text-align: left;
    margin-left: 10px;
    float: left;
    height: 40px;
}
div.input_info span.info
{
    display:inline-block;
    width:50px;
}
</style>
<script type="" src="/js/ajaxfileupload.js"></script>
		<script type="text/javascript">
			$(function(){
				$(".basic_msg").css({"fontSize":"25px","color":"#000"});
				$("#product_basic").show();
			});
			
			
			
			function getMinorStrategy(){
				var id=$("#majorStrategy").val();
				
				$.post("findMinorStrategyByMajorStrategyId.do",{"majorStrategyId":id},function(data){
					var obj = document.form.minorStrategy;
					obj.length=1;
					if(data != null){
						for(i=0;i<data.length;i++){
							obj[i+1]=new Option(data[i].title, data[i].subclassId);
						}
					}
				});
				
			}
			function getManager(){
				var id=$("#company").val();
				
				$.post("findManagerByCompany.do",{"companyId":id},function(data){
					var obj = document.form.manager;
					obj.length=1;
					if(data != null){
						for(i=0;i<data.length;i++){
							obj[i+1]=new Option(data[i].realName, data[i].managerId);
						}
					}
				});
				
			}
			function checkExpectedProfit(){
				var reg = /^[1-9]\d*|0$/;
				var expectedProfit = $("#expectedProfit").val();
				if(!reg.test(expectedProfit)){
					$("#expectedProfit").val(0);
				}
			}
			function ajaxFileUpload() {  
	            $.ajaxFileUpload  
	        (  
	            {  
	                url: '/imageUp.jsp',  
	                secureuri: false,  
	                fileElementId: 'netvalueFile',  
	                dataType: 'json',  
	                beforeSend: function() {  
	                    $("#loading").show();  
	                },  
	                complete: function() {  
	                    $("#loading").hide();  
	                },  
	                success: function(data, status) {  
	                	//alert(data.url);
	                    $('#netvalueUri').val(data.url);
	                    $('#net').attr('src',"/"+data.url);
	                },  
	                error: function(data, status, e) {  
	                    alert(e);  
	                }  
	            }  
	        )  
	            return false;  
	        }  
		</script>
</head>
<body>
	<div class="container">
		<div class="navbar">
			<div class="navbar-inner">
				<%@include file="../navigation/menu.jsp"%>
			</div>
		</div>
		<div class="row">
			<%@include file="../navigation/navigation.jsp"%>
			<div class="span9">
			
				<div class="tabs">
					<ul style="list-style-type: none">
						<li><a href="javascript:;" onclick="product_basic()"> <span class="basic_msg">基本信息</span></a></li>
					</ul>
				</div>
				<form id="edit-profile" class="form-horizontal" method="post" action="addProduct.do" name="form" onsubmit="checkExpectedProfit()">
					<legend style="margin-top:15px"></legend>
					<div id="product_basic">
						<div class="control-group">
								<label class="control-label" for="select01">基金类型</label>
								<div class="controls">
									<select id="select01" name="productType">
									<option value="0">--选择基金类型--</option>
									<c:forEach items="${productTypes }" var="productTypes">
										<option value="${productTypes.subclassId }">${productTypes.title }</option>
									</c:forEach>									
										
									</select>
								</div>
							</div>
						<div class="control-group">
							<label class="control-label" for="input01">基金名字</label>
							<div class="controls">
								<input type="text" class="input-xlarge" id="input01" name="productName" />
							</div>
						</div>
						<div class="control-group">
								<label class="control-label" for="input01">基金简称</label>
								<div class="controls">
									<input type="text" class="input-xlarge" id="input01" name="shorterName" />
								</div>
							</div>
						<div class="control-group">
							<label class="control-label" for="input01">产品编码</label>
							<div class="controls">
								<input type="text" class="input-xlarge" id="input01" name="productCode" />
							</div>
						</div>
						
							<div class="control-group">
								<label class="control-label" for="company">所属公司</label>
								<div class="controls">
									<select id="company" name="companyId" onchange="getManager()">
									<option value="0"></option>
									<c:forEach items="${companys }" var="company">
										<option value="${company.companyId }">${company.shorterName }</option>
									</c:forEach>
									
									</select>
								</div>
							</div>
						<div class="control-group">
								<label class="control-label" for="manager">所属经理</label>
								<div class="controls">
									<select id="manager" name="managerId">
										<option value="0"></option>
									</select>
								</div>
							</div>
						
						<div class="control-group">
								<label class="control-label" for="select01">发行平台</label>
								<div class="controls">
									<select id="select01" name="issuePortal">
									<c:forEach items="${issuePortal }" var="issuePortal">
										<option value="${issuePortal.subclassId }">${issuePortal.title }</option>
									</c:forEach>
									
										
									</select>
								</div>
							</div>
						<div class="control-group">
								<label class="control-label" for="yes">结构化</label>
								<div class="input_info fee_type">
									<input type="radio" name="isStructured" checked="checked" id="yes" value="1"/>
                        			<label for="yes">是</label>
                        			<input type="radio" name="isStructured" id="no" value="0"/>
                       		 		<label for="no">否</label>
								</div>
							</div>
						<div class="control-group">
								<label class="control-label" for="yes">备案</label>
								<div class="input_info fee_type">
									<input type="radio" name="isFiling" checked="checked" id="yes" value="1" />
                        			<label for="yes">是</label>
                        			<input type="radio" name="isFiling" id="no" value="0"  />
                       		 		<label for="no">否</label>
								</div>
								
							</div>
						<div class="control-group">
								<label class="control-label" for="select01">监管单位</label>
								<div class="controls">
									<select id="select01" name="supervisionUnits">
									<c:forEach items="${supervisionUnits }" var="supervisionUnits">
										<option value="${supervisionUnits.subclassId }">${supervisionUnits.title }</option>
									</c:forEach>									
										
									</select>
								</div>
							</div>
						<div class="control-group">
							<label class="control-label" for="input07">基金托管人</label>
							<div class="controls">
								<input type="text" class="input-xlarge" id="input07"
									name="custody" />
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" for="input08">证券经纪机构</label>
							<div class="controls">
								<textarea type="text" class="input-xlarge" id="input08"
									name="primeBroker"></textarea>
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" for="input08">期货经纪机构</label>
							<div class="controls">
								<textarea type="text" class="input-xlarge" id="input08"
									name="futureBroker">${product.futureBroker }</textarea>
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" for="input09">基金行政管理人</label>
							<div class="controls">
								<textarea type="text" class="input-xlarge" id="input09"
									name="administrator"></textarea>
							</div>
						</div>
						
						<div class="control-group">
								<label class="control-label" for="select01">MIHF评级</label>
								<div class="controls">
									<select id="select01" name="mihfRating">
									<c:forEach items="${mihf }" var="mihf">
										<option value="${mihf.subclassId }">${mihf.title }</option>
									</c:forEach>
									
										
									</select>
								</div>
							</div>
						<div class="control-group">
							<label class="control-label" for="majorStrategy">投资主策略</label>
							<div class="controls">								
								<select id="majorStrategy" name="majorStrategy" onchange="getMinorStrategy()">
								<option value="0">--请选择投资主策略--</option>
									<c:forEach items="${majorStrategy }" var="majorStrategy">
										<option value="${majorStrategy.subclassId }">${majorStrategy.title }</option>
									</c:forEach>
	
								</select>
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" for="minorStrategy">投资子策略</label>
							<div class="controls">								
								<select id="minorStrategy" name="minorStrategy" >
								<option value="0">--请选择投资子策略--</option>
								<!-- 
									<c:forEach items="${minorStrategy }" var="minorStrategy">
										<option value="${minorStrategy.subclassId }">${minorStrategy.title }</option>
									</c:forEach>
	 -->
								</select>
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" for="input14">投资策略描述</label>
							<div class="controls">
								<textarea type="text" class="input-xlarge" id="input14"
									name="strategyDescription"></textarea>
							</div>
						</div>
						<div class="control-group">
							<label class="control-label" for="input15">投资范围</label>
							<div class="controls">
								<textarea type="text" class="input-xlarge" id="input15"
									name="investmentScope"></textarea>
							</div>
						</div>
						<div class="control-group">
								<label class="control-label" for="select01">主投资地区</label>
								<div class="controls">
									<select id="select01" name="investmentRegion">
									<c:forEach items="${investmentRegion }" var="investmentRegion">
										<option value="${investmentRegion.subclassId }">${investmentRegion.title }</option>
									</c:forEach>
										
									</select>
								</div>
							</div>
							<div class="control-group">
							<label class="control-label" for="expectedProfit">预计收益(%)</label>
							<div class="controls">
								<input type="text" class="input-xlarge" id="expectedProfit"
									name="expectedProfit"/>
							</div>
						</div>
						<div class="control-group">
								<label class="control-label" for="netvalueUri">产品净值图</label>
								<div class="controls">
									<input id="netvalueFile" type="file" name="netvalueFile" class="fimg1"/>
									<input id="netvalueUri" type="hidden" name="netvalueUri"/>
									<button type="button" class="btn btn-primary" onclick="return ajaxFileUpload();">上传图片</button>
									<img id="net"/>
								</div>
								
							</div>
							<div class="control-group">
							<label class="control-label" for="input07">产品亮点</label>
							<div class="controls">
								<input type="text" class="input-xlarge" id="input07"
									name="brightPoint" />
							</div>
						</div>
						<div class="control-group">
								<label class="control-label" for="select01">产品状态</label>
								<div class="controls">
									<select id="select01" name="status">
										<option value="0">已清盘</option>	
										<option value="1" selected>热销中</option>	
										<option value="2">运行中</option>										
									</select>
								</div>
							</div>
							
							<div class="control-group">
							<label class="control-label" for="showStatus">前台显示</label>
								<div class="controls">
									<input type="checkbox"  id="showStatus" name="showStatus" 
										checked value="1"/>
							</div>
						</div>
						<div class="form-actions">
							<button type="submit" class="btn btn-primary">保存</button>
							<button class="btn" type="reset" onclick="history.back()">取消</button>
						</div>
					</div>
					
				</form>
			</div>
		</div>
	</div>
</body>
</html>
