<%@ Page Language="C#" AutoEventWireup="false" CodeBehind="ProductCustomField.aspx.cs" Inherits="web.admin.ProductCustomField" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
	<HEAD>
		<title>ProductCustomField</title><meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
		<LINK href="images/adminstyle.css" type="text/css" rel="stylesheet"></LINK>
				<script language="JavaScript">
<!--
//By Dicky 2005-2-17 11:16:49
function Window_Load(Flag)
{

if (Flag == 0)
{

  parent.document.all['Loading'].style.display = 'block';
  parent.document.all['Loading'].style.width = '500';
   parent.document.all['Loading'].style.height = '60';
  //show the window
}
else
{
  parent.document.all['Loading'].style.display = 'none';
  
  //hide the window
}
}
//-->
</script>
		<script language="javascript">
			function selectType()
			{
				if(document.Form1.ddlTypes.value == "1")
				{
					eval("type1" + ".style.display=\"\";");
					eval("type2" + ".style.display=\"none\";");
				}
				else
				{
					eval("type1" + ".style.display=\"none\";");
					eval("type2" + ".style.display=\"\";");
				}
			}
			function newCustomField()
			{
				if(document.Form1.ddlCustomFieldNames.value == "0")
				{
					eval("newFieldName" + ".style.display=\"\";");
				}
				else
				{
					eval("newFieldName" + ".style.display=\"none\";");
				}
			}
			
			function finish()
			{
				window.close();
				opener.focus();
			}
		</script>
	</HEAD>
		<body rightmargin="0" leftmargin="0" topmargin="0" onload="Window_Load(1);">
	
		<form id="Form1" method="post" runat="server" onsubmit="Window_Load(0);">
			<div class="top">
          
    <table width="100%" align="center" cellpadding="0" cellspacing="0" background="img/labelbg.gif" bgcolor="#EDF6FF">
      <tr>
		      <td height="34" class="tl"></td>
		<td class="tm"><span class="tt">商品管理 &gt;&gt; 商品扩展配件管理</span></td>
		      <td class="tm2"><span class="tt"></span></td>
		<td class="tr"></td>
	</tr>
</table>
</div>
            <br />
			
			
  <table class="tableBorder" cellSpacing="0" cellPadding="0" width="96%" align="center" border="0">
    <tr> 
      <th height="35" align="left" background="img/labelbg.gif" class="tableHeaderText"> 
        &nbsp;&nbsp; 店铺附送物品管理 <a href="#" target="_blank"></a>&nbsp; </th>
  </table>
            <br />
			
  <table  cellSpacing="1" cellPadding="1" width="96%" align="center" border="0">
    <tr>
					<td class="forumRowHighlight"><asp:datagrid id="dgCustomField" runat="server" Width="100%" HeaderStyle-CssClass="summary-title"
							HorizontalAlign="Left" DataKeyField="ProductCustomFieldID" AutoGenerateColumns="False" PagerStyle-Mode="NumericPages" BorderColor="#C0C0FF" BorderWidth="1px" CellPadding="4" GridLines="None" BorderStyle="Solid">
							<Columns>
								<asp:TemplateColumn HeaderText="物品类名称">
									<HeaderStyle HorizontalAlign="Center" Width="80px" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False"></HeaderStyle>
									<ItemTemplate>
										<asp:TextBox ID="CustomField" Runat="server" Width="80px" Text='<%# DataBinder.Eval(Container.DataItem, "FieldName") %>'>
										</asp:TextBox>
									</ItemTemplate>
                                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Top" Width="80px" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" />
								</asp:TemplateColumn>
								<asp:TemplateColumn HeaderText="多选">
									<HeaderStyle HorizontalAlign="Center" Width="40px"></HeaderStyle>
									<ItemTemplate>
										<asp:CheckBox ID="isMultiple" Runat="server" Checked='<%# DataBinder.Eval(Container.DataItem, "Multiple").ToString() == "1" ? true : false %>'>
										</asp:CheckBox>
									</ItemTemplate>
                                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Top" Width="30px" Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" />
								</asp:TemplateColumn>
								<asp:TemplateColumn Visible="False" HeaderText="数量">
									<HeaderStyle HorizontalAlign="Center" Width="30px"></HeaderStyle>
									<ItemTemplate>
										<asp:CheckBox ID="isCountable" Runat="server" Checked='<%# DataBinder.Eval(Container.DataItem, "Countable").ToString() == "1" ? true : false %>'>
										</asp:CheckBox>
									</ItemTemplate>
                                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Top" Width="30px" />
								</asp:TemplateColumn>
								<asp:TemplateColumn HeaderText="物品名">
									<HeaderStyle HorizontalAlign="Left"></HeaderStyle>
									<ItemTemplate>
						<br />				<br />
              <table width="100%" cellpadding="3" cellspacing="0" border="0"><tr >
                <asp:Repeater ID="rptFieldItems" Runat="server" DataSource='<%# GetFieldItems(DataBinder.Eval(Container.DataItem, "ProductCustomFieldID").ToString()) %>' >
											
												
												
													<ItemTemplate >
														<td >(<%# Container.ItemIndex + 1 %>)&nbsp;&nbsp;<%# DataBinder.Eval(Container.DataItem, "ItemName") %>&nbsp;&nbsp;价格：<%# DataBinder.Eval(Container.DataItem, "Price") %><a href='Actions.aspx?Action=DFieldItem&ItemID=<%# DataBinder.Eval(Container.DataItem, "CustomFieldItemID") %>&pid=<%=Request.QueryString["productid"]%>'>&nbsp;&nbsp;[ 删除 ]</a></td>
												</ItemTemplate>
													
												
											</asp:Repeater>
										</tr></table>
									</ItemTemplate>
                                    <ItemStyle HorizontalAlign="Left" VerticalAlign="Top" />
								</asp:TemplateColumn>
								<asp:ButtonColumn HeaderText="操作"
									CommandName="Update" Text="修改">
                                    <HeaderStyle HorizontalAlign="Center" Width="30px" />
                                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Top" Width="30px" />
                                </asp:ButtonColumn>
								<asp:ButtonColumn HeaderText="删除" CommandName="Delete"
									Text="&lt;div id=&quot;de&quot; onclick=&quot;javascript:return confirm('真的要删除吗？')&quot;&gt;删除&lt;/div&gt;">
                                    <HeaderStyle HorizontalAlign="Center" Width="30px" />
                                    <ItemStyle HorizontalAlign="Center" VerticalAlign="Top" Width="30px" />
                                </asp:ButtonColumn>
							</Columns>
                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                        <ItemStyle Height="23px" HorizontalAlign="Center" BackColor="#EFF3FB" />
                        <HeaderStyle BackColor="ControlLight" CssClass="summary-title" Height="28px" Font-Bold="True" ForeColor="Gray" />
                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <SelectedItemStyle BackColor="#D1DDF1" ForeColor="#333333" Font-Bold="True" />
                        <AlternatingItemStyle BackColor="White" />
                        <EditItemStyle BackColor="#2461BF" />
						</asp:datagrid></td>
				</tr>
			</table>
            <br />
			
  <table class="tableBorder" cellSpacing="0" cellPadding="0" width="96%" align="center" border="0">
    <tr> 
      <th height="35" align="left" background="img/labelbg.gif" class="tableHeaderText"> 
        &nbsp;&nbsp; &nbsp;&nbsp; 店铺附送物品添加 <a href="#" target="_blank"></a>&nbsp; </th>
    
  </table>
            <br />
			
  <table  cellSpacing="1" cellPadding="1" width="96%" align="center" border="0">
    <tr>
					<td>
						<table class="tableBorder" cellSpacing="0" cellPadding="6" width="100%" align="center" border="0">
          <tr>
								
            <td align="right" width="150" style="height: 42px">物品类名称： </td>
								<td style="height: 42px"><asp:dropdownlist id="ddlCustomFieldNames" runat="server"></asp:dropdownlist>&nbsp;&nbsp;<SPAN id="newFieldName" style="DISPLAY: none"><asp:textbox id="txtNewFieldName" Width="120px" Runat="server"></asp:textbox>
										<br>
                                    <br />
										<asp:checkbox id="cbxMultiple" Runat="server" Text="多选"></asp:checkbox>
										<asp:checkbox id="cbxCountable" Runat="server" Text="允许多数量" Visible="false"></asp:checkbox>
                                    &nbsp; &nbsp;<span style="color: #ff3333"> (说明:不选择则前台显示为单选按钮形式!)</span></SPAN>
									<script language="javascript">newCustomField();</script>

                                    <span style="color: #ff3333"></span>
								</td>
							</tr>
							
          <tr bgcolor="F2F2F2"> 
            <td width="150" height="3" align="right">添加物品方式： </td>
								
            <td height="3"> 
              <asp:DropDownList ID="ddlTypes" Runat="server" AutoPostBack="True">
										<asp:ListItem Value="1">添加新物品</asp:ListItem>
										<asp:ListItem Value="2">已有物品中选择</asp:ListItem>
									</asp:DropDownList></td>
							</tr>
							<asp:Panel ID="pnlType1" Runat="server">
								<TR>
									
              <TD align="right" width="150">物品名： </TD>
									<TD>
										<asp:textbox id="txtNewFieldValue" Width="100px" Runat="server"></asp:textbox></TD>
								</TR>
								
            <TR bgcolor="F2F2F2"> 
              <TD width="150" align="right">价格： </TD>
									
              <TD> 
                <asp:textbox id="txtPrice" Width="100px" Runat="server">0</asp:textbox></TD>
								</TR>
								<TR>
									<TD align="right" width="150" height="15">默认选择：
									</TD>
									<TD height="15">
										<asp:checkbox id="cbxSelected" Runat="server"></asp:checkbox>
										<asp:textbox id="txtShopProductID" Width="100px" Runat="server" Visible="False">0</asp:textbox></TD>
								</TR>
							</asp:Panel>
							<asp:Panel ID="pnlType2" Runat="server" Visible="False">
								
            <TR bgcolor="F2F2F2"> 
              <TD width="150" align="right">物品库： </TD>
									
              <TD> 
                <asp:CheckBoxList id="cblItems" Runat="server" RepeatColumns="2"></asp:CheckBoxList></TD>
								</TR>
							</asp:Panel>
							<tr>
								<td></td>
								<td><asp:button id="btnSubmit" runat="server" Text="提交"></asp:button></td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		</form>
	</body>
</HTML>
