<?php include("../includes/header.php"); ?>
<style>
body{
    background: linear-gradient(135deg,#eef2f7,#d9e4f5);
}
.register-card{
    border-radius: 20px;
}
</style>

<div class="container py-5">
<div class="row justify-content-center">

<div class="col-lg-8 col-md-10 col-sm-12">
<div class="card shadow-lg register-card p-4">
<h4 class="text-center mb-4 fw-bold">Associate Registration</h4>

<form action="process_register.php" method="POST" enctype="multipart/form-data">

<div class="row">

<div class="col-md-6 col-12 mt-3">
<label>Full Name</label>
<input type="text" name="name" class="form-control" required>
</div>

<div class="col-md-6 col-12 mt-3">
<label>Organization Name</label>
<input type="text" name="org_name" class="form-control" required>
</div>

<div class="col-md-6 col-12 mt-3">
<label class="form-label">Tax Id / GST No. (Optional)</label>
<input type="text" name="tax_id" class="form-control" placeholder="Enter GST / Tax ID">
</div>

<div class="col-md-6 col-12 mt-3">
<label>Phone</label>
<input type="text" name="phone" class="form-control">
</div>

<div class="col-md-6 col-12 mt-3">
<label>Email</label>
<input type="email" name="email" id="email" class="form-control" required>
<small id="email_status"></small>
</div>

<div class="col-md-6 col-12 mt-3">
<label>Password</label>
<input type="password" name="password" class="form-control" required>
</div>

<div class="col-md-12 col-12 mt-3">
<label>Address</label>
<textarea name="address" class="form-control"></textarea>
</div>

<div class="col-md-6 col-12 mt-3">
<label>Country</label>
<select name="country" class="form-select" required>
<option value="">Select Country</option>

<option>Afghanistan</option>
<option>Albania</option>
<option>Algeria</option>
<option>Andorra</option>
<option>Angola</option>
<option>Antigua and Barbuda</option>
<option>Argentina</option>
<option>Armenia</option>
<option>Australia</option>
<option>Austria</option>
<option>Azerbaijan</option>
<option>Bahamas</option>
<option>Bahrain</option>
<option>Bangladesh</option>
<option>Barbados</option>
<option>Belarus</option>
<option>Belgium</option>
<option>Belize</option>
<option>Benin</option>
<option>Bhutan</option>
<option>Bolivia</option>
<option>Bosnia and Herzegovina</option>
<option>Botswana</option>
<option>Brazil</option>
<option>Brunei</option>
<option>Bulgaria</option>
<option>Burkina Faso</option>
<option>Burundi</option>
<option>Cambodia</option>
<option>Cameroon</option>
<option>Canada</option>
<option>Cape Verde</option>
<option>Central African Republic</option>
<option>Chad</option>
<option>Chile</option>
<option>China</option>
<option>Colombia</option>
<option>Comoros</option>
<option>Congo</option>
<option>Costa Rica</option>
<option>Croatia</option>
<option>Cuba</option>
<option>Cyprus</option>
<option>Czech Republic</option>
<option>Denmark</option>
<option>Djibouti</option>
<option>Dominica</option>
<option>Dominican Republic</option>
<option>East Timor</option>
<option>Ecuador</option>
<option>Egypt</option>
<option>El Salvador</option>
<option>Equatorial Guinea</option>
<option>Eritrea</option>
<option>Estonia</option>
<option>Eswatini</option>
<option>Ethiopia</option>
<option>Fiji</option>
<option>Finland</option>
<option>France</option>
<option>Gabon</option>
<option>Gambia</option>
<option>Georgia</option>
<option>Germany</option>
<option>Ghana</option>
<option>Greece</option>
<option>Grenada</option>
<option>Guatemala</option>
<option>Guinea</option>
<option>Guinea-Bissau</option>
<option>Guyana</option>
<option>Haiti</option>
<option>Honduras</option>
<option>Hungary</option>
<option>Iceland</option>
<option>India</option>
<option>Indonesia</option>
<option>Iran</option>
<option>Iraq</option>
<option>Ireland</option>
<option>Israel</option>
<option>Italy</option>
<option>Jamaica</option>
<option>Japan</option>
<option>Jordan</option>
<option>Kazakhstan</option>
<option>Kenya</option>
<option>Kiribati</option>
<option>Korea North</option>
<option>Korea South</option>
<option>Kuwait</option>
<option>Kyrgyzstan</option>
<option>Laos</option>
<option>Latvia</option>
<option>Lebanon</option>
<option>Lesotho</option>
<option>Liberia</option>
<option>Libya</option>
<option>Liechtenstein</option>
<option>Lithuania</option>
<option>Luxembourg</option>
<option>Madagascar</option>
<option>Malawi</option>
<option>Malaysia</option>
<option>Maldives</option>
<option>Mali</option>
<option>Malta</option>
<option>Marshall Islands</option>
<option>Mauritania</option>
<option>Mauritius</option>
<option>Mexico</option>
<option>Micronesia</option>
<option>Moldova</option>
<option>Monaco</option>
<option>Mongolia</option>
<option>Montenegro</option>
<option>Morocco</option>
<option>Mozambique</option>
<option>Myanmar</option>
<option>Namibia</option>
<option>Nauru</option>
<option>Nepal</option>
<option>Netherlands</option>
<option>New Zealand</option>
<option>Nicaragua</option>
<option>Niger</option>
<option>Nigeria</option>
<option>North Macedonia</option>
<option>Norway</option>
<option>Oman</option>
<option>Pakistan</option>
<option>Palau</option>
<option>Panama</option>
<option>Papua New Guinea</option>
<option>Paraguay</option>
<option>Peru</option>
<option>Philippines</option>
<option>Poland</option>
<option>Portugal</option>
<option>Qatar</option>
<option>Romania</option>
<option>Russia</option>
<option>Rwanda</option>
<option>Saint Kitts and Nevis</option>
<option>Saint Lucia</option>
<option>Saint Vincent and the Grenadines</option>
<option>Samoa</option>
<option>San Marino</option>
<option>Sao Tome and Principe</option>
<option>Saudi Arabia</option>
<option>Senegal</option>
<option>Serbia</option>
<option>Seychelles</option>
<option>Sierra Leone</option>
<option>Singapore</option>
<option>Slovakia</option>
<option>Slovenia</option>
<option>Solomon Islands</option>
<option>Somalia</option>
<option>South Africa</option>
<option>Spain</option>
<option>Sri Lanka</option>
<option>Sudan</option>
<option>Suriname</option>
<option>Sweden</option>
<option>Switzerland</option>
<option>Syria</option>
<option>Taiwan</option>
<option>Tajikistan</option>
<option>Tanzania</option>
<option>Thailand</option>
<option>Togo</option>
<option>Tonga</option>
<option>Trinidad and Tobago</option>
<option>Tunisia</option>
<option>Turkey</option>
<option>Turkmenistan</option>
<option>Tuvalu</option>
<option>Uganda</option>
<option>Ukraine</option>
<option>United Arab Emirates</option>
<option>United Kingdom</option>
<option>United States</option>
<option>Uruguay</option>
<option>Uzbekistan</option>
<option>Vanuatu</option>
<option>Vatican City</option>
<option>Venezuela</option>
<option>Vietnam</option>
<option>Yemen</option>
<option>Zambia</option>
<option>Zimbabwe</option>

</select>
</div>



<div class="col-md-6 col-12 mt-3">
<label>Pin/Zip</label>
<input type="text" name="pin_zip" class="form-control">
</div>

<div class="col-md-12 col-12 mt-3">
<label>Upload Legal Document (PDF)</label>
<input type="file" name="legal_document" accept=".pdf" class="form-control" required>
</div>

<div class="col-md-12 col-12 mt-3">
<input type="checkbox" required> I Accept Terms & Conditions
</div>
<!--
<div class="col-md-6 col-12 mt-3">
<div class="g-recaptcha" data-sitekey="6Lc08e4qAAAAAGQZwFq1FCJuse_kzDZdrZ49F9qG"></div>
</div>
-->
<div class="col-md-12 col-12 mt-3">
<button type="submit" id="submitBtn" class="btn btn-primary w-100">
Submit Application
</button>
</div>

</div>
</form>
</div>
</div>

</div>
</div>
<script>
$(document).ready(function(){

    $("#email").on("blur", function(){

        var email = $(this).val().trim();

        if(email === ""){
            $("#email_status").html("");
            return;
        }

        $.ajax({
            url: "check_email.php",
            type: "POST",
            data: { email: email },
            success: function(response){

                response = response.trim();

                if(response === "exists"){
                    $("#email_status").html(
                        "<span style='color:red'>Email already registered</span>"
                    );
                    $("#submitBtn").prop("disabled", true);
                }
                else if(response === "available"){
                    $("#email_status").html(
                        "<span style='color:green'>Email available</span>"
                    );
                    $("#submitBtn").prop("disabled", false);
                }
                else{
                    $("#email_status").html("");
                }
            },
            error: function(){
                $("#email_status").html(
                    "<span style='color:red'>Error checking email</span>"
                );
            }
        });

    });

});
</script>
<?php include("../includes/footer.php"); ?>