{layout:default} {class:Shop.Admin.storeConfig.Area}
<lbhead>
    <title><%=Tag("地名管理")%>-<%=site.title%></title>
</lbhead>
<lbpath>
    <div class="tools">
    <ul>
    <%if (PageReturnMsg == ""){%>
    <li class="add"><a href="javascript:void(0);" onclick="EditArea(0);"><b></b><span><%=Tag("添加")%></span></a></li>
    <li class="submit"><a href="javascript:void(0);" onclick="Update();"><b></b><span><%=Tag("保存")%></span></a></li>
    <li class="del"><a href="javascript:void(0);" onclick="Area_Del();"><b></b><span><%=Tag("删除")%></span></a></li>
    <%}%>
    <li class="name"><span id="navIgation"><%=Tag("当前位置")%>：<a href="<%=site.AdminPath %>/Ajax/ajax_admin.aspx?__Action=MenuJump&pid=0"><%=Tag("管理首页")%></a> > <%=Tag("地名管理")%> <%=Getpath(pid)%></span></li>
    </ul>
    </div>
</lbpath>
<lbbody>
    <div class="searchbox">
        <input type="text" id="key" name="key" class="input-query" value="<%=key %>" onkeydown="if(event.keyCode==13){search_();}" /><input type="button" id="btnSou" class="btn-query" onclick="search_();" />
    </div>
    <table id="list" class="datalist">
        <tr class="title">
            <th style="width: 40px" class="selectAll">
                <a href="javascript:void(0);" onclick="$('input[name=\'Fid\']').attr('checked',!$(this).attr('checked'));$(this).attr('checked',!$(this).attr('checked'));"><%=Tag("全选")%></a>
            </th>
            <th style="width: 60px">
                <%=Tag("ID")%>
            </th>
            <th style="width: 60px">
                <%=Tag("代码")%>
            </th>
            <th style="width: 200px">
                <%=Tag("名称")%>
            </th>
            <th style="width: 100px">
                <%=Tag("子地名数")%>
            </th>        
            <th style="width: 100px">
                <%=Tag("排序")%>
            </th>
            <th>
                <%=Tag("编辑")%>
            </th>
        </tr>
        <%foreach (DB.LebiShop.Lebi_Area model in models)
          {%>
        <tr class="list" ondblclick="EditArea(<%=model.id %>);" >
            <td style="text-align:center">
                <input type="checkbox" name="Fid" del="true" value="<%=model.id %>" />
                <input type="hidden" name="IDS" shop="true" value="<%=model.id %>" />
            </td>
            <td>
                <%=model.id %>
            </td>
            <td>
                <%=model.Code %>
            </td>
            <td>
                <%=model.Name %>
            </td>
            <td>
                <%if (Count(model.id) == 0)
                  { %><%=Count(model.id)%><%}
                  else
                  { %><a href="?pid=<%=model.id %>"><%=Count(model.id)%></a><%} %>
            </td>
            <td>
                <input type="text" id="Sort<%=model.id %>" name="Sort<%=model.id %>" shop="true" class="input" style="width: 60px" value="<%=model.Sort %>" onkeyup="value=value.replace(/[^\d]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" />
            </td>
            <td>
                <a href="javascript:void(0)" onclick="EditArea(<%=model.id %>);"><%=Tag("编辑")%></a> | <a href="?pid=<%=model.id %>"><%=Tag("查看")%></a>
            </td>
        </tr>
        <%} %>
    </table>
    <script type="text/javascript">
        function search_() {
            var key = $("#key").val();
            window.location = "?pid=<%=pid %>&key=" + escape(key);
        }
        function EditArea(id) {
            var title_ = "<%=Tag("编辑地名")%>";
            if (id == 0) title_ = "<%=Tag("添加地名")%>"
            var url_ = "area_edit_window.aspx?pid=<%=pid %>&id=" + id;
            var width_ = 420;
            var height_ = "auto";
            var modal_ = true;
            EditWindow(title_, url_, width_, height_, modal_);
        }
        function Area_Del() {
            if (!confirm("<%=Tag("编辑")%>确认要删除？"))
                return false;
            var postData = GetFormJsonData("del");
            var url = "<%=site.AdminPath %>/ajax/ajax_site.aspx?__Action=Area_Del";
            RequestAjax(url,postData,function(){MsgBox(1, "<%=Tag("操作成功")%>", "?")});
        }
        function Update() {
            var postData = GetFormJsonData("shop");
            var url = "<%=site.AdminPath %>/ajax/ajax_site.aspx?__Action=Area_Update";
            RequestAjax(url,postData,function(){MsgBox(1, "<%=Tag("操作成功")%>", "?")});
        }
    </script>
</lbbody>
<lbbottom>
<input type="hidden" name="pid" shop="true" value="<%=pid %>" />
<div class="bottom" id="body_bottom">
    <%=PageString%>
</div>
</lbbottom>