source: pro-violet-viettel/sourcecode/assets/js/admin/user.js @ 822

Last change on this file since 822 was 818, checked in by namnd, 10 years ago
File size: 2.4 KB
RevLine 
[396]1(function($){
2    $.fn.setCursorToTextEnd = function() {
3        $initialVal = this.val();
4        this.val($initialVal + ' ');
5        this.val($initialVal);
6    };
[644]7})(jQuery);
8
9function 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
55function tradeHistory(id, page)
56{
57        $.ajax({
[725]58                url: '/frontend/user/getUserInfor/'+id +'/page/'+page,
[644]59                type: 'POST',
60                success: function(data)
61                {
[725]62                   
[644]63                        results = jQuery.parseJSON(data);
[725]64
65                        $("#content-trade-histoty").html(results.modal);
66
[644]67                }
68        });     
69}
70
[725]71
[644]72function getUserHistory(id, page)
73{
74        regisHistory(id, page);
75        tradeHistory(id, page);
76        $("#user-history").modal('show');
[725]77}
78
79function admin_update_user()
80{
81
82    $.ajax({
83                url: '/frontend/user/adminUpdateUser/',
84                type: 'POST',
85                data: $("#admin_update_user_form").serialize(),
86                success: function(data)
87                {
88                   
89                        results = jQuery.parseJSON(data);
90
91                        if(results.success==1)
92                        {
93                            $('#user-history').modal('hide');
[773]94                            //alert("đã cập nhật");
[770]95                            location.reload();
[725]96                        }
97
98                }
99        });
[644]100}
Note: See TracBrowser for help on using the repository browser.