<?php
// Get employee information
$stmt = $conn->prepare("SELECT * FROM employee WHERE id = ?");
$stmt->bind_param("i", $_SESSION['employee_id']);
$stmt->execute();
$result = $stmt->get_result();

if ($row = $result->fetch_assoc()) {
    $em_user = textUncode($row['em_user']);
    $em_role = $row['em_role'];
    $em_code = textUncode($row['em_code']);
    $em_email = textUncode($row['em_email']);
    $em_tel = textUncode($row['em_tel']);
} else {
    $stmt->close();
    $conn->close();
    header("Location: /");
    exit;
}
$stmt->close();
?>

<div class="panel">
    <section>
        <h3><?= $em_user ?></h3>
        <div class="role_text"><?= ($em_role == 0) ? "组长" : "组员" ?></div>
        <ul class="lxfs">
            <li class="tel"><?= $em_tel ?></li>
            <li class="mail"><?= $em_email ?></li>
        </ul>
    </section>
    <div>
        <dl>
            <?php if (strpos($em_code, "BX") === false): ?>
                <dt><a href="../home.php">客户查找</a></dt>
            <?php endif; ?>
            <dt><a href="../customerAdd.php">客户录入</a></dt>
            <dt id="myCustomer" class="subnav">我的客户
                <div class="list-wraper">
                    <a href="../customers.php">全部客户  (<?= $_SESSION['t'] ?>)</a>
                    <a href="../customers.php?fliterBusiness=1">经销商  (<?= $_SESSION['t1'] ?>)</a>
                    <a href="../customers.php?fliterBusiness=2">零售  (<?= $_SESSION['t2'] ?>)</a>
                    <a href="../customers.php?fliterBusiness=3">连锁店铺  (<?= $_SESSION['t3'] ?>)</a>
                    <a href="../customers.php?fliterBusiness=4">中间商  (<?= $_SESSION['t4'] ?>)</a>
                    <a href="../customers.php?fliterDeal=2">明确需求  (<?= $_SESSION['d2'] ?>)</a>
                    <a href="../customers.php?fliterDeal=3">已经成交  (<?= $_SESSION['d1'] ?>)</a>
                    <a href="../customersNew.php">本月新增</a>
                    <?php if (strpos($em_code, "BX") === false): ?>
                        <a href="../customersFollow.php">即将加入公海 </a>
                        <a href="../teamSeas.php">小组公海(60天无更新)</a>
                        <a href="../highSeas.php">公司公海(120天无更新)</a>
                        <a href="../claimRecord.php">认领记录</a>
                        <a href="../abnormal.php" class="new">异常客户</a>
                    <?php endif; ?>
                </div>
            </dt>
            <dt class="subnav">数据
                <div class="list-wraper">
                    <a href="../dashboard.php">数据看板</a>
                    <?php if (strpos($em_code, "BX") === false): ?>
                        <a href="../team.php">本月小组数据</a>
                    <?php endif; ?>
                </div>
            </dt>
            <dt><a href="../tagClound.php">标签云</a></dt>
            <?php if (strpos($em_code, "BX") === false): ?>
                <dt><a href="../silentCustomer.php">静默客户</a></dt>
            <?php endif; ?>
            <?php if ($em_role == 0): ?>
                <dt class="subnav">我的团队
                    <div class="list-wraper">
                        <a href="../subcustomers.php">组员客户</a>
                        <a href="../subtagClound.php">组员客户分析</a>
                    </div>
                </dt>
            <?php endif; ?>
            <dt><a href="../pwdEdit.php">修改密码</a></dt>
            <dt><a href="../index.php?act=logout" onclick="return confirm('确认要退出吗?');">退出登录</a></dt>
        </dl>
    </div>
    <div class="copyright">
        <p>Version 1.5</p>
    </div>
    <?php if (strpos($em_code, "BX") === false): ?>
        <div class="statement">***注意事项***<br>所有业务务必全面录入客户资料,如发现有客户重复第一时间与前录入人沟通并妥善将与客户沟通的内容交接到原录入人,如故意隐瞒或者选择无视不交接,自愿接受退还客户及停止一个月官网询盘客户推送的惩罚,情节严重者按照违反公司利益进行辞退!</div>
    <?php endif; ?>
</div>