<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ include file="../../language.jsp" %>

<%
	String timeStr=new java.util.Date().getTime()+"";
	String eav=timeStr.substring(6,timeStr.length());
%>



<script src="../scripts/itsm/config/eav/eavCi.js?random=<%=new java.util.Date().getTime()%>"></script>
<script type="text/javascript">itsm.config.eav.eavCi.eavAttrsList();</script>
<div class="loading" id="eavCi_loading"><img src="../images/icons/loading.gif" /></div>

<div class="content" id="eavCi_panel">

	<table id="eavCiList"></table>
    <div id="eavCiPager"></div>
    <div id="eavCiToolbar" style="display:none">
    	<sec:authorize url="/pages/eav!saveEavEntity.action">
		<a class="easyui-linkbutton" plain="true" icon="icon-add" onclick="itsm.config.eav.eavCi.addEav()"><fmt:message key="common.add"/></a>
		</sec:authorize>
		<sec:authorize url="/pages/eav!updateEavEntity.action">
		<a class="easyui-linkbutton" plain="true" icon="icon-edit" onclick="itsm.config.eav.eavCi.editEav()"><fmt:message key="common.edit"/></a>
		</sec:authorize>
		<sec:authorize url="/pages/eav!deleteEavEntity.action">
		<a class="easyui-linkbutton" plain="true" icon="icon-cancel" onclick="itsm.config.eav.eavCi.deleteEav()"><fmt:message key="common.delete"/></a>
		</sec:authorize>
    </div>
	    
	    
    <div style="height:3px"></div>
	    
    <table id="eavAttrsList"></table>
    <div id="eavAttrsPager"></div>
    <div id="eavAttrsToolbar" style="display:none">
    	<sec:authorize url="/pages/attrs!save.action">
		<a class="easyui-linkbutton" plain="true" icon="icon-add" onclick="itsm.config.eav.eavCi.openAttrsDiv()"><fmt:message key="common.add"/></a>
		</sec:authorize>
		<sec:authorize url="/pages/attrs!update.action">
		<a class="easyui-linkbutton" plain="true" icon="icon-edit" onclick="itsm.config.eav.eavCi.openEditAttrsDiv()"><fmt:message key="common.edit"/></a>
		</sec:authorize>
		<sec:authorize url="/pages/attrs!delete.action">
		<a class="easyui-linkbutton" plain="true" icon="icon-cancel" onclick="itsm.config.eav.eavCi.deleteEavAttrs()"><fmt:message key="common.delete"/></a>
		</sec:authorize>
    </div>
    
    
    <!-- 添加 -->
	<div id="addEavCiDiv" class="easyui-window" closed="true" collapsible="false" minimizable="false" maximizable="false" modal="true" title="<fmt:message key="common.add"/>/<fmt:message key="common.edit"/>" style="width:400px;height:auto">
		<form id="addEavCiDivForm">	
			 <input type="hidden" name="eavEntityDTO.eavNo" id="add_eavNo"  />
			 <div class="lineTableBgDiv" >
    			<table class="lineTable" cellspacing="1"> 
				<tr>
					<td><fmt:message key="label.name"/></td>
					<td><input name="eavEntityDTO.eavName" id="add_eavName" class="easyui-validatebox input" required="true"/></td>
				</tr>
				<tr>
					<td><fmt:message key="label.common.desc"/></td>
					<td><input name="eavEntityDTO.desc" id="add_entityDesc" class="input" /></td>
				</tr>
				<tr>
					<td colspan="2">
						<br>
						<a class="easyui-linkbutton" plain="false" icon="icon-add" onclick="itsm.config.eav.eavCi.saveEav()" ><fmt:message key="common.save"/></a>
					</td>
				</tr>
			</table>
			</div>
		</form>
	</div>
    
    
    <!--添加扩展属性 -->
	<div id="addAttrDiv" class="easyui-window" closed="true" collapsible="false" minimizable="false" maximizable="false" modal="true" title="<fmt:message key="common.add"/><fmt:message key="common.extendedAttribute"/>" style="width:400px;height:auto">
		<form id="addAttrForm">	
			 <div class="lineTableBgDiv" >
    			<table class="lineTable" cellspacing="1"> 
				<tr>
					<td><fmt:message key="label.role.roleName"/></td>
					<td><input name="attributesDTO.attrAsName" id="add_attrAsName" style="width:96%" class="easyui-validatebox" required="true"/></td>
				</tr>
			
				<tr>
					<td><fmt:message key="label.type"/></td>
					<td>
						<select name="attributesDTO.attrType" class="input">
							<option value="String"><fmt:message key="label.text"/></option>
							<option value="Lob"><fmt:message key="label.longText"/></option>
						</select>
					</td>
				</tr>
				<tr>
					<td><fmt:message key="label.length"/></td>
					<td><input name="attributesDTO.length" id="add_length" class="easyui-numberbox input"/></td>
				</tr>
				<tr>
					<td colspan="2">
						<input type="hidden" name="attributesDTO.attrName" id="add_attrName" value="eav_<%=eav%>"/>
						<a class="easyui-linkbutton" plain="false" icon="icon-add" onclick="itsm.config.eav.eavCi.saveAttrs()" ><fmt:message key="common.add"/></a>
					</td>
				</tr>
			</table>
			</div>
		</form>
	</div>
	
	
	<!--编辑扩展属性 -->
	<div id="editAttrDiv" class="easyui-window" closed="true" collapsible="false" minimizable="false" maximizable="false" modal="true" title=<fmt:message key="common.edit"/><fmt:message key="common.extendedAttribute"/> style="width:400px;height:auto">
		
		<form id="editAttrForm"> 	
			
			
			
			<div class="lineTableBgDiv" >
    			<table class="lineTable" cellspacing="1"> 
		
				<tr>
					<td><fmt:message key="label.name"/></td>
					<td><input name="attributesDTO.attrAsName" id="edit_attrAsName" class="easyui-validatebox input" required="true"/></td>
				</tr>
				
				<tr>
					<td><fmt:message key="label.type"/></td>
					<td>
						<select name="attributesDTO.attrType" id="edit_attrType" class="input">
							<option value="String"><fmt:message key="label.text"/></option>
							<!-- 
							<option value="Integer"><fmt:message key="label.integer"/></option>
							<option value="Double"><fmt:message key="label.decimal"/></option>
							<option value="Date"><fmt:message key="common.date"/></option>
							-->
							<option value="Lob"><fmt:message key="label.longText"/></option>
						</select>
				</tr>
				<tr>
					<td><fmt:message key="label.length"/></td>
					<td><input name="attributesDTO.length" id="edit_length" class="easyui-numberbox input"/></td>
				</tr>
				<tr>
					<td colspan="2">
						<input type="hidden" name="attributesDTO.attrName" id="edit_attrName" />
						<input type="hidden" name="attributesDTO.attrNo" id="edit_attrNo">
						<a class="easyui-linkbutton" icon="icon-save" onclick="itsm.config.eav.eavCi.editSaveAttrs()" ><fmt:message key="common.save"/></a>
					</td>
				</tr>
			</table>
		</div>
		</form>
	</div>
	
	
 </div>