{layout:default} {class:Shop.Admin.Config.Type}
<lbhead>
    <title><%=Tag("类型管理")%>-<%=site.title%></title>
</lbhead>
<lbfile>
    <link rel="stylesheet" type="text/css" href="<%=site.AdminAssetsPath %>/plugins/bigcolorpicker/jquery.bigcolorpicker.css" />
</lbfile>
<lbpath>
    <h3 class="text-themecolor m-b-0 m-t-0"><%=Tag("类型管理")%></h3>
    <ol class="breadcrumb">
        <li class="breadcrumb-item"><a href="<%=site.AdminPath %>/Ajax/ajax_admin.aspx?__Action=MenuJump&pid=0"><%=Tag("管理首页")%></a></li>
        <li class="breadcrumb-item active"><%=Tag("类型管理")%></li>
    </ol>
</lbpath>
<lbbody>
    <div class="col-12">
        <div class="card">
            <div class="card-body">
                <div class="row">
                    <div class="col-md-9 m-b-10">
                        <%if (PageReturnMsg == ""){%>
                        <button class="btn btn-success" onclick="Update();"><i class="ti-check"></i> <%=Tag("保存")%></button>
                        <%}%>
                    </div>
                    <div class="col-md-3 m-b-10 input-group">
                        <input type="text" id="key" name="key" value="<%=key %>" class="form-control" onkeydown="if(event.keyCode==13){search_();}">
                        <div class="input-group-append">
                            <button type="button" class="btn btn-primary" onclick="search_();"><i class="ti-search"></i></button>
                        </div>
                    </div>
                </div>
                <div class="table-responsive">
                    <table class="table table-hover no-wrap">
                        <thead>
                            <tr>
                                <th style="width:4%">
                                    <%=Tag("ID")%>
                                </th>
                                <th>
                                    <%=Tag("名称")%>
                                </th>
                                <th>
                                    <%=Tag("代码")%>
                                </th>
                                <th style="width:10%">
                                    <%=Tag("排序")%>
                                </th>
                                <th style="width:15%">
                                    <%=Tag("颜色")%>
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                            <%foreach (DB.LebiShop.Lebi_Type model in models){%>
                            <tr>
                                <td>
                                    <input type="hidden" name="IDS" shop="true" value="<%=model.id %>" />
                                    <%=model.id%>
                                </td>
                                <td>
                                    <%=model.Name%>
                                </td>
                                <td>
                                    <%=model.Class%>
                                </td>
                                <td>
                                    <input type="text" id="Sort<%=model.id %>" name="Sort<%=model.id %>" value="<%=model.Sort %>" class="form-control form-control-sm" shop="true" onkeyup='value=value.replace(/[^\d]/g,"")'>
                                </td>
                                <td>
                                    <div class="input-group">
                                        <input type="text" id="Color<%=model.id %>" name="Color<%=model.id %>" value="<%=model.Color %>" class="form-control form-control-sm" shop="true">
                                        <div class="input-group-append">
                                            <span class="input-group-text" id="s_Color<%=model.id %>" style="cursor: pointer;background-color:<%=model.Color %>">
                                                <i class="ti-paint-bucket"></i>
                                            </span>
                                        </div>
                                    </div>
                                </td>
                            </tr>
                            <%} %>
                        </tbody>
                    </table>
                </div>
                <div class="row">
                    <div class="col-12">
                        <nav aria-label="Page navigation ">
                            <%=PageString%>
                        </nav>
                    </div>
                </div>
            </div>
        </div>
    </div>
</lbbody>
<lbscripts>
    <script src="<%=site.AdminAssetsPath %>/plugins/bigcolorpicker/jquery.bigcolorpicker.min.js"></script>
    <script>
        $(function () {
            <%foreach (DB.LebiShop.Lebi_Type model in models){%>
                $("#s_Color<%=model.id %>").bigColorpicker(function (el, color) { $(el).css("background-color", color); $("#Color<%=model.id %>").val(color); });
            <%}%>
        });
        function search_() {
            var key = $("#key").val();
            window.location = "?key=" + escape(key);
        }
        function Update() {
            var postData = GetFormJsonData("shop");
            var url = "<%=site.AdminPath %>/ajax/ajax_site.aspx?__Action=Type_Update";
            RequestAjax(url,postData,function(){MsgBox(1, "<%=Tag("操作成功")%>", "")});
        }
    </script>
</lbscripts>