[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;
|
---|
[818] | 19 | $("#user-history").find("#topup-money").html(results.acc_balanced);
|
---|
[644] | 20 | content = "";
|
---|
| 21 | if(result.length>0){
|
---|
| 22 | for (var i in result)
|
---|
| 23 | {
|
---|
[773] | 24 | content += '<tr><td class="center">'+result[i].source+'</td><td class="center">'+result[i].amount+'</td><td class="center">'+result[i].p_name+'</td><td>'+result[i].created_time+'</td></tr>';
|
---|
[644] | 25 |
|
---|
| 26 | }
|
---|
| 27 | }else
|
---|
| 28 | {
|
---|
[773] | 29 | content += '<tr><td class="center" colspan=4>Chưa ÄÄng kà gói dá»ch vụ nà o!</td></tr>';
|
---|
[644] | 30 | }
|
---|
| 31 | $("#user-history").find("#content-regis-histoty").html(content);
|
---|
| 32 | $("#user-history").find("#regis-pagination").html(paging);
|
---|
[645] | 33 | $("#regis-pagination .ajax_paging").click(function ()
|
---|
[644] | 34 | {
|
---|
| 35 | $.ajax({
|
---|
| 36 | url: $(this).attr("href"),
|
---|
| 37 | type: "POST",
|
---|
| 38 | success: function (data, textStatus, jqXHR)
|
---|
| 39 | {
|
---|
| 40 | results = jQuery.parseJSON(data);
|
---|
| 41 | regisHistory(id, results.current_page);
|
---|
| 42 | },
|
---|
| 43 | error: function ()
|
---|
| 44 | {
|
---|
| 45 | $(".ajaxloading").hide();
|
---|
| 46 | }
|
---|
| 47 | });
|
---|
| 48 | return false;
|
---|
| 49 | });
|
---|
| 50 |
|
---|
| 51 | }
|
---|
| 52 | });
|
---|
| 53 | }
|
---|
| 54 |
|
---|
| 55 | function tradeHistory(id, page)
|
---|
| 56 | {
|
---|
| 57 | $.ajax({
|
---|
[725] | 58 | url: '/frontend/user/getUserInfor/'+id +'/page/'+page,
|
---|
[644] | 59 | type: 'POST',
|
---|
| 60 | success: function(data)
|
---|
| 61 | {
|
---|
| 62 | results = jQuery.parseJSON(data);
|
---|
[725] | 63 | $("#content-trade-histoty").html(results.modal);
|
---|
[644] | 64 | }
|
---|
| 65 | });
|
---|
| 66 | }
|
---|
| 67 |
|
---|
[725] | 68 |
|
---|
[644] | 69 | function getUserHistory(id, page)
|
---|
| 70 | {
|
---|
| 71 | regisHistory(id, page);
|
---|
| 72 | tradeHistory(id, page);
|
---|
| 73 | $("#user-history").modal('show');
|
---|
[725] | 74 | }
|
---|
| 75 |
|
---|
| 76 | function admin_update_user()
|
---|
| 77 | {
|
---|
| 78 |
|
---|
| 79 | $.ajax({
|
---|
| 80 | url: '/frontend/user/adminUpdateUser/',
|
---|
| 81 | type: 'POST',
|
---|
| 82 | data: $("#admin_update_user_form").serialize(),
|
---|
| 83 | success: function(data)
|
---|
| 84 | {
|
---|
| 85 |
|
---|
| 86 | results = jQuery.parseJSON(data);
|
---|
| 87 |
|
---|
| 88 | if(results.success==1)
|
---|
| 89 | {
|
---|
| 90 | $('#user-history').modal('hide');
|
---|
[773] | 91 | //alert("Äã cáºp nháºt");
|
---|
[770] | 92 | location.reload();
|
---|
[725] | 93 | }
|
---|
| 94 |
|
---|
| 95 | }
|
---|
| 96 | });
|
---|
[838] | 97 | }
|
---|
| 98 |
|
---|
| 99 | function checkSelecteDistrict(){
|
---|
| 100 | provinceId = $(".form-field-province").val();
|
---|
| 101 | $.ajax({
|
---|
| 102 | url: '/frontend/user/getDistrict/' + provinceId,
|
---|
| 103 | type: 'POST',
|
---|
| 104 | success: function (data, textStatus, jqXHR)
|
---|
| 105 | {
|
---|
| 106 | result = jQuery.parseJSON(data);
|
---|
| 107 | content = "";
|
---|
| 108 | if (result != null){
|
---|
| 109 | for (var i in result){
|
---|
| 110 | if (result[i].district_id === district_id){
|
---|
| 111 | content = content + '<option value="' + result[i].district_id + '" selected >' + result[i].type + " " + result[i].district_name + '</option>';
|
---|
| 112 | }else{
|
---|
| 113 | content = content + '<option value="' + result[i].district_id + '">' + result[i].type + " " + result[i].district_name + '</option>';
|
---|
| 114 | }
|
---|
| 115 | }
|
---|
| 116 | $(".form-field-district").html(content);
|
---|
| 117 | }
|
---|
| 118 | }
|
---|
| 119 | });
|
---|
| 120 | }
|
---|
| 121 |
|
---|
| 122 | function changeEventProvince(){
|
---|
| 123 | $(".form-field-district").html("");
|
---|
| 124 | provinceId = $("#form-field-province").val();
|
---|
| 125 | $.ajax({
|
---|
| 126 | url: '/frontend/user/getDistrict/' + provinceId,
|
---|
| 127 | type: 'POST',
|
---|
| 128 | success: function (data, textStatus, jqXHR)
|
---|
| 129 | {
|
---|
| 130 | result = jQuery.parseJSON(data);
|
---|
| 131 | content = "";
|
---|
| 132 | if (result != null){
|
---|
| 133 | for (var i in result){
|
---|
| 134 | content = content + '<option value="' + result[i].district_id + '">'+ result[i].type + " " + result[i].district_name + '</option>'
|
---|
| 135 | }
|
---|
| 136 | $(".form-field-district").html(content);
|
---|
| 137 | }
|
---|
| 138 | }
|
---|
| 139 | });
|
---|
| 140 | }
|
---|