<%@ Page Language="vb" MasterPageFile="~/CITAD.Master" 
    AutoEventWireup="false" 
    Codebehind="UserDetail.aspx.vb"
    Inherits="CITAD.WEB.VB.UserDetail" 
    Culture="auto" 
    meta:resourcekey="PageResource1"
    UICulture="auto" 
    EnableEventValidation="false" 
    Title="Chi tiết người sử dụng" %>

<%@ Register Src="../../Controls/MessageBox.ascx" TagName="MessageBox" TagPrefix="uc1" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <script language="javascript" type="text/javascript">
        window.document.onkeyup=ShortcutKeys;
        function ShortcutKeys()
        {
            if(event.ctrlKey) //btnSave
            {
                if(window.event.keyCode==83)
                {
                    document.getElementById('ctl00$ContentPlaceHolder1$btnSave').click();
                }
            }
        }
        window.onload = function(){
            document.getElementById('<%=txtFullName.ClientID%>').focus();
        }
    </script>
    
  <%--  <script language="javascript" type="text/javascript">
        function addDay()
        {
            var intNumOfDay;
            intNumOfDay=document.getElementById('<%=txtPERIOD.ClientID %>').value;
            var date = new Date();
            var appDate= new string();
            appDate= "<%=Application('gstrCI_Date') %>";
            var year = appDate.substring(0,4);
            var month = appDate.substring(4,2);
            var day = appDate.substring(7,2);
            date.setDate=date.getDate() + intNumOfDate;
            date.setMonth=month;
            date.setFullYear=year;
        }
    </script>--%>
    <cc1:ToolkitScriptManager runat="Server" ID="ScriptManager1" EnableScriptGlobalization="True"
        EnableScriptLocalization="True" CombineScripts="True" EnablePageMethods="true" />    
    <div style="width:770px;">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <table cellpadding="0" cellspacing="0" border="0" width="770px">
                <tr>
                    <!--Luu thong tin nhom-->
                    <td rowspan="1" valign="top">
                        <fieldset style="height: 419px">
                            <legend>
                                <asp:Label ID="Label1" runat="server" Text="Thông tin người sử dụng" meta:resourcekey="Label2Resource1"></asp:Label>
                            </legend>
                            <table>
                                <tr>
                                    <td align="right">
                                        <asp:Label ID="lblHoTen" runat="server" Text="Họ và tên" meta:resourcekey="lblHoTenResource1"></asp:Label></td>
                                    <td>
                                        <asp:TextBox ID="txtFullName" runat="server" Width="162px" meta:resourcekey="txtFullNameResource1"
                                            MaxLength="50" CssClass="citad-txt"></asp:TextBox></td>
                                </tr>
                                <tr>
                                    <td align="right" colspan="2">
                                        <asp:RequiredFieldValidator ID="rfvTextFullName" runat="server" ControlToValidate="txtFullName"
                                            ErrorMessage="Họ và tên không được để trống" ValidationGroup="TTNguoiSuDung"
                                            Display="Dynamic" SetFocusOnError="True" meta:resourcekey="rfvTextFullNameResource1"></asp:RequiredFieldValidator></td>
                                </tr>
                                <tr>
                                    <td align="right">
                                        <asp:Label ID="lblHanMatKhau" runat="server" Text="Hạn sử dụng mật khẩu" meta:resourcekey="lblHanMatKhauResource1"></asp:Label></td>
                                    <td>
                                        <asp:TextBox ID="txtPERIOD" runat="server" AutoPostBack="True" OnTextChanged="txtPERIOD_TextChanged"
                                            Width="70px" CssClass="citad-txt" MaxLength="5"></asp:TextBox>
                                        <asp:Label ID="Label8" runat="server" Text="Ngày" meta:resourcekey="Label8Resource1"></asp:Label></td>
                                </tr>
                                <tr>
                                    <td align="right">
                                        <asp:Label ID="lblNgayHetHan" runat="server" Text="Ngày hết hạn mật khẩu"
                                            meta:resourcekey="lblNgayHetHanResource1"></asp:Label></td>
                                    <td>
                                        <asp:TextBox ID="txtExpriteDate" runat="server" Width="70px" meta:resourcekey="txtExpriteDateResource1"
                                            ValidationGroup="MKE" CssClass="citad-txt" ReadOnly="True"></asp:TextBox>
                                </tr>
                                <tr>
                                    <td align="right">
                                        <asp:Label ID="lblCHANGEPASSWORDATNEXTLOGIN" runat="server" Text="Đổi mật khẩu trong lần tiếp theo"
                                            meta:resourcekey="chkCHANGEPASSWORDATNEXTLOGINResource1"></asp:Label>
                                    </td>
                                    <td align="left">
                                        <asp:CheckBox ID="chkCHANGEPASSWORDATNEXTLOGIN" runat="server" Text=" " />
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right">
                                        <asp:Label ID="Label5" runat="server" Text="Tình trạng sử dụng" meta:resourcekey="Label5Resource1"></asp:Label></td>
                                    <td align="left">
                                        <asp:RadioButton ID="rdbDangSuDung" runat="server" GroupName="grpSuDung" Checked="True"
                                            Text="Đang sử dụng" meta:resourcekey="rdbDangSuDungResource1" /></td>
                                </tr>
                                <tr>
                                    <td align="right">
                                    </td>
                                    <td align="left">
                                        <asp:RadioButton ID="rdbKhongSuDung" runat="server" GroupName="grpSuDung" Text="Chưa sử dụng"
                                            meta:resourcekey="rdbKhongSuDungResource1" AutoPostBack="True" OnCheckedChanged="rdbKhongSuDung_CheckedChanged" /></td>
                                </tr>
                                <tr>
                                    <td align="right" style="height: 26px">
                                        <asp:Label ID="lblTenDangNhap" runat="server" Text="Tên đăng nhập" meta:resourcekey="lblTenDangNhapResource1"></asp:Label></td>
                                    <td style="height: 26px">
                                        <asp:TextBox ID="txtUserID" runat="server" Width="130px" meta:resourcekey="txtUserIDResource1"
                                            MaxLength="30" CssClass="citad-txtReadonly" ></asp:TextBox></td>
                                </tr>
                                <tr>
                                    <td colspan="2" align="right">
                                        <asp:RequiredFieldValidator ID="rfvUserID" runat="server" ControlToValidate="txtUserID" 
                                            ErrorMessage="Tên đăng nhập không được để trống" ForeColor="red" 
                                            SetFocusOnError="true" ValidationGroup="TTNguoiSuDung" 
                                            Display="dynamic" meta:resourcekey="rfvUserIDResource1" >
                                        
                                        </asp:RequiredFieldValidator>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right">
                                    </td>
                                    <td>
                                        <asp:CheckBox ID="chkMULTI_APP" runat="server" Text="Cho phép ký duyệt nhiều lần"
                                            Visible="False" meta:resourcekey="chkMULTI_APPResource1" /></td>
                                </tr>
                                <tr>
                                    <td align="right">
                                        <asp:Label ID="lblMatKhau" runat="server" Text="Mật khẩu" meta:resourcekey="lblMatKhauResource1"></asp:Label></td>
                                    <td>
                                        <asp:TextBox ID="txtPassWords" runat="server" Width="130px" TextMode="Password" meta:resourcekey="txtPassWordsResource1"
                                            MaxLength="30" CssClass="citad-txt"></asp:TextBox></td>
                                </tr>
                                <tr>
                                    <td align="right">
                                        <asp:Label ID="lblNhapLaiMatKhau" runat="server" Text="Nhập lại mật khẩu" meta:resourcekey="lblNhapLaiMatKhauResource1"></asp:Label></td>
                                    <td>
                                        <asp:TextBox ID="txtReTypePassWords" runat="server" meta:resourcekey="txtReTypePassWordsResource1"
                                            MaxLength="30" CssClass="citad-txt" TextMode="Password" Width="130px"></asp:TextBox></td>
                                </tr>
                                <tr>
                                    <td align="right">
                                        <asp:Label ID="lblGioiTinh" runat="server" Text="Giới tính" meta:resourcekey="lblGioiTinhResource1"></asp:Label></td>
                                    <td>
                                        <asp:RadioButton ID="RadioNam" runat="server" GroupName="sex" Text="Nam" meta:resourcekey="RadioNamResource1"
                                            Checked="True" />
                                        <asp:RadioButton ID="RadioNu" runat="server" GroupName="sex" Text="Nữ" meta:resourcekey="RadioNuResource1" /></td>
                                </tr>
                                <tr>
                                    <td align="right">
                                        <asp:Label ID="lblNgaySinh" runat="server" Text="Ngày sinh" meta:resourcekey="lblNgaySinhResource1"></asp:Label></td>
                                    <td>
                                        <asp:TextBox runat="server" ID="dtpDateOfBirth" Width="70px" meta:resourcekey="dtpDateOfBirthResource1"
                                            CssClass="citad-txt" MaxLength="10" />
                                        <asp:ImageButton ID="imgCalendar2" runat="server" ImageUrl="~/Images/Calendar.png"
                                            meta:resourcekey="imgCalendarResource1" /></td>
                                </tr>
                                <tr>
                                    <td align="right" valign="top">
                                        <asp:Label ID="lblGhiChu" runat="server" Text="Ghi chú" meta:resourcekey="lblGhiChuResource1"></asp:Label></td>
                                    <td>
                                        <asp:TextBox ID="txtDESCRIPTION" runat="server" Height="48px" Width="173px" meta:resourcekey="txtDESCRIPTIONResource1"
                                            MaxLength="200" CssClass="citad-txt"></asp:TextBox></td>
                                </tr>
                            </table>
                        </fieldset>
                    </td>
                    <td valign="top" style="padding-left: 5px;">
                        <table cellpadding="0" cellspacing="0" border="0">
                            <tr>
                                <td>
                                    <fieldset style="width: 180px; height: 189px">
                                        <legend>
                                            <asp:Label ID="Label4" runat="server" Text="Nhóm đã tham gia" meta:resourcekey="Label4Resource1"></asp:Label>
                                        </legend>
                                        <asp:GridView ID="dgvGroup" runat="server" 
                                            CellPadding="1" 
                                            CssClass="grid" 
                                            AllowPaging="True"
                                            AutoGenerateColumns="False" 
                                            DataKeyNames="GROUP_ID" 
                                            meta:resourcekey="dgvGroupResource1"
                                            OnRowDataBound="dgvGroup_RowDataBound" 
                                            PageSize="6">
                                            <FooterStyle CssClass="grid-footer" />
                                            <RowStyle CssClass="grid-row" />
                                            <SelectedRowStyle CssClass="grid-selectedRow" />
                                            <PagerStyle HorizontalAlign="Center" CssClass="grid-pager" />
                                            <HeaderStyle CssClass="grid-header" />
                                            <AlternatingRowStyle CssClass="grid-alternating" />
                                            <Columns>
                                                <asp:TemplateField meta:resourceKey="TemplateFieldResource1">
                                                    <ItemStyle HorizontalAlign="Center" />
                                                    <HeaderStyle Width="20px" HorizontalAlign="Center" />
                                                    <HeaderTemplate>
                                                        <asp:CheckBox ID="chkCheckAll1" runat="server" onclick="return CheckAll(this,'chkUsed1');"
                                                            meta:resourcekey="chkCheckAllResource1" />
                                                    </HeaderTemplate>
                                                    <ItemTemplate>
                                                        <input id="chkUsed1" runat="server" type="checkbox" />
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:BoundField HeaderText="STT" meta:resourcekey="BoundFieldResource1">
                                                    <HeaderStyle Width="25px" HorizontalAlign="Center" />
                                                    <ItemStyle HorizontalAlign="Center" />
                                                </asp:BoundField>
                                                <asp:BoundField DataField="GROUP_NAME" HeaderText="T&#234;n Nh&#243;m" meta:resourcekey="BoundFieldResource2" />
                                            </Columns>
                                            <EmptyDataTemplate>
                                                <asp:Label ID="lblMsg" runat="server" meta:resourcekey="lblMsgResource1" Text="Chưa tham gia nhóm nào."></asp:Label>
                                            </EmptyDataTemplate>
                                        </asp:GridView>
                                    </fieldset>
                                </td>
                                <td style="width: 33px">
                                    <div style="text-align: center;">
                                        <asp:ImageButton ID="btnSelect" runat="server" ImageUrl="~/Images/group_up.gif" />
                                        <asp:ImageButton ID="btnDeselect" runat="server" ImageUrl="~/Images/group_down.gif" />                                        
                                    </div>
                                </td>
                                <td>
                                    <fieldset style="width: 180px; height: 189px">
                                        <legend>
                                            <asp:Label ID="lblDeselectedGroup" runat="server" Text="Nhóm chưa tham gia" meta:resourcekey="lblDeselectedGroupResource1">
                                            </asp:Label>
                                        </legend>
                                        <asp:GridView ID="dgvDeselectedGroup" runat="server"
                                            CssClass="grid" 
                                            CellPadding="1" 
                                            AllowPaging="True" 
                                            AutoGenerateColumns="False" 
                                            DataKeyNames="GROUP_ID" 
                                            PageSize="6"
                                            OnRowDataBound="dgvDeselectedGroup_RowDataBound" 
                                            OnPageIndexChanging="dgvDeselectedGroup_PageIndexChanging">
                                            <FooterStyle CssClass="grid-footer" />
                                            <RowStyle CssClass="grid-row" />
                                            <SelectedRowStyle CssClass="grid-selectedRow" />
                                            <PagerStyle HorizontalAlign="Center" CssClass="grid-pager" />
                                            <HeaderStyle CssClass="grid-header" />
                                            <AlternatingRowStyle CssClass="grid-alternating" />
                                            <Columns>
                                                <asp:TemplateField meta:resourceKey="TemplateFieldResource1">
                                                    <ItemStyle HorizontalAlign="Center" />
                                                    <HeaderStyle Width="20px" HorizontalAlign="Center" />
                                                    <HeaderTemplate>
                                                        <asp:CheckBox ID="chkCheckAll2" runat="server" onclick="return CheckAll(this,'chkUsed2');"
                                                            meta:resourcekey="chkCheckAllResource1" />
                                                    </HeaderTemplate>
                                                    <ItemTemplate>
                                                        <input id="chkUsed2" runat="server" type="checkbox" />
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:BoundField HeaderText="STT" meta:resourcekey="BoundFieldResource1">
                                                    <HeaderStyle Width="25px" HorizontalAlign="Center" />
                                                    <ItemStyle HorizontalAlign="Center" />
                                                </asp:BoundField>
                                                <asp:BoundField DataField="GROUP_NAME" HeaderText="T&#234;n Nh&#243;m" meta:resourcekey="BoundFieldResource2" />
                                            </Columns>
                                            <EmptyDataTemplate>
                                                <asp:Label ID="lblMsg2" runat="server" meta:resourcekey="lblMsgResource2" Text="Không có nhóm chưa tham gia."></asp:Label>
                                            </EmptyDataTemplate>
                                        </asp:GridView>
                                    </fieldset>
                                </td>
                            </tr>
                        </table>
                        <fieldset>
                            <legend>
                                <asp:Label ID="lblListPermission" runat="server" Text="Danh sách quyền" meta:resourcekey="lblListPermissionResource1"></asp:Label>
                            </legend>
                            <div style="overflow: scroll; width: 390px; height: 209px;">
                                <asp:TreeView ID="tvwPermission" runat="server" 
                                    ImageSet="WindowsHelp" 
                                    meta:resourcekey="tvwPermissionResource1"                                    
                                    Height="200px" 
                                    BorderStyle="None" 
                                    >
                                    <ParentNodeStyle Font-Bold="False" />
                                    <HoverNodeStyle Font-Underline="True" ForeColor="#6666AA" />
                                    <SelectedNodeStyle Font-Underline="False" HorizontalPadding="0px" VerticalPadding="0px"
                                        BackColor="#B5B5B5" />
                                    <NodeStyle Font-Names="Tahoma" Font-Size="8pt" ForeColor="Black" HorizontalPadding="5px"
                                        NodeSpacing="0px" VerticalPadding="1px" />
                                </asp:TreeView>
                            </div>
                        </fieldset>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" align="center" style="padding-top: 5px">
                        <asp:Button ID="btnSave" runat="server" Text="Ghi" Width="80px" meta:resourcekey="btnSaveResource1"
                            ValidationGroup="TTNguoiSuDung" CssClass="citad-btn" />
                        <asp:Button ID="btnClose" runat="server" CssClass="citad-btn" Text="Đóng" OnClick="btnClose_Click"
                            meta:resourcekey="btnCloseResource1" Width="80px" /></td>
                </tr>
            </table>
            <cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="dtpDateOfBirth"
                Enabled="True" Format="dd/MM/yyyy" PopupButtonID="imgCalendar2">
            </cc1:CalendarExtender>
            <%--<cc1:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="txtExpriteDate"
                Format="dd/MM/yyyy" Enabled="True">
            </cc1:CalendarExtender>--%>
            <cc1:MaskedEditExtender ID="MaskedEditExtender2" runat="server" Mask="99/99/9999"
                TargetControlID="dtpDateOfBirth" AcceptNegative="Left" ErrorTooltipEnabled="True"
                MaskType="Date" CultureAMPMPlaceholder="" CultureCurrencySymbolPlaceholder=""
                CultureDateFormat="" CultureDatePlaceholder="" CultureDecimalPlaceholder="" CultureThousandsPlaceholder=""
                CultureTimePlaceholder="" Enabled="True">
            </cc1:MaskedEditExtender>
            <%--Tên đăng nhập--%>
            <ajaxToolkit:FilteredTextBoxExtender ID="ftbRV_Code" runat="server" TargetControlID="txtUserID"
                FilterType="Custom" FilterMode="validChars" ValidChars="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" />
            <asp:HiddenField ID="hidUserID" runat="server" />
            <asp:HiddenField ID="hidRePwd" runat="server" />
            <asp:HiddenField ID="hidPwd" runat="server" />
            <asp:HiddenField ID="hidClearPass" runat="server" />
            <asp:HiddenField ID="hidExpiredDate" runat="server" />
            
            <uc1:MessageBox ID="MessageBox1" runat="server"></uc1:MessageBox>       
        </ContentTemplate>
    </asp:UpdatePanel>
    </div>
    <script type="text/javascript">
        try
        {
            Sys.WebForms.PageRequestManager.getInstance().add_endRequest(onEndRequest);
            Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler);
        }
        catch(err){}
        function pageUnload()
        {
            try
            {
                Sys.WebForms.PageRequestManager.getInstance().remove_beginRequest(BeginRequestHandler);
                Sys.WebForms.PageRequestManager.getInstance().remove_endRequest(onEndRequest);
            }
            catch(err){}
        }
        
        var p1;
        var p2;
        
        function BeginRequestHandler(sender, args)
        {
            p1 = document.getElementById('<%=txtPassWords.ClientID %>').value;
            p2 = document.getElementById('<%=txtReTypePassWords.ClientID %>').value;
        }
        function onEndRequest(sender, args)
        {
            if (document.getElementById('<%=hidClearPass.ClientID %>').value == "1")
            {
                document.getElementById('<%=txtPassWords.ClientID %>').value = "";
                document.getElementById('<%=txtReTypePassWords.ClientID %>').value = "";
            }
            else 
            {
                document.getElementById('<%=txtPassWords.ClientID %>').value = p1;
                document.getElementById('<%=txtReTypePassWords.ClientID %>').value = p2;
            }
        }
        
    </script>
</asp:Content>