Subversion Repositories SmartDukaan

Rev

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