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

Last change on this file since 818 was 818, checked in by namnd, 10 years ago
File size: 2.4 KB
Line 
1(function($){
2    $.fn.setCursorToTextEnd = function() {
3        $initialVal = this.val();
4        this.val($initialVal + ' ');
5        this.val($initialVal);
6    };
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;
19                        $("#user-history").find("#topup-money").html(results.acc_balanced);
20                        content = "";
21                        if(result.length>0){
22                                for (var i in result)
23                                {
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>';
25                                       
26                                }
27                        }else
28                        {
29                                content += '<tr><td class="center" colspan=4>Chưa đăng kí gói dịch vụ nào!</td></tr>';
30                        }
31                        $("#user-history").find("#content-regis-histoty").html(content);
32                        $("#user-history").find("#regis-pagination").html(paging);
33                        $("#regis-pagination .ajax_paging").click(function ()
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({
58                url: '/frontend/user/getUserInfor/'+id +'/page/'+page,
59                type: 'POST',
60                success: function(data)
61                {
62                   
63                        results = jQuery.parseJSON(data);
64
65                        $("#content-trade-histoty").html(results.modal);
66
67                }
68        });     
69}
70
71
72function getUserHistory(id, page)
73{
74        regisHistory(id, page);
75        tradeHistory(id, page);
76        $("#user-history").modal('show');
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');
94                            //alert("đã cập nhật");
95                            location.reload();
96                        }
97
98                }
99        });
100}
Note: See TracBrowser for help on using the repository browser.