<%@ page language="C#" enableeventvalidation="false" masterpagefile="~/MasterFile/TimeCheck.master" autoeventwireup="true" inherits="TA_UI_Master_MyProfileView, App_Web_ioskhdy0" %>

<%@ Register TagPrefix="dxGridview" Namespace="DevExpress.Web" Assembly="DevExpress.Web.v14.2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="BodyContentPH" runat="Server">
    <script src="../plugins/datepicker/jquery-1.11.1.min.js"></script>
    <script language="javascript" src="../js/jquery.autocomplete.js" type="text/javascript"></script>
    <script src="../plugins/datepicker/bootstrap-datepicker.js"></script>
    <script src="../js/Lookupddl.js"></script>
    <script type="text/javascript">
        $(function () {
            $('#ctl00_BodyContentPH_txt_dobrecord').datetimepicker({ format: document.getElementById('ctl00_BodyContentPH_Hidden1').value });
            $('#ctl00_BodyContentPH_txt_dob').datetimepicker({ format: document.getElementById('ctl00_BodyContentPH_Hidden1').value });
        });
    </script>
    <script type="text/javascript">
        var Errorretrievingdatafromlookup = "Error retrieving data from lookup";
        function assignValue(e, ctrl, val) {
            var keycode;
            if (window.event) keycode = window.event.keyCode;
            else if (e) keycode = e.which;
            else if (event) keycode = event.keyCode;
            else return true;
            ph = ctrl.value;
            if (ctrl.value.lastIndexOf("+") == 0 || ctrl.value.lastIndexOf("+") == -1) {
            }
            else {
                ctrl.value = ph;
                ctrl.focus();
                alert(Entervalid + val + AlertNumber);
                return false
            }
            if (!(keycode == 58 && e.value.indexOf(":") > -1)) {
                if ((keycode == 40) || (keycode == 41) || (keycode == 43) || (keycode == 45) || (keycode >= 48 && keycode <= 57) || (keycode == 8) || (keycode == 0)) {
                    return true;
                }
                else {
                    return false;
                }
            }
            else {
                return false;
            }
            return true;
        }
        function checkPhone(e) {
            var keycode;
            if (window.event) keycode = window.event.keyCode;
            else if (e) keycode = e.which;
            else if (event) keycode = event.keyCode;
            else return true;
            if (!(keycode == 58 && e.value.indexOf(":") > -1)) {
                if ((keycode == 40) || (keycode == 41) || (keycode == 43) || (keycode == 45) || (keycode >= 48 && keycode <= 57) || (keycode == 8) || (keycode == 0)) {
                    return true;
                }
                else {
                    return false;
                }
            }
            else {
                return false;
            }
            return true;
        }
    </script>
    <div class="content-header">
        <h1 style="background-image: url('../dist/img/pem.png'); background-repeat: no-repeat; padding-left: 35px">
            <asp:Label ID="lbl_HeaderMyProfileView" runat="server"></asp:Label>
        </h1>
        <asp:SiteMapPath ID="site" runat="server" CssClass="breadcrumb">
            <NodeStyle CssClass="active" />
        </asp:SiteMapPath>
    </div>
    <div class="content">
        <div class="exda-table">
            <div class="col-md-2" id="previewhead" runat="server" style="display: none">
                <h5>
                    <asp:Label Text="Preview" ID="lblpreview" runat="server" Style="text-align: left !important"></asp:Label></h5>
            </div>
            <h6>
                <span style="color: Red">|</span><asp:Label ID="lbl_Man" runat="server">
                </asp:Label>(2 No.)
            </h6>
        </div>
        <div class="emp-filter">
            <div class="row">
                <asp:HiddenField ID="Hidden1" runat="server" />
                <div class="form-horizontal">
                    <div class="col-md-12">
                        <div class="row form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_EmployeeFirstName" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txt_EmpFirstName" runat="server" CssClass="form-control mandatory"
                                    MaxLength="35" onkeypress="return acceptChars_MaxLength(event,this,35,MaxLength);"></asp:TextBox>
                            </div>
                            <div class="col-md-1">
                            </div>
                            <div class="col-md-2">
                                <asp:Label ID="lbl_MiddleName" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txt_MiddleName" runat="server" CssClass="form-control"
                                    MaxLength="35" onkeypress="return acceptChars_MaxLength(event,this,35,MaxLength);"></asp:TextBox>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-12">
                        <div class="form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_LastName" runat="server"></asp:Label><font color="#FF0000"></font>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txt_LastName" runat="server" CssClass="form-control"
                                    MaxLength="35" onkeypress="return acceptChars_MaxLength(event,this,35,MaxLength);"></asp:TextBox>
                            </div>
                            <div class="col-md-1">
                            </div>
                            <div class="col-md-2">
                                <asp:Label ID="lbl_FathersName" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txt_FatherName" runat="server" CssClass="form-control" ReadOnly="true"
                                    MaxLength="50" onkeypress="return acceptChars_MaxLength(event,this,50,MaxLength);"></asp:TextBox>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-12">
                        <div class="form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_MothersName" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txt_MotherName" runat="server" CssClass="form-control" ReadOnly="true"
                                    MaxLength="50" onkeypress="return acceptChars_MaxLength(event,this,50,MaxLength);"></asp:TextBox>
                            </div>
                            <div class="col-md-1">
                            </div>
                            <div class="col-md-2">
                                <asp:Label ID="lbl_BloodGroup" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txt_BloodGroup" runat="server" CssClass="form-control" ReadOnly="true"
                                    MaxLength="15" onkeyup="return chkMaxLen(event,this,15,MaxLength);"></asp:TextBox>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-12">
                        <div class="form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_DateofBirth" runat="server"></asp:Label><font color="#FF0000"></font>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txt_dob" CssClass="form-control" runat="server" ReadOnly="true"
                                    MaxLength="11" onDrop="return false;" oncut="return false"></asp:TextBox>
                            </div>
                            <div class="col-md-1">
                            </div>
                            <div class="col-md-2">
                                <asp:Label ID="lbl_DateofBirthAsPerRec" class="control-label con-top" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txt_dobrecord" runat="server" CssClass="form-control" ReadOnly="true"
                                    MaxLength="11" onDrop="return false;" oncut="return false"></asp:TextBox>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-12">
                        <div class="form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_EmailID" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txt_EmailID" CssClass="form-control" runat="server" ReadOnly="true"
                                    MaxLength="100" Onblur="validateEmailID();"></asp:TextBox>
                            </div>
                            <div class="col-md-1">
                            </div>
                            <div class="col-md-2">
                                <asp:Label ID="lbl_PersonalMailID" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txt_PerEmailId" CssClass="form-control" runat="server" ReadOnly="true"
                                    MaxLength="100"></asp:TextBox>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-12">
                        <div class="form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_ContactAddress" runat="server"></asp:Label><font color="#FF0000">
                                        </font>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txt_ContactAddress" runat="server" CssClass="form-control"
                                    MaxLength="255" onkeypress="return acceptAddress(event,this)" onkeyup="return chkMaxLen(event,this,225,MaxLength);"
                                    TextMode="MultiLine" Style="resize: none"></asp:TextBox>
                            </div>
                            <div class="col-md-1">
                            </div>
                            <div class="col-md-2">
                                <asp:Label ID="lbl_PermanentAddress" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txt_PermanentAddress" runat="server" CssClass="form-control"
                                    MaxLength="255" onkeypress="return acceptAddress(event,this);" onkeyup="return chkMaxLen(event,this,225,MaxLength);"
                                    TextMode="MultiLine" Style="resize: none"></asp:TextBox>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-12">
                        <div class="form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_Country" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:DropDownList ID="ddl_Country" CssClass="form-control select2" EnableViewState="true" Enabled="false"
                                    runat="server" AppendDataBoundItems="true" AutoPostBack="true" OnSelectedIndexChanged="ddl_Country_SelectedIndexChanged" onchange="return GetLookupData('1',Errorretrievingdatafromlookup);">
                                    <asp:ListItem Selected="True" Text="-Select-"></asp:ListItem>
                                </asp:DropDownList>
                            </div>
                            <div class="col-md-1">
                            </div>
                            <div class="col-md-2">
                                <asp:Label ID="lbl_State" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:DropDownList ID="ddl_State" CssClass="form-control select2" EnableViewState="true" Enabled="false"
                                    runat="server" AppendDataBoundItems="true" onchange="return GetLookupData('2',Errorretrievingdatafromlookup);">
                                    <asp:ListItem Selected="True" Text="-Select-"></asp:ListItem>
                                </asp:DropDownList>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-12">
                        <div class="form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_City" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:DropDownList ID="ddl_City" CssClass="form-control select2" EnableViewState="true" Enabled="false"
                                    runat="server" AppendDataBoundItems="true" onchange="return GetLookupData('3',Errorretrievingdatafromlookup);">
                                    <asp:ListItem Selected="True" Text="-Select-"></asp:ListItem>
                                </asp:DropDownList>
                            </div>
                            <div class="col-md-1">
                            </div>
                            <div class="col-md-2">
                                <asp:Label ID="lbl_District" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txt_District" CssClass="form-control" runat="server" Enabled="false"
                                    MaxLength="50" onkeypress="return Valiadteltgt(event,this);"></asp:TextBox>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-12">
                        <div class="form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_PhoneNumber" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txt_PhoneNo" runat="server" CssClass="form-control"
                                    MaxLength="15" onDrop="return false;" onkeyup="return assignValue(event,this,'Phone')"
                                    onkeypress="return checkPhone(event)"></asp:TextBox>
                            </div>
                            <div class="col-md-1">
                            </div>
                            <div class="col-md-2">
                                <asp:Label ID="lbl_MobileNumber" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txt_MobileNo" runat="server" CssClass="form-control"
                                    MaxLength="15" onDrop="return false;" onkeyup="return assignValue(event,this,'Mobile')"
                                    onkeypress="return checkPhone(event)"></asp:TextBox>
                            </div>
                        </div>
                    </div>

                    <div class="col-md-12">
                        <div class="form-group">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_Nationality" runat="server"></asp:Label><font color="#FF0000"></font>
                            </div>
                            <div class="col-md-3">
                                <asp:TextBox onpaste="return true" ID="txt_Nationality" runat="server" CssClass="form-control" ReadOnly="true"
                                    MaxLength="50" onkeypress="return acceptChars_MaxLength(event,this,50,MaxLength);"></asp:TextBox>
                            </div>
                            <div class="col-md-1">
                            </div>
                            <div class="col-md-2">
                                <asp:Label ID="lbl_Religion" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <asp:DropDownList ID="ddlReligion" runat="server" AppendDataBoundItems="true" CssClass="form-control select2" Enabled="false">
                                    <asp:ListItem Selected="True" Text="-Select-" Value="0"></asp:ListItem>
                                </asp:DropDownList>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-12">
                        <div class="row">
                            <div class="col-md-2">
                                <asp:Label ID="lbl_Maritalstatus" runat="server"></asp:Label>
                            </div>
                            <div class="col-md-3">
                                <div class="row">
                                    <div class="col-md-6">
                                        <asp:RadioButton ID="rbtn_Single" GroupName="MaritalStatus" runat="server" Checked="True"
                                            Text="Single" CssClass="radio radio-primary" />
                                    </div>
                                    <div class="col-md-6">
                                        <asp:RadioButton ID="rbtn_Married" GroupName="MaritalStatus" runat="server" Text="Married"
                                            CssClass="radio radio-primary" />
                                    </div>
                                </div>
                            </div>
                            <div class="col-md-1">
                            </div>
                        </div>
                    </div>
                    <div id="photo" runat="server" style="display: none;">
                        <div class="col-md-3">
                            <asp:Label ID="lbl_Photo" runat="server" Text="Photo"></asp:Label>
                            <br />
                            <asp:Label runat="server" Font-Bold="true" Text="[Only bmp,jpeg,gif file format is supported]"></asp:Label>
                        </div>
                        <div class="col-md-3">
                            <div class="emp-img">
                                <script type="text/javascript">
                                    function openfileDialog() {
                                        $("#ctl00_BodyContentPH_fup_Photo").click();
                                    }
                                    $(function () {
                                        $('#ctl00_BodyContentPH_fup_Photo').change(function (event) {
                                            debugger;
                                            var tmppath = URL.createObjectURL(event.target.files[0]);
                                            $("#EmpImage").fadeIn("fast").attr('src', tmppath);
                                        });
                                    });
                                </script>
                                <a href="#" onclick="openfileDialog();"><span data-original-title="browse photo"
                                    data-toggle="tooltip" title="">
                                    <asp:Image ID="EmpImage" runat="server" ImageUrl="../dist/img/emp-photo.png" CssClass="emp-photo" />
                                </span></a>

                            </div>
                            <div style="display: none">
                                <asp:FileUpload ID="fup_Photo" runat="server" CssClass="fupload"></asp:FileUpload>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-12">
                        <div class="row">
                            <div class="col-md-2">
                                <span style="color: Red">|</span>&nbsp;&nbsp;Doc. Proof
                            </div>
                            <div class="col-md-3">
                                <asp:FileUpload ID="fu_proofDoc" runat="server" CssClass="form-control" />

                            </div>
                            <div class="col-md-7">
                                <div style="margin-top: 5px;"><b>Choose the File to be imported</b></div>
                                <div style="font-size: 12px; text-align: justify;">[only <b>Doc,Docx,JPEG,PDF,JPG</b> formats are Supported] Maximum upload file size is <b style="font-size: 12px;">5MB</b>.</div>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-12">
                        <div class="row">
                            <div class="col-md-5">
                            </div>
                            <div class="col-md-6">
                                <div class="pull-right-button">
                                    <asp:LinkButton ID="btn_Myprofile_Save" runat="server" CssClass="btn save-btn fa-floppy-o" OnClick="btn_Myprofile_Save_Click" OnClientClick="return ValidateControls();"></asp:LinkButton>
                                    <asp:LinkButton Visible="false" ID="btn_Cancel" CssClass="btn clr-btn fa-times" runat="server"
                                        CausesValidation="false" OnClick="btn_Cancel_Click"></asp:LinkButton>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script>
        function ValidateControls() {
            var empFstName = '<%= Session["My_fstNme"] %>';
            var My_ConAddr = '<%= Session["My_ConAddr"] %>';
            var My_PermAddr = '<%= Session["My_PermAddr"] %>';
            var My_Mstate = '<%= Session["My_Mstate"] %>';
            var My_mNme = '<%= Session["My_mNme"] %>';
            var My_lstNme = '<%= Session["My_lstNme"] %>';
            var new_MStatus = "";
            if (document.aspnetForm.ctl00_BodyContentPH_rbtn_Single.checked) {
                new_MStatus = "Single";
            }
            if (document.aspnetForm.ctl00_BodyContentPH_rbtn_Married.checked) {
                new_MStatus = "Married";
            }
            if (trim(document.aspnetForm.ctl00_BodyContentPH_txt_EmpFirstName.value) == "") {
                alert(EnterEmployeeFirstName);
                document.aspnetForm.ctl00_BodyContentPH_txt_EmpFirstName.focus();
                return false;
            }
            else if (trim(document.aspnetForm.ctl00_BodyContentPH_txt_EmpFirstName.value) != "" || trim(document.aspnetForm.ctl00_BodyContentPH_txt_ContactAddress.value) != "" || trim(document.aspnetForm.ctl00_BodyContentPH_txt_PermanentAddress.value) != "") {
                if (trim(document.aspnetForm.ctl00_BodyContentPH_txt_EmpFirstName.value) != empFstName ||
                    trim(document.aspnetForm.ctl00_BodyContentPH_txt_MiddleName.value) != My_mNme ||
                    trim(document.aspnetForm.ctl00_BodyContentPH_txt_LastName.value) != My_lstNme ||
                    trim(document.aspnetForm.ctl00_BodyContentPH_txt_ContactAddress.value) != My_ConAddr ||
                    trim(document.aspnetForm.ctl00_BodyContentPH_txt_PermanentAddress.value) != My_PermAddr ||
                    new_MStatus != My_Mstate) {
                    var fileupload = document.aspnetForm.ctl00_BodyContentPH_fu_proofDoc.value;
                    if (fileupload == null || fileupload == "") {
                        alert("Upload the required document to update my profile details in the system");
                        return false;
                    }
                    else {
                        var array = ['pdf', 'doc', 'docx', 'jpeg', 'jpg'];
                        var xyz = document.getElementById("ctl00_BodyContentPH_fu_proofDoc");
                        var Extension = xyz.value.substring(xyz.value.lastIndexOf('.') + 1).toLowerCase();
                        if (array.indexOf(Extension) <= -1) {
                            alert("Please Upload only PDF,DOC,JPEG.JPG extension file");
                            return false;

                        }
                    }
                }
            }
            return confirm("Are you sure to, Save?");
        }
    </script>
</asp:Content>
