Commit 11362870 by Teeradone Darunnat

Merge branch 'integration' into teeradone

parents b2aba42a 43988cd8
......@@ -14,7 +14,7 @@ class ProfilesController extends AppController
/*******************************/
$id = $this->Auth->user('id');
$id = $this->Auth->user('id');
$this->loadModel('Users');
$responseUserProfile = $this->Users->get($id, [
......@@ -47,19 +47,53 @@ class ProfilesController extends AppController
'keyField' => 'id',
'valueField' => 'province_name_th'
])
->where(['master_country_id =' => $responseUserPersonal['master_country_id']])
->order(['province_name_th']);
// pr($Province);die;
->where(['master_country_id =' => $responseUserPersonal['master_country_id']])
->order(['province_name_th']);
// pr($Province);die;
if(!empty($Province)) $Province = $Province->toArray();
$res = $responseUserPersonal['birthdate'];
if($res){
$dateNow = @$res->i18nFormat('dd/MM/yyyy');
}else{
$dateNow = "";
}
$res = $responseUserPersonal['birthdate'];
if($res){
$dateNow = @$res->i18nFormat('dd/MM/yyyy');
}else{
$dateNow = "";
}
/**
*
* Function show user card
* @Data 01/06/2018
* @author Prasong.p
*
*/
$this->loadModel('UserCards');
$UserCards = $this->UserCards->find('all')
->select($this->UserCards)
->select(
'morg.org_name_th'
)
->join([
'morg' => [
'table' => 'master.master_organizations',
'type' => 'INNER',
'conditions' => [
'morg.id = userCards.organize_id'
],
]
])
->where([
'userCards.user_id' => $id
])
->order(['userCards.id' => 'ASC'])
->toArray();
//$this->set(compact('UserCards'));
//------- save update profile ----
if ($this->request->is(['patch', 'post', 'put'])) {
$data = $this->request->data;
......@@ -89,525 +123,44 @@ class ProfilesController extends AppController
if(empty($useremails)){
$chkemail = true;
// pr('true');die;
}else{
// pr('false');die;
$chkemail = false;
$chkemail = false;
}
}
if($chkemail == true){
$birthdate = explode("/", $this->request->data['UserPersonals']['birthdate']);
$birthdate = $birthdate[2].'-'.$birthdate[1].'-'.$birthdate[0];
// 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['firstname_en'] = $this->request->data['UserPersonals']['firstname_th'];
$userPersonals['lastname_en'] = $this->request->data['UserPersonals']['lastname_th'];
$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;
// pr($userPersonals);die;
if ($this->UserPersonals->save($userPersonals)) {
$this->Flash->success(__('Update Complete.'));
return $this->redirect(['action' => 'index']);
$birthdate = explode("/", $this->request->data['UserPersonals']['birthdate']);
$birthdate = $birthdate[2].'-'.$birthdate[1].'-'.$birthdate[0];
// 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['firstname_en'] = $this->request->data['UserPersonals']['firstname_th'];
$userPersonals['lastname_en'] = $this->request->data['UserPersonals']['lastname_th'];
$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;
// pr($userPersonals);die;
if ($this->UserPersonals->save($userPersonals)) {
$this->Flash->success(__('Update Complete.'));
return $this->redirect(['action' => 'index']);
}
}else{
$this->Flash->error(__('Email Address already used by others.'));
}
}else{
$this->Flash->error(__('Email Address already used by others.'));
}
$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', 'responseUserPersonal']);
}
/*****************************************************************************/
public function settingProfile()
{
//prr($this->request->getHeaderLine('Accept-Language'));
$this->viewBuilder()->layout('blank');
$http = new Client();
$data = [];
$options = ['headers' => [
'Content-Type' => 'application/x-www-form-urlencoded',
'Authorization' => $this->request->getHeaderLine('Authorization')
//'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo1OTI0OSwidXNlcm5hbWUiOiJ0ZXN0dGVzdCIsImlwIjoiMTE2LjU4LjIyNS4yNDgiLCIkdG9waWMiOiJ0ZXN0dGVzdDMzM2Y5MWI5ZjVlMTQzMjlmMWQ2ZTc2MzgwYjhiOWVhIn0.7KwfmevJ--tz0ta5f1O_eDxKSPAjWuAzLSRCNSeWg-g'
//'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo1OTI4OCwidXNlcm5hbWUiOiJOYW5hMyIsImlwIjoiMTI3LjAuMC4xIiwiJHRvcGljIjoiTmFuYTNiODAwMjVlNWYyZTUxZDVkMmY0ZTM1Y2E4YWFkNmI1MSJ9.Up1oxsqxWASpOmj9UsAuHISlKArT2EE5NRM0bB2NLIE'
//'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo1OTI5NCwidXNlcm5hbWUiOiJOYW5hOCIsImlwIjoiMTI3LjAuMC4xIiwiJHRvcGljIjoiTmFuYThhMzQzYmRiNjNiNzYxZWFjMTFmYzBlOGU2ZDQ2NjE5YyJ9.B2vi2ftThzO8bfv7xDx3lgpo_3-us-S10OzBpFmRn2Q'
]
];
//debug($options);
$api_core_profile = Configure::read('Config.apiCore.profile');
$http = new Client();
$response = $http->post($api_core_profile,$data,$options)->body();
$response = json_decode($response,'_full');#prr($response);
$Profiles = $response['result']['Data'];
$this->set(compact('Profiles'));
#$Profiles['UserProfiles'][0]['organize_id'] = 10;
#$Profiles['UserProfiles'][0]['dept_id'] = 10;
#debug($Profiles);
$count_user_profile = count($Profiles['UserProfiles']);
//$Profiles['UserProfiles'] = $Profiles['UserProfiles'][0];
$Profiles['UserProfiles']['education'] = @$Profiles['UserProfiles'][0];
unset($Profiles['UserProfiles'][0]);
if(count($Profiles['UserProfiles']) > 1){ $Profiles['UserProfiles']['work'] = $Profiles['UserProfiles'][1];unset($Profiles['UserProfiles'][1]);}
//$master_language_id = $Profiles['UserDefaultLanguages']['master_language_id'];
$master_language_id = $this->request->getHeaderLine('Accept-Language');
$this->loadModel('MasterLanguages');
$MasterLanguages = $this->MasterLanguages->find('list',
[
'conditions' => ['id' => $master_language_id],
'keyField' => 'id',
'valueField' => 'language_abbr'
]
);
if(!empty($MasterLanguages)) $MasterLanguages = $MasterLanguages->toArray();
#prd($MasterLanguages);
//$language = strtolower($MasterLanguages[$master_language_id]);
#Education
#---------------------------------------------------------------------------------------------------------------
$this->loadModel('MasterOrganizations');
$MasterOrganizationEducations = $this->MasterOrganizations->find('list',
[
'conditions' => ['master_organization_type_id' => 1],
'keyField' => 'id',
'valueField' => 'org_name_th',
'order' => 'org_name_th asc'
]
);
if(!empty($MasterOrganizationEducations)) $MasterOrganizationEducations = $MasterOrganizationEducations->toArray();
$this->set(compact('MasterOrganizations'));
//debug($MasterOrganizationEducations);
$this->loadModel('MasterDepartments');
$MasterDepartments = $this->MasterDepartments->find('list',
[
//'conditions' => ['master_organization_id' => $Profiles['UserProfiles']['education']['organize_id']],
//'conditions' => ['master_organization_id' => $Profiles['UserProfiles'][0]['organize_id']],
'conditions' => ['master_organization_id' => 7],
'keyField' => 'id',
'valueField' => 'dept_name_th',
'order' => 'dept_name_th asc'
]
);
if(!empty($MasterDepartments)) $MasterDepartments = $MasterDepartments->toArray();
$this->set(compact('MasterDepartments'));
//debug($MasterDepartments);
$this->loadModel('MasterSections');
$MasterSections = $this->MasterSections->find('list',
[
//'conditions' => ['master_department_id' => $Profiles['UserProfiles']['education']['dept_id']],
//'conditions' => ['master_department_id' => $Profiles['UserProfiles'][0]['dept_id']],
'conditions' => ['master_department_id' => 49],
'keyField' => 'id',
'valueField' => 'section_name_th',
'order' => 'section_name_th asc'
]
);
if(!empty($MasterSections)) $MasterSections = $MasterSections->toArray();
$this->set(compact('MasterSections'));
//debug($MasterSections);
#Work
#---------------------------------------------------------------------------------------------------------------
$MasterOrganizationPositions = [];
if(!empty($Profiles['UserProfiles']['work']['organize_id'])){
$this->loadModel('MasterOrganizationPositions');
$MasterOrganizationPositions = $this->MasterOrganizationPositions->find('list',
[
'conditions' => ['master_organization_id' => $Profiles['UserProfiles']['work']['organize_id']],
'keyField' => 'id',
'valueField' => 'organization_position_name',
'order' => 'organization_position_name asc'
]
);
if(!empty($MasterOrganizationPositions)) $MasterOrganizationPositions = $MasterOrganizationPositions->toArray();
#prd($MasterOrganizationPositions);
}
$this->loadModel('MasterBusinessTypes');
$MasterBusinessTypes = $this->MasterBusinessTypes->find('list',
[
'conditions' => ['master_language_id' => $master_language_id],
'keyField' => 'id',
'valueField' => 'business_type_name',
'order' => 'business_type_name asc',
]
);
if(!empty($MasterBusinessTypes)) $MasterBusinessTypes = $MasterBusinessTypes->toArray();
#prd($MasterBusinessTypes);
$this->loadModel('MasterOrganizations');
$MasterOrganizationWorks = $this->MasterOrganizations->find('list',
[
'conditions' => ['master_organization_type_id' => 2],
'keyField' => 'id',
'valueField' => 'org_name_th',
'order' => 'org_name_th asc'
]
);
if(!empty($MasterOrganizationWorks)) $MasterOrganizationWorks = $MasterOrganizationWorks->toArray();
#prd($MasterOrganizationWorks);
$MasterSectionWorks = [];
if(!empty($Profiles['UserProfiles']['work']['dept_id'])){
$this->loadModel('MasterSections');
$MasterSectionWorks = $this->MasterSections->find('list',
[
'conditions' => ['master_department_id' => $Profiles['UserProfiles']['work']['dept_id']],
'keyField' => 'id',
'valueField' => 'section_name_th',
'order' => 'section_name_th asc'
]
);
if(!empty($MasterSectionWorks)) $MasterSectionWorks = $MasterSectionWorks->toArray();
#prd($MasterSectionWorks);
}
#debug($Profiles);
$this->set(compact(
'Profiles',
'MasterOrganizationEducations', 'MasterDepartmentEducations', 'MasterSectionEducations',
'MasterOrganizationPositions', 'MasterBusinessTypes', 'MasterOrganizationWorks', 'MasterSectionWorks'
));
//-------end save update ----
$this->set(compact('userPersonals', 'responseUserProfile', 'dateNow', 'username', 'Country', 'Province', 'responseUserPersonal','UserCards'));
$this->set('_serialize', ['userPersonals', 'responseUserProfile', 'dateNow', 'username', 'Country', 'Province', 'responseUserPersonal','UserCards']);
}
public function updateProfile()
{
$this->viewBuilder()->layout('blank');
$data = $this->request->data;#debug($data);
#$api_update_profile = 'http://connect06.pakgon.com/api/Connects/Profile/updateProfile';
#$api_update_profile = Configure::read('Config.apiCore.profile').'/updateProfile';
$http = new Client();
$data = [];
$options = ['headers' => [
'Content-Type' => 'application/x-www-form-urlencoded',
'Authorization' => $this->request->getHeaderLine('Authorization')
//'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo1OTI0OSwidXNlcm5hbWUiOiJ0ZXN0dGVzdCIsImlwIjoiMTE2LjU4LjIyNS4yNDgiLCIkdG9waWMiOiJ0ZXN0dGVzdDMzM2Y5MWI5ZjVlMTQzMjlmMWQ2ZTc2MzgwYjhiOWVhIn0.7KwfmevJ--tz0ta5f1O_eDxKSPAjWuAzLSRCNSeWg-g'
//'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo1OTI4OCwidXNlcm5hbWUiOiJOYW5hMyIsImlwIjoiMTI3LjAuMC4xIiwiJHRvcGljIjoiTmFuYTNiODAwMjVlNWYyZTUxZDVkMmY0ZTM1Y2E4YWFkNmI1MSJ9.Up1oxsqxWASpOmj9UsAuHISlKArT2EE5NRM0bB2NLIE'
//'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo1OTI5NCwidXNlcm5hbWUiOiJOYW5hOCIsImlwIjoiMTI3LjAuMC4xIiwiJHRvcGljIjoiTmFuYThhMzQzYmRiNjNiNzYxZWFjMTFmYzBlOGU2ZDQ2NjE5YyJ9.B2vi2ftThzO8bfv7xDx3lgpo_3-us-S10OzBpFmRn2Q'
]
];
//debug($options);exit();
$api_update_profile = Configure::read('Config.apiCore.profile');
$http = new Client();
$response = $http->post($api_update_profile,$data,$options)->body();
//debug($response);
$response = json_decode($response,'_full');#debug($response);
$Profiles = $response['result']['Data'];
$this->set(compact('Profiles'));
$this->loadModel('UserPersonLists');
$this->loadModel('UserProfiles');
$this->loadModel('AppAccess');
$this->loadModel('SubjectEnrolls');
//debug($this->request->data);
if ($this->request->is('post')) {
#59294
//if (!empty($this->request->data)) {
$UserPersonLists_V = $this->UserPersonLists->find('all',
[
#'conditions' => ['is_used' => true,'username' => $data['username']],
'conditions' => ['user_id' => $this->request->data['data']['Users']['id']],
'fields' => ['id', 'user_id'],
'limit' => 1
]
)->toArray();
//debug($UserPersonLists[0]['id']);exit();
//if (empty($UserPersonLists[0]['id'] == null)) {
if (!empty($UserPersonLists_V)) {
foreach($this->request->data as $UserPersonLists) {
//$UserPersonLists=$this->UserPersonLists->newEntity();
//debug($UserPersonLists['id'] = $this->request->data['data']['Users']['id']);exit();
//debug($UserPersonLists['data']['Users']['id']);exit();
//debug($UserPersonLists=$this->UserPersonLists->get($UserPersonLists['Users']['id']));exit();
//debug($UserPersonLists_V);exit();
$UserPersonLists=$this->UserPersonLists->get($UserPersonLists_V[0]['id']);
$UserPersonLists['master_organization_id'] = $this->request->data['data']['UserProfiles']['education']['organize_id'];
$UserPersonLists['master_department_id'] = $this->request->data['data']['UserProfiles']['education']['dept_id'];
$UserPersonLists['master_section_id'] = $this->request->data['data']['UserProfiles']['education']['section_id'];
$UserPersonLists['card_code'] = $this->request->data['data']['UserProfiles']['education']['card_code'];
$UserPersonLists['first_name'] = $this->request->data['data']['UserPersonals']['name'];
$UserPersonLists['last_name'] = $this->request->data['data']['UserPersonals']['name'];
$UserPersonLists['master_user_type_id'] = '1';
$UserPersonLists['user_id'] = $this->request->data['data']['Users']['id'];
$UserPersonLists['is_used'] = '1';
$UserPersonLists['created'] = date('Y-m-d H:i:s');
$UserPersonLists['create_uid'] = '0';
$UserPersonLists['modified'] = date('Y-m-d H:i:s');
$UserPersonLists['update_uid'] = '0';
$UserPersonLists['master_prefix_id'] = '1';
//debug($UserPersonLists);exit();
if (empty($UserPersonLists['card_code'] == null || $UserPersonLists['master_organization_id'] == null || $UserPersonLists['master_department_id'] == null || $UserPersonLists['master_section_id'] == null)) {
if ($this->UserPersonLists->save($UserPersonLists)) {
}
} else{
$this->Flash->error(__('ไม่สามารถปรับปรุงข้อมูลการศึกษาได้ โปรดติด่อเจ้าหน้าที่'));
return $this->redirect(['controller' => 'Profiles', 'action' => 'index']);
}
//debug($this->UserPersonLists->save($UserPersonLists));exit();
}
}else {
foreach($this->request->data as $UserPersonLists) {
$UserPersonLists=$this->UserPersonLists->newEntity();
//debug($UserPersonLists['id'] = $this->request->data['data']['Users']['id']);exit();
//debug($UserPersonLists['data']['Users']['id']);exit();
//debug($UserPersonLists=$this->UserPersonLists->get($UserPersonLists['Users']['id']));exit();
//debug($UserPersonLists_V);exit();
//$UserPersonLists=$this->UserPersonLists->get($UserPersonLists_V[0]['id']);
$UserPersonLists['master_organization_id'] = $this->request->data['data']['UserProfiles']['education']['organize_id'];
$UserPersonLists['master_department_id'] = $this->request->data['data']['UserProfiles']['education']['dept_id'];
$UserPersonLists['master_section_id'] = $this->request->data['data']['UserProfiles']['education']['section_id'];
$UserPersonLists['card_code'] = $this->request->data['data']['UserProfiles']['education']['card_code'];
$UserPersonLists['first_name'] = $this->request->data['data']['UserPersonals']['name'];
$UserPersonLists['last_name'] = $this->request->data['data']['UserPersonals']['name'];
$UserPersonLists['master_user_type_id'] = '1';
$UserPersonLists['user_id'] = $this->request->data['data']['Users']['id'];
$UserPersonLists['is_used'] = '1';
$UserPersonLists['created'] = date('Y-m-d H:i:s');
$UserPersonLists['create_uid'] = '0';
$UserPersonLists['modified'] = date('Y-m-d H:i:s');
$UserPersonLists['update_uid'] = '0';
$UserPersonLists['master_prefix_id'] = '1';
//debug($UserPersonLists);exit();
if (empty($UserPersonLists['card_code'] == null || $UserPersonLists['master_organization_id'] == null || $UserPersonLists['master_department_id'] == null || $UserPersonLists['master_section_id'] == null)) {
if ($this->UserPersonLists->save($UserPersonLists)) {
}
} else{
$this->Flash->error(__('ไม่สามารถปรับปรุงข้อมูลการศึกษาได้ โปรดติด่อเจ้าหน้าที่'));
return $this->redirect(['controller' => 'Profiles', 'action' => 'index']);
}
//debug($this->UserPersonLists->save($UserPersonLists));exit();
}
}
$UserProfiles = $this->UserProfiles->find('all',
[
'conditions' => ['user_id' => $this->request->data['data']['Users']['id']],
'fields' => ['user_id'],
'limit' => 1
]
)->toArray();
//debug($this->request->data['data']['Users']['id']);exit();
if (!empty($this->request->data['data']['Users']['id'])) {
foreach($UserProfiles as $user_profiles) {
$user_profiles=$this->UserProfiles->get($this->request->data['data']['UserProfiles']['education']['id']);
//$date = date_create('2000-01-01');
//$user_profiles['id'] = $this->request->data['data']['Users']['id'];
//$user_profiles['user_id'] = $this->request->data['data']['Users']['id'];
$user_profiles['organize_id'] = $this->request->data['data']['UserProfiles']['education']['organize_id'];
$user_profiles['dept_id'] = $this->request->data['data']['UserProfiles']['education']['dept_id'];
$user_profiles['section_id'] = $this->request->data['data']['UserProfiles']['education']['section_id'];
$user_profiles['card_code'] = $this->request->data['data']['UserProfiles']['education']['card_code'];
$user_profiles['user_type_id'] = '1';
$user_profiles['img_path'] = '';
//$user_profiles['is_used'] = '1';
//$user_profiles['created_by'] = '0';
$user_profiles['created'] = date('Y-m-d H:i:s');
$user_profiles['modified_by'] = '0';
$user_profiles['modified'] = date('Y-m-d H:i:s');
//$user_profiles['position_org'] = '195';
//$user_profiles['position_edu'] = '89';
$user_profiles['enter_date'] = date('Y-m-d');
$user_profiles['address'] = $this->request->data['data']['UserProfiles']['education']['address'];
$user_profiles['master_business_type_id'] = '0';
$user_profiles['phone_no'] = $this->request->data['data']['UserProfiles']['education']['phone_no'];
$user_profiles['master_organization_position_id'] = $this->request->data['data']['UserProfiles']['education']['organize_id'];
//debug($this->request->data)
//debug($this->UserProfiles->save($user_profiles));exit;
//debug($user_profiles);exit();
if($this->UserProfiles->save($user_profiles)){
}
//return $this->redirect(['controller' => 'Profiles', 'action' => 'index']);
}
}else {
foreach($this->request->data as $UserPersonLists) {
$UserPersonLists=$this->UserPersonLists->newEntity();
//debug($UserPersonLists['id'] = $this->request->data['data']['Users']['id']);exit();
//debug($UserPersonLists['data']['Users']['id']);exit();
//debug($UserPersonLists=$this->UserPersonLists->get($UserPersonLists['Users']['id']));exit();
//debug($UserPersonLists_V);exit();
//$UserPersonLists=$this->UserPersonLists->get($UserPersonLists_V[0]['id']);
$user_profiles['organize_id'] = $this->request->data['data']['UserProfiles']['education']['organize_id'];
$user_profiles['dept_id'] = $this->request->data['data']['UserProfiles']['education']['dept_id'];
$user_profiles['section_id'] = $this->request->data['data']['UserProfiles']['education']['section_id'];
$user_profiles['card_code'] = $this->request->data['data']['UserProfiles']['education']['card_code'];
$user_profiles['user_type_id'] = '1';
$user_profiles['img_path'] = '';
//$user_profiles['is_used'] = '1';
//$user_profiles['created_by'] = '0';
$user_profiles['created'] = date('Y-m-d H:i:s');
$user_profiles['modified_by'] = '0';
$user_profiles['modified'] = date('Y-m-d H:i:s');
//$user_profiles['position_org'] = '195';
//$user_profiles['position_edu'] = '89';
$user_profiles['enter_date'] = date('Y-m-d');
$user_profiles['address'] = $this->request->data['data']['UserProfiles']['education']['address'];
$user_profiles['master_business_type_id'] = '0';
$user_profiles['phone_no'] = $this->request->data['data']['UserProfiles']['education']['phone_no'];
$user_profiles['master_organization_position_id'] = $this->request->data['data']['UserProfiles']['education']['organize_id'];
//debug($UserPersonLists);exit();
if ($this->UserPersonLists->save($UserPersonLists)) {
}
//debug($this->UserPersonLists->save($UserPersonLists));exit();
}
}
$AppAccess = $this->AppAccess->find('all',
[
'conditions' => ['user_id' => $this->request->data['data']['Users']['id']],
//'fields' => ['user_id'],
'limit' => 1
]
)->toArray();
//debug($AppAccess);//exit();
//debug($AppAccess);exit();
if (!empty($AppAccess)) {
//debug($AppAccess);exit();
foreach($AppAccess as $app_access) {
//debug($app_access);exit();
//debug($this->request->data['data']['Users']['id']);exit();
$app_access=$this->AppAccess->get($app_access['id']);
//$user_profiles=$this->UserProfiles->get($this->request->data['data']['UserProfiles']['education']['id']);
//$app_access=$this->AppAccess->newEntity();
//debug($AppAccess);exit();
$AppAccess['user_id'] = $this->request->data['data']['Users']['id'];
$app_access['master_app_id'] = '3';
$app_access['is_used'] = '1';
$app_access['create_uid'] = '0';
$app_access['created'] = date('Y-m-d H:i:s');
$app_access['update_uid'] = '0';
$app_access['modified'] = date('Y-m-d H:i:s');
//debug($app_access);exit();
if($this->AppAccess->save($app_access)){
}
}
}else{
//debug($this->request->data['data']['Users']['id']);exit();
foreach($this->request->data as $app_access) {
//debug($this->request->data);exit();
//debug($this->request->data['data']['Users']['id']);exit();
//$app_access=$this->AppAccess->get($app_access['id']);
//$user_profiles=$this->UserProfiles->get($this->request->data['data']['UserProfiles']['education']['id']);
$app_access=$this->AppAccess->newEntity();
//debug($this->request->data['data']['Users']['id']);exit();
$app_access['user_id'] = $this->request->data['data']['Users']['id'];
$app_access['master_app_id'] = '3';
$app_access['is_used'] = '1';
$app_access['create_uid'] = '0';
$app_access['created'] = date('Y-m-d H:i:s');
$app_access['update_uid'] = '0';
$app_access['modified'] = date('Y-m-d H:i:s');
//debug($app_access);exit();
if($this->AppAccess->save($app_access)){
}
}
}
$SubjectEnrolls = $this->SubjectEnrolls->find('all',
[
'conditions' => ['user_id' => $this->request->data['data']['Users']['id']],
//'fields' => ['user_id'],
'limit' => 1
]
)->toArray();
//$SubjectEnrolls = $this->SubjectEnrolls->find('all')->toArray();
//debug($SubjectEnrolls);exit();
if (!empty($SubjectEnrolls)) {
foreach($this->request->data as $subject_enrolls) {
//debug($subject_enrolls);exit();
$subject_enrolls=$this->SubjectEnrolls->get($SubjectEnrolls[0]['id']);
//$subject_enrolls=$this->SubjectEnrolls->newEntity();
$subject_enrolls['subject_id'] = '';
$subject_enrolls['user_id'] = $this->request->data['data']['Users']['id'];
$subject_enrolls['master_organization_id'] = $this->request->data['data']['UserProfiles']['education']['organize_id'];
$subject_enrolls['card_code'] = $this->request->data['data']['UserProfiles']['education']['card_code'];
$subject_enrolls['is_used'] = '1';
$subject_enrolls['create_uid'] = '0';
$subject_enrolls['created'] = date('Y-m-d H:i:s');
$subject_enrolls['update_uid'] = '0';
$subject_enrolls['modified'] = date('Y-m-d H:i:s');
//debug($subject_enrolls);exit();
if($this->SubjectEnrolls->save($subject_enrolls)){
if (empty($subject_enrolls)) {
$this->Session->setFlash(__("ไม่ถูกต้อง"));
return false;
}
}
}
}else{
foreach($this->request->data as $subject_enrolls) {
//debug($subject_enrolls);exit();
//$subject_enrolls=$this->SubjectEnrolls->get($SubjectEnrolls[0]['id']);
$subject_enrolls=$this->SubjectEnrolls->newEntity();
$subject_enrolls['subject_id'] = '';
$subject_enrolls['user_id'] = $this->request->data['data']['Users']['id'];
$subject_enrolls['master_organization_id'] = $this->request->data['data']['UserProfiles']['education']['organize_id'];
$subject_enrolls['card_code'] = $this->request->data['data']['UserProfiles']['education']['card_code'];
$subject_enrolls['is_used'] = '1';
$subject_enrolls['create_uid'] = '0';
$subject_enrolls['created'] = date('Y-m-d H:i:s');
$subject_enrolls['update_uid'] = '0';
$subject_enrolls['modified'] = date('Y-m-d H:i:s');
//debug($subject_enrolls);exit();
if($this->SubjectEnrolls->save($subject_enrolls)){
if (empty($subject_enrolls)) {
$this->Session->setFlash(__("ไม่ถูกต้อง"));
return false;
}
}
}
}
//}
// $this->Flash->error(__('ไม่สามารถปรับปรุงข้อมูลการศึกษาได้ โปรดติด่อเจ้าหน้าที่'));
// return $this->redirect(['controller' => 'Profiles', 'action' => 'index']);
}
//debug($UserPersonLists);exit();
$this->Flash->success(__('ปรับปรุงข้อมูลสำเร็จ'));
return $this->redirect(['controller' => 'Profiles', 'action' => 'index']);
}
public function profileCard()
{
$this->viewBuilder()->layout('blank');
}
}
......@@ -208,33 +208,33 @@ class UserCardsController extends AppController
}
public function viewCard($user_id = null){
$this->viewBuilder()->layout('blank');
$user_id = $this->Auth->user('id');
$this->loadModel('UserCards');
$UserCards = $this->UserCards->find('all')
->select($this->UserCards)
->select(
'morg.org_name_th'
)
->join([
'morg' => [
'table' => 'master.master_organizations',
'type' => 'INNER',
'conditions' => [
'morg.id = userCards.organize_id'
],
]
])
->where([
'userCards.user_id' => $user_id
])
->order(['userCards.id' => 'ASC'])
->toArray();
// $user_id = $this->Auth->user('id');
// $this->loadModel('UserCards');
// $UserCards = $this->UserCards->find('all')
// ->select($this->UserCards)
// ->select(
// 'morg.org_name_th'
// )
// ->join([
// 'morg' => [
// 'table' => 'master.master_organizations',
// 'type' => 'INNER',
// 'conditions' => [
// 'morg.id = userCards.organize_id'
// ],
// ]
// ])
// ->where([
// 'userCards.user_id' => $user_id
// ])
// ->order(['userCards.id' => 'ASC'])
// ->toArray();
// pr($UserCards);die;
$this->set(compact('UserCards'));
// // pr($UserCards);die;
// $this->set(compact('UserCards'));
// -----------------------------ในส่วนของการ add-------------------------
$this->autoRender = false;
$this->loadModel('TempUserCards');
$this->loadModel('MasterOrganizations');
if($this->request->is('post')) {
......@@ -306,12 +306,14 @@ class UserCardsController extends AppController
return $this->redirect(['controller' => 'Profiles', 'action' => 'index']);
}
}else{
$this->Flash->error(__('Already registered'));
return $this->redirect(['controller' => 'UserCards', 'action' => 'viewCard']);
$this->Flash->error(__('ลงทะเบียนไว้อยู่แล้ว'));
// return $this->redirect(['controller' => 'UserCards', 'action' => 'viewCard']);
return $this->redirect(['controller' => 'Profiles', 'action' => 'index#box-add-card']);
}
}else{
$this->Flash->error(__('Data not found'));
return $this->redirect(['controller' => 'UserCards', 'action' => 'viewCard']);
$this->Flash->error(__('ไม่พบข้อมูล'));
// return $this->redirect(['controller' => 'UserCards', 'action' => 'viewCard']);
return $this->redirect(['controller' => 'Profiles', 'action' => 'index#box-add-card']);
}
}
}
......
......@@ -3,15 +3,16 @@ use Cake\I18n\Time;
?>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12">
<div class="modal " id="card_<?php echo $i;?>" tabindex="-1" role="dialog" aria-labelledby=""
aria-hidden="true">
<div class="modal fade" id="card_<?php echo $i;?>" tabindex="-1" role="dialog" aria-labelledby="defaultModalLabel" aria-hidden="true">
<div class="modal-dialog box-ads">
<a class="close-modal" data-dismiss="modal">X </a>
<div class="container login-container">
<div class="">
<div class="owl-carousel owl-theme" data-plugin-options="{'items': 1}">
<div class="row rotate270 form_1">
<?php echo $this->Html->image('/img/core/img/card-bg-front@3x.png', array('div' => false, 'class' => 'img-responsive img-rounded','style' => 'position: absolute;')); ?>
<div class="form_1-card-img">
<?php echo $this->Html->image('/img/core/img/card-bg-front@3x.png', array('div' => false, 'class' => 'img-responsive img-rounded','style' => '')); ?>
</div>
<div class="row date-name">
<div class="col-xs-8 ">
<br>
......@@ -63,7 +64,7 @@ use Cake\I18n\Time;
</div>
<!--/ .font-card-->
<div>
<?php echo $this->Html->image('/img/core/img/card-bg-back@3x.png', array('div' => false, 'class' => 'img-responsive img-rounded','style' => '3position: absolute;')); ?>
<?php echo $this->Html->image('/img/core/img/card-bg-back@3x.png', array('div' => false, 'class' => 'img-responsive img-rounded','style' => '')); ?>
</div>
<!--/ .back-card-->
</div>
......@@ -76,4 +77,59 @@ use Cake\I18n\Time;
</div>
<!--/.defaultModal -->
</div>
<!--/.col-xs-12 -->
</div>
<!--/row modal card-->
<style>
.form_1 {
width: 100%;
height: 100%;
margin: auto;
padding: auto;
}
.form_1-card-img {
position: absolute;
width: 100%;
margin: auto;
padding: auto;
}
.form_1-card-img img {
position: relative;
width: 100%;
}
.form_1 .date-name {
width: 500px;
margin: 55% 0% 0% -40%;
border-bottom: 0px solid red;
position: absolute;
z-index: 9999;
display: block;
}
.date-name div div {
height: 35px;
}
.form_1 .date-position {
width: 500px;
margin: 70% 0% 0% -15%;
border-bottom: 0px solid #000;
}
.form_1 .date-time {
width: 500px;
margin: 70% 0% 0% 10%;
border-bottom: 0px solid #000;
}
.form_1 .date-label {
width: 500px;
margin: 70% 0% 0% 20%;
border-bottom: 0px solid #000;
}
</style>
\ No newline at end of file
<div class="col-xs-12" data-hash="box-add-card" id="box-add-card">
<div class="col-xs-1 col-sm-1 col-md-1 box-arrow left">
<i class="fa fa-angle-left prev"> </i>
</div>
<div class="col-xs-10 col-sm-10 col-md-10">
<img src="/img/core/img/bloc-plus@3x.png" class="img-responsive" style="width: 100%">
</div>
<div class="col-xs-1 col-sm-1 col-md-1 box-arrow right"></div>
<div class="">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo $this->Form->create('UserCards', [
'id' => 'frmSignIn',
'type' => 'file',
'onsubmit' => 'return check();',
'url' => ['controller' => 'user-cards', 'action' => 'view-card']
]); ?>
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo $this->Flash->render(); ?>
<?php echo $this->Form->hidden('UserCards.user_id', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'id' => 'userId', 'type' => 'text', 'placeholder' => 'USERNAME']); ?>
<?php echo $this->Form->hidden('UserCards.organize_id', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'id' => 'organize_id', 'type' => 'text', 'label' => __('ไอดีใช้งาน'), 'placeholder' => 'USERNAME']); ?>
<?php echo $this->Form->input('UserCards.organize_code', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'id' => 'organize_code', 'type' => 'text', 'label' => __('Company Code'), 'placeholder' => 'Company Code']); ?>
<label id="nameorg_th" style="color: green"></label>
<label id="noorg_th" style="color: red"></label>
</div>
</div>
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo $this->Form->input('UserCards.employee', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'id' => 'employee', 'type' => 'text', 'label' => __('Ref 1'), 'placeholder' => 'Ref 1', 'disabled']); ?>
<label id="nameemp_th" style="color: green"></label>
<label id="noepm_th" style="color: red"></label>
</div>
</div>
<div class="form-group has-feedback bootstrap-iso">
<div class="col-xs-12 col-sm-12 col-md-12">
<label class="label-text-sub">
<?php echo __('Ref 2');?>
</label>
<input type="text" name="UserCards[birthdate]" id="date" placeholder="Ref 2" value="" readonly placeholder="DD-MM-YYYY" data-date-format="mm/dd/yyyy"
class="form-control-reg border-bottom-from" disabled>
<span class="glyphicon glyphicon-calendar form-control-feedback"></span>
</div>
</div>
<div>
<button type="submit" class="btn btn-quaternary mr-xs mb-sm button-text-profile" id="checkbutton"><?php echo __('Check') ?></button>
</div>
<?php echo $this->Form->end(); ?>
</div>
<!--/.col-xs-12 -->
</div>
<!--/.row -->
</div>
<!--/.col-xs-12 -->
<?php $this->append('scriptBottom'); ?>
<script type="text/javascript">
var organize_id = $("#organize_id");
var employee = $("#employee");
var date = $("#date");
$(document).ready(function () {
$("#organize_code").on('change', function () {
var organize_code = $("#organize_code").val();
$('#employee').attr("disabled", true);
$('#date').attr("disabled", true);
$('#checkbutton').attr("disabled", true);
organize_id.val('');
employee.val('');
date.val('');
$.post("/UserCards/checkOrg", {
organize_code: organize_code
}, function (data) {
if (data != 'false') {
data = jQuery.parseJSON(data);
if (data['chkuser'] == true) {
$("#noorg_th").text('');
$("#noorg_th").text(<?php echo __('Register with') ?> + data[0]['org_name_th'] +
<?php echo __('already') ?>);
$("#nameorg_th").text('');
$('#employee').attr("disabled", true);
organize_id.val('');
employee.val('');
} else if (data['chkuser'] == false) {
$("#nameorg_th").text('');
$("#nameorg_th").text(data[0]['org_name_th']);
$("#noorg_th").text('');
$("#checkbutton").removeAttr("disabled");
$("#employee").removeAttr("disabled");
organize_id.val(data[0]['id']);
}
} else {
$("#noorg_th").text('');
$("#noorg_th").text(<?php echo __('Data not found') ?>);
$("#nameorg_th").text('');
$("#noepm_th").text('');
$("#nameemp_th").text('');
$('#employee').attr("disabled", true);
organize_id.val('');
employee.val('');
}
});
});
$("#employee").on('change', function () {
var employee_val = employee.val();
var organize_code = $("#organize_code").val();
$('#date').attr("disabled", true);
date.val('');
$.post("/UserCards/checkEmp", {
employee_val: employee_val,
organize_code: organize_code
}, function (data) {
if (data != 'false') {
data = jQuery.parseJSON(data);
if (data['chkuser'] == true) {
$("#noepm_th").text('');
$("#noepm_th").text(<?php echo __('Registered') ?>);
$("#nameemp_th").text('');
$('#date').attr("disabled", true);
date.val('');
} else if (data['chkuser'] == false) {
$("#nameemp_th").text('');
$("#nameemp_th").text(data['prefix_name_th'] + data['firstname_th'] + ' ' + data['lastname_th']);
$("#noepm_th").text('');
$("#date").removeAttr("disabled");
}
} else {
$("#noepm_th").text('');
$("#noepm_th").text(<?php echo __('"Did not find the information you need", Please enter the correct information and press the check.') ?>);
$("#nameemp_th").text('');
$('#date').attr("disabled", true);
date.val('');
}
});
});
var date_input = $('input[id="date"]'); //our date input has the name "date"
var container = $('.bootstrap-iso form').length > 0 ? $('.bootstrap-iso form').parent() : "body";
var options = {
format: 'dd/mm/yyyy',
container: container,
todayHighlight: true,
autoclose: true,
};
date_input.datepicker(options);
});
function check() {
if ($("#organize_code").val() == '') {
alert(<?php echo __('Please enter Company Code.') ?>);
organize_id.focus();
return false;
}
if (employee.val() == '') {
alert(<?php echo __('Please enter Ref1.') ?>);
employee.focus();
return false;
}
if (date.val() == '') {
alert(<?php echo __('Please enter Ref2.') ?>);
date.focus();
return false;
}
}
</script>
<style>
#alertBox {
position: relative;
width: 300px;
min-height: 100px;
/*margin-top:50px;*/
border: 1px solid #666;
background-color: #fff;
background-repeat: no-repeat;
background-position: 20px 30px;
left: 0;
right: 0;
top: 100px;
z-index: 2;
}
#modalContainer>#alertBox {
position: fixed;
}
#alertBox h1 {
margin: 0;
font: bold 0.9em verdana, arial;
background-color: #000;
color: #FFF;
border-bottom: 1px solid #000;
padding: 2px 0 2px 5px;
}
#alertBox p {
font-size: 14px;
height: 30px;
padding: 10px;
/* margin-left: 55px; */
text-align: center;
}
#alertBox #closeBtn {
display: block;
position: relative;
margin: 5px auto;
padding: 7px;
border: 0 none;
width: 70px;
font: 0.7em verdana, arial;
text-transform: uppercase;
text-align: center;
color: #FFF;
background-color: #000;
border-radius: 3px;
text-decoration: none;
}
/* unrelated styles */
#mContainer {
position: relative;
width: 600px;
margin: auto;
padding: 5px;
border-top: 2px solid #000;
border-bottom: 2px solid #000;
font: 0.7em verdana, arial;
}
h1,
h2 {
margin: 0;
padding: 4px;
font: bold 1.5em verdana;
border-bottom: 1px solid #000;
text-align: center;
}
code {
font-size: 1.2em;
color: #069;
}
#credits {
position: relative;
margin: 25px auto 0px auto;
width: 350px;
font: 0.7em verdana;
border-top: 1px solid #000;
border-bottom: 1px solid #000;
height: 90px;
padding-top: 4px;
}
#credits img {
float: left;
margin: 5px 10px 5px 0px;
border: 1px solid #000000;
width: 80px;
height: 79px;
}
.important {
background-color: #F5FCC8;
padding: 2px;
}
code span {
color: green;
}
</style>
<?php $this->end();?>
\ No newline at end of file
<?php
use Cake\I18n\Time;
class QRGenerator {
protected $size;
......@@ -27,281 +29,373 @@
}
}
?>
<div class="row">
<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 data-toggle="modal" data-target="#defaultModal" style="text-align: center; cursor: pointer;">
<img src="/img/core/img/connect-card-v3.png" class="img-responsive" id="img-upload" alt="Profile picture">
</div>
</div>
<div class="col-xs-1 col-sm-1 col-md-1 box-arrow" >
<a>
<?php echo $this->Html->link(
'<i class = "fa fa-angle-right"></i>',
['controller' => 'UserCards', 'action' => 'viewCard', '_full' => true],['escape' => false]
); ?>
</a>
</div>
<div style="clear: both"></div>
</div><!--/row-->
<br><br>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo $this->Form->create('UserProfiles', ['id' => 'frmSignIn', 'type' => 'file','name' => 'frmSignIn','role' => 'form', 'onsubmit' => 'return validateForm()']); ?>
<?php echo $this->Flash->render() ?>
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<h3> <?php echo __('user profile');?></h3>
</div>
<div class="owl-carousel owl-theme" data-plugin-options="{'items': 1}">
<div class="row">
<div class="col-xs-1 col-sm-1 col-md-1 box-arrow left">
</div>
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo $this->Form->hidden('Users.user_id', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $responseUserProfile['id'], 'id' => 'userId', 'type' => 'text', 'label' => __('username'), 'placeholder' => 'USERNAME']); ?>
<?php echo $this->Form->input('Users.username', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $username, 'id' => 'username', 'type' => 'text', 'label' => __('username'), 'placeholder' => 'USERNAME', 'readonly']); ?>
<?php // echo $this->Form->input('user_id', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfile->username, 'id' => 'userId', 'type' => 'text', 'label' => __('ชื่อผู้ใช้งาน'), 'placeholder' => 'USERNAME']); ?>
<div class="col-xs-10 col-sm-10 col-md-10">
<div data-toggle="modal" data-target="#defaultModal" style="text-align: center; cursor: pointer;">
<img src="/img/core/img/connect-card-v3.png" class="img-responsive" id="img-upload" alt="Profile picture">
</div>
</div>
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo __('firstname');?><em>* </em>
<?php echo $this->Form->input('UserPersonals.firstname_th', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $responseUserPersonal['firstname_th'], 'id' => 'firstname_th', 'type' => 'text', 'label' => false, 'placeholder' => 'firstname']); ?>
<?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' => 'ชื่อ - นามสกุล']); ?>
</div>
<div class="col-xs-1 col-sm-1 col-md-1 box-arrow right">
<i class="fa fa-angle-right next"></i>
</div>
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo __('lastname');?><em>* </em>
<?php echo $this->Form->input('UserPersonals.lastname_th', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $responseUserPersonal['lastname_th'], 'id' => 'lastname_th', 'type' => 'text', 'label' => false, 'placeholder' => 'lastname']); ?>
<?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' => 'ชื่อ - นามสกุล']); ?>
<div style="clear: both"></div>
<br><br>
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo $this->Form->create('UserProfiles', ['id' => 'frmSignIn', 'type' => 'file','name' => 'frmSignIn','role' => 'form', 'onsubmit' => 'return validateForm()']); ?>
<?php echo $this->Flash->render() ?>
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<h3>
<?php echo __('user profile');?>
</h3>
</div>
</div>
</div>
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo __('birthdate');?><em>* </em>
<?php echo $this->Form->input('UserPersonals.birthdate', ['class' => 'form-control-reg border-bottom-from', 'value' => $dateNow, 'id' => 'datepicker', 'type' => 'text', 'label' => false, 'placeholder' => 'DD-MM-YYYY']); ?>
<span class="glyphicon glyphicon-calendar form-control-feedback datepicker"></span>
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo $this->Form->hidden('Users.user_id', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $responseUserProfile['id'], 'id' => 'userId', 'type' => 'text', 'label' => __('username'), 'placeholder' => 'USERNAME']); ?>
<?php echo $this->Form->input('Users.username', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $username, 'id' => 'username', 'type' => 'text', 'label' => __('username'), 'placeholder' => 'USERNAME', 'readonly']); ?>
<?php // echo $this->Form->input('user_id', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfile->username, 'id' => 'userId', 'type' => 'text', 'label' => __('ชื่อผู้ใช้งาน'), 'placeholder' => 'USERNAME']); ?>
</div>
</div>
</div>
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<!--<label class="label-text-sub">เพศ</label>-->
<?php echo __('gender'); ?>
<div class="radio-group">
<label class="radio-inline">
<input type="radio" name="UserPersonals[gender]" id="male" value="M" <?php echo ($responseUserPersonal['gender'] == 'M') ? 'checked="checked"' : null; ?>> <?php echo __('male'); ?>
</label>
<label class="radio-inline">
<input type="radio" name="UserPersonals[gender]" id="female" value="F" <?php echo ($responseUserPersonal['gender'] == 'F') ? 'checked="checked"' : null; ?>> <?php echo __('female'); ?>
</label>
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo __('firstname');?>
<em>* </em>
<?php echo $this->Form->input('UserPersonals.firstname_th', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $responseUserPersonal['firstname_th'], 'id' => 'firstname_th', 'type' => 'text', 'label' => false, 'placeholder' => 'firstname']); ?>
<?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' => 'ชื่อ - นามสกุล']); ?>
</div>
</div>
</div>
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo __('blood group'); ?>
<div class="radio-group">
<label class="radio-inline">
<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 class="radio-inline">
<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 class="radio-inline">
<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 class="radio-inline">
<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>
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo __('lastname');?>
<em>* </em>
<?php echo $this->Form->input('UserPersonals.lastname_th', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $responseUserPersonal['lastname_th'], 'id' => 'lastname_th', 'type' => 'text', 'label' => false, 'placeholder' => 'lastname']); ?>
<?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' => 'ชื่อ - นามสกุล']); ?>
</div>
</div>
</div>
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo __('mobile');?><em>* </em>
<?php echo $this->Form->input('UserPersonals.moblie_no', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $responseUserPersonal['moblie_no'], 'id' => 'moblieNo', 'type' => 'text', 'label' => false, 'maxlength' => '10', 'placeholder' => 'mobile']); ?>
<?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 class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo __('birthdate');?>
<em>* </em>
<?php echo $this->Form->input('UserPersonals.birthdate', ['class' => 'form-control-reg border-bottom-from', 'value' => $dateNow, 'id' => 'datepicker', 'type' => 'text', 'label' => false, 'placeholder' => 'DD-MM-YYYY']); ?>
<span class="glyphicon glyphicon-calendar form-control-feedback datepicker"></span>
</div>
</div>
</div>
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo __('email');?><em>* </em>
<!-- <?php echo $this->Form->input('UserPersonals.email', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $responseUserPersonal['email'], 'id' => 'email', 'label' => false, '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']); ?>
<input type="text" name="email" id="email" value="<?php echo $responseUserPersonal['email'] ?>" placeholder="mail@xxx.com" class="form-control-reg border-bottom-from">
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<!--<label class="label-text-sub">เพศ</label>-->
<?php echo __('gender'); ?>
<div class="radio-group">
<label class="radio-inline">
<input type="radio" name="UserPersonals[gender]" id="male" value="M" <?php echo ($responseUserPersonal[ 'gender']=='M' )
? 'checked="checked"' : null; ?>>
<?php echo __('male'); ?>
</label>
<label class="radio-inline">
<input type="radio" name="UserPersonals[gender]" id="female" value="F" <?php echo ($responseUserPersonal[ 'gender']=='F'
) ? 'checked="checked"' : null; ?>>
<?php echo __('female'); ?>
</label>
</div>
</div>
</div>
</div>
<div class="form-group has-feedback">
<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', 'value' => $responseUserPersonal['address'], 'id' => 'address', 'type' => 'text', 'label' => __('address'), '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 class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo __('blood group'); ?>
<div class="radio-group">
<label class="radio-inline">
<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 class="radio-inline">
<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 class="radio-inline">
<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 class="radio-inline">
<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>
</div>
</div>
</div>
</div>
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo __('country'); ?><em>* </em>
<?php
echo $this->Form->input( 'master_country_id', array(
'id' => 'master_country_id',
'label' => false,
'type' => 'select',
'require'=>'require',
'options' => $Country,
'value' => $responseUserPersonal['master_country_id'],
'empty' => '---Select---',
'default' => !empty($responseUserPersonal['master_country_id'])? $responseUserPersonal['master_country_id']:'',
'class' => 'form-control border-bottom-from label-text-sub require',
'style' => 'width:100%'
));
?>
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo __('mobile');?>
<em>* </em>
<?php echo $this->Form->input('UserPersonals.moblie_no', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $responseUserPersonal['moblie_no'], 'id' => 'moblieNo', 'type' => 'text', 'label' => false, 'maxlength' => '10', 'placeholder' => 'mobile']); ?>
<?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 class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo __('province'); ?><em>* </em>
<?php
echo $this->Form->input( 'master_province_id', array(
'id' => 'master_province_id',
'label' => false,
'type' => 'select',
'require'=>'require',
'options' => $Province,
'value' => $responseUserPersonal['master_province_id'],
'empty' => '---Select---',
'default' => !empty($responseUserPersonal['master_province_id'])? $responseUserPersonal['master_province_id']:'',
'class' => 'form-control border-bottom-from label-text-sub require',
'style' => 'width:100%'
));
?>
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo __('email');?>
<em>* </em>
<!-- <?php echo $this->Form->input('UserPersonals.email', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $responseUserPersonal['email'], 'id' => 'email', 'label' => false, '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']); ?>
<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">
<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', 'value' => $responseUserPersonal['address'], 'id' => 'address', 'type' => 'text', 'label' => __('address'), '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 class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo __('country'); ?>
<em>* </em>
<?php
echo $this->Form->input( 'master_country_id', array(
'id' => 'master_country_id',
'label' => false,
'type' => 'select',
'require'=>'require',
'options' => $Country,
'value' => $responseUserPersonal['master_country_id'],
'empty' => '---Select---',
'default' => !empty($responseUserPersonal['master_country_id'])? $responseUserPersonal['master_country_id']:'',
'class' => 'form-control border-bottom-from label-text-sub require',
'style' => 'width:100%'
));
?>
</div>
</div>
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo __('province'); ?>
<em>* </em>
<?php
echo $this->Form->input( 'master_province_id', array(
'id' => 'master_province_id',
'label' => false,
'type' => 'select',
'require'=>'require',
'options' => $Province,
'value' => $responseUserPersonal['master_province_id'],
'empty' => '---Select---',
'default' => !empty($responseUserPersonal['master_province_id'])? $responseUserPersonal['master_province_id']:'',
'class' => 'form-control border-bottom-from label-text-sub require',
'style' => 'width:100%'
));
?>
</div>
</div>
<div>
<?php // echo $this->Form->submit(__('SAVE')) ?>
<button type="submit" class="btn btn-quaternary mr-xs mb-sm button-text-profile">
<?php echo __('SAVE');?>
</button>
</div>
<?php echo $this->Form->end(); ?>
</div>
<div>
<?php // echo $this->Form->submit(__('SAVE')) ?>
<button type="submit" class="btn btn-quaternary mr-xs mb-sm button-text-profile">SAVE</button>
</div>
<?php echo $this->Form->end(); ?>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12">
<div class="modal fade" id="defaultModal" tabindex="-1" role="dialog" aria-labelledby="defaultModalLabel" aria-hidden="true">
<div class="modal-dialog box-ads">
<a class="close-modal" data-dismiss="modal">X </a>
<div class="container login-container">
<div class="owl-carousel owl-theme" data-plugin-options="{'items': 1}">
<div>
<img src="/img/core/img/connect-card-v2.png" class="img-responsive" id="img-upload" alt="Profile picture">
</div>
<div>
<div class="qrcode-profile"><br>
<?php echo __('Show QR Code to get permission');?>
<!--/.row profile-->
<!-- ************ user card ************ -->
<?php
$i=0;
foreach ($UserCards as $value) {
?>
<div class="row">
<div class="col-xs-1 col-sm-1 col-md-1 box-arrow left">
<i class="fa fa-angle-left prev"> </i>
</div>
<div class="col-xs-10 col-sm-10 col-md-10">
<div class="box-card">
<div data-toggle="modal" data-target="#card_<?php echo $i;?>" style="cursor: pointer; padding-right: 10px; padding-left: 10px;">
<div class="row">
<div class="col-xs-8">
<div style="font-size: 17px">
<br>
<label>id<label>
</div>
<div>
<?php echo $value['card_code'] ?>
</div>
<div>
<label style="font-size: 17px"><?php echo __('Firstname') ?></label>
<?php echo $value['prefix_name_th'].$value['firstname_th'].' '.$value['lastname_th'] ?>
</div>
</div>
<div class="col-xs-4">
<img src="/img/core/img/user-profile@3x.png" class="img-responsive">
</div>
</div>
<div class="row">
<div class="col-xs-10">
<label style="font-size: 17px"><?php echo __('Position') ?></label>
<?php echo $value['position_name'] ?>
</div>
</div>
<div class="row text-center">
<br>
<div class="col-xs-6">
<?php
$now = new Time($value['date_issued']);
$dateIssued = $now->i18nFormat('yyyy-MM-dd');
echo $this->DateFormat->formatDateThai($dateIssued);
?>
</div>
<div class="col-xs-6">
<?php
$now = new Time($value['date_expiry']);
$dateExpiry = $now->i18nFormat('yyyy-MM-dd');
echo $this->DateFormat->formatDateThai($dateExpiry);
?>
</div>
</div>
<img src="/img/core/img/connect-card-back.png" class="img-responsive" id="img-upload" alt="Profile picture">
<div class="qrcode-name">
<?php
$ex1 = new QRGenerator();
echo "<img src=".$ex1->generate()." style='position: absolute;width: 150px;border: solid 1px #000;' class='qrcode-name'>";
?>
<?php //echo $this->Html->image('/img/core/img/qr-code.jpg', array('div' => false, 'class' => 'qrcode-name','style' => 'position: absolute;width: 120px;')); ?>
<div class="row text-center">
<div class="col-xs-6">
<label style="font-size: 17px"><?php echo __('Card issue') ?></label>
</div>
<div class="col-xs-6">
<label style="font-size: 17px"><?php echo __('Old age') ?></label>
</div>
</div>
</div>
</div>
</div>
</div>
<!--/.box-card -->
<div class="col-xs-1 col-sm-1 col-md-1 box-arrow right">
<i class="fa fa-angle-right next"></i>
</div>
<div class="col-xs-12 col-sm-12 col-md-12">
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<h4><?php echo __('Company Information') ?></h4>
</div>
</div>
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<label style="font-size: 17px" class="col-xs-4 col-sm-4 col-md-4"><?php echo __('Firstname') ?></label>
<?php echo $value['prefix_name_th'].$value['firstname_th'] ?>
</div>
</div>
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<label style="font-size: 17px" class="col-xs-4 col-sm-4 col-md-4"><?php echo __('Lastname') ?></label>
<?php echo $value['lastname_th'] ?>
</div>
</div>
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<label style="font-size: 17px" class="col-xs-4 col-sm-4 col-md-4"><?php echo __('Company Name') ?></label>
<?php echo $value['morg']['org_name_th'] ?>
</div>
</div>
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<label style="font-size: 17px" class="col-xs-4 col-sm-4 col-md-4"><?php echo __('Department') ?></label>
<?php echo $value['section_name'] ?>
</div>
</div>
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<label style="font-size: 17px" class="col-xs-4 col-sm-4 col-md-4"><?php echo __('Position') ?></label>
<?php echo $value['position_name'] ?>
</div>
</div>
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<label style="font-size: 17px" class="col-xs-4 col-sm-4 col-md-4"><?php echo __('Card issue') ?></label>
<?php
$now = new Time($value['date_issued']);
$dateIssued = $now->i18nFormat('yyyy-MM-dd');
echo $this->DateFormat->formatDateThai($dateIssued);
?>
</div>
</div>
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<label style="font-size: 17px" class="col-xs-4 col-sm-4 col-md-4"><?php echo __('Old age') ?></label>
<?php
$now = new Time($value['date_expiry']);
$dateExpiry = $now->i18nFormat('yyyy-MM-dd');
echo $this->DateFormat->formatDateThai($dateExpiry);
?>
</div>
</div>
</div>
<!--/.col-xs-12 -->
</div>
</div>
</div>
</div>
<!--/.row -->
<script>
$(document).ready(function() {
$("#email").on('change',function(){
var userId = document.getElementById("userId").value;
var email = document.getElementById("email").value;
$.post("/Checkemails/checkemail", {email: email,userId: userId}, function(data) {
// console.log(data);
data = jQuery.parseJSON(data);
if(data['chk'] == 'false'){
alert(<?php echo __('This email is already in the system.') ?>);
return false;
}
});
});
$("#moblieNo").on('change',function(){
var elem = document.getElementById('moblieNo').value;
// console.log(elem);
if(!elem.match(/^([A-Za-zก-๙])+$/i)){
alert(<?php echo __('only numbers') ?>);
return false;
}
})
});
<?php
$i++;
}
?>
<!-- ************ end user card ************ -->
<!--- *************** add card ******************* -->
function validateForm() {
var firstname_th = document.getElementById("firstname_th").value;
if (firstname_th == null || firstname_th == "") {
alert(<?php echo __('Please enter your firstname.') ?>);
return false;
}
var lastname_th = document.getElementById("lastname_th").value;
if (lastname_th == null || lastname_th == "") {
alert(<?php echo __('Please enter your lastname.') ?>);
return false;
}
<?php echo $this->element('card_from/from_add_card'); ?>
var birthdate = document.getElementById("datepicker").value;
if (birthdate == null || birthdate == "") {
alert(<?php echo __('Please enter your birthdate.') ?>);
return false;
<!--- *************** end card ******************* -->
</div>
<!--/.owl-carousel -->
<!--- *************** model list ******************* -->
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12">
<div class="modal fade" id="defaultModal" tabindex="-1" role="dialog" aria-labelledby="defaultModalLabel" aria-hidden="true">
<div class="modal-dialog box-ads">
<a class="close-modal" data-dismiss="modal">X </a>
<div class="container login-container">
<div class="owl-carousel owl-theme" data-plugin-options="{'items': 1}">
<div>
<img src="/img/core/img/connect-card-v2.png" class="img-responsive" id="img-upload" alt="Profile picture">
</div>
<div>
<div class="qrcode-profile"><br>
<?php echo __('Show QR Code to get permission');?>
</div>
<img src="/img/core/img/connect-card-back.png" class="img-responsive" id="img-upload" alt="Profile picture">
<div class="qrcode-name">
<?php
$ex1 = new QRGenerator();
echo "<img src=".$ex1->generate()." style='position: absolute;width: 150px;border: solid 1px #000;' class='qrcode-name'>";
?>
<?php //echo $this->Html->image('/img/core/img/qr-code.jpg', array('div' => false, 'class' => 'qrcode-name','style' => 'position: absolute;width: 120px;')); ?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!--/.row modal card-->
<?php
if(!empty($UserCards)){
$i=0;
foreach ($UserCards as $value) {
echo $this->element('card_from/from_0',array('value' => $value,'i'=> $i));
$i++;
}
}
?>
var moblieNo = document.getElementById("moblieNo").value;
if (moblieNo == null || moblieNo == "") {
alert(<?php echo __('Please enter your mobile.') ?>);
return false;
}
if(document.getElementById("moblieNo").value.length != 10)
{
alert(<?php echo __('Please enter a 10 digit mobile number.') ?>);
return false;
}
<!--- *************** end model list ******************* -->
var email = document.getElementById("email").value;
if (email == null || email == "") {
alert(<?php echo __('Please enter your email address.') ?>);
return false;
}
var email = $("#email").val();
if (/(.+)@(.+){2,}\.(.+){2,}/.test(email)) { } else {
alert(<?php echo __('Email address format wrong, Please enter the correct number.') ?>);
return false;
}
// var email = document.getElementById("email").value;
// $.post("/Checkemails/checkemail", {email: email}, function(data) {
// data = jQuery.parseJSON(data);
// if(data['chk'] == 'false'){
// alert("อีเมลล์นี้มีในระบบแล้ว");
// return false;
// }
// });
var master_country_id = document.getElementById("master_country_id").value;
if (master_country_id == null || master_country_id == "") {
alert(<?php echo __('Please specify country') ?>);
return false;
}
var master_province_id = document.getElementById("master_province_id").value;
if (master_province_id == null || master_province_id == "") {
alert(<?php echo __('Please specify province') ?>);
return false;
}
$("body").delegate(".is_active", "click", function () {
$('.is_active').not(this).prop('checked', false);
return true;
});
}
</div>
<!--/.row top-->
<script type="text/javascript">
</script>
<style>
......@@ -413,17 +507,214 @@
.form-control-reg{
height : 50px;
}
.box-card {
border: 1px solid #ccc;
height: 200px;
margin-top: 10px;
border-radius: 20px;
box-shadow: 2px 2px 4px #ccc;
margin-bottom: 10px;
}
.box-arrow {
font-size: 36px;
height: 200px;
padding-top: 20%;
cursor: pointer;
}
.box-arrow.left {
padding-right: 0px;
text-align: right;
}
.box-arrow.right {
padding-left: 0px;
}
.box-ads {
width: 1%;
display: table;
margin: auto;
padding: auto;
position: relative;
padding-top: 10px;
margin-top: 5px;
}
.box-ads .close-modal {
position: absolute;
top: 0;
right: 0;
width: 40px;
height: 40px;
background-color: #000;
color: #fff;
cursor: pointer;
font-size: 20px;
border-radius: 20px;
padding-top: 10px;
margin-right: 10px;
text-align: center;
z-index: 9999;
}
.box-ads .close-modal:hover {
text-decoration: none;
}
.rotate270 .row {
-webkit-transform: rotate(270deg);
-moz-transform: rotate(270deg);
-o-transform: rotate(270deg);
writing-mode: rl-tb;
position: absolute;
font-size: 30px;
display:block;
z-index:3999;
}
</style>
<script>
<?php $this->append('scriptBottom'); ?>
<script type="text/javascript">
var ALERT_TITLE = "";
var ALERT_BUTTON_TEXT = "Ok";
$(document).ready(function() {
$("#email").on('change',function(){
var userId = document.getElementById("userId").value;
var email = document.getElementById("email").value;
$.post("/Checkemails/checkemail", {email: email,userId: userId}, function(data) {
// console.log(data);
data = jQuery.parseJSON(data);
if(data['chk'] == 'false'){
alert("<?php echo __('This email is already in the system.'); ?>");
return false;
}
});
});
$("#moblieNo").on('change',function(){
var elem = document.getElementById('moblieNo').value;
// console.log(elem);
if(!elem.match(/^([A-Za-zก-๙])+$/i)){
alert("<?php echo __('only numbers'); ?>");
return false;
}
});
//==================================================
// CHANGE Province According Country
//==================================================
$("#master_country_id").on('change', function () {
var id = $(this).val();
if (id) {
var dataString = 'id=' + id;
$.ajax({
type: "POST",
url: '/provinces/getProvince',
data: dataString,
cache: false,
success: function (html) {
$("#master_province_id").html(html);
}
});
}
});
});
$('.owl-carousel').owlCarousel({
loop: false,
items: 1,
rewindNav: false,
startPosition: 'URLHash',
});
owl = $('.owl-carousel').owlCarousel();
$(".prev").click(function () {
owl.trigger('prev.owl.carousel');
});
$(".next").click(function () {
owl.trigger('next.owl.carousel');
});
function validateForm() {
var firstname_th = document.getElementById("firstname_th").value;
if (firstname_th == null || firstname_th == "") {
alert("<?php echo __('Please enter your firstname.'); ?>");
return false;
}
var lastname_th = document.getElementById("lastname_th").value;
if (lastname_th == null || lastname_th == "") {
alert("<?php echo __('Please enter your lastname.'); ?>");
return false;
}
var birthdate = document.getElementById("datepicker").value;
if (birthdate == null || birthdate == "") {
alert("<?php echo __('Please enter your birthdate.'); ?>");
return false;
}
var moblieNo = document.getElementById("moblieNo").value;
if (moblieNo == null || moblieNo == "") {
alert("<?php echo __('Please enter your mobile.'); ?>");
return false;
}
if(document.getElementById("moblieNo").value.length != 10)
{
alert("<?php echo __('Please enter a 10 digit mobile number.'); ?>");
return false;
}
var email = document.getElementById("email").value;
if (email == null || email == "") {
alert("<?php echo __('Please enter your email address.'); ?>");
return false;
}
var email = $("#email").val();
if (/(.+)@(.+){2,}\.(.+){2,}/.test(email)) { } else {
alert("<?php echo __('Email address format wrong, Please enter the correct number.'); ?>");
return false;
}
var master_country_id = document.getElementById("master_country_id").value;
if (master_country_id == null || master_country_id == "") {
alert("<?php echo __('Please specify country') ?>");
return false;
}
var master_province_id = document.getElementById("master_province_id").value;
if (master_province_id == null || master_province_id == "") {
alert("<?php echo __('Please specify province') ?>");
return false;
}
$("body").delegate(".is_active", "click", function () {
$('.is_active').not(this).prop('checked', false);
return true;
});
}
$(function () {
//==================================================
// CHANGE Date Times
//==================================================
$('#datepicker').datepicker({
format: 'dd/mm/yyyy'
});
});
if (document.getElementById) {
window.alert = function (txt) {
createCustomAlert(txt);
}
}
function createCustomAlert(txt) {
d = document;
......@@ -465,78 +756,7 @@
function removeCustomAlert() {
document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer"));
}
function ful() {
alert('Alert this pages');
}
</script>
<?php $this->append('scriptBottom'); ?>
<script type="text/javascript">
$(function () {
//==================================================
// CHANGE Date Times
//==================================================
$('#datepicker').datepicker({
format: 'dd/mm/yyyy'
});
});
//==================================================
// CHANGE Province According Country
//==================================================
$(document).ready(function () {
$("#master_country_id").on('change', function () {
var id = $(this).val();
if (id) {
var dataString = 'id=' + id;
$.ajax({
type: "POST",
url: '/provinces/getProvince',
data: dataString,
cache: false,
success: function (html) {
$("#master_province_id").html(html);
}
});
}
});
});
</script>
<?php $this->end();?>
<style>
.box-arrow{
font-size:36px;
height: 200px;
padding-top:20%;
cursor: pointer;
}
.box-ads{
width: 1%;
display: table;
margin: auto;
position: relative;
padding-top: 10px;
margin-top: 5px;
}
.box-ads .close-modal{
position:absolute;
top:0;
right: 0;
width: 40px;
height: 40px;
background-color: #000;
color: #fff;
cursor: pointer;
font-size: 20px;
border-radius: 20px;
padding-top: 10px;
margin-right: 10px;
text-align: center;
z-index: 9999;
}
.box-ads .close-modal:hover{
text-decoration: none;
}
</style>
\ 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