Subversion Repositories SmartDukaan

Rev

Rev 3234 | Rev 3397 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

$(function() {
    $("a.show-order-details").live('click', function() {
        var orderId = $(this).attr('orderId');
        var userId = $(this).attr('userId');
        loadOrderInfo("bottom-infopane", userId, orderId);
    });

    $("a.show-user-details").live('click', function() {
        var userId = $(this).attr('userId');
        loadUserPane("infopane", userId);
    });

    $("a.show-orders").live('click', function() {
        var userId = $(this).attr('userId');
        loadOrderPane("infopane", userId, 0);
    });

    $("a.show-cart").live('click', function() {
        var userId = $(this).attr('userId');
        var cartId = $(this).attr('cartId');
        loadCartPane("infopane", userId, cartId);
    });

    $("a.show-user-communication").live('click', function() {
        var userId = $(this).attr('userId');
        loadUserCommunicationPane("infopane", userId);
    });

    $("a.show-line-details").live('click', function() {
        var userId = $(this).attr('userId');
        var itemId = $(this).attr('itemId');
        loadLineInfo("bottom-infopane", userId, itemId);
    });

    $("a.show-comm-details").live('click', function() {
        var userId = $(this).attr('userId');
        var commId = $(this).attr('commId');
        loadCommunicationInfo("bottom-infopane", userId, commId);
    });

    $("a.show-tickets").live('click', function() {
        var userId = $(this).attr('userId');
        loadTicketPane("infopane", userId, 0);
    });

    $("a.show-activity").live('click', function() {
        var userId = $(this).attr('userId');
        loadActivityPane("infopane", userId);
    });

    $("a.show-ticket-details").live('click', function() {
        var ticketId = $(this).attr('ticketId');
        
        // will be set when ticket Id link is clicked from activity page
        var activityId = $(this).attr('activityId');
        loadTicketInfo("bottom-infopane", ticketId, null, activityId);
    });

    $("a.show-activity-details").live('click', function() {
        var activityId = $(this).attr('activityId');
        var userId = $(this).attr('userId');
        loadActivityInfo("bottom-infopane", userId, activityId);
    });

    $("a.create-ticket").live('click', function() {
        loadTicketCreationForm("infopane");
    });

    $("a.create-activity").live('click', function() {
        loadActivityCreationForm("infopane");
    });

    $("a.create-user-ticket").live('click', function() {
        var userId = $(this).attr('userId');
        loadUserTicketCreationForm("infopane", userId);
    });

    $("a.create-user-activity").live('click', function() {
        var userId = $(this).attr('userId');
        loadUserActivityCreationForm("infopane", userId);
    });

    $('#update-ticket-form').live('submit', function() {
        var ticketId = $(this).attr('ticketId');
        updateTicket("infopane", ticketId, $(this).serialize());
        return false;
    });

    $('form#mail-form').live(
            'submit',
            function() {
                var ticketId = $('#update-ticket-form').attr('ticketId');
                updateTicket("infopane", ticketId, $(this).serialize() + '&'
                        + $('#update-ticket-form').serialize());
                $.colorbox.close();
                return false;
            });

    $('form#activity-mail-form').live(
            'submit',
            function() {
                createActivity("infopane", $(this).serialize() + '&' + $("#create-activity-form").serialize());
                $.colorbox.close();
                return false;
            });

    $('#create-user-ticket-form').live('submit', function() {
        createUserTicket("infopane", $(this).serialize());
        return false;
    });

    $('#create-user-activity-form').live('submit', function() {
        createUserActivity("infopane", $(this).serialize());
        return false;
    });

    $('#create-ticket-form').live('submit', function() {
        createTicket("infopane", $(this).serialize());
        return false;
    });

    $('#create-activity-form').live('submit', function() {
        createActivity("infopane", $(this).serialize());
        return false;
    });

    $(".home-page").click(function() {
        goToHomePage();
    });

    $(".my-open-tickets").live('click', function() {
        loadTickets('infopane', "/crm/tickets!getMyOpenTickets");
    });

    $(".my-tickets").live('click', function() {
        loadTickets('infopane', "/crm/tickets!getMyTickets");
    });

    $(".unassigned-tickets").live('click', function() {
        loadTickets('infopane', "/crm/tickets!getUnassignedTickets");
    });

    $(".all-open-tickets").live('click', function() {
        loadTickets('infopane', "/crm/tickets!getAllOpenTickets");
    });

    $(".all-tickets").live('click', function() {
        loadTickets('infopane', "/crm/tickets!getAllTickets");
    });

    $("form").ajaxSend(function(evt, request, settings) {
        $("#spinner-div").show();
    });

    $("form").ajaxComplete(function(evt, request, settings) {
        $("#spinner-div").hide();
    });

    $("a").ajaxSend(function(evt, request, settings) {
        $("#spinner-div").show();
    });

    $("a").ajaxComplete(function(evt, request, settings) {
        $("#spinner-div").hide();
    });

    $("select#activity-type").live('change', function() {
        var userId = $(this).attr('userId');
        processActivityTypeChange(userId, $(this).val());
    });
    
    $(".list-my-activity").live('click', function() {
        listActivities('infopane', "");
    });

    $(".list-customer-activity").live('click', function() {
        listActivities('infopane', "creatorId=1");
    });
});