Commit 1cf54a6a by Teeradone-PIM

teeradone 23/5/2561

parent 7e963e6a
......@@ -28,7 +28,6 @@ class ProfilesController extends AppController
'user_id' => $id ]
])->first();
//********DropdownCountry********
$this->loadModel('MasterCountries');
$Country = $this->MasterCountries->find('list', [
......@@ -56,7 +55,7 @@ class ProfilesController extends AppController
$dateNow = $res->i18nFormat('dd/MM/yyyy');
if ($this->request->is(['patch', 'post', 'put'])) {
// pr($this->request->data());die;
// pr($this->request->data['email']);die;
$data = $this->request->data;
......@@ -70,23 +69,27 @@ class ProfilesController extends AppController
]
]
)->first();
// pr($this->request->data['email']);die;
if($userPersonals['email'] == $this->request->data['UserPersonals']['email']){
if($userPersonals['email'] == $this->request->data['email']){
$chkemail = true;
}else{
$userPersonals = $this->UserPersonals->find('all',
$useremails = $this->UserPersonals->find('all',
[
'limit' => 1,
'conditions' => [
'email' => $data['UserPersonals']['email']
'email' => $data['email']
]
]
)->toArray();
)->first();
if(empty($userPersonals)){
if(empty($useremails)){
$chkemail = true;
// pr('true');die;
}else{
$chkemail = false;
// pr('false');die;
$chkemail = false;
}
}
......@@ -94,17 +97,20 @@ class ProfilesController extends AppController
$birthdate = explode("/", $this->request->data['UserPersonals']['birthdate']);
$birthdate = $birthdate[2].'-'.$birthdate[1].'-'.$birthdate[0];
$userPersonals = $this->UserPersonals->patchEntity($userPersonals, $data['UserPersonals']);
// pr($userPersonals);die;
// $userPersonals = $this->UserPersonals->patchEntity($userPersonals, $data['UserPersonals']);
$userPersonals['firstname_th'] = $this->request->data['UserPersonals']['firstname_th'];
$userPersonals['lastname_th'] = $this->request->data['UserPersonals']['lastname_th'];
$userPersonals['email'] = $this->request->data['UserPersonals']['email'];
$userPersonals['email'] = $this->request->data['email'];
$userPersonals['birthdate'] = $birthdate;
$userPersonals['user_id'] = $data['Users']['user_id'];
$userPersonals['master_country_id'] = $this->request->data['master_country_id'];
$userPersonals['master_province_id'] = $this->request->data['master_province_id'];
$userPersonals['modified_by'] = $id;
// $userPersonals = $this->UserPersonals->patchEntity($userPersonals, $data['UserPersonals']);
$userPersonals = $this->Users->patchEntity($userPersonals, $this->request->getData());
// pr($userPersonals);die;
if ($this->UserPersonals->save($userPersonals)) {
$this->Flash->success(__('Update Complete.'));
return $this->redirect(['action' => 'index']);
......@@ -115,7 +121,7 @@ class ProfilesController extends AppController
$this->Flash->error(__('Not update. Please, try again.'));
}
$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', 'responseUserPersonal']);
}
/*****************************************************************************/
......
......@@ -120,8 +120,10 @@
</div>
<div class="form-group has-feedback">
<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', 'value' => $responseUserPersonal['email'], 'id' => 'email', 'label' => __('Email'), 'placeholder' => 'mail@xxx.com']); ?>
<!-- <?php echo $this->Form->input('UserPersonals.email', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $responseUserPersonal['email'], 'id' => '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']); ?>
<label class="label-text-sub" style="font-size: 14px"><?php echo __('อีเมลล์');?></label>
<input type="text" name="email" id="email" value="<?php echo $responseUserPersonal['email'] ?>" placeholder="mail@xxx.com" class="form-control-reg border-bottom-from">
</div>
</div>
<div class="form-group has-feedback">
......@@ -440,7 +442,7 @@
<!-- <?php $this->append('scriptBottom'); ?>
<?php $this->append('scriptBottom'); ?>
<script type="text/javascript">
$(function () {
$('#moblieNo').inputmask('999-999-9999');
......@@ -509,4 +511,4 @@
.box-ads .close-modal:hover{
text-decoration: none;
}
</style> -->
\ No newline at end of file
</style>
\ No newline at end of file
......@@ -92,7 +92,7 @@
<div class="form-group has-feedback">
<div class="col-md-12">
<label class="label-text-sub"><?php echo __('เบอร์โทรศัพท์');?><em>* </em></label>
<input type="text" name="phone_no" id="phone_no" onkeypress="check_phone();" value="" maxlength="10" placeholder="000-000-0000" class="mask form-control-reg border-bottom-from">
<input type="text" name="phone_no" id="phone_no" onkeypress="check_phone();" value="" maxlength="12" placeholder="000-000-0000" class="mask form-control-reg border-bottom-from">
</div>
</div>
</div>
......@@ -164,6 +164,17 @@
</div>
</div>
<!-- ------------------------------- popup ----------------------------------- -->
<script type="text/javascript">
$(function () {
$('#phone_no').inputmask('999-999-9999');
//==================================================
// CHANGE Date Times
//==================================================
$('#datepicker').datepicker({
format: 'dd/mm/yyyy'
});
});
</script>
<script>
$(document).ready(function() {
......@@ -224,7 +235,7 @@
alert("กรุณากรอก เบอร์โทรศัพท์ของท่าน");
return false;
}
if(document.getElementById("phone_no").value.length < 10 || document.getElementById("phone_no").value.length > 10)
if(document.getElementById("phone_no").value.length != 12)
{
alert('กรุณากรอกเบอร์โทรศัพท์ ให้ครบ 10 หลัก');
return false;
......
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