Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
smart_core_connect
/
core-connect
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
27bf0ff0
authored
May 16, 2018
by
opal007
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'integration' into opal007
parents
48ca970a
d68b3251
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
28 deletions
+52
-28
www/src/Controller/ProfilesController.php
+30
-3
www/src/Template/Profiles/index.ctp
+22
-25
No files found.
www/src/Controller/ProfilesController.php
View file @
27bf0ff0
...
@@ -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'
]);
]);
...
@@ -565,5 +567,30 @@ if (!empty($SubjectEnrolls)) {
...
@@ -565,5 +567,30 @@ if (!empty($SubjectEnrolls)) {
$this
->
viewBuilder
()
->
layout
(
'blank'
);
$this
->
viewBuilder
()
->
layout
(
'blank'
);
}
}
// 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;
// }
}
}
www/src/Template/Profiles/index.ctp
View file @
27bf0ff0
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment