@model IQueryable<Com._9pm2.ClientWeb.Database.CustomerCategory>
@{
    ViewBag.Title = "客户分类";
}
<link href="~/Content/cxcolor/css/jquery.cxcolor.css" type="text/css" rel="stylesheet" />
<script src="~/Content/cxcolor/jquery.cxcolor.js"></script>
<script src="../../Scripts/customercategory.js?vn=20180813"></script>

<div class="list">
    <div>
        <button type="button" class="btn btn-default" id="btnNew">新增</button>
    </div>
    <table id="tCategory" style="max-width:600px">
        <thead>
            <tr>
                <th>分类名称</th>
                <th>标记颜色</th>
                <th style="width:120px"></th>
            </tr>
        </thead>
        <tbody>
            @foreach (var item in Model)
            {
                <tr id="@item.Id">

                    <td>@item.Name</td>
                    <td class="text-center">
                        @if (!string.IsNullOrEmpty(item.Color))
                        {
                            <div class="customer-flag" style="background-color: @item.Color;"></div>
                        }
                    </td>
                    <td>
                        <div class="operation-btns">
                            <div>
                                <button id="select">&nbsp;</button>
                            </div>
                            <ul>
                                <li><a href="javascript:void(0);" onclick="EditCategory('@item.Id','@item.Name','@item.Color');">编辑 </a></li>
                                <li><a href="javascript:void(0);" onclick="DeleteCategory('@item.Id');">删除</a></li>
                            </ul>
                        </div>

                    </td>
                </tr>
            }
        </tbody>
    </table>
</div>

<div id="divCategory" title="客户类别信息" style="display:none">
    <div id="divCategoryContent" style="overflow-y: auto; ">

        <table id="tableEdit" class="font85 tableEdit">
            <tr>
                <td class="label">分类名称</td>
                <td>
                    @Html.TextBox("Name", null, new { maxlength = "50" })&nbsp;<span class="redStar">*</span>
                    @Html.Hidden("Id")
                </td>
            </tr>
            <tr>
                <td class="label">分类颜色</td>
                <td>
                    <input id="category_color" name="category_color" type="text" class="input_cxcolor" readonly="readonly">
                    @Html.Hidden("Color")
                </td>
            </tr>
        </table>
        <br />

    </div>
    <div style="text-align:right;">
        <div class="error-msg"></div>
        <input type="button" class="btn btn-primary" id="btnSave" value="保存" />
        <input type="button" id="btnCancel" class="btn btn-default" onclick="$('#divCategory').dialog('close');" value="取消" />
    </div>
</div>
