<%@ page contentType="text/html; charset=gbk" language="java" %>
<%@ page import="mediastore.web.global.*"%>
<%@ page import="mediastore.web.form.*"%>
<%@ page import="java.util.*"%>


<script language="JavaScript">
function addType()
{
	if(document.form1.newgoodstype.value == null || document.form1.newgoodstype.value == "")
	{
		alert("类型名称不可为空");
	}
	else
	{
		var newgoodstype = document.form1.newgoodstype.value;
		document.form2.action = "goodsPropertyManageAddType.do?newgoodstype="+newgoodstype;
		document.form2.submit();
	}
}
function addClass()
{
	if(document.form1.newgoodsclass.value == null || document.form1.newgoodsclass.value == "")
	{
		alert("分类名称不可为空");
	}
	else
	{
		var newgoodsclass = document.form1.newgoodsclass.value;
		document.form2.action = "goodsPropertyManageAddClass.do?newgoodsclass="+newgoodsclass;
		document.form2.submit();
	}
}
function addShelf()
{
	if(document.form1.newshelfid.value == null || document.form1.newshelfid.value == "")
	{
		alert("货架名称不可为空");
	}
	else
	{
		var newshelfid = document.form1.newshelfid.value;
		document.form2.action = "goodsPropertyManageAddShelf.do?newshelfid="+newshelfid;
		document.form2.submit();
	}
}

function updateGoodsType(goodstype, newgoodstypename)
{
	document.form2.action = "goodsPropertyManageUptGoodsType.do?goodstype="+goodstype+"&newgoodstypename="+newgoodstypename+"&";
	document.form2.submit();
}

function updateGoodsClass(goodsclass, newgoodsclassname)
{
	document.form2.action = "goodsPropertyManageUptGoodsClass.do?goodsclass="+goodsclass+"&newgoodsclassname="+newgoodsclassname+"&";
	document.form2.submit();
}

function updateGoodsShelf(goodsshelfid, newgoodsshelfname)
{
	document.form2.action = "goodsPropertyManageUptGoodsShelf.do?goodsshelfid="+goodsshelfid+"&newgoodsshelfname="+newgoodsshelfname+"&";
	document.form2.submit();
}


function deleteGoodsType(goodstype)
{
	if(confirm("确定要删除该货物类型吗？"))
	{
		document.form2.action = "goodsPropertyManageDelGoodsType.do?deletegoodstype="+goodstype+"&";
		document.form2.submit();
	}
}

function deleteGoodsClass(goodsclass)
{
	if(confirm("确定要删除该分类属性吗？"))
	{
		document.form2.action = "goodsPropertyManageDelGoodsClass.do?deletegoodsclass="+goodsclass+"&";
		document.form2.submit();
	}
}

function deleteGoodsShelfId(goodsshelfid)
{
	if(confirm("确定要删除该货架名称吗？"))
	{
		document.form2.action = "goodsPropertyManageDelGoodsShelf.do?deletegoodsshelfid="+goodsshelfid+"&";
		document.form2.submit();
	}
}





</script>




<table width="768" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td width="5" rowspan="4" class="trtable"></td>
    <td width="6" bgcolor="#214984" height="1"></td>
    <td rowspan="4" bgcolor="#214984" width="1" height="1"></td>
    <td bgcolor="#214984" class="10p" colspan="2" height="1"></td>
    <td rowspan="4" width="1" bgcolor="#214984" height="1"></td>
    <td bgcolor="#214984" width="5" height="1"></td>
    <td width="5" rowspan="4" class="trtable"></td>
  </tr>
  <tr> 
    <td width="6"></td>
    <td width="379" height="20" class="mainhead">货物属性管理</td>
    <td class="mainhead" width="379" height="20">&nbsp;</td>
    <td width="5"></td>
  </tr>
<tr> 
    <td width="6"></td>
    <td valign="top" colspan="2"> 
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
        
        <tr> 
          <td height="300" align="center" valign="top">   

<%
	//---获得传来的参数formbean---
	GoodsPropertyManageFB gpmfb = (GoodsPropertyManageFB)request.getAttribute(Globals.REQUEST_GOODSPROMANAGE);
	List goodsTypeList = gpmfb.getGoodsTypeList();
	List goodsClassList = gpmfb.getGoodsClassList();
	List goodsShelfIdList = gpmfb.getGoodsShelfIdList();
	//----------------------------
	
	
	String [] tmpStrBuf;
%>




<form name="form1" method="post" action="" >
<font color=#215385><b>添加属性</b></font>
<IMG src="images/line1.gif" border=0>
<br>
<input type="hidden" name="start_rec_num"  value="1">

<TABLE width="100%" border="1" cellpadding="3" cellspacing="0" bordercolor="#FFFFFF" class="mailtable">  

<tr>
	<td width="250"><font color=#215385><b>货物类型</b></font></td> <td width="250"><font color=#215385><b>分类属性</b></font></td> <td width="250"><font color=#215385><b>货架名称</b></font></td>
</tr>
<tr>
	<td>
	<font color=#215385>类型名称</font>
	<input type=text name='newgoodstype' size="18" class="none" onKeyDown="if(event.keyCode==13) addType();">
	<input name=addtype type=button value="添加" onClick="addType()">
	</td>
	<td>
	<font color=#215385>分类名称</font>
	<input type=text name='newgoodsclass' size="18" class="none" onKeyDown="if(event.keyCode==13) addClass();">
	<input name=addclass type=button value="添加" onClick="addClass()">
	</td>
	<td>
	<font color=#215385>货架名称</font>
	<input type=text name='newshelfid' size="18" class="none" onKeyDown="if(event.keyCode==13) addShelf();">
	<input name=addshelf type=button value="添加" onClick="addShelf()">
	</td>
</tr>

</TABLE>

</form>

<br>





<form name="form2" method="post" action="" >
<font color=#215385><b>属性列表</b></font>
<IMG src="images/line1.gif" border=0>
<br>
<input type="hidden" name="start_rec_num"  value="1">


<TABLE width="100%" border="1" cellpadding="3" cellspacing="0" bordercolor="#FFFFFF" class="mailtable">  
<br>
<tr>
	<td width="250"><font color=#215385><b>货物类型</b></font></td> <td width="250"><font color=#215385><b>分类属性</b></font></td> <td width="250"><font color=#215385><b>货架名称</b></font></td>
</tr>
<tr>
<td>
	<table width=100%>
		<tr bgcolor="#C2CEDC">
			<td align=center><b>类型代码</b></td>
			<td align=center><b>类型名称</b></td>
			<td align=center><b>删除</b></td>
		</tr>
		<%
	      		for (int i=0; i<goodsTypeList.size(); i++)
			{
	      			tmpStrBuf = (String [])goodsTypeList.get(i);
	      	%>

	        <tr <%if((i%2)==1){%>bgcolor="#CAE4F4"<%}else{%>bgcolor="#F9E4F2"<%}%> >
			<td align=center><%=tmpStrBuf[0]%></td>
			<td align=center><INPUT name="goodstypename" type="text" size=12 value="<%=tmpStrBuf[1]%>" onChange="updateGoodsType('<%=tmpStrBuf[0]%>', this.value)"></td>
			<td align=center>
				<%
					if(tmpStrBuf[2].equals("1"))
					{
				%>
				<a href="javascript:deleteGoodsType('<%=tmpStrBuf[0]%>') "><IMG src="images/delto.gif" border=0></a>
				<%
					}
				%>
			</td>
		</tr>
		<%
			}//for
		%>
	</table>
</td>
<td>
	<table width=100%>
		<tr bgcolor="#C2CEDC">
		<td align=center><b>分类代码</b></td>
		<td align=center><b>分类名称</b></td>
		<td align=center><b>删除</b></td>
		</tr>
		<%
	      		for (int i=0; i<goodsClassList.size(); i++)
			{
	      			tmpStrBuf = (String [])goodsClassList.get(i);
	      	%>

	        <tr <%if((i%2)==1){%>bgcolor="#CAE4F4"<%}else{%>bgcolor="#F9E4F2"<%}%> >
			<td align=center><%=tmpStrBuf[0]%></td>
			<td align=center><INPUT name="goodsclassname" type="text" size=12 value="<%=tmpStrBuf[1]%>" onChange="updateGoodsClass('<%=tmpStrBuf[0]%>', this.value)"></td>
			<td align=center>
				<%
					if(tmpStrBuf[2].equals("1"))
					{
				%>
				<a href="javascript:deleteGoodsClass('<%=tmpStrBuf[0]%>') "><IMG src="images/delto.gif" border=0></a>
				<%
					}
				%>
			</td>
		</tr>
		<%
			}//for
		%>
	</table>
</td>
<td>
	<table width=100%>
		<tr bgcolor="#C2CEDC">
		<td align=center><b>货架代码</b></td>
		<td align=center><b>货架名称</b></td>
		<td align=center><b>删除</b></td>
		</tr>
		<%
	      		for (int i=0; i<goodsShelfIdList.size(); i++)
			{
	      			tmpStrBuf = (String [])goodsShelfIdList.get(i);
	      	%>

	        <tr <%if((i%2)==1){%>bgcolor="#CAE4F4"<%}else{%>bgcolor="#F9E4F2"<%}%> >
			<td align=center><%=tmpStrBuf[0]%></td>
			<td align=center><INPUT name="goodsclassshelf" type="text" size=12 value="<%=tmpStrBuf[1]%>" onChange="updateGoodsShelf('<%=tmpStrBuf[0]%>', this.value)"></td>
			<td align=center>
				<%
					if(tmpStrBuf[2].equals("1"))
					{
				%>
				<a href="javascript:deleteGoodsShelfId('<%=tmpStrBuf[0]%>') "><IMG src="images/delto.gif" border=0></a>
				<%
					}
				%>
			</td>
		</tr>
		<%
			}//for
		%>
	</table>
</td>
</tr>
</table>

</form>





	</td>
        </tr>
        <tr> 
          <td valign="middle" align="center">&nbsp;</td>
        </tr>

      </table>
      
    </td>
    <td width="5"></td>
  </tr>
  <tr> 
    <td width="6"></td>
    <td colspan="2" class="mainhead">&nbsp;</td>
    <td width="5"></td>
  </tr>
  <tr> 
    <td colspan="8" bgcolor="#214984" height="2"></td>
  </tr>
</table>

