<%@ Page Title="User Rights" Language="C#" MasterPageFile="~/SunMaster.Master" AutoEventWireup="true" CodeBehind="UserRights.aspx.cs" Inherits="SUNWEB.UserRights" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
     <script type="text/javascript">

    function SelectAllCheckboxes(chk) {
        $('#<%=grdUserRights.ClientID %>').find("input:checkbox").each(function () {
            if (this != chk) {
                this.checked = chk.checked;
            }
        });
    }

    function SelectAllCheckboxes1(chk) {
        $('#<%=grdChkMultiBranch.ClientID %>').find("input:checkbox").each(function () {
            if (this != chk) {
                this.checked = chk.checked;
            }
        });
    }

     </script>


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<asp:UpdatePanel runat="server" ID="updatepanel1" UpdateMode="Conditional">
<ContentTemplate>
       <table style="margin-left: 1%; width: 98%;">
       <tr>
      <td style="font-size:large; width: 50%; font-family:'Open Sans', sans-serif; font-weight:bolder;">
         USER RIGHTS 
     </td>    
     
     </tr>
     </table>
     <div class="row">
                       
                        <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
                            <div class="card">
                                <h5 class="card-header" style="background-color: #4c4c4c; color: White; font-size: 14px;">User Rights</h5>
                                <div class="card-body">
                                    <form id="validationform" data-parsley-validate="" novalidate="">
                                        <div class="form-group row">
                                            <label class="col-12 col-sm-3 col-form-label text-sm-right">Company Name </label>
                                            <div class="col-12 col-sm-8 col-lg-6">
                                                <asp:DropDownList ID="cmbCompanyName"  runat="server" CssClass="custom-select" Enabled="false"></asp:DropDownList>
                                            </div>
                                        </div>

                                        <div class="form-group row">
                                            <label class="col-12 col-sm-3 col-form-label text-sm-right">User Name</label>
                                            <div class="col-12 col-sm-8 col-lg-6">
                                             <asp:DropDownList ID="cmbUser" AutoPostBack="true" onselectedindexchanged="cmbUsers_SelectedIndexChanged" runat="server" CssClass="custom-select"></asp:DropDownList>
                                            </div>
                                        </div>
                                      

                                        <div class="form-group row" runat="server">
                                            <label class="col-12 col-sm-3 col-form-label text-sm-right">Branch Name </label>
                                            <div class="col-12 col-sm-8 col-lg-6">
                                                  <asp:DropDownList ID="CmbBranchList" AutoPostBack="true" runat="server" onselectedindexchanged="CmbBranchList_SelectedIndexChanged" CssClass="custom-select"></asp:DropDownList>
                                            </div>
                                        </div>

                                        <div class="form-group row" runat="server">
                                           <label class="col-12 col-sm-3 col-form-label text-sm-right">
                                            <asp:Label ID="lblLicsenceType" runat="server"   Text="License Type"></asp:Label> 

                                            </label>
                                               

                                            <div class="col-12 col-sm-8 col-lg-6">
                                                
                                              <asp:Label ID="lblLicsenceValue" runat="server" ForeColor="Green" ></asp:Label>
                                             </div>
                                        </div>

                                        <label id="lbl1" runat="server"> </label>
                                        <div class="col-xl-4 col-lg-4 col-md-12 col-sm-12 col-12 mb-2" runat="server" visible="false">
                                        <label for="validationCustom03">
                                        <asp:Label ID="lblBranchAliasName"  ForeColor="Gray" runat="server" Text="Branch Name"></asp:Label></label>
                                        <asp:DropDownList ID="cmbBranches" CssClass="custom-select"  
                                         runat="server" AutoPostBack="true"       
                                         OnSelectedIndexChanged="cmbBranches_SelectedIndexChanged"></asp:DropDownList>                                \
                                         <br /><br />
                                         <asp:Label ID="lblMultiBranchMsg" runat="server" ForeColor="Green" Font-Size="Small"></asp:Label>
                                         <asp:HiddenField ID="hidCmid" runat="server" Visible="false"/>
                                         </div>
                                     
                                    </form>
                                </div>
                            </div>
                        </div>
            </div>


                      <%--Gridview--%>

             <div class="row" style="padding-left:18px;">
                        <div class="card">
                           <h4 class="card-header" style="background-color: #4c4c4c; color: White; font-size: 14px;">
                           <asp:Label ID="Label1" runat="server">PageWise Rights Information</asp:Label>
                           </h4>
                           <div class="card-body">
                           <div class="table-responsive">
                           <table id="Table1" class="table table-striped table-bordered second" style="width: 100%">
                           <tbody>
                           <caption>

                          <asp:Panel ID="Panel3"  runat="server" BackColor="white" Height="1750px" 
                            ScrollBars="Auto" Width="700px">
                            <div class="rounded_corners" style="width:600px;">
                            <asp:GridView ID="grdUserRights" runat="server" OnRowDataBound="grdUserRights_RowDataBound"  
                            CssClass="admin_mGrid" AutoGenerateColumns="false" 
                            Font-Size="Small"    
                            Font-Bold="true"
                            DataKeyNames="Pid" 
                            PageSize="50000"  
                            Width="600px" 
                            PagerStyle-CssClass="pgr"
                            AlternatingRowStyle-CssClass="alt" 
                            EmptyDataText="No Company Exist" Font-Names="Verdana" >
                          <Columns>

                        <asp:TemplateField>  
                        <HeaderTemplate>   
                            <asp:CheckBox ID="chkAllSelect" runat="server" Visible="false"   onclick="javascript:SelectAllCheckboxes(this);" />  
                        </HeaderTemplate>  
                        <ItemTemplate>  
                            <asp:CheckBox ID="chkSelect" Checked="true" runat="server" Visible="false"  />  
                        </ItemTemplate>  
                        </asp:TemplateField> 
                        <asp:TemplateField HeaderText="SNo">
                        <ItemTemplate>
                        <%#Container.DataItemIndex+1 %>
                        </ItemTemplate>
                        </asp:TemplateField>
                            
                        <asp:TemplateField HeaderText="Pid" Visible="false" >
                        <ItemTemplate>
                        <asp:Label ID="lblPid" runat="server" Text='<%#Eval("Pid")%>'></asp:Label>
                        </a>
                        </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Page Name" >
                        <ItemTemplate>
                        <asp:Label ID="lblPageName" runat="server" Text='<%#Eval("PageName") %>'></asp:Label>
                        </ItemTemplate>
                        </asp:TemplateField> 

                      <asp:TemplateField  >  
                      <HeaderTemplate>   
                      <asp:Label ID="lblPageAccess" runat="server" Text=" Page Access"></asp:Label>
                      </HeaderTemplate>  
                      <ItemTemplate >  
                      <asp:CheckBox ID="chkPageAccess"  runat="server" />  
                      </ItemTemplate>  
                      </asp:TemplateField> 
                      <asp:TemplateField>  
                        <HeaderTemplate>   
                      <asp:Label ID="lblRead" runat="server" Text="Read"></asp:Label>
                        </HeaderTemplate>  
                        <ItemTemplate >  
                        <asp:CheckBox ID="chkRead"   runat="server" />  
                        </ItemTemplate>  
                      </asp:TemplateField>  
                       <asp:TemplateField  >  
                      <HeaderTemplate>   
                       <asp:Label ID="lblWrite" runat="server" Text="Write"></asp:Label>
                       </HeaderTemplate>  
                       <ItemTemplate >  
                       <asp:CheckBox ID="chkWrite"   runat="server" />  
                       </ItemTemplate>  
                       </asp:TemplateField>  
                                  
                   <asp:TemplateField>  
                    <HeaderTemplate>   
                   <asp:Label ID="lblDownload" runat="server" Text="DownLoad"></asp:Label>
                    </HeaderTemplate>  
                    <ItemTemplate >  
                    <asp:CheckBox ID="chkDownload"   runat="server" />  
                    </ItemTemplate>  
                    </asp:TemplateField>  
                    </Columns>
                    <EditRowStyle CssClass="EditRowStyle" />
                    <FooterStyle CssClass="HeaderStyle" />
                    <HeaderStyle CssClass="HeaderStyle" />
                    <RowStyle CssClass="RowStyle" />
                    <SelectedRowStyle CssClass="SelectedRowStyle" />
                    </asp:GridView>
                    <h4><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<asp:Label ID="lblMultipleRightsLABEL" runat="server"   Text="Multi Branch Rights Permission"></asp:Label>  </b>   </h4>
                      
                  <div class="rounded_corners" style="width:600px;">
                     <asp:GridView ID="grdChkMultiBranch" runat="server"  
                          CssClass="admin_mGrid" AutoGenerateColumns="false" 
                          
                           Font-Size="Small" 
                           DataKeyNames="BranchId " 
                          PageSize="50000"  
                          Width="600px" 
                          PagerStyle-CssClass="pgr"
                          AlternatingRowStyle-CssClass="alt" 
                          EmptyDataText="No Company Exist" Font-Names="Verdana"  >
                  
                          <Columns>
                          <asp:TemplateField>  
                          <HeaderTemplate>   
                          <asp:CheckBox ID="chkAllSelect" runat="server" Visible="false" onclick="javascript:SelectAllCheckboxes1(this);" />  
                           <%-- <asp:Label ID="lblRead" runat="server" Text="Multi Branch Access "></asp:Label>--%>
                          </HeaderTemplate>  
                          <ItemTemplate>  
                          <asp:CheckBox ID="chkSelect"   Checked="true"  runat="server" Visible="false" />  
                          </ItemTemplate>  
                          </asp:TemplateField> 
                          <asp:TemplateField HeaderText="SNo">
                          <ItemTemplate>
                          <%#Container.DataItemIndex+1 %>
                          </ItemTemplate>
                          </asp:TemplateField>
                          <asp:TemplateField HeaderText="BranchId" Visible="true" >
                          <ItemTemplate>
                          <asp:Label ID="lblBranchID" runat="server" Text='<%#Eval("BranchID")%>'></asp:Label>
                          </a>
                          </ItemTemplate>
                          </asp:TemplateField>
                          <asp:TemplateField HeaderText="Branch Name" >
                          <ItemTemplate>
                          <asp:Label ID="lblBranchName" runat="server" Text='<%#Eval("Branches") %>'></asp:Label>
                          </ItemTemplate>
                          </asp:TemplateField> 
                          <asp:TemplateField  >  
                        <HeaderTemplate>   
                        <asp:Label ID="lblPageAccess" runat="server" Text=" Branch Access"></asp:Label>
                        </HeaderTemplate>  
                        <ItemTemplate >  
                        <asp:CheckBox ID="chkBranchPageAccess"   runat="server" />  
                        </ItemTemplate>  
                        </asp:TemplateField>  
                        </Columns>
                        <EditRowStyle CssClass="EditRowStyle" />
                        <FooterStyle CssClass="HeaderStyle" />
                        <HeaderStyle CssClass="HeaderStyle" />
                        <RowStyle CssClass="RowStyle" />
                        <SelectedRowStyle CssClass="SelectedRowStyle" />
                      </asp:GridView>

                       <div class="form-group row text-right">
                       <div class="col col-sm-10 col-lg-9 offset-sm-1 offset-lg-0">
                       <asp:Button ID="btnSubmit" OnClientClick="return validate()"  runat="server"  CssClass="btn btn-space btn-primary"
                       Text="Create" onclick="btnSubmit_Click" />
                       <asp:Button ID="btnUpdate"   runat="server"   Text="Update" onclick="btnUpdate_Click" CssClass="btn btn-space btn-primary"  />
                       </div>
                       </div>

                      </div>
                      </asp:Panel>
                      </caption>
                      </table>
                      </div>
                      </div>
                      </div>
                      </div>
 
     </ContentTemplate>
     </asp:UpdatePanel>

<script src="https://code.jquery.com/jquery-3.7.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css?v=1.1" rel="stylesheet" />
<!-- Bootstrap 5 -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" />
<!-- Optional Bootstrap Icons -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css" rel="stylesheet" />


</asp:Content>
