<%@ page language="C#" autoeventwireup="true" inherits="Pages_OnlineAdmission_NewAdmissionForm, App_Web_3jllk20f" enableEventValidation="false" viewStateEncryptionMode="Never" %>

<!DOCTYPE html>

<html>
<head runat="server">
    <title></title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.2.0/css/solid.css" integrity="sha384-wnAC7ln+XN0UKdcPvJvtqIH3jOjs9pnKnq9qX68ImXvOGz2JuFoEiCjT8jyZQX2z" crossorigin="anonymous">
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.2.0/css/fontawesome.css" integrity="sha384-HbmWTHay9psM8qyzEKPc8odH4DsOuzdejtnr+OFtDmOcIVnhgReQ4GZBH7uwcjf6" crossorigin="anonymous">
    <link href="../../App_Themes/admission/css/bootstrap.css" rel="stylesheet" />
    <link href="../../App_Themes/admission/css/style.css" rel="stylesheet" />
    <link href="../../App_Themes/admission/css/jquery-ui.css" rel="stylesheet" />
    <link href="http://fonts.googleapis.com/css?family=PT+Sans:400,400i,700,700i" rel="stylesheet">
</head>

<body>
    <div class="w3l-main">
        <div class="row">
            <div class="col-lg-12">
                <div class="page-header">
                    <h3>
                        <asp:Label ID="schoolnameLabel" runat="server" Text=""></asp:Label>
                    </h3>
                    <h4 class="pTop6">Admission form
                    </h4>
                </div>
            </div>
        </div>
        <form id="form1" runat="server" class="w3l-from container">

            <div class="col-lg-12 padd-0 mt1" runat="server" id="failuremessage" visible="false">
                <div class="alert alert-danger">
                    <i class="fas fa-times"></i>&nbsp;&nbsp;&nbsp;Error ! Please check all the inputs.
                </div>
            </div>
            <div class="col-lg-12 padd-0 mt1" runat="server" id="failurebdaymessage" visible="false">
                <div class="alert alert-danger">
                    <asp:Label runat="server" ID="BirthDateErrorLabel"></asp:Label>
                </div>
            </div>

            <div class="col-lg-12 padd-0 mt1">
                <div class="alert alert-danger">

                    <i class="fa fa-asterisk "></i>&nbsp;&nbsp;&nbsp;Required Field
                        
                </div>
            </div>
            <div class="form-group">
                <div class="col-lg-12 padd-0">
                    <div class="topic-header ">
                        <h5>
                            <span id="SchoolInformationLabel" runat="server"><i class="fas fa-school bg-bgreen"></i>&nbsp;School Information</span>
                        </h5>
                    </div>
                    <div class="col-md-4">
                        <div class="bg-white">
                            <label for="InputName" class="mandatory">School Name</label>
                            <div class="input-group">
                                <asp:DropDownList ID="OrgDropDownList" Width="100%" CssClass="form-control" runat="server" AutoPostBack="true" OnSelectedIndexChanged="OrgDropDownList_OnSelectedIndexChanged">
                                </asp:DropDownList>
                                <div id="orgnull" class="null-message" style="display: none">Select School</div>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-4">
                        <div class="bg-white">
                            <label for="InputName" class="mandatory">Batch</label>
                            <div class="input-group">
                                <asp:DropDownList ID="BatchDropDownList" runat="server" CssClass="form-control" AutoPostBack="true" OnSelectedIndexChanged="BatchDropDownList_OnSelectedIndexChanged">
                                </asp:DropDownList>
                                <div id="batchnull" class="null-message" style="display: none">Select Batch</div>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-4">
                        <div class="bg-white">
                            <label for="InputName" class="mandatory">Standard </label>
                            <div class="input-group">
                                <asp:DropDownList ID="StandardDropDownList" runat="server" CssClass="form-control" AutoPostBack="true" OnSelectedIndexChanged="StandardDropDownList_OnSelectedIndexChanged">
                                </asp:DropDownList>
                                <div id="standardnull" class="null-message" style="display: none">Select Standard</div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="form-group">
                <div class="col-lg-12 padd-0">
                    <div class="topic-header ">
                        <h5>
                            <span id="StudentInformationHeaderLabel" runat="server" text=""><i class="fas fa-user-graduate bg-yellow"></i>&nbsp;Student Information</span>
                        </h5>
                    </div>

                    <div class="col-md-4">
                        <div class="bg-white">
                            <label for="InputName" class="mandatory">Student Name</label>
                            <div class="input-group">
                                <asp:TextBox ID="FirstNameTextBox" runat="server" CssClass="form-control" placeholder="Student Name"></asp:TextBox>
                                <div id="fnamenull" class="null-message" style="display: none">Student Name is required</div>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-4">
                        <div class="bg-white">
                            <label for="InputName">Father Name</label>
                            <div class="input-group">
                                <asp:TextBox ID="MiddleNameTextBox" runat="server" CssClass="form-control" placeholder="Father Name"></asp:TextBox>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-4">
                        <div class="bg-white">
                            <label for="InputName" class="mandatory">SurName</label>
                            <div class="input-group">
                                <asp:TextBox ID="LastNameTextBox" runat="server" CssClass="form-control" placeholder="SurName"></asp:TextBox>
                                <div id="lnamenull" class="null-message" style="display: none">SurName is required</div>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-4">
                        <div class="bg-white">
                            <label for="InputName" class="mandatory">Gender</label>
                            <div class="input-group">
                                <asp:DropDownList ID="GenderDropDownList" CssClass="form-control" runat="server">
                                </asp:DropDownList>
                                <div id="gendernull" class="null-message" style="display: none">Select Gender</div>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-4">
                        <div class="bg-white">
                            <label for="InputName" class="mandatory">Birth Date</label>
                            <div class="input-group">
                                <asp:TextBox runat="server" ID="BirthDateTextBox" CssClass="form-control" placeholder="dd/mm/yyyy" onkeyup="FormatIt(this);" />
                                <div id="dobdnull" class="null-message" style="display: none">DOB is required</div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="form-group">
                <div class="col-lg-12 padd-0">
                    <div class="topic-header">
                        <h5>
                            <span id="MobileNoHeaderLabel" runat="server"><i class="fas fa-mobile bg-red"></i>&nbsp;Mobile No.</span>
                        </h5>
                    </div>

                    <div class="col-md-4">
                        <div class="bg-white">
                            <label for="InputName" class="mandatory">Mobile No</label>
                            <div class="input-group">
                                <asp:TextBox ID="MobileNoTextBox" runat="server" CssClass="form-control" onkeypress="return isNumberKey(event)" placeholder="Mobile No."></asp:TextBox>
                                <div id="mobilenull" class="null-message" style="display: none">Valid Mobile no. is required</div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="form-group col-lg-6 padd-0" runat="server" id="PasswordDiv">

                <div class="topic-header">
                    <h5>
                        <span id="Password" runat="server" text=""><i class="fas fa-unlock-alt bg-aqua"></i>&nbsp;Password</span>
                    </h5>
                </div>

                <div class="col-md-8">
                    <div class="bg-white">
                        <label for="InputName" class="mandatory">Password</label>
                        <div class="input-group">
                            <asp:TextBox ID="PasswordTextBox" runat="server" CssClass="form-control" TextMode="Password" onkeypress="CheckPassword()" placeholder="&#9679;&#9679;&#9679;&#9679;&#9679;"></asp:TextBox>
                            <div id="passnull" class="null-message" style="display: none">Password is required</div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="form-group col-lg-6 padd-0" runat="server" id="ConfirmPasswordDiv">
                <div class="topic-header">
                    <h5>
                        <span id="ConfirmPasswordHeaderLabel" runat="server" text=""><i class="fas fa-unlock-alt bg-jade"></i>&nbsp;Confirm Password</span>
                    </h5>
                </div>

                <div class="col-md-8">
                    <div class="bg-white">
                        <label for="InputName" class="mandatory">Confirm Password</label>
                        <div class="input-group">
                            <asp:TextBox ID="ConfirmPasswordTextBox" CssClass="form-control" runat="server" TextMode="Password" onkeypress="CheckPassword()" placeholder="&#9679;&#9679;&#9679;&#9679;&#9679;"></asp:TextBox>
                            <div id="confirmpassnull" class="null-message" style="display: none">Confirmation is required</div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="col-lg-12 pTop6 text-center">
                <asp:Button ID="ApplyButton" runat="server" OnClick="ApplyButton_Click" CssClass="btn apply fas" Text="&#xf4ff; Apply" OnClientClick="return ValidateNull();" />
            </div>

        </form>
    </div>
</body>
</html>
<script src='<%# ResolveUrl("~/App_Themes/BlackTheme/plugins/jQueryUI/jquery-ui.min.js")%>' type="text/javascript"></script>
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<script type="text/javascript">
    $(function () {
        var currentYear = (new Date).getFullYear();
        $("#BirthDateTextBox").datepicker({
            dateFormat: 'dd/mm/yy',
            changeYear: true,
            changeMonth: true,
            yearRange: "1950:currentYear"
        }).val();
    });
    function FormatIt(obj) {
        if (obj.value.length == 2)
            obj.value = obj.value + "/";
        if (obj.value.length == 5)
            obj.value = obj.value + "/";
    }
    function isNumberKey(evt) {
        var charCode = (evt.which) ? evt.which : event.keyCode
        if (charCode > 31 && (charCode < 48 || charCode > 57)) {
            return false;
        }
        else {
            var mobile = document.getElementById("MobileNoTextBox").value;
            var DOB = document.getElementById("BirthDateTextBox").value;
            if (mobile != "") {
                document.getElementById("mobilenull").style.display = 'none';
            }
            if (DOB != "") {
                document.getElementById("dobdnull").style.display = 'none';
            }
        }
    }
    function CheckPassword() {
        var pass = document.getElementById("PasswordTextBox").value;
        var conpass = document.getElementById("ConfirmPasswordTextBox").value;
        if (pass != "") {
            document.getElementById("passnull").style.display = 'none';
        }
        if (conpass != "") {
            document.getElementById("confirmpassnull").style.display = 'none';
        }
    }
    function checkNum() {
        if ((event.keyCode > 64 && event.keyCode < 91) || (event.keyCode > 96 && event.keyCode < 123) || event.keyCode == 8 || event.keyCode == 32 || event.keyCode == 13 || event.keyCode == 176) {
            var fname = document.getElementById("FirstNameTextBox").value;
            var lname = document.getElementById("LastNameTextBox").value;
            if (fname != "") {
                document.getElementById("fnamenull").style.display = 'none';
            }
            if (lname != "") {
                document.getElementById("lnamenull").style.display = 'none';
            }
        }
        else {
            event.returnValue = false;
        }
    }
    function ValidateNull() {
        var Role = '<%= Session["Role"] %>';
        if (Role != "Admin") {
            var fname = document.getElementById("FirstNameTextBox").value;
            var lname = document.getElementById("LastNameTextBox").value;
            var gender = document.getElementById("GenderDropDownList").value;
            var org = document.getElementById("OrgDropDownList").value;
            var batch = document.getElementById("BatchDropDownList").value;
            var standard = document.getElementById("StandardDropDownList").value;
            var DOB = document.getElementById("BirthDateTextBox").value;
            var mobile = document.getElementById("MobileNoTextBox").value;
            var pass = document.getElementById("PasswordTextBox").value;
            var confirmpass = document.getElementById("ConfirmPasswordTextBox").value;
            if (fname == "" || lname == "" || gender == "-1" || org == "-1" || batch == "-1" || standard == "-1" || mobile == "" || pass == "" || confirmpass == "" || DOB == "") {
                if (confirmpass == "") {
                    document.getElementById("confirmpassnull").style.display = 'block';
                    $('#<%=ConfirmPasswordTextBox.ClientID %>').focus();
                }
                if (pass == "") {
                    document.getElementById("passnull").style.display = 'block';
                    $('#<%=PasswordTextBox.ClientID %>').focus();
                }
                if (!(/^\d{10}$/.test(mobile))) {
                    document.getElementById("mobilenull").style.display = 'block';
                    $('#<%=MobileNoTextBox.ClientID %>').focus();
                }
                if (mobile == "") {
                    document.getElementById("mobilenull").style.display = 'block';
                    $('#<%=MobileNoTextBox.ClientID %>').focus();
                }
                if (DOB == "") {
                    document.getElementById("dobdnull").style.display = 'block';
                    $('#<%=BirthDateTextBox.ClientID %>').focus();
                }
                if (gender == "-1") {
                    document.getElementById("gendernull").style.display = 'block';
                    $('#<%=GenderDropDownList.ClientID %>').focus();
                }
                if (lname == "") {
                    document.getElementById("lnamenull").style.display = 'block';
                    $('#<%=LastNameTextBox.ClientID %>').focus();
                }
                if (fname == "") {
                    document.getElementById("fnamenull").style.display = 'block';
                    $('#<%=FirstNameTextBox.ClientID %>').focus();
                }
                if (standard == "-1") {
                    document.getElementById("standardnull").style.display = 'block';
                    $('#<%=StandardDropDownList.ClientID %>').focus();
                }
                if (batch == "-1") {
                    document.getElementById("batchnull").style.display = 'block';
                    $('#<%=BatchDropDownList.ClientID %>').focus();
                }
                if (org == "-1") {
                    document.getElementById("orgnull").style.display = 'block';
                    $('#<%=OrgDropDownList.ClientID %>').focus();
                }
                return false;
            }
            else if (fname != "" && lname != "" && gender != "-1" && org != "-1" && batch != "-1" && standard != "-1" && mobile != "" && pass != "" && confirmpass != "" && DOB != "") {
                var mobilenumber = document.getElementById("MobileNoTextBox");
                var textLength = mobilenumber.value.length;
                if (textLength <= 9) {
                    document.getElementById("mobilenull").style.display = 'block';
                    $('#<%=MobileNoTextBox.ClientID %>').focus();
                    return false;
                }
                if (DOB == "") {
                    document.getElementById("dobdnull").style.display = 'block';
                    $('#<%=BirthDateTextBox.ClientID %>').focus();
                }
                var pattern = /^([0-9]{2})\/([0-9]{2})\/([0-9]{4})$/;
                if (!pattern.test(DOB)) {
                    alert("Date Should be in dd/mm/yyyy format");
                    $('#<%=BirthDateTextBox.ClientID %>').focus();
                    return false;
                }
                if (pass === confirmpass) {
                    return true;
                }
                else {
                    alert("Password not matched");
                    $('#<%=ConfirmPasswordTextBox.ClientID %>').focus();
                    return false;
                }
            }
    }
}
function DropDownCheck(obj) {
    var value = document.getElementById(obj.id).value;
    if (obj.id == "OrgDropDownList") {
        document.getElementById("orgnull").style.display = 'block';
        $('#<%=OrgDropDownList.ClientID %>').focus();
    }
    if (obj.id == "BatchDropDownList") {
        document.getElementById("batchnull").style.display = 'block';
        $('#<%=BatchDropDownList.ClientID %>').focus();
    }
    if (obj.id == "StandardDropDownList") {
        document.getElementById("standardnull").style.display = 'block';
        $('#<%=StandardDropDownList.ClientID %>').focus();
    }
    if (value == "-1") {
        if (obj.id == "GenderDropDownList") {
            document.getElementById("gendernull").style.display = 'block';
            $('#<%=GenderDropDownList.ClientID %>').focus();
        }
        return false;
    }
    else {
        if (obj.id == "OrgDropDownList") {
            document.getElementById("orgnull").style.display = 'none';
        }
        if (obj.id == "BatchDropDownList") {
            document.getElementById("batchnull").style.display = 'none';
        }
        if (obj.id == "StandardDropDownList") {
            document.getElementById("standardnull").style.display = 'none';
        }
        if (obj.id == "GenderDropDownList") {
            document.getElementById("gendernull").style.display = 'none';
        }
        return false;
    }
} 
</script>
