Subversion Repositories SmartDukaan

Rev

Rev 4163 | Rev 4241 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2674 vikas 1
$(function() {
3228 mandeep.dh 2
    $("a.show-order-details").live('click', function() {
3
        var orderId = $(this).attr('orderId');
3499 mandeep.dh 4
        loadOrderInfo("bottom-infopane", orderId);
3228 mandeep.dh 5
    });
3206 mandeep.dh 6
 
3228 mandeep.dh 7
    $("a.show-user-details").live('click', function() {
8
        var userId = $(this).attr('userId');
9
        loadUserPane("infopane", userId);
10
    });
3090 mandeep.dh 11
 
3228 mandeep.dh 12
    $("a.show-orders").live('click', function() {
13
        var userId = $(this).attr('userId');
14
        loadOrderPane("infopane", userId, 0);
15
    });
3090 mandeep.dh 16
 
3228 mandeep.dh 17
    $("a.show-cart").live('click', function() {
18
        var userId = $(this).attr('userId');
19
        var cartId = $(this).attr('cartId');
20
        loadCartPane("infopane", userId, cartId);
21
    });
3090 mandeep.dh 22
 
3228 mandeep.dh 23
    $("a.show-line-details").live('click', function() {
24
        var userId = $(this).attr('userId');
25
        var itemId = $(this).attr('itemId');
26
        loadLineInfo("bottom-infopane", userId, itemId);
27
    });
3090 mandeep.dh 28
 
3228 mandeep.dh 29
    $("a.show-tickets").live('click', function() {
30
        var userId = $(this).attr('userId');
3405 mandeep.dh 31
        loadTickets('infopane', "/crm/tickets!searchTickets?userId=" + userId);
3228 mandeep.dh 32
    });
3090 mandeep.dh 33
 
3228 mandeep.dh 34
    $("a.show-activity").live('click', function() {
35
        var userId = $(this).attr('userId');
3405 mandeep.dh 36
        listActivities('infopane', "userId=" + userId);
3228 mandeep.dh 37
    });
3090 mandeep.dh 38
 
3228 mandeep.dh 39
    $("a.show-ticket-details").live('click', function() {
40
        var ticketId = $(this).attr('ticketId');
3405 mandeep.dh 41
 
3228 mandeep.dh 42
        // will be set when ticket Id link is clicked from activity page
43
        var activityId = $(this).attr('activityId');
44
        loadTicketInfo("bottom-infopane", ticketId, null, activityId);
45
    });
3090 mandeep.dh 46
 
3228 mandeep.dh 47
    $("a.show-activity-details").live('click', function() {
48
        var activityId = $(this).attr('activityId');
3422 mandeep.dh 49
        loadActivityInfo("bottom-infopane", activityId);
3228 mandeep.dh 50
    });
3090 mandeep.dh 51
 
3228 mandeep.dh 52
    $("a.create-ticket").live('click', function() {
3405 mandeep.dh 53
        var userId = $(this).attr('userId');
54
 
55
        var params = null;
56
        if (userId != null && userId != "") {
57
            params = "userId=" + userId;
58
        }
59
 
60
        loadTicketCreationForm("infopane", params);
3228 mandeep.dh 61
    });
3206 mandeep.dh 62
 
3228 mandeep.dh 63
    $("a.create-activity").live('click', function() {
64
        var userId = $(this).attr('userId');
3090 mandeep.dh 65
 
3405 mandeep.dh 66
        var params = null;
67
        if (userId != null && userId != "") {
68
            params = "userId=" + userId;
69
        }
70
 
71
        loadActivityCreationForm("infopane", params);
3339 mandeep.dh 72
    });
73
 
3228 mandeep.dh 74
    $('#update-ticket-form').live('submit', function() {
75
        var ticketId = $(this).attr('ticketId');
76
        updateTicket("infopane", ticketId, $(this).serialize());
77
        return false;
78
    });
3206 mandeep.dh 79
 
3228 mandeep.dh 80
    $('form#mail-form').live(
81
            'submit',
82
            function() {
4163 mandeep.dh 83
            	var body = $('#mail-body').val().trim();
84
                if (body == null || body == '') {
85
                	alert('Please specify body of the mail');
86
                }
87
                else {
4164 mandeep.dh 88
                    var ticketId = $('#update-ticket-form').attr('ticketId');
4163 mandeep.dh 89
                    updateTicket("infopane", ticketId, $(this).serialize() + '&'
90
                            + $('#update-ticket-form').serialize());
91
                    $.colorbox.close();
92
                }
93
 
3228 mandeep.dh 94
                return false;
95
            });
3106 mandeep.dh 96
 
4020 mandeep.dh 97
    $('form#escalation-form').live(
98
            'submit',
99
            function() {
100
                var ticketId = $('#update-ticket-form').attr('ticketId');
101
                updateTicket("infopane", ticketId, $(this).serialize() + '&'
102
                        + $('#update-ticket-form').serialize());
103
                $.colorbox.close();
104
                return false;
105
            });
106
 
3228 mandeep.dh 107
    $('form#activity-mail-form').live(
108
            'submit',
109
            function() {
110
                createActivity("infopane", $(this).serialize() + '&' + $("#create-activity-form").serialize());
111
                $.colorbox.close();
112
                return false;
113
            });
3106 mandeep.dh 114
 
3405 mandeep.dh 115
    $('#create-activity-form').live('submit', function() {
116
        createActivity("infopane", $(this).serialize());
3339 mandeep.dh 117
        return false;
118
    });
119
 
3228 mandeep.dh 120
    $('#create-ticket-form').live('submit', function() {
121
        createTicket("infopane", $(this).serialize());
122
        return false;
123
    });
3106 mandeep.dh 124
 
3228 mandeep.dh 125
    $(".home-page").click(function() {
126
        goToHomePage();
127
    });
3106 mandeep.dh 128
 
3228 mandeep.dh 129
    $(".my-open-tickets").live('click', function() {
4008 mandeep.dh 130
        loadTickets('infopane', "/crm/tickets!searchTickets?agentIds=" + $(this).attr('agentIds') +"&status=OPEN");
3228 mandeep.dh 131
    });
3151 mandeep.dh 132
 
3228 mandeep.dh 133
    $(".unassigned-tickets").live('click', function() {
3234 mandeep.dh 134
        loadTickets('infopane', "/crm/tickets!getUnassignedTickets");
3151 mandeep.dh 135
    });
136
 
4065 mandeep.dh 137
    $("#spinner-div").ajaxSend(function(evt, request, settings) {
138
        if (settings.url != '/crm') {
139
            $(this).show();
140
        }
3228 mandeep.dh 141
    });
142
 
4065 mandeep.dh 143
    $("#spinner-div").ajaxComplete(function(evt, request, settings) {
144
        if (settings.url != '/crm') {
145
            $(this).hide();
146
        }
3228 mandeep.dh 147
    });
148
 
149
    $("select#activity-type").live('change', function() {
3422 mandeep.dh 150
        processActivityTypeChange($(this).val());
3228 mandeep.dh 151
    });
3397 mandeep.dh 152
 
3339 mandeep.dh 153
    $(".list-my-activity").live('click', function() {
154
        listActivities('infopane', "");
155
    });
156
 
157
    $(".list-customer-activity").live('click', function() {
158
        listActivities('infopane', "creatorId=1");
159
    });
3390 mandeep.dh 160
 
161
    $("#mark-as-read").live('click', function() {
162
        var activityId = $(this).attr('activityId');
163
        markAsRead(activityId);
164
    });
3397 mandeep.dh 165
 
166
    $("form#search").live('submit', function() {
167
        if ($('#searchEntity').val() == 'Tickets') {
168
            loadTickets('infopane', "/crm/tickets!searchTickets?" + $(this).serialize());
169
        }
170
        else {
171
            listActivities('infopane', $(this).serialize());
172
        }
173
 
174
        $.colorbox.close();
175
        return false;
176
    });
177
 
178
    $(".advanced-search").live('click', function() {
179
        loadAdvancedSearchBox();
180
        return false;
181
    });
182
 
183
    $("select#searchEntity").live('change', function() {
184
        var searchEntity = $(this).val();
185
        processSearchEntityChange(searchEntity);
186
    });
3499 mandeep.dh 187
 
188
    $('.pending-cod-verification-tickets').live('click', function() {
3546 mandeep.dh 189
        loadTickets('infopane', "/crm/tickets!searchTickets?category=COD_VERIFICATION&status=OPEN");        
190
        return false;
3499 mandeep.dh 191
    });
3546 mandeep.dh 192
 
3578 mandeep.dh 193
    $('.open-failed-payments-tickets').live('click', function() {
194
        loadTickets('infopane', "/crm/tickets!searchTickets?category=FAILED_PAYMENTS&status=OPEN");        
195
        return false;
196
    });
197
 
4008 mandeep.dh 198
    $('.open-delayed-delivery-tickets').live('click', function() {
199
        loadTickets('infopane', "/crm/tickets!searchTickets?category=DELAYED_DELIVERY&status=OPEN");        
200
        return false;
201
    });
202
 
3499 mandeep.dh 203
    $('.trust-level-increase').live('click', function() {
204
        increaseTrustLevel('infopane', $('input#trust-level-increase').attr('userId'), $('input#trust-level-increase').val());
205
    });
206
 
3546 mandeep.dh 207
    $('.update-order-status').live('click', function() {
208
        updateOrderStatus('bottom-infopane', $(this).attr('ticketId'), $(this).attr('orderId'), $(this).attr('orderStatus'));
3499 mandeep.dh 209
    });
3711 mandeep.dh 210
 
211
    $('.list-my-unread-activity').live('click', function() {
212
        loadUnreadActivities('infopane');
213
    });
4142 mandeep.dh 214
 
215
    $('form.change-address').live('submit', function() {
216
        changeAddress($(this).serialize());
217
    });
2674 vikas 218
});