@model Com._9pm2.ClientWeb.Models.ContactList
@{
    ViewBag.Title = "联系人查询";
}
<script src="../../Scripts/contact.js?vn=20180813"></script>
<form method="post" action="/Contact/Index">
    @{
        Com._9pm2.ClientWeb.Models.LoginUser user = Session["LoginUser"] as Com._9pm2.ClientWeb.Models.LoginUser;
    }
    <div class="callout callout-success lead">提示：如需维护联系人信息，请在 [客户管理] 页面操作。</div>
    <div class="divSearch">
        <div>
            <div class="div-search-select2">
                @Html.DropDownList("sCustomerNo", new SelectList(Model.DdlCustomer, "ItemValue", "ItemText"))
            </div>
                @Html.TextBox("Keywords", null, new { maxlength = "50", placeholder = "关键字" })
            <button class="btn btn-default" id="btnSearch">搜索</button> 	
            <button class="btn btn-default" type="button" onclick="downExcel()">下载(Excel)</button>   
        </div>
    </div>
</form>

<div class="list">
    <table id="tContact">
        <thead>
            <tr>
                <th>所属客户</th>
                <th>姓名</th>
                <th>座机</th>
                <th>手机</th>
                <th>Email</th>
                <th>QQ</th>               
                <th>主联系人</th>
                <th>备注</th>
            </tr>
        </thead>
        <tbody>
            @foreach (var item in Model.Contacts)
            {
                <tr id="@item.ContactNo">

                    <td>

                        @Html.DisplayFor(modelItem => item.Customer.CustomerFullName)

                    </td>
                    <td>@Html.DisplayFor(modelItem => item.ContactName)</td>
                    <td>@Html.DisplayFor(modelItem => item.Phone)</td>
                    <td>@Html.DisplayFor(modelItem => item.Mobile)</td>
                    <td>@Html.DisplayFor(modelItem => item.Email)</td>
                    <td>@Html.DisplayFor(modelItem => item.QQ)</td>
                   
                    <td>
                        @if (item.IsMain)
                        {
                            <span>是</span>
                        }
                        else
                        {
                            <span></span>
                        }
                    </td>
                    <td>@Html.DisplayFor(modelItem => item.Other)</td>
                </tr>
            }
        </tbody>
    </table>
    @Html.Pager("Index", "Contact", Model.RouterDirectory, Model.PagerConfig, "pagerDiv", "pagerDiv", 8, true, false, true, true, false)
</div>

<div id="divContact" title="联系人信息" style="display:none">
    <div id="divContactContent" style="overflow-y: auto; height: 340px;">
        @using (Html.BeginForm())
        {
            <table id="tableEdit" class="font85 tableEdit">
                <tr>
                    <td class="label">所属客户</td>
                    <td>
                        @Html.DropDownList("CustomerNo", new SelectList(Model.DdlCustomer, "ItemValue", "ItemText"))&nbsp;<span class="redStar">*</span>
                        @Html.Hidden("ContactNo")
                    </td>
                </tr>
                <tr>
                    <td class="label">姓名</td>
                    <td>
                        @Html.TextBox("ContactName", null, new { maxlength = "50" })&nbsp;<span class="redStar">*</span>
                    </td>
                </tr>
                <tr>
                    <td class="label">座机</td>
                    <td>
                        @Html.TextBox("Phone", null, new { maxlength = "50" })
                    </td>
                </tr>
                <tr>
                    <td class="label">手机</td>
                    <td>
                        @Html.TextBox("Mobile", null, new { maxlength = "50" })
                    </td>
                </tr>
                <tr>
                    <td class="label">Email</td>
                    <td>
                        @Html.TextBox("Email", null, new { maxlength = "50" })
                    </td>
                </tr>
                <tr>
                    <td class="label">QQ</td>
                    <td>
                        @Html.TextBox("QQ", null, new { maxlength = "50" })
                    </td>
                </tr>
                <tr>
                    <td class="label">其它</td>
                    <td>
                        @Html.TextBox("Other", null, new { maxlength = "50" })
                    </td>
                </tr>
                <tr>
                    <td class="label">主联系人</td>
                    <td>
                        @Html.CheckBox("IsMain")&nbsp;<img style="width:18px;height:18px; vertical-align:middle; margin:auto" src="../../Images/grid/help.png" />
                    </td>
                </tr>
            </table>
            <br />
        }
    </div>
    <div style="text-align:right;">
        <span id="errorMessage" class="errorSpan"></span>
        <input type="button" class="btn btn-primary" id="btnSave" value="保存" />
        <input type="button" id="btnCancel" class="btn btn-default" value="取消" />
    </div>
</div>
