<%@ Page Title="" Language="C#" MasterPageFile="~/Application.Master" AutoEventWireup="true" CodeBehind="UserGroup.aspx.cs" Inherits="ICDAS_3_0_Web_App.Administration.UserGroup" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <%@ Register Src="~/User_Controls/ucSearchGrid.ascx" TagPrefix="ucSearchGrid" TagName="ucSearchGrid" %>
    <%@ Register Src="~/User_Controls/ucToolBar.ascx" TagPrefix="ucToolBar" TagName="ucToolBar" %>
    <!--THIS SCRIPT IS USED FOR MAINTAINING SCROLL POSITION ON POSTBACK OF GRID-->
    <script type="text/javascript">
        window.onload = function () {
            var h = document.getElementById("<%=div_position.ClientID%>");
            document.getElementById("<%=dvScroll.ClientID%>").scrollTop = h.value;
        }
        function SetDivPosition() {
            var intY = document.getElementById("<%=dvScroll.ClientID%>").scrollTop;
            var h = document.getElementById("<%=div_position.ClientID%>");
            h.value = intY;
        }

        function afterpostback() {

            var h = document.getElementById("<%=div_position.ClientID%>");
            document.getElementById("<%=dvScroll.ClientID%>").scrollTop = h.value;

        }

        function SelectAllCheckboxes(spanChk) {
            var xState = spanChk.checked;
            var theBox = spanChk;
            elm = theBox.form.elements;
            for (i = 0; i < elm.length; i++)
                if (elm[i].type == "checkbox" && elm[i].id != theBox.id) {
                    if (elm[i].checked != xState)
                        elm[i].click();
                }
        }

    </script>
</asp:Content>
<asp:Content ID="cotMain" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:UpdatePanel ID="upnlwzUserGroup" UpdateMode="Always" runat="server">
        <ContentTemplate>
            <div class="row">
                <div class="col-md-12 col-sm-12 col-xs-12">
                    <div class="x_panel">
                        <div class="x_content">
                            <asp:HiddenField ID="hdnRecordId" Value="0" runat="server" />
                            <asp:HiddenField ID="hdnEditRecordId" Value="0" runat="server" />
                            <asp:HiddenField ID="hdnRecordIds" Value="" runat="server" />
                            <asp:HiddenField ID="hdnRowIndex" Value="0" runat="server" />
                            <asp:HiddenField ID="div_position" Value="0" runat="server" />
                            <div class="x_title">
                                <h4>
                                    <asp:Label ID="lblFormTitle" runat="server"></asp:Label></h4>
                                <div class="clearfix"></div>
                            </div>
                            <div id="wizard" class="form_wizard wizard_horizontal">
                                <ul class="wizard_steps">
                                    <li>
                                        <a runat="server" id="aStep1" class="selected">
                                            <span class="step_no">1</span>
                                            <small>Search Records</small>
                                            </span>
                                        </a>
                                    </li>
                                    <li>
                                        <a runat="server" id="aStep2" class="disabled">
                                            <span class="step_no">2</span>
                                            <small>Manage User Group</small>
                                            </span>
                                        </a>
                                    </li>
                                    <li>
                                        <a runat="server" id="aStep3" class="disabled">
                                            <span class="step_no small">3</span>
                                            <small>Manage Group Access</small>
                                            </span>
                                        </a>
                                    </li>
                                </ul>
                            </div>

                            <div class="col-xs-12 col-sm-12 col-lg-12">
                                <ucToolBar:ucToolBar runat="server" ID="ucToolBar" DisplaySaveAs="N" />
                            </div>
                            <div class="col-xs-12 col-sm-12 col-lg-12">
                                <asp:Wizard ID="wzMain" CssClass="col-sm-12" DisplaySideBar="false" OnActiveStepChanged="wzMain_ActiveStepChanged"
                                    runat="server" class="form_wizard wizard_horizontal">
                                    <WizardSteps>
                                        <asp:WizardStep ID="Step0" runat="server">
                                            <ucSearchGrid:ucSearchGrid runat="server" ID="ucSearchGrid" />
                                        </asp:WizardStep>
                                        <asp:WizardStep StepType="Step" ID="Step1" runat="server">
                                            <div class="row">
                                                <div class="col-xs-12 col-sm-12 col-lg-6">
                                                    <div class="input-group">
                                                        <span class="input-group-addon">Name*</span>
                                                        <asp:TextBox ID="txtGroupName" MaxLength="100" runat="server" CssClass="form-control" AutoCompleteType="Disabled" autocomplete="off"
                                                            placeholder="Enter Group Name" required onkeypress="return blockSpecialChar(event)" />
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-xs-12 col-sm-12 col-lg-6">
                                                    <div class="input-group">
                                                        <span class="input-group-addon">Details</span>
                                                        <asp:TextBox ID="txtUserGroupDetails" MaxLength="255" runat="server" TextMode="MultiLine" Rows="3" CssClass="form-control" AutoCompleteType="Disabled" autocomplete="off"
                                                            placeholder="Enter Details" onkeypress="return blockSpecialChar(event)" />
                                                    </div>
                                                </div>
                                                <div class="col-xs-12 col-sm-12 col-lg-4" style="display: none;">
                                                    <div class="input-group">
                                                        <span class="input-group-addon">Status</span>
                                                        <asp:RadioButtonList ID="optRecordStatus" runat="server" CssClass="form-control" RepeatDirection="Horizontal">
                                                            <asp:ListItem Value="0" Selected="True" style="margin-right: 20px">Active</asp:ListItem>
                                                            <asp:ListItem Value="1" style="margin-right: 30px">Not Active</asp:ListItem>
                                                        </asp:RadioButtonList>

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

                                        </asp:WizardStep>
                                        <asp:WizardStep ID="Step2" runat="server">
                                            <div class="row">
                                                <div class="col-xs-12 col-sm-12 col-lg-6">
                                                    <div class="input-group">
                                                        <span class="input-group-addon">Group Name</span>
                                                        <asp:TextBox ID="txtGroupNameDisplay" MaxLength="100" runat="server" CssClass="form-control" AutoCompleteType="Disabled" autocomplete="off"
                                                            ReadOnly="true" />
                                                    </div>
                                                </div>
                                                <div class="col-xs-12 col-sm-12 col-lg-12">
                                                    <div style="text-align: center;">
                                                        <span><b>Access Rights - Select / Deselect All</b></span>
                                                        <asp:CheckBox ID="chkAll" onclick="javascript:SelectAllCheckboxes(this);" runat="server"
                                                            ToolTip="Select/Deselect All"></asp:CheckBox>
                                                    </div>
                                                </div>
                                                <div class="col-xs-12 col-sm-12 col-lg-12">
                                                    <table id="tblHeader" class="table table-bordered dt-responsive nowrap" style="background-color: #ddd;">
                                                        <tr>
                                                            <td style="width: 55%; text-align: center">Menu Name</td>
                                                            <td style="width: 7%; text-align: center">View</td>
                                                            <td style="width: 7%; text-align: center">Add</td>
                                                            <td style="width: 7%; text-align: center">Edit</td>
                                                            <td style="width: 7%; text-align: center">Save</td>
                                                            <td style="width: 7%; text-align: center">Delete</td>
                                                            <td style="width: 7%; text-align: center">Print</td>
                                                            <td class="hidden">&nbsp</td>
                                                        </tr>
                                                    </table>
                                                </div>
                                                <div class="col-xs-12 col-sm-12 col-lg-12">
                                                    <div id="dvScroll" onscroll="SetDivPosition()" runat="server" style="height: 350px; overflow: auto; overflow-x: hidden;">
                                                        <asp:GridView ID="grdProjectMenu" runat="server" CellPadding="0" CellSpacing="0"
                                                            AllowPaging="false" AllowSorting="false" AutoGenerateColumns="False" OnRowDataBound="grdProjectMenu_RowDataBound"
                                                            CssClass="table table-bordered dt-responsive nowrap"
                                                            ShowHeader="false">
                                                            <Columns>
                                                                <asp:TemplateField HeaderText="Menu Name">
                                                                    <ItemTemplate>
                                                                        <asp:Label ID="lblMenuName" runat="server" Text='<%# Eval("MenuName")%>'></asp:Label>
                                                                    </ItemTemplate>
                                                                    <HeaderStyle />
                                                                    <ItemStyle HorizontalAlign="Left" Width="58%" />
                                                                </asp:TemplateField>
                                                                <asp:TemplateField HeaderText="View">
                                                                    <ItemTemplate>
                                                                        <asp:CheckBox ID="chkViewAccess" Checked='<%# Eval("ViewAccess").ToString() == "1" ? true : false %>' runat="server" AutoPostBack="true" OnCheckedChanged="chkAccess_CheckedChanged"></asp:CheckBox>
                                                                    </ItemTemplate>
                                                                    <HeaderStyle Width="7%" />
                                                                    <ItemStyle HorizontalAlign="Center" Width="7%" />
                                                                </asp:TemplateField>
                                                                <asp:TemplateField HeaderText="Add">
                                                                    <ItemTemplate>
                                                                        <asp:CheckBox ID="chkAddAccess" Checked='<%# Eval("AddAccess").ToString() == "1" ? true : false %>' runat="server" AutoPostBack="true" OnCheckedChanged="chkAccess_CheckedChanged"></asp:CheckBox>
                                                                    </ItemTemplate>
                                                                    <HeaderStyle Width="7%" />
                                                                    <ItemStyle HorizontalAlign="Center" Width="7%" />
                                                                </asp:TemplateField>
                                                                <asp:TemplateField HeaderText="Edit">
                                                                    <ItemTemplate>
                                                                        <asp:CheckBox ID="chkEditAccess" Checked='<%# Eval("EditAccess").ToString() == "1" ? true : false %>' runat="server" AutoPostBack="true" OnCheckedChanged="chkAccess_CheckedChanged"></asp:CheckBox>
                                                                    </ItemTemplate>
                                                                    <HeaderStyle Width="8%" />
                                                                    <ItemStyle HorizontalAlign="Center" Width="8%" />
                                                                </asp:TemplateField>
                                                                <asp:TemplateField HeaderText="Save">
                                                                    <ItemTemplate>
                                                                        <asp:CheckBox ID="chkSaveAccess" Checked='<%# Eval("SaveAccess").ToString() == "1" ? true : false %>' runat="server" AutoPostBack="true" OnCheckedChanged="chkAccess_CheckedChanged"></asp:CheckBox>
                                                                    </ItemTemplate>
                                                                    <HeaderStyle Width="7%" />
                                                                    <ItemStyle HorizontalAlign="Center" Width="7%" />
                                                                </asp:TemplateField>
                                                                <asp:TemplateField HeaderText="Delete">
                                                                    <ItemTemplate>
                                                                        <asp:CheckBox ID="chkDeleteAccess" Checked='<%# Eval("DeleteAccess").ToString() == "1" ? true : false %>' runat="server" AutoPostBack="true" OnCheckedChanged="chkAccess_CheckedChanged"></asp:CheckBox>
                                                                    </ItemTemplate>
                                                                    <HeaderStyle Width="7%" />
                                                                    <ItemStyle HorizontalAlign="Center" Width="7%" />
                                                                </asp:TemplateField>
                                                                <asp:TemplateField HeaderText="Print">
                                                                    <ItemTemplate>
                                                                        <asp:CheckBox ID="chkPrintAccess" Checked='<%# Eval("PrintAccess").ToString() == "1" ? true : false %>' runat="server" AutoPostBack="true" OnCheckedChanged="chkAccess_CheckedChanged"></asp:CheckBox>
                                                                    </ItemTemplate>
                                                                    <HeaderStyle Width="7%" />
                                                                    <ItemStyle HorizontalAlign="Center" Width="7%" />
                                                                </asp:TemplateField>
                                                                <asp:BoundField DataField="MenuCode" HeaderText="MenuCode">
                                                                    <HeaderStyle CssClass="hidden"></HeaderStyle>
                                                                    <ItemStyle CssClass="hidden"></ItemStyle>
                                                                </asp:BoundField>
                                                                <asp:TemplateField HeaderText="Menu Type">
                                                                    <ItemTemplate>
                                                                        <asp:Label ID="lblMenuType" runat="server" Text='<%# Eval("MenuType")%>'></asp:Label>
                                                                    </ItemTemplate>
                                                                    <HeaderStyle CssClass="hidden"></HeaderStyle>
                                                                    <ItemStyle CssClass="hidden"></ItemStyle>
                                                                </asp:TemplateField>
                                                                <asp:BoundField DataField="AccessId" HeaderText="AccessId">
                                                                    <HeaderStyle CssClass="hidden"></HeaderStyle>
                                                                    <ItemStyle CssClass="hidden"></ItemStyle>
                                                                </asp:BoundField>
                                                                <asp:BoundField DataField="MenuGroup" HeaderText="MenuGroup">
                                                                    <HeaderStyle CssClass="hidden"></HeaderStyle>
                                                                    <ItemStyle CssClass="hidden"></ItemStyle>
                                                                </asp:BoundField>
                                                                <asp:BoundField DataField="MenuLevelType" HeaderText="MenuLevelType">
                                                                    <HeaderStyle CssClass="hidden"></HeaderStyle>
                                                                    <ItemStyle CssClass="hidden"></ItemStyle>
                                                                </asp:BoundField>
                                                                <asp:BoundField DataField="MenuLevel" HeaderText="MenuLevel">
                                                                    <HeaderStyle CssClass="hidden"></HeaderStyle>
                                                                    <ItemStyle CssClass="hidden"></ItemStyle>
                                                                </asp:BoundField>
                                                                <asp:TemplateField HeaderText="Menu Type">
                                                                    <ItemTemplate>
                                                                        <asp:Label ID="lblModifed" runat="server" Text='<%# Eval("Modifed")%>'></asp:Label>
                                                                    </ItemTemplate>
                                                                    <HeaderStyle CssClass="hidden"></HeaderStyle>
                                                                    <ItemStyle CssClass="hidden"></ItemStyle>
                                                                </asp:TemplateField>
                                                            </Columns>
                                                        </asp:GridView>
                                                    </div>
                                                </div>
                                                <br />
                                            </div>
                                        </asp:WizardStep>
                                    </WizardSteps>
                                    <StartNavigationTemplate>
                                        <asp:Button ID="btnNextButton" Visible="false" runat="server" Text="Next" CommandName="MoveNext" CssClass="btn btn-primary btn-sm" />
                                    </StartNavigationTemplate>
                                    <StepNavigationTemplate>
                                        <br />
                                        <asp:Button ID="btnStepPrevious" formnovalidate="true" runat="server" ToolTip="CONTINUE TO PREVIOUS SCREEN WITHOUT SAVING RECORDS" CausesValidation="false" Text="Previous" CssClass="btn btn-success btn-sm" OnClick="btnStepPrevious_Click" />
                                        <asp:Button ID="btnStepNext" formnovalidate="true" runat="server" ToolTip="CONTINUE TO NEXT SCREEN WITHOUT SAVING RECORDS" Text="Continue" CssClass="btn btn-primary btn-sm" OnClick="btnStepNext_Click" />
                                    </StepNavigationTemplate>
                                    <FinishNavigationTemplate>
                                        <br />
                                        <asp:Button ID="btnPrevious" runat="server" formnovalidate="true" Text="Previous" CssClass="btn btn-success btn-sm" ToolTip="MOVE BACK TO PREVIOUS SCREEN" CommandName="MovePrevious" />
                                    </FinishNavigationTemplate>
                                </asp:Wizard>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>

