<%@ Page CodeFileBaseClass="AliCMS.Lib.AdminPageBase" %>
<ali:Get ID="Supplier" Object="Supplier" Guid="Request.QueryString['SupplierID']" />
<ali:List ID="Regions" Mark="Goods" Object="Region" />
<script language="c#" runat="server">
protected string BuildRegion(object regionId)
{
	StringBuilder result = new StringBuilder();

	DataRow[] regions = Regions.Select(AliShop.GoodsModule.Alias.Region.ID + "='" + regionId + "'");
	while (regions.Length != 0)
	{
		result.Insert(0, regions[0][AliShop.GoodsModule.Alias.Region.Name]);
		regions = Regions.Select(AliShop.GoodsModule.Alias.Region.ID + "='" + regions[0][AliShop.GoodsModule.Alias.Region.ParentID] + "'");
	}
	
	return result.ToString();
}
</script>
<section data-page="supplier_addresses_list" data-title="供应商收货地址">
	<div class="path1"><span>您的位置：</span><a href="../list.aspx" target="ali-navtab">供应商列表</a> → <b class="<%=ContentLang%>Font"><%=Supplier[Name]%></b></div>
	<div class="content">
		<div class="ali-tabs margin2" data-event="click">
			<div class="ali-tabs-header">
				<div class="ali-tabs-nav-container">
					<ul>
						<li><a href="../edit.aspx?ID=<%=Supplier[InnerID]%>" target="ali-navtab">编辑</a></li>
						<li><a href="add.aspx?SupplierID=<%=Supplier[ID]%>" target="ali-navtab">添加收货地址</a></li>
						<li class="ali-active"><a>浏览收货地址</a></li>
						<li><a href="../payment/add.aspx?SupplierID=<%=Supplier[ID]%>" target="ali-navtab">添加收款账号</a></li>
						<li><a href="../payment/list.aspx?SupplierID=<%=Supplier[ID]%>" target="ali-navtab">浏览收款账号</a></li>
					</ul>
				</div>
			</div>
			<div class="ali-tabs-body">
				<div class="ali-tabs-panel"></div>
				<div class="ali-tabs-panel"></div>
				<div class="ali-tabs-panel">
					<table data-ali-widget="grid" class="grid1">
						<thead>
							<tr>
								<th>地址</th>
								<th width="100">邮政编码</th>
								<th width="120">是否默认</th>
								<th width="120">删除</th>
							</tr>
						</thead>
						<tbody>
							<ali:List ID="List" Object="Supplier.Addresses" Page="PageNumber" PageSize="PageSizeValue" Validate="True">
								<ali:Record>
									<tr data-id="<%=InnerID%>">
										<td><a href="edit.aspx?ID=<%=InnerID%>" target="ali-navtab"><%=BuildRegion(RegionID)%><%=Address%></a></td>
										<td><%=Zip%></td>
										<td>
											<%If Convert.ToBoolean(IsDefault)%>
												是
											<%Else%>
												否
											<%EndIf%>
										</td>
										<td><a class="ali-button" data-operation="Delete">删除</a></td>
									</tr>
								</ali:Record>
							</ali:List>
						</tbody>
					</table>
				</div>
			</div>
			<div class="ali-tabs-bottom"><b></b></div>
		</div>
	</div>
</section>