[396] | 1 | (function($){
|
---|
| 2 | $.fn.setCursorToTextEnd = function() {
|
---|
| 3 | $initialVal = this.val();
|
---|
| 4 | this.val($initialVal + ' ');
|
---|
| 5 | this.val($initialVal);
|
---|
| 6 | };
|
---|
[644] | 7 | })(jQuery);
|
---|
| 8 |
|
---|
| 9 | function regisHistory(id, page)
|
---|
| 10 | {
|
---|
| 11 | $.ajax({
|
---|
| 12 | url: '/frontend/user/regis_history/'+id +'/page/'+page,
|
---|
| 13 | type: 'POST',
|
---|
| 14 | success: function(data)
|
---|
| 15 | {
|
---|
| 16 | results = jQuery.parseJSON(data);
|
---|
| 17 | paging = results.paging;
|
---|
| 18 | result = results.packagelogs;
|
---|
| 19 | content = "";
|
---|
| 20 | if(result.length>0){
|
---|
| 21 | for (var i in result)
|
---|
| 22 | {
|
---|
| 23 | content += '<tr><td class="center">'+result[i].source+'</td><td class="center">'+result[i].p_name+'</td><td>'+result[i].created_time+'</td></tr>';
|
---|
| 24 |
|
---|
| 25 | }
|
---|
| 26 | }else
|
---|
| 27 | {
|
---|
| 28 | content += '<tr><td class="center" colspan=3>Chưa ÄÄng kà gói dá»ch vụ nà o!</td></tr>';
|
---|
| 29 | }
|
---|
| 30 | $("#user-history").find("#content-regis-histoty").html(content);
|
---|
| 31 | $("#user-history").find("#regis-pagination").html(paging);
|
---|
[645] | 32 | $("#regis-pagination .ajax_paging").click(function ()
|
---|
[644] | 33 | {
|
---|
| 34 | $.ajax({
|
---|
| 35 | url: $(this).attr("href"),
|
---|
| 36 | type: "POST",
|
---|
| 37 | success: function (data, textStatus, jqXHR)
|
---|
| 38 | {
|
---|
| 39 | results = jQuery.parseJSON(data);
|
---|
| 40 | regisHistory(id, results.current_page);
|
---|
| 41 | },
|
---|
| 42 | error: function ()
|
---|
| 43 | {
|
---|
| 44 | $(".ajaxloading").hide();
|
---|
| 45 | }
|
---|
| 46 | });
|
---|
| 47 | return false;
|
---|
| 48 | });
|
---|
| 49 |
|
---|
| 50 | }
|
---|
| 51 | });
|
---|
| 52 | }
|
---|
| 53 |
|
---|
| 54 | function tradeHistory(id, page)
|
---|
| 55 | {
|
---|
| 56 | $.ajax({
|
---|
| 57 | url: '/frontend/user/trade_history/'+id +'/page/'+page,
|
---|
| 58 | type: 'POST',
|
---|
| 59 | success: function(data)
|
---|
| 60 | {
|
---|
| 61 | results = jQuery.parseJSON(data);
|
---|
| 62 | paging = results.paging;
|
---|
| 63 | result = results.paidlogs;
|
---|
| 64 | content = "";
|
---|
| 65 | if(result.length>0){
|
---|
| 66 | for (var i in result)
|
---|
| 67 | {
|
---|
| 68 | content += '<tr><td class="center">'+result[i].source+'</td><td class="center">'+result[i].amount+'</td><td>'+result[i].paid_time+'</td></tr>';
|
---|
| 69 |
|
---|
| 70 | }
|
---|
| 71 | }else
|
---|
| 72 | {
|
---|
| 73 | content += '<tr><td class="center" colspan=3>Chưa có giao dá»ch nà o!</td></tr>';
|
---|
| 74 | }
|
---|
| 75 | $("#user-history").find("#content-trade-histoty").html(content);
|
---|
| 76 | $("#user-history").find("#trade-pagination").html(paging);
|
---|
[645] | 77 | $("#trade-pagination .ajax_paging").click(function ()
|
---|
[644] | 78 | {
|
---|
| 79 | $.ajax({
|
---|
| 80 | url: $(this).attr("href"),
|
---|
| 81 | type: "POST",
|
---|
| 82 | success: function (data, textStatus, jqXHR)
|
---|
| 83 | {
|
---|
| 84 | results = jQuery.parseJSON(data);
|
---|
| 85 | tradeHistory(id, results.current_page);
|
---|
| 86 | },
|
---|
| 87 | error: function ()
|
---|
| 88 | {
|
---|
| 89 | $(".ajaxloading").hide();
|
---|
| 90 | }
|
---|
| 91 | });
|
---|
| 92 | return false;
|
---|
| 93 | });
|
---|
| 94 |
|
---|
| 95 | }
|
---|
| 96 | });
|
---|
| 97 | }
|
---|
| 98 |
|
---|
| 99 | function getUserHistory(id, page)
|
---|
| 100 | {
|
---|
| 101 | regisHistory(id, page);
|
---|
| 102 | tradeHistory(id, page);
|
---|
| 103 | $("#user-history").modal('show');
|
---|
| 104 | } |
---|