Commit 868107e4 by Wittaya-PIM

Merge branch 'integration' into wittaya

parents 304670a3 46092de0
...@@ -20,6 +20,11 @@ class ProfilesController extends AppController ...@@ -20,6 +20,11 @@ class ProfilesController extends AppController
]); ]);
$username = $responseUserProfile['username']; $username = $responseUserProfile['username'];
$this->loadModel('UserPersonals');
$responseUserPersonal = $this->UserPersonals->get($id, [
'contain' => []
]);
//********DropdownCountry******** //********DropdownCountry********
$this->loadModel('MasterCountries'); $this->loadModel('MasterCountries');
$Country = $this->MasterCountries->find('list', [ $Country = $this->MasterCountries->find('list', [
...@@ -28,6 +33,7 @@ class ProfilesController extends AppController ...@@ -28,6 +33,7 @@ class ProfilesController extends AppController
'keyField' => 'id', 'keyField' => 'id',
'valueField' => 'country_name_th' 'valueField' => 'country_name_th'
]); ]);
// pr($responseUserPersonal['master_country_id']);die;
if(!empty($Country)) $Country = $Country->toArray(); if(!empty($Country)) $Country = $Country->toArray();
//********DropdownProvince******** //********DropdownProvince********
...@@ -37,14 +43,11 @@ class ProfilesController extends AppController ...@@ -37,14 +43,11 @@ class ProfilesController extends AppController
'is_used' => true], 'is_used' => true],
'keyField' => 'id', 'keyField' => 'id',
'valueField' => 'province_name_th' 'valueField' => 'province_name_th'
]); ])->where(['master_country_id =' => $responseUserPersonal['master_country_id']]);
// pr($Province);die;
if(!empty($Province)) $Province = $Province->toArray(); if(!empty($Province)) $Province = $Province->toArray();
$this->loadModel('UserPersonals'); $res = $responseUserPersonal['birthdate'];
$responseUserProfile = $this->UserPersonals->get($id, [
'contain' => []
]);
$res = $responseUserProfile['birthdate'];
$dateNow = $res->i18nFormat('dd/MM/yyyy'); $dateNow = $res->i18nFormat('dd/MM/yyyy');
if ($this->request->is(['patch', 'post', 'put'])) { if ($this->request->is(['patch', 'post', 'put'])) {
...@@ -104,7 +107,7 @@ class ProfilesController extends AppController ...@@ -104,7 +107,7 @@ class ProfilesController extends AppController
} }
$this->Flash->error(__('Not update. Please, try again.')); $this->Flash->error(__('Not update. Please, try again.'));
} }
$this->set(compact('userPersonals', 'responseUserProfile', 'dateNow', 'username', 'Country', 'Province')); $this->set(compact('userPersonals', 'responseUserProfile', 'dateNow', 'username', 'Country', 'Province', 'responseUserPersonal'));
$this->set('_serialize', ['userPersonals', 'responseUserProfile', 'dateNow', 'username', 'Country', 'Province']); $this->set('_serialize', ['userPersonals', 'responseUserProfile', 'dateNow', 'username', 'Country', 'Province']);
} }
......
...@@ -114,26 +114,6 @@ class UsersController extends AppController ...@@ -114,26 +114,6 @@ class UsersController extends AppController
$this->viewBuilder()->layout('blank'); $this->viewBuilder()->layout('blank');
} }
// public function getProvince() {
// $this->autoRender = false;
// $this->loadModel('MasterProvinces');
// $states = array();
// pr($this->request->$data);die;
// if (isset($this->request['data']['id'])) {
// $states = $this->MasterProvinces->find('list', array(
// 'keyField' => 'id',
// 'valueField' => ['country_name_th'],
// 'conditions' => array(
// 'State.countries_id' => $this->request['data']['id']
// )
// ));
// }
// header('Content-Type: application/json');
// pr($states);die;
// echo json_encode($states);
// exit();
// }
#--------------------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------------------
...@@ -220,7 +200,7 @@ class UsersController extends AppController ...@@ -220,7 +200,7 @@ class UsersController extends AppController
// $this->Flash->success(__('The register success.')); // $this->Flash->success(__('The register success.'));
return $this->redirect(['controller' => 'Users', 'action' => 'pinCode/'.$users['token']]); return $this->redirect(['controller' => 'Users', 'action' => 'pinCode/'.$users['token']]);
return $this->redirect(['action' => 'signin']); // return $this->redirect(['action' => 'signin']);
} }
$this->Flash->error(__('Username or Email Address already used by others.')); $this->Flash->error(__('Username or Email Address already used by others.'));
return $this->redirect(['action' => 'signup']); return $this->redirect(['action' => 'signup']);
...@@ -289,7 +269,7 @@ class UsersController extends AppController ...@@ -289,7 +269,7 @@ class UsersController extends AppController
public function pinCode($token=null) public function pinCode($token=null)
{ {
if(empty($token)) die; if(empty($token))
$this->viewBuilder()->layout('blank'); $this->viewBuilder()->layout('blank');
...@@ -300,8 +280,8 @@ class UsersController extends AppController ...@@ -300,8 +280,8 @@ class UsersController extends AppController
$http = new Client(); $http = new Client();
#$response = json_decode($http->post($api_core_verify_pin_code,$data)->body(),'_full'); #$response = json_decode($http->post($api_core_verify_pin_code,$data)->body(),'_full');
$response = $http->post($api_core_verify_pin_code,$data)->body(); $response = $http->post($api_core_verify_pin_code,$data)->body();
$response = json_decode($response,'_full'); $response = json_decode($response,'_full');
if(!empty($response)){ if(!empty($response)){
if(trim($response['status']) == 'Success'){ if(trim($response['status']) == 'Success'){
$this->Flash->success(__('Verify Completed.')); $this->Flash->success(__('Verify Completed.'));
...@@ -316,43 +296,11 @@ class UsersController extends AppController ...@@ -316,43 +296,11 @@ class UsersController extends AppController
} }
#--------------------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------------------
#Forgot Password
// public function forgotPassword()
// {
// $this->viewBuilder()->layout('blank');
// $data = $this->request->data();
// #$data['data']['ip'] = $this->request->clientIp();
// if(!empty($data)){
// if(!empty($data['data']['username'])){ #---------------------------------------------------------------------------------------------------
// $data['data']['ip'] = $this->request->clientIp();#prr($data);
// $api_core_forgotPassword = Configure::read('Config.apiCore.forgotPassword');
// $http = new Client();
// $response = $http->post($api_core_forgotPassword,$data['data'])->body();
// $response = json_decode($response,'_full');#debug($response);
// if(!empty($response)){
// if(trim($response['status']) == 'Success'){
// $this->Flash->success(__('Completed.'));
// return $this->redirect(['controller' => 'Users', 'action' => 'signin']);
// }else{
// $this->Flash->error(__('Forgot Password Fail'));
// return $this->redirect(['controller' => 'Users', 'action' => 'forgotPassword']);
// }
// }else{
// $this->Flash->error(__('Forgot Password Fail'));
// return $this->redirect(['controller' => 'Users', 'action' => 'forgotPassword']);
// }
// }else{
// $this->Flash->error(__('Data Empty'));
// return $this->redirect(['controller' => 'Users', 'action' => 'forgotPassword']);
// }
// }
// }
public function forgotPassword() public function forgotPassword()
{ {
...@@ -361,41 +309,46 @@ class UsersController extends AppController ...@@ -361,41 +309,46 @@ class UsersController extends AppController
if ($this->request->is('post')) { if ($this->request->is('post')) {
$hasher = new DefaultPasswordHasher(); $hasher = new DefaultPasswordHasher();
$email = $this->request->data['email']; $email = $this->request->data['email'];
//-------------------Random--------------------------------------------------------------- //-------------------RandomPassword---------------------------------------------------------
$alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'; // $alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
$pass = array(); // $pass = array();
$alphaLength = strlen($alphabet) - 1; // $alphaLength = strlen($alphabet) - 1;
for ($i = 0; $i < 8; $i++) { // for ($i = 0; $i < 8; $i++) {
$n = rand(0, $alphaLength); // $n = rand(0, $alphaLength);
$pass[] = $alphabet[$n]; // $pass[] = $alphabet[$n];
} // }
$password = implode($pass); // $password = implode($pass);
//------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------
$users['password'] = $hasher->hash($password);
// $users['password'] = $hasher->hash($password);
$user_personals = $this->UserPersonals->find('all',[ $user_personals = $this->UserPersonals->find('all',[
'conditions' => [ 'conditions' => [
'UserPersonals.email' => $email 'UserPersonals.email' => $email
] ]
])->first(); ])->first();
pr($password);
if(!empty($user_personals)){ if(!empty($user_personals)){
//--------------------ตัวส่ง Email --------------------------------------------------------- //--------------------ตัวส่ง Email ---------------------------------------------------------
// pr($user_personals);die; // pr($user_personals);die;
// $data_notification = []; // $data_notification = [];
// $data_notification['email'] = $this->request->data['email']; // $data_notification['email'] = $this->request->data['email'];
// $data_notification['pin_code'] = $password; // $data_notification['pin_code'] = $users['pin_pass'];
// $this->notification($data_notification); // $this->notification($data_notification);
//---------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------
$users = $this->Users->find('all',[ $users = $this->Users->find('all',[
'conditions' => [ 'conditions' => [
'Users.id' => $user_personals['user_id'] 'Users.id' => $user_personals['user_id']
] ]
])->first(); ])->first();
pr($users);die; $digits = 4;
$users = $this->Users->patchEntity($users, $this->request->getData()); $users['pin_pass'] = str_pad(rand(0, pow(10, $digits)-1), $digits, '0', STR_PAD_LEFT);
$token = $users['token'];
// pr($users);die;
// $users = $this->Users->patchEntity($users, $this->request->getData());
$this->Users->save($users); $this->Users->save($users);
// pr($users);die;
$this->Flash->success(__('send password to email success')); $this->Flash->success(__('send password to email success'));
return $this->redirect(['action' => 'signin']); return $this->redirect(['action' => 'pinCodepassword/'.$token]);
}else{ }else{
$this->Flash->error(__('Invalid Email.')); $this->Flash->error(__('Invalid Email.'));
return $this->redirect(['action' => 'forgot-password']); return $this->redirect(['action' => 'forgot-password']);
...@@ -403,38 +356,57 @@ class UsersController extends AppController ...@@ -403,38 +356,57 @@ class UsersController extends AppController
} }
} }
public function pinCodepassword($token=null)
#---------------------------------------------------------------------------------------------------
public function changePassword()
{ {
$this->viewBuilder()->layout('blank'); $this->viewBuilder()->layout('blank');
if ($this->request->is('post')) { $users = $this->Users->find('all',[
$hasher = new DefaultPasswordHasher(); 'conditions'=>[
$password = $this->request->data['password']; 'Users.token'=>$token
$confirm_password = $this->request->data['confirm_password']; ]
$oldpassword = $this->request->data['oldpassword']; ])->first();
$this->request->data['password'] = $hasher->hash($this->request->data['password']);
$userid = 59445; if($this->request->is('post')){
$data = $this->request->data();
$data['pin_pass'] = $data['pin_code_1'].$data['pin_code_2'].$data['pin_code_3'].$data['pin_code_4'];
if($data['pin_pass']==$users['pin_pass']){
$this->Flash->success(__('Pin Completed.'));
return $this->redirect(['controller' => 'Users', 'action' => 'changePassword/'.$token]);
}
$this->Flash->error(__('Pin Invalid'));
return $this->redirect(['controller' => 'Users', 'action' => 'pinCodepassword/'.$token]);
}
$this->set(array('token' => $token, '_serialize' => array('token')));
}
public function changePassword($token=null)
{
$this->viewBuilder()->layout('blank');
$users = $this->Users->find('all',[ $users = $this->Users->find('all',[
'conditions' => [ 'conditions' => [
'Users.id' => $userid 'Users.token' => $token
] ]
])->first(); ])->first();
if ($this->request->is('post')) {
$hasher = new DefaultPasswordHasher();
$password = $this->request->data['password'];
$confirm_password = $this->request->data['confirm_password'];
$oldpassword = $this->request->data['oldpassword'];
$this->request->data['password'] = $hasher->hash($this->request->data['password']);
//------- เทียบ password ที่เข้ารหัส ---------------password_verify($password,hashed_password)--------------------------- //------- เทียบ password ที่เข้ารหัส ---------------password_verify($password,hashed_password)---------------------------
if (password_verify($oldpassword, $users['password'])) { if (password_verify($oldpassword, $users['password'])) {
if($password==$confirm_password){ $users = $this->Users->patchEntity($users, $this->request->getData());
$users = $this->Users->patchEntity($users, $this->request->getData()); $this->Users->save($users);
$this->Users->save($users); $this->Flash->success(__('change password success'));
$this->Flash->success(__('change password success')); return $this->redirect(['action' => 'signin']);
return $this->redirect(['action' => 'signin']);
}
} else { } else {
$this->Flash->error(__('Invalid password.')); $this->Flash->error(__('Invalid password.'));
return $this->redirect(['action' => 'change-password']); return $this->redirect(['action' => 'change-password/'.$token]);
} }
} }
$this->set(array('token' => $token, '_serialize' => array('token')));
} }
#--------------------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------------------
public function signout() public function signout()
......
...@@ -30,6 +30,7 @@ public function generate(){ ...@@ -30,6 +30,7 @@ public function generate(){
<div class="row"> <div class="row">
<div class="col-xs-1 col-sm-1 col-md-1 box-arrow" ></div> <div class="col-xs-1 col-sm-1 col-md-1 box-arrow" ></div>
<div class="col-xs-10 col-sm-10 col-md-10"> <div class="col-xs-10 col-sm-10 col-md-10">
<div data-toggle="modal" data-target="#defaultModal" style="text-align: center; cursor: pointer;"> <div data-toggle="modal" data-target="#defaultModal" style="text-align: center; cursor: pointer;">
<img src="/img/core/img/card-bg-front@3x-V2.png" class="img-responsive" id="img-upload" alt="Profile picture"> <img src="/img/core/img/card-bg-front@3x-V2.png" class="img-responsive" id="img-upload" alt="Profile picture">
...@@ -37,7 +38,12 @@ public function generate(){ ...@@ -37,7 +38,12 @@ public function generate(){
</div> </div>
<div class="col-xs-1 col-sm-1 col-md-1 box-arrow" > <div class="col-xs-1 col-sm-1 col-md-1 box-arrow" >
<i class = "fa fa-angle-right"></i> <a>
<?php echo $this->Html->link(
'<i class = "fa fa-angle-right"></i>',
['controller' => 'UserCards', 'action' => 'viewCard', '_full' => true],['escape' => false]
); ?>
</a>
</div> </div>
<div style="clear: both"></div> <div style="clear: both"></div>
</div><!--/row--> </div><!--/row-->
...@@ -57,13 +63,13 @@ public function generate(){ ...@@ -57,13 +63,13 @@ public function generate(){
<?php // debug($userProfiles); exit;?> <?php // debug($userProfiles); exit;?>
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12"> <div class="col-xs-12 col-sm-12 col-md-12">
<?php echo $this->Form->input('UserPersonals.firstname_th', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'value' => $responseUserProfile['firstname_th'], 'id' => 'firstname_th', 'type' => 'text', 'label' => __('ชื่อ'), 'placeholder' => 'ชื่อ', 'required']); ?> <?php echo $this->Form->input('UserPersonals.firstname_th', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'value' => $responseUserPersonal['firstname_th'], 'id' => 'firstname_th', 'type' => 'text', 'label' => __('ชื่อ'), 'placeholder' => 'ชื่อ', 'required']); ?>
<?php // echo $this->Form->input('fullname', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->firstname_th . ' ' . $userProfiles->lastname_th, 'id' => 'fullName', 'type' => 'text', 'label' => __('ชื่อ - นามสกุล'), 'placeholder' => 'ชื่อ - นามสกุล', 'required']); ?> <?php // echo $this->Form->input('fullname', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->firstname_th . ' ' . $userProfiles->lastname_th, 'id' => 'fullName', 'type' => 'text', 'label' => __('ชื่อ - นามสกุล'), 'placeholder' => 'ชื่อ - นามสกุล', 'required']); ?>
</div> </div>
</div> </div>
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12"> <div class="col-xs-12 col-sm-12 col-md-12">
<?php echo $this->Form->input('UserPersonals.lastname_th', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'value' => $responseUserProfile['lastname_th'], 'id' => 'lastname_th', 'type' => 'text', 'label' => __('นามสกุล'), 'placeholder' => 'นามสกุล', 'required']); ?> <?php echo $this->Form->input('UserPersonals.lastname_th', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'value' => $responseUserPersonal['lastname_th'], 'id' => 'lastname_th', 'type' => 'text', 'label' => __('นามสกุล'), 'placeholder' => 'นามสกุล', 'required']); ?>
<?php // echo $this->Form->input('fullname', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->firstname_th . ' ' . $userProfiles->lastname_th, 'id' => 'fullName', 'type' => 'text', 'label' => __('ชื่อ - นามสกุล'), 'placeholder' => 'ชื่อ - นามสกุล', 'required']); ?> <?php // echo $this->Form->input('fullname', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->firstname_th . ' ' . $userProfiles->lastname_th, 'id' => 'fullName', 'type' => 'text', 'label' => __('ชื่อ - นามสกุล'), 'placeholder' => 'ชื่อ - นามสกุล', 'required']); ?>
</div> </div>
</div> </div>
...@@ -79,10 +85,10 @@ public function generate(){ ...@@ -79,10 +85,10 @@ public function generate(){
<?php echo __('เพศ'); ?> <?php echo __('เพศ'); ?>
<div class="radio-group"> <div class="radio-group">
<label class="radio-inline"> <label class="radio-inline">
<input type="radio" name="UserPersonals[gender]" id="male" value="M" <?php echo ($responseUserProfile['gender'] == 'M') ? 'checked="checked"' : null; ?>> <?php echo __('ชาย'); ?> <input type="radio" name="UserPersonals[gender]" id="male" value="M" <?php echo ($responseUserPersonal['gender'] == 'M') ? 'checked="checked"' : null; ?>> <?php echo __('ชาย'); ?>
</label> </label>
<label class="radio-inline"> <label class="radio-inline">
<input type="radio" name="UserPersonals[gender]" id="female" value="F" <?php echo ($responseUserProfile['gender'] == 'F') ? 'checked="checked"' : null; ?>> <?php echo __('หญิง'); ?> <input type="radio" name="UserPersonals[gender]" id="female" value="F" <?php echo ($responseUserPersonal['gender'] == 'F') ? 'checked="checked"' : null; ?>> <?php echo __('หญิง'); ?>
</label> </label>
</div> </div>
</div> </div>
...@@ -92,35 +98,35 @@ public function generate(){ ...@@ -92,35 +98,35 @@ public function generate(){
<?php echo __('กรุ๊ปเลือด'); ?> <?php echo __('กรุ๊ปเลือด'); ?>
<div class="radio-group"> <div class="radio-group">
<label class="radio-inline"> <label class="radio-inline">
<input type="radio" name="UserPersonals[blood_group]" id="blood-A" value="A" <?php echo ($responseUserProfile['blood_group'] == 'A') ? 'checked="checked"' : null; ?>> <?php echo __('A'); ?> <input type="radio" name="UserPersonals[blood_group]" id="blood-A" value="A" <?php echo ($responseUserPersonal['blood_group'] == 'A') ? 'checked="checked"' : null; ?>> <?php echo __('A'); ?>
</label> </label>
<label class="radio-inline"> <label class="radio-inline">
<input type="radio" name="UserPersonals[blood_group]" id="blood-B" value="B" <?php echo ($responseUserProfile['blood_group'] == 'B') ? 'checked="checked"' : null; ?>> <?php echo __('B'); ?> <input type="radio" name="UserPersonals[blood_group]" id="blood-B" value="B" <?php echo ($responseUserPersonal['blood_group'] == 'B') ? 'checked="checked"' : null; ?>> <?php echo __('B'); ?>
</label> </label>
<label class="radio-inline"> <label class="radio-inline">
<input type="radio" name="UserPersonals[blood_group]" id="blood-AB" value="AB" <?php echo ($responseUserProfile['blood_group'] == 'AB') ? 'checked="checked"' : null; ?>> <?php echo __('AB'); ?> <input type="radio" name="UserPersonals[blood_group]" id="blood-AB" value="AB" <?php echo ($responseUserPersonal['blood_group'] == 'AB') ? 'checked="checked"' : null; ?>> <?php echo __('AB'); ?>
</label> </label>
<label class="radio-inline"> <label class="radio-inline">
<input type="radio" name="UserPersonals[blood_group]" id="blood-O" value="O" <?php echo ($responseUserProfile['blood_group'] == 'O') ? 'checked="checked"' : null; ?>> <?php echo __('O'); ?> <input type="radio" name="UserPersonals[blood_group]" id="blood-O" value="O" <?php echo ($responseUserPersonal['blood_group'] == 'O') ? 'checked="checked"' : null; ?>> <?php echo __('O'); ?>
</label> </label>
</div> </div>
</div> </div>
</div> </div>
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12"> <div class="col-xs-12 col-sm-12 col-md-12">
<?php echo $this->Form->input('UserPersonals.moblie_no', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'value' => $responseUserProfile['moblie_no'], 'id' => 'moblieNo', 'type' => 'text', 'label' => __('เบอร์โทรศัพท์'), 'placeholder' => '000-000-0000']); ?> <?php echo $this->Form->input('UserPersonals.moblie_no', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'value' => $responseUserPersonal['moblie_no'], 'id' => 'moblieNo', 'type' => 'text', 'label' => __('เบอร์โทรศัพท์'), 'placeholder' => '000-000-0000']); ?>
<?php // echo $this->Form->input('moblie_no', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->moblie_no, 'id' => 'moblieNo', 'type' => 'text', 'label' => __('เบอร์โทรศัพท์'), 'placeholder' => '000-000-0000']); ?> <?php // echo $this->Form->input('moblie_no', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->moblie_no, 'id' => 'moblieNo', 'type' => 'text', 'label' => __('เบอร์โทรศัพท์'), 'placeholder' => '000-000-0000']); ?>
</div> </div>
</div> </div>
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12"> <div class="col-xs-12 col-sm-12 col-md-12">
<?php echo $this->Form->input('UserPersonals.email', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'value' => $responseUserProfile['email'], 'id' => 'email', 'type' => 'email', 'label' => __('Email'), 'placeholder' => 'mail@xxx.com']); ?> <?php echo $this->Form->input('UserPersonals.email', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'value' => $responseUserPersonal['email'], 'id' => 'email', 'type' => 'email', 'label' => __('Email'), 'placeholder' => 'mail@xxx.com']); ?>
<?php // echo $this->Form->input('email', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->email, 'id' => 'email', 'type' => 'email', 'label' => __('Email'), 'placeholder' => 'mail@xxx.com']); ?> <?php // echo $this->Form->input('email', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->email, 'id' => 'email', 'type' => 'email', 'label' => __('Email'), 'placeholder' => 'mail@xxx.com']); ?>
</div> </div>
</div> </div>
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12"> <div class="col-xs-12 col-sm-12 col-md-12">
<?php echo $this->Form->input('UserPersonals.address', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'value' => $responseUserProfile['address'], 'id' => 'address', 'type' => 'text', 'label' => __('ที่อยู่อาศัย'), 'placeholder' => __('112/3 สุขุมวิท 22 ทองหล่อ กทม 10523')]); ?> <?php echo $this->Form->input('UserPersonals.address', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'value' => $responseUserPersonal['address'], 'id' => 'address', 'type' => 'text', 'label' => __('ที่อยู่อาศัย'), 'placeholder' => __('112/3 สุขุมวิท 22 ทองหล่อ กทม 10523')]); ?>
<?php // echo $this->Form->input('address', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->address, 'id' => 'address', 'type' => 'text', 'label' => __('ที่อยู่อาศัย'), 'placeholder' => __('112/3 สุขุมวิท 22 ทองหล่อ กทม 10523')]); ?> <?php // echo $this->Form->input('address', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->address, 'id' => 'address', 'type' => 'text', 'label' => __('ที่อยู่อาศัย'), 'placeholder' => __('112/3 สุขุมวิท 22 ทองหล่อ กทม 10523')]); ?>
</div> </div>
</div> </div>
...@@ -133,9 +139,9 @@ public function generate(){ ...@@ -133,9 +139,9 @@ public function generate(){
'label' => false, 'label' => false,
'type' => 'select', 'type' => 'select',
'options' => $Country, 'options' => $Country,
'value' => $responseUserProfile['master_country_id'], 'value' => $responseUserPersonal['master_country_id'],
'empty' => '---Select---', 'empty' => '---Select---',
'default' => !empty($responseUserProfile['master_country_id'])? $responseUserProfile['master_country_id']:'', 'default' => !empty($responseUserPersonal['master_country_id'])? $responseUserPersonal['master_country_id']:'',
'class' => 'form-control border-bottom-from label-text-sub required', 'class' => 'form-control border-bottom-from label-text-sub required',
'style' => 'width:100%' 'style' => 'width:100%'
)); ));
...@@ -151,9 +157,9 @@ public function generate(){ ...@@ -151,9 +157,9 @@ public function generate(){
'label' => false, 'label' => false,
'type' => 'select', 'type' => 'select',
'options' => $Province, 'options' => $Province,
'value' => $responseUserProfile['master_province_id'], 'value' => $responseUserPersonal['master_province_id'],
'empty' => '---Select---', 'empty' => '---Select---',
'default' => !empty($responseUserProfile['master_province_id'])? $responseUserProfile['master_province_id']:'', 'default' => !empty($responseUserPersonal['master_province_id'])? $responseUserPersonal['master_province_id']:'',
'class' => 'form-control border-bottom-from label-text-sub required', 'class' => 'form-control border-bottom-from label-text-sub required',
'style' => 'width:100%' 'style' => 'width:100%'
)); ));
...@@ -199,7 +205,7 @@ public function generate(){ ...@@ -199,7 +205,7 @@ public function generate(){
</div> </div>
</div> </div>
</div> </div>
<?php $this->append('scriptBottom'); ?>
<script type="text/javascript"> <script type="text/javascript">
$(function () { $(function () {
$('#moblieNo').inputmask('999-999-9999'); $('#moblieNo').inputmask('999-999-9999');
...@@ -233,6 +239,7 @@ public function generate(){ ...@@ -233,6 +239,7 @@ public function generate(){
}); });
</script> </script>
<?php $this->end();?>
<style> <style>
.box-arrow{ .box-arrow{
font-size:36px; font-size:36px;
......
...@@ -6,9 +6,8 @@ ...@@ -6,9 +6,8 @@
<!-- <div class="alert alert-warning" role="alert" style="margin: 10px 0px 10px 0px;font-size: 17px;text-align: center;"> <!-- <div class="alert alert-warning" role="alert" style="margin: 10px 0px 10px 0px;font-size: 17px;text-align: center;">
<strong><?php echo __('กรุณา! ตรวจสอบอีเมลล์ของท่าน');?></strong> <strong><?php echo __('กรุณา! ตรวจสอบอีเมลล์ของท่าน');?></strong>
</div>--> </div>-->
<?php echo $this->Form->create(null, ['url' => ['controller' => 'Users','action' => 'changePassword'],'class' => 'form-horizontal','id' => '','name' => 'changePressword','role' => 'form', 'onsubmit' => 'return validateForm()']);?> <?php echo $this->Form->create(null, ['url' => ['controller' => 'Users','action' => 'changePassword/'.$token],'class' => 'form-horizontal','id' => '','name' => 'changePressword','role' => 'form', 'onsubmit' => 'return validateForm()']);?>
<?php echo $this->Flash->render(); ?> <?php echo $this->Flash->render(); ?>
<div> <div>
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<div class="col-md-12"> <div class="col-md-12">
...@@ -22,7 +21,7 @@ ...@@ -22,7 +21,7 @@
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<div class="col-md-12"> <div class="col-md-12">
<label class="label-text-sub"><?php echo __('รหัสผ่านใหม่');?></label> <label class="label-text-sub"><?php echo __('รหัสผ่านใหม่');?></label>
<input type="text" value="" name="password" placeholder="********" class="form-control-reg border-bottom-from" id="password" onkeyup='check();'> <input type="password" value="" name="password" placeholder="********" class="form-control-reg border-bottom-from" id="password" onkeyup='check();'>
<span class="glyphicon glyphicon-eye-open form-control-feedback"></span> <span class="glyphicon glyphicon-eye-open form-control-feedback"></span>
</div> </div>
</div> </div>
...@@ -44,7 +43,6 @@ ...@@ -44,7 +43,6 @@
echo $this->Form->submit('ตรวจสอบ', array('div' => false, 'class' => 'btn btn-quaternary mr-xs mb-sm button-text', echo $this->Form->submit('ตรวจสอบ', array('div' => false, 'class' => 'btn btn-quaternary mr-xs mb-sm button-text',
'name' => 'btn', 'id' => '', 'title' => 'Title')); 'name' => 'btn', 'id' => '', 'title' => 'Title'));
?> ?>
</div> </div>
<?php echo $this->Form->end(); ?> <?php echo $this->Form->end(); ?>
...@@ -200,3 +198,57 @@ ...@@ -200,3 +198,57 @@
color:green; color:green;
} }
</style> </style>
<script>
var ALERT_TITLE = "";
var ALERT_BUTTON_TEXT = "Ok";
if (document.getElementById) {
window.alert = function (txt) {
createCustomAlert(txt);
}
}
function createCustomAlert(txt) {
d = document;
if (d.getElementById("modalContainer"))
return;
mObj = d.getElementsByTagName("body")[0].appendChild(d.createElement("div"));
mObj.id = "modalContainer";
mObj.style.height = d.documentElement.scrollHeight + "px";
alertObj = mObj.appendChild(d.createElement("div"));
alertObj.id = "alertBox";
if (d.all && !window.opera)
alertObj.style.top = document.documentElement.scrollTop + "px";
alertObj.style.left = (d.documentElement.scrollWidth - alertObj.offsetWidth) / 2 + "px";
alertObj.style.visiblity = "visible";
h1 = alertObj.appendChild(d.createElement("h1"));
h1.appendChild(d.createTextNode(ALERT_TITLE));
msg = alertObj.appendChild(d.createElement("p"));
//msg.appendChild(d.createTextNode(txt));
msg.innerHTML = txt;
btn = alertObj.appendChild(d.createElement("a"));
btn.id = "closeBtn";
btn.appendChild(d.createTextNode(ALERT_BUTTON_TEXT));
btn.href = "#";
btn.focus();
btn.onclick = function () {
removeCustomAlert();
return false;
}
alertObj.style.display = "block";
}
function removeCustomAlert() {
document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer"));
}
function ful() {
alert('Alert this pages');
}
</script>
...@@ -17,9 +17,6 @@ ...@@ -17,9 +17,6 @@
</div> </div>
</div> </div>
</div> </div>
<div> <div>
<?php <?php
echo $this->Form->submit('ตรวจสอบ', array('div' => false, 'class' => 'btn btn-quaternary mr-xs mb-sm button-text', echo $this->Form->submit('ตรวจสอบ', array('div' => false, 'class' => 'btn btn-quaternary mr-xs mb-sm button-text',
......
...@@ -64,10 +64,10 @@ ...@@ -64,10 +64,10 @@
<?php <?php
echo $this->Form->input( 'master_province_id', [ echo $this->Form->input( 'master_province_id', [
'name'=>'master_province_id', 'name'=>'master_province_id',
// 'id'=>'master_province_id', 'id'=>'master_province_id',
'label' => false, 'label' => false,
'type' => 'select', 'type' => 'select',
'options' => $provinces, // 'options' => $provinces,
'empty' => '---Select---', 'empty' => '---Select---',
'default' => '', 'default' => '',
'class' => 'form-control border-bottom-from label-text-sub required', 'class' => 'form-control border-bottom-from label-text-sub required',
...@@ -437,6 +437,7 @@ ...@@ -437,6 +437,7 @@
var id = $(this).val(); var id = $(this).val();
if (id) { if (id) {
var dataString = 'id=' + id; var dataString = 'id=' + id;
$("#master_province_id").html('');
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: '/users/getProvince', url: '/users/getProvince',
......
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