<%@ page language="C#" autoeventwireup="true" inherits="Forms_UserGroupsCSS, App_Web_oqpl0drw" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Src="~/UserControls/New_Header.ascx" TagName="Header" TagPrefix="uc1" %>
<%@ Register Src="~/UserControls/New_Footer.ascx" TagName="Footer" TagPrefix="uc2" %>

<%--<%@ Register Assembly="DevExpress.Web.ASPxGridView.v8.2, Version=8.2.10.0, Culture=neutral, PublicKeyToken=9B171C9FD64DA1D1"
    Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dxwgv" %>
<%@ Register Assembly="DevExpress.Web.ASPxEditors.v8.2, Version=8.2.10.0, Culture=neutral, PublicKeyToken=9B171C9FD64DA1D1"
    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>--%>

<%@ Register Assembly="DevExpress.Web.v14.2" Namespace="DevExpress.Web" TagPrefix="dxw" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>tSense-IoT Manage User Groups</title>
    <meta http-equiv="X-UA-Compatible" content="IE=7" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="Page-Enter" content="blendTrans(Duration=0)" />
    <meta http-equiv="Page-Exit" content="blendTrans(Duration=0)" />
    <link href="../css/reset.css" rel="stylesheet" type="text/css" />
    <link href="../css/stylesheet2.css" rel="stylesheet" type="text/css" />
    <link href="../css/Updated_css.css" rel="stylesheet" type="text/css" />
    <link href="../css/dropdown.css" rel="stylesheet" type="text/css" />
    <link rel="SHORTCUT ICON" href="../images/favicon.ico" />
    <script src="../js/wow.min.js"></script>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScmUserGroup" runat="server">
        </asp:ScriptManager>
        <asp:UpdatePanel ID="upUserGroup" runat="server">
            <ContentTemplate>
                <div id="container">
                    <!-- Header Starts Here -->
                    <uc1:Header ID="ucHeader" runat="server" />
                    <!-- Nav Ends Here -->
                    <!-- Content Starts Here -->
                    <div id="outer">
                        <div id="inner">
                            <div id="float-wrap">
                                <!-- Main Content Starts Here -->
                                <!-- Main Content Starts Here -->
                                <div id="content">
                                    <div class="content-wrap">
                                        <div id="top-content">
                                            <div id="heading">
                                                <img class="icon" src="../images/configuration-icon.jpg" alt="" />
                                                <h1>Configuration</h1>
                                                <a href="Dashboard.aspx">Home</a><span>&gt;</span><span><a href="ConfigurationSetup.aspx">User 
                                            Groups</a></span><span>&gt;</span><span><a href="UserGroups.aspx">Manage</a></span>
                                            </div>
                                            <div id="control-box">
                                                <table border="0" cellpadding="0" cellspacing="0" id="control-tbl" width="100%">
                                                    <tr height="20px">
                                                        <td>&nbsp;
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <div id="control-btn">
                                                                <table cellpadding="0" cellspacing="0" border="0" align="right">
                                                                    <tr>
                                                                        <td colspan="3">&nbsp;
                                                                        </td>
                                                                        <td>
                                                                            <asp:ImageButton ID="btnAddUser" runat="server" ImageUrl="~/images/btn-add-usergroup.jpg"
                                                                                OnClick="btnAddUser_Click" />
                                                                        </td>
                                                                        <td>&nbsp;&nbsp;
                                                                        </td>
                                                                        <td>
                                                                            <asp:ImageButton ID="lbtAssignUserGrp" runat="server" ImageUrl="~/images/btn-group-assignment.jpg"
                                                                                PostBackUrl="~/Forms/GroupUserAssignment.aspx" />
                                                                        </td>
                                                                        <td>&nbsp;&nbsp;
                                                                        </td>
                                                                        <td>
                                                                            <asp:ImageButton ID="ibtManageUsers" runat="server" ImageUrl="~/images/btn-manage-users.jpg"
                                                                                PostBackUrl="~/Forms/EmployeeMaster.aspx" />
                                                                        </td>
                                                                        <td>&nbsp;&nbsp;
                                                                        </td>
                                                                        <td>
                                                                            <asp:ImageButton ID="btnBack" runat="server" PostBackUrl="~/Forms/ConfigurationSetup.aspx"
                                                                                ImageUrl="~/images/btn-back-to-configuration.jpg" />
                                                                        </td>
                                                                        <td>&nbsp;&nbsp;&nbsp;&nbsp;
                                                                        </td>
                                                                    </tr>
                                                                </table>
                                                            </div>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </div>
                                            <div class="clear clearfix">
                                            </div>
                                        </div>
                                        <div class="clear clearfix">
                                        </div>
                                        <asp:Panel ID="pnlUserGroupInformations" runat="server" CssClass="ControlShow">
                                            <div class="form-box">
                                                <h1>
                                                    <span class="icon">
                                                        <img src="../images/icn-manage-usergroup.gif" alt="" /></span>Manage User 
                                                Groups</h1>
                                                <table border="0" cellpadding="0" cellspacing="0" class="form-tbl">
                                                    </tr>
                                                <tr>
                                                    <td class="split"></td>
                                                    <td>
                                                        <asp:Label ID="lblGroupName" runat="server" CssClass="label" Text="User Group Name"></asp:Label>
                                                        &nbsp;
                                                        <asp:Label ID="Label14" runat="server" ForeColor="Red">*</asp:Label>
                                                    </td>
                                                    <td>
                                                        <asp:TextBox ID="txtUserGroupName" runat="server" onkeypress="chkAlphaNumericWithSpace(event,this,29)"
                                                            MaxLength="30" TabIndex="1" onpaste="return false;" ondrop="return false;"></asp:TextBox>
                                                    </td>
                                                </tr>
                                                    <tr>
                                                        <td class="split"></td>
                                                        <td valign="top">
                                                            <asp:Label ID="lblGroupDes" runat="server" CssClass="label" Text="User Group Description"></asp:Label>
                                                        </td>
                                                        <td>
                                                            <asp:TextBox ID="txtUserDescription" runat="server" Width="250px" Height="50px" TextMode="MultiLine"
                                                                MaxLength="250" TabIndex="2" onkeypress="return chkDescription(event,this,249);"></asp:TextBox>
                                                        </td>
                                                        <td style="width: 50%"></td>
                                                    </tr>
                                                    <tr>
                                                        <td></td>
                                                        <td colspan="2">
                                                            <asp:Label ID="Label1" runat="server" ForeColor="Red">*</asp:Label>&nbsp;
                                                        <asp:Label ID="Label3" runat="server">Required Fields</asp:Label>
                                                        </td>
                                                        <td colspan="3"></td>
                                                    </tr>
                                                    <tr>
                                                        <td class="split"></td>
                                                        <td colspan="3">
                                                            <div id="grid-dsply">
                                                                <div class="fleetContent">
                                                                    <asp:HiddenField ID="hdnSelectedModuleList" runat="server" />
                                                                    <asp:HiddenField ID="hdnSelectedOperationList" runat="server" />
                                                                    <asp:GridView ID="gvModuleOperationsList" runat="server" AllowPaging="False" AllowSorting="False"
                                                                        AutoGenerateColumns="False" BackColor="#CCCCCC" OnRowDataBound="gvModuleOperationsList_RowDataBound"
                                                                        CellPadding="0" CellSpacing="1" GridLines="None" Width="100%">
                                                                        <Columns>
                                                                            <asp:TemplateField>
                                                                                <HeaderTemplate>
                                                                                    <table cellpadding="0" cellspacing="0" width="100%">
                                                                                        <tr>
                                                                                            <td>&nbsp;
                                                                                            </td>
                                                                                            <td style="width: 25%;">
                                                                                                <asp:CheckBox ID="chkModules" runat="server" TabIndex="3" onclick="SelectAllModules(this.checked);" Text=" Select All Modules & Operations" />
                                                                                            </td>
                                                                                            <td style="width: 74%;">

                                                                                                <img src="../images/CSC/icn-module-list.gif" alt="" align="left" />
                                                                                                Module List
                                                                                            </td>
                                                                                        </tr>
                                                                                    </table>
                                                                                </HeaderTemplate>
                                                                                <ItemTemplate>
                                                                                    <table cellpadding="0" cellspacing="0" width="100%">
                                                                                        <tr>
                                                                                            <td>
                                                                                                <img id="imgExpandCollapse" runat="server" onclick="ExpandOrCollpase(this.id);" src="../images/gvCollapsedButton.png" />
                                                                                            </td>
                                                                                            <td style="width: 5%;">
                                                                                                <asp:CheckBox ID="chkModuleID" runat="server" onclick="SelectOrUnSelectHeader(this.id, this.checked);UnCheckOperations(this.id, this.checked);"
                                                                                                    TabIndex="3" />
                                                                                                <asp:HiddenField ID="hdnModuleID" runat="server" Value='<%# Eval("ModuleID") %>' />
                                                                                            </td>
                                                                                            <td style="width: 94%;">Module :&nbsp;&nbsp;
                                                                                            <asp:Label ID="lblModuleName" runat="server" Text='<%# Eval("ModuleName") %>'></asp:Label>
                                                                                            </td>
                                                                                        </tr>
                                                                                        <tr id="trOperationsList" runat="server" class="ControlHide" style="padding-bottom: 5px">
                                                                                            <td></td>
                                                                                            <td colspan="2" style="margin: 0px; padding: 0px">
                                                                                                <asp:GridView ID="gvOperationsList" runat="server" AllowPaging="False" AllowSorting="False"
                                                                                                    AutoGenerateColumns="False" BackColor="#CCCCCC" CellPadding="0" CellSpacing="1"
                                                                                                    GridLines="None" OnRowDataBound="gvOperationsList_RowDataBound" Width="100%">
                                                                                                    <Columns>
                                                                                                        <asp:TemplateField ItemStyle-Width="5%">
                                                                                                            <ItemTemplate>
                                                                                                                <asp:CheckBox ID="chkOperationCheck" runat="server" onclick="SelectOrUnSelectOperationsHead(this.id, this.checked);" />
                                                                                                                <asp:HiddenField ID="hdnOperationID" runat="server" Value='<%# Eval("OperationTypeID") %>' />
                                                                                                            </ItemTemplate>
                                                                                                            <HeaderTemplate>
                                                                                                                <asp:CheckBox ID="chkSelectAllOperations" runat="server" onclick="SelectAllOperations(this.id,this.checked);" />
                                                                                                            </HeaderTemplate>
                                                                                                            <HeaderStyle HorizontalAlign="Left" />
                                                                                                        </asp:TemplateField>

                                                                                                        <asp:BoundField DataField="OperationTypeName" HeaderText="Operation" ItemStyle-Width="30%" />
                                                                                                        <asp:BoundField DataField="OperationDesc" HeaderText="Description" ItemStyle-Width="65%" />
                                                                                                    </Columns>
                                                                                                    <EmptyDataTemplate>
                                                                                                        No operations found.
                                                                                                    </EmptyDataTemplate>
                                                                                                    <RowStyle CssClass="fleetCon" />
                                                                                                    <FooterStyle CssClass="fleetFoot" />
                                                                                                    <AlternatingRowStyle CssClass="fleetConalt" />
                                                                                                    <PagerStyle CssClass="fleetFoot" HorizontalAlign="Left" />
                                                                                                    <HeaderStyle CssClass="fleetHead" />
                                                                                                    <EmptyDataRowStyle CssClass="fleetHead" />
                                                                                                </asp:GridView>
                                                                                            </td>
                                                                                        </tr>
                                                                                    </table>
                                                                                </ItemTemplate>
                                                                            </asp:TemplateField>
                                                                        </Columns>
                                                                        <EmptyDataTemplate>
                                                                            No modules found.
                                                                        </EmptyDataTemplate>
                                                                        <RowStyle CssClass="fleetCon" />
                                                                        <FooterStyle CssClass="fleetFoot" />
                                                                        <AlternatingRowStyle CssClass="fleetConalt" />
                                                                        <PagerStyle CssClass="fleetFoot" HorizontalAlign="Left" />
                                                                        <HeaderStyle CssClass="fleetHead" />
                                                                        <EmptyDataRowStyle CssClass="fleetHead" />
                                                                    </asp:GridView>
                                                                </div>
                                                            </div>
                                                        </td>
                                                        <tr>
                                                            <td class="split"></td>
                                                            <td colspan="3">
                                                                <center>
                                                                    <asp:ImageButton ID="btnAddUserGroup" runat="server" ImageUrl="~/images/btn-save.jpg"
                                                                        OnClientClick="return ValidateUserGroupInformation();" TabIndex="4" OnClick="btnAddUserGroup_Click" />
                                                                    <asp:ImageButton ID="btnEditUserGroup" runat="server" ImageUrl="~/images/btn-update.jpg"
                                                                        OnClientClick="return ValidateUserGroupInformation();" TabIndex="5" OnClick="btnEditUserGroup_Click" />
                                                                    <asp:ImageButton ID="btnCancelUserGroup" runat="server" ImageUrl="~/images/btn-cancel.jpg"
                                                                        OnClick="btnCancelUserGroup_Click" />
                                                                </center>
                                                            </td>
                                                        </tr>
                                                    </tr>
                                                </table>
                                            </div>
                                        </asp:Panel>
                                        <asp:Panel ID="pnlUserGroupDetails" runat="server" CssClass="ControlShow">
                                            <div class="form-box">
                                                <h1>
                                                    <span class="icon">
                                                        <img src="../images/icn-group.gif" alt="" /></span>User Group Details
                                                </h1>
                                            </div>
                                            <div id="grid-dsply">
                                                <dxw:ASPxGridView ID="gvUserGroupDetails" ClientInstanceName="gvUserGroupDetails"
                                                    KeyFieldName="UserGroupId" runat="server" Width="100%" AutoGenerateColumns="False"
                                                    EnableTheming="true" Theme="Office2003Blue"
                                                    CssFilePath="~/App_Themes/Office2003 Blue/{0}/grid.css" CssPostfix="Office2003_Blue">
                                                    <%--<Images ImageFolder="~/App_Themes/Office2003 Blue/{0}/">
                                                    <CollapsedButton Height="12px" Url="~/App_Themes/Office2  003 Blue/GridView/gvCollapsedButton.png"
                                                        Width="11px" />
                                                    <ExpandedButton Height="12px" Url="~/App_Themes/Office2003 Blue/GridView/gvExpandedButton.png"
                                                        Width="11px" />
                                                    <DetailCollapsedButton Height="12px" Url="~/App_Themes/Office2003 Blue/GridView/gvCollapsedButton.png"
                                                        Width="11px" />
                                                    <DetailExpandedButton Height="12px" Url="~/App_Themes/Office2003 Blue/GridView/gvExpandedButton.png"
                                                        Width="11px" />
                                                </Images>--%>
                                                    <Styles AlternatingRow-Enabled="True" CssFilePath="~/App_Themes/Office2003 Blue/{0}/styles.css"
                                                        CssPostfix="Office2003_Blue">
                                                        <Header ImageSpacing="5px" SortingImageSpacing="5px">
                                                        </Header>
                                                        <LoadingPanel ImageSpacing="10px">
                                                        </LoadingPanel>
                                                        <PagerBottomPanel CssClass="PageFooter">
                                                        </PagerBottomPanel>
                                                        <PagerTopPanel CssClass="PageFooter">
                                                        </PagerTopPanel>
                                                    </Styles>
                                                    <SettingsPager PrevPageButton-Image-Url="../App_Themes/Office2003 Blue/GridView/pPrev.gif"
                                                        PrevPageButton-Image-UrlDisabled="../App_Themes/Office2003 Blue/GridView/pPrevDisabled.gif"
                                                        NextPageButton-Image-UrlDisabled="../App_Themes/Office2003 Blue/GridView/pNextDisabled.gif"
                                                        NextPageButton-Image-Url="../App_Themes/Office2003 Blue/GridView/pNext.gif" AlwaysShowPager="true">
                                                    </SettingsPager>
                                                    <Columns>
                                                        <dxw:GridViewDataColumn Caption="UserGroupName" Width="44%" FieldName="UserGroupName"
                                                            VisibleIndex="1">
                                                            <HeaderCaptionTemplate>
                                                                <img id="imgUserGroupName" src="../images/CSC/icn-usergroup-name.gif" alt="" />
                                                                &nbsp;
                                                            <asp:Label ID="lblUserGroupName" runat="server" Text="User Group Name"></asp:Label>
                                                            </HeaderCaptionTemplate>
                                                        </dxw:GridViewDataColumn>
                                                        <dxw:GridViewDataColumn Caption="UserGroupDescription" Width="46%" FieldName="UserGroupDesc"
                                                            VisibleIndex="2" CellStyle-Wrap="True">
                                                            <HeaderCaptionTemplate>
                                                                <img id="imgDescription" src="../images/CSC/icn-usergroup-desc.gif" alt="" />
                                                                &nbsp;
                                                            <asp:Label ID="lblDescription" runat="server" Text="Description"></asp:Label>
                                                            </HeaderCaptionTemplate>
                                                        </dxw:GridViewDataColumn>
                                                        <dxw:GridViewDataTextColumn Caption="View" Width="3%" VisibleIndex="3">
                                                            <HeaderTemplate>
                                                            </HeaderTemplate>
                                                            <DataItemTemplate>
                                                                <asp:LinkButton ID="ibnView" runat="server" OnClick="ibnView_Click" CommandArgument='<%# Eval("UserGroupId") %>'
                                                                    Style="text-decoration: none;"> <img src="../images/icn-view.gif" alt="View"/> </asp:LinkButton>
                                                            </DataItemTemplate>
                                                        </dxw:GridViewDataTextColumn>
                                                        <dxw:GridViewDataTextColumn Caption="Edit" Width="3%" HeaderStyle-HorizontalAlign="Center"
                                                            CellStyle-HorizontalAlign="Center" Name="Edit" VisibleIndex="4">
                                                            <HeaderTemplate>
                                                            </HeaderTemplate>
                                                            <DataItemTemplate>
                                                                <asp:ImageButton ID="btnEdit" runat="server" CommandArgument='<%# Eval("UserGroupId").ToString()+ "," +  Eval("IsDefaultUserGroup").ToString() %>'
                                                                    AlternateText="Edit" ImageUrl="~/images/icn-edit.gif" OnClick="btnEditUser_click"
                                                                    ToolTip="Click here to Edit" />
                                                            </DataItemTemplate>
                                                        </dxw:GridViewDataTextColumn>
                                                        <dxw:GridViewDataTextColumn Caption="Delete" VisibleIndex="5" HeaderStyle-HorizontalAlign="Center"
                                                            CellStyle-HorizontalAlign="Center" Width="3%">
                                                            <HeaderTemplate>
                                                            </HeaderTemplate>
                                                            <DataItemTemplate>
                                                                <asp:ImageButton ID="btnDelete" runat="server" CommandArgument='<%# Eval("UserGroupId")+ "," +  Eval("IsDefaultUserGroup").ToString()+ "," +  Eval("AssignedUsers").ToString() %>'
                                                                    AlternateText="Delete" OnClientClick="return confirm('Do you want to delete this?');"
                                                                    CommandName="Delete" ImageUrl="~/images/delete-icon.gif" ToolTip="Click here to Delete"
                                                                    OnClick="btnDelete_click" ImageAlign="Middle" />
                                                            </DataItemTemplate>
                                                        </dxw:GridViewDataTextColumn>
                                                    </Columns>
                                                    <Settings ShowStatusBar="Auto" ShowFilterRow="false" ShowGroupPanel="false" />
                                                    <SettingsText EmptyDataRow="No Data Identified" />
                                                    <ClientSideEvents EndCallback="function(s, e) {document.getElementById('btnTest').click();}" />
                                                    <SettingsBehavior ColumnResizeMode="NextColumn" AllowSort="true" AllowDragDrop="true"
                                                        AllowGroup="true" AllowFocusedRow="false" />
                                                    <SettingsPager PageSize="10" Mode="ShowPager">
                                                    </SettingsPager>
                                                </dxw:ASPxGridView>
                                            </div>
                                        </asp:Panel>
                                    </div>
                                </div>
                                <!-- Main Content Ends Here -->
                                <div id="left">
                                </div>
                                <div class="clear clearfix">
                                </div>
                            </div>
                            <div id="right">
                            </div>
                        </div>
                    </div>
                </div>
                <asp:Button ID="btnTest" Text="Test" CssClass="ControlHide" runat="server" />
            </ContentTemplate>
            <Triggers>
                <asp:PostBackTrigger ControlID="btnTest" />
            </Triggers>
        </asp:UpdatePanel>
        <!-- Content Ends Here -->
        <uc2:Footer ID="ucFooter" runat="server" />

        <script language="javascript" type="text/javascript" src="../js/myformvalidations.js"></script>

        <script language="javascript" type="text/javascript" src="../js/FormValidations.js"></script>

        <script type="text/javascript" language="javascript" src="../js/GridCheckBoxMaintaining.js"></script>

        <script type="text/javascript" language="javascript">
            function GetConfirmation(Mode, isOwnGroup, isDefault, assignedStatus) {
                if (isDefault == 1) {
                    alert('Cannot ' + Mode + ' the default user group !');
                    return false;
                }
                else if (Mode == 'edit' && isOwnGroup == 1) {
                    alert('Cannot edit your own user group !');
                    return false;
                }
                else if (Mode == 'delete' && assignedStatus == 1) {
                    alert('Cannot delete the user group as it is assigned to user(s) !');
                    return false;
                }
                else {
                    if (Mode == 'delete') {
                        return confirm('Are you sure you want to delete this entry?');
                    }
                    else {
                        return true;
                    }
                }
            }
        </script>
        <asp:HiddenField ID="hdnLogout" runat="server" />
    </form>
</body>
</html>
