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


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


        let email = $('#email');
        let password = $('#password');
        let submit_btn = $('#submit_btn');
        let remember_me = $('#remember-me');
        let form = $('.auth-login-form');
        submit_btn.on('click',function (e) {
            e.preventDefault();
            let data = {
                email:email.val(),
                password:password.val(),
                remember_me:remember_me.is(':checked'),
                _token: "xVg5vlGiMwfiDk04qzHQhHjes4QkM1yoxS7WeOHB"
            }
            $.ajax({
                url: "https://trackergenius.runterminal.com/login",
                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) {
                    if(err.status === 401)
                    {
                        toastr.error(err.responseJSON.message, 'Error Alert', {
                            timeOut: 100
                        });
                    }
                    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
                            });
                        })
                    }
                }
            })
        })
   