
        let isRtl = $('html').attr('data-textdirection') === 'rtl';
    


        $(document).on('select2:open', () => {
            document.querySelector('.select2-search__field').focus();
        });
    


        let name = $('#name');
        let email = $('#email');
        let phone = $('#phone');
        let address = $('#address');
        let city = $('#city');
        let zip = $('#zip');
        let country_id = $('#country_id');
        let skype = $('#skype');
        let password = $('#password');
        let submit_btn = $('#submit_btn');
        let form = $('.auth-register-form');
        submit_btn.on('click', function(e) {
            e.preventDefault();
            let data = {
                name: name.val(),
                email: email.val(),
                phone: phone.val(),
                address: address.val(),
                city: city.val(),
                zip: zip.val(),
                country_id: country_id.val(),
                skype: skype.val(),
                password: password.val(),
                _token: "xVg5vlGiMwfiDk04qzHQhHjes4QkM1yoxS7WeOHB"
            }
            $.ajax({
                url: "https://trackergenius.runterminal.com/register",
                type: "POST",
                data: data,
                beforeSend: function() {
                    submit_btn.attr('disabled', true);
                    submit_btn.html(
                        '<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> Loading...'
                    );
                },
                success: function(response) {
                    if (response.status) {
                        submit_btn.html('Login');
                        submit_btn.attr('disabled', false);
                        form.trigger('reset');
                        toastr.success(response.message, 'Success Alert', {
                            timeOut: 2000
                        });
                        setTimeout(function() {
                            window.location.href = response.route
                        }, 2000)
                    } else {
                        submit_btn.html('Login');
                        submit_btn.attr('disabled', false);
                        toastr.error(response.message);
                    }
                },
                error: function(err) {
                    console.log(err.status);
                    if (err.status === 401) {
                        toastr.error(err.responseJSON.message, 'Error Alert', {
                            timeOut: 2000
                        });
                    }
                    if(err.status === 500)
                    {
                        submit_btn.html('Login');
                        submit_btn.attr('disabled', false);
                        form.trigger('reset');
                        toastr.success('User register success', 'Success Alert', {
                            timeOut: 2000
                        });
                    }
                    submit_btn.html('Login');
                    submit_btn.attr('disabled', false);
                    let errors = err.responseJSON.errors;
                    if (errors) {
                        $.each(errors, function(key, value) {
                            toastr.error(value, 'Error Alert', {
                                timeOut: 2000
                            });
                        })
                    }
                }
            })
        })
    


        let firstInvalid = $('form').find('.is-invalid').eq(0);

        if (firstInvalid.length) {
            $('body, html').stop(true, true).animate({
                'scrollTop': firstInvalid.offset().top - 200 + 'px'
            }, 200);
        }
        // Basic Select2 select
        $(".select2").each(function() {
            let $this = $(this);
            $this.wrap('<div class="position-relative"></div>');
            $this.select2({
                dropdownAutoWidth: true,
                width: '100%',
                dropdownParent: $this.parent()
            });
        });
    