<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ include file="../language.jsp" %>

<script> var _rulePackageNo = '${param.packageNo}'</script>

<script src="../scripts/itsm/rules/editRule.js?random=<%=new java.util.Date().getTime()%>"></script>



<div style="padding:10px" id="editRule_loading"><img src="../images/icons/loading.gif" /></div>


	

<div class="easyui-panel" border="none" fit="true" style="padding:3px;display:none" id="editRule_content">
<!-- 数据列表 -->
<div id="editRuleDiv"  class="easyui-panel" border="none" fit="true">


	<input id="operator" name="operator" value="${param.operator }" type="hidden"/>
	<input id="rulepackageNo" name="rulepackageNo" value="${param.packageNo }" type="hidden"/>
	<form id="editRuleForm">
	<!-- 新的面板 start-->
	
	<div class="easyui-layout" fit="true">
	
		
		<div region="north" border="false" style="overflow:hidden; border-top:#99bbe8 1px solid; border-left:#99bbe8 1px solid; border-right:#99bbe8 1px solid; height:35px;padding:4px; text-align:right">
			<a class="easyui-linkbutton" plain="true" icon="icon-save" style="margin-right:15px" id="editRule_saveRule"><fmt:message key="common.save" /></a>
			<a class="easyui-linkbutton" plain="true" icon="icon-undo" style="margin-right:15px" id="editRule_backToRuleList" ><fmt:message key="common.returnToList" /></a>
		</div>
		
		<!-- 左边规则信息 -->
		<div region="west" split="true" title="<fmt:message key="common.basicInfo" />" style="width:380px;">
		<s:hidden name="rule.condition.rulePatternNo" />
		<s:hidden type="hidden" name="rule.rulePackage.rulePackageNo" />
        <s:hidden name="rule.ruleNo" ></s:hidden>
        <input type="hidden" name="rule.dialect" value="mvel">
		<input type="hidden" name="rule.condition.patternBinding" value="dto">
		<input type="hidden" name="rule.condition.patternType" value="RequestDTO">
		
		
		
			
			<div class="lineTableBgDiv">
			<table style="width:100%" class="lineTable" cellspacing="1">
			

				<tr>
					<td style="width:20%"><fmt:message key="label.rule.ruleName" /></td>
					<td style="width:80%">
					<input name="rule.ruleName" value="${rule.ruleName}" class="easyui-validatebox input" validType="length[1,200]" required="true" />
					</td>
				</tr>
				
				
				
				<tr>
					<td><fmt:message key="label.rule.ruleDecription" /></td>
					<td>
					<textarea name="rule.description" class="easyui-validatebox textarea" validType="length[5,200]" required="true" >${rule.description}</textarea>
					</td>
				</tr>
			
				
			</table>
			</div>

		</div>
		
		<!-- 扩展信息 start -->
		<div region="center" title="<fmt:message key="common.detailInfo" />" style="background:#eee;" >
			<div class="easyui-tabs" fit="true" border="false">
			
				<div title="<fmt:message key="title.rule.ruleSet" />" style="overflow:hidden;padding:3px" >
				
				<div class="easyui-panel" title="<fmt:message key="title.rule.addOrEdirRuleSet" />"  collapsible="false" minimizable="false" maximizable="false" closable="false" style="height:120px">

		<div class="lineTableBgDiv">
			<table style="width:100%" class="lineTable" cellspacing="1">
  <tr>
    <td style="width:25%"><fmt:message key="label.rule.fitStyle" /></td>
    <td style="width:75%">
    

   	  <input id="edit_rule_or" type="radio" name="orand" ${rule.condition.constraints[0].andOr eq 'or'?'checked':''}/><fmt:message key="label.rule.fitOne" />
      <input id="edit_rule_and" type="radio" name="orand" ${rule.condition.constraints[0].andOr eq 'and'?'checked':''}/><fmt:message key="label.rule.fitAll" />
    
    </td>
   
  </tr>
    <tr>
    <td><fmt:message key="label.rule.ruleSetDetail" /></td>
    <td>
    
    
    
    
    
    
    					<table style="width:100%">
					
					<tr>
					<td style="width:15%">
						<select id="editRule_team" ></select>
					</td>
					<td style="width:15%">
						<select id="editRule_matical"></select>
					</td>
					<td style="width:40%">
						<div id="editRule_propertyValueDIV" style="float:left">
							<input id="editRule_propertyValue" size="30" value="" /> 
						</div>
					</td>
					
					<td style="width:30%">
						<a class="easyui-linkbutton" plain="true" icon="icon-ok" style="margin-right: 15px" id="editRule_addRuleToList"><fmt:message key="label.rule.confirm" /></a>
					</td>
					
					</tr>
					
					
					</table>
    

    
    </td>
  </tr>
</table>   	
                    	
</div> 	
				
				
				</div>

				
				<div style="height:3px"></div>
				
				<div class="easyui-panel" title="<fmt:message key="title.rule.ruleSet" />" collapsible="false" minimizable="false" maximizable="false" closable="false" style="height:200px;">
                    	
                    	
                    <div class="lineTableBgDiv">
		<table id="editRule_constraintsTable" style="width:100%" class="lineTable" cellspacing="1">
  <tr>
    <td style="width:25%;font-weight:bold;text-align:center;color:#15428b"><fmt:message key="label.rule.condition" /></td>
    <td style="width:50%;font-weight:bold;text-align:center;color:#15428b"><fmt:message key="label.rule.ruleContent" /></td>
    <td style="width:25%;font-weight:bold;text-align:center;color:#15428b"><fmt:message key="label.rule.operation" /></td>
  </tr>
  <c:if test="${!empty rule.condition }">
  
  <s:iterator value="rule.condition.constraints" var="cs" status="idx">
  
  
  	  <tr id="constraint${cs.conNo}">
		    <td style=";height:28px;text-align:center">
		    <input type="hidden" name="rule_condition_constraints_dataType" value="${cs.dataType }">
		    <input type="hidden" name="rule_condition_constraints_conNo" value="${cs.conNo}"/>
		    
		    <script>
		    var pname="${cs.propertyName}";
		    var id="#${idx.count}_editcpn";
		    itsm.rules.editRule.switchRuleNameActionName(pname,id);
		    </script>
		    
		    <div id="${idx.count}_editcpn"></div>
		    
		    <input type="hidden" name="rule_condition_constraints_propertyName" value="${cs.propertyName}" >
		 
		    
		    
		    
		    </td>
		    <td style="text-align:center">${cs.propertyValueName}
		    <input type="hidden" name="rule_condition_constraints_propertyValueName" value="${cs.propertyValueName}" >
		    <input type="hidden" name="rule_condition_constraints_propertyValue" value="${cs.propertyValue}" >
		    
		    </td>
		    <td style=";text-align:center">
		    <img src="../images/icons/delete.gif" style="cursor:pointer;margin:0px" onclick="itsm.rules.ruleCM.removeRow('#constraint${cs.conNo}')"/>
		    </td>
	</tr>
  
  </s:iterator>
  
  
  </c:if>
</table>   	
                    	
</div> 	
                    	
                    	

				</div>

				</div>
				
				
				
				<c:if test="${param.tag!='autoUpdate'}">
				
					<div title="<fmt:message key="title.rule.actionSet" />" style="overflow: hidden; padding: 3px">






	<div class="easyui-panel" title="<fmt:message key="title.rule.addOrEditActionSet" />" collapsible="false" minimizable="false" maximizable="false" closable="false" style="height: 120px">



		<div class="lineTableBgDiv">
			<table style="width:100%" class="lineTable" cellspacing="1">
				<tr>
					<td style="width: 25%"><fmt:message key="label.rule.actionType" /></td>
					<td style="width: 75%">
					    <select style="font-size:12px"  id="editRule_executeAction"></select>
					</td>
				</tr>
				<tr>
					<td><fmt:message key="label.rule.actionDetail" /></td>
					<td>
					  
					  
					  
					  
					  <table width="100%">
					
					<tr>
					<td style="width:60%">
						<div id="editRule_givenValueDIV">
							<input id="editRule_givenValue_Panel" style='width:100%;cursor:pointer;color:#555555' readonly/>
							<input type="hidden" id="editRule_givenValue" />
						</div>
					</td>
					
					<td style="width:40%">
						<a class="easyui-linkbutton" plain="true" icon="icon-ok" style="margin-right: 15px" id="editRule_addActionsToList"><fmt:message key="label.rule.confirm" /></a>
					</td>
						
					</tr>
					
					</table>
					  
					  
					  
					  
					  
					  
					
					</td>
				</tr>
			</table>
		</div>


	</div>



<div style="height:3px"></div>

	<div class="easyui-panel" title="<fmt:message key="title.rule.actionSet" />" collapsible="false" minimizable="false" maximizable="false" closable="false" style="height: 200px;">
		<div class="lineTableBgDiv">
		<table id="editRule_actionTable" style="width:100%" class="lineTable" cellspacing="1">
				<tr>
					<td style="width: 25%; font-weight: bold; text-align: center; color: #15428b"><fmt:message key="label.rule.actionType" /></td>
					<td style="width: 50%; font-weight: bold; text-align: center; color: #15428b"><fmt:message key="label.rule.actionDetail" /></td>
					<td style="width: 25%; font-weight: bold; text-align: center; color: #15428b"><fmt:message key="label.rule.operation" /></td>
				</tr>
				
				
			  <c:if test="${!empty rule.actions }">
 
			  <s:iterator value="rule.actions" var="rc" status="idx">
			  
			  <tr id="action${rc.actionNo}">
			    <td style=";height:28px;text-align:center">
			    <input type="hidden" name="rule_actions_dataType" value="${rc.dataType}">
			    <input type="hidden" name="rule_actions_actionNo" value="${rc.actionNo}" />
			    
			    
			    
			    <script>
			    var pname="${rc.propertyName}";
			    var id="#${idx.count}_editacpn";
			    itsm.rules.editRule.switchRuleNameActionName(pname,id);
			    </script>
			    
			    <div id="${idx.count}_editacpn"></div>
			    
			    <input type="hidden" style="border:none" name="rule_actions_propertyName" value="${rc.propertyName}" readonly/>
			
			    </td>
			    <td style=";text-align:center">${rc.givenName}
			    <input type="hidden" name="rule_actions_givenValue" value="${rc.givenValue}" readonly>
			    <input type="hidden" name="rule_actions_givenName" value="${rc.givenName}" readonly>

			    </td>
			    <td style=";text-align:center">
			    	<img src="../images/icons/delete.gif" style="cursor:pointer;margin:0px" onclick="itsm.rules.ruleCM.removeRow('#action${rc.actionNo}')" />
			    </td>
			  </tr>
			  </s:iterator>
			  </c:if>
				
				
				
			</table>
		</div>
	</div>


	</div>
				

</c:if>
				
			</div>
		</div>
	</div>

</form>
</div>














<!-- 选择服务机构 -->
<div id="editRuleSeclceServicesOrgDIV" title="<fmt:message key="title.rule.chooseServiceOrg" />" class="easyui-window"  closed="true" collapsible="false" minimizable="false" maximizable="false" modal="true" style="width:200px;height:280px; padding:10px; line-height:20px;" >
	
	
	<div id="editRuleSeclceServicesOrgTreeDIV"></div>
	
</div>


</div>


