Subversion Repositories SmartDukaan

Rev

Rev 4793 | Rev 5225 | 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
    });
5168 amar.kumar 11
 
12
    $("a.agent-ticket-count").live('click', function() {
13
        loadTickets('infopane', "/crm/tickets!searchTickets?agentIds=" + $(this).attr('agentId') +"&status=OPEN");
14
    });
3090 mandeep.dh 15
 
3228 mandeep.dh 16
    $("a.show-orders").live('click', function() {
17
        var userId = $(this).attr('userId');
18
        loadOrderPane("infopane", userId, 0);
19
    });
3090 mandeep.dh 20
 
3228 mandeep.dh 21
    $("a.show-cart").live('click', function() {
22
        var userId = $(this).attr('userId');
23
        var cartId = $(this).attr('cartId');
24
        loadCartPane("infopane", userId, cartId);
25
    });
3090 mandeep.dh 26
 
3228 mandeep.dh 27
    $("a.show-line-details").live('click', function() {
28
        var userId = $(this).attr('userId');
29
        var itemId = $(this).attr('itemId');
30
        loadLineInfo("bottom-infopane", userId, itemId);
31
    });
3090 mandeep.dh 32
 
3228 mandeep.dh 33
    $("a.show-tickets").live('click', function() {
34
        var userId = $(this).attr('userId');
3405 mandeep.dh 35
        loadTickets('infopane', "/crm/tickets!searchTickets?userId=" + userId);
3228 mandeep.dh 36
    });
3090 mandeep.dh 37
 
3228 mandeep.dh 38
    $("a.show-activity").live('click', function() {
39
        var userId = $(this).attr('userId');
3405 mandeep.dh 40
        listActivities('infopane', "userId=" + userId);
3228 mandeep.dh 41
    });
3090 mandeep.dh 42
 
3228 mandeep.dh 43
    $("a.show-ticket-details").live('click', function() {
44
        var ticketId = $(this).attr('ticketId');
3405 mandeep.dh 45
 
3228 mandeep.dh 46
        // will be set when ticket Id link is clicked from activity page
47
        var activityId = $(this).attr('activityId');
48
        loadTicketInfo("bottom-infopane", ticketId, null, activityId);
49
    });
4241 anupam.sin 50
 
51
    $("a.show-activity-description").live('click', function() {
52
    	loadActivityDescription("activity-description-pane", this);
53
    });
3090 mandeep.dh 54
 
3228 mandeep.dh 55
    $("a.show-activity-details").live('click', function() {
56
        var activityId = $(this).attr('activityId');
3422 mandeep.dh 57
        loadActivityInfo("bottom-infopane", activityId);
3228 mandeep.dh 58
    });
4241 anupam.sin 59
 
3228 mandeep.dh 60
    $("a.create-ticket").live('click', function() {
3405 mandeep.dh 61
        var userId = $(this).attr('userId');
62
 
63
        var params = null;
64
        if (userId != null && userId != "") {
65
            params = "userId=" + userId;
66
        }
67
 
68
        loadTicketCreationForm("infopane", params);
3228 mandeep.dh 69
    });
3206 mandeep.dh 70
 
3228 mandeep.dh 71
    $("a.create-activity").live('click', function() {
72
        var userId = $(this).attr('userId');
3090 mandeep.dh 73
 
3405 mandeep.dh 74
        var params = null;
75
        if (userId != null && userId != "") {
76
            params = "userId=" + userId;
77
        }
78
 
79
        loadActivityCreationForm("infopane", params);
3339 mandeep.dh 80
    });
81
 
3228 mandeep.dh 82
    $('#update-ticket-form').live('submit', function() {
83
        var ticketId = $(this).attr('ticketId');
84
        updateTicket("infopane", ticketId, $(this).serialize());
85
        return false;
86
    });
3206 mandeep.dh 87
 
3228 mandeep.dh 88
    $('form#mail-form').live(
89
            'submit',
90
            function() {
4163 mandeep.dh 91
            	var body = $('#mail-body').val().trim();
92
                if (body == null || body == '') {
93
                	alert('Please specify body of the mail');
94
                }
95
                else {
4164 mandeep.dh 96
                    var ticketId = $('#update-ticket-form').attr('ticketId');
4163 mandeep.dh 97
                    updateTicket("infopane", ticketId, $(this).serialize() + '&'
98
                            + $('#update-ticket-form').serialize());
99
                    $.colorbox.close();
100
                }
101
 
3228 mandeep.dh 102
                return false;
103
            });
3106 mandeep.dh 104
 
4020 mandeep.dh 105
    $('form#escalation-form').live(
106
            'submit',
107
            function() {
108
                var ticketId = $('#update-ticket-form').attr('ticketId');
109
                updateTicket("infopane", ticketId, $(this).serialize() + '&'
110
                        + $('#update-ticket-form').serialize());
111
                $.colorbox.close();
112
                return false;
113
            });
4241 anupam.sin 114
 
4705 anupam.sin 115
    $('form#cancel-form').live('submit',
116
    		function() {
117
    	if( $('#cancelReasonBox').attr('style') && !($('#cancelReasonBox').attr('style').indexOf('none'))) {
118
    	var body = $('#cancel-body').val().trim();
119
    	if (body == null || body == '') {
120
    		alert('Please specify description');
121
    		return false;
122
    	}
123
    }
124
    var ticketId = $('.display-cancel-order-popup').attr('ticketId');
125
    var orderId = $('.display-cancel-order-popup').attr('orderId');
126
    var orderStatus = $('.display-cancel-order-popup').attr('orderStatus');
127
    cancelOrder("bottom-infopane", ticketId, orderId, orderStatus, $(this).serialize());
128
    $.colorbox.close();
129
    return false;
130
	});
4020 mandeep.dh 131
 
3228 mandeep.dh 132
    $('form#activity-mail-form').live(
133
            'submit',
134
            function() {
135
                createActivity("infopane", $(this).serialize() + '&' + $("#create-activity-form").serialize());
136
                $.colorbox.close();
137
                return false;
138
            });
3106 mandeep.dh 139
 
3405 mandeep.dh 140
    $('#create-activity-form').live('submit', function() {
141
        createActivity("infopane", $(this).serialize());
3339 mandeep.dh 142
        return false;
143
    });
144
 
3228 mandeep.dh 145
    $('#create-ticket-form').live('submit', function() {
146
        createTicket("infopane", $(this).serialize());
147
        return false;
148
    });
3106 mandeep.dh 149
 
3228 mandeep.dh 150
    $(".home-page").click(function() {
151
        goToHomePage();
152
    });
3106 mandeep.dh 153
 
3228 mandeep.dh 154
    $(".my-open-tickets").live('click', function() {
4008 mandeep.dh 155
        loadTickets('infopane', "/crm/tickets!searchTickets?agentIds=" + $(this).attr('agentIds') +"&status=OPEN");
3228 mandeep.dh 156
    });
3151 mandeep.dh 157
 
3228 mandeep.dh 158
    $(".unassigned-tickets").live('click', function() {
3234 mandeep.dh 159
        loadTickets('infopane', "/crm/tickets!getUnassignedTickets");
3151 mandeep.dh 160
    });
161
 
4065 mandeep.dh 162
    $("#spinner-div").ajaxSend(function(evt, request, settings) {
163
        if (settings.url != '/crm') {
164
            $(this).show();
165
        }
3228 mandeep.dh 166
    });
167
 
4065 mandeep.dh 168
    $("#spinner-div").ajaxComplete(function(evt, request, settings) {
169
        if (settings.url != '/crm') {
170
            $(this).hide();
171
        }
3228 mandeep.dh 172
    });
173
 
174
    $("select#activity-type").live('change', function() {
3422 mandeep.dh 175
        processActivityTypeChange($(this).val());
3228 mandeep.dh 176
    });
3397 mandeep.dh 177
 
3339 mandeep.dh 178
    $(".list-my-activity").live('click', function() {
179
        listActivities('infopane', "");
180
    });
181
 
182
    $(".list-customer-activity").live('click', function() {
183
        listActivities('infopane', "creatorId=1");
184
    });
3390 mandeep.dh 185
 
186
    $("#mark-as-read").live('click', function() {
187
        var activityId = $(this).attr('activityId');
188
        markAsRead(activityId);
189
    });
3397 mandeep.dh 190
 
4490 anupam.sin 191
    $("#deny-doa").live('click', function() {
192
    	var ticketId = $(this).attr('ticketId');
193
    	var orderId = $(this).attr('orderId');
194
    	denyDOA(orderId, ticketId);
195
    });
196
 
197
    $("#authorize-doa").live('click', function() {
198
    	var ticketId = $(this).attr('ticketId');
199
    	var orderId = $(this).attr('orderId');
200
    	authorizeDOA(orderId, ticketId);
201
    });
202
 
203
    $("#deny-return").live('click', function() {
204
    	var ticketId = $(this).attr('ticketId');
205
    	var orderId = $(this).attr('orderId');
206
    	denyReturn(orderId, ticketId);
207
    });
208
 
209
    $("#authorize-return").live('click', function() {
210
    	var ticketId = $(this).attr('ticketId');
211
    	var orderId = $(this).attr('orderId');
212
    	authorizeReturn(orderId, ticketId);
213
    });
214
 
4267 anupam.sin 215
    $("#block-payment").live('click', function() {
216
    	var transactionId = $(this).attr('transactionId');
217
    	var ticketId = $(this).attr('ticketId');
4438 anupam.sin 218
    	var paymentId = $(this).attr('paymentId');
219
    	blockPayment(transactionId, ticketId, paymentId);
4267 anupam.sin 220
    });
221
 
222
    $("#allow-payment").live('click', function() {
223
    	var transactionId = $(this).attr('transactionId');
224
    	var ticketId = $(this).attr('ticketId');
4438 anupam.sin 225
    	var paymentId = $(this).attr('paymentId');
226
    	allowPayment(transactionId, ticketId, paymentId);
4267 anupam.sin 227
    });
228
 
3397 mandeep.dh 229
    $("form#search").live('submit', function() {
230
        if ($('#searchEntity').val() == 'Tickets') {
231
            loadTickets('infopane', "/crm/tickets!searchTickets?" + $(this).serialize());
232
        }
233
        else {
234
            listActivities('infopane', $(this).serialize());
235
        }
236
 
237
        $.colorbox.close();
238
        return false;
239
    });
240
 
241
    $(".advanced-search").live('click', function() {
242
        loadAdvancedSearchBox();
243
        return false;
244
    });
245
 
246
    $("select#searchEntity").live('change', function() {
247
        var searchEntity = $(this).val();
248
        processSearchEntityChange(searchEntity);
249
    });
3499 mandeep.dh 250
 
251
    $('.pending-cod-verification-tickets').live('click', function() {
3546 mandeep.dh 252
        loadTickets('infopane', "/crm/tickets!searchTickets?category=COD_VERIFICATION&status=OPEN");        
253
        return false;
3499 mandeep.dh 254
    });
3546 mandeep.dh 255
 
3578 mandeep.dh 256
    $('.open-failed-payments-tickets').live('click', function() {
257
        loadTickets('infopane', "/crm/tickets!searchTickets?category=FAILED_PAYMENTS&status=OPEN");        
258
        return false;
259
    });
4267 anupam.sin 260
 
261
    $('.open-flagged-payments-tickets').live('click', function() {
262
        loadTickets('infopane', "/crm/tickets!searchTickets?category=PAYMENT_FLAGGED&status=OPEN");        
263
        return false;
264
    });
4490 anupam.sin 265
 
266
    $('.doa-request-tickets').live('click', function() {
267
        loadTickets('infopane', "/crm/tickets!searchTickets?category=DOA_RECEIVED&status=OPEN");        
268
        return false;
269
    });
270
 
271
    $('.return-request-tickets').live('click', function() {
272
        loadTickets('infopane', "/crm/tickets!searchTickets?category=RETURN_FORM&status=OPEN");        
273
        return false;
274
    });
4751 anupam.sin 275
 
276
    $('#order-cancellation-tickets').live('click', function() {
277
        loadTickets('infopane', "/crm/tickets!searchTickets?category=ORDER_CANCELLATION&status=OPEN");        
278
        return false;
279
    });
3578 mandeep.dh 280
 
4008 mandeep.dh 281
    $('.open-delayed-delivery-tickets').live('click', function() {
282
        loadTickets('infopane', "/crm/tickets!searchTickets?category=DELAYED_DELIVERY&status=OPEN");        
283
        return false;
284
    });
285
 
3499 mandeep.dh 286
    $('.trust-level-increase').live('click', function() {
287
        increaseTrustLevel('infopane', $('input#trust-level-increase').attr('userId'), $('input#trust-level-increase').val());
288
    });
289
 
3546 mandeep.dh 290
    $('.update-order-status').live('click', function() {
291
        updateOrderStatus('bottom-infopane', $(this).attr('ticketId'), $(this).attr('orderId'), $(this).attr('orderStatus'));
3499 mandeep.dh 292
    });
4241 anupam.sin 293
 
294
    $('.display-cancel-order-popup').live('click', function() {
4689 anupam.sin 295
    	displayCancelOrderPopUp();
4241 anupam.sin 296
    });
3711 mandeep.dh 297
 
298
    $('.list-my-unread-activity').live('click', function() {
299
        loadUnreadActivities('infopane');
300
    });
4142 mandeep.dh 301
 
302
    $('form.change-address').live('submit', function() {
303
        changeAddress($(this).serialize());
304
    });
4681 amar.kumar 305
 
4689 anupam.sin 306
    $('#orderCancellationButton').live('click', function(){
307
        displayCancelOrderPopUp();
308
    });
309
 
4681 amar.kumar 310
    $('input.cancelReason').live('change', function(){
311
    	showHidecancelReasonDiv($(this).attr('id'));
312
    });
4793 amar.kumar 313
 
314
    $('a.manage-agents').live('click', function() {
315
        loadAgentsInfo("infopane");
316
    });
317
 
318
    $('a#create-agent').live('click', function() {
319
    	loadAgentCreationForm();
320
    });
321
 
322
    $('a#deactivate-agent').live('click', function() {
323
    	deactivateAgentPopup();
324
    });
325
 
326
    $('a#change-password').live('click', function() {
327
    	changeAgentPasswordPopup();
328
    });
329
 
5168 amar.kumar 330
    $('a#change-role').live('click', function() {
331
    	changeAgentRolePopup();
332
    });
333
 
4793 amar.kumar 334
    $('input#deactivate-agent').live('click', function() {
335
    	deactivateAgent($('#deactivate-agent-email').val(),$('#deactivate-agent-email').find(':selected')[0].id);
336
    });
337
 
338
    $('#create-agent-form').live('submit', function() {
339
    	if(validateAgentCreationForm()){
340
    		var managerId = $('#manager-email-id').find(':selected')[0].id;
341
    		createAgent($(this).serialize(), managerId);
342
    	}
343
    });
344
 
5168 amar.kumar 345
    $('#change-agent-role-form').live('submit', function() {
346
    	if($('#changed-role')[0].value!=""||$('#changed-role')[0].value!=undefined){
347
    		changeAgentRole($(this).serialize());
348
    	} else {
349
    		alert("Please choose roles before proceeding");
350
    	}
351
    });
352
 
4793 amar.kumar 353
    $('#change-agent-password').live('click', function() {
354
    	updateAgentPassword();
355
    });
2674 vikas 356
});