<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="Category2.aspx.cs" Inherits="helpdesk.Admin.Category2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">


    

        


    <!-- add check item -->
       <asp:UpdatePanel runat="server" ID="pnl1"  UpdateMode="Conditional"  >
        <ContentTemplate>

     <div class="layui-fluid">
         <div class="layui-row layui-col-space15">
             <div class="layui-col-md12">
                 <div class="layui-card">

                     <div class="layui-card-header">配置问题二级分类</div>
                     <div class="layui-card-body">

                         <div class="layui-form">


                             <div class="layui-form-item">
                                 <label class="layui-form-label req">一级分类</label>
                                 <div class="layui-input-inline">
                                   
                                   <asp:DropDownList ID="ddl_parentcategory"   
                                      AutoPostBack="true" lay-ignore
                                        runat="server" 
                                        CssClass="form-control"
                                        >
                                    </asp:DropDownList>  
                                 </div>                               
                             </div>
                            
                             <div class="layui-form-item">
                                 <label class="layui-form-label req">二级分类</label>
                                 <div class="layui-input-block">
                                     <asp:TextBox class="layui-input" 
                                          ValidationGroup="add" 
                                          width="600px"
                                         ID="txt_catname"   runat="server"></asp:TextBox>
                                    <asp:RequiredFieldValidator ValidationGroup="add" ID="RequiredFieldValidator1" runat="server"
                                         ErrorMessage="必须填写类别" ControlToValidate="txt_catname" Display="Dynamic"></asp:RequiredFieldValidator>

 
                                 </div>  
                             </div>




                           <div class="layui-form-item">
                                 <label class="layui-form-label">默认负责人</label>
                                 <div class="layui-input-inline">
                                   
                                <asp:TextBox class="layui-input"   id="txt_usernames" runat="server"></asp:TextBox>

                                 </div>

                                   <div class="layui-form-mid layui-word-aux"> 

                                       <a href="###"
                                           onclick="Pop('Pop_User.aspx?t=open',500,450); return false" 
                                            class="layui-btn layui-btn-sm layui-btn-warm">
                                        
                                           选择负责人
                                           
                                           </a> 指派一个默认负责人后，系统自动派单给默认负责人</div>
                              
                             </div>


                             


                             <div class="layui-form-item">
                                 <label class="layui-form-label req">排序号</label>
                                 <div class="layui-input-inline">
                                   
                                    <asp:TextBox class="layui-input" ID="txt_orderid" Text="0" runat="server"></asp:TextBox>

                                 </div>

                                   <div class="layui-form-mid layui-word-aux">数字越小越靠前 支持负数</div>

                               
                             </div>

                              
                             <div class="layui-form-item">
                                 <div class="layui-input-block">
                                     <asp:Button runat="server"  class="layui-btn" ID="btn_save" ValidationGroup="add"  Text="添加" OnClick="btn_save_Click"/>
                                    
                                 </div>
                             </div>
                         </div>

                     </div>
                 </div>
             </div>
         </div>
  </div>

            </ContentTemplate>
           </asp:UpdatePanel>
     <!-- /add check item -->






    

    <!-- list -->

     <asp:UpdatePanel runat="server" ID="pnl2"  >
        <ContentTemplate>
   
            <div class="layui-card">
                 <div class="layui-card-body">
     
      <div style="padding-bottom: 10px;">
          <asp:Button runat="server" ID="btn_del" 
               OnClientClick=" if(!isselect()) { return false;} "
               Text="批量删除" 
              class="layui-btn layui-btn-danger"
               OnClick="btn_del_Click" />

           

            <asp:LinkButton ID="lb_update_order" runat="server" 
                            class="layui-btn layui-btn-primary "
                            onclick="lb_update_order_Click"> 
                             更新排序

                            </asp:LinkButton>  <span class="layui-word-aux">在下表的排序号里输入数字 一次性更新</span>

                             
      
        </div>


 

                     <asp:ListView runat="server" ID="lv_lists"
                         
                         
                          EnableViewState="false"  DataSourceID="sds" DataKeyNames="id" OnItemUpdating="lv_lists_ItemUpdating">

                           <LayoutTemplate>
                            
                                         <table   lay-filter="tbl-lists" class="layui-table"  >
                                              <thead>
                                              <tr>
                                                
                                                 <th width="60px" > 
                                                     
                                                     <input type="checkbox"   id="chk_all" lay-skin="primary"    lay-filter="chk_all" > ID

                                                 </th>
                                                 <th width="100px">排序号</th>
                                                 <th width="500px" >二级分类</th> 

                                                   <th width="200px" >默认负责人</th> 

                                                 <th >操作</th>
                                             </tr>
                                                  </thead>
                                            
                                             
                                              <tbody>  
                                                 <tr id="itemPlaceholder" runat="server">
                                                 </tr>
                                            </tbody>
                                         </table>
                                     
                                         
                                   
                         </LayoutTemplate>
                       


                          <ItemTemplate>
                             <tr  > 
                                 
                                 <td>
                                     <input type="checkbox"  class="chk_item" value="<%# Eval("id") %>"   name="chk_item" lay-skin="primary" >
                                     <asp:Literal  runat="server" ID="lt_id" Text='<%#Eval("id") %>'></asp:Literal>
                                     
                                 </td>

                                   <td>
                                         <asp:TextBox runat="server"  CssClass="layui-input"   Text='<%#Bind("orderId") %>' ID="txt_orderid"></asp:TextBox>

                                 </td>

                                 <td>
                                    <%# Eval("catname") %>
                                </td>
                                
                                 <td>
                                    <%# Eval("usernames") %>
                                </td>
                                  

                                 <td>

                                   <asp:LinkButton runat="server" ID="EditButton"  CommandName="Edit"
                                        class="layui-btn layui-btn-xs"
                                       >编辑</asp:LinkButton>


                                         <asp:LinkButton runat="server" ID="DeleteButton" 
                                             
                                              OnClientClick="return confirm('确定删除吗？')"
                                              CommandName="Delete"
                                        class="layui-btn layui-btn-danger layui-btn-xs"
                                       >删除</asp:LinkButton>


                                      
                                     
                                 </td>
                             </tr>
                         </ItemTemplate>
                        
                         
                         <EditItemTemplate>
                             <tr style="">
                                
                                 <td>
                                    
                                 </td>

                                   
                                 <td>
                                     <asp:TextBox ID="orderids" CssClass="layui-input  " runat="server" Text='<%# Bind("orderid") %>' />
                                 </td>


                                 <td>
                                     <asp:TextBox ID="catnameTextBox" runat="server"  CssClass="layui-input  "  Text='<%# Bind("catname") %>' />
                                 </td>

                                 
                                 <td>
                                     <asp:TextBox ID="usernamesTextBox" runat="server"  CssClass="layui-input  "  Text='<%# Eval("usernames") %>' />
                                 </td>

                              
                                
                            
                               
                                 <td>
                                     <asp:LinkButton ID="UpdateButton" 
                                          class="layui-btn layui-btn-xs layui-btn-normal"

                                         runat="server" CommandName="Update" Text="更新" />
 

                                     <asp:LinkButton 
                                         
                                           class="layui-btn layui-btn-xs layui-btn-warm"
                                         ID="CancelButton" runat="server" CommandName="Cancel" Text="取消" />
                                 </td>
                             </tr>
                         </EditItemTemplate>
                         
                         


                     </asp:ListView>




                   


 








       <asp:SqlDataSource ID="sds"   
             
           ConnectionString='<%$ ConnectionStrings:ConnectionString %>'
           Runat="server" 
           DeleteCommand="DELETE FROM [helphesk_categories] WHERE [id] = @id"  
           SelectCommand="SELECT id,catname,orderid, uids, usernames from helphesk_categories where parentid =@parentid order by orderid asc   " 
           UpdateCommand="UPDATE [helphesk_categories] SET [catname] = @catname, uids=@uids,  usernames=@usernames,  orderid=@orderid   WHERE [id] = @id" 


           
              >

              <SelectParameters>
        <asp:ControlParameter ControlID="ddl_parentcategory" Name="parentid" />
       </SelectParameters>
            

        
    </asp:SqlDataSource>

 
     
</div>
                </div>
      
            



                


        </ContentTemplate>
    </asp:UpdatePanel>


    <!-- /list -->



     
    
    
      <script src="../layuiadmin/layui/layui.all.js"></script> 

     

    <script> 
          
        chkAll();

    </script>

 
    <input type="hidden" name="hf_ids" id="hf_ids" />










    <script>



        function SetOpValue(o2) {
            try {
                result = o2.split(";");
                for (i = 0; i < result.length; i++) {
                    if (result[i] != "") {
                        var r = result[i].split("$");
                        var _username = r[1];
                        //var _username = "";
                        $("#<%=txt_usernames.ClientID%>").val(_username);
                    }
                }
            }
            catch (e) {

            }

        }


         

    </script>


</asp:Content>
