<?php

/**
 * 未申请小区专家的模板
 */
?>
<?php

/**
 * 正在申请小区专家的模板
 */

?>
<!---->
<div id="centre" class="layout">
	<div class="centreInner ">
		<div class="mainInner radius5 neighborhoodExpert">
			<div class=" belongBox radius3">
				<p class="title">您目前没有小区专家在职<a href="#" class="link">什么是小区专家及优势&gt;&gt;</a></p>
			</div>
			
			<!---->
			
			<div class="branchCommon radius5 "   >
				<div class="hd ">
					<table class="tableExpert">
						<tr>
							<td class="w268">小区名称</td>
							<td class="w156">在职专家数</td>
							<td class="w195">建议申请时间</td>
							<td class="w148">申请状态</td>
							<td>操作</td>
						</tr>
					</table>
				</div>
				<div class="mod">
					<table class="tableExpert">
                                            <?php  foreach ($block as $key => $value) { ?>
                                                <tr>
							<td class="td w268"><a class="name" target="_blank" bid ="<?=$value['blockid']?>" href="http://nj.sell.house365.com/community_id<?=$value['blockid']?>/"><?=$value['blockname']?></a></td>
							<td class="td w156"><?=$value['expert_num']?></td>
                                                        <td class="td w195"><span class="color"><?php if($value['endtime']){ echo $value['endtime']; } else { echo '立即';}?></span></td>
							<td class="td w148"><span class="color"><?=$value['status']?></span></td>
							<td class="td">
                                                            <?php if($value['action']) { ?>
                                                            <a class="link <?=$value['action']['key']?>" href="#" ><?=$value['action']['name']?></a>
                                                            <?php } else { ?>
                                                            -
                                                            <?php } ?>
                                                        </td>
						</tr>
                                            <?php }  ?>
						
						<tr class="bg">
							<td class="td w268"><a class="name" href="#">明发滨江新城</a></td>
							<td class="td w156">4</td>
							<td class="td w195"><span class="color">2013-5-21 17:09后</span></td>
							<td class="td w148"><span class="color">未申请</span></td>
							<td class="td"><a class="link" href="javascript:openWin('jsDialogNeighborhoodExpert')">申请</a></td>
						</tr>
						<tr>
							<td class="td w268"><a class="name" href="#">明发滨江新城</a></td>
							<td class="td w156">4</td>
							<td class="td w195"><span class="color">2013-5-21 17:09后</span></td>
							<td class="td w148"><span class="color">未申请</span></td>
							<td class="td"><a class="link" href="javascript:openWin('jsDialogNeighborhoodExpert')">申请</a></td>
						</tr>
						<tr  class="bg">
							<td class="td w268"><a class="name" href="#">明发滨江新城</a></td>
							<td class="td w156">4</td>
							<td class="td w195"><span class="color">2013-5-21 17:09后</span></td>
							<td class="td w148"><span class="color">未申请</span></td>
							<td class="td"><a class="link" href="javascript:openWin('jsDialogNeighborhoodExpert')">申请</a></td>
						</tr>
						<tr>
							<td class="td w268"><a class="name" href="#">明发滨江新城</a></td>
							<td class="td w156">4</td>
							<td class="td w195"><span class="color">2013-5-21 17:09后</span></td>
							<td class="td w148"><span class="color">未申请</span></td>
							<td class="td"><a class="link" href="javascript:openWin('jsDialogNeighborhoodExpert')">申请</a></td>
						</tr>
					</table>
				</div>
			</div>
			
			<!---->
			<div class="infoExpert">
				<p class="item">小区专家申请说明</p>
				<p class="item">1.在租售宝发布房源可以获取房豆,提高您的等级，增加网友对您的信任度，提升专业形象。
				<p class="item">2.房豆可以用来兑换小区专家或房源橱窗展示，只要你发多图房源，就有机会获得哦! &nbsp;&nbsp; <a href="#" class="link"> 申请小区专家&gt;&gt;</a>
				<p class="item"><a href="#" class="link">查看详细说明&gt;&gt;</a></p>
			</div>
			<!----> 
			
		</div>
	</div>
</div>


<!--申请小区专家 弹出层-->
<div id="jsDialogNeighborhoodExpert" class="dialog dialog2 radius5 dialogNeighborhoodExpert" >
	<div class="hd">
		<h3 class="h3">申请小区专家</h3>
		<span title="关闭" class="close close-win">&Chi;</span> </div>
	<div class="mod">
		<form action="" >
			<div class="forms">
				<dl class="list">
					
					<!---->
					
					<dd class="list_item clearfix">
						<label class="label">申请小区：</label>
						<div class="fields nameInput ">
							<div class="fgInput jsNameInput jsFgInput">
								<div class="fgInput"> <a href="#" target="_blank" id="apply_block_name" class="popLinkName"></a> </div>
							</div>
						</div>
					</dd>
					<!---->
					
					<dd class="list_item clearfix">
						<label class="label">申请宣言：</label>
						<div class="fields">
							<div class="fgInput">
								<textarea class="textarea" id="jsExpert"></textarea>
								<div class="clearfix">
									<div class="fgInput textFgErroy">
										<label class="error" style="display:none" >输入错误</label>
									</div>
									<p class="textFg textFg6 textFgFR">剩余<span class="colorN" id="jsExpertNum">50</span>个字</p>
								</div>
							</div>
						</div>
					</dd>
					<dd class="list_item clearfix">
						<label class="label">&nbsp;</label>
						<div class="fields">
							<div class="fgInput"> <a  href="####" class="btnPopo btnCon radius5 applyBtn">提交</a> <a href="####" class="btnPopo btnCon radius5 close-win">取消</a> </div>
						</div>
					</dd>
				</dl>
			</div>
                    <input id="apply_block_id" type="hidden" name="block_id" value="" />
		</form>
	</div>
</div>
<div id="jsDialogNeighborhoodExpert1" class="dialog dialog1 radius5 dialogNeighborhoodExpert" >
    <div class="hd">
		<h3 class="h3">申请小区专家</h3>
		<span title="关闭" class="close close-win">&Chi;</span> 
    </div>
    <div class="mod">
        <dl class="list">
                <dd class="list_item clearfix">
                        <label class="label"></label>
                </dd>
        </dl>
    </div>
</div>
<script>
countFun("jsReason",50,"jsReasonNum");
countFun("jsExpert",50,"jsExpertNum");
$(function() {
    $(".apply").click(function() {
        var block_name = $(this).parents('tr').find(".name").text()
        var block_id = $(this).parents('tr').find(".name").attr("bid");
        var block_url = $(this).parents('tr').find(".name").attr('href');
        var applyWin = $("#jsDialogNeighborhoodExpert");
        applyWin.find("#apply_block_name").text(block_name);
        applyWin.find("#apply_block_name").attr('href',block_url);
        applyWin.find("#apply_block_id").val(block_id);
        openWin('jsDialogNeighborhoodExpert');
    })
    $(".applyBtn").click(function() {
        var error = $(".error");
        var cNum = parseInt($("#jsExpertNum").text());
        if(cNum===50) {error.html("输入错误！").show();return; }
        if(cNum>40&&cNum<50) {error.html("请填写10个字以上的申请宣言！").show();return;}
        error.hide();
        var url = './apply/'
        var blockid = $("#apply_block_id").val();
        var reason = $("#jsExpert").val();
        $.post(url,{blockid:blockid,reason:reason},function(d) {
            //console.log(d);
            if(d.status==='1') {
                closeWin("jsDialogNeighborhoodExpert");
                var applyMsgWin = $("#jsDialogNeighborhoodExpert1");
                applyMsgWin.find("label").text(d.msg)
                openWin("jsDialogNeighborhoodExpert1");
            } else {
                error.html(d.msg).show();
            }
        },'json');
        
    })
    $(".cancel").click(function() {
        var x = confirm("是否取消？");
        if(x === true) {
            $.get(url,{},function(d) {
                alert(d);
            })
        }
    })
})
function closeWin(winId){
    var winElemt = $("#"+winId);
    winElemt.hide();
    $('#gTipsCover'+winId).remove();		
}
</script>