Subversion Repositories SmartDukaan

Rev

Rev 4142 | Rev 4249 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4142 Rev 4241
Line 18... Line 18...
18
        success : function(response) {
18
        success : function(response) {
19
            $('#' + domId).html(response);
19
            $('#' + domId).html(response);
20
            loadOrderInfo("bottom-infopane", orderId);
20
            loadOrderInfo("bottom-infopane", orderId);
21
            orderTable = $('#user-orders').dataTable({
21
            orderTable = $('#user-orders').dataTable({
22
                "aaSorting" : [ [ 1, 'desc' ] ],
22
                "aaSorting" : [ [ 1, 'desc' ] ],
-
 
23
              "bAutoWidth": false,
-
 
24
              "aoColumns" : [{ "sWidth": "16%" },//order id
-
 
25
                             { "sWidth": "30%" },//item desc
-
 
26
                             { "sWidth": "16%" },//created
-
 
27
                             { "sWidth": "8%" },//amount
-
 
28
                             { "sWidth": "17%" },//status
-
 
29
                             { "sWidth": "9%" }],//mobile no.
23
                "fnDrawCallback": function() { truncateText(125); },
30
                "fnDrawCallback": function() { truncateText(125); },
24
                "iDisplayLength" : 5,
31
                "iDisplayLength" : 5,
25
                "sDom" : 'T<"clear">lfrtip',
32
                "sDom" : 'T<"clear">lfrtip',
26
                "oTableTools" : {
33
                "oTableTools" : {
27
                    "sSwfPath" : "swf/copy_cvs_xls_pdf.swf"
34
                    "sSwfPath" : "swf/copy_cvs_xls_pdf.swf"
Line 38... Line 45...
38
        url : "/crm/user-cart?userId=" + userId + "&cartId=" + cartId,
45
        url : "/crm/user-cart?userId=" + userId + "&cartId=" + cartId,
39
        success : function(response) {
46
        success : function(response) {
40
            $('#' + domId).html(response);
47
            $('#' + domId).html(response);
41
            cartTable = $('#user-cart').dataTable({
48
            cartTable = $('#user-cart').dataTable({
42
                "aaSorting" : [ [ 1, 'desc' ] ],
49
                "aaSorting" : [ [ 1, 'desc' ] ],
-
 
50
              "bAutoWidth": false,
-
 
51
              "aoColumns" : [{ "sWidth": "32%" },//name
-
 
52
                             { "sWidth": "9%" },//quantity
-
 
53
                             { "sWidth": "16%" },//actual price
-
 
54
                             { "sWidth": "16%" },//discounted price
-
 
55
                             { "sWidth": "9%" },//estimate
-
 
56
                             { "sWidth": "18%" }],//created on
43
                "iDisplayLength" : 10,
57
                "iDisplayLength" : 10,
44
                "sDom" : 'T<"clear">lfrtip',
58
                "sDom" : 'T<"clear">lfrtip',
45
                "oTableTools" : {
59
                "oTableTools" : {
46
                    "sSwfPath" : "swf/copy_cvs_xls_pdf.swf"
60
                    "sSwfPath" : "swf/copy_cvs_xls_pdf.swf"
47
                },
61
                },
Line 114... Line 128...
114
                $('#activity-row-' + activityId).addClass('selected');
128
                $('#activity-row-' + activityId).addClass('selected');
115
            }
129
            }
116
            
130
            
117
            $('#order-table').dataTable({
131
            $('#order-table').dataTable({
118
                "aaSorting" : [ [ 2, 'desc' ] ],
132
                "aaSorting" : [ [ 2, 'desc' ] ],
-
 
133
//            "bAutoWidth": false,
-
 
134
//            "aoColumns" : [{ "sWidth": "5%" },
-
 
135
//                           { "sWidth": "20%" },
-
 
136
//                           { "sWidth": "20%" },
-
 
137
//                           { "sWidth": "12.5%" },
-
 
138
//                           { "sWidth": "12.5%" },
-
 
139
//                           { "sWidth": "10%" },
-
 
140
//                           { "sWidth": "10%" },
-
 
141
//                           { "sWidth": "10%" }],
119
                "iDisplayLength" : 5,
142
                "iDisplayLength" : 5,
120
                "fnDrawCallback": function() {truncateText(100);},
143
                "fnDrawCallback": function() {truncateText(100);},
121
                "aLengthMenu" : [ [ 5, 10, 20, -1 ], [ 5, 10, 20, "All" ] ]
144
                "aLengthMenu" : [ [ 5, 10, 20, -1 ], [ 5, 10, 20, "All" ] ]
122
            });
145
            });
123
        }
146
        }
Line 125... Line 148...
125
}
148
}
126
 
149
 
127
function createTicketDataTable(domId) {
150
function createTicketDataTable(domId) {
128
    var ticketsTable = $('#' + domId).dataTable({
151
    var ticketsTable = $('#' + domId).dataTable({
129
         "aaSorting" : [ [ 3, 'asc' ] ],
152
         "aaSorting" : [ [ 3, 'asc' ] ],
130
//         "bAutoWidth": false,
153
         "bAutoWidth": false,
131
//         "aoColumns" : [{ "sWidth": "5%" },
154
         "aoColumns" : [{ "sWidth": "9%" },//ticket id
132
//                        { "sWidth": "20%" },
155
                        { "sWidth": "16%" },//customer id or Description when orderId is set
133
//                        { "sWidth": "20%" },
156
                        { "sWidth": "21%" },//category id
134
//                        { "sWidth": "12.5%" },
157
                        { "sWidth": "13%" },//date created
135
//                        { "sWidth": "12.5%" },
158
                        { "sWidth": "13%" },//date closed
136
//                        { "sWidth": "10%" },
159
                        { "sWidth": "12%" },//assignee
137
//                        { "sWidth": "10%" },
160
                        { "sWidth": "8%" },//status
138
//                        { "sWidth": "10%" }],
161
                        { "sWidth": "8%" }],//priority
139
        "fnDrawCallback": function() {truncateText(85);},
162
        "fnDrawCallback": function() {truncateText(85);},
140
        "iDisplayLength" : 5,
163
        "iDisplayLength" : 5,
141
        "sDom" : 'T<"clear">lfrtip',
164
        "sDom" : 'T<"clear">lfrtip',
142
        "oTableTools" : {
165
        "oTableTools" : {
143
            "sSwfPath" : "swf/copy_cvs_xls_pdf.swf"
166
            "sSwfPath" : "swf/copy_cvs_xls_pdf.swf"
Line 146... Line 169...
146
    });
169
    });
147
 
170
 
148
    return ticketsTable;
171
    return ticketsTable;
149
}
172
}
150
 
173
 
-
 
174
function loadActivityDescription(domId, aActivityId) {
-
 
175
	$('#' + domId).html("<h4>Activity Description :</h4><pre>" + $(aActivityId).parent().siblings('td[id="activity-description"]').attr('title') + '</pre>');
-
 
176
    $('#activity-table tr').removeClass('selected');
-
 
177
    $(aActivityId).parent().parent().addClass('selected');
-
 
178
}
-
 
179
 
151
function loadActivityInfo(domId, activityId) {
180
function loadActivityInfo(domId, activityId) {
152
    $.ajax({
181
    $.ajax({
153
        type : "GET",
182
        type : "GET",
154
        url : "/crm/activity-info?activityId=" + activityId,
183
        url : "/crm/activity-info?activityId=" + activityId,
155
        success : function(response) {
184
        success : function(response) {
Line 162... Line 191...
162
}
191
}
163
 
192
 
164
function createActivityDataTable(domId) {
193
function createActivityDataTable(domId) {
165
    var activityTable = $('#' + domId).dataTable({
194
    var activityTable = $('#' + domId).dataTable({
166
        "aaSorting" : [ [ 4, 'desc' ] ],
195
        "aaSorting" : [ [ 4, 'desc' ] ],
-
 
196
     "bAutoWidth": false,
-
 
197
      "aoColumns" : [{ "sWidth": "10%" },//id
-
 
198
                     { "sWidth": "22%" },//activity type
-
 
199
                     { "sWidth": "15%" },//description
-
 
200
                     { "sWidth": "12%" },//timestamp
-
 
201
                     { "sWidth": "12%" },//creator
-
 
202
                     { "sWidth": "12%" },//customer id
-
 
203
                     { "sWidth": "9%" },//ticket id
-
 
204
                     { "sWidth": "8%" }],//category
167
        "iDisplayLength" : 5,
205
        "iDisplayLength" : 5,
168
        "sDom" : 'T<"clear">lfrtip',
206
        "sDom" : 'T<"clear">lfrtip',
169
        "fnDrawCallback": function() {truncateText(95);},
207
        "fnDrawCallback": function() {truncateText(95);},
170
        "oTableTools" : {
208
        "oTableTools" : {
171
            "sSwfPath" : "swf/copy_cvs_xls_pdf.swf"
209
            "sSwfPath" : "swf/copy_cvs_xls_pdf.swf"
Line 346... Line 384...
346
        }
384
        }
347
    });
385
    });
348
}
386
}
349
 
387
 
350
function truncateText(widthSize) {
388
function truncateText(widthSize) {
351
    $(".truncated-text").truncate({
389
    $(".truncated-text").each(function() {
352
        width : widthSize,
390
    	$(this).truncate({
-
 
391
            width : $(this).attr('truncatedTextWidth'),
353
        addtitle : true
392
            addtitle : true
354
    });
393
        });
-
 
394
	})
355
}
395
}
356
 
396
 
357
function markAsRead(activityId) {
397
function markAsRead(activityId) {
358
    $.ajax({
398
    $.ajax({
359
        type : "POST",
399
        type : "POST",
Line 399... Line 439...
399
            $('#' + domId).html(response);
439
            $('#' + domId).html(response);
400
        }
440
        }
401
    });
441
    });
402
}
442
}
403
 
443
 
-
 
444
function displayCancelOrderPopUp() {
-
 
445
    	$.colorbox({
-
 
446
            inline : true,
-
 
447
            width : "650px",
-
 
448
            height : "520px",
-
 
449
            href : "div#cancel-cod-div",
-
 
450
            onClosed : function() {
-
 
451
                CKEDITOR.instances['cancel-cod-body'].destroy(false);
-
 
452
                $("div#cancel-cod-div").hide();
-
 
453
            }
-
 
454
        });
-
 
455
 
-
 
456
        $("div#cancel-cod-div").show();
-
 
457
        $('#cancel-cod-body').ckeditor({toolbar : 'Basic', scayt_autoStartup : true});
-
 
458
}
-
 
459
 
404
function updateOrderStatus(domId, ticketId, orderId, orderStatus) {
460
function cancelOrder(domId, ticketId, orderId, orderStatus, formData) {
-
 
461
    $.ajax({
405
    if (orderStatus == "CANCELED") {
462
        type : "POST",
406
        if (!confirm("Are you sure you want to cancel order id: " + orderId + " ?")) {
463
        url : "/crm/tickets!updateOrderStatus?id=" + ticketId + "&orderId=" + orderId
-
 
464
        					+ "&orderStatus=" + orderStatus + "&" + formData,
-
 
465
        success : function(response) {
407
            return;
466
            $('#' + domId).html(response);
408
        }
467
        }
409
    }
468
    });
-
 
469
}
410
 
470
 
-
 
471
function updateOrderStatus(domId, ticketId, orderId, orderStatus) {
411
    $.ajax({
472
    $.ajax({
412
        type : "POST",
473
        type : "POST",
413
        url : "/crm/tickets!updateOrderStatus?id=" + ticketId + "&orderId=" + orderId + "&orderStatus=" + orderStatus,
474
        url : "/crm/tickets!updateOrderStatus?id=" + ticketId + "&orderId=" + orderId
-
 
475
        					+ "&orderStatus=" + orderStatus,
414
        success : function(response) {
476
        success : function(response) {
415
            $('#' + domId).html(response);
477
            $('#' + domId).html(response);
416
        }
478
        }
417
    });
479
    });
418
}
480
}
Line 444... Line 506...
444
        url : "/crm",
506
        url : "/crm",
445
        success : function(response) {
507
        success : function(response) {
446
            $('#sidebar').html($(response).find('#sidebar').html());
508
            $('#sidebar').html($(response).find('#sidebar').html());
447
        }
509
        }
448
    });
510
    });
449
}
511
}
450
512