<?php 

class Ielts_Lms_My_Account_Ajax {
    private static $instance;

    /**
	 * Main Ielts_Lms Instance.
	 *
	 * Ensures only one instance of Ielts_Lms is loaded or can be loaded.
	 *
	 * @since 1.0
	 * @static
	 * @see ST()
	 * @return Ielts_Lms - Main instance.
	 */
	public static function get_instance() {
		if ( ! isset( self::$instance ) ) {
			/** @psalm-suppress InvalidPropertyAssignmentValue */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
			self::$instance = new self();
			/** @psalm-suppress InvalidPropertyAssignmentValue */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
		}
		return self::$instance;
	}

    public function __construct(){
        global $ST_OPTION_st_proqyz__auth_ielts_account_complete;
        $my_account_init = get_option($ST_OPTION_st_proqyz__auth_ielts_account_complete,0);
        if($my_account_init == 1){
            $this->_reg();
        }
    }

    public function _reg(){
        $this->register_ajax_hooks();
        $this->register_hooks();
    }


    // Add the select input to a form or wherever you need it

    public function register_ajax_hooks(){
        add_action('wp_ajax_ielts-lms-my-account-step-1', [$this, 'my_account_step1']);
        add_action('wp_ajax_ielts-lms-submit-step-1', [$this,'submit_step1']);
        add_action('wp_ajax_ielts-lms-my-account-step-1-load', [$this, 'my_account_step1_load']);
        add_action('wp_ajax_ielts-lms-submit-step-2', [$this,'submit_step2']);
        add_action('wp_ajax_ielts-lms-my-account-step-2-load', [$this, 'my_account_step2_load']);
        add_action('wp_ajax_ielts-lms-submit-step-3', [$this,'submit_step3']);
        
    }

    public function register_hooks(){
       // add_action('user_register', [$this,'redirect_after_signup'], 10, 1);
	   //	add_action('template_redirect', [$this,'custom_redirect_logic'] );
    }

    public function redirect_after_signup($user_id) {
		// Check if the user meta 'account-step' is not set or its value is 0
		$is_completed = get_user_meta($user_id, 'account-completed', true);
		if (!$is_completed) {
			// Redirect the user to the 'profile-complete' page
			if (!is_page('signup/complete-profile')) {
				if(isset($_GET['redirect_to']) && !empty($_GET['redirect_to'])){
					// Redirect the user to the 'profile-complete' page
					wp_safe_redirect('signup/complete-profile?redirect_to='.$redirect_to);
					exit();
				} else {
					wp_safe_redirect('signup/complete-profile');
					exit();
				}
			}

		}
	}

	

	public function custom_redirect_logic() {
		// Check if the user is not an administrator (not visiting wp-admin)
		if(is_user_logged_in()){
			if (!current_user_can('administrator')) {
				$user_id = get_current_user_id();
				$current_url = home_url($_SERVER['REQUEST_URI']);
				// Check if the user meta 'account-step' is not set or its value is 0
				if (!get_user_meta($user_id, 'account-completed', true)) {
					if (strpos($current_url, '/signup/complete-profile') == false) {
						if(isset($_GET['redirect_to']) && !empty($_GET['redirect_to'])){
							$redirect_to = $_GET['redirect_to'];
							// Redirect the user to the 'profile-complete' page
							wp_safe_redirect('signup/complete-profile?redirect_to='.$redirect_to);
							exit();
						} else {
							wp_safe_redirect('signup/complete-profile');
							exit();
						}
					}
				}
				
			}
		}
	}
	



    public function my_account_step1(){

        

        $current_user_id = get_current_user_id();
        # step - 1 [meta]
        $metas = [
            "ielts_lms_step-which-best-describes-you",          // multiple

            "ielts_lms_step-what-kind-of-student-you-are",
            "ielts_lms_step-tell-us-about-your-child",

            "ielts_lms_step-my-reason-for-practicing-ielts",    // multiple

            "ielts_lms_step-how-about-an-ielts-score",          // [yes | no]

            "ielts_lms_step-previous-score",                    // float
            "ielts_lms_step-target-score",                      // float
            "ielts_lms_step-exam-preparation-time"              // string
        ];

        $which_best_describes_you       = get_user_meta($current_user_id, 'ielts_lms_step-which-best-describes-you', true);
        $what_kind_of_student_you_are   = get_user_meta($current_user_id, 'ielts_lms_step-what-kind-of-student-you-are', true);
        $tell_us_about_your_child       = get_user_meta($current_user_id, 'ielts_lms_step-tell-us-about-your-child', true);
        /*
        $my_reason_for_practicing_ielts = get_user_meta($current_user_id, 'ielts_lms_step-my-reason-for-practicing-ielts', true);
        $how_about_an_ielts_score       = get_user_meta($current_user_id, 'ielts_lms_step-how-about-an-ielts-score', true);

        $previous_score                 = get_user_meta($current_user_id, 'ielts_lms_step-previous-score', true);
        $target_score                   = get_user_meta($current_user_id, 'ielts_lms_step-target-score', true);
        $exam_preparation_time          = get_user_meta($current_user_id, 'ielts_lms_step-exam-preparation-time', true);
        */


        ob_start(); ?>
        <form class="profile-question-form" method="post" id="profile-form-step-1" accept-charset="UTF-8">

            <!--steps::begin-->
            <div class="step-progress clearfix">
                <span class="active step-1 ">1</span>
                <ul class="dots f-step">
                    <li class="active"></li>
                    <li class="active"></li>
                    <li></li>
                    <li></li>
                </ul>
                <span class="step-2">2</span>
                <ul class="dots s-step">
                    <li></li>
                    <li></li>
                    <li></li>
                    <li></li>
                </ul>
                <span class="step-3">3</span>
            </div>
            <!--steps::end-->
        
            <div class="describes-box clearfix">
                <h2 class="describes-box__title">
                    Which best describes you?
                </h2>
                <div role="tabpanel" class="describes-box__describes-content">
                    <!--TAB-LINKS::begin-->
                    <ul class="nav describes-box__job-tabs user-job-box hidden-xs" role="tablist">
                        <li data-value="current-student" data-step="ielts_lms_step-which-best-describes-you" role="presentation" class="lg-tab describes-box__tab-item <?php echo ($which_best_describes_you == "current-student")? 'active' : ''; ?>">
                            <a href="#current-std" aria-controls="current-std" role="tab" data-toggle="tab" data-value="current-std" data-name="profile_type" drupal-selector="profile_type" aria-expanded="true">
                                <div class="describes-box__tab-title">Current Student</div>
                                <span class="checked-icon"></span> 
                            </a>
                        </li>
                        <li data-value="parent-or-guardian-of-current-student" data-step="ielts_lms_step-which-best-describes-you" role="presentation" class="lg-tab describes-box__tab-item <?php echo ($which_best_describes_you == "parent-or-guardian-of-current-student")? 'active' : ''; ?>">
                            <a href="#parent" aria-controls="parent" role="tab" data-toggle="tab" data-value="parent" data-name="profile_type" drupal-selector="profile_type" aria-expanded="false">
                                <div class="describes-box__tab-title">Parent or Guardian of current student</div>
                                <span class="checked-icon"></span> 
                            </a>
                        </li>
                        <li data-value="working-professional" data-step="ielts_lms_step-which-best-describes-you" role="presentation" class="lg-tab describes-box__tab-item <?php echo ($which_best_describes_you == "working-professional")? 'active' : ''; ?>">
                            <a href="#pro" aria-controls="pro" role="tab" data-toggle="tab" data-value="pro" data-name="profile_type" aria-expanded="false" drupal-selector="profile_type">
                                <div class="describes-box__tab-title">Working Professional</div>
                                <span class="checked-icon"></span> 
                            </a>
                        </li>
                        <li data-value="institution-staff" data-step="ielts_lms_step-which-best-describes-you" role="presentation" class="lg-tab describes-box__tab-item <?php echo ($which_best_describes_you == "institution-staff")? 'active' : ''; ?>">
                            <a href="#staff" aria-controls="staff" role="tab" data-toggle="tab" data-value="staff" data-name="profile_type" drupal-selector="profile_type" aria-expanded="false">
                                <div class="describes-box__tab-title">Institution Staff</div>
                                <span class="checked-icon"></span> 
                            </a>
                        </li>
                        <li data-value="partner" data-step="ielts_lms_step-which-best-describes-you" role="presentation" class="lg-tab describes-box__tab-item <?php echo ($which_best_describes_you == "partner")? 'active' : ''; ?>">
                            <a href="#partner" aria-controls="partner" role="tab" data-toggle="tab" data-value="partner" data-name="profile_type" drupal-selector="profile_type" aria-expanded="false">
                                <div class="describes-box__tab-title">Partner</div>
                                <span class="checked-icon"></span> 
                            </a>
                        </li>
                    </ul>
                    <!--TAB-LINKS::end-->
                    <!--STEPS-TABS::BEGIN-->
                    <div class="tab-content" id="my-job">

                        <div role="tabpanel" class="xs-tabs tab-pane describes-box__tab-pane <?php echo ($which_best_describes_you == "current-student")? 'active' : ''; ?>" id="current-std" data-describe="current-student">
                            <span class="checked-icon"></span>
                            <div class="describes-box__job-body clearfix">
                                <h5 class="describes-box__job-quest hidden-xs"> What kind of student you are?</h5>
                                <h3 class="describes-box__panel-title panel-title"> 
                                    <a href="#current-student" class="describes-box__tab-mb-title" data-toggle="tab0" data-value="current-student"> 
                                        Current Student 
                                    </a>
                                </h3>
                                <div class="describes-box__job-list " id="mb-current-std">
                                    <div class="describes-box__job-list-wrapper clearfix"> 

                                        <label class="iot-ra-cbx col-xs-12 col-sm-6"> 
                                            <input type="radio" name="kind-of" data-value="junior-Middle-high-school" value="junior-Middle-high-school" <?php echo ($what_kind_of_student_you_are == "junior-Middle-high-school")? 'checked' : ''; ?>> 
                                            <span class="checkmark"></span> 
                                            <span class="cb-label">Junior/Middle high school</span> 
                                        </label> 

                                        <label class="iot-ra-cbx col-xs-12 col-sm-6"> 
                                            <input type="radio" name="kind-of" data-value="college-University-student" value="college-University-student" <?php echo ($what_kind_of_student_you_are == "college-University-student")? 'checked' : ''; ?>> 
                                            <span class="checkmark"></span> 
                                            <span class="cb-label">College/University student</span> 
                                        </label> 

                                        <label class="iot-ra-cbx col-xs-12 col-sm-6"> 
                                            <input type="radio" name="kind-of" data-value="high-school-student" value="high-school-student" <?php echo ($what_kind_of_student_you_are == "high-school-student")? 'checked' : ''; ?>> 
                                            <span class="checkmark"></span> 
                                            <span class="cb-label">High school student</span> 
                                        </label> 

                                        <label class="iot-ra-cbx col-xs-12 col-sm-6"> 
                                            <input type="radio" name="kind-of" data-value="graduate-student" value="graduate-student" <?php echo ($what_kind_of_student_you_are == "graduate-student")? 'checked' : ''; ?>> 
                                            <span class="checkmark"></span> 
                                            <span class="cb-label">Graduate student</span> 
                                        </label> 

                                        <label class="iot-ra-cbx col-xs-12 col-sm-6"> 
                                            <input type="radio" name="kind-of" data-value="other" value="other" <?php echo ($what_kind_of_student_you_are == "other")? 'checked' : ''; ?>> 
                                            <span class="checkmark"></span> 
                                            <span class="cb-label">Other</span> 
                                        </label>

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

                        <div role="tabpanel" class="xs-tabs tab-pane describes-box__tab-pane <?php echo ($which_best_describes_you == "parent-or-guardian-of-current-student")? 'active' : ''; ?>" id="parent" data-describe="parent-or-guardian-of-current-student">
                            <span class="checked-icon"></span>

                            <div class="describes-box__job-body clearfix">
                                <h5 class="describes-box__job-quest hidden-xs"> Tell us about your child</h5>
                                <h3 class="describes-box__panel-title panel-title"> 
                                    <a href="#parent-or-guardian-of-current-student" class="describes-box__tab-mb-title" data-toggle="tab0" data-value="parent-or-guardian-of-current-student"> 
                                        Parent or Guardian of current student 
                                    </a>
                                </h3>
                                <div class="describes-box__job-list" id="mb-parent">
                                    <div class="describes-box__job-list-wrapper clearfix"> 
                                        <label class="iot-ra-cbx col-xs-12 col-sm-6"> 
                                            <input type="radio" name="kind-of-parent" data-value="junior-Middle-high-school" value="junior-Middle-high-school" <?php echo ($tell_us_about_your_child == "junior-Middle-high-school")? 'checked' : ''; ?> /> 
                                            <span class="checkmark"></span> 
                                            <span class="cb-label">Junior/Middle high school</span> 
                                        </label> 
                                        <label class="iot-ra-cbx col-xs-12 col-sm-6"> 
                                            <input type="radio" name="kind-of-parent" data-value="college-University-student" value="college-University-student" <?php echo ($tell_us_about_your_child == "college-University-student")? 'checked' : ''; ?> /> 
                                            <span class="checkmark"></span> 
                                            <span class="cb-label">College/University student</span> 
                                        </label> 
                                        <label class="iot-ra-cbx col-xs-12 col-sm-6"> 
                                            <input type="radio" name="kind-of-parent" data-value="high-school-student" value="high-school-student" <?php echo ($tell_us_about_your_child == "high-school-student")? 'checked' : ''; ?> /> 
                                            <span class="checkmark"></span> 
                                            <span class="cb-label">High school student</span> 
                                        </label> 
                                        <label class="iot-ra-cbx col-xs-12 col-sm-6"> 
                                            <input type="radio" name="kind-of-parent" data-value="graduate-student" value="graduate-student" <?php echo ($tell_us_about_your_child == "graduate-student")? 'checked' : ''; ?> /> 
                                            <span class="checkmark"></span> 
                                            <span class="cb-label">Graduate student</span> 
                                        </label> 
                                        <label class="iot-ra-cbx col-xs-12 col-sm-6"> 
                                            <input type="radio" name="kind-of-parent" data-value="other" value="other" <?php echo ($tell_us_about_your_child == "other")? 'checked' : ''; ?> /> 
                                            <span class="checkmark"></span> 
                                            <span class="cb-label">Other</span> 
                                        </label>
                                    </div>
                                </div>
                            </div>

                        </div>

                        <div role="tabpanel" class="xs-tabs tab-pane describes-box__tab-pane visible-xs <?php echo ($which_best_describes_you == "working-professional")? 'active' : ''; ?>" data-describe="working-professional">
                            <span class="checked-icon"></span>
                            <div class="describes-box__job-body unique clearfix">
                                <h5 class="describes-box__job-quest hidden-xs"></h5>
                                <h3 class="describes-box__panel-title panel-title"> 
                                    <a data-toggle="tab0" class="describes-box__tab-mb-title" href="#working-professional" data-value="working-professional"> Working Professional </a>
                                </h3>
                            </div>
                        </div>
                        <div role="tabpanel" class="xs-tabs tab-pane describes-box__tab-pane visible-xs <?php echo ($which_best_describes_you == "institution-staff")? 'active' : ''; ?>" data-describe="institution-staff">
                            <span class="checked-icon"></span>
                            <div class="describes-box__job-body unique clearfix">
                                <h5 class="describes-box__job-quest hidden-xs"></h5>
                                <h3 class="describes-box__panel-title panel-title"> 
                                    <a data-toggle="tab0" class="describes-box__tab-mb-title" href="#institution-staff" data-value="institution-staff">  
                                        Institution Staff 
                                    </a>
                                </h3>
                            </div>
                        </div>
                        <div role="tabpanel" class="xs-tabs tab-pane describes-box__tab-pane visible-xs <?php echo ($which_best_describes_you == "partner")? 'active' : ''; ?>" data-describe="partner">
                            <span class="checked-icon"></span>
                            <div class="describes-box__job-body unique clearfix">
                                <h5 class="describes-box__job-quest hidden-xs"></h5>
                                <h3 class="describes-box__panel-title panel-title"> 
                                    <a data-toggle="tab0" class="describes-box__tab-mb-title" href="#partner" data-value="partner"> 
                                        Partner 
                                    </a>
                                </h3>
                            </div>
                        </div>
                    </div>
                    <!--STEPS-TABS::END-->
                </div>
            </div>
        
            <div class="step-footer-wp">
                <div class="step-footer clearfix">
                    <div class="container">
                        <div class="more-info"> We will personalise your feed and <br> recommendation based on this info.</div>
                        <button type="submit" class="bt-next step-footer__btn -next button js-form-submit form-submit btn-default btn" type="submit" id="edit-submit" name="op" value="Next">
                            Next
                        </button>
                        
                    </div>
                </div>
            </div>

        </form>
    
        <?php return ob_get_clean();
    }

    public function submit_step1(){
        if(isset($_POST['data'])){
            $user_id = get_current_user_id();
            $data = (array) $_POST['data'];
    
            if( count($data) > 0 ) {
                foreach($data as $key => $value ) {
                    update_user_meta($user_id, $key, $value );
                }
    
                wp_send_json([
                    "success"   => true,
                    "res"       => "step 1 saved successfully",
                    "has_html"  => true,
                    "html"      => $this->my_account_step2()   
                ]);
            } else {
                wp_send_json([
                    "success"   => false,
                    "res"       => "Missing user data"   
                ]);
            }
        } else {
            wp_send_json([
                "success"   => false,
                "res"       => "Missing user data"   
            ]);
        }
    }

    public function my_account_step2(){
        $current_user_id        = get_current_user_id();
        $current_user           = wp_get_current_user();
        

        $currencies             = get_option('wccs_currencies',true);
        $currencies_enabled     = false;
        if($currencies){
            $currencies = (array) $currencies;
            if(count($currencies) > 0 ) {
                $currencies_enabled     = true;
            }
        }

        $first_name = get_user_meta($current_user_id, 'first_name',true);
        $last_name  = get_user_meta($current_user_id, 'last_name',true);
        $user_email = $current_user->user_email;
        $country    = get_user_meta($current_user_id, "billing_country",true);
        $currency   = get_user_meta($current_user_id, "currency",true);
        $timezone   = get_user_meta($current_user_id, "timezone",true);




        ob_start(); ?>
        <form class="profile-question-form " method="post" id="profile-form-step-2" accept-charset="UTF-8">

            <!--steps::begin-->
            <div class="step-progress clearfix">
                <span class="active step-1 completed">1</span>
                <ul class="dots f-step">
                    <li class="active completed"></li>
                    <li class="active completed"></li>
                    <li class="active"></li>
                    <li class="active"></li>
                </ul>
                <span class="step-2 active">2</span>
                <ul class="dots s-step">
                    <li class="active"></li>
                    <li class="active"></li>
                    <li></li>
                    <li></li>
                </ul>
                <span class="step-3">3</span>
            </div>
            <!--steps::end-->



            <div class="basic-info-box clearfix ">
                <div id="basic-if-form">
                    <div class="row row-flex">
                        <div class="form-group col-xs-12 col-sm-6">
                            <div class="js-form-item form-item js-form-type-textfield form-item-first-name js-form-item-first-name"> 
                                <label class="basic-info-box__label group-label js-form-required form-required" for="first_name">First Name *</label> 
                                <input placeholder="Please fill in your first name" class="form-text required form-control" type="text" id="first_name" name="first_name" value="<?php echo $first_name; ?>" size="60" maxlength="128" required="required" aria-required="true" />
                            </div>
                        </div>
                        <div class="form-group col-xs-12 col-sm-6">
                            <div class="js-form-item form-item js-form-type-textfield form-item-last-name js-form-item-last-name"> 
                                <label class="basic-info-box__label group-label js-form-required form-required" for="last_name">Last Name *</label> 
                                <input placeholder="Please fill in your last name" class="form-text required form-control" type="text" id="last_name" name="last_name" value="<?php echo $last_name; ?>" size="60" maxlength="128" required="required" aria-required="true" />
                            </div>
                        </div>
                        <div class="form-group col-xs-12 col-sm-6">
                            <div class="js-form-item form-item js-form-type-email form-item-email js-form-item-email form-disabled"> 
                                <label class="basic-info-box__label group-label js-form-required form-required" for="email">Email / Parent Email *</label> 
                                <input placeholder="Please fill in your email address" disabled="disabled" class="form-email required form-control" type="email" id="email" name="email" value="<?php echo $user_email; ?>" size="60" maxlength="254" required="required" aria-required="true" />
                            </div>
                        </div>
                        <div class="form-group col-xs-12 col-sm-6">
                            <div class="js-form-item form-item js-form-type-select form-item-country js-form-item-country">
                                <label class="basic-info-box__label group-label js-form-required form-required" for="edit-country">Country/Region of Residence *</label>
                                <div class="select-wrapper">
                                    <select data-select-value="<?php echo $country; ?>" value="<?php echo $country; ?>" required="required" name="country" id="country" class="select2 dropdown bootstrap-select form-select form-control dropup">
                                        <option value="" selected="selected">Select a country / region…</option>
                                        <option value="AF">Afghanistan</option>
                                        <option value="AX">Åland Islands</option>
                                        <option value="AL">Albania</option>
                                        <option value="DZ">Algeria</option>
                                        <option value="AS">American Samoa</option>
                                        <option value="AD">Andorra</option>
                                        <option value="AO">Angola</option>
                                        <option value="AI">Anguilla</option>
                                        <option value="AQ">Antarctica</option>
                                        <option value="AG">Antigua and Barbuda</option>
                                        <option value="AR">Argentina</option>
                                        <option value="AM">Armenia</option>
                                        <option value="AW">Aruba</option>
                                        <option value="AU">Australia</option>
                                        <option value="AT">Austria</option>
                                        <option value="AZ">Azerbaijan</option>
                                        <option value="BS">Bahamas</option>
                                        <option value="BH">Bahrain</option>
                                        <option value="BD">Bangladesh</option>
                                        <option value="BB">Barbados</option>
                                        <option value="BY">Belarus</option>
                                        <option value="PW">Belau</option>
                                        <option value="BE">Belgium</option>
                                        <option value="BZ">Belize</option>
                                        <option value="BJ">Benin</option>
                                        <option value="BM">Bermuda</option>
                                        <option value="BT">Bhutan</option>
                                        <option value="BO">Bolivia</option>
                                        <option value="BQ">Bonaire, Saint Eustatius and Saba</option>
                                        <option value="BA">Bosnia and Herzegovina</option>
                                        <option value="BW">Botswana</option>
                                        <option value="BV">Bouvet Island</option>
                                        <option value="BR">Brazil</option>
                                        <option value="IO">British Indian Ocean Territory</option>
                                        <option value="BN">Brunei</option>
                                        <option value="BG">Bulgaria</option>
                                        <option value="BF">Burkina Faso</option>
                                        <option value="BI">Burundi</option>
                                        <option value="KH">Cambodia</option>
                                        <option value="CM">Cameroon</option>
                                        <option value="CA">Canada</option>
                                        <option value="CV">Cape Verde</option>
                                        <option value="KY">Cayman Islands</option>
                                        <option value="CF">Central African Republic</option>
                                        <option value="TD">Chad</option>
                                        <option value="CL">Chile</option>
                                        <option value="CN">China</option>
                                        <option value="CX">Christmas Island</option>
                                        <option value="CC">Cocos (Keeling) Islands</option>
                                        <option value="CO">Colombia</option>
                                        <option value="KM">Comoros</option>
                                        <option value="CG">Congo (Brazzaville)</option>
                                        <option value="CD">Congo (Kinshasa)</option>
                                        <option value="CK">Cook Islands</option>
                                        <option value="CR">Costa Rica</option>
                                        <option value="HR">Croatia</option>
                                        <option value="CU">Cuba</option>
                                        <option value="CW">Curaçao</option>
                                        <option value="CY">Cyprus</option>
                                        <option value="CZ">Czech Republic</option>
                                        <option value="DK">Denmark</option>
                                        <option value="DJ">Djibouti</option>
                                        <option value="DM">Dominica</option>
                                        <option value="DO">Dominican Republic</option>
                                        <option value="EC">Ecuador</option>
                                        <option value="EG">Egypt</option>
                                        <option value="SV">El Salvador</option>
                                        <option value="GQ">Equatorial Guinea</option>
                                        <option value="ER">Eritrea</option>
                                        <option value="EE">Estonia</option>
                                        <option value="SZ">Eswatini</option>
                                        <option value="ET">Ethiopia</option>
                                        <option value="FK">Falkland Islands</option>
                                        <option value="FO">Faroe Islands</option>
                                        <option value="FJ">Fiji</option>
                                        <option value="FI">Finland</option>
                                        <option value="FR">France</option>
                                        <option value="GF">French Guiana</option>
                                        <option value="PF">French Polynesia</option>
                                        <option value="TF">French Southern Territories</option>
                                        <option value="GA">Gabon</option>
                                        <option value="GM">Gambia</option>
                                        <option value="GE">Georgia</option>
                                        <option value="DE">Germany</option>
                                        <option value="GH">Ghana</option>
                                        <option value="GI">Gibraltar</option>
                                        <option value="GR">Greece</option>
                                        <option value="GL">Greenland</option>
                                        <option value="GD">Grenada</option>
                                        <option value="GP">Guadeloupe</option>
                                        <option value="GU">Guam</option>
                                        <option value="GT">Guatemala</option>
                                        <option value="GG">Guernsey</option>
                                        <option value="GN">Guinea</option>
                                        <option value="GW">Guinea-Bissau</option>
                                        <option value="GY">Guyana</option>
                                        <option value="HT">Haiti</option>
                                        <option value="HM">Heard Island and McDonald Islands</option>
                                        <option value="HN">Honduras</option>
                                        <option value="HK">Hong Kong</option>
                                        <option value="HU">Hungary</option>
                                        <option value="IS">Iceland</option>
                                        <option value="IN">India</option>
                                        <option value="ID">Indonesia</option>
                                        <option value="IR">Iran</option>
                                        <option value="IQ">Iraq</option>
                                        <option value="IE">Ireland</option>
                                        <option value="IM">Isle of Man</option>
                                        <option value="IL">Israel</option>
                                        <option value="IT">Italy</option>
                                        <option value="CI">Ivory Coast</option>
                                        <option value="JM">Jamaica</option>
                                        <option value="JP">Japan</option>
                                        <option value="JE">Jersey</option>
                                        <option value="JO">Jordan</option>
                                        <option value="KZ">Kazakhstan</option>
                                        <option value="KE">Kenya</option>
                                        <option value="KI">Kiribati</option>
                                        <option value="KW">Kuwait</option>
                                        <option value="KG">Kyrgyzstan</option>
                                        <option value="LA">Laos</option>
                                        <option value="LV">Latvia</option>
                                        <option value="LB">Lebanon</option>
                                        <option value="LS">Lesotho</option>
                                        <option value="LR">Liberia</option>
                                        <option value="LY">Libya</option>
                                        <option value="LI">Liechtenstein</option>
                                        <option value="LT">Lithuania</option>
                                        <option value="LU">Luxembourg</option>
                                        <option value="MO">Macao</option>
                                        <option value="MG">Madagascar</option>
                                        <option value="MW">Malawi</option>
                                        <option value="MY">Malaysia</option>
                                        <option value="MV">Maldives</option>
                                        <option value="ML">Mali</option>
                                        <option value="MT">Malta</option>
                                        <option value="MH">Marshall Islands</option>
                                        <option value="MQ">Martinique</option>
                                        <option value="MR">Mauritania</option>
                                        <option value="MU">Mauritius</option>
                                        <option value="YT">Mayotte</option>
                                        <option value="MX">Mexico</option>
                                        <option value="FM">Micronesia</option>
                                        <option value="MD">Moldova</option>
                                        <option value="MC">Monaco</option>
                                        <option value="MN">Mongolia</option>
                                        <option value="ME">Montenegro</option>
                                        <option value="MS">Montserrat</option>
                                        <option value="MA">Morocco</option>
                                        <option value="MZ">Mozambique</option>
                                        <option value="MM">Myanmar</option>
                                        <option value="NA">Namibia</option>
                                        <option value="NR">Nauru</option>
                                        <option value="NP">Nepal</option>
                                        <option value="NL">Netherlands</option>
                                        <option value="NC">New Caledonia</option>
                                        <option value="NZ">New Zealand</option>
                                        <option value="NI">Nicaragua</option>
                                        <option value="NE">Niger</option>
                                        <option value="NG">Nigeria</option>
                                        <option value="NU">Niue</option>
                                        <option value="NF">Norfolk Island</option>
                                        <option value="KP">North Korea</option>
                                        <option value="MK">North Macedonia</option>
                                        <option value="MP">Northern Mariana Islands</option>
                                        <option value="NO">Norway</option>
                                        <option value="OM">Oman</option>
                                        <option value="PK">Pakistan</option>
                                        <option value="PS">Palestinian Territory</option>
                                        <option value="PA">Panama</option>
                                        <option value="PG">Papua New Guinea</option>
                                        <option value="PY">Paraguay</option>
                                        <option value="PE">Peru</option>
                                        <option value="PH">Philippines</option>
                                        <option value="PN">Pitcairn</option>
                                        <option value="PL">Poland</option>
                                        <option value="PT">Portugal</option>
                                        <option value="PR">Puerto Rico</option>
                                        <option value="QA">Qatar</option>
                                        <option value="RE">Reunion</option>
                                        <option value="RO">Romania</option>
                                        <option value="RU">Russia</option>
                                        <option value="RW">Rwanda</option>
                                        <option value="BL">Saint Barthélemy</option>
                                        <option value="SH">Saint Helena</option>
                                        <option value="KN">Saint Kitts and Nevis</option>
                                        <option value="LC">Saint Lucia</option>
                                        <option value="SX">Saint Martin (Dutch part)</option>
                                        <option value="MF">Saint Martin (French part)</option>
                                        <option value="PM">Saint Pierre and Miquelon</option>
                                        <option value="VC">Saint Vincent and the Grenadines</option>
                                        <option value="WS">Samoa</option>
                                        <option value="SM">San Marino</option>
                                        <option value="ST">São Tomé and Príncipe</option>
                                        <option value="SA">Saudi Arabia</option>
                                        <option value="SN">Senegal</option>
                                        <option value="RS">Serbia</option>
                                        <option value="SC">Seychelles</option>
                                        <option value="SL">Sierra Leone</option>
                                        <option value="SG">Singapore</option>
                                        <option value="SK">Slovakia</option>
                                        <option value="SI">Slovenia</option>
                                        <option value="SB">Solomon Islands</option>
                                        <option value="SO">Somalia</option>
                                        <option value="ZA">South Africa</option>
                                        <option value="GS">South Georgia/Sandwich Islands</option>
                                        <option value="KR">South Korea</option>
                                        <option value="SS">South Sudan</option>
                                        <option value="ES">Spain</option>
                                        <option value="LK">Sri Lanka</option>
                                        <option value="SD">Sudan</option>
                                        <option value="SR">Suriname</option>
                                        <option value="SJ">Svalbard and Jan Mayen</option>
                                        <option value="SE">Sweden</option>
                                        <option value="CH">Switzerland</option>
                                        <option value="SY">Syria</option>
                                        <option value="TW">Taiwan</option>
                                        <option value="TJ">Tajikistan</option>
                                        <option value="TZ">Tanzania</option>
                                        <option value="TH">Thailand</option>
                                        <option value="TL">Timor-Leste</option>
                                        <option value="TG">Togo</option>
                                        <option value="TK">Tokelau</option>
                                        <option value="TO">Tonga</option>
                                        <option value="TT">Trinidad and Tobago</option>
                                        <option value="TN">Tunisia</option>
                                        <option value="TR">Turkey</option>
                                        <option value="TM">Turkmenistan</option>
                                        <option value="TC">Turks and Caicos Islands</option>
                                        <option value="TV">Tuvalu</option>
                                        <option value="UG">Uganda</option>
                                        <option value="UA">Ukraine</option>
                                        <option value="AE">United Arab Emirates</option>
                                        <option value="GB">United Kingdom (UK)</option>
                                        <option value="US">United States (US)</option>
                                        <option value="UM">United States (US) Minor Outlying Islands</option>
                                        <option value="UY">Uruguay</option>
                                        <option value="UZ">Uzbekistan</option>
                                        <option value="VU">Vanuatu</option>
                                        <option value="VA">Vatican</option>
                                        <option value="VE">Venezuela</option>
                                        <option value="VN">Vietnam</option>
                                        <option value="VG">Virgin Islands (British)</option>
                                        <option value="VI">Virgin Islands (US)</option>
                                        <option value="WF">Wallis and Futuna</option>
                                        <option value="EH">Western Sahara</option>
                                        <option value="YE">Yemen</option>
                                        <option value="ZM">Zambia</option>
                                        <option value="ZW">Zimbabwe</option>
                                    </select>
                                </div>
                                <p class="notice_country small warning text-danger" style="display:none;">Country is required</p>
                            </div>
                        </div>
                        <?php if($currencies_enabled){ ?>
                        <div class="form-group col-xs-12 col-sm-6">
                            <div class="js-form-item form-item js-form-type-select form-item-currency js-form-item-currency">
                                <label class="basic-info-box__label group-label js-form-required form-required" for="edit-currency">Display Currency *</label>
                                <div class="select-wrapper">
                                    
                                    <select id="currency" name="currency" required="required" class="select2 dropdown bootstrap-select form-select form-control dropup">
                                        <?php 
                                            foreach($currencies as $key => $currencie){
                                                ?>
                                                <option value="<?php echo $key; ?>" <?php echo ($currency == $key)? 'selected' : ''; ?>>
                                                    <?php echo $currencie['label']; ?> <?php echo $currencie['symbol']; ?>
                                                </option>
                                                <?php 
                                            }
                                        ?>
                                    </select>

                                </div>
                            </div>
                        </div>
                        <?php } ?>
                        <div class="form-group col-xs-12 <?php echo ($currencies_enabled)? 'col-sm-6' : 'col-sm-12 col-md-12'; ?>">
                            <div class="js-form-item form-item js-form-type-select form-item-timezone js-form-item-timezone">
                                <label class="basic-info-box__label group-label js-form-required form-required" for="edit-timezone">Timezone *</label>
                                <div class="select-wrapper">
                                    
                                    <select data-select-value="<?php echo $timezone; ?>" value="<?php echo $timezone; ?>" class="select2 dropdown bootstrap-select form-select required form-control dropup" id="timezone" name="timezone" required="required">
                                        <option value="">Please select</option>
                                        <optgroup label="Africa">
                                            <option value="Africa/Abidjan">(GMT+00:00) Abidjan</option>
                                            <option value="Africa/Accra">(GMT+00:00) Accra</option>
                                            <option value="Africa/Bamako">(GMT+00:00) Bamako</option>
                                            <option value="Africa/Banjul">(GMT+00:00) Banjul</option>
                                            <option value="Africa/Bissau">(GMT+00:00) Bissau</option>
                                            <option value="Africa/Conakry">(GMT+00:00) Conakry</option>
                                            <option value="Africa/Dakar">(GMT+00:00) Dakar</option>
                                            <option value="Africa/Freetown">(GMT+00:00) Freetown</option>
                                            <option value="Africa/Lome">(GMT+00:00) Lome</option>
                                            <option value="Africa/Monrovia">(GMT+00:00) Monrovia</option>
                                            <option value="Africa/Nouakchott">(GMT+00:00) Nouakchott</option>
                                            <option value="Africa/Ouagadougou">(GMT+00:00) Ouagadougou</option>
                                            <option value="Africa/Sao_Tome">(GMT+00:00) Sao Tome</option>
                                            <option value="Africa/Algiers">(GMT+01:00) Algiers</option>
                                            <option value="Africa/Bangui">(GMT+01:00) Bangui</option>
                                            <option value="Africa/Brazzaville">(GMT+01:00) Brazzaville</option>
                                            <option value="Africa/Casablanca">(GMT+01:00) Casablanca</option>
                                            <option value="Africa/Ceuta">(GMT+01:00) Ceuta</option>
                                            <option value="Africa/Douala">(GMT+01:00) Douala</option>
                                            <option value="Africa/El_Aaiun">(GMT+01:00) El Aaiun</option>
                                            <option value="Africa/Kinshasa">(GMT+01:00) Kinshasa</option>
                                            <option value="Africa/Lagos">(GMT+01:00) Lagos</option>
                                            <option value="Africa/Libreville">(GMT+01:00) Libreville</option>
                                            <option value="Africa/Luanda">(GMT+01:00) Luanda</option>
                                            <option value="Africa/Malabo">(GMT+01:00) Malabo</option>
                                            <option value="Africa/Ndjamena">(GMT+01:00) Ndjamena</option>
                                            <option value="Africa/Niamey">(GMT+01:00) Niamey</option>
                                            <option value="Africa/Porto-Novo">(GMT+01:00) Porto-Novo</option>
                                            <option value="Africa/Tunis">(GMT+01:00) Tunis</option>
                                            <option value="Africa/Blantyre">(GMT+02:00) Blantyre</option>
                                            <option value="Africa/Bujumbura">(GMT+02:00) Bujumbura</option>
                                            <option value="Africa/Cairo">(GMT+02:00) Cairo</option>
                                            <option value="Africa/Gaborone">(GMT+02:00) Gaborone</option>
                                            <option value="Africa/Harare">(GMT+02:00) Harare</option>
                                            <option value="Africa/Johannesburg">(GMT+02:00) Johannesburg</option>
                                            <option value="Africa/Juba">(GMT+02:00) Juba</option>
                                            <option value="Africa/Khartoum">(GMT+02:00) Khartoum</option>
                                            <option value="Africa/Kigali">(GMT+02:00) Kigali</option>
                                            <option value="Africa/Lubumbashi">(GMT+02:00) Lubumbashi</option>
                                            <option value="Africa/Lusaka">(GMT+02:00) Lusaka</option>
                                            <option value="Africa/Maputo">(GMT+02:00) Maputo</option>
                                            <option value="Africa/Maseru">(GMT+02:00) Maseru</option>
                                            <option value="Africa/Mbabane">(GMT+02:00) Mbabane</option>
                                            <option value="Africa/Tripoli">(GMT+02:00) Tripoli</option>
                                            <option value="Africa/Windhoek">(GMT+02:00) Windhoek</option>
                                            <option value="Africa/Addis_Ababa">(GMT+03:00) Addis Ababa</option>
                                            <option value="Africa/Asmara">(GMT+03:00) Asmara</option>
                                            <option value="Africa/Dar_es_Salaam">(GMT+03:00) Dar es Salaam</option>
                                            <option value="Africa/Djibouti">(GMT+03:00) Djibouti</option>
                                            <option value="Africa/Kampala">(GMT+03:00) Kampala</option>
                                            <option value="Africa/Mogadishu">(GMT+03:00) Mogadishu</option>
                                            <option value="Africa/Nairobi">(GMT+03:00) Nairobi</option>
                                        </optgroup>
                                        <optgroup label="America">
                                            <option value="America/Danmarkshavn">(GMT+00:00) Danmarkshavn</option>
                                            <option value="America/Scoresbysund">(GMT-01:00) Scoresbysund</option>
                                            <option value="America/Noronha">(GMT-02:00) Noronha</option>
                                            <option value="America/Araguaina">(GMT-03:00) Araguaina</option>
                                            <option value="America/Asuncion">(GMT-03:00) Asuncion</option>
                                            <option value="America/Bahia">(GMT-03:00) Bahia</option>
                                            <option value="America/Belem">(GMT-03:00) Belem</option>
                                            <option value="America/Argentina/Buenos_Aires">(GMT-03:00) Buenos Aires (Argentina)</option>
                                            <option value="America/Argentina/Catamarca">(GMT-03:00) Catamarca (Argentina)</option>
                                            <option value="America/Cayenne">(GMT-03:00) Cayenne</option>
                                            <option value="America/Argentina/Cordoba">(GMT-03:00) Cordoba (Argentina)</option>
                                            <option value="America/Fortaleza">(GMT-03:00) Fortaleza</option>
                                            <option value="America/Argentina/Jujuy">(GMT-03:00) Jujuy (Argentina)</option>
                                            <option value="America/Argentina/La_Rioja">(GMT-03:00) La Rioja (Argentina)</option>
                                            <option value="America/Maceio">(GMT-03:00) Maceio</option>
                                            <option value="America/Argentina/Mendoza">(GMT-03:00) Mendoza (Argentina)</option>
                                            <option value="America/Miquelon">(GMT-03:00) Miquelon</option>
                                            <option value="America/Montevideo">(GMT-03:00) Montevideo</option>
                                            <option value="America/Nuuk">(GMT-03:00) Nuuk</option>
                                            <option value="America/Paramaribo">(GMT-03:00) Paramaribo</option>
                                            <option value="America/Punta_Arenas">(GMT-03:00) Punta Arenas</option>
                                            <option value="America/Recife">(GMT-03:00) Recife</option>
                                            <option value="America/Argentina/Rio_Gallegos">(GMT-03:00) Rio Gallegos (Argentina)</option>
                                            <option value="America/Argentina/Salta">(GMT-03:00) Salta (Argentina)</option>
                                            <option value="America/Argentina/San_Juan">(GMT-03:00) San Juan (Argentina)</option>
                                            <option value="America/Argentina/San_Luis">(GMT-03:00) San Luis (Argentina)</option>
                                            <option value="America/Santarem">(GMT-03:00) Santarem</option>
                                            <option value="America/Santiago">(GMT-03:00) Santiago</option>
                                            <option value="America/Sao_Paulo">(GMT-03:00) Sao Paulo</option>
                                            <option value="America/Argentina/Tucuman">(GMT-03:00) Tucuman (Argentina)</option>
                                            <option value="America/Argentina/Ushuaia">(GMT-03:00) Ushuaia (Argentina)</option>
                                            <option value="America/St_Johns">(GMT-03:30) St Johns</option>
                                            <option value="America/Anguilla">(GMT-04:00) Anguilla</option>
                                            <option value="America/Antigua">(GMT-04:00) Antigua</option>
                                            <option value="America/Aruba">(GMT-04:00) Aruba</option>
                                            <option value="America/Barbados">(GMT-04:00) Barbados</option>
                                            <option value="America/Blanc-Sablon">(GMT-04:00) Blanc-Sablon</option>
                                            <option value="America/Boa_Vista">(GMT-04:00) Boa Vista</option>
                                            <option value="America/Campo_Grande">(GMT-04:00) Campo Grande</option>
                                            <option value="America/Caracas">(GMT-04:00) Caracas</option>
                                            <option value="America/Cuiaba">(GMT-04:00) Cuiaba</option>
                                            <option value="America/Curacao">(GMT-04:00) Curacao</option>
                                            <option value="America/Dominica">(GMT-04:00) Dominica</option>
                                            <option value="America/Glace_Bay">(GMT-04:00) Glace Bay</option>
                                            <option value="America/Goose_Bay">(GMT-04:00) Goose Bay</option>
                                            <option value="America/Grenada">(GMT-04:00) Grenada</option>
                                            <option value="America/Guadeloupe">(GMT-04:00) Guadeloupe</option>
                                            <option value="America/Guyana">(GMT-04:00) Guyana</option>
                                            <option value="America/Halifax">(GMT-04:00) Halifax</option>
                                            <option value="America/Kralendijk">(GMT-04:00) Kralendijk</option>
                                            <option value="America/La_Paz">(GMT-04:00) La Paz</option>
                                            <option value="America/Lower_Princes">(GMT-04:00) Lower Princes</option>
                                            <option value="America/Manaus">(GMT-04:00) Manaus</option>
                                            <option value="America/Marigot">(GMT-04:00) Marigot</option>
                                            <option value="America/Martinique">(GMT-04:00) Martinique</option>
                                            <option value="America/Moncton">(GMT-04:00) Moncton</option>
                                            <option value="America/Montserrat">(GMT-04:00) Montserrat</option>
                                            <option value="America/Port_of_Spain">(GMT-04:00) Port of Spain</option>
                                            <option value="America/Porto_Velho">(GMT-04:00) Porto Velho</option>
                                            <option value="America/Puerto_Rico">(GMT-04:00) Puerto Rico</option>
                                            <option value="America/Santo_Domingo">(GMT-04:00) Santo Domingo</option>
                                            <option value="America/St_Barthelemy">(GMT-04:00) St Barthelemy</option>
                                            <option value="America/St_Kitts">(GMT-04:00) St Kitts</option>
                                            <option value="America/St_Lucia">(GMT-04:00) St Lucia</option>
                                            <option value="America/St_Thomas">(GMT-04:00) St Thomas</option>
                                            <option value="America/St_Vincent">(GMT-04:00) St Vincent</option>
                                            <option value="America/Thule">(GMT-04:00) Thule</option>
                                            <option value="America/Tortola">(GMT-04:00) Tortola</option>
                                            <option value="America/Atikokan">(GMT-05:00) Atikokan</option>
                                            <option value="America/Bogota">(GMT-05:00) Bogota</option>
                                            <option value="America/Cancun">(GMT-05:00) Cancun</option>
                                            <option value="America/Cayman">(GMT-05:00) Cayman</option>
                                            <option value="America/Detroit">(GMT-05:00) Detroit</option>
                                            <option value="America/Eirunepe">(GMT-05:00) Eirunepe</option>
                                            <option value="America/Grand_Turk">(GMT-05:00) Grand Turk</option>
                                            <option value="America/Guayaquil">(GMT-05:00) Guayaquil</option>
                                            <option value="America/Havana">(GMT-05:00) Havana</option>
                                            <option value="America/Indiana/Indianapolis">(GMT-05:00) Indianapolis (Indiana)</option>
                                            <option value="America/Iqaluit">(GMT-05:00) Iqaluit</option>
                                            <option value="America/Jamaica">(GMT-05:00) Jamaica</option>
                                            <option value="America/Lima">(GMT-05:00) Lima</option>
                                            <option value="America/Kentucky/Louisville">(GMT-05:00) Louisville (Kentucky)</option>
                                            <option value="America/Indiana/Marengo">(GMT-05:00) Marengo (Indiana)</option>
                                            <option value="America/Kentucky/Monticello">(GMT-05:00) Monticello (Kentucky)</option>
                                            <option value="America/Nassau">(GMT-05:00) Nassau</option>
                                            <option value="America/New_York">(GMT-05:00) New York</option>
                                            <option value="America/Nipigon">(GMT-05:00) Nipigon</option>
                                            <option value="America/Panama">(GMT-05:00) Panama</option>
                                            <option value="America/Pangnirtung">(GMT-05:00) Pangnirtung</option>
                                            <option value="America/Indiana/Petersburg">(GMT-05:00) Petersburg (Indiana)</option>
                                            <option value="America/Port-au-Prince">(GMT-05:00) Port-au-Prince</option>
                                            <option value="America/Rio_Branco">(GMT-05:00) Rio Branco</option>
                                            <option value="America/Thunder_Bay">(GMT-05:00) Thunder Bay</option>
                                            <option value="America/Toronto">(GMT-05:00) Toronto</option>
                                            <option value="America/Indiana/Vevay">(GMT-05:00) Vevay (Indiana)</option>
                                            <option value="America/Indiana/Vincennes">(GMT-05:00) Vincennes (Indiana)</option>
                                            <option value="America/Indiana/Winamac">(GMT-05:00) Winamac (Indiana)</option>
                                            <option value="America/Bahia_Banderas">(GMT-06:00) Bahia Banderas</option>
                                            <option value="America/Belize">(GMT-06:00) Belize</option>
                                            <option value="America/North_Dakota/Beulah">(GMT-06:00) Beulah (North Dakota)</option>
                                            <option value="America/North_Dakota/Center">(GMT-06:00) Center (North Dakota)</option>
                                            <option value="America/Chicago">(GMT-06:00) Chicago</option>
                                            <option value="America/Costa_Rica">(GMT-06:00) Costa Rica</option>
                                            <option value="America/El_Salvador">(GMT-06:00) El Salvador</option>
                                            <option value="America/Guatemala">(GMT-06:00) Guatemala</option>
                                            <option value="America/Indiana/Knox">(GMT-06:00) Knox (Indiana)</option>
                                            <option value="America/Managua">(GMT-06:00) Managua</option>
                                            <option value="America/Matamoros">(GMT-06:00) Matamoros</option>
                                            <option value="America/Menominee">(GMT-06:00) Menominee</option>
                                            <option value="America/Merida">(GMT-06:00) Merida</option>
                                            <option value="America/Mexico_City">(GMT-06:00) Mexico City</option>
                                            <option value="America/Monterrey">(GMT-06:00) Monterrey</option>
                                            <option value="America/North_Dakota/New_Salem">(GMT-06:00) New Salem (North Dakota)</option>
                                            <option value="America/Rainy_River">(GMT-06:00) Rainy River</option>
                                            <option value="America/Rankin_Inlet">(GMT-06:00) Rankin Inlet</option>
                                            <option value="America/Regina">(GMT-06:00) Regina</option>
                                            <option value="America/Resolute">(GMT-06:00) Resolute</option>
                                            <option value="America/Swift_Current">(GMT-06:00) Swift Current</option>
                                            <option value="America/Tegucigalpa">(GMT-06:00) Tegucigalpa</option>
                                            <option value="America/Indiana/Tell_City">(GMT-06:00) Tell City (Indiana)</option>
                                            <option value="America/Winnipeg">(GMT-06:00) Winnipeg</option>
                                            <option value="America/Boise">(GMT-07:00) Boise</option>
                                            <option value="America/Cambridge_Bay">(GMT-07:00) Cambridge Bay</option>
                                            <option value="America/Chihuahua">(GMT-07:00) Chihuahua</option>
                                            <option value="America/Creston">(GMT-07:00) Creston</option>
                                            <option value="America/Dawson">(GMT-07:00) Dawson</option>
                                            <option value="America/Dawson_Creek">(GMT-07:00) Dawson Creek</option>
                                            <option value="America/Denver">(GMT-07:00) Denver</option>
                                            <option value="America/Edmonton">(GMT-07:00) Edmonton</option>
                                            <option value="America/Fort_Nelson">(GMT-07:00) Fort Nelson</option>
                                            <option value="America/Hermosillo">(GMT-07:00) Hermosillo</option>
                                            <option value="America/Inuvik">(GMT-07:00) Inuvik</option>
                                            <option value="America/Mazatlan">(GMT-07:00) Mazatlan</option>
                                            <option value="America/Ojinaga">(GMT-07:00) Ojinaga</option>
                                            <option value="America/Phoenix">(GMT-07:00) Phoenix</option>
                                            <option value="America/Whitehorse">(GMT-07:00) Whitehorse</option>
                                            <option value="America/Yellowknife">(GMT-07:00) Yellowknife</option>
                                            <option value="America/Los_Angeles">(GMT-08:00) Los Angeles</option>
                                            <option value="America/Tijuana">(GMT-08:00) Tijuana</option>
                                            <option value="America/Vancouver">(GMT-08:00) Vancouver</option>
                                            <option value="America/Anchorage">(GMT-09:00) Anchorage</option>
                                            <option value="America/Juneau">(GMT-09:00) Juneau</option>
                                            <option value="America/Metlakatla">(GMT-09:00) Metlakatla</option>
                                            <option value="America/Nome">(GMT-09:00) Nome</option>
                                            <option value="America/Sitka">(GMT-09:00) Sitka</option>
                                            <option value="America/Yakutat">(GMT-09:00) Yakutat</option>
                                            <option value="America/Adak">(GMT-10:00) Adak</option>
                                        </optgroup>
                                        <optgroup label="Antarctica">
                                            <option value="Antarctica/Troll">(GMT+00:00) Troll</option>
                                            <option value="Antarctica/Syowa">(GMT+03:00) Syowa</option>
                                            <option value="Antarctica/Mawson">(GMT+05:00) Mawson</option>
                                            <option value="Antarctica/Vostok">(GMT+06:00) Vostok</option>
                                            <option value="Antarctica/Davis">(GMT+07:00) Davis</option>
                                            <option value="Antarctica/DumontDUrville">(GMT+10:00) DumontDUrville</option>
                                            <option value="Antarctica/Casey">(GMT+11:00) Casey</option>
                                            <option value="Antarctica/Macquarie">(GMT+11:00) Macquarie</option>
                                            <option value="Antarctica/McMurdo">(GMT+13:00) McMurdo</option>
                                            <option value="Antarctica/Palmer">(GMT-03:00) Palmer</option>
                                            <option value="Antarctica/Rothera">(GMT-03:00) Rothera</option>
                                        </optgroup>
                                        <optgroup label="Arctic">
                                            <option value="Arctic/Longyearbyen">(GMT+01:00) Longyearbyen</option>
                                        </optgroup>
                                        <optgroup label="Asia">
                                            <option value="Asia/Amman">(GMT+02:00) Amman</option>
                                            <option value="Asia/Beirut">(GMT+02:00) Beirut</option>
                                            <option value="Asia/Damascus">(GMT+02:00) Damascus</option>
                                            <option value="Asia/Famagusta">(GMT+02:00) Famagusta</option>
                                            <option value="Asia/Gaza">(GMT+02:00) Gaza</option>
                                            <option value="Asia/Hebron">(GMT+02:00) Hebron</option>
                                            <option value="Asia/Jerusalem">(GMT+02:00) Jerusalem</option>
                                            <option value="Asia/Nicosia">(GMT+02:00) Nicosia</option>
                                            <option value="Asia/Aden">(GMT+03:00) Aden</option>
                                            <option value="Asia/Baghdad">(GMT+03:00) Baghdad</option>
                                            <option value="Asia/Bahrain">(GMT+03:00) Bahrain</option>
                                            <option value="Asia/Kuwait">(GMT+03:00) Kuwait</option>
                                            <option value="Asia/Qatar">(GMT+03:00) Qatar</option>
                                            <option value="Asia/Riyadh">(GMT+03:00) Riyadh</option>
                                            <option value="Asia/Tehran">(GMT+03:30) Tehran</option>
                                            <option value="Asia/Baku">(GMT+04:00) Baku</option>
                                            <option value="Asia/Dubai">(GMT+04:00) Dubai</option>
                                            <option value="Asia/Muscat">(GMT+04:00) Muscat</option>
                                            <option value="Asia/Tbilisi">(GMT+04:00) Tbilisi</option>
                                            <option value="Asia/Yerevan">(GMT+04:00) Yerevan</option>
                                            <option value="Asia/Kabul">(GMT+04:30) Kabul</option>
                                            <option value="Asia/Aqtau">(GMT+05:00) Aqtau</option>
                                            <option value="Asia/Aqtobe">(GMT+05:00) Aqtobe</option>
                                            <option value="Asia/Ashgabat">(GMT+05:00) Ashgabat</option>
                                            <option value="Asia/Atyrau">(GMT+05:00) Atyrau</option>
                                            <option value="Asia/Dushanbe">(GMT+05:00) Dushanbe</option>
                                            <option value="Asia/Karachi">(GMT+05:00) Karachi</option>
                                            <option value="Asia/Oral">(GMT+05:00) Oral</option>
                                            <option value="Asia/Qyzylorda">(GMT+05:00) Qyzylorda</option>
                                            <option value="Asia/Samarkand">(GMT+05:00) Samarkand</option>
                                            <option value="Asia/Tashkent">(GMT+05:00) Tashkent</option>
                                            <option value="Asia/Yekaterinburg">(GMT+05:00) Yekaterinburg</option>
                                            <option value="Asia/Colombo">(GMT+05:30) Colombo</option>
                                            <option value="Asia/Kolkata">(GMT+05:30) Kolkata</option>
                                            <option value="Asia/Kathmandu">(GMT+05:45) Kathmandu</option>
                                            <option value="Asia/Almaty">(GMT+06:00) Almaty</option>
                                            <option value="Asia/Bishkek">(GMT+06:00) Bishkek</option>
                                            <option value="Asia/Dhaka">(GMT+06:00) Dhaka</option>
                                            <option value="Asia/Omsk">(GMT+06:00) Omsk</option>
                                            <option value="Asia/Qostanay">(GMT+06:00) Qostanay</option>
                                            <option value="Asia/Thimphu">(GMT+06:00) Thimphu</option>
                                            <option value="Asia/Urumqi">(GMT+06:00) Urumqi</option>
                                            <option value="Asia/Yangon">(GMT+06:30) Yangon</option>
                                            <option value="Asia/Bangkok">(GMT+07:00) Bangkok</option>
                                            <option value="Asia/Barnaul">(GMT+07:00) Barnaul</option>
                                            <option value="Asia/Ho_Chi_Minh">(GMT+07:00) Ho Chi Minh</option>
                                            <option value="Asia/Hovd">(GMT+07:00) Hovd</option>
                                            <option value="Asia/Jakarta">(GMT+07:00) Jakarta</option>
                                            <option value="Asia/Krasnoyarsk">(GMT+07:00) Krasnoyarsk</option>
                                            <option value="Asia/Novokuznetsk">(GMT+07:00) Novokuznetsk</option>
                                            <option value="Asia/Novosibirsk">(GMT+07:00) Novosibirsk</option>
                                            <option value="Asia/Phnom_Penh">(GMT+07:00) Phnom Penh</option>
                                            <option value="Asia/Pontianak">(GMT+07:00) Pontianak</option>
                                            <option value="Asia/Tomsk">(GMT+07:00) Tomsk</option>
                                            <option value="Asia/Vientiane">(GMT+07:00) Vientiane</option>
                                            <option value="Asia/Brunei">(GMT+08:00) Brunei</option>
                                            <option value="Asia/Choibalsan">(GMT+08:00) Choibalsan</option>
                                            <option value="Asia/Hong_Kong">(GMT+08:00) Hong Kong</option>
                                            <option value="Asia/Irkutsk">(GMT+08:00) Irkutsk</option>
                                            <option value="Asia/Kuala_Lumpur">(GMT+08:00) Kuala Lumpur</option>
                                            <option value="Asia/Kuching">(GMT+08:00) Kuching</option>
                                            <option value="Asia/Macau">(GMT+08:00) Macau</option>
                                            <option value="Asia/Makassar">(GMT+08:00) Makassar</option>
                                            <option value="Asia/Manila">(GMT+08:00) Manila</option>
                                            <option value="Asia/Shanghai">(GMT+08:00) Shanghai</option>
                                            <option value="Asia/Singapore">(GMT+08:00) Singapore</option>
                                            <option value="Asia/Taipei">(GMT+08:00) Taipei</option>
                                            <option value="Asia/Ulaanbaatar">(GMT+08:00) Ulaanbaatar</option>
                                            <option value="Asia/Chita">(GMT+09:00) Chita</option>
                                            <option value="Asia/Dili">(GMT+09:00) Dili</option>
                                            <option value="Asia/Jayapura">(GMT+09:00) Jayapura</option>
                                            <option value="Asia/Khandyga">(GMT+09:00) Khandyga</option>
                                            <option value="Asia/Pyongyang">(GMT+09:00) Pyongyang</option>
                                            <option value="Asia/Seoul">(GMT+09:00) Seoul</option>
                                            <option value="Asia/Tokyo">(GMT+09:00) Tokyo</option>
                                            <option value="Asia/Yakutsk">(GMT+09:00) Yakutsk</option>
                                            <option value="Asia/Ust-Nera">(GMT+10:00) Ust-Nera</option>
                                            <option value="Asia/Vladivostok">(GMT+10:00) Vladivostok</option>
                                            <option value="Asia/Magadan">(GMT+11:00) Magadan</option>
                                            <option value="Asia/Sakhalin">(GMT+11:00) Sakhalin</option>
                                            <option value="Asia/Srednekolymsk">(GMT+11:00) Srednekolymsk</option>
                                            <option value="Asia/Anadyr">(GMT+12:00) Anadyr</option>
                                            <option value="Asia/Kamchatka">(GMT+12:00) Kamchatka</option>
                                        </optgroup>
                                        <optgroup label="Atlantic">
                                            <option value="Atlantic/Canary">(GMT+00:00) Canary</option>
                                            <option value="Atlantic/Faroe">(GMT+00:00) Faroe</option>
                                            <option value="Atlantic/Madeira">(GMT+00:00) Madeira</option>
                                            <option value="Atlantic/Reykjavik">(GMT+00:00) Reykjavik</option>
                                            <option value="Atlantic/St_Helena">(GMT+00:00) St Helena</option>
                                            <option value="Atlantic/Azores">(GMT-01:00) Azores</option>
                                            <option value="Atlantic/Cape_Verde">(GMT-01:00) Cape Verde</option>
                                            <option value="Atlantic/South_Georgia">(GMT-02:00) South Georgia</option>
                                            <option value="Atlantic/Stanley">(GMT-03:00) Stanley</option>
                                            <option value="Atlantic/Bermuda">(GMT-04:00) Bermuda</option>
                                        </optgroup>
                                        <optgroup label="Australia">
                                            <option value="Australia/Perth">(GMT+08:00) Perth</option>
                                            <option value="Australia/Eucla">(GMT+08:45) Eucla</option>
                                            <option value="Australia/Darwin">(GMT+09:30) Darwin</option>
                                            <option value="Australia/Brisbane">(GMT+10:00) Brisbane</option>
                                            <option value="Australia/Lindeman">(GMT+10:00) Lindeman</option>
                                            <option value="Australia/Adelaide">(GMT+10:30) Adelaide</option>
                                            <option value="Australia/Broken_Hill">(GMT+10:30) Broken Hill</option>
                                            <option value="Australia/Hobart">(GMT+11:00) Hobart</option>
                                            <option value="Australia/Lord_Howe">(GMT+11:00) Lord Howe</option>
                                            <option value="Australia/Melbourne">(GMT+11:00) Melbourne</option>
                                            <option value="Australia/Sydney">(GMT+11:00) Sydney</option>
                                        </optgroup>
                                        <optgroup label="Europe">
                                            <option value="Europe/Dublin">(GMT+00:00) Dublin</option>
                                            <option value="Europe/Guernsey">(GMT+00:00) Guernsey</option>
                                            <option value="Europe/Isle_of_Man">(GMT+00:00) Isle of Man</option>
                                            <option value="Europe/Jersey">(GMT+00:00) Jersey</option>
                                            <option value="Europe/Lisbon">(GMT+00:00) Lisbon</option>
                                            <option value="Europe/London">(GMT+00:00) London</option>
                                            <option value="Europe/Amsterdam">(GMT+01:00) Amsterdam</option>
                                            <option value="Europe/Andorra">(GMT+01:00) Andorra</option>
                                            <option value="Europe/Belgrade">(GMT+01:00) Belgrade</option>
                                            <option value="Europe/Berlin">(GMT+01:00) Berlin</option>
                                            <option value="Europe/Bratislava">(GMT+01:00) Bratislava</option>
                                            <option value="Europe/Brussels">(GMT+01:00) Brussels</option>
                                            <option value="Europe/Budapest">(GMT+01:00) Budapest</option>
                                            <option value="Europe/Busingen">(GMT+01:00) Busingen</option>
                                            <option value="Europe/Copenhagen">(GMT+01:00) Copenhagen</option>
                                            <option value="Europe/Gibraltar">(GMT+01:00) Gibraltar</option>
                                            <option value="Europe/Ljubljana">(GMT+01:00) Ljubljana</option>
                                            <option value="Europe/Luxembourg">(GMT+01:00) Luxembourg</option>
                                            <option value="Europe/Madrid">(GMT+01:00) Madrid</option>
                                            <option value="Europe/Malta">(GMT+01:00) Malta</option>
                                            <option value="Europe/Monaco">(GMT+01:00) Monaco</option>
                                            <option value="Europe/Oslo">(GMT+01:00) Oslo</option>
                                            <option value="Europe/Paris">(GMT+01:00) Paris</option>
                                            <option value="Europe/Podgorica">(GMT+01:00) Podgorica</option>
                                            <option value="Europe/Prague">(GMT+01:00) Prague</option>
                                            <option value="Europe/Rome">(GMT+01:00) Rome</option>
                                            <option value="Europe/San_Marino">(GMT+01:00) San Marino</option>
                                            <option value="Europe/Sarajevo">(GMT+01:00) Sarajevo</option>
                                            <option value="Europe/Skopje">(GMT+01:00) Skopje</option>
                                            <option value="Europe/Stockholm">(GMT+01:00) Stockholm</option>
                                            <option value="Europe/Tirane">(GMT+01:00) Tirane</option>
                                            <option value="Europe/Vaduz">(GMT+01:00) Vaduz</option>
                                            <option value="Europe/Vatican">(GMT+01:00) Vatican</option>
                                            <option value="Europe/Vienna">(GMT+01:00) Vienna</option>
                                            <option value="Europe/Warsaw">(GMT+01:00) Warsaw</option>
                                            <option value="Europe/Zagreb">(GMT+01:00) Zagreb</option>
                                            <option value="Europe/Zurich">(GMT+01:00) Zurich</option>
                                            <option value="Europe/Athens">(GMT+02:00) Athens</option>
                                            <option value="Europe/Bucharest">(GMT+02:00) Bucharest</option>
                                            <option value="Europe/Chisinau">(GMT+02:00) Chisinau</option>
                                            <option value="Europe/Helsinki">(GMT+02:00) Helsinki</option>
                                            <option value="Europe/Kaliningrad">(GMT+02:00) Kaliningrad</option>
                                            <option value="Europe/Kiev">(GMT+02:00) Kiev</option>
                                            <option value="Europe/Mariehamn">(GMT+02:00) Mariehamn</option>
                                            <option value="Europe/Riga">(GMT+02:00) Riga</option>
                                            <option value="Europe/Sofia">(GMT+02:00) Sofia</option>
                                            <option value="Europe/Tallinn">(GMT+02:00) Tallinn</option>
                                            <option value="Europe/Uzhgorod">(GMT+02:00) Uzhgorod</option>
                                            <option value="Europe/Vilnius">(GMT+02:00) Vilnius</option>
                                            <option value="Europe/Zaporozhye">(GMT+02:00) Zaporozhye</option>
                                            <option value="Europe/Istanbul">(GMT+03:00) Istanbul</option>
                                            <option value="Europe/Kirov">(GMT+03:00) Kirov</option>
                                            <option value="Europe/Minsk">(GMT+03:00) Minsk</option>
                                            <option value="Europe/Moscow">(GMT+03:00) Moscow</option>
                                            <option value="Europe/Simferopol">(GMT+03:00) Simferopol</option>
                                            <option value="Europe/Volgograd">(GMT+03:00) Volgograd</option>
                                            <option value="Europe/Astrakhan">(GMT+04:00) Astrakhan</option>
                                            <option value="Europe/Samara">(GMT+04:00) Samara</option>
                                            <option value="Europe/Saratov">(GMT+04:00) Saratov</option>
                                            <option value="Europe/Ulyanovsk">(GMT+04:00) Ulyanovsk</option>
                                        </optgroup>
                                        <optgroup label="Indian">
                                            <option value="Indian/Antananarivo">(GMT+03:00) Antananarivo</option>
                                            <option value="Indian/Comoro">(GMT+03:00) Comoro</option>
                                            <option value="Indian/Mayotte">(GMT+03:00) Mayotte</option>
                                            <option value="Indian/Mahe">(GMT+04:00) Mahe</option>
                                            <option value="Indian/Mauritius">(GMT+04:00) Mauritius</option>
                                            <option value="Indian/Reunion">(GMT+04:00) Reunion</option>
                                            <option value="Indian/Kerguelen">(GMT+05:00) Kerguelen</option>
                                            <option value="Indian/Maldives">(GMT+05:00) Maldives</option>
                                            <option value="Indian/Chagos">(GMT+06:00) Chagos</option>
                                            <option value="Indian/Cocos">(GMT+06:30) Cocos</option>
                                            <option value="Indian/Christmas">(GMT+07:00) Christmas</option>
                                        </optgroup>
                                        <optgroup label="Pacific">
                                            <option value="Pacific/Palau">(GMT+09:00) Palau</option>
                                            <option value="Pacific/Chuuk">(GMT+10:00) Chuuk</option>
                                            <option value="Pacific/Guam">(GMT+10:00) Guam</option>
                                            <option value="Pacific/Port_Moresby">(GMT+10:00) Port Moresby</option>
                                            <option value="Pacific/Saipan">(GMT+10:00) Saipan</option>
                                            <option value="Pacific/Bougainville">(GMT+11:00) Bougainville</option>
                                            <option value="Pacific/Efate">(GMT+11:00) Efate</option>
                                            <option value="Pacific/Guadalcanal">(GMT+11:00) Guadalcanal</option>
                                            <option value="Pacific/Kosrae">(GMT+11:00) Kosrae</option>
                                            <option value="Pacific/Noumea">(GMT+11:00) Noumea</option>
                                            <option value="Pacific/Pohnpei">(GMT+11:00) Pohnpei</option>
                                            <option value="Pacific/Funafuti">(GMT+12:00) Funafuti</option>
                                            <option value="Pacific/Kwajalein">(GMT+12:00) Kwajalein</option>
                                            <option value="Pacific/Majuro">(GMT+12:00) Majuro</option>
                                            <option value="Pacific/Nauru">(GMT+12:00) Nauru</option>
                                            <option value="Pacific/Norfolk">(GMT+12:00) Norfolk</option>
                                            <option value="Pacific/Tarawa">(GMT+12:00) Tarawa</option>
                                            <option value="Pacific/Wake">(GMT+12:00) Wake</option>
                                            <option value="Pacific/Wallis">(GMT+12:00) Wallis</option>
                                            <option value="Pacific/Auckland">(GMT+13:00) Auckland</option>
                                            <option value="Pacific/Enderbury">(GMT+13:00) Enderbury</option>
                                            <option value="Pacific/Fakaofo">(GMT+13:00) Fakaofo</option>
                                            <option value="Pacific/Fiji">(GMT+13:00) Fiji</option>
                                            <option value="Pacific/Tongatapu">(GMT+13:00) Tongatapu</option>
                                            <option value="Pacific/Chatham">(GMT+13:45) Chatham</option>
                                            <option value="Pacific/Apia">(GMT+14:00) Apia</option>
                                            <option value="Pacific/Kiritimati">(GMT+14:00) Kiritimati</option>
                                            <option value="Pacific/Easter">(GMT-05:00) Easter</option>
                                            <option value="Pacific/Galapagos">(GMT-06:00) Galapagos</option>
                                            <option value="Pacific/Pitcairn">(GMT-08:00) Pitcairn</option>
                                            <option value="Pacific/Gambier">(GMT-09:00) Gambier</option>
                                            <option value="Pacific/Marquesas">(GMT-09:30) Marquesas</option>
                                            <option value="Pacific/Honolulu">(GMT-10:00) Honolulu</option>
                                            <option value="Pacific/Rarotonga">(GMT-10:00) Rarotonga</option>
                                            <option value="Pacific/Tahiti">(GMT-10:00) Tahiti</option>
                                            <option value="Pacific/Midway">(GMT-11:00) Midway</option>
                                            <option value="Pacific/Niue">(GMT-11:00) Niue</option>
                                            <option value="Pacific/Pago_Pago">(GMT-11:00) Pago Pago</option>
                                        </optgroup>
                                        <option value="UTC">(GMT+00:00) UTC</option>
                                    </select>

                                
                                </div>
                            </div>
                        </div>
                        <div class="user-confirm clearfix">
                            <p class="user-confirm__text">I confirm that I accept the site’s 
                                <a data-toggle="modal" data-target="#modal-term" href="javascript:;">Terms</a> 
                                and 
                                <a data-toggle="modal" data-target="#modal-privacy" href="javascript:;">Privacy</a> 
                                agreements and allow my data to be held for as long as I am registered with this Website *
                            </p>
                            <label class="iot-ra-cbx"> 
                                <input type="radio" name="confirm_age" class="virtual-value" data-input-name="confirm_age" value="yes" required="" checked="checked" /> 
                                <span class="checkmark"></span> 
                                <span class="cb-label">Yes</span> 
                            </label> 
                            <label class="iot-ra-cbx"> 
                                <input type="radio" name="confirm_age" class="virtual-value" data-input-name="confirm_age" value="no" required=""> 
                                <span class="checkmark"></span> 
                                <span class="cb-label">No</span> 
                            </label>
                        </div>
                    </div>
                </div>
            </div>






            <div class="step-footer-wp">
                <div class="step-footer clearfix">
                    <div class="container">
                        <div class="more-info"> We will personalise your feed and <br> recommendation based on this info.</div>
                        <button type="submit" class="bt-next step-footer__btn -next button js-form-submit form-submit btn-default btn" type="submit" id="edit-submit" name="op" value="Next">
                            Next
                        </button>
                        <button type="button" class="bt-prev step-footer__btn -prev" data-action="ielts-lms-my-account-step-1-load">Previous</a>
                        
                    </div>
                </div>
            </div>
        </form>
        <?php return ob_get_clean();
    }

    public function my_account_step1_load(){
        wp_send_json([
            "success"   => true,
            "res"       => "step 1 loaded successfully",
            "has_html"  => true,
            "html"      => $this->my_account_step1()   
        ]);
    }

    public function submit_step2(){
        if(isset($_POST['data'])){
            $user_id = get_current_user_id();
            $data = (array) $_POST['data'];
    
            if( count($data) > 0 ) {
                foreach($data as $key => $value ) {
                    update_user_meta($user_id, $key, $value );
                }
    
                wp_send_json([
                    "success"   => true,
                    "res"       => "step 1 saved successfully",
                    "has_html"  => true,
                    "html"      => $this->my_account_step3()   
                ]);
            } else {
                wp_send_json([
                    "success"   => false,
                    "res"       => "Missing user data"   
                ]);
            }
        } else {
            wp_send_json([
                "success"   => false,
                "res"       => "Missing user data"   
            ]);
        }
    }

    public function my_account_step3(){
        $current_user_id        = get_current_user_id();
        $current_user           = wp_get_current_user();
        

        

        $my_reason_for_practicing_ielts = get_user_meta($current_user_id, 'ielts_lms_step-my-reason-for-practicing-ielts', true);
        $how_about_an_ielts_score       = get_user_meta($current_user_id, 'ielts_lms_step-how-about-an-ielts-score', true);

        $previous_score                 = get_user_meta($current_user_id, 'ielts_lms_step-previous-score', true);
        $target_score                   = get_user_meta($current_user_id, 'ielts_lms_step-target-score', true);
        $exam_preparation_time          = get_user_meta($current_user_id, 'ielts_lms_step-exam-preparation-time', true);
        
        if($my_reason_for_practicing_ielts == ""){
            $my_reason_for_practicing_ielts = "study-abroad";
        }


        if($how_about_an_ielts_score == ""){
            $how_about_an_ielts_score = "i-dont-have-an-ielts-score";
        }



        ob_start(); ?>
        <form class="profile-question-form " method="post" id="profile-form-step-3" accept-charset="UTF-8">

            <!--steps::begin-->
            <div class="step-progress clearfix">
                <span class="active step-1 completed">1</span>
                <ul class="dots f-step">
                    <li class="active completed"></li>
                    <li class="active completed"></li>
                    <li class="active"></li>
                    <li class="active"></li>
                </ul>
                <span class="active step-2 completed">2</span>
                <ul class="dots s-step">
                    <li class="active completed"></li>
                    <li class="active completed"></li>
                    <li class="active"></li>
                    <li class="active"></li>
                </ul>
                <span class="step-3 active">3</span>
            </div>
            <!--steps::end-->




            <div class="reason-box-wrap clearfix">
                <div class="reason-box clearfix">
                    <h2 class="clearfix">My reason for practicing IELTS</h2>
                    <div role="tabpanel" class="my-reason-content">

                        <ul class="nav reason-box__reason-tabs hidden-xs" role="tablist">
                            <li role="presentation" class="reason-box__tab-item <?php echo ($my_reason_for_practicing_ielts == "study-abroad")? 'active' : ''; ?>">
                                <a href="#study-abroad" data-toggle="tab2" data-common="">
                                    <div class="reason-box__tab-title">Study abroad</div>
                                    <span class="checked-icon"></span> 
                                </a>
                            </li>
                            <li role="presentation" class="reason-box__tab-item  <?php echo ($my_reason_for_practicing_ielts == "immigration")? 'active' : ''; ?>">
                                <a href="#immigration" data-toggle="tab2">
                                    <div class="reason-box__tab-title">Immigration</div>
                                    <span class="checked-icon"></span> 
                                </a>
                            </li>
                            <li role="presentation" class="reason-box__tab-item  <?php echo ($my_reason_for_practicing_ielts == "job-requirements")? 'active' : ''; ?>">
                                <a href="#job-requirements" data-toggle="tab2">
                                    <div class="reason-box__tab-title">Job requirements</div>
                                    <span class="checked-icon"></span> 
                                </a>
                            </li>
                            <li role="presentation" class="reason-box__tab-item  <?php echo ($my_reason_for_practicing_ielts == "other")? 'active' : ''; ?>">
                                <a href="#other" data-toggle="tab2">
                                    <div class="reason-box__tab-title">Other</div>
                                    <span class="checked-icon"></span> 
                                </a>
                            </li>
                        </ul>

                        <div class="tab-content" id="my-reasons">

                            <div role="tabpanel" data-value="study-abroad" class="xs-tab3 tab-pane visible-xs <?php echo ($my_reason_for_practicing_ielts == "study-abroad")? 'active' : ''; ?>" id="study-abroad">
                                <span class="checked-icon"></span>
                                <div class="reason-box__tab-body unique clearfix">
                                    <h3 class="reason-box__panel-title panel-title" data-panel="false"> 
                                        <a class="reason-box__tab-mb-title" href="#study-abroad" data-toggle="tab3">
                                            Study abroad
                                        </a>
                                    </h3>
                                </div>
                            </div>

                            <div role="tabpanel" data-value="immigration" class="xs-tab3 tab-pane visible-xs <?php echo ($my_reason_for_practicing_ielts == "immigration")? 'active' : ''; ?>" id="immigration">
                                <span class="checked-icon"></span>
                                <div class="reason-box__tab-body unique clearfix">
                                    <h3 class="reason-box__panel-title panel-title" data-panel="false"> 
                                        <a class="reason-box__tab-mb-title" href="#immigration" data-toggle="tab3">
                                            Immigration
                                        </a>
                                    </h3>
                                </div>
                            </div>

                            <div role="tabpanel" data-value="job-requirements" class="xs-tab3 tab-pane visible-xs <?php echo ($my_reason_for_practicing_ielts == "job-requirements")? 'active' : ''; ?>" id="job-requirements">
                                <span class="checked-icon"></span>
                                <div class="reason-box__tab-body unique clearfix">
                                    <h3 class="reason-box__panel-title panel-title" data-panel="false"> 
                                        <a data class="reason-box__tab-mb-title" href="#job-requirements" data-toggle="tab3">
                                            Job requirements
                                        </a>
                                    </h3>
                                </div>
                            </div>

                            <div role="tabpanel" data-value="other" class="xs-tab3 tab-pane visible-xs <?php echo ($my_reason_for_practicing_ielts == "other")? 'active' : ''; ?>" id="other">
                                <span class="checked-icon"></span>
                                <div class="reason-box__tab-body unique clearfix">
                                    <h3 class="reason-box__panel-title panel-title" data-panel="false" > 
                                        <a class="reason-box__tab-mb-title" href="#other" data-toggle="tab3">
                                            Other
                                        </a>
                                    </h3>
                                </div>
                            </div>

                        </div>

                    </div>
                    
                </div>

                <section class="ielt-score clearfix" role="tabpanel">
                    <h2 class="section-title">How about an IELTS score?</h2>
                    <div class="ielt-score__body clearfix">
                        <div class="ielt-score__label"> 
                            <label class="iot-ra-cbx col-xs-12 col-sm-6 choose-ielts-score"> 
                                <input class="form-radio" type="radio" id="ielts_lms_step-how-about-an-ielts-score-1" name="ielts_lms_step-how-about-an-ielts-score" value="i-have-an-ielts-score" <?php echo ($how_about_an_ielts_score == "i-have-an-ielts-score")? 'checked' : ''; ?> /> 
                                <span class="checkmark"></span> 
                                <span class="cb-label">I have an IELTS score</span> 
                            </label> 
                            <label class="iot-ra-cbx col-xs-12 col-sm-6 choose-ielts-score"> 
                                <input class="form-radio" type="radio" id="ielts_lms_step-how-about-an-ielts-score-2" name="ielts_lms_step-how-about-an-ielts-score" value="i-dont-have-an-ielts-score" <?php echo ($how_about_an_ielts_score == "i-dont-have-an-ielts-score")? 'checked' : ''; ?> /> 
                                <span class="checkmark"></span> 
                                <span class="cb-label">I don’t have an IELTS score</span> 
                            </label>
                        </div>
                    </div>

                    <div class="score-tabs row active dont-have-score">

                    

                        <div class="form-group score-tabs__form-group col-xs-12">
                            <div class="js-form-item form-item js-form-type-select form-item-previous-score js-form-item-previous-score <?php echo ($how_about_an_ielts_score == "i-have-an-ielts-score")? 'show' : ''; ?>" style="display: none;">
                                <label for="previous-score" class="">Previous Score</label>
                                <div class="select-wrapper">
                                    <select class="select2 form-select form-control" data-select-value="<?php echo $previous_score; ?>" id="previous-score" name="previous-score" tab-index="-98">
                                        <option>Please select</option>
                                        <option value="9.0">9.0</option>
                                        <option value="8.5">8.5</option>
                                        <option value="8.0">8.0</option>
                                        <option value="7.5">7.5</option>
                                        <option value="7.0">7.0</option>
                                        <option value="6.5">6.5</option>
                                        <option value="6.0">6.0</option>
                                        <option value="5.5">5.5</option>
                                        <option value="5.0">5.0</option>
                                    </select>
                                </div>
                            </div>
                        </div>

                        <div class="form-group score-tabs__form-group col-xs-12">
                            <div class="js-form-item form-item js-form-type-select form-item-target-score js-form-item-target-score show" style="display: none;">
                                <label for="target-score" class="">Target Score</label>
                                <div class="select-wrapper">
                                    <select class="select2 form-select form-control" data-select-value="<?php echo $target_score; ?>" id="target-score" name="target-score" required="required" tab-index="-98">
                                        <option>Please select</option>
                                        <option value="9.0">9.0</option>
                                        <option value="8.5">8.5</option>
                                        <option value="8.0">8.0</option>
                                        <option value="7.5">7.5</option>
                                        <option value="7.0">7.0</option>
                                        <option value="6.5">6.5</option>
                                        <option value="6.0">6.0</option>
                                        <option value="5.5">5.5</option>
                                        <option value="5.0">5.0</option>
                                    </select>
                                </div>
                            </div>
                        </div>

                        <div class="form-group score-tabs__form-group exam-preparation-time col-xs-12">
                            <div class="js-form-item form-item js-form-type-select form-item-exam-preparation-time js-form-item-exam-preparation-time show" style="">
                                <label for="exam-preparation-time" class="js-form-required form-required">Exam preparation time</label>
                                <div class="select-wrapper">
                                    <select class="select2 form-select form-control" data-select-value="<?php echo $exam_preparation_time; ?>" id="exam-preparation-time" name="exam-preparation-time" required="required" tab-index="-98">
                                        <option>Please select</option>
                                        <option value="1 month">1 month</option>
                                        <option value="2 months">2 months</option>
                                        <option value="3 months">3 months</option>
                                        <option value="6 months">6 months</option>
                                        <option value="12 months">12 months</option>
                                        <option value="more than 12 months">more than 12 months</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                    </div>

                </section>
                
            </div>            





            <div class="step-footer-wp">
                <div class="step-footer clearfix">
                    <div class="container">
                        <div class="more-info"> We will personalise your feed and <br> recommendation based on this info.</div>
                        <button type="submit" class="bt-next step-footer__btn -next button js-form-submit form-submit btn-default btn" type="submit" id="edit-submit" name="op" value="Next">
                            Next
                        </button>
                        <button type="button" class="bt-prev step-footer__btn -prev" data-action="ielts-lms-my-account-step-2-load">Previous</a>
                        
                    </div>
                </div>
            </div>
        </form>
        <?php return ob_get_clean();
    }

    public function my_account_step2_load(){
        wp_send_json([
            "success"   => true,
            "res"       => "step 2 loaded successfully",
            "has_html"  => true,
            "html"      => $this->my_account_step2()   
        ]);
    }

    public function submit_step3(){
        if(isset($_POST['data'])){
            $user_id = get_current_user_id();
            $data = (array) $_POST['data'];
    
            if( count($data) > 0 ) {
                foreach($data as $key => $value ) {
                    update_user_meta($user_id, $key, $value );
                }

                update_user_meta($user_id,'account-completed',1);
    
                wp_send_json([
                    "success"   => true,
                    "res"       => "step 3 saved successfully",
                    "has_html"  => false,
                    "redirect"  => true,
                    "url"       => site_url()  
                ]);
            } else {
                wp_send_json([
                    "success"   => false,
                    "res"       => "Missing user data"   
                ]);
            }
        } else {
            wp_send_json([
                "success"   => false,
                "res"       => "Missing user data"   
            ]);
        }
    }


}

return Ielts_Lms_My_Account_Ajax::get_instance();


