Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
2749 vikas 1
var orderTable;
2
var cartTable;
3096 mandeep.dh 3
 
3090 mandeep.dh 4
function loadUserPane(domId, userId) {
3228 mandeep.dh 5
    $.ajax({
6
        type : "GET",
7
        url : "/crm/user-info?userId=" + userId,
8
        success : function(response) {
9
            $('#' + domId).html(response);
10
        }
11
    });
2674 vikas 12
}
18884 amit.gupta 13
aoColumns = {
14
	'return':
15
	[  { "sWidth": "6%" },
16
	   { "sWidth": "30%" },
17
	   { "sWidth": "5%" },
18
	   { "sWidth": "10%" },
19
	   { "sWidth": "15%" },
20
	   { "sWidth": "8%" },
21
	   { "sWidth": "10%" },
22
	   { "sWidth": "8%" },
18886 amit.gupta 23
	   { "sWidth": "8%" }],
18884 amit.gupta 24
 
25
 
26
	'delayed':
27
	[  { "sWidth": "6%" },
28
	   { "sWidth": "25%" },
29
	   { "sWidth": "5%" },
30
	   { "sWidth": "10%" },
31
	   { "sWidth": "15%" },
32
	   { "sWidth": "8%" },
33
	   { "sWidth": "10%" },
34
	   { "sWidth": "9%" },
18886 amit.gupta 35
	   { "sWidth": "12%" }],
18884 amit.gupta 36
	'codverification':
37
	[  { "sWidth": "8%" },
38
	   { "sWidth": "40%" },
39
	   { "sWidth": "5%" },
40
	   { "sWidth": "10%" },
41
	   { "sWidth": "17%" },
42
	   { "sWidth": "10%" },
43
	   { "sWidth": "10%" }
18886 amit.gupta 44
	],
18884 amit.gupta 45
	'storepickup':
46
	[  { "sWidth": "6%" },
47
	   { "sWidth": "25%" },
48
	   { "sWidth": "5%" },
49
	   { "sWidth": "8%" },
50
	   { "sWidth": "15%" },
51
	   { "sWidth": "8%" },
52
	   { "sWidth": "10%" },
53
	   { "sWidth": "12%" },
54
	   { "sWidth": "4%" },
18886 amit.gupta 55
	   { "sWidth": "7%" }]
18884 amit.gupta 56
};
3228 mandeep.dh 57
function loadOrderPane(domId, userId, orderId) {
58
    $.ajax({
59
        type : "GET",
60
        url : "/crm/user-orders?userId=" + userId,
61
        success : function(response) {
62
            $('#' + domId).html(response);
3499 mandeep.dh 63
            loadOrderInfo("bottom-infopane", orderId);
3228 mandeep.dh 64
            orderTable = $('#user-orders').dataTable({
65
                "aaSorting" : [ [ 1, 'desc' ] ],
4241 anupam.sin 66
              "bAutoWidth": false,
18583 amit.gupta 67
              "aoColumns" : [{ "sWidth": "8%" },//transaction id
68
                             { "sWidth": "7%" },//item desc
4241 anupam.sin 69
                             { "sWidth": "30%" },//item desc
18583 amit.gupta 70
                             { "sWidth": "4%" },//item desc
18308 amit.gupta 71
                             { "sWidth": "14%" },//created
4241 anupam.sin 72
                             { "sWidth": "8%" },//amount
73
                             { "sWidth": "17%" },//status
18308 amit.gupta 74
                             { "sWidth": "11%" }],//mobile no.
3996 mandeep.dh 75
                "fnDrawCallback": function() { truncateText(125); },
4605 anupam.sin 76
                "iDisplayLength" : 10,
3339 mandeep.dh 77
                "sDom" : 'T<"clear">lfrtip',
78
                "oTableTools" : {
79
                    "sSwfPath" : "swf/copy_cvs_xls_pdf.swf"
80
                },
3228 mandeep.dh 81
                "aLengthMenu" : [ [ 5, 10, 20, -1 ], [ 5, 10, 20, "All" ] ]
82
            });
83
        }
84
    });
2674 vikas 85
}
86
 
6111 anupam.sin 87
function loadRechargeOrderPane(domId, userId, rechargeOrderId) {
88
    $.ajax({
89
        type : "GET",
90
        url : "/crm/recharge-orders?userId=" + userId,
91
        success : function(response) {
92
            $('#' + domId).html(response);
93
            loadRechargeOrderInfo("bottom-infopane", rechargeOrderId);
94
            orderTable = $('#recharge-orders').dataTable({
95
                "aaSorting" : [ [ 1, 'desc' ] ],
96
              "bAutoWidth": false,
97
              "aoColumns" : [{ "sWidth": "16%" },//recharge order id
98
                             { "sWidth": "30%" },//desc
99
                             { "sWidth": "16%" },//created
100
                             { "sWidth": "8%" },//amount
101
                             { "sWidth": "17%" },//status
6982 anupam.sin 102
                             { "sWidth": "13%" }],//mobile no.
103
                "fnDrawCallback": function() { truncateText(180); },
6111 anupam.sin 104
                "iDisplayLength" : 10,
105
                "sDom" : 'T<"clear">lfrtip',
106
                "oTableTools" : {
107
                    "sSwfPath" : "swf/copy_cvs_xls_pdf.swf"
108
                },
109
                "aLengthMenu" : [ [ 5, 10, 20, -1 ], [ 5, 10, 20, "All" ] ]
110
            });
111
        }
112
    });
113
}
114
 
115
function loadRechargeOrderInfo(domId, rechargeOrderId) {
116
    $.ajax({
117
        type : "GET",
118
        url : "/crm/recharge-order-info?rechargeOrderId=" + rechargeOrderId,
119
        success : function(response) {
120
            $('#' + domId).html(response);
121
 
122
            var trId = 'order-row-' + rechargeOrderId;
123
            if (orderTable != null) {
124
                for ( var index in orderTable.fnGetNodes()) {
125
                    var item = orderTable.fnGetNodes()[index];
126
                    if ($(item).attr('id') == trId) {
127
                        orderTable.fnDisplayRow(item);
128
                        break;
129
                    }
130
                }
131
            }
132
 
133
            $('#recharge-orders tr').removeClass('selected');
6153 anupam.sin 134
            $('#order-row-' + rechargeOrderId).addClass('selected');
6111 anupam.sin 135
        }
136
    });
137
}
138
 
3228 mandeep.dh 139
function loadCartPane(domId, userId, cartId) {
140
    $.ajax({
141
        type : "GET",
142
        url : "/crm/user-cart?userId=" + userId + "&cartId=" + cartId,
143
        success : function(response) {
144
            $('#' + domId).html(response);
145
            cartTable = $('#user-cart').dataTable({
146
                "aaSorting" : [ [ 1, 'desc' ] ],
4241 anupam.sin 147
              "bAutoWidth": false,
148
              "aoColumns" : [{ "sWidth": "32%" },//name
149
                             { "sWidth": "9%" },//quantity
150
                             { "sWidth": "16%" },//actual price
151
                             { "sWidth": "16%" },//discounted price
152
                             { "sWidth": "9%" },//estimate
153
                             { "sWidth": "18%" }],//created on
3228 mandeep.dh 154
                "iDisplayLength" : 10,
3339 mandeep.dh 155
                "sDom" : 'T<"clear">lfrtip',
156
                "oTableTools" : {
157
                    "sSwfPath" : "swf/copy_cvs_xls_pdf.swf"
158
                },
3228 mandeep.dh 159
                "aLengthMenu" : [ [ 5, 10, 20, -1 ], [ 5, 10, 20, "All" ] ]
160
            });
161
        }
162
    });
2714 vikas 163
}
164
 
3499 mandeep.dh 165
function loadOrderInfo(domId, orderId) {
3228 mandeep.dh 166
    $.ajax({
167
        type : "GET",
3499 mandeep.dh 168
        url : "/crm/user-order-info?orderId=" + orderId,
3228 mandeep.dh 169
        success : function(response) {
170
            $('#' + domId).html(response);
3220 mandeep.dh 171
 
3228 mandeep.dh 172
            var trId = 'order-row-' + orderId;
173
            if (orderTable != null) {
174
                for ( var index in orderTable.fnGetNodes()) {
175
                    var item = orderTable.fnGetNodes()[index];
176
                    if ($(item).attr('id') == trId) {
177
                        orderTable.fnDisplayRow(item);
178
                        break;
179
                    }
180
                }
181
            }
3220 mandeep.dh 182
 
7572 anupam.sin 183
            $('#user-orders tr, #orders-without-user tr').removeClass('selected');
3228 mandeep.dh 184
            $('#order-row-' + orderId).addClass('selected');
185
        }
186
    });
2714 vikas 187
}
188
 
3228 mandeep.dh 189
function loadLineInfo(domId, userId, itemId) {
190
    $.ajax({
191
        type : "GET",
192
        url : "/crm/user-line-info?userId=" + userId + "&itemId=" + itemId,
193
        success : function(response) {
194
            $('#' + domId).html(response);
195
            $('#user-cart tr').removeClass('selected');
196
            $('#cart-row-' + itemId).addClass('selected');
197
        }
198
    });
2830 vikas 199
}
200
 
3228 mandeep.dh 201
function loadTicketInfo(domId, ticketId, ticketTable, activityId) {
202
    $.ajax({
203
        type : "GET",
3405 mandeep.dh 204
        url : "/crm/tickets/" + ticketId + "/edit",
3228 mandeep.dh 205
        success : function(response) {
206
            $('#' + domId).html(response);
3206 mandeep.dh 207
 
3228 mandeep.dh 208
            var trId = 'ticket-row-' + ticketId;
209
            if (ticketTable != null) {
210
                for ( var index in ticketTable.fnGetNodes()) {
211
                    var item = ticketTable.fnGetNodes()[index];
212
                    if ($(item).attr('id') == trId) {
213
                        ticketTable.fnDisplayRow(item);
214
                        break;
215
                    }
216
                }
217
            }
3206 mandeep.dh 218
 
3228 mandeep.dh 219
            $('#tickets tr').removeClass('selected');
220
            $('#' + trId).addClass('selected');
221
 
222
            // For tickets accessed from activity page
223
            if (activityId != null) {
3339 mandeep.dh 224
                $('#activity tr').removeClass('selected');
3228 mandeep.dh 225
                $('#activity-row-' + activityId).addClass('selected');
226
            }
18348 amit.gupta 227
            $('#tr-table').dataTable({
228
            	"bAutoWidth": false,
229
          		"bLengthChange": false,
230
	            "bFilter": false,
231
            	"aoColumns" : [{ "sWidth": "8%" },
232
                	           { "sWidth": "8%" },
233
                    	       { "sWidth": "8%" },
234
                        	   { "sWidth": "50%" },
18354 amit.gupta 235
                        	   { "sWidth": "13%" },
18349 amit.gupta 236
                        	   { "sWidth": "13%" }],
18348 amit.gupta 237
 
238
                "iDisplayLength" : 10,
239
                //"fnDrawCallback": function() {truncateText(100);},
18855 amit.gupta 240
                "aLengthMenu" : [ [ 5, 10, 20, -1 ], [ 5, 10, 20, "All" ] ]
18348 amit.gupta 241
            });
3546 mandeep.dh 242
 
243
            $('#order-table').dataTable({
18884 amit.gupta 244
 
18348 amit.gupta 245
                //"aaSorting" : [ [ 2, 'desc' ] ],
18345 amit.gupta 246
	            "bAutoWidth": false,
18886 amit.gupta 247
	            "aoColumns" : aoColumns[ordertype],
18345 amit.gupta 248
                //"iDisplayLength" : 10,
18348 amit.gupta 249
                "fnDrawCallback": function() {
250
	                $('.mk_transaction').click(function(){
251
 
252
	                });
253
                },
18855 amit.gupta 254
                "aLengthMenu" : [ [ 5, 10, 20, -1 ], [ 5, 10, 20, "All" ] ]
18345 amit.gupta 255
            });
3228 mandeep.dh 256
        }
257
    });
3090 mandeep.dh 258
}
259
 
3405 mandeep.dh 260
function createTicketDataTable(domId) {
3499 mandeep.dh 261
    var ticketsTable = $('#' + domId).dataTable({
4142 mandeep.dh 262
         "aaSorting" : [ [ 3, 'asc' ] ],
4241 anupam.sin 263
         "bAutoWidth": false,
264
         "aoColumns" : [{ "sWidth": "9%" },//ticket id
265
                        { "sWidth": "16%" },//customer id or Description when orderId is set
266
                        { "sWidth": "21%" },//category id
267
                        { "sWidth": "13%" },//date created
268
                        { "sWidth": "13%" },//date closed
269
                        { "sWidth": "12%" },//assignee
270
                        { "sWidth": "8%" },//status
271
                        { "sWidth": "8%" }],//priority
3546 mandeep.dh 272
        "fnDrawCallback": function() {truncateText(85);},
4605 anupam.sin 273
        "iDisplayLength" : 10,
3339 mandeep.dh 274
        "sDom" : 'T<"clear">lfrtip',
275
        "oTableTools" : {
5203 amar.kumar 276
            "sSwfPath" : "swf/copy_cvs_xls_pdf.swf",
277
            "sExtends": "csv",
278
            "sFieldSeperator": "`"
3339 mandeep.dh 279
        },
280
        "aLengthMenu" : [ [ 5, 10, 20, -1 ], [ 5, 10, 20, "All" ] ]
281
    });
3499 mandeep.dh 282
 
283
    return ticketsTable;
3339 mandeep.dh 284
}
285
 
4241 anupam.sin 286
function loadActivityDescription(domId, aActivityId) {
5521 amar.kumar 287
	if($(aActivityId).attr('isRead')=="true") {
288
		$('#' + domId).html("<h4>Activity Description :</h4><pre>" + $(aActivityId).parent().siblings('td[id="activity-description"]').attr('title') + '</pre>');
289
	} else {
290
		$('#' + domId).html("<h4>Activity Description :</h4><pre>" + $(aActivityId).parent().siblings('td[id="activity-description"]').attr('title') + 
291
				'</pre><br/><input type="button" value="Mark as read" activityid="'+ $(aActivityId).attr('activityid') +'" id="mark-as-read">');
292
	}
4241 anupam.sin 293
    $('#activity-table tr').removeClass('selected');
294
    $(aActivityId).parent().parent().addClass('selected');
295
}
296
 
3422 mandeep.dh 297
function loadActivityInfo(domId, activityId) {
3228 mandeep.dh 298
    $.ajax({
299
        type : "GET",
3422 mandeep.dh 300
        url : "/crm/activity-info?activityId=" + activityId,
3228 mandeep.dh 301
        success : function(response) {
302
            $('#' + domId).html(response);
3339 mandeep.dh 303
            $('#activity tr').removeClass('selected');
3228 mandeep.dh 304
            $('#activity-row-' + activityId).addClass('selected');
3390 mandeep.dh 305
            $('#activity').css('table-layout', 'fixed');
3228 mandeep.dh 306
        }
307
    });
3090 mandeep.dh 308
}
309
 
3405 mandeep.dh 310
function createActivityDataTable(domId) {
3499 mandeep.dh 311
    var activityTable = $('#' + domId).dataTable({
3339 mandeep.dh 312
        "aaSorting" : [ [ 4, 'desc' ] ],
4241 anupam.sin 313
     "bAutoWidth": false,
5203 amar.kumar 314
      "aoColumns" : [{ "sWidth": "7%" },//id
315
                     { "sWidth": "18%" },//activity type
316
                     { "sWidth": "11%" },//description
317
                     { "sWidth": "11%" },//timestamp
4241 anupam.sin 318
                     { "sWidth": "12%" },//creator
5203 amar.kumar 319
                     { "sWidth": "6%" },//customer id
320
                     { "sWidth": "7%" },//ticket id
321
                     { "sWidth": "7%" },//ticket status
322
                     { "sWidth": "12%" },//category
323
                     { "sWidth": "9%" }],//contact number
4605 anupam.sin 324
        "iDisplayLength" : 10,
3339 mandeep.dh 325
        "sDom" : 'T<"clear">lfrtip',
3546 mandeep.dh 326
        "fnDrawCallback": function() {truncateText(95);},
3339 mandeep.dh 327
        "oTableTools" : {
5203 amar.kumar 328
            "sSwfPath" : "swf/copy_cvs_xls_pdf.swf",
329
            "sExtends": "csv",
330
            "sFieldSeperator": "`"
3339 mandeep.dh 331
        },
332
        "aLengthMenu" : [ [ 5, 10, 20, -1 ], [ 5, 10, 20, "All" ] ]
333
    });
3499 mandeep.dh 334
 
335
    return activityTable;
3339 mandeep.dh 336
}
337
 
4793 amar.kumar 338
function loadAgentsInfo(domId) {
339
	$.ajax({
340
		type    : "GET",
341
		url	    : "/crm/agent",
342
		success : function(response) {
343
			$('#' + domId).html(response);
344
 
345
			var agentTable = $('#agents').dataTable({
346
                "aaSorting" : [ [ 1, 'asc' ] ],
347
                "bAutoWidth": false,
348
                "aoColumns" : [{ "sWidth": "12%", "sSortDataType": "dom-text", "sType": "numeric" },//AgentID
7162 kshitij.so 349
                               { "sWidth": "25%" },//Agent Name
350
                               { "sWidth": "30%" },//Email ID
351
                               { "sWidth": "20%" },//Role
4793 amar.kumar 352
                               { "sWidth": "13%", "sSortDataType": "dom-text", "sType": "numeric"}],//Manager ID
353
                "iDisplayLength" : 10,
354
                "sDom" : 'T<"clear">lfrtip',
355
                "oTableTools" : {
356
                    "sSwfPath" : "swf/copy_cvs_xls_pdf.swf"
357
                },
358
            });
359
		}
360
	});
361
}
362
 
5909 amar.kumar 363
function loadAllOpenTickets(domId) {
364
	$.ajax({
365
		type    : "GET",
366
		url	    : "/crm/tickets!getAllOpenTickets",
367
		success : function(response) {
368
			$('#' + domId).html(response);
369
 
370
			var agentTable = $('#open-tickets').dataTable({
371
                "aaSorting" : [ [ 1, 'asc' ] ],
372
                "bAutoWidth": true,
373
                "iDisplayLength" : 25,
374
                "sDom" : 'T<"clear">lfrtip',
375
                "oTableTools" : {
376
                    "sSwfPath" : "swf/copy_cvs_xls_pdf.swf"
377
                },
378
            });
379
		}
380
	});
381
}
382
 
3405 mandeep.dh 383
function loadTicketCreationForm(domId, params) {
3228 mandeep.dh 384
    $.ajax({
385
        type : "GET",
3339 mandeep.dh 386
        url : "/crm/tickets/new",
3405 mandeep.dh 387
        data : params,
3339 mandeep.dh 388
        success : function(response) {
389
            $('#' + domId).html(response);
390
        }
391
    });
392
}
393
 
3405 mandeep.dh 394
function loadActivityCreationForm(domId, params) {
3339 mandeep.dh 395
    $.ajax({
396
        type : "GET",
397
        url : "/crm/activity/new",
3405 mandeep.dh 398
        data : params,
3339 mandeep.dh 399
        success : function(response) {
400
            $('#' + domId).html(response);
401
        }
402
    });
403
}
404
 
3090 mandeep.dh 405
function updateTicket(domId, ticketId, params) {
3228 mandeep.dh 406
    $.ajax({
4782 mandeep.dh 407
        type : "POST",
408
        url : "/crm/tickets!update?id=" + ticketId,
409
        data : params,
3228 mandeep.dh 410
        success : function(response) {
3339 mandeep.dh 411
            var ticketTable = $('table[id$="tickets"]');
412
            if (ticketTable.length == 1) {
413
                var rowIndex = ticketTable.dataTable().fnGetPosition($('tr#ticket-row-' + ticketId)[0]);
414
                var responseObj = jQuery(response);
3546 mandeep.dh 415
                var actionMessages = responseObj.find('#action-messages').html();
3339 mandeep.dh 416
                responseObj.find('#ticket-row-' + ticketId).children().each(
417
                        function(i, item) {
418
                            var th = responseObj.find('th').eq(i);
419
                            if (th.text() == "Ticket Id") {
420
                                return;
421
                            }
422
 
423
                            var thOld = ticketTable.find('th').filter(
424
                                    function(index) {
425
                                        if ($(this).text() == th.text()) {
426
                                            return true;
427
                                        }
428
 
429
                                        return false;
430
                                    });
431
 
4249 anupam.sin 432
                            if ($(thOld).length != 0) {
3339 mandeep.dh 433
                                ticketTable.dataTable().fnUpdate($(item).text(), rowIndex, $(thOld).index(), true, false);
434
                            }
435
                        });
436
 
3546 mandeep.dh 437
                loadTicketInfo("bottom-infopane", ticketId, ticketTable.dataTable(), null);
3339 mandeep.dh 438
                ticketTable.css('table-layout', 'fixed');
3546 mandeep.dh 439
 
440
                var alertString = jQuery.trim(actionMessages);
441
                if (alertString != '') {
442
                    alert(alertString);
443
                }
3339 mandeep.dh 444
            }
445
            else {
446
                loadTicketInfo("bottom-infopane", ticketId, null, null);
447
            }
448
 
3499 mandeep.dh 449
            truncateText(85);
3339 mandeep.dh 450
        }
451
    });
452
}
453
 
3090 mandeep.dh 454
function createTicket(domId, params) {
3228 mandeep.dh 455
    $.ajax({
456
        type : "POST",
3339 mandeep.dh 457
        url : "/crm/tickets",
3228 mandeep.dh 458
        data : params,
459
        success : function(response) {
460
            $('#' + domId).html(response);
3405 mandeep.dh 461
            var ticketTable = createTicketDataTable('tickets');
3228 mandeep.dh 462
        }
463
    });
3090 mandeep.dh 464
}
465
 
4793 amar.kumar 466
function createAgent(params, managerId){
467
	$.ajax({
468
		type : "POST",
469
		url : "/crm/agent!createAgent?managerId="+managerId,
470
		data : params,
471
		success : function(response) {
472
			alert("Agent created with the specified information");
473
			$.colorbox.close();
474
			$('#infopane').html(response);
475
			var agentTable = $('#agents').dataTable({
476
                "aaSorting" : [ [ 1, 'asc' ] ],
477
                "bAutoWidth": false,
478
                "aoColumns" : [{ "sWidth": "12%", "sSortDataType": "dom-text", "sType": "numeric" },//AgentID
7162 kshitij.so 479
                               { "sWidth": "25%" },//Agent Name
480
                               { "sWidth": "30%" },//Email ID
481
                               { "sWidth": "20%" },//Role
4793 amar.kumar 482
                               { "sWidth": "13%", "sSortDataType": "dom-text", "sType": "numeric"}],//Manager ID
483
                "iDisplayLength" : 10,
484
                "sDom" : 'T<"clear">lfrtip',
485
                "oTableTools" : {
486
                    "sSwfPath" : "swf/copy_cvs_xls_pdf.swf"
487
                },
488
            });
489
		}
490
	});
491
}
492
 
5168 amar.kumar 493
function changeAgentRole(params){
494
	$.ajax({
495
		type : "POST",
496
		url : "/crm/agent!changeAgentRole",
497
		data : params,
498
		success : function(response) {
499
			alert("Agent role changed");
500
			$.colorbox.close();
501
			$('#infopane').html(response);
502
			var agentTable = $('#agents').dataTable({
503
                "aaSorting" : [ [ 1, 'asc' ] ],
504
                "bAutoWidth": false,
505
                "aoColumns" : [{ "sWidth": "12%", "sSortDataType": "dom-text", "sType": "numeric" },//AgentID
7162 kshitij.so 506
                               { "sWidth": "25%" },//Agent Name
507
                               { "sWidth": "30%" },//Email ID
508
                               { "sWidth": "20%" },//Role
5168 amar.kumar 509
                               { "sWidth": "13%", "sSortDataType": "dom-text", "sType": "numeric"}],//Manager ID
510
                "iDisplayLength" : 10,
511
                "sDom" : 'T<"clear">lfrtip',
512
                "oTableTools" : {
513
                    "sSwfPath" : "swf/copy_cvs_xls_pdf.swf"
514
                },
515
            });
516
		}
517
	});
518
}
519
 
3090 mandeep.dh 520
function createActivity(domId, params) {
3228 mandeep.dh 521
    $.ajax({
522
        type : "POST",
3339 mandeep.dh 523
        url : "/crm/activity",
3228 mandeep.dh 524
        data : params,
525
        success : function(response) {
526
            $('#' + domId).html(response);
3405 mandeep.dh 527
            var activityTable = createActivityDataTable('activity');
3228 mandeep.dh 528
        }
529
    });
3106 mandeep.dh 530
}
531
 
532
function goToHomePage() {
3228 mandeep.dh 533
    document.location.href = "/crm";
3106 mandeep.dh 534
}
535
 
3422 mandeep.dh 536
function loadTickets(domId, getURL, ticketId) {
3228 mandeep.dh 537
    $.ajax({
538
        type : "GET",
3234 mandeep.dh 539
        url : getURL,
3228 mandeep.dh 540
        success : function(response) {
541
            $('#' + domId).html(response);
3405 mandeep.dh 542
            var ticketTable = createTicketDataTable('tickets');
3422 mandeep.dh 543
            if (ticketId != null) {
544
                loadTicketInfo("bottom-infopane", ticketId, ticketTable.dataTable(), null);
545
                ticketTable.css('table-layout', 'fixed');
546
            }
3228 mandeep.dh 547
        }
548
    });
3106 mandeep.dh 549
}
5225 amar.kumar 550
function changeActivityFormValidCriteria(commonDescription) {
551
	if(commonDescription == "") {
552
		$('#description').addClass('required');
553
	} else {
554
		$('#description').removeClass('required');
555
	}
556
}
3137 mandeep.dh 557
 
3422 mandeep.dh 558
function processActivityTypeChange(activityType) {
5203 amar.kumar 559
	if(activityType != "RECEIVED_CALL_FROM_CUSTOMER") {
560
		$('select#common-activity-desc').hide();
5224 amar.kumar 561
		$('#description').addClass('required');
5203 amar.kumar 562
	} else {
563
		$('select#common-activity-desc').show();
564
	}
3269 mandeep.dh 565
    if (activityType == "SEND_EMAIL_TO_CUSTOMER") {
3228 mandeep.dh 566
        $.colorbox({
567
            inline : true,
3519 mandeep.dh 568
            width : "775px",
569
            height : "445px",
3228 mandeep.dh 570
            href : "div#mail-div",
571
            onClosed : function() {
3519 mandeep.dh 572
				CKEDITOR.instances['mail-body'].destroy(false);
3228 mandeep.dh 573
                $("div#mail-div").hide();
574
                $('select#activity-type').val('OTHER');
575
            }
576
        });
3206 mandeep.dh 577
 
3228 mandeep.dh 578
        $("div#mail-div").show();
3701 mandeep.dh 579
        $('#mail-body').ckeditor({toolbar : 'Basic', scayt_autoStartup : true});
3228 mandeep.dh 580
    }
4020 mandeep.dh 581
    else if (activityType == "ESCALATE_TICKET") {
582
        $.colorbox({
583
            inline : true,
584
            width : "675px",
18308 amit.gupta 585
            height : "560px",
4020 mandeep.dh 586
            href : "div#escalation-div",
587
            onClosed : function() {
588
                CKEDITOR.instances['escalation-mail-body'].destroy(false);
589
                $("div#escalation-div").hide();
590
                $('select#activity-type').val('OTHER');
591
            }
592
        });
593
 
594
        $("div#escalation-div").show();
595
        $('#escalation-mail-body').ckeditor({toolbar : 'Basic', scayt_autoStartup : true});
596
    }
3206 mandeep.dh 597
}
598
 
599
function processInputFormSubmit() {
3228 mandeep.dh 600
    $.ajax({
601
        type : "POST",
602
        url : "/crm/",
603
        success : function(response) {
604
            $.html(response);
3405 mandeep.dh 605
            var ticketTable = createTicketDataTable('tickets');
3228 mandeep.dh 606
        }
607
    });
3339 mandeep.dh 608
}
609
 
610
function listActivities(domId, params) {
611
    $.ajax({
612
        type : "GET",
613
        url : "/crm/activity",
614
        data : params,
615
        success : function(response) {
616
            $('#' + domId).html(response);
3405 mandeep.dh 617
            var activityTable = createActivityDataTable('activity');
3339 mandeep.dh 618
        }
619
    });
620
}
621
 
18345 amit.gupta 622
function truncateText(widthSize, jqueryContainer) {
623
	if(typeof jqueryContainer!="undefined"){
624
	    jqueryContainer.find(".truncated-text").each(function() {
625
	    	$(this).truncate({
626
	            width : $(this).attr('truncatedTextWidth'),
627
	            addtitle : true
628
	        });
629
		})
630
	}else {
631
	    $(".truncated-text").each(function() {
632
	    	$(this).truncate({
633
	            width : $(this).attr('truncatedTextWidth'),
634
	            addtitle : true
635
	        });
636
		})
637
	}
3339 mandeep.dh 638
}
3390 mandeep.dh 639
 
640
function markAsRead(activityId) {
641
    $.ajax({
642
        type : "POST",
643
        url : "/crm/activity!markAsRead?activityId=" + activityId,
644
        success: function(response) {
645
            listActivities('infopane', "creatorId=1");
646
        }
647
    });
648
}
3397 mandeep.dh 649
 
650
function loadAdvancedSearchBox() {
651
    $.colorbox({
652
        inline : true,
653
        width : "535px",
654
        height : "465px",
655
        href : "form#search",
656
        onClosed : function() {
657
            $("form#search").hide();
658
        }
659
    });
660
 
661
    $("form#search").show();
662
}
663
 
664
function processSearchEntityChange(searchEntity) {
665
    if (searchEntity == "Tickets") {
666
        $("#assignee").show();
667
        $("#creator").hide();
4142 mandeep.dh 668
        $("tr#activityTypes").hide();
3397 mandeep.dh 669
    }
670
    else if (searchEntity == "Activities") {
671
        $("#assignee").hide();
672
        $("#creator").show();
4142 mandeep.dh 673
        $("tr#activityTypes").show();
3397 mandeep.dh 674
    }
675
}
3499 mandeep.dh 676
 
677
function increaseTrustLevel(domId, userId, trustLevelDelta) {
678
    $.ajax({
679
        type : "PUT",
680
        url : "/crm/user-info/" + userId + "?trustLevelDelta=" + trustLevelDelta,
681
        success : function(response) {
682
            $('#' + domId).html(response);
683
        }
684
    });
685
}
686
 
11890 kshitij.so 687
function addPrivateDealUser(domId, userId) {
688
    $.ajax({
689
        type : "PUT",
690
        url : "/crm/user-info!addPrivateDealUser?userId=" + userId,
691
        success : function(response) {
692
            $('#' + domId).html(response);
693
        }
694
    });
695
}
696
 
697
function changePrivateDealUserStatus(domId, userId, state) {
698
    $.ajax({
699
        type : "PUT",
700
        url : "/crm/user-info!changeStatusOfPrivateDealUser?userId=" + userId+ "&isPrivateDealUserActive=" + state,
701
        success : function(response) {
702
            $('#' + domId).html(response);
703
        }
704
    });
705
}
706
 
707
function resetPasswordForPrivateDealUser(domId, userId) {
708
    $.ajax({
709
        type : "PUT",
710
        url : "/crm/user-info!resetPrivateDealUserPassword?userId=" + userId,
711
        success : function(response) {
712
            $('#' + domId).html(response);
713
        },
714
    	error : function() {
715
    		alert("Unable to reset password.");
716
    	}
717
    });
718
}
719
 
4241 anupam.sin 720
function displayCancelOrderPopUp() {
721
    	$.colorbox({
722
            inline : true,
723
            width : "650px",
4314 anupam.sin 724
            height : "550px",
4689 anupam.sin 725
            href : "div#cancel-div",
4241 anupam.sin 726
            onClosed : function() {
4689 anupam.sin 727
                CKEDITOR.instances['cancel-body'].destroy(false);
728
                $("div#cancel-div").hide();
4241 anupam.sin 729
            }
730
        });
731
 
4689 anupam.sin 732
        $("div#cancel-div").show();
733
        $('#cancel-body').ckeditor({toolbar : 'Basic', scayt_autoStartup : true});
4241 anupam.sin 734
}
735
 
7393 anupam.sin 736
function displayCancelStoreOrderPopUp() {
737
	$.colorbox({
738
        inline : true,
739
        width : "650px",
740
        height : "550px",
741
        href : "#cancel-store-order-div",
742
        onClosed : function() {
743
            CKEDITOR.instances['cancel-store-order-body'].destroy(false);
744
            $("#cancel-store-order-div").hide();
745
        }
746
    });
747
 
748
    $("#cancel-store-order-div").show();
749
    $('#cancel-store-order-body').ckeditor({toolbar : 'Basic', scayt_autoStartup : true});
750
}
751
 
4241 anupam.sin 752
function cancelOrder(domId, ticketId, orderId, orderStatus, formData) {
4704 anupam.sin 753
	if ($('#cancellationInitiator').val()) {
4689 anupam.sin 754
		var cancellationInitiator = $('#cancellationInitiator').val();
755
		var uri = "/crm/user-order-info!markOrderForCancellation?orderId=" + orderId
756
						+ "&cancellationInitiator=" + cancellationInitiator + "&" + formData;
757
		var cancellationResult = function() {
758
			document.location.href = "/crm?email=&orderId=" + orderId;
759
		}
760
	} else {
761
		var uri = "/crm/tickets!updateOrderStatus?id=" + ticketId + "&orderId=" + orderId
762
						+ "&orderStatus=" + orderStatus + "&" + formData;
763
		var cancellationResult = function(response) {
764
            $('#' + domId).html(response);
765
        }
766
	}
4241 anupam.sin 767
    $.ajax({
768
        type : "POST",
4689 anupam.sin 769
        url : uri,
770
        success : cancellationResult
4241 anupam.sin 771
    });
4681 amar.kumar 772
 
773
    if(formData.indexOf("LOWER_PRICE_AVAILABLE_ELSEWHERE")!=-1){
774
    	var desc = formData.split("&");
775
    	var description = "Order cancelled because of Lower Price Available elsewhere";
776
    	$.ajax({
777
    		type : "POST",
778
    		url : "/crm/tickets?orderId="+orderId+"&priority=MEDIUM&category=PRODUCT_PROCUREMENT"
779
    				+ "&assigneeEmailId=chaitnaya.vats@shop2020.in&description="+description+"&"+desc[1],
780
    		success : function(response){
781
    			alert("Ticket created for Lower Price Available elsewhere");
782
    		}
783
    	});
784
 
785
    }
4241 anupam.sin 786
}
4065 mandeep.dh 787
 
7393 anupam.sin 788
function cancelStoreOrder(domId, ticketId, orderId, orderStatus, formData) {
789
	if ($('#cancellationInitiator').val() != "CUSTOMER" && $('#cancellationInitiator').val() != "INTERNAL") {
790
		alert("Cannot refund");
791
		return false;
792
	} 
793
	var cancellationInitiator = $('#cancellationInitiator').val();
794
	var uri = "/crm/user-order-info!markOrderForCancellation?orderId=" + orderId
795
					+ "&cancellationInitiator=" + cancellationInitiator + "&" + formData;
796
	var cancellationResult = function() {
797
		document.location.href = "/crm?email=&orderId=" + orderId;
798
	}
799
 
800
    $.ajax({
801
        type : "POST",
802
        url : uri,
803
        success : cancellationResult
804
    });
805
}
806
 
4241 anupam.sin 807
function updateOrderStatus(domId, ticketId, orderId, orderStatus) {
3499 mandeep.dh 808
    $.ajax({
3546 mandeep.dh 809
        type : "POST",
4241 anupam.sin 810
        url : "/crm/tickets!updateOrderStatus?id=" + ticketId + "&orderId=" + orderId
811
        					+ "&orderStatus=" + orderStatus,
3499 mandeep.dh 812
        success : function(response) {
3546 mandeep.dh 813
            $('#' + domId).html(response);
3499 mandeep.dh 814
        }
815
    });
3711 mandeep.dh 816
}
817
 
818
function loadUnreadActivities(domId) {
819
    $.ajax({
820
        type : "GET",
821
        url : "/crm/activity!getUnreadActivities",
822
        success : function(response) {
823
            $('#' + domId).html(response);
824
            var activityTable = createActivityDataTable('activity');
825
        }
826
    });
827
}
4065 mandeep.dh 828
 
829
function refreshSidebar() {
830
    $.ajax({
4142 mandeep.dh 831
        type : "PUT",
832
        url : "/crm",
833
        success : function(response) {
834
            $('#sidebar').html($(response).find('#sidebar').html());
835
        }
836
    });
837
}
838
 
839
function changeAddress(urlParams) {
840
    $.ajax({
4065 mandeep.dh 841
        type : "GET",
842
        url : "/crm",
843
        success : function(response) {
844
            $('#sidebar').html($(response).find('#sidebar').html());
845
        }
846
    });
4267 anupam.sin 847
}
848
 
4681 amar.kumar 849
function showHidecancelReasonDiv(cancelReason){
4793 amar.kumar 850
	var reasonsToShowDiv = ['LOWER_PRICE_AVAILABLE_ELSEWHERE','OTHER','OUT_OF_STOCK','COLOR_OUT_OF_STOCK'];
851
	if(($.inArray(cancelReason, reasonsToShowDiv))!=-1){
4681 amar.kumar 852
		$('#cancelReasonBox').show();
853
	} else {
854
		$('#cancelReasonBox').hide();
855
	}
856
}
857
 
4438 anupam.sin 858
function blockPayment(transactionId, ticketId, paymentId) {
4267 anupam.sin 859
	$.ajax({
860
		type : "GET",
4451 anupam.sin 861
		url : "/crm/tickets!blockPayment?transactionId=" + transactionId + "&id=" + ticketId + "&paymentId=" + paymentId,
4267 anupam.sin 862
		success : function(response) {
863
            $('#bottom-infopane').html(response);
864
        }
865
	});
866
}
867
 
4438 anupam.sin 868
function allowPayment(transactionId, ticketId, paymentId) {
4267 anupam.sin 869
	$.ajax({
870
		type : "GET",
4451 anupam.sin 871
		url : "/crm/tickets!allowPayment?transactionId=" + transactionId + "&id=" + ticketId + "&paymentId=" + paymentId,
4267 anupam.sin 872
		success : function(response) {
873
            $('#bottom-infopane').html(response);
874
        }
875
	});
4490 anupam.sin 876
}
877
 
878
function denyDOA(orderId, ticketId) {
879
	$.ajax({
880
		type : "GET",
881
		url : "/crm/tickets!denyDOA?orderId=" + orderId + "&id=" + ticketId,
882
		success : function(response) {
883
            $('#bottom-infopane').html(response);
884
        }
885
	});
886
}
887
 
888
 
889
function authorizeDOA(orderId, ticketId) {
890
	$.ajax({
891
		type : "GET",
892
		url : "/crm/tickets!authorizeDOA?orderId=" + orderId + "&id=" + ticketId,
893
		success : function(response) {
894
            $('#bottom-infopane').html(response);
895
        }
896
	});
897
}
898
 
899
function denyReturn(orderId, ticketId) {
900
	$.ajax({
901
		type : "GET",
902
		url : "/crm/tickets!denyReturn?orderId=" + orderId + "&id=" + ticketId,
903
		success : function(response) {
904
            $('#bottom-infopane').html(response);
905
        }
906
	});
907
}
908
 
909
 
910
function authorizeReturn(orderId, ticketId) {
911
	$.ajax({
912
		type : "GET",
913
		url : "/crm/tickets!authorizeReturn?orderId=" + orderId + "&id=" + ticketId,
914
		success : function(response) {
915
            $('#bottom-infopane').html(response);
916
        }
917
	});
4689 anupam.sin 918
}
919
 
920
function markOrderForCancellation(orderId, formData) {
921
	console.log(typeof(orderId), typeof(formData), orderId, formData);
922
 
923
	$.ajax({
924
		type : "GET",
925
		url : "/crm/user-order-info!markOrderForCancellation?orderId=" + orderId + "&cancellationInitiator=" + formData,
926
		success : function(response) {
927
			document.location.href = "/crm?email=&orderId=" + orderId;
928
        }
929
	});
4793 amar.kumar 930
}
931
 
932
function loadAgentCreationForm() {
933
	$.colorbox({
934
        inline : true,
935
        width : "550px",
936
        height : "400px",
937
        href : "div#create-agent-div",
938
        onClosed : function() {
939
            $("div#create-agent-div").hide();
940
        }
941
    });
942
 
943
    $("div#create-agent-div").show();
944
 
945
}
946
 
947
function deactivateAgentPopup() {
948
	$.colorbox({
949
        inline : true,
950
        width : "400px",
951
        height : "150px",
952
        href : "div#deactivate-agent-div",
953
        onClosed : function() {
954
            $("div#deactivate-agent-div").hide();
955
        }
956
    });
957
 
958
    $("div#deactivate-agent-div").show();
959
 
960
}
961
 
962
function changeAgentPasswordPopup(){
963
	$.colorbox({
964
        inline : true,
965
        width  : "350px",
966
        height : "350px",
967
        href   : "div#change-password-div",
968
        onClosed : function() {
969
            $("div#change-password-div").hide();
970
        }
971
    });
972
 
973
    $("div#change-password-div").show();
974
}
975
 
5168 amar.kumar 976
function changeAgentRolePopup(){
977
	$.colorbox({
978
        inline : true,
979
        width  : "375px",
980
        height : "350px",
981
        href   : "div#change-agent-role-div",
982
        onClosed : function() {
983
            $("div#change-agent-role-div").hide();
984
        }
985
    });
4793 amar.kumar 986
 
5168 amar.kumar 987
    $("div#change-agent-role-div").show();
988
}
989
 
4793 amar.kumar 990
function updateAgentPassword(){
991
	if(($('#change-password1').val().trim())==($('#change-password2').val().trim())){
992
		$.ajax({
993
			type : "POST",
994
			url : "/crm/agent!changePassword?emailId=" + $('#agentEmail').val() + "&newPassword=" + $('#change-password1').val().trim(),
995
			success : function(response) {
996
				alert("Password updated successfully");
997
				$.colorbox.close();
998
			}
999
		});
1000
	}
1001
	else { 
1002
		alert("Passwords not matching");
1003
		return false;
1004
	}
1005
}
1006
 
1007
function validateAgentCreationForm(){
1008
	var formError = false;
1009
	if($('#new-agent-name').val().length == 0) {
1010
		$('#agent-name-error').html("Please enter the name");
1011
		$('#new-agent-name').addClass('agent-form-error');
1012
		formError = true;
1013
	}
1014
	if(($('#new-agent-id').val().length == 0)) {
1015
		$('#agent-email-error').html("Please enter the Email-ID");
1016
		$('#new-agent-id').addClass('agent-form-error');
1017
		formError = true;
1018
	}
1019
	if($('#create-password1').val().length == 0) {
1020
		$('#agent-password1-error').html("Please enter password");
1021
		$('#create-password1').addClass('agent-form-error');
1022
		formError = true;
1023
	} else if($('#create-password2').val().length == 0){
1024
		$('#agent-password2-error').html("Please re enter password");
1025
		$('#create-password2').addClass('agent-form-error');
1026
		formError = true;
1027
	} else if($('#create-password1').val()!=$('#create-password2').val()) {
1028
		$('#agent-password1-error').html("Please make sure you entered same passwords");
1029
		$('#create-password1').addClass('agent-form-error');
1030
		$('#create-password2').addClass('agent-form-error');
1031
		formError = true;
1032
	}
1033
 
1034
	if(formError){
1035
		return false;
1036
	}
1037
	return true;
1038
}
1039
 
1040
function clearAgentCreationForm() {
1041
		$('#agent-name-error').html("");
1042
		$('#new-agent-name').removeClass('agent-form-error');
1043
		$('#agent-email-error').html("");
1044
		$('#new-agent-id').removeClass('agent-form-error');
1045
		$('#agent-password1-error').html("");
1046
		$('#create-password1').removeClass('agent-form-error');
1047
		$('#agent-password2-error').html("");
1048
		$('#create-password2').removeClass('agent-form-error');
1049
		$('#agent-password1-error').html("");
1050
		$('#create-password1').removeClass('agent-form-error');
1051
		$('#create-password2').removeClass('agent-form-error');
1052
}
1053
 
1054
function deactivateAgent(emailId, id) {
1055
	$.ajax({
1056
		type : "POST",
1057
		url : "/crm/agent!deActivateAgent?emailId=" + emailId+ "&id=" + id,
7162 kshitij.so 1058
		success : function(response) { 
1059
			alert("Agent deactivated successfully");
4793 amar.kumar 1060
			$.colorbox.close();
1061
			$('#infopane').html(response);
1062
			var agentTable = $('#agents').dataTable({
1063
                "aaSorting" : [ [ 1, 'asc' ] ],
1064
                "bAutoWidth": false,
1065
                "aoColumns" : [{ "sWidth": "12%", "sSortDataType": "dom-text", "sType": "numeric" },//AgentID
7162 kshitij.so 1066
                               { "sWidth": "25%" },//Agent Name
1067
                               { "sWidth": "30%" },//Email ID
1068
                               { "sWidth": "20%" },//Role
4793 amar.kumar 1069
                               { "sWidth": "13%", "sSortDataType": "dom-text", "sType": "numeric"}],//Manager ID
1070
                "iDisplayLength" : 10,
1071
                "sDom" : 'T<"clear">lfrtip',
1072
                "oTableTools" : {
1073
                    "sSwfPath" : "swf/copy_cvs_xls_pdf.swf"
1074
                },
1075
            });
1076
		}
1077
	});
5791 anupam.sin 1078
}
1079
 
5917 anupam.sin 1080
function extendExpiryDate(domId, ticketId, orderId, pickupExtension) {
5791 anupam.sin 1081
    $.ajax({
1082
        type : "POST",
5917 anupam.sin 1083
        url : "/crm/tickets!extendExpiry?id=" + ticketId + "&orderId=" + orderId + "&pickupExtension=" + pickupExtension,
5791 anupam.sin 1084
        success : function(response) {
1085
            $('#' + domId).html(response);
1086
        }
1087
    });
6507 anupam.sin 1088
}
1089
 
1090
function refundRechargeOrder(rechargeOrderId, domId) {
1091
	$.ajax({
1092
        type : "POST",
1093
        url : "/crm/recharge-order-info!refundRechargeOrder?rechargeOrderId=" + rechargeOrderId,
1094
        success : function(response) {
6516 anupam.sin 1095
        	location.reload();
6507 anupam.sin 1096
        },
1097
        error : function() {
1098
        	$('#' + domId).html("<div style='padding:15px 5px 15px 5px;color:red;'><b>Error in refunding. " +
1099
        			"<a href='/crm/?email=&mobileNumber=&orderId=&ticketId=&rechargeOrderId=" + rechargeOrderId + "&deviceNumber=&submit=Search'>Try again</a> or contact Engineering team.</b></div>");
1100
        }
1101
    });
6985 anupam.sin 1102
}
1103
 
7730 anupam.sin 1104
function convertStoreToNormal(orderId) {
1105
	$.ajax({
1106
        type : "POST",
7732 anupam.sin 1107
        url : "/crm/user-order-info!convertStoreToNormal?orderId=" + orderId,
7730 anupam.sin 1108
        success : function() {
1109
        	location.reload();
1110
        },
1111
        error: function() {
1112
        	location.reload();
1113
        }
1114
    });
1115
}
1116
 
6985 anupam.sin 1117
function changeShippingAddress(orderId) {
1118
	$.ajax({
1119
        type : "POST",
1120
        url : "/crm/user-order-info!changeShippingAddress?orderId=" + orderId,
1121
        data : $('#shippingAddressFrm').serialize(),
1122
        success : function(response) {
1123
        	location.reload();
1124
        },
1125
        error : function() {
1126
        	location.reload();
1127
        }
1128
    });
7372 kshitij.so 1129
}
7572 anupam.sin 1130
 
8821 manish.sha 1131
function refundOrderPayment(params) {
1132
	$.ajax({
1133
        type : "POST",
1134
        url : "/crm/user-order-info!refundOrderPayment",
1135
        data : params,
1136
        success : function(response) {
1137
			alert(response);
1138
			location.reload();
1139
        },
1140
        error : function() {
1141
        	alert("Error in refund");
1142
        	location.reload();
1143
        }
1144
    });
1145
}
1146
 
7572 anupam.sin 1147
function loadOrdersByMobile(domId) {
1148
    orderTable = $('#orders-without-user').dataTable({
1149
      "aaSorting" : [ [ 1, 'desc' ] ],
1150
      "bAutoWidth": false,
11890 kshitij.so 1151
      "aoColumns" : [{ "sWidth": "5%" },//order id
1152
                     { "sWidth": "7%" },//Source
1153
                     { "sWidth": "20%" },//item desc
7572 anupam.sin 1154
                     { "sWidth": "16%" },//created
1155
                     { "sWidth": "7%" },//amount
1156
                     { "sWidth": "15%" },//status
11890 kshitij.so 1157
                     { "sWidth": "10%" },//mobile no.
1158
                     { "sWidth": "20%" }],//email
18345 amit.gupta 1159
        "fnDrawCallback": function() { truncateText(125, $(this)); },
7572 anupam.sin 1160
        "iDisplayLength" : 10,
1161
        "sDom" : 'T<"clear">lfrtip',
1162
        "oTableTools" : {
1163
            "sSwfPath" : "swf/copy_cvs_xls_pdf.swf"
1164
        },
1165
        "aLengthMenu" : [ [ 5, 10, 20, -1 ], [ 5, 10, 20, "All" ] ]
1166
    });
9166 manish.sha 1167
}
1168
 
1169
function loadRechargeOrdersByDeviceNo(domId){
1170
	orderTable = $('#recharge-orders').dataTable({
1171
	      "aaSorting" : [ [ 1, 'desc' ] ],
1172
	      "bAutoWidth": false,
9174 manish.sha 1173
	      "aoColumns" : [{ "sWidth": "13%" },//recharge order id
1174
                         { "sWidth": "22%" },//desc
9166 manish.sha 1175
                         { "sWidth": "16%" },//created
1176
                         { "sWidth": "8%" },//amount
1177
                         { "sWidth": "17%" },//status
9174 manish.sha 1178
                         { "sWidth": "10%" },//mobile no.
1179
                         { "sWidth": "14% "}],//email Id
9166 manish.sha 1180
	        "fnDrawCallback": function() { truncateText(125); },
1181
	        "iDisplayLength" : 10,
1182
	        "sDom" : 'T<"clear">lfrtip',
1183
	        "oTableTools" : {
1184
	            "sSwfPath" : "swf/copy_cvs_xls_pdf.swf"
1185
	        },
1186
	        "aLengthMenu" : [ [ 5, 10, 20, -1 ], [ 5, 10, 20, "All" ] ]
1187
	    });
7572 anupam.sin 1188
}