Index: pro-violet-viettel/sourcecode/application/modules/frontend/controllers/user.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/frontend/controllers/user.php	(revision 505)
+++ pro-violet-viettel/sourcecode/application/modules/frontend/controllers/user.php	(revision 508)
@@ -15,5 +15,5 @@
     public function profile() {
         $user_info = $this->session->userdata('userInfo');
-    
+
         if ($user_info) {
             $this->load->model('servicepackage_model');
@@ -23,8 +23,8 @@
             $token = md5($us_id . self::TOKENPW);
             $data = $this->get_data($src, $token, $us_id);
-            $data['current_tab']=$this->uri->segment(4,'edit-basic');
+            $data['current_tab'] = $this->uri->segment(4, 'edit-basic');
             $data['packages'] = $this->servicepackage_model->getAllPackages();
             $this->load->view('frontend/user_profile', $data);
-        } else { 
+        } else {
             redirect('frontend/home');
         }
@@ -39,5 +39,5 @@
             parse_str($user_info['user'], $info);
             $this->load->model('servicepackage_model');
-            
+
             $package = $this->servicepackage_model->getPackage($input['p_id']);
             $user = $user_info['user'];
@@ -68,5 +68,5 @@
         $input = $this->input->post();
         $user_info = $this->session->userdata('userInfo');
-        parse_str($user_info['user'],$info);
+        parse_str($user_info['user'], $info);
         if (isset($input['fullname'])) {
             if (strlen($input['fullname']) < 10) {
@@ -79,14 +79,14 @@
                 $user_info = $this->session->userdata('userInfo');
                 if ($user_info) {
-                    
+
                     $src = "SBG";
-                    $us_id=$user_info['us_id'];
+                    $us_id = $user_info['us_id'];
                     $input['password'] = '';
                     $input['oldpass'] = '';
                     $input['gender'] = '';
-                    $input['email'] ='';
+                    $input['email'] = '';
                     $input['province'] = '';
-                    $info['fullname']=$input['fullname'];
-                    $info['school']=$input['school'];
+                    $info['fullname'] = $input['fullname'];
+                    $info['school'] = $input['school'];
                     $token = md5($us_id . self::TOKENPW);
                     $user = $this->get_data($src, $token, $us_id);
@@ -94,5 +94,5 @@
                         $this->load->model('user_model');
                         $update = $this->user_model->update_user($src, $token, $input, $us_id);
-                        $info= urldecode(http_build_query($info));
+                        $info = urldecode(http_build_query($info));
                         $userdata = array('username' => $user_info['username'], 'user' => $info, 'us_id' => $user_info['us_id'], 'logined_in' => TRUE);
                         $this->session->set_userdata('userInfo', $userdata);
@@ -109,24 +109,20 @@
         $user = $this->user_model->get_user_by_id($us_id);
         $package = $this->servicepackage_model->getPackage($input['p_id']);
-        $user['acc_balanced']=$user['acc_balanced']-$package['p_price'];
-       
-        if ($package['p_unit']=="months")
-        {
-        $user['expire_date']=date('Y-m-d 00:00:00', strtotime("+".$package['p_period']." months", strtotime($user['expire_date'])));
-        }
-        if ($package['p_unit']=="days")
-        {
-        $user['expire_date']=date('Y-m-d 00:00:00', strtotime("+3 days", strtotime($user['expire_date'])));
-        }
-        $user['expire_date']=date("Y-m-d 00:00:00",  (strtotime($user['expire_date'])-1));
-        $user['p_id']=$package['p_id'];
-        $this->user_model->updateUser($us_id,$user);
-        $user['expire_date']=date("d-m-Y",  (strtotime($user['expire_date'])));
-        $result['expire_date']=$user['expire_date'];
+        $user['acc_balanced'] = $user['acc_balanced'] - $package['p_price'];
+
+        if ($package['p_unit'] == "months") {
+            $user['expire_date'] = date('Y-m-d 00:00:00', strtotime("+" . $package['p_period'] . " months", strtotime($user['expire_date'])));
+        }
+        if ($package['p_unit'] == "days") {
+            $user['expire_date'] = date('Y-m-d 00:00:00', strtotime("+3 days", strtotime($user['expire_date'])));
+        }
+        $user['expire_date'] = date("Y-m-d 00:00:00", (strtotime($user['expire_date']) - 1));
+        $user['p_id'] = $package['p_id'];
+        $this->user_model->updateUser($us_id, $user);
+        $user['expire_date'] = date("d-m-Y", (strtotime($user['expire_date'])));
+        $result['expire_date'] = $user['expire_date'];
         $result['success'] = 1;
         echo json_encode($result);
-        
-    }
-    
+    }
 
     private function get_data($src, $token, $us_id) {
@@ -146,4 +142,5 @@
         }
     }
+
 
     private function dateDiff($expire_date) {
@@ -165,16 +162,8 @@
         }
     }
-    public function test()
-    {
-        $user_info = $this->session->userdata('userInfo');
-        echo "<pre>";
-        print_r ($user_info);
-        echo "</pre>";
-    }
+
     public function update_user() {
-        $this->load->helper('email');
         $us_id = $this->uri->segment(4);
         $user_info = $this->session->userdata('userInfo');
-       
         if ($user_info) {
             $result = array();
@@ -186,14 +175,24 @@
             if ($input) {
                 $input['username'] = $user['username'];
-                $input['fullname'] = $user['fullname'];
+                if (array_key_exists('fullname', $input)) {
+                    if (strlen($input['fullname']) == 0) {
+                        $result['errors']['fullname_err'] = "Há» tÃªn khÃŽng ÄÆ°á»£c Äá» trá»ng !";
+                    }
+                } else {
+                    $input['fullname'] = $user['fullname'];
+                }
+                /*
+                  if ($strlen($input['school']) == 0)
+                  {
+                  $result['errors']['school_err'] = "ÄÆ¡n vá» khÃŽng ÄÆ°á»£c Äá» trá»ng !";
+                  }
+                  if ($strlen($input['province']) == 0)
+                  {
+                  $result['errors']['province_err'] = "Tá»nh/thÃ nh khÃŽng ÄÆ°á»£c Äá» trá»ng !";
+                  } */
                 $input['password'] = '';
                 $input['oldpass'] = '';
                 $this->load->model('user_model');
-                $result['fullname'] = $input['fullname'];
-                if (strlen($input['email']) > 0) {
-                    if (!valid_email($input['email'])) {
-                        $result['errors']['email_err'] = "Email khÃŽng ÄÃºng Äá»nh dáº¡ng";
-                    }
-                }
+                //$result['fullname'] = $input['fullname'];
                 if (!isset($result['errors'])) {
                     $result['data'] = $this->user_model->update_user($src, $token, $input, $us_id);
@@ -205,146 +204,47 @@
             redirect('frontend/home');
         }
-	private function get_data($src, $token, $us_id)
-	{
-		$this->load->model('user_model');
-		$user = $this->user_model->get_user_info($src, $token, $us_id);
-		
-		if (strpos($user, '&')){
-			parse_str($user);
-			$us = $this->user_model->get_user_by_id($us_id);
-			$data = array('us_id'=>$us_id, 'username'=>$username, 'fullname'=>$fullname,
-						'gender'=>$gender, 'email'=>$email, 'phone'=>$phone, 'school'=>$school, 'province'=>$province,
-						'acc_balanced'=>$us['acc_balanced'], 'expire_date'=>date('d/m/Y', strtotime($us['expire_date'])), 'date_diff'=>$this->dateDiff($us['expire_date']), 'use_package'=>$us['use_package']
-					);
-			return $data;
-		}else
-		{
-			return "";
-		}
-	}
-	
-	private function dateDiff($expire_date)
-	{
-		$date1 = date("Y-m-d");
-		if ((strtotime($expire_date) - strtotime($date1))<0) return "0 ngÃ y cÃ²n láº¡i";
-		$diff = strtotime($expire_date) - strtotime($date1);
-		$years = floor($diff / (365*60*60*24));
-		$months = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
-		$days = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
-		if ($years>0){
-			return $years." nÄm, ".$months." thÃ¡ng, ".$days." ngÃ y cÃ²n láº¡i";
-		}
-		else{
-			if ($months>0)
-			{
-				return  $months." thÃ¡ng, ".$days." ngÃ y cÃ²n láº¡i";
-			}
-			else
-			{
-				return $days." ngÃ y cÃ²n láº¡i";
-			}
-		}
-		
-	}
-	
-	public function update_user()
-	{
-		$us_id=$this->uri->segment(4);
-		$user_info = $this->session->userdata('userInfo');
-		if ($user_info)
-		{
-			$result = array();
-			$result['success'] = 0;
-			$src = "SBG";
-			$token = md5($us_id.self::TOKENPW);
-			$user = $this->get_data($src, $token, $us_id);
-			$input = $this->input->post();
-			if ($input){
-				$input['username'] = $user['username'];
-				if (array_key_exists('fullname', $input))
-				{
-					if (strlen($input['fullname'])==0)
-					{
-						$result['errors']['fullname_err'] = "Há» tÃªn khÃŽng ÄÆ°á»£c Äá» trá»ng !";
-					}
-				}else
-				{
-					$input['fullname'] = $user['fullname'];
-				}
-				/*
-				if ($strlen($input['school']) == 0)
-				{
-					$result['errors']['school_err'] = "ÄÆ¡n vá» khÃŽng ÄÆ°á»£c Äá» trá»ng !";
-				}
-				if ($strlen($input['province']) == 0)
-				{
-					$result['errors']['province_err'] = "Tá»nh/thÃ nh khÃŽng ÄÆ°á»£c Äá» trá»ng !";
-				}*/
-				$input['password'] = '';
-				$input['oldpass'] = '';
-				$this->load->model('user_model');
-				//$result['fullname'] = $input['fullname'];
-				if (!isset($result['errors'])){
-					$result['data'] = $this->user_model->update_user($src, $token, $input, $us_id);
-					$result['success'] = 1;
-				}
-				echo json_encode($result);
-			}
-			
-		}else
-		{
-			redirect('frontend/home');
-		}
-	}
-	
-	public function change_password()
-	{
-		$us_id=$this->uri->segment(4);
-		$user_info = $this->session->userdata('userInfo');
-		if ($user_info)
-		{
-			$this->load->model('user_model');
-			$us_id = $user_info['us_id'];
-			$src = "SBG";
-			$token = md5($us_id.self::TOKENPW);
-			$input = $this->input->post();
-			if (strlen($input['passwd']) == 0)
-			{
-				$result['errors']['passwd_old_err'] = "Máº­t kháº©u khÃŽng ÄÆ°á»£c Äá» trá»ng !";
-			}
-			if (strlen($input['passwd_new']) == 0)
-			{
-				$result['errors']['passwd_new_err'] = "Máº­t kháº©u khÃŽng ÄÆ°á»£c Äá» trá»ng !";
-			}else if($input['passwd'] == $input['passwd_new'])
-			{
-				$result['errors']['passwd_new_err'] = "Máº­t kháº©u trÃ¹ng vá»i máº­t kháº©u hiá»n táº¡i !";
-			}
-			if ($input['passwd_new'] != $input['confirm_passwd_new'])
-			{
-				$result['errors']['confirm_passwd_new_err'] = "Máº­t kháº©u khÃŽng trÃ¹ng nhau !";
-			}
-			if (!isset($result['errors']))
-			{
-				$user = array('username'=>$user_info['username'], 'fullname'=>null, 'gender'=>null, 'email'=>null, 'school'=>null, 'province'=>null, 'password'=>$input['passwd_new'], 'oldpass'=>$input['passwd']);
-				$data = $this->user_model->update_user($src, $token, $user, $us_id);
-				parse_str($data);
-				switch($status)
-				{
-					case 0:
-						$result['success'] = 1;
-						break;
-					case 6:
-						$result['errors']['passwd_old_err'] = "Máº­t kháº©u cung cáº¥p khÃŽng ÄÃºng !";
-						break;
-					default:
-						break;
-				}
-			}
-			
-			echo json_encode($result);
-		}else
-		{
-			redirect('frontend/home');
-		}
-	}
+    }
+
+    public function change_password() {
+        $us_id = $this->uri->segment(4);
+        $user_info = $this->session->userdata('userInfo');
+        if ($user_info) {
+            $this->load->model('user_model');
+            $us_id = $user_info['us_id'];
+            $src = "SBG";
+            $token = md5($us_id . self::TOKENPW);
+            $input = $this->input->post();
+            if (strlen($input['passwd']) == 0) {
+                $result['errors']['passwd_old_err'] = "Máº­t kháº©u khÃŽng ÄÆ°á»£c Äá» trá»ng !";
+            }
+            if (strlen($input['passwd_new']) == 0) {
+                $result['errors']['passwd_new_err'] = "Máº­t kháº©u khÃŽng ÄÆ°á»£c Äá» trá»ng !";
+            } else if ($input['passwd'] == $input['passwd_new']) {
+                $result['errors']['passwd_new_err'] = "Máº­t kháº©u trÃ¹ng vá»i máº­t kháº©u hiá»n táº¡i !";
+            }
+            if ($input['passwd_new'] != $input['confirm_passwd_new']) {
+                $result['errors']['confirm_passwd_new_err'] = "Máº­t kháº©u khÃŽng trÃ¹ng nhau !";
+            }
+            if (!isset($result['errors'])) {
+                $user = array('username' => $user_info['username'], 'fullname' => null, 'gender' => null, 'email' => null, 'school' => null, 'province' => null, 'password' => $input['passwd_new'], 'oldpass' => $input['passwd']);
+                $data = $this->user_model->update_user($src, $token, $user, $us_id);
+                parse_str($data);
+                switch ($status) {
+                    case 0:
+                        $result['success'] = 1;
+                        break;
+                    case 6:
+                        $result['errors']['passwd_old_err'] = "Máº­t kháº©u cung cáº¥p khÃŽng ÄÃºng !";
+                        break;
+                    default:
+                        break;
+                }
+            }
+
+            echo json_encode($result);
+        } else {
+            redirect('frontend/home');
+        }
+    }
+
 }
Index: pro-violet-viettel/sourcecode/application/modules/frontend/views/user_profile.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/frontend/views/user_profile.php	(revision 505)
+++ pro-violet-viettel/sourcecode/application/modules/frontend/views/user_profile.php	(revision 508)
@@ -29,6 +29,6 @@
                         <div class="tabbable">
                             <ul class="nav nav-tabs padding-16">
-                                <li class="active">
-                                    <a href="#edit-basic" data-toggle="tab">
+                                <li class="active" >
+                                    <a id="edit-basic-tab" href="#edit-basic" data-toggle="tab">
                                         <i class="green icon-edit bigger-125"></i>
                                         ThÃŽng tin cÃ¡ nhÃ¢n
@@ -36,6 +36,6 @@
                                 </li>
 
-                                <li>
-                                    <a href="#edit-password" data-toggle="tab">
+                                <li >
+                                    <a id="edit-password-tab" href="#edit-password" data-toggle="tab">
                                         <i class="blue icon-key bigger-125"></i>
                                         Äá»i máº­t kháº©u
@@ -43,12 +43,12 @@
                                 </li>
 
-                                <li>
-                                    <a href="#account-info" data-toggle="tab">
+                                <li >
+                                    <a id="account-info-tab" href="#account-info" data-toggle="tab">
                                         <img src="<?php echo $base_url; ?>assets/img/payment.png" width="16" class="img-responsive pull-left">
                                         ThÃŽng tin tÃ i khoáº£n
                                     </a>
                                 </li>
-                                <li>
-                                    <a href="#services-register" data-toggle="tab">
+                                <li >
+                                    <a id="services-register-tab" href="#services-register" data-toggle="tab">
                                         <i class="blue icon-cog bigger-125"></i>
                                         ÄÄng kÃœ dá»ch vá»¥
@@ -205,5 +205,5 @@
                                         </div>
                                         <div class="col-sm-6">
-                                            <h4>Thá»i báº¡n sá»­ dá»¥ng </h4> <h3><?php echo @$expire_date; ?> <span class="badge"><?php echo @$date_diff; ?></span></h3>
+                                            <h4>Thá»i háº¡n sá»­ dá»¥ng </h4> <h3><?php echo @$expire_date; ?> <span class="badge"><?php echo @$date_diff; ?></span></h3>
                                         </div>
 
@@ -253,8 +253,8 @@
                                         <h4 class="header blue bolder smaller">ThÃŽng tin tÃ i khoáº£n</h4>
                                         <div class="col-sm-6">
-                                            <h4>Sá» tiá»n </h4> <h3><?php echo number_format(@$acc_balanced, 0); ?> VND</h3>
+                                            <h4>Sá» tiá»n trong tÃ i khoáº£n SBG Online </h4> <h3><?php echo number_format(@$acc_balanced, 0); ?> VND<span id="add_money" style="cursor:pointer" class="badge">Náº¡p thÃªm tiá»n</span></h3>
                                         </div>
                                         <div class="col-sm-6">
-                                            <h4>Thá»i báº¡n sá»­ dá»¥ng </h4> <h3><?php echo @$expire_date; ?> <span class="badge"><?php echo @$date_diff; ?></span></h3>
+                                            <h4>Thá»i háº¡n sá»­ dá»¥ng </h4> <h3><?php echo @$expire_date; ?> <span class="badge"><?php echo @$date_diff; ?></span></h3>
                                         </div> 
                                         <h4 class="header blue bolder smaller">ÄÄng kÃœ dá»ch vá»¥</h4>
@@ -437,6 +437,6 @@
 </div>
 <script type="text/javascript">
-var url=<?php echo base_url();?>
-var current_tab=<?php echo $current_tab;?>
+var url="<?php echo base_url();?>";
+var current_tab="<?php echo $current_tab;?>";
 </script>
 <?php
