Subversion Repositories SmartDukaan

Rev

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