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

Last change on this file since 770 was 770, checked in by quyenla, 10 years ago

admin roles

File size: 2.3 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                        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);
32                        $("#regis-pagination .ajax_paging").click(function ()
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
54function tradeHistory(id, page)
55{
56        $.ajax({
57                url: '/frontend/user/getUserInfor/'+id +'/page/'+page,
58                type: 'POST',
59                success: function(data)
60                {
61                   
62                        results = jQuery.parseJSON(data);
63
64                        $("#content-trade-histoty").html(results.modal);
65
66                }
67        });     
68}
69
70
71function getUserHistory(id, page)
72{
73        regisHistory(id, page);
74        tradeHistory(id, page);
75        $("#user-history").modal('show');
76}
77
78function admin_update_user()
79{
80
81    $.ajax({
82                url: '/frontend/user/adminUpdateUser/',
83                type: 'POST',
84                data: $("#admin_update_user_form").serialize(),
85                success: function(data)
86                {
87                   
88                        results = jQuery.parseJSON(data);
89
90                        if(results.success==1)
91                        {
92                            $('#user-history').modal('hide');
93                            alert("đã cập nhật");
94                            location.reload();
95                        }
96
97                }
98        });
99}
Note: See TracBrowser for help on using the repository browser.