Subversion Repositories SmartDukaan

Rev

Rev 21090 | Blame | Compare with Previous | Last modification | View Log | RSS feed

$(function() {
        $(".add-new-user").live('click', function() {
                loadNewUserForm("page-content-wrapper","");
        });
        
        $(".search-user").live('click', function() {
                loadSearchUserForm("page-content-wrapper");
        });
        
        $(".edit-user").live('click', function() {
                var userId = $(this).attr('userId');
                loadUserForm("page-content-wrapper", userId);
        });
        
        $(".my-profile").live('click', function() {
                loadMyProfile("page-content-wrapper");
        });
        
        $(".add-l3-user").live('click', function() {
                var referrerEmail = $(this).attr('referrerEmail');
                loadNewUserForm("page-content-wrapper", referrerEmail);
        });
        
        $("#new-user-form").live('submit', function(){
            var formData = new FormData($(this)[0]);

            jQuery.ajax({
                url: "/Support/pmsa!addNewUser",
                type: 'POST',
                data: formData,
                async: false,
                success: function (data) {
                        $("#alert-message").show();
                        $("#alert-message").text(data);
                        $('html, body').animate({
                        scrollTop: $('#page-content-wrapper').offset().top
                    }, 2000);
                },
                         error : function() {
                                alert("OOPS!!!Failed to do changes.Try Again.",'ERROR');
                         },
                cache: false,
                contentType: false,
                processData: false
            });
            return false;
        });
        
        $("#edit-user-form").live('submit', function(){
            var formData = new FormData($(this)[0]);

            jQuery.ajax({
                url: "/Support/pmsa!updateUser",
                type: 'POST',
                data: formData,
                async: false,
                success: function (data) {
                        $("#alert-message").show();
                        $("#alert-message").text(data);
                        $('html, body').animate({
                        scrollTop: $('#page-content-wrapper').offset().top
                    }, 2000);
                },
                         error : function() {
                                alert("OOPS!!!Failed to do changes.Try Again.",'ERROR');
                         },
                cache: false,
                contentType: false,
                processData: false
            });
            return false;
        });
        
        $(".pending-user").live('click', function() {
                jQuery.ajax({
                type : "GET",
                url : "/Support/pmsa!pendingUsers",
                success : function(response) {
                    $('#' + 'page-content-wrapper').html(response);
                }
            });  
        });
        
        $(".recent-user").live('click', function() {
                jQuery.ajax({
                type : "GET",
                url : "/Support/pmsa!recentUsers",
                success : function(response) {
                    $('#' + 'page-content-wrapper').html(response);
                }
            });  
        });
        
        $("#search-user").live('submit', function(){
            var formData = new FormData($(this)[0]);

            jQuery.ajax({
                url: "/Support/pmsa!searchUser",
                type: 'POST',
                data: formData,
                async: false,
                success: function (data) {
                        $('#' + 'search-results').html(data);
                },
                         error : function() {
                                alert("OOPS!!!Failed to do changes.Try Again.",'ERROR');
                         },
                cache: false,
                contentType: false,
                processData: false
            });
            return false;
        });

});