Commit 27bf0ff0 by opal007

Merge branch 'integration' into opal007

parents 48ca970a d68b3251
...@@ -24,7 +24,8 @@ class ProfilesController extends AppController ...@@ -24,7 +24,8 @@ class ProfilesController extends AppController
$this->loadModel('MasterCountries'); $this->loadModel('MasterCountries');
$Country = $this->MasterCountries->find('list', [ $Country = $this->MasterCountries->find('list', [
'conditions' => [ 'conditions' => [
'is_used' => true], 'is_used' => true,
'MasterCountries.id' => 1],
'keyField' => 'id', 'keyField' => 'id',
'valueField' => 'country_name_th' 'valueField' => 'country_name_th'
]); ]);
...@@ -34,7 +35,8 @@ class ProfilesController extends AppController ...@@ -34,7 +35,8 @@ class ProfilesController extends AppController
$this->loadModel('MasterProvinces'); $this->loadModel('MasterProvinces');
$Province = $this->MasterProvinces->find('list', [ $Province = $this->MasterProvinces->find('list', [
'conditions' => [ 'conditions' => [
'is_used' => true], 'is_used' => true,
'master_country_id' => 1],
'keyField' => 'id', 'keyField' => 'id',
'valueField' => 'province_name_th' 'valueField' => 'province_name_th'
]); ]);
...@@ -566,4 +568,29 @@ if (!empty($SubjectEnrolls)) { ...@@ -566,4 +568,29 @@ if (!empty($SubjectEnrolls)) {
} }
// public function getProvince() {
// $this->autoRender = false;
// $this->loadModel('MasterProvinces');
// $states = array();
// // pr($this->request->data);die;
// // echo 'jjjj';
// $states = $this->MasterProvinces->find('list', array(
// 'keyField' => 'id',
// 'valueField' => 'province_name_th',
// 'conditions' => array(
// 'master_country_id' => 2
// )
// ))->toArray();
// $arr = array();
// foreach($states as $key => $val){
// $arr[$key] = $val;
// }
// //pr($states);die;
// // $arr['1'] = "ไทยยยย";
// // $arr['2'] = "ไทยยยยยยยยยย";
// echo json_encode($arr);
// // $data = jQuery.parseJSON($f);
// // pr($data);die;
// }
} }
...@@ -200,29 +200,25 @@ ...@@ -200,29 +200,25 @@
//================================================== //==================================================
// CHANGE Province According Country // CHANGE Province According Country
//================================================== //==================================================
$(document).ready(function() { // $(document).ready(function() {
$("#loding1").hide(); // $("#loding1").hide();
$("#loding2").hide(); // $("#loding2").hide();
$("#master_country_id").on('change',function() { // $("#master_country_id").on('change',function() {
var id = $(this).val(); // var id = $(this).val();
$("#loding1").show(); // // alert('dddd');
$("#master_province_id").find('option').remove(); // $("#loding1").show();
if (id) { // $("#master_province_id").find('option').remove();
var dataString = 'id='+ id; // if (id) {
$.ajax({ // var dataString = 'id='+ id;
type: "POST", // alert(dataString);
url: '/Profiles/index', // $.post("/Profiles/getProvince", {id: id}, function(data) {
data: dataString, // console.log(data);
cache: false, // data = jQuery.parseJSON(data);
success: function(html) { // console.log(data);
$("#loding1").hide(); // });
$.each(html, function(key, value) { // // $('<option>').val('').text('---Select---');
$('<option>').val('').text('select'); // // $('<option>').val(key).text(value).appendTo($("#master_province_id"));
$('<option>').val(key).text(value).appendTo($("#master_province_id")); // }
}); // });
} // });
});
}
});
});
</script> </script>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment