<%@ page language="java" errorPage="/error.jsp" pageEncoding="UTF-8"
	contentType="text/html; charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>企业资料信息管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- bootstrap 3.0.2 -->
<%-- <link href="<c:url value='/styles/lib/bootstrap.min.css'/>" rel="stylesheet" type="text/css" />
<link href="<c:url value='/styles/lib/font-awesome.min.css'/>" rel="stylesheet" type="text/css" />
<link href='<c:url value='/styles/lib/ionicons.min.css' />' rel="stylesheet" type="text/css" />
<link href="<c:url value='/styles/lib/datatables/dataTables.bootstrap.css' />" rel="stylesheet" type="text/css" /> --%>
<link href="<c:url value='/scripts/lib/layui/layui.css'/>" rel="stylesheet" type="text/css" />
<link href="<c:url value='/styles/AdminLTE.css?2019-1-1'/>" rel="stylesheet" type="text/css" />
<link href="<c:url value='/styles/virtualArch/virtualArcList.css?2019-1-1'/>" rel="stylesheet" type="text/css" />
<script src="${ctx }/scripts/lib/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="<c:url value='/plugin/layer/layer.js'/>"></script>
<script type="text/javascript" src="<c:url value='/scripts/lib/layui/layui.js'/>"></script>
<%-- <script type="text/javascript" src="<c:url value='/scripts/bootstrap.min.js'/>"></script> --%>
<script type="text/javascript" src="<c:url value='/scripts/lib/template-native.js'/>"></script>

<script type="text/javascript" src="${ctx}/scripts/jquery/ajaxfileupload.js"></script>
<script type="text/javascript" src="${ctx}/scripts/admin/cjqt.js"></script>
</head>
<body>
	<input type="hidden" value="${virAccountInfo}" id="virAccountInfo">
	<input type="hidden" value="${ctx}" id="contextPath">
	<input type="hidden" id="funcid" value="${funcid}">
	<input type="hidden" value="${virtualArchitectureId}" id="virtualId_">
	<input type="hidden" value="${ctx}" id="contextPath" />
	<input type="hidden" value="${updateAct}" id="updateAct" />
	<input type="hidden" value="${deleteAct}" id="deleteAct" />

	<%-- 因为js中无法直接调用自定义的权限校验标签 --%>
	<%-- 判断当前用户是否有相应权限,如果有权限则在JSP页面新增隐藏input标签,方便js代码调用 --%>

	<%-- 是否有修改权限 --%>
	<perm:hasPermission permCode="pc:organization:enterprise-data:edit">
		<input type="hidden" value="1" id="perm-edit" />
	</perm:hasPermission>
	<%-- 是否有删除权限 --%>
	<perm:hasPermission permCode="pc:organization:enterprise-data:delete">
		<input type="hidden" value="1" id="perm-delete" />
	</perm:hasPermission>

	<div class="bread-wp">
		组织架构  > 企业资料信息管理
	</div>
	<div class="right-content">
		<div class="main-content-mode-wp clearfloat email-publish-wp ">
		<form:form  id="conditionform"  class="clearfloat">
			<c:if test="${fn:length(organizationList) > 1}">
				<div class="part-wp">
					<span class="search-tips">校区</span>
					<input class="default-select" name="organizationId" id="organizationId" autocomplete="off" />
	              	<span class="select_wrap _hide"></span>
<!-- 					<select name="organizationId" id="organizationId" class="default-select">
						<option value="">请选择校区</option>
						<c:forEach items="${organizationList }" var="org">
						<c:choose>
							<c:when test="${org.id==orgId }">
							   <option value="${org.id }" selected="selected">${org.name }</option>
							</c:when>
							<c:otherwise>
								<option value="${org.id }">${org.name }</option>
							</c:otherwise>
							</c:choose>
						</c:forEach>
					</select> -->
				</div>		
			</c:if>
			<c:if test="${fn:length(organizationList) == 1}">
					<input type='hidden' class="default-select single-orgid" name="organizationId" id="organizationId" org__id="${orgs[0].id}" autocomplete="off" value="${obj.id }" org__id='${obj.id }'/>
					<!-- <c:forEach items="${organizationList}" var="obj">
						<input type="hidden" id="organizationId" name="organizationId"  value="${obj.id }" class="default-select"/>
					</c:forEach> -->
			</c:if>
			<c:if test="${not empty virAccountInfo}">
				<div class="part-wp">
					<span class="search-tips">企业</span>
					<input class="default-select" disabled name="virtualId" id="virtualId" autocomplete="off" value="${virAccountInfo.virName}" com__id="${virAccountInfo.virId}" level="${virAccountInfo.level}" range_id="${virAccountInfo.range_id}" />
			  </div>
			</c:if>	
			<c:if test="${fn:length(virAccountInfo) == 0}">
			<div class="part-wp">
				<span class="search-tips">企业</span>
				<input class="default-select" name="virtualId" id="virtualId"  autocomplete="off" />
		    <span class="select_wrap _hide"></span>
	     <!-- <c:if test="${fn:length(organizationList) == 1}">
					<span class="search-tips">企业</span>
				</c:if>	
				<select name="organizationList" id="virtualId" class="default-select">
						<option value="">请选择企业</option>
				</select> -->
			</div>
      </c:if>	
      <c:if test="${fn:length(virAccountInfo) == 0}">
		  <div class="part-wp">
			  <span class="search-tips">代理企业</span>
			  <input class="large-input" type="text" id="agentName" placeholder="请输入代理企业名称"/>
		  </div>
			<div class="part-wp">
				<span class="search-tips">关键字</span>
				<input class="large-input keyWord" type="text" placeholder="请输入企业名称/客户编号/联系电话/地址"/>
			</div>
			<div class="part-wp">
				<span class="search-tips">合同到期时间</span>
				<input type="text" name="date1" id="date1" autocomplete="off" class="date-input">
				<span style="display: inline-block;margin-left: 5px;">~</span>
				<input type="text" name="date2" id="date2" autocomplete="off" class="date-input">
      </div>
    </c:if>
			<div class="part-wp">
			<button class="search-btn btn-red" type="button">查询</button>
			<button class="set-btn btn-white" type="button">重置</button>
			</div>
    </form:form>
		 <div class="main-operate-wp">
		 <c:if test="${isAdminAndProjectAdmin || virAccountInfo.level == 2}">
		 		<button class="btn-add-blue add-ele-btn" type="button">新增</button>

		 	<c:if test="${fn:length(buildList) == 1}">
				<form id="fileUploadForm" name="form" class="import-enterprise-btn" action="${ctx }/admin/virtual/importVirtualInfo"
					  method="POST" enctype="multipart/form-data">
					<button class="btn-export-white export-btn">导入</button>
					<input type="file" id="excelFile" name="excelFile" />
					<c:forEach items="${buildList }" var="bu">
						<input type="hidden" id="buildId" name="buildId"  value="${bu.id}"/>
					</c:forEach>
				</form>
			</c:if>
			<c:if test="${fn:length(buildList) >1}">
				<button class="btn-export-white export-btn-enter">导入</button>
			</c:if>
			<button class="download-btn btn-download-white" >下载模板</button>
		 </c:if>
     </div>
	 	 <table class="layui-hide" id="LAY_table_user" lay-filter="user"></table>  
		</div>
	</div>
	<script type="text/html" id="indexTpl">
    {{d.LAY_TABLE_INDEX+1}}
	</script>
	<%-- <section class="content">
		<div class="row">
			<div class="col-xs-12">
				<div class="boxlist">
					<!-- /.box-header -->
					<div class="box-body table-responsive">
						<form:form id="conditionform" action="${ctx}/admin/virtualArch/list?funcid=${funcid}" method="POST">
							<input type="hidden" id="pageNo" name="pageNo" value="${page.currentPage }" />
							<div class="form-group">
							<c:if test="${fn:length(organizationList) > 1}">
								<label>校区名称</label>
								<select name="organizationId" id="organizationId"  style="width:160px;">
									<option value="">请选择校区</option>
									<c:forEach items="${organizationList}" var="obj">
										<c:choose>
											<c:when test="${obj.id==organizationId }">
											<option value="${obj.id }" selected="selected">${obj.name }</option>
											</c:when>
											<c:otherwise>
											<option value="${obj.id }">${obj.name }</option>
											</c:otherwise>
										</c:choose>
									</c:forEach>
								</select>
								</c:if>
								<c:if test="${fn:length(organizationList) == 1}">
								<c:forEach items="${organizationList}" var="obj">
									<input type="hidden" id="orgId" name="orgId"  value="${obj.id }"/>
								</c:forEach>
								</c:if>
								<select name="virtualId" id="virtualId" style="width:160px;">
									<option value="">请选择企业</option>
								</select>
								&nbsp;&nbsp;&nbsp;&nbsp;
								<label>签约状态</label>
								<select name="contractStatus" id="contractStatus"  style="width:160px;">
									<option value="">请选择签约状态</option>
									<c:forEach items="${contractStatusGroup }" var="obj">
										<c:choose>
											<c:when test="${obj.itemcode==contractStatus }">
											<option value="${obj.itemcode }" selected="selected">${obj.itemname }</option>
											</c:when>
											<c:otherwise>
											<option value="${obj.itemcode }">${obj.itemname }</option>
											</c:otherwise>
										</c:choose>
									</c:forEach>
								</select>
								&nbsp;&nbsp;
								<label>客户类型</label>
								<select name="customerType" id="customerType"  style="width:160px;">
									<option value="">请选择客户类型</option>
									<c:forEach items="${vipGroup }" var="obj">
										<c:choose>
											<c:when test="${obj.itemcode==customerType }">
											<option value="${obj.itemcode }" selected="selected">${obj.itemname }</option>
											</c:when>
											<c:otherwise>
											<option value="${obj.itemcode }">${obj.itemname }</option>
											</c:otherwise>
										</c:choose>
									</c:forEach>
								</select>								
								<br/>
								<label>关键字</label> &nbsp;
								<input style="margin-bottom: 5px;width:500px;" type="text" name="keyWord" value="${keyWord}" placeholder="请输入企业名称/客户编号/联系电话/地址">
							</div>

						</form:form>
						<div class="btns-wrapper" >
              <button class="btn btn-red" href="javaScript:void(0);" id='btn-search'>查询</button>
							<c:if test="${addAct =='1' }">
								<button class="btn  btn-white" href="javaScript:void(0);" onclick="addVirtualArchitecture('')">新增</button>
              </c:if>
							<div class="template-operate">
								<c:if test="${fn:length(buildList) == 1}">
									<form id="fileUploadForm" name="form" class="import-enterprise-btn" action="${ctx }/admin/virtual/importVirtualInfo"
										  method="POST" enctype="multipart/form-data">
										<button class="btn-red export-btn">导入</button>
										<input type="file" id="excelFile" name="excelFile" />
										<c:forEach items="${buildList }" var="bu">
											<input type="hidden" id="buildId" name="buildId"  value="${bu.id}"/>
										</c:forEach>
									</form>
								</c:if>
								<c:if test="${fn:length(buildList) >1}">
									<button class="btn-red export-btn-enter">导入</button>
								</c:if>
								<button class="download-btn btn-white" >下载模板</button>
              </div>
						</div>
						<table id="example2" class="table table-bordered table-hover">
							<thead>
								<tr>
									<th width="5%">序号</th>
									<!-- <th>客户编号</th> -->
									<th width="12%">企业名称</th>
									<th width="8%">企业编码</th>
									
									<th width="8%">联系电话</th>
									<!-- <th>审核状态</th>
									<th>签约状态</th>
									<th>VIP客户</th> -->
									<!-- <th>所属校区</th>
									<th>修改人/修改时间</th> -->
									<th width="10%">楼宇</th>
									<th width="8%">楼层</th>
									<th width="14%">房间号</th>
									<th width="7%">企业状态</th>
									<th width="18%">地址</th>
									<th width="10%">操作</th>
								</tr>
							</thead>
							<tbody class="layui-form">
								<c:forEach items="${page.items }" var="model" varStatus="status">
									<tr>
										<td>${ (page.currentPage-1)*page.pageSize+(status.index+1)}</td>
										<td>${model.customerNumber }</td>
										<td title="公司地址:${model.address}">${model.name }</td>
										<td>${model.codeNumber }</td>
										
										<td>${model.phone }</td>
										<td>
											<c:forEach items="${reviewStatusGroup }" var="temp">
												<c:if test="${temp.itemcode==model.status }">
													${temp.itemname }
												</c:if>
											</c:forEach>
										</td>
										<td>
											<c:forEach items="${contractStatusGroup }" var="obj">
												<c:if test="${obj.itemcode==model.contractStatus }">
													${obj.itemname }
												</c:if>
											</c:forEach>
										</td>
										<td>
											<c:forEach items="${vipGroup }" var="obj">
												<c:if test="${obj.itemcode==model.customerType }">
													${obj.itemname }
												</c:if>
											</c:forEach>
										</td>
										<td>
											${model.organizationName}
										</td>
										<td>
											<c:choose>
												<c:when test="${!empty model.modifier }">
													${model.modifier}<br/>
													${model.modifyTime}
												</c:when>
												<c:otherwise>
													${model.creator}<br/>
													${model.createTime}
												</c:otherwise>
											</c:choose>
										</td>
										<td>${model.buildName }</td>
										<td>${model.floorNames }</td>
										<td>${model.roomNames }</td>
										<c:if test="${model.leaseStatus ==1 }">
										<td>在租</td>
										</c:if>
										<c:if test="${model.leaseStatus ==0 }">
										<td>已迁出</td>
										</c:if>
										<td>${model.address }</td>
										<td style="text-align:center">
											<span style="display: block; width: 156px;">
	                                   		<c:if test="${updateAct =='1' }">
												<button onclick="addVirtualArchitecture('${model.id}')" title="编辑"  class="t-btn t-red-btn">
													编辑
		                                   		</button>
	                                   		</c:if>
	                                   		<c:if test="${deleteAct =='1' }">
												<button onclick="dele('${model.id}')" title="删除"  class=" t-btn t-white-btn" >
													删除
		                                   		</button>
	                                   		</c:if>
	                                   		</span>
	                                   		
	                                   		<span style="display: block; width: 156px;">
	                                   		<c:if test="${updateAct =='1' }">
		                                   		<a href="${ctx}/admin/signContact/query?funcid=${funcid}&virtualId=${model.id}" title="签约管理" class="btn btn-default" onclick="deailsContractInfomation('${model.id}')">
													<span>签约管理</span>
		                                   		</a>
		                                   		<a href="${ctx}/admin/bill/generalBillsPage?funcid=${funcid}&virtualId=${model.id}" title="账单管理" class="btn btn-default" onclick="deailsContractInfomation('${model.id}')">
													<span>账单管理</span>
		                                   		</a>
	                                   		</c:if>
	                                   		</span>
										</td>
									</tr>
								</c:forEach>
							</tbody>
						</table>
						<div class="btn-page">
		                    <!-- 页码 -->
		                    <div align="center" class="pages clearfix">
		                           <c:forEach items="${page.iterPages }" var="pageNo">
									<c:choose>
										<c:when test="${pageNo == page.currentPage }">
											<span class='current'>${pageNo }</span>
										</c:when>
										<c:when test="${pageNo != null}">
											<a href="javascript:void(0);" onclick='goPage(${pageNo});'>${pageNo}</a>
										</c:when>
										<c:otherwise>
											<em>...</em>
										</c:otherwise>
									</c:choose>
								</c:forEach>
								<strong>共<span style="color:black;font-weight:bold;font-size:16px;">${page.totalCount}</span>条</strong>
								<strong>跳转到第</strong><input type="text" id="gopage" style="width: 40px;" onkeyup="this.value=this.value.replace(/\D/g,'')" onkeypress="this.value=this.value.replace(/\D/g,'')"/><strong>页</strong>
								<a class="btn-sm  btn-primary" href="javascript:goPage('gopage');" id='bindBtn'>确定</a>
		                	</div>
			            </div>
					</div>
					<!-- /.box-body -->
				</div>
			</div>
		</div>
	</section> --%>
	<script type="text/javascript" src="<c:url value='/scripts/admin/virtualArch/virtualArcList.js?2019-1-10'/>"></script>
</body>
</html>