Subversion Repositories SmartDukaan

Rev

Rev 7616 | Rev 7730 | 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
 
7616 manish.sha 312
    //Start:- Added By Manish Sharma for Creating a new Ticket: Category- RTO Refund on 21-Jun-2013
313
    $('.rto-refunds-tickets').live('click', function() {
314
        loadTickets('infopane', "/crm/tickets!searchTickets?category=RTO_REFUND&status=OPEN");        
315
        return false;
316
    });
317
    //End:- Added By Manish Sharma for Creating a new Ticket: Category- RTO Refund on 21-Jun-2013
318
 
4751 anupam.sin 319
    $('#order-cancellation-tickets').live('click', function() {
320
        loadTickets('infopane', "/crm/tickets!searchTickets?category=ORDER_CANCELLATION&status=OPEN");        
321
        return false;
322
    });
3578 mandeep.dh 323
 
4008 mandeep.dh 324
    $('.open-delayed-delivery-tickets').live('click', function() {
325
        loadTickets('infopane', "/crm/tickets!searchTickets?category=DELAYED_DELIVERY&status=OPEN");        
326
        return false;
327
    });
5858 amar.kumar 328
 
329
    $('#store-pickup-tickets').live('click', function() {
330
        loadTickets('infopane', "/crm/tickets!searchTickets?category=STORE_PICKUP&status=OPEN");        
331
        return false;
332
    });
4008 mandeep.dh 333
 
3499 mandeep.dh 334
    $('.trust-level-increase').live('click', function() {
335
        increaseTrustLevel('infopane', $('input#trust-level-increase').attr('userId'), $('input#trust-level-increase').val());
336
    });
337
 
3546 mandeep.dh 338
    $('.update-order-status').live('click', function() {
339
        updateOrderStatus('bottom-infopane', $(this).attr('ticketId'), $(this).attr('orderId'), $(this).attr('orderStatus'));
3499 mandeep.dh 340
    });
4241 anupam.sin 341
 
3711 mandeep.dh 342
 
343
    $('.list-my-unread-activity').live('click', function() {
344
        loadUnreadActivities('infopane');
345
    });
4142 mandeep.dh 346
 
347
    $('form.change-address').live('submit', function() {
348
        changeAddress($(this).serialize());
349
    });
4681 amar.kumar 350
 
7372 kshitij.so 351
    $('.display-cancel-order-popup').live('click', function(){
4689 anupam.sin 352
        displayCancelOrderPopUp();
353
    });
354
 
7393 anupam.sin 355
    $('.display-cancel-store-order-popup').live('click', function(){
356
        displayCancelStoreOrderPopUp();
357
    });
358
 
4681 amar.kumar 359
    $('input.cancelReason').live('change', function(){
360
    	showHidecancelReasonDiv($(this).attr('id'));
361
    });
4793 amar.kumar 362
 
363
    $('a.manage-agents').live('click', function() {
364
        loadAgentsInfo("infopane");
365
    });
366
 
5909 amar.kumar 367
    $('a.open-tickets').live('click', function() {
368
        loadAllOpenTickets("infopane");
369
    });
370
 
371
    $('a.open-ticket-count').live('click', function() {
372
    	loadTickets('infopane', "/crm/tickets!searchTickets?category=" + $(this).attr('category') + "&status=OPEN");
373
    });
374
 
4793 amar.kumar 375
    $('a#create-agent').live('click', function() {
376
    	loadAgentCreationForm();
377
    });
378
 
379
    $('a#deactivate-agent').live('click', function() {
380
    	deactivateAgentPopup();
381
    });
382
 
383
    $('a#change-password').live('click', function() {
384
    	changeAgentPasswordPopup();
385
    });
386
 
5168 amar.kumar 387
    $('a#change-role').live('click', function() {
388
    	changeAgentRolePopup();
389
    });
390
 
4793 amar.kumar 391
    $('input#deactivate-agent').live('click', function() {
392
    	deactivateAgent($('#deactivate-agent-email').val(),$('#deactivate-agent-email').find(':selected')[0].id);
393
    });
394
 
395
    $('#create-agent-form').live('submit', function() {
396
    	if(validateAgentCreationForm()){
397
    		var managerId = $('#manager-email-id').find(':selected')[0].id;
398
    		createAgent($(this).serialize(), managerId);
399
    	}
400
    });
401
 
5168 amar.kumar 402
    $('#change-agent-role-form').live('submit', function() {
403
    	if($('#changed-role')[0].value!=""||$('#changed-role')[0].value!=undefined){
404
    		changeAgentRole($(this).serialize());
405
    	} else {
406
    		alert("Please choose roles before proceeding");
407
    	}
408
    });
409
 
4793 amar.kumar 410
    $('#change-agent-password').live('click', function() {
411
    	updateAgentPassword();
412
    });
5791 anupam.sin 413
 
414
    $('.extend-expiry').live('click', function() {
415
    	var pickupExtension = $('#pickupExtension').val();
5917 anupam.sin 416
        extendExpiryDate('bottom-infopane', $(this).attr('ticketId'), $(this).attr('orderId'), pickupExtension);
5791 anupam.sin 417
    });
6507 anupam.sin 418
 
419
    $('#refund-recharge-order').live('click', function() {
420
        var orderId = $(this).attr('orderId');
421
        refundRechargeOrder(orderId, "bottom-infopane");
422
    });
6985 anupam.sin 423
 
424
    $('#changeShippingAddress').live('click', function() {
425
    	$('#changeShippingAddress').hide();
426
    	$('#shippingAddressFrm').slideDown(100);
427
    });
428
 
429
    $('#cancelAddressChange').live('click', function() {
430
    	$('#shippingAddressFrm').slideUp(100, function(){
431
    		$('#changeShippingAddress').show();
432
    	});
433
    });
434
 
435
    $('#submitNewAddress').live('click', function(){
436
    	var orderId = $(this).attr('orderId');
437
    	changeShippingAddress(orderId);
438
    });
7645 anupam.sin 439
 
440
    $('#display-store-ret-auth-options').live('click', function() {
441
    	$.colorbox({
442
            inline : true,
443
            width : "550px",
444
            height : "200px",
445
            href : "div#store-return-auth",
446
            onClosed : function() {
447
            	$('#store-return-form input[name=orderId], #store-return-form input[name=ticketId]').remove();
448
            	$("#store-return-auth").hide();
449
            }
450
        });
451
    	$("#store-return-form").append("<input type='hidden' name='orderId' value=" + $(this).attr('orderId') + "></input>");
452
        $("#store-return-form").append("<input type='hidden' name='ticketId' value=" + $(this).attr('ticketId') + "></input>");
453
        $("#store-return-auth").show();
454
    });
455
 
456
    $('#display-store-doa-auth-options').live('click', function() {
457
    	$.colorbox({
458
            inline : true,
459
            width : "550px",
460
            height : "200px",
461
            href : "div#store-doa-auth",
462
            onClosed : function() {
463
            	$('#store-doa-form input[name=orderId], #store-doa-form input[name=ticketId]').remove();
464
            	$("#store-doa-auth").hide();
465
            }
466
        });
467
    	$("#store-doa-form").append("<input type='hidden' name='orderId' value=" + $(this).attr('orderId') + "></input>");
468
        $("#store-doa-form").append("<input type='hidden' name='ticketId' value=" + $(this).attr('ticketId') + "></input>");
469
        $("#store-doa-auth").show();
470
    });
471
 
472
    $('#auth-return-button').live('click', function() {
473
        $.ajax({
474
            type : "POST",
475
            url : "/crm/tickets!authorizeReturn",
476
            data : $('#store-return-form').serialize(),
477
            success : function(response) {
478
                $('#bottom-infopane').html(response);
479
            }
480
        });
481
        $.colorbox.close();
482
    });
483
 
484
    $('#auth-doa-button').live('click', function() {
485
    	$.ajax({
486
            type : "POST",
487
            url : "/crm/tickets!authorizeDOA",
488
            data : $('#store-doa-form').serialize(),
489
            success : function(response) {
490
                $('#bottom-infopane').html(response);
491
            }
492
        });
493
        $.colorbox.close();
494
    });
7372 kshitij.so 495
});