<%@ Page Language="C#" MasterPageFile="~/masterpages/eDashboard.master" AutoEventWireup="true" Theme="eMain" Inherits="site_AccessManagement_UserAssignment_Default"
    Title="eSecuritel User Assignment" Culture="auto"
    UICulture="auto" Codebehind="Default.aspx.cs" %>

<%@ Register Src="~/Controls/ScriptingHelper.ascx" TagName="ScriptingHelper" TagPrefix="uc" %>
<%@ Register Src="~/Controls/CustomSorter.ascx" TagName="CustomSorter"
    TagPrefix="uc" %>
<%@ Register Src="~/Controls/PageJump.ascx" TagName="PageJump" TagPrefix="uc" %>
<%@ Register Assembly="eSecuritel.HITS.UI.Components" Namespace="eSecuritel.HITS.UI.Components"
    TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="eContent" runat="Server">

    <script src="../../../script/eSetFormControls.js" type="text/javascript"></script>
    <script src="../../../script/eGridHelper.js" type="text/javascript"></script>
    <uc:ScriptingHelper ID="ScriptingHelper1" runat="server" />
    
    <h1>
        <asp:Label ID="m_lblSubHeader" runat="server" Text="User Assignment - " /></h1>
    <strong class="required">
        <asp:Label ID="m_lblMessage" runat="server" Visible="False" Text="User does not have right to select user."></asp:Label></strong>
           
      <div class="helptip">
        <img src="../../../images/Collapse_13x13.jpg" class="showstate" onclick="expandMasterSearch(this, 'm_pnlHelpTip')"
            alt="contract" />
              <asp:Literal ID="Literal1" runat="server" Text="<i>Help Tip</i>" />
    </div> 
         <div id="m_pnlHelpTip" style="background-color: #e3edfe">        
            <asp:Literal ID="m_litHelpTip1" runat="server" Text="<i>- Use Search User Criteria to filter the user list.</i>" /><br />
            <asp:Literal ID="m_litHelpTip2" runat="server" Text="<i>- Click the user link to assign user.</i>" /><br />
            <asp:Literal ID="m_litHelpFunction" runat="server" Text="<i>- <b>This function will assign the selected user with many Roles/Groups/GroupLists and ONLY those.</b></i>" />
          </div> 
    <br />
    <!-------------------------------------------- User Search ---------------------------------------->
    <cc1:ExtendedValidationSummary ID="m_extValidationSummaryTop" runat="server" ValidationGroup="validationGroup"
        HeaderText="The following items need to be reviewed:" />
   
    <div class="mastersearch">
        <img src="../../../images/Collapse_13x13.jpg" class="showstate" onclick="expandMasterSearch(this, 'm_pnlMasterSearchCriteria')"
            alt="contract" />
        <asp:Literal ID="m_litSearchUsersHeader" runat="server" Text="Search User" />
    </div>
    
    <div id="m_pnlMasterSearchCriteria" style="background-color: #DBDCDE">
        <table border="0" cellpadding="0" cellspacing="0">
            <tr>
                <td align = "right" style="height: 27px">
                    <asp:Literal ID="m_litFirstName" runat="server" Text="<%$ Resources: SubscriberManagement, LabelFirstName %>" /></td>
                <td style="height: 27px">
                    <asp:TextBox ID="m_txtFirstName" runat="server" Width="165px"></asp:TextBox></td>
                <td align = "right" style="height: 27px">
                    <asp:Literal ID="m_litLastName" runat="server" Text="<%$ Resources : Default,LastNameLabel %>" /></td>
                <td style="height: 27px">
                    <asp:TextBox ID="m_txtLastName" runat="server" Width="165px"></asp:TextBox></td>
            </tr>
            <asp:Panel ID="pnlOrganizationSearchCriteria" runat="server">
                <tr>
                    <td align = "right" style="height: 27px">
                        <asp:Literal ID="m_litOrganization" runat="server" Text="Organization:" /></td>
                    <td style="height: 27px">
                        <asp:DropDownList ID="m_ddlOrg" runat="server" Width="172px">
                        </asp:DropDownList>
                        <asp:RequiredFieldValidator ID="m_rvOrganization" runat="server" Text="<%$ Resources:Default, ValidatorText %>"
                            ValidationGroup="validationGroup" ErrorMessage="Organization Name is Required"
                            ControlToValidate="m_ddlOrg"></asp:RequiredFieldValidator></td>
                    <td align = "right" style="height: 27px">
                        <asp:Literal ID="m_litOrganizatinUnit" runat="server" Text="Organization Unit:" /></td>
                    <td style="height: 27px">
                        <asp:TextBox ID="m_txtOrgUnit" runat="server" Width="165px"></asp:TextBox></td>
                </tr>
            </asp:Panel>
            <tr>
                <td align = "right">
                    <asp:Literal ID="m_litActive" runat="server" Text="Active:" /></td>
                <td colspan="3">
                    <asp:DropDownList ID="m_ddlActive" runat="server">
                        <asp:ListItem Text="Both" Value="B" />
                        <asp:ListItem Text="Yes" Value="Y" />
                        <asp:ListItem Text="No" Value="N" />
                    </asp:DropDownList></td>
            </tr>
        </table>
    </div>
    <br />
    <!--------------------------------------Advanced User Search --------------------------->
    <div class="subpanelheader hr">
        <img id="m_imgSearchCriteria" runat="server" src="../../../images/Collapse_13x13.jpg" class="showstate"
            onclick="expandMasterSearch(this, 'm_pnlAdditionalCriteria')" alt="contract" />
        <asp:Literal ID="m_litAdditionalSearchCriteriaHeader" runat="server" Text="Additional Search Criteria" /></div>
            
    <div id="m_pnlAdditionalCriteria" style="<%=AdditionalCriteriaStyle %>">
        <div class="subpanelAddition" style="background-color: #e3edfe">
            <table border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td align = "right">
                        <asp:Literal ID="m_litEmail" runat="server" Text="<%$ Resources : SubscriberManagement,LabelEmailColon %>" /></td>
                    <td>
                        <asp:TextBox ID="m_txtEmail" runat="server" Width="165px"></asp:TextBox></td>
                    <td align = "right">
                        <asp:Literal ID="m_litLogin" runat="server" Text="Login:" /></td>
                    <td>
                        <asp:TextBox ID="m_txtLogin" runat="server" Width="165px"></asp:TextBox></td>
                </tr>
                <tr>
                    <td align = "right">
                        <asp:Literal ID="m_litWorkPhone" runat="server" Text="Work Phone:" /></td>
                    <td>
                        <asp:TextBox ID="m_txtPhoneNumber" runat="server" Width="80px" MaxLength="12"></asp:TextBox>
                        <span style="font-size: xx-small;">
                            <asp:Literal ID="m_litExamplePhoneNumber" runat="server" Text="<%$ Resources: UsersManagement, LabelExamplexxxxxxxxxx %>"
                            /></span></td>
                    <td align = "right">
                        <asp:Literal ID="m_litPhoneExtension" runat="server" Text="Ext:" /></td>
                    <td>
                        <asp:TextBox ID="m_txtPhoneExtension" runat="server" Width="45px" MaxLength="6"></asp:TextBox></td>
                </tr>
                <tr>
                    <td align = "right">
                        <asp:Literal ID="m_litPageSize" runat="server" Text="<%$ Resources : HandsetManagement,LabelRecordsPerPageColon %>" /></td>
                    <td>
                        <asp:DropDownList ID="m_ddlPageSize" runat="server">
                            <asp:ListItem Text="20" Value="20"></asp:ListItem>
                            <asp:ListItem Text="50" Value="50"></asp:ListItem>
                            <asp:ListItem Text="100" Value="100"></asp:ListItem>
                        </asp:DropDownList></td>
                </tr>
            </table>
        </div>
    </div>
    <div style="padding-left: 155px">
        <asp:Button ID="m_btnSearch" runat="server" Text="<%$ Resources : Default,ButtonSetFilter %>" CssClass="pagebutton"
            OnClick="m_btnSearch_Click" />
       <input id="m_btnClear" type="button" runat="server" value="<%$ Resources : Default,ButtonClear %>" class="pagebutton"
                 /> 
    </div>
    <br />
    <!-------------------------------------------- User Search Results ---------------------------------------->
    <asp:Panel ID="m_pnlStatus" runat="server" Visible="False">
        <asp:Label ID="m_lblStatus" runat="server" />
    </asp:Panel>
    <asp:Panel ID="m_pnlGridUsers" runat="server" Visible="False">
        <asp:GridView ID="m_grdUsers" runat="server" AutoGenerateColumns="False" AllowPaging="True"
            OnRowDataBound="grdUsers_RowDataBound" OnPageIndexChanged="grdUsers_PageIndexChanged"
            OnPageIndexChanging="grdUsers_PageIndexChanging">
            <Columns>
                <asp:TemplateField>
                    <HeaderTemplate>
                        <table id="tblUserGridHeader" runat="server">
                            <tr valign="top" runat="server">
                                <td runat="server">
                                    <div style="overflow: hidden; width: 7px; height: 25px;">
                                        &nbsp;</div>
                                </td>
                                <td runat="server">
                                    <div style="text-align: left; overflow: hidden; width: 90px; height: 25px;">
                                        <asp:Literal ID="m_litUserGridLoginColumnHeader" runat="server" Text="Login" />
                                        <br />
                                        <uc:CustomSorter ID="m_csLogin" runat="server" OnSortAscendingClicked="customSorter_SortClicked"
                                            OnSortDescendingClicked="customSorter_SortClicked" SortExpression="Login" />
                                    </div>
                                </td>
                                <td runat="server">
                                    <div style="text-align: left; overflow: hidden; width: 90px; height: 25px;">
                                        <asp:Literal ID="m_litUserGridLastNameColumnHeader" runat="server" Text="Last Name" />
                                        <br />
                                        <uc:CustomSorter ID="m_csLastname" runat="server" OnSortAscendingClicked="customSorter_SortClicked"
                                            OnSortDescendingClicked="customSorter_SortClicked" SortExpression="LastName" />
                                    </div>
                                </td>
                                <td runat="server">
                                    <div style="text-align: left; overflow: hidden; width: 90px; height: 25px;">
                                        <asp:Literal ID="m_litUserGridFirstNameColumnHeader" runat="server" Text="First Name" /></div>
                                </td>
                                <td runat="server">
                                    <div style="text-align: left; overflow: hidden; width: 180px; height: 25px;">
                                        <asp:Literal ID="m_litUserGridDepartmentsColumnHeader" runat="server" Text="Departments" />
                                    </div>
                                </td>
                                <td runat="server">
                                    <div style="text-align: left; overflow: hidden; width: 45px; height: 25px;">
                                        <asp:Literal ID="m_litUserGridActiveColumnHeader" runat="server" Text="Active" />
                                        <br />
                                        <uc:CustomSorter ID="m_csActive" runat="server" OnSortAscendingClicked="customSorter_SortClicked"
                                            OnSortDescendingClicked="customSorter_SortClicked" SortExpression="Active" />
                                    </div>
                                </td>
                                <td runat="server">
                                    <div style="text-align: left; overflow: hidden; width: 95px; height: 25px;">
                                        <asp:Literal ID="m_litUserGridWorkPhoneColumnHeader" runat="server" Text="Work Phone" />
                                    </div>
                                </td>
                                <td runat="server">
                                    <div style="text-align: left; overflow: hidden; width: 35px; height: 25px;">
                                        <asp:Literal ID="m_litUserGridExtColumnHeader" runat="server" Text="Ext" />
                                    </div>
                                </td>
                                <td runat="server">
                                    <div style="text-align: left; overflow: hidden; width: 160px; height: 25px;">
                                        <asp:Literal ID="m_litUserGridEmailColumnHeader" runat="server" Text="Email" />
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </HeaderTemplate>
                    <ItemTemplate>
                        <table id="tblGridUserDetails" runat="server">
                            <tr runat="server">
                                <td align="center" style="background-color: #585d7d; color: #fff;" runat="server">
                                    <asp:Label ID="m_lblCompanyName" runat="server" Font-Bold="True" /></td>
                            </tr>
                            <tr runat="server">
                                <td runat="server">
                                    <asp:GridView ID="m_grdUsersDetails" OnRowCommand="grdUsersDetails_RowCommand" runat="server"
                                        AutoGenerateColumns="False" OnRowDataBound="grdUsersDetails_RowDataBound">
                                        <Columns>
                                            <asp:TemplateField>
                                                <ItemTemplate>
                                                    <div style="overflow: hidden; width: 17px; height: 24px;">
                                                    </div>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField>
                                                <ItemTemplate>
                                                    <div style="overflow: hidden; width: 90px; height: 25px;">
                                                        <asp:LinkButton ID="m_lbLogin" runat="server" Font-Underline="true" />
                                                    </div>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField>
                                                <ItemTemplate>
                                                    <div style="overflow: hidden; width: 90px; height: 25px;">
                                                        <asp:Label ID="m_lblLastName" runat="server" />
                                                    </div>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField>
                                                <ItemTemplate>
                                                    <div style="overflow: hidden; width: 90px; height: 25px;">
                                                        <asp:Label ID="m_lblFirstName" runat="server" />
                                                    </div>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField>
                                                <ItemTemplate>
                                                    <div style="overflow: hidden; width: 180px;">
                                                        <asp:Label ID="m_lblDepartments" runat="server" />
                                                    </div>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField>
                                                <ItemTemplate>
                                                    <div style="overflow: hidden; width: 45px; height: 25px; text-align: center;">
                                                        <asp:Label ID="m_lblActive" runat="server" />
                                                    </div>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField>
                                                <ItemTemplate>
                                                    <div style="overflow: hidden; width: 95px; height: 25px;">
                                                        <asp:Label ID="m_lblWorkPhone" runat="server" />
                                                    </div>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField>
                                                <ItemTemplate>
                                                    <div style="overflow: hidden; width: 35px; height: 25px;">
                                                        <asp:Label ID="m_lblExtension" runat="server" />
                                                    </div>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:TemplateField>
                                                <ItemTemplate>
                                                    <div style="overflow: hidden; width: 160px; height: 25px;">
                                                        <asp:HyperLink ID="m_hypUserEmail" runat="server" CssClass="EmailBox" Font-Underline="true" />
                                                    </div>
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                        </Columns>
                                    </asp:GridView>
                                </td>
                            </tr>
                        </table>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
        <uc:PageJump ID="m_pjUsers" runat="server" OnJumpToPageClicked="pjUsers_JumpToPageClicked" />
        <br />
    </asp:Panel>
    <asp:Label ID="m_lblNoUserResultsFound" Font-Bold="True" ForeColor="Red" runat="server"
        Visible="False" />
    <asp:ObjectDataSource ID="m_odsUser" runat="server" SelectMethod="Select" SelectCountMethod="SelectCount"
        TypeName="UserDataSource" EnablePaging="True">
        <SelectParameters>
            <asp:Parameter Name="userData" Type="Object" />
            <asp:SessionParameter Name="userSortExpression" SessionField="userSortExpression"
                Type="Object" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <asp:Button ID="m_btnCancel" runat="server" Text="<%$ Resources : Default,ButtonCancel %>" CssClass="pagebutton" CausesValidation="False"
        OnClick="m_btnCancel_Click" />
    <br />
    <cc1:ExtendedValidationSummary ID="m_extValidationSummaryBottom" runat="server" ValidationGroup="validationGroup"
        HeaderText="The following items need to be reviewed:" />
</asp:Content>
