Changeset 838
- Timestamp:
- Mar 27, 2015 9:49:55 AM (10 years ago)
- Location:
- pro-violet-viettel
- Files:
-
- 1 added
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
pro-violet-viettel/sourcecode/application/modules/admin/controllers/collaborator.php
r690 r838 9 9 parent::__construct(); 10 10 $this->load->helper('cookie'); 11 $this->load->helper('language'); 12 $this->lang->load('messages', 'message'); 11 13 } 12 14 … … 25 27 $this->load->helper('pagging'); 26 28 $this->load->model('collabolator_model'); 29 $provinces = lang('_PROVINCES_'); 27 30 $data['current_page'] = $this->uri->segment(4, 1); 28 31 $data['itemsoptions'] = array(10, 25, 50, 100); … … 62 65 $data['start'] = ($data['current_page'] - 1) * $data['perpage']; 63 66 $data['total'] = $this->collabolator_model->countCollaborator($data); 64 $data['collaborators'] = $this->collabolator_model->getCollaborators($data); 67 68 $collaborators = $this->collabolator_model->getCollaborators($data); 69 foreach ($collaborators as $index => $collaborator){ 70 $collaborator ['province'] = isset($provinces[$collaborator ['province']]) ? $provinces[$collaborator ['province']] : $collaborator ['province']; 71 $collaborators[$index] = $collaborator; 72 } 73 $data['collaborators'] = $collaborators; 65 74 66 75 $data['paging_url'] = base_url() . "/admin/cong_tac_vien/trang/"; -
pro-violet-viettel/sourcecode/application/modules/admin/controllers/reportAsistant.php
r742 r838 199 199 $data['num_links'] = 2; 200 200 $data['paging'] = pagging($data); 201 201 202 202 if ($this->input->is_ajax_request()) { 203 203 return $this->load->view('reportAsistant/listview_user', $data); -
pro-violet-viettel/sourcecode/application/modules/admin/models/admin_model.php
r770 r838 18 18 $result = $this->db->query($query, array($login_name, $hash_password)); 19 19 20 21 22 23 24 25 20 if($result->num_rows() == 1){ 21 $admin = $result->row(0); 22 $query="SELECT * FROM tbladminrole LEFT JOIN tblrole ON tbladminrole.role_id=tblrole.role_id WHERE tbladminrole.admin_id= ".$admin->admin_id; 23 $result2 = $this->db->query($query); 24 $admin->roles=$result2; 25 return $admin; 26 26 27 27 }else -
pro-violet-viettel/sourcecode/application/modules/admin/models/collabolator_model.php
r742 r838 17 17 if ($data['search_field'] == "cellphone") { 18 18 if(strlen($data['daterange_start'])>0){ 19 $sql.=" WHERE (cellphone LIKE '%" . $data['keyword'] . "%' OR district LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";19 $sql.=" WHERE (cellphone LIKE '%" . $data['keyword'] . "%' OR full_name LIKE '%".$data['keyword']."%' OR district LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')"; 20 20 }else{ 21 $sql.=" WHERE (cellphone LIKE '%" . $data['keyword'] . "%' OR district LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%')";21 $sql.=" WHERE (cellphone LIKE '%" . $data['keyword'] . "%' OR full_name LIKE '%".$data['keyword']."%' OR district LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%')"; 22 22 } 23 23 } else { … … 215 215 if ($data['search_field'] == "cellphone") { 216 216 if(strlen($data['daterange_start'])>0){ 217 $sql.=" WHERE (cellphone LIKE '%" . $data['keyword'] . "%' OR district LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')";217 $sql.=" WHERE (cellphone LIKE '%" . $data['keyword'] . "%' OR full_name LIKE '%".$data['keyword']."%' OR district LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%') AND (created_time BETWEEN '".$data['daterange_start']."' AND '".$data['daterange_end']."')"; 218 218 }else{ 219 $sql.=" WHERE (cellphone LIKE '%" . $data['keyword'] . "%' OR district LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%')";219 $sql.=" WHERE (cellphone LIKE '%" . $data['keyword'] . "%' OR full_name LIKE '%".$data['keyword']."%' OR district LIKE '%".$data['keyword']."%' OR province LIKE '%".$data['keyword']."%')"; 220 220 } 221 221 } else { … … 439 439 } 440 440 441 function check_login($login_name, $password) 442 { 443 $hash_password = md5($password); 444 $query = "SELECT * FROM tblcollaborator WHERE login_name = ? AND passwd = ?"; 445 $result = $this->db->query($query, array($login_name, $hash_password)); 446 if($result->num_rows() == 1){ 447 $collaborator = $result->row(0); 448 return $collaborator; 449 450 }else 451 { 452 return null; 453 } 454 } 455 441 456 } -
pro-violet-viettel/sourcecode/application/modules/admin/models/reportmodel.php
r818 r838 33 33 34 34 // tinh doanh thu theo thang 35 $from = "tblpaidlog.paid_time >= '" . $input ['year'] . "-" . $input ['month'] . "-01 00:00:00'"; 35 36 $sql = "SELECT *,SUM(amount) as total FROM tblpaidlog LEFT JOIN tbluser ON tbluser.us_id=tblpaidlog.us_id WHERE $from AND $to GROUP BY tbluser.province"; 36 37 $query = $this->db->query ( $sql ); … … 133 134 $data['totalDtn'] = $totalDtn; 134 135 135 //return $provinces;136 136 return $data; 137 137 } -
pro-violet-viettel/sourcecode/application/modules/admin/views/collaborator/listview.php
r719 r838 97 97 } 98 98 ?>" 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> 99 <th>Há» và tên</th> 99 100 <th>Quáºn/Huyá»n</th> 100 101 <th>Tá»nh/TP</th> … … 130 131 131 132 <td class=" "><a href="<?php echo base_url(); ?>admin/thong_ke_cong_tac_vien/<?php echo $collaborator['id']; ?>"><?php echo $collaborator['cellphone']; ?></a></td> 133 <td class=" "><?php echo $collaborator['full_name']; ?></td> 132 134 <td class=" "><?php echo $collaborator['district']; ?></td> 133 135 <td class=" "><?php echo $collaborator['province']; ?></td> -
pro-violet-viettel/sourcecode/application/modules/admin/views/reportprovince/province.php
r818 r838 109 109 <td style="font-weight:bold;"><?php echo $totalTbn; ?></td> 110 110 <td style="font-weight:bold;"><?php echo $totalDtng; ?></td> 111 <td style="font-weight:bold;"><?php echo $totalDt ng; ?></td>111 <td style="font-weight:bold;"><?php echo $totalDtth; ?></td> 112 112 <td style="font-weight:bold;"><?php echo $totalDtn; ?></td> 113 113 -
pro-violet-viettel/sourcecode/application/modules/frontend/controllers/home.php
r707 r838 179 179 return 0; 180 180 } 181 182 public function test(){ 183 $provinces = lang('_PROVINCES_'); 184 $this->load->library("PHPExcel"); 185 $file = './assets/danhsachquanhuyen.xls'; 186 $objPHPExcel = PHPExcel_IOFactory::load($file); 187 $cell_collection = $objPHPExcel->getActiveSheet()->getCellCollection(); 188 foreach ($cell_collection as $cell) { 189 $column = $objPHPExcel->getActiveSheet()->getCell($cell)->getColumn(); 190 $row = $objPHPExcel->getActiveSheet()->getCell($cell)->getRow(); 191 $data_value = $objPHPExcel->getActiveSheet()->getCell($cell)->getValue(); 192 193 if ($row == 1) { 194 $header[$row][$column] = $data_value; 195 } else { 196 $arr_data[$row][$column] = $data_value; 197 } 198 } 199 200 $data['header'] = $header; 201 $data['values'] = $arr_data; 202 203 foreach ($data['values'] as $index => $value){ 204 foreach ($provinces as $provinceId => $province){ 205 if ($value['C'] == $province) $data['values'][$index]['C'] = $provinceId; 206 if ($value['B'] >= 10){ 207 $data['values'][$index]['B'] = "0".$value['B']; 208 }else{ 209 $data['values'][$index]['B'] = "00".$value['B']; 210 } 211 } 212 213 } 214 215 $dt = array(); 216 foreach ($data['values'] as $index => $value){ 217 218 $dt[$index]['district_id'] = $value['B']; 219 $dt[$index]['province_id'] = $value['C']; 220 $dt[$index]['district_name'] = $value['D']; 221 $dt[$index]['type'] = $value['E']; 222 } 223 //var_dump($dt); 224 //$this->load->model ( 'user_model' ); 225 //$result = $this->user_model->insertDistrict($dt); 226 //var_dump($result); 227 } 181 228 } 182 229 -
pro-violet-viettel/sourcecode/application/modules/frontend/controllers/user.php
r818 r838 62 62 $us_id = $user_info['us_id']; 63 63 $user = $this->user_model->get_user_by_id($us_id); 64 //$us = array(); 65 $user['district'] = $this->user_model->getDistrictByIdAndProvince($user['district'], $user['province']); 66 64 67 $result['can_buy'] = 1; 65 68 $result['can_edit'] = 0; … … 140 143 //$user = $this->user_model->get_user_by_id($us_id); 141 144 $user = $this->user_model->getUserById($us_id); 145 //$user['district'] = $this->user_model->getDistrictByIdAndProvince($user['district'], $user['province']); 142 146 $package = $this->servicepackage_model->getPackage($input['p_id']); 143 147 $user['acc_balanced'] = $user['acc_balanced'] - $package['p_price']; … … 150 154 $user['p_id'] = $package['p_id']; 151 155 $user['province'] = $input['province']; 156 $user['district'] = $input['district']; 152 157 $this->user_model->updateUser($us_id, $user); 153 158 $user['expire_date'] = date("d-m-Y", (strtotime($user['expire_date']))); … … 172 177 173 178 $user = $this->user_model->get_user_by_id($us_id); 179 $user['district'] = $this->user_model->getDistrictByIdAndProvince($user['district'], $user['province']); 174 180 $package = $this->servicepackage_model->getPackage($p_id); 175 181 … … 207 213 parse_str($user); 208 214 $us = $this->user_model->get_user_by_id($us_id); 215 $us['district'] = $this->user_model->getDistrictByIdAndProvince($us['district'], $province); 209 216 $data = array('us_id' => $us_id, 'username' => $username, 'fullname' => $fullname, 210 'gender' => $gender, 'email' => $email, 'phone' => $phone, 'school' => $school, 'province' => $province, 217 'gender' => $gender, 'email' => $email, 'phone' => $phone, 'school' => $school, 'province' => $province, 'district' => $us['district'], 211 218 'acc_balanced' => $us['acc_balanced'], 'expire_date' => $us['expire_date'], 'date_diff' => $this->dateDiff($us['expire_date']) 212 219 ); … … 476 483 477 484 } 485 486 function getDistrict(){ 487 488 $user_info = $this->session->userdata('userInfo'); 489 if ($user_info) { 490 $result = array(); 491 $provinceId = $this->uri->segment(4); 492 $this->load->model ( 'user_model' ); 493 if ($provinceId){ 494 $results = $this->user_model->getDistrictByProvince($provinceId); 495 } 496 echo json_encode($results); 497 }else{ 498 show_404(); 499 } 500 501 } 478 502 479 503 } -
pro-violet-viettel/sourcecode/application/modules/frontend/models/user_model.php
r818 r838 173 173 ), 'user' ); 174 174 $u = array('province'=>$user['province'], 175 'district' => $user['district'], 175 176 'updated_time'=>date('Y-m-d H:i:s') 176 177 ); … … 617 618 } 618 619 620 public function getDistrictByProvince($provinceId){ 621 $sql = "SELECT * FROM tbldistrict WHERE province_id = ?"; 622 $query = $this->db->query ( $sql, array ( 623 $provinceId 624 ) ); 625 $results = $query->result_array(); 626 return $results; 627 } 628 629 public function insertDistrict($data){ 630 $this->db->insert_batch('tbldistrict', $data); 631 return $this->db->affected_rows(); 632 } 633 634 public function getDistrictByIdAndProvince($districtId, $provinceId){ 635 $sql = "SELECT * FROM tbldistrict WHERE district_id = ? AND province_id = ?"; 636 $query = $this->db->query ( $sql,array ($districtId, $provinceId) ); 637 if ($query->num_rows () > 0) { 638 $row = $query->row_array (); 639 return $row; 640 } 641 } 642 619 643 } -
pro-violet-viettel/sourcecode/application/modules/frontend/views/lecture_editor.php
r819 r838 92 92 </div> 93 93 </div> 94 <div class="form-group"> 95 <label for="form-field-username" class="col-sm-4 control-label no-padding-right">Quáºn / Huyá»n</label> 96 <div class="col-sm-8"> 97 <select name="district" id="form-field-district" class="input-large"></select> 98 </div> 99 </div> 94 100 95 101 Lưu Ü: -
pro-violet-viettel/sourcecode/application/modules/frontend/views/package_register_modal.php
r753 r838 48 48 <label for="form-field-province" class="col-sm-4 control-label no-padding-right">Tá»nh / Thà nh phá»</label> 49 49 <div class="col-sm-8"> 50 <select name="province" id="form-field-province" class=" input-large">50 <select name="province" id="form-field-province" class="form-field-province input-large"> 51 51 <option></option> 52 52 <?php foreach (lang('_PROVINCES_') as $key=>$pro):?> … … 56 56 </div> 57 57 </div> 58 <!--div class="form-group"> 59 <label for="form-field-district" class="col-sm-4 control-label no-padding-right">Quáºn / Huyá»n</label> 60 58 <div class="form-group"> 59 <label for="form-field-username" class="col-sm-4 control-label no-padding-right">Quáºn / Huyá»n</label> 61 60 <div class="col-sm-8"> 62 <input type="text" name="district" value="<?php echo $user['district']; ?>" placeholder="Quáºn / Huyá»n" id="form-field-district" class="input-large"> 61 <select name="district" id="form-field-district" class="form-field-district input-large"> 62 63 </select> 63 64 </div> 64 </div -->65 </div> 65 66 66 67 <?php if ($can_edit == 1) { ?> -
pro-violet-viettel/sourcecode/application/modules/frontend/views/user_infor.php
r773 r838 22 22 </div> 23 23 24 <div class="col-xs-12" style="margin: 5px;">25 <div class="form-group">26 <label for="form-field-username" class="col-sm-4 control-label no-padding-right">Quáºn / Huyá»n</label>27 <div class="col-sm-8">28 <input type="text" name="district" value="<?php echo $user['district']; ?>" placeholder="Quáºn / Huyá»n" id="form-field-username" class="col-xs-12 col-sm-10">29 </div>30 </div>31 </div>32 33 24 <div class="col-xs-12" style="margin: 5px;"> 34 25 <div class="form-group"> 35 26 <label for="form-field-username" class="col-sm-4 control-label no-padding-right">Tá»nh / Thà nh phá»</label> 36 27 <div class="col-sm-8"> 37 <select name="province" id="form-field-province" class=" col-xs-12 col-sm-10">28 <select name="province" id="form-field-province" class="form-field-province col-xs-12 col-sm-10"> 38 29 <?php foreach ($provinces as $key => $pro): ?> 39 30 <option value="<?php echo $key; ?>" <?php if ($user['province'] == $key) echo "selected"; ?>><?php echo $pro; ?></option> … … 43 34 </div> 44 35 </div> 36 <div class="col-xs-12" style="margin: 5px;"> 37 <div class="form-group"> 38 <label for="form-field-username" class="col-sm-4 control-label no-padding-right">Quáºn / Huyá»n</label> 39 <div class="col-sm-8"> 40 <select name="district" id="form-field-district" class="form-field-district col-xs-12 col-sm-10"> 41 42 </select> 43 </div> 44 </div> 45 </div> 45 46 46 47 <input type="hidden" name="us_id" value="<?php echo $user['us_id'] ?>"> … … 56 57 ?> 57 58 </form> 59 <script> 60 var district_id = "<?php echo $user['district']; ?>"; 61 $(".form-field-province").change(function(){ 62 changeEventProvince(); 63 }); 64 if ($(".form-field-province").val() !== 'undefined'){ 65 checkSelecteDistrict(); 66 } 67 </script> -
pro-violet-viettel/sourcecode/application/modules/frontend/views/user_profile.php
r773 r838 96 96 97 97 <div class="space-4"></div> 98 98 99 99 <div class="form-group"> 100 100 <label for="form-field-username" class="col-sm-4 control-label no-padding-right">Tá»nh / Thà nh phá»</label> 101 101 102 102 <div class="col-sm-8"> 103 <!--input type="text" name="province" value="<?php echo @$province; ?>" placeholder="Tá»nh / Thà nh phá»" id="form-field-province" class="col-xs-12 col-sm-10"-->104 <select name="province" id="form-field-province" class=" col-xs-12 col-sm-10">103 104 <select name="province" id="form-field-province" class="form-field-province col-xs-12 col-sm-10"> 105 105 <option></option> 106 106 <?php foreach ($provinces as $key=>$pro):?> … … 110 110 </div> 111 111 </div> 112 <!--div class="form-group"> 112 <div class="space-4"></div> 113 <div class="form-group"> 113 114 <label for="form-field-username" class="col-sm-4 control-label no-padding-right">Quáºn / Huyá»n</label> 114 115 <div class="col-sm-8"> 116 <input type="text" name="district" value="<?php echo @$district; ?>" placeholder="Quáºn / Huyá»n" id="form-field-district" class="col-xs-12 col-sm-10"> 117 </div> 118 </div--> 115 <div class="col-sm-8"> 116 <select name="district" id="form-field-district" class="form-field-district col-xs-12 col-sm-10"> 117 118 </select> 119 </div> 120 </div> 121 119 122 120 123 </div> … … 516 519 <script type="text/javascript"> 517 520 var url="<?php echo base_url();?>"; 521 var district_id = "<?php echo $district; ?>"; 518 522 var current_tab="<?php echo $current_tab;?>"; 519 523 //var current_balanced = <?php echo $acc_balanced; ?>; -
pro-violet-viettel/sourcecode/application/modules/services/controllers/sync.php
r822 r838 39 39 foreach($lst as $item){ 40 40 $item = (array)$item; 41 41 $phoneNumber = $this->Services_model->formatPhoneNumber((string)$item['phone'], 2); 42 42 $data = array( 43 43 'address'=> (string)$item['address'], … … 47 47 'id'=>(int)$item['id'], 48 48 'full_name'=>(string)$item['name'], 49 'cellphone'=>(string)$item['phone'], 49 'passwd' => md5($phoneNumber), 50 'cellphone'=>$phoneNumber, 50 51 'precinct'=>(string)$item['precinct'], 51 52 'province'=>(string)$item['province'], -
pro-violet-viettel/sourcecode/application/modules/services/models/services_model.php
r822 r838 449 449 */ 450 450 public function formatPhoneNumber ($phoneNumber, $direction = 1) { 451 $result = $phoneNumber; 451 452 $aryMatch = array(); 452 453 if (preg_match('/^(84)([0-9]{9,10})$/', $phoneNumber, $aryMatch) == 1 && $direction == 1) { … … 461 462 else if (preg_match('/^(0)([0-9]{9,10})$/', $phoneNumber, $aryMatch) == 1 && $direction == -1) { 462 463 $result = '84'. $aryMatch[2]; 464 } 465 else if (preg_match('/^[1,9]([0-9]{8,9})$/', $phoneNumber, $aryMatch) == 1 && $direction = 2) { 466 $result = '0'. $phoneNumber; 463 467 } 464 468 … … 473 477 district = "'.$data['district'].'", 474 478 email = "'.$data['email'].'", 475 full_name = "'.$data['full_name'].'", 479 full_name = "'.$data['full_name'].'", 480 passwd = "'.$data['passwd'].'", 476 481 cellphone = "'.$data['cellphone'].'", 477 482 precinct = "'.$data['precinct'].'", -
pro-violet-viettel/sourcecode/assets/css/custom.css
r707 r838 310 310 311 311 #form-field-province {padding-left: 0;} 312 #form-field-district {padding-left: 0;} -
pro-violet-viettel/sourcecode/assets/js/admin/user.js
r818 r838 60 60 success: function(data) 61 61 { 62 63 62 results = jQuery.parseJSON(data); 64 65 63 $("#content-trade-histoty").html(results.modal); 66 67 64 } 68 65 }); … … 99 96 }); 100 97 } 98 99 function checkSelecteDistrict(){ 100 provinceId = $(".form-field-province").val(); 101 $.ajax({ 102 url: '/frontend/user/getDistrict/' + provinceId, 103 type: 'POST', 104 success: function (data, textStatus, jqXHR) 105 { 106 result = jQuery.parseJSON(data); 107 content = ""; 108 if (result != null){ 109 for (var i in result){ 110 if (result[i].district_id === district_id){ 111 content = content + '<option value="' + result[i].district_id + '" selected >' + result[i].type + " " + result[i].district_name + '</option>'; 112 }else{ 113 content = content + '<option value="' + result[i].district_id + '">' + result[i].type + " " + result[i].district_name + '</option>'; 114 } 115 } 116 $(".form-field-district").html(content); 117 } 118 } 119 }); 120 } 121 122 function changeEventProvince(){ 123 $(".form-field-district").html(""); 124 provinceId = $("#form-field-province").val(); 125 $.ajax({ 126 url: '/frontend/user/getDistrict/' + provinceId, 127 type: 'POST', 128 success: function (data, textStatus, jqXHR) 129 { 130 result = jQuery.parseJSON(data); 131 content = ""; 132 if (result != null){ 133 for (var i in result){ 134 content = content + '<option value="' + result[i].district_id + '">'+ result[i].type + " " + result[i].district_name + '</option>' 135 } 136 $(".form-field-district").html(content); 137 } 138 } 139 }); 140 } -
pro-violet-viettel/sourcecode/assets/js/frontend/lecture.js
r765 r838 193 193 }); 194 194 195 }) 195 }); 196 197 if ($("#form-field-province").val() !== 'undefined'){ 198 provinceId = $("#form-field-province").val(); 199 $.ajax({ 200 url: 'user/getDistrict/' + provinceId, 201 type: 'POST', 202 success: function (data, textStatus, jqXHR) 203 { 204 result = jQuery.parseJSON(data); 205 content = ""; 206 if (result != null){ 207 for (var i in result){ 208 content = content + '<option value="' + result[i].district_id + '">' + result[i].district_name + '</option>' 209 } 210 $("#form-field-district").html(content); 211 } 212 } 213 }); 214 } 215 216 $("#form-field-province").change(function(){ 217 provinceId = this.value; 218 $.ajax({ 219 url: 'user/getDistrict/' + provinceId, 220 type: 'POST', 221 success: function (data, textStatus, jqXHR) 222 { 223 result = jQuery.parseJSON(data); 224 content = ""; 225 if (result != null){ 226 for (var i in result){ 227 content = content + '<option value="' + result[i].district_id + '">' + result[i].district_name + '</option>' 228 } 229 $("#form-field-district").html(content); 230 } 231 } 232 }); 233 }); -
pro-violet-viettel/sourcecode/assets/js/frontend/user.js
r820 r838 1 1 function updateInfo(us_id) { 2 2 $.ajax({ 3 url: ' update_user/' + us_id,3 url: '/frontend/user/update_user/' + us_id, 4 4 type: 'POST', 5 5 data: $("#frm1").serialize(), … … 42 42 $("#account-info-tab").click(); 43 43 }); 44 45 46 if ($(".form-field-province").val() !== 'undefined'){ 47 checkSelecteDistrict(); 48 } 49 $(".form-field-province").change(function(){ 50 changeEventProvince(); 51 }); 52 53 54 44 55 $("#finish_package_register").click(function () { 45 56 finish_package_register(); … … 274 285 return x1 + x2; 275 286 } 287 288 function checkSelecteDistrict(){ 289 provinceId = $(".form-field-province").val(); 290 $.ajax({ 291 url: '/frontend/user/getDistrict/' + provinceId, 292 type: 'POST', 293 success: function (data, textStatus, jqXHR) 294 { 295 result = jQuery.parseJSON(data); 296 content = ""; 297 if (result != null){ 298 for (var i in result){ 299 if (result[i].district_id === district_id){ 300 content = content + '<option value="' + result[i].district_id + '" selected >' + result[i].type + " " + result[i].district_name + '</option>'; 301 }else{ 302 content = content + '<option value="' + result[i].district_id + '">' + result[i].type + " " + result[i].district_name + '</option>'; 303 } 304 } 305 $(".form-field-district").html(content); 306 } 307 } 308 }); 309 } 310 311 if ($(".form-field-province").val() !== 'undefined'){ 312 checkSelecteDistrict(); 313 } 314 315 function changeEventProvince(){ 316 $(".form-field-district").html(""); 317 provinceId = $("#form-field-province").val(); 318 $.ajax({ 319 url: '/frontend/user/getDistrict/' + provinceId, 320 type: 'POST', 321 success: function (data, textStatus, jqXHR) 322 { 323 result = jQuery.parseJSON(data); 324 content = ""; 325 if (result != null){ 326 for (var i in result){ 327 content = content + '<option value="' + result[i].district_id + '">'+ result[i].type + " " + result[i].district_name + '</option>' 328 } 329 $(".form-field-district").html(content); 330 } 331 } 332 }); 333 } 334 335 $(".form-field-province").change(function(){ 336 changeEventProvince(); 337 });
Note: See TracChangeset
for help on using the changeset viewer.