Index: pro-violet-viettel/sourcecode/application/config/routes.php
===================================================================
--- pro-violet-viettel/sourcecode/application/config/routes.php	(revision 397)
+++ pro-violet-viettel/sourcecode/application/config/routes.php	(revision 401)
@@ -49,4 +49,8 @@
 $route['admin/cong_tac_vien/trang/:any'] = 'admin/collaborator/getCollaborators/$1';
 $route['admin/cong_tac_vien/test'] = 'admin/collaborator/test';
+$route['admin/cong_tac_vien/xem/:any'] = 'admin/collaborator/viewUser';
+$route['admin/cong_tac_vien/sua/:any'] = 'admin/collaborator/editUser';
+$route['admin/cong_tac_vien/xoa/:any'] = 'admin/collaborator/deleteUser';
+$route['admin/cong_tac_vien/cap_nhat'] = 'admin/collaborator/updateUser';
 
 $route['admin/quan_tri_vien'] = 'admin/admin_acc';
Index: pro-violet-viettel/sourcecode/application/modules/admin/controllers/collaborator.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/admin/controllers/collaborator.php	(revision 397)
+++ pro-violet-viettel/sourcecode/application/modules/admin/controllers/collaborator.php	(revision 401)
@@ -56,5 +56,5 @@
         $data['start'] = ($data['current_page'] - 1) * $data['perpage'];
         $data['total'] = $this->collabolator_model->countCollaborator($data);  
-        $data['collaborators'] = $this->collabolator_model->getCollaborator($data);
+        $data['collaborators'] = $this->collabolator_model->getCollaborators($data);
 
         $data['paging_url'] = base_url() . "/admin/cong_tac_vien/trang/";
@@ -121,26 +121,81 @@
         echo json_encode($result);
     }
-
+    public function viewUser()
+    {
+        $id=$this->uri->segment(4);
+        $this->load->model('collabolator_model');
+        $data=$this->collabolator_model->getCollaborator($id);
+        $this->load->view('collaborator/viewUser',$data);
+    }
+    public function editUser()
+    {
+        $id=$this->uri->segment(4);
+        $this->load->model('collabolator_model');
+        $data=$this->collabolator_model->getCollaborator($id);
+        $this->load->view('collaborator/editUser',$data);
+    }
+    public function updateUser()
+    {
+        $input['activated']=0;
+        $input=  array_merge($input,$this->input->post());
+        $this->load->model('collabolator_model');
+        if (strlen($input['full_name'])==0)
+        {
+            $result['errors'][]="TÃªn cá»ng tÃ¡c viÃªn khÃŽng ÄÆ°á»£c Äá» trá»ng";
+        }
+        if (strlen($input['login_name'])==0)
+        {
+            $result['errors'][]="TÃªn ÄÄng nháº­p khÃŽng ÄÆ°á»£c Äá» trá»ng";
+        }
+        else
+        {
+            if ($this->collabolator_model->isExist(array('field'=>'login_name','value'=>$input['login_name'],'id'=>$input['id'])))
+            {
+                $result['errors'][]="TÃªn ÄÄng nháº­p ÄÃ£ ÄÆ°á»£c sá»­ dá»¥ng";
+            }
+        }
+        if (strlen($input['cellphone'])==0)
+        {
+            $result['errors'][]="Sá» Äiá»n thoáº¡i khÃŽng ÄÆ°á»£c Äá» trá»ng";
+        }
+        else
+        {
+            if ($this->collabolator_model->isExist(array('field'=>'cellphone','value'=>$input['cellphone'],'id'=>$input['id'])))
+            {
+                $result['errors'][]="Sá» Äiá»n thoáº¡i ÄÃ£ ÄÆ°á»£c sá»­ dá»¥ng";
+            }
+        }
+        if (strlen($input['passwd'])==0)
+        {
+            //$result['errors'][]="Máº­t kháº©u khÃŽng ÄÆ°á»£c Äá» trá»ng";
+        }
+        if ($input['passwd'] != $input['passwd2'])
+        {
+            $result['errors'][]="Máº­t kháº©u khÃŽng trÃ¹ng nhau";
+        }
+        if (!isset($result['errors']))
+        {
+            unset($input['passwd2']);
+            $input['activated']=1;
+            $input['updated_time']=date("Y-m-d H:i:s");
+            $this->load->model('collabolator_model');
+            $this->collabolator_model->update($input['id'],$input);
+            $result['success'] = 1;
+        }
+        echo json_encode($result);
+    }
     public function test() {
         
-        $this->load->library('doctrine');
+       
         for ($i = 1; $i <= 500; $i++) {
-            $collaborator = new Entities\Tblcollaborator();
-            $collaborator->setActivated(rand(0, 1));
-            $collaborator->setAuthor(1);
-            $collaborator->setCellphone('0' . (1695061706 + $i));
-            $collaborator->setCreatedTime(date("Y-m-d H:i:s"));
-            $collaborator->setFullName("Full Name " . $i);
-            $collaborator->setLoginName("loginname" . $i);
-            $collaborator->setPasswd(md5("12345678"));
-            $collaborator->setUpdatedTime(date("Y-m-d H:i:s"));
-            try {
-                $this->doctrine->em->persist($collaborator);
-                $this->doctrine->em->flush();
-                $result['success'] = 1;
-            } catch (Exception $e) {
-
-                echo $e;
-            }
+            $input['full_name']="Full Name ".$i;
+            $input['login_name']="loginname".$i;
+            $input['passwd']=md5("12345678");
+            $input['cellphone']="01234567".(100+$i);
+            $input['activated']=rand(0,1);
+            $input['created_time']=date("Y-m-d H:i:s");
+            $input['updated_time']=date("Y-m-d H:i:s");
+            $this->load->model('collabolator_model');
+            $this->collabolator_model->insert($input);
         }
     }
Index: pro-violet-viettel/sourcecode/application/modules/admin/models/collabolator_model.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/admin/models/collabolator_model.php	(revision 397)
+++ pro-violet-viettel/sourcecode/application/modules/admin/models/collabolator_model.php	(revision 401)
@@ -12,5 +12,5 @@
     }
 
-    function getCollaborator($data) {
+    function getCollaborators($data) {
         $sql = "SELECT * FROM " . $this->table_name;
         if ($data['keyword']) {
@@ -36,6 +36,12 @@
 
     function isExist($data) {
-        $sql = "SELECT COUNT(id) as total FROM " . $this->table_name . " WHERE " . $data['field'] . " = '" . $data['value'] . "' LIMIT 1";
-        if ($this->db->query($sql)->row_array()['total'] == 1) {
+        $sql = "SELECT COUNT(id) as total FROM " . $this->table_name . " WHERE " . $data['field'] . " = '" . $data['value'] . "'";
+        if (isset($data['id']))
+        {
+            $id=$data['id'];
+            $sql.=" AND id <> ".$id." LIMIT 1";
+        }
+        $result = $this->db->query($sql)->row_array();
+        if ($result['total'] == 1) {
             return true;
         } else {
@@ -53,12 +59,12 @@
             }
         }
-        if (isset($this->db->query($sql)->row_array()['total']))
-        {
-        return $this->db->query($sql)->row_array()['total'];
-        }
-        else
-        {
-            return 0;
-        }
+        $result = $this->db->query($sql)->row_array();
+        return $result['total']; 
+    }
+    function getCollaborator($id)
+    {
+        $sql="SELECT * FROM ".$this->table_name." WHERE id=".$id." LIMIT 1";
+        $result = $this->db->query($sql)->row_array();
+        return $result;
     }
 
Index: pro-violet-viettel/sourcecode/application/modules/admin/views/collaborator/index.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/admin/views/collaborator/index.php	(revision 397)
+++ pro-violet-viettel/sourcecode/application/modules/admin/views/collaborator/index.php	(revision 401)
@@ -2,5 +2,5 @@
 $base_url = base_url();
 $this->load->view('layout/admin/header', array('base_url' => $base_url));
-$this->load->view('layout/admin/sidebar', array('base_url' => $base_url));
+$this->load->view('layout/admin/sidebar', array('base_url' => $base_url, 'method'=>$this->router->method, 'class'=>$this->router->class  ));
 ?>
 <script type="text/javascript">
@@ -35,5 +35,5 @@
         
         
-$( '.sorting, .sorting_desc, .sorting_asc' ).click(function( index ) {
+        $( '.sorting, .sorting_desc, .sorting_asc' ).click(function( index ) {
             var current_class=$( this ).attr('class');
             $(".sorting_desc").attr("class","sorting");
@@ -62,4 +62,16 @@
             filter();
         });
+        $('[data-toggle="ajaxModal"]').on('click',
+              function(e) {
+                $('#ajaxModal').remove();
+                e.preventDefault();
+                var $this = $(this)
+                  , $remote = $this.data('remote') || $this.attr('href')
+                  , $modal = $('<div class="modal" id="ajaxModal"><div class="modal-body"></div></div>');
+                $('body').append($modal);
+                $modal.modal({backdrop: 'static', keyboard: false});
+                $modal.load($remote);
+              }
+            );
 
 
Index: pro-violet-viettel/sourcecode/application/modules/admin/views/collaborator/listview.php
===================================================================
--- pro-violet-viettel/sourcecode/application/modules/admin/views/collaborator/listview.php	(revision 397)
+++ pro-violet-viettel/sourcecode/application/modules/admin/views/collaborator/listview.php	(revision 401)
@@ -83,6 +83,7 @@
                                     </label>
                                 </th>
+                             
+                                <th class="<?php if ($sorting_field == 'full_name') {echo $sorting_order;} else {echo "sorting";}?>" id="full_name" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 183px;" aria-label="Há» tÃªn: activate to sort column ascending">Há» tÃªn</th>
                                 <th class="<?php if ($sorting_field == 'cellphone') {echo $sorting_order;} else {echo "sorting";}?>" id="cellphone" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 176px;" aria-label="Sá» Äiá»n thoáº¡i: activate to sort column ascending">Sá» Äiá»n thoáº¡i</th>
-                                <th class="<?php if ($sorting_field == 'full_name') {echo $sorting_order;} else {echo "sorting";}?>" id="full_name" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 183px;" aria-label="Há» tÃªn: activate to sort column ascending">Há» tÃªn</th>
                                 <th class="sorting" id="money" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 122px;" aria-label="Tiá»n: activate to sort column ascending">Tiá»n</th>
                                 <th class="<?php if ($sorting_field == 'created_time') {echo $sorting_order;} else {echo "sorting";}?>" id="created_time" role="columnheader" tabindex="0" aria-controls="sample-table-2" rowspan="1" colspan="1" style="width: 209px;" aria-label="NgÃ y ÄÄng kÃœ: activate to sort column ascending">
@@ -107,8 +108,9 @@
                                 </td>
 
+                                
+                                <td class=" "><?php echo $collaborator['full_name']?></td>
                                 <td class=" ">
                                     <a href="#"><?php echo $collaborator['cellphone']?></a>
                                 </td>
-                                <td class=" "><?php echo $collaborator['full_name']?></td>
                                 <td class="hidden-480 ">3,330 VND</td>
                                 <td class=" "><?php echo $collaborator['created_time']?></td>
@@ -131,13 +133,13 @@
                                     <div class="visible-md visible-lg hidden-sm hidden-xs action-buttons">
                                         <a href="#" class="blue">
-                                            <i class="icon-zoom-in bigger-130"></i>
+                                            <i data-toggle="ajaxModal" href='http://viettel.violet.vn/admin/cong_tac_vien/xem/<?php echo $collaborator['id'];?>'  class="icon-zoom-in bigger-130"></i>
                                         </a>
 
                                         <a href="#" class="green">
-                                            <i class="icon-pencil bigger-130"></i>
+                                            <i data-toggle="ajaxModal" href='http://viettel.violet.vn/admin/cong_tac_vien/sua/<?php echo $collaborator['id'];?>' data-toggle="modal" href='#editUser' class="icon-pencil bigger-130"></i>
                                         </a>
 
                                         <a href="#" class="red">
-                                            <i class="icon-trash bigger-130"></i>
+                                            <i data-toggle="ajaxModal" href='http://viettel.violet.vn/admin/cong_tac_vien/xoa/<?php echo $collaborator['id'];?>' data-toggle="modal" href='#deleteUser' class="icon-trash bigger-130"></i>
                                         </a>
                                     </div>
Index: pro-violet-viettel/sourcecode/application/views/layout/admin/sidebar.php
===================================================================
--- pro-violet-viettel/sourcecode/application/views/layout/admin/sidebar.php	(revision 397)
+++ pro-violet-viettel/sourcecode/application/views/layout/admin/sidebar.php	(revision 401)
@@ -69,5 +69,5 @@
 								</li>
 
-								<li>
+								<li class="<?php if(in_array($class,array("collaborator"))) {echo "active";}?>">
 									<a href="<?php echo $base_url; ?>admin/cong_tac_vien">
 										<i class="icon-double-angle-right"></i>
