Changeset 574


Ignore:
Timestamp:
Nov 19, 2014 2:08:05 PM (10 years ago)
Author:
namnd
Message:
 
Location:
pro-violet-viettel/sourcecode
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • pro-violet-viettel/sourcecode/application/config/routes.php

    r499 r574  
    125125$route['admin/card_log/trang/:any'] = 'admin/cardlog/get_cardlogs/$1';
    126126
     127$route['frontend/user/trade_history/:num/page'] = 'frontend/user/trade_history/$1/1';
     128$route['frontend/user/trade_history/:num/page/:any'] = 'frontend/user/trade_history/$1/$2';
    127129
    128130/* End of file routes.php */
  • pro-violet-viettel/sourcecode/application/modules/frontend/controllers/user.php

    r568 r574  
    2727            $data['packages'] = $this->servicepackage_model->getAllPackages();
    2828            $data['is_viettel'] = $user_info['is_viettel'];
    29                         $paidlogs = $this->user_model->getPaidlog($us_id);
     29                        //$paidlogs = $this->user_model->getPaidlog($us_id);
    3030                       
    31                         $data['paidlogs'] = $paidlogs;
     31                        //$data['paidlogs'] = $paidlogs;
    3232            parse_str($user, $info);
    3333            $data = array_merge($data, $u);
     
    287287        }
    288288    }
     289       
     290        public function trade_history()
     291        {
     292                $this->load->helper('pagging');
     293                $us_id = $this->uri->segment(4);
     294        $user_info = $this->session->userdata('userInfo');
     295        if ($user_info)
     296                {
     297                       
     298                        $data['us_id'] = $us_id;
     299                        $data['perpage'] = 10;
     300                        $data['current_page'] = $this->uri->segment(6, 1);
     301                        $data['start'] = ($data['current_page'] - 1) * $data['perpage'];
     302                        $this->load->model('user_model');
     303                        $result = $this->user_model->getPaidlog($data);
     304                        $data['total'] = $this->user_model->countPaiglogs($us_id);
     305                        $data['num_links'] = 2;
     306                        $data['paging_url'] = base_url() . "frontend/user/trade_history/".$us_id."/page/";
     307                        $data['paging'] = pagging($data);
     308                        $paidlogs = array();
     309                        foreach ($result as $paidlog):
     310                                $paidlog['amount'] = number_format($paidlog['amount'], 0);
     311                                $paidlog['paid_time'] = date('d-m-Y H:i:s', strtotime($paidlog['paid_time']));
     312                                array_push($paidlogs, $paidlog);
     313                        endforeach;
     314                        $data['paidlogs'] = $paidlogs;
     315                        echo json_encode($data);
     316                }else {
     317            redirect('frontend/home');
     318        }
     319        }
    289320
    290321}
  • pro-violet-viettel/sourcecode/application/modules/frontend/models/user_model.php

    r561 r574  
    482482        }
    483483       
    484         public function getPaidlog($us_id)
     484        public function getPaidlog($data)
    485485        {
    486                 $this->db->query ( 'UNLOCK TABLES' );
    487                 $sql = 'SELECT * FROM tblpaidlog where us_id = ?';
     486                $us_id = $data['us_id'];
     487                $this->db->query ( 'UNLOCK TABLES' );
     488                $sql = "SELECT * FROM tblpaidlog where us_id = ? ORDER BY paid_time DESC LIMIT ".$data['start'].", ".$data['perpage']." ";
    488489                $query = $this->db->query ( $sql, array (
    489490                                $us_id
     
    492493                return $row;
    493494        }
     495       
     496        public function countPaiglogs($us_id)
     497        {
     498                $this->db->query ( 'UNLOCK TABLES' );
     499                $sql="SELECT COUNT(paid_id) AS total FROM tblpaidlog WHERE us_id = ?";
     500                $query = $this->db->query ( $sql, array (
     501                                $us_id
     502                ) );
     503                $result = $query->row_array();
     504                return $result['total'];
     505        }
    494506}
  • pro-violet-viettel/sourcecode/application/modules/frontend/views/user_profile.php

    r570 r574  
    229229                                                                                        <label id="charging" style="display: none;"><span class="icon-refresh icon-refresh-animate"></span> Xin chờ...</label>
    230230                                            <div class="space-4"></div>
    231                                             <a href="#" data-toggle="modal" data-target="#trade-history"><i class="icon-archive"></i> Lịch sá»­ giao dịch</a>
     231                                            <a onclick="tradeHistory(<?php echo $us_id; ?>, 1);" data-toggle="modal"><i class="icon-archive"></i> Lịch sá»­ giao dịch</a>
    232232                                        </div>
    233233                                        <div class="clearfix">
     
    331331                                </th>
    332332                                <th class="center">Số tiền (VNĐ)</th>
    333 
    334333                                <th>
    335334                                    <i class="icon-time bigger-110 hidden-480"></i>
     
    338337                            </tr>
    339338                        </thead>
    340 
    341                         <tbody>
    342                                                         <?php if (isset($paidlogs)) {?>
    343                                                         <?php foreach($paidlogs as $paidlog): ?>
    344                             <tr>
    345                                 <td class="center">
    346                                                                 <?php echo $paidlog['source']; ?>
    347                                 </td>
    348                                 <td class="center"><?php echo number_format($paidlog['amount'], 0); ?></td>
    349                                 <td><?php echo date('d-m-Y H:i:s', strtotime($paidlog['paid_time']));?></td>
    350                             </tr>
    351                                                         <?php endforeach; ?>
    352                                                         <?php }else{ ?>
    353                                                         <tr>
    354                                 <td class="center" colspan=3>Quí vị chưa có giao dịch nào!</td>
    355                                                         </tr>
    356                                                         <?php } ?>
     339                        <tbody id="content-trade-histoty">
    357340                        </tbody>
    358341                    </table>
     342                                        <div>
     343                                                <div class="dataTables_paginate paging_bootstrap">
     344                                                        <ul class="pagination">
     345                                                        </ul>
     346                                                </div>
     347                                        </div>
    359348                </div><!-- /.table-responsive -->
    360349            </div>
     
    498487        var url="<?php echo base_url();?>";
    499488        var current_tab="<?php echo $current_tab;?>";
     489
    500490</script>
    501491<?php
  • pro-violet-viettel/sourcecode/application/views/layout/frontend/header.php

    r503 r574  
    2222                        .sidebar:before, .sidebar {background-color: transparent;}
    2323                        .icon-refresh-animate {
    24                         -animation: spin .7s infinite linear;
    25                         -webkit-animation: spin2 .7s infinite linear;
     24                                -animation: spin .7s infinite linear;
     25                                -webkit-animation: spin2 .7s infinite linear;
    2626                        }
    2727
     
    3434                                from { transform: scale(1) rotate(0deg);}
    3535                                to { transform: scale(1) rotate(360deg);}
     36                        }
     37                        #frm3 a
     38                        {
     39                                cursor: pointer;
    3640                        }
    3741                </style>
  • pro-violet-viettel/sourcecode/assets/js/frontend/user.js

    r562 r574  
    6666            {
    6767                $("#package_register_modal").modal("hide");
    68                 $("#success_package_register_content").html("QuÜ vị đã đăng kí sá»­ dụng CÃŽng cụ Soạn Bài giảng trá»±c tuyến. Quí vị được sá»­ dụng dịch vụ đến hết 24h ngày "+results.expire_date);
     68                $("#success_package_register_content").html("QuÜ vị đã đăng kí sá»­ dụng CÃŽng cụ Soạn Bài giảng trức tuyến. Quí vị được sá»­ dụng dịch vụ đến hết 24h ngày "+results.expire_date);
    6969                $("#success_package_register_modal").modal("show");
    7070               
     
    161161}
    162162
    163 
     163function tradeHistory(id, page)
     164{
     165        $.ajax({
     166                url: '/frontend/user/trade_history/'+id +'/page/'+page,
     167                type: 'POST',
     168                success: function(data)
     169                {
     170                        results = jQuery.parseJSON(data);
     171                        paging = results.paging;
     172                        result = results.paidlogs;
     173                        content = "";
     174                        if(result.length>0){
     175                                for (var i in result)
     176                                {
     177                                        content += '<tr><td class="center">'+result[i].source+'</td><td class="center">'+result[i].amount+'</td><td>'+result[i].paid_time+'</td></tr>';
     178                                       
     179                                }
     180                        }else
     181                        {
     182                                content += '<tr><td class="center" colspan=3>Quí vị chưa có giao dịch nào!</td></tr>';
     183                        }
     184                        $("#trade-history").find("#content-trade-histoty").html(content);
     185                        $("#trade-history").find(".pagination").html(paging);
     186                         $(".ajax_paging").click(function ()
     187                         {
     188                                $.ajax({
     189                                        url: $(this).attr("href"),
     190                                        type: "POST",
     191                                        success: function (data, textStatus, jqXHR)
     192                                        {
     193                                                results = jQuery.parseJSON(data);
     194                                                tradeHistory(id, results.current_page);
     195                                        },
     196                                        error: function ()
     197                                        {
     198                                                $(".ajaxloading").hide();
     199                                        }
     200                                });
     201                                return false;
     202                         });
     203                        $("#trade-history").modal('show');
     204                }
     205        });
     206}
Note: See TracChangeset for help on using the changeset viewer.