Subversion Repositories SmartDukaan

Rev

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