<!-- include 'header' -->
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script src="<?= WEB_SITE_GLOBAL ?>/js/jquery.ui.core.js"></script>
<script src="<?= WEB_SITE_GLOBAL ?>/js/jquery.ui.widget.js"></script>
<script src="<?= WEB_SITE_GLOBAL ?>/js/jquery.ui.position.js"></script>
<script src="<?= WEB_SITE_GLOBAL ?>/js/jquery.ui.autocomplete.js"></script>
<script src="<?= WEB_SITE_GLOBAL ?>/js/autoTag.js"></script>

<script>
function deleteTagCompany(tid,cid,obj){
	
	var url="/ajaxDeleteTagCompany";
	
	$.ajax({
		url:url,
		type: "post",
		cache: false,
		dataType: "json",
		data: {
			tid:tid,
			cid:cid
		},
		global: true,
		success: function(data){
			
			var tagifo=$("#syc_"+cid).attr('tag');
			obj.style.display="none";
			obj.remove();
			var retagifo=tagifo.replace(tid, " ");
			
			tagifo=$("#syc_"+cid).attr('tag',retagifo);
			
			
			//obj.hide();
		},
		error:function(err){

		}
		});
}
</script>
<body>
	<div class="mainLayout">
		<div class="mainMenu">
			<div class="menuItem">
				<a href="/" class="mLogo">CLD</a>
				<ul>
					<!-- include 'menu' -->
				</ul>
			</div>
		</div>
		<div class="warpContent">
			<div class="contactTab">
				<a href="/contacts">我的客户</a><a href="/mycompany" class="now">我的单位</a><a href="/communication" >内部通讯</a>
				<div class="searchItem">
				<form action="/searchMyCompany" method="post">
				<input type="text" name="search" placeholder="输入姓名或单位名称进行搜索"><input type="submit" value="搜索" class="subBtn">
				</form>
				</div>
				<div class="tabButton">
					<a href="javascript:void(0)" onclick="addClient()">+客户</a>
				</div>
			</div>
			<div class="contactDatabase fL">
				<div class="contactCate">
				<form name="up" id="up" action="/searchMyCompany" method="post">
					<input type="hidden" name="districtLv" id="districtLv" value="{{districtLv}}" />	
					<input type="hidden" name="nature" id="nature" value="" />
					<ul class="cateList">
	  					<li class="clearfix">
	  					<select name="lv1" id="lv1" onchange="searchUp();">
	  					<option value="0">请选择</option>
	  						<!-- loop district -->
	  						<!-- if {{district' vlaue.level}}==1 -->
	  						<!-- if {{district' value.id}}=={{lv1}} -->  
		  							<option selected value="{{district' value.id}}">{{district' value.name}}({{CC1}})</option>
		  							<!-- else -->
		  							<option  value="{{district' value.id}}">{{district' value.name}}</option>
		  							<!-- endif -->
	  						<!-- endif -->
	  						<!-- endloop -->
	  					</select>&nbsp;
	  					<span id="mlv2">
	  					<select name="lv2" id="lv2" onchange="searchSe();" >
	  					<option value="0">-请选择-</option>
	  					<!-- loop htmllv2 -->
		  						<!-- if {{htmllv2' value.id}}=={{lv2}} -->
		  							<option selected value="{{htmllv2' value.id}}">{{htmllv2' value.name}}({{CC2}})</option>
		  						<!-- else -->
		  							<option  value="{{htmllv2' value.id}}">{{htmllv2' value.name}}</option>
		  						<!-- endif -->
		  						<!-- endloop -->
	  					</select>
	  					</span>
	  					&nbsp;
	  					<span id="mlv3">
	  					<select name="lv3" id="lv3" onchange="searchTh();">
	  					<option value="0">-请选择-</option>
	  					<!-- loop htmllv3 -->
		  						<!-- if {{htmllv3' value.id}}=={{lv3}} -->
		  						<option selected value="{{htmllv3' value.id}}">{{htmllv3' value.name}}({{CC3}})</option>
		  						 <!-- else -->
		  						 	<option value="{{htmllv3' value.id}}">{{htmllv3' value.name}}</option>
		  						 <!-- endif -->
		  						<!-- endloop -->
	  					</select>&nbsp;
	  					</span>
	  					</li>
	  					<li class="filter clearfix">
	  					
	  					<a href="javascript:void(0)"  onclick="showNature('',this)" <!-- if {{Hnature}}=="" -->class='now' <!-- endif --> >不限</a>
	  					
	  					{{natureHtml}}
	  					</li>
	  					
	  					<li class="clearfix filter">
	  					<!-- loop tag -->
	  					<label><span class="contactsTag tagCol-0{{tag' value.colorid}}" data-placement="right" data-toggle="ctooltip" data-original-title="{{tag' value.name}}">
	  					<input type="checkbox" name="tag[]" <!-- if inarray({{tag' value.tid}},{{tagList}}) --> checked <!-- endif --> value="{{tag' value.tid}}" onclick="searchTag()">
	  					</span></label>
	  					<!-- endloop -->
	  					<a  href="#editTag" data-toggle="modal" role="button" title="编辑标签">编辑</a>
	  						
	  					</li>
	  					
	  				</ul>
	  				<div class="contactTableHead">
	  					<table>
	  						<tbody><tr><td width="330">单位</td><td width="100">个人标签</td><td width="190">地区</td><td width="60">客户数</td><td>单位性质</td></tr>
	  					</tbody></table>
	  				</div>
	  				</form>
				</div>
				
				<form action="/DoAddTagCompany" method="post">
				<div class="contactList autoHeightL2">
					<table class="contactTable">
	  						<tbody id="client">
	  						<!-- loop company -->
	  						<tr data="{{company' value.district}}" nature="{{company' vlaue.nature}}">
	  							<td width="330"><a href="javascript:void(0)" onclick="getCompany('{{company' value.cidKey}}')">{{company' value.companyname}}</a></td>
	  							<td width="100">
		  							<!-- loop clientInfo' value.taginfo -->
		  							<i class="contactsTag tagCol-0{{clientInfo' value' value.colorid}}" onclick="deleteTagCompany({{clientInfo' value' value.tid}},{{clientInfo' value.cid}},this)">x</i>
		  							<!-- endloop -->
		  							<a href="#addTag"  data-toggle="modal" role="button" class="addTag" onclick="selectTagAd({{clientInfo' value.cid}})" title="添加个人标签">+</a>
		  						</td>
	  							<td width="190">{{company' value.local}}</td>
	  							
	  							<td width="60">{{company' value.count}}</td>
	  							<td>{{company' value.nature}} <input type="checkbox" name="id[]" class="hide" value="{{company' value.cid}}" id="tagAd_{{company' value.cid}}"></td>
	  						</tr>
	  						<!-- endloop -->
	  						
	  				</tbody></table>
	  				<div class="changePage">
	  				翻页
	  				<select id="newsP" onchange="javascript:getNewsTPage()">
					{{pageinfo}}				
					</select>
					</div>
				</div>
				<!--弹出（添加标签）-->
				
				<div class="modal hide fade" id="addTag">
				<div class="modal-dialog">
 <div class="modal-content">
				
				    <div class="modal-header">
				    	<h3>添加标签</h3>
				    </div>
				    <div class="modal-body">
				   
					    	<div class="control-group">
								<div class="controls clearfix">
									<!-- loop tag -->
									<label class="checkbox">
					                	<label><input type="checkbox" name="tagALD[]" value="{{tag' value.tid}}"><span class="contactsTag tagCol-0{{tag' value.colorid}}">{{tag' value.name}}</span></label>
					              	</label>
					              	<!-- endloop -->
								</div>
				   			</div>
				    
				    </div>
				    <div class="modal-footer">
						<a href="javascript:void(0)" onclick="selectTagCl('id[]')" class="button btn-gray" data-dismiss="modal" aria-hidden="true">取消</a>
						<input type="submit" value="确定" class="button" ></input>
					</div>
				</div>
				</div></div>
				</form>
				<!--弹出内容-->	
				
			</div>
			<div class="contactDetil fL autoHeightR3">
				
				<div  style="display:none;" id="clientInfo">
					
				</div>
				<div style="display:none;" id="changeCompany">
					<form name="lock" action="/updateChangeCompany" method="post">
					<div id="cli_info"></div>
					
					<div class="contactPanel">
					<table><tbody>
						<tr><th>单位全称</th><td colspan="3"><input type="text" name="companyname" id="tags5" /> </td></tr>
					<tr><td colspan="4"><div class="bsAlert bsInfo">输入单位全称，系统将为你检索是否已存在单位；<br>若存在，则点选对应的单位即可；<br>若不存在，则需填写详细单位信息，添加新单位。<span class="colRed">若公司名称包含“-”符号，无法更换单位，请先去掉“-”符号</span></div></td></tr></tbody></table>
					</div>
					<div class="contactPanel" id="contactPanelNew" >
					</div>
					</form>
					
				</div>
				<div  style="display:none;" id="addClient">
					<form name="adcl" id="adcl" action="/addClient" method="post" >
						<div class="contactInfo">
				  			<div class="contactPanel">
				  				<div class="bsAlert bsInfo"><b>添加新客户</b>前，可先搜索是否有其他同事已经添加了该客户。</div>
				  				<table>
				  					<tbody>
				  					<tr>
				  					<th>姓名</th><td><span data-placement="bottom" data-toggle="ctooltip" data-original-title="*必填；请填写真实姓名，如：张三、李四；不能出现其他信息" ><input type="text" name="clientname" id="adclientname" style="width:55%" required="required">
				  					<select name="priority" id="priority"><option value="5" selected>优先级</option><option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option></select>
				  					</span></td>
				  					<th>昵称</th><td><span data-placement="bottom" data-toggle="ctooltip" data-original-title="*必填；格式：'林（声平）总:''江（东明）工：'" ><input type="text" name="nicename" style="width:55%" required="required"></span>
				  					<select name="gender">
				  					<option value="男">男</option><option value="女">女</option>
				  					</select>
				  					</td>
				  					</tr>
				  					<tr><th>手机</th><td><span data-placement="bottom" data-toggle="ctooltip" data-original-title="多个号码请用分号间隔即可" ><input type="text" name="telephone"><span></td>
				  					<th>电话</th><td><span data-placement="bottom" data-toggle="ctooltip" data-original-title="填写格式为：0756-3850888；多个号码请用分号间隔即可" ><input type="text" name="phone"></span></td></tr>
				  					<tr><th>部门</th><td><span data-placement="bottom" data-toggle="ctooltip" data-original-title="请规范填写部门，系统将按此关键词自动归类同单位同部门下的客户" ><input type="text" name="department" required="required"></span></td>
				  					<th>职务</th><td><span data-placement="bottom" data-toggle="ctooltip" data-original-title="请填写简短清晰的职务" ><input type="text"name="position"></span></td></tr>
				  					<tr><th>办公室</th><td colspan="4"><span data-placement="bottom" data-toggle="ctooltip" data-original-title="填写客户所在办公室位置等" ><input type="text" name="office"></span></td></tr>
				  					<tr><th>QQ</th><td><span data-placement="right" data-toggle="ctooltip" data-original-title="多个QQ请用分号间隔即可" ><input type="text" name="qq"></span></td><th>邮箱</th><td><span data-placement="left" data-toggle="ctooltip" data-original-title="多个邮箱请用分号间隔即可" ><input type="text" name="email"></span></td></tr>
				  					<tr><th>备注</th><td colspan="4"><span data-placement="bottom" data-toggle="ctooltip" data-original-title="" ><input type="text" name="mark"></span></td></tr>
				  				</tbody></table>
				  			</div>
				  			<div class="contactPanel">
				  				<table>
				  					<tbody><tr><th>单位全称</th><td colspan="4"><span data-placement="bottom" data-toggle="ctooltip" data-original-title="*必填；填写具体单位名称，系统将按此名称自动建立单位名录" ><input type="text" name="companyname" id="adcompanyname" required="required"></span> </td></tr>
				  					<tr><th>地区</th>
				  					<td colspan="5">
				  					<div data-placement="bottom" data-toggle="ctooltip" data-original-title="*必填；必须三项全选" >
				  					<select name="lv21" id="lv21" onchange="dislv('lv21','22');">
		  					<option value="0">请选择</option>
		  						<!-- loop district2 -->
		  						<!-- if {{district' vlaue.level}}==1 -->
		  						<option value="{{district' vlaue.id}}">{{district' vlaue.name}}</option>
		  						<!-- endif -->
		  						<!-- endloop -->
		  					</select>&nbsp;
		  					<span id="mlv22">
		  					<select >
		  					<option></option>
		  					</select>
		  					</span>
		  					&nbsp;
		  					<span id="mlv23">
		  					<select>
		  					<option></option>
		  					</select>&nbsp;
		  					</span></div>
				  					
									</td>
				  					</tr>
				  					<tr ><th>性质</th><td colspan="3">
				  					<!-- loop nature -->
				  					<label><input type="checkbox" name="nature[]" value="{{nature' value}}">{{nature' value}}</label>&nbsp;
				  					<!-- endloop -->
				  					</td></tr>
				  					<tr><th>单位地址</th><td colspan="3"><span data-placement="bottom" data-toggle="ctooltip" data-original-title="*必填；请填写详细地址，包含省/市/区" ><input type="text" name="address" required="required"></span></td></tr>
				  					<tr><th>传真</th><td><span data-placement="bottom" data-toggle="ctooltip" data-original-title="填写格式为：0756-3850888" ><input type="text" name="fax"></span></td><th>单位主页</th><td><span data-placement="bottom" data-toggle="ctooltip" data-original-title="填写该单位的网站地址" ><input type="text" name="webservice"></span></td></tr>
				  					<tr><th>乘车路线</th><td colspan="3"><span data-placement="bottom" data-toggle="ctooltip" data-original-title="填写出差至该单位的乘车路线" ><input type="text" name="ride"></span></td></tr>
				  					<tr><th>地标建筑</th><td colspan="3"><span data-placement="bottom" data-toggle="ctooltip" data-original-title="填写单位附近比较显眼的地标建筑等" ><input type="text" name="landmarks"></span></td></tr>
				  					<tr><th>参考住宿</th><td colspan="3"><span data-placement="bottom" data-toggle="ctooltip" data-original-title="填写可供选择的出差住宿方式"><input type="text" name="stay"></span></td></tr>
				  					<tr><td colspan="4"><input type="button" onclick="checkadcl()" value="确定" class="button"></input><span id="admsg"></span></td></tr>
				  				</tbody></table>
				  			</div>
				  			<!--添加前提示-->
				  			<style>.contactDetil{position:relative;}</style>
				  			<div class="searchTips">
		  				<div class="tipsImg">
		  				<a class="button" id="closeST">滚！</a></div>
		  			</div>
		  			<!--添加前提示-->
			  			</div>
		  			</form>
				</div>				
				
				<div class="contactInfo" style="display:none;" id="staffInfo">
		  			
	  			</div>
	  			
	  			<div id="longleLog" style="display:none;">
	  			
		  			<div  class="header" style="">
		  				<h1 id="longleTitle"></h1>
		  				<h2><span id="longleResponsible"></span> <span id="longleStatus">收回 / 专业版+河南养护</span></h2>
		  			</div>
	  			
	  			<div  class="lockRecord autoHeightR2" >
	  				<!--添加记录按钮-->
	  				<!-- <div class="toolItem clearfix">
	  					<a href="#" class="button">添加记录</a>
	  				</div>  -->
	  				<!--添加记录-->
	  				<div class="toolItem clearfix">
						
	  				<form name="lock" action="/addDoLockLog" method="post">
	  				<input type="hidden" name="klid" id="klid" ></input>
						  <div class="control-group">
						    <label class="control-label" for="inputEmail">记录类型</label>
						    <div class="controls">
						    
							    <label class="radio inline">
							    	<input type="radio" name="longleStatus" id="longleStatus_3"  value="3" checked>借出
							    </label>
							    <label class="radio inline">
							    	<input type="radio" name="longleStatus" id="longleStatus_4"  value="4">销售
							    </label>
							    <label class="radio inline">
							    	<input type="radio" name="longleStatus" id="longleStatus_9"  value="9">赠送
							    </label>
							    <label class="radio inline">
							    	<input type="radio" name="longleStatus" id="longleStatus_5" disabled="disabled"  value="5">升级
							    </label>
							    <label class="radio inline">
							    	<input type="radio" name="longleStatus" id="longleStatus_6" disabled="disabled"  value="6">更换
							    </label>
							    <label class="radio inline">
							    	<input type="radio" name="longleStatus" id="longleStatus_7"  disabled="disabled" value="7">收回
							    </label>
							    <label class="radio inline">
							    	<input type="radio" name="longleStatus" id="longleStatus_8" disabled="disabled" value="8">备注
							    </label>
						    </div>
						  </div>
	  				<!--添加记录-借锁-->
	  				<div id="longleStatusShow_3">
						  <div class="control-group"  >
						    <label class="control-label" for="inputPassword">借出客户</label>
						    <div class="controls">
						    <span data-placement="right" data-toggle="ctooltip" data-original-title="只允许填写库中存在的客户，若输入客户不存在，请先添加该客户。">
						      <input type="text" name="browseClient" id="tags" value="">
						  	</span>
						    </div>
						  </div>
						  <div class="control-group" style="display:none">
						    <label class="control-label" for="inputPassword">产品</label>
						    <div class="controls">
						      <select name="testbrowseProduct">
						      <!-- loop product  -->
						      <option value="{{category' value.title}}">{{category' value.title}}</option>
						      <!-- endloop -->
						      </select>
						    </div>
						  </div>
					</div>
	  				<!--添加记录-销售-->
	  				<div id="longleStatusShow_4" style="display:none;">
						  <div class="control-group">
						    <label class="control-label" for="inputPassword">销售客户</label>
						    <div class="controls">
						    <span data-placement="right" data-toggle="ctooltip" data-original-title="只允许填写库中存在的客户，若输入客户不存在，请先添加该客户。">
						      <input type="text" name="sellClient" id="tags2" value="">
						  	</span>
						    </div>
						  </div>
						  <div class="control-group">
						    <label class="control-label" for="inputPassword">产品</label>
						    <div class="controls">
						      <select name="sellProduct"><!-- loop product  -->
						      <option value="{{category' value.title}}">{{category' value.title}}</option>
						      <!-- endloop --></select>
						    </div>
						  </div>
					</div>
					<!--添加记录-赠送-->
	  				<div id="longleStatusShow_9" style="display:none;">
						  <div class="control-group">
						    <label class="control-label" for="inputPassword">赠送客户</label>
						    <div class="controls">
						      <span data-placement="right" data-toggle="ctooltip" data-original-title="只允许填写库中存在的客户，若输入客户不存在，请先添加该客户。"><input type="text" name="giftClient" id="tags4" value=""></span>
						    </div>
						  </div>
						  
					</div>
	  				<!--添加记录-升级-->
	  				<div id="longleStatusShow_5" style="display:none;">
						  <div class="control-group">
						    <label class="control-label" for="inputPassword">新增产品</label>
						    <div class="controls">
						      <select name="newProduct">
						      <!-- loop product  -->
						      <option value="{{product' value.pid}}">{{product' value.title}}</option>
						      <!-- endloop -->
						      </select>
						    </div>
						  </div>
					</div>
	  				<!--添加记录-更换-->
	  				<div id="longleStatusShow_6" style="display:none;">
						  <div class="control-group">
						    <label class="control-label" for="inputPassword">新锁号</label>
						    <div class="controls">
						    <span data-placement="right" data-toggle="ctooltip" data-original-title="只允许填写库中存在锁号，若输入锁号不存在，请先生成/接收该锁。">
						      <input type="text" name="key_num" id="key_num" value=""></span>
						    </div>
						  </div>
					</div>
	  				<!--添加记录-备注-->
	  				<div id="longleStatusShow_8" style="display:none;">
						  <div class="control-group">
						    <label class="control-label" for="inputPassword">备注</label>
						    <div class="controls">
						      <textarea style="width:95%" rows="5" name="mark" id="mark"></textarea>
						    </div>
						  </div>
					</div>
	  				<!--添加记录按钮-->
						<div class="control-group">
						    <div class="controls clearfix">
						    	<input type="submit" class="button" value="确定添加" />
						    </div>
						   </div>	  				
	  				</div>
	  					 </form>
	  				<!--记录列表-->
	  				<div id="LongleLogHtml"></div>
					<!-- <div class="infoFlowList">
						<div class="dateTitle">
							<em class="month"><span class="num">8</span><span class="text">-01</span></em>
							<span class="year">2013</span>
						</div>
						<ul class="flowList">
							<li class="item iconLock">备注</li>
							<li class="item">总部<a href="#">张少珊</a></li>
							<li class="item">内容，内容备注内容。内容，内容备注内容。内容，内容备注内容。内容，内容备注内容。内容，内容备注内容。内容，内容备注内容。内容，内容备注内容。内容，内容备注内容。内容，内容备注内容。内容，内容备注内容。</li>
						</ul>
					</div>
					 -->
					
				</div>
				
				</div>
				
				
	  			
			</div>
		</div>
	</div>
	 <!--弹出（编辑标签名）-->
<div class="modal hide fade" id="editTag">
<div class="modal-dialog">
 <div class="modal-content">
    <div class="modal-header">
    <h3>编辑标签</h3>
    </div>
    <form name="userinfo" action="/DoEdiTagCompany" method="post">
    <div class="modal-body">
    
	    	<div class="control-group">
				<div class="controls clearfix">
					<!-- loop tag -->
					<label class="checkbox">
	                	<span class="contactsTag tagCol-0{{tag' value.colorid}}">标签</span><input type="text" name="tag_{{tag' value.colorid}}" value="{{tag' value.name}}">
	              		<input type="hidden" name="tid_{{tag' value.colorid}}" value="{{tag' value.tid}}" ></input>
	              	</label>
	              	<!-- endloop -->
				</div>
	    	</div>
    
    </div>
	<div class="modal-footer">
	    <a href="#" class="button btn-gray" data-dismiss="modal" aria-hidden="true">取消</a>
	   	<input type="submit" class="button" value="确定">
	</div>
	</form>
	</div></div>
</div>
    <!--弹出内容-->
	
<script type="text/javascript">autoFlashHeight();</script>	
</body>