Commit 68b33d4e by Prasong Putichanchai

Merge branch 'integration' into prasong

# Conflicts:
#	.gitignore
parents f3e159f1 fa4192db
<?php
namespace App\Controller;
use App\Controller\AppController;
class CheckemailsController extends AppController {
public function initialize() {
parent::initialize();
$this->Auth->allow('checkemail');
}
public function checkemail(){
// die('jjjjj');
$this->autoRender = false;
if ($this->request->is('post')) {
$this->loadModel('UserPersonals');
$emails = $this->UserPersonals->find('all',[
'conditions' => [
'email' => $this->request->data['email']
]
])->first();
if(!empty($emails)&&$emails['email']!=''&&$emails['email']!='-'){
if(!empty($this->request->data['userId'])){
if($this->request->data['userId'] == $emails['user_id']){
$emails['chk'] = 'true';
$data = json_encode($emails);
echo $data;
}
$emails['chk'] = 'false';
$data = json_encode($emails);
echo $data;
}
$emails['chk'] = 'false';
$data = json_encode($emails);
echo $data;
}else{
$emails['chk'] = 'true';
$data = json_encode($emails);
echo $data;
}
}
}
}
\ No newline at end of file
...@@ -8,13 +8,13 @@ use Cake\Http\Client; ...@@ -8,13 +8,13 @@ use Cake\Http\Client;
class ProfilesController extends AppController class ProfilesController extends AppController
{ {
public function index($id = 13112){ public function index(){
$this->viewBuilder()->layout('blank'); $this->viewBuilder()->layout('blank');
/*******************************/ /*******************************/
$id = $this->Auth->user('id'); $id = $this->Auth->user('id');
$this->loadModel('Users'); $this->loadModel('Users');
$responseUserProfile = $this->Users->get($id, [ $responseUserProfile = $this->Users->get($id, [
...@@ -28,7 +28,6 @@ class ProfilesController extends AppController ...@@ -28,7 +28,6 @@ class ProfilesController extends AppController
'user_id' => $id ] 'user_id' => $id ]
])->first(); ])->first();
//********DropdownCountry******** //********DropdownCountry********
$this->loadModel('MasterCountries'); $this->loadModel('MasterCountries');
$Country = $this->MasterCountries->find('list', [ $Country = $this->MasterCountries->find('list', [
...@@ -47,8 +46,8 @@ class ProfilesController extends AppController ...@@ -47,8 +46,8 @@ class ProfilesController extends AppController
'keyField' => 'id', 'keyField' => 'id',
'valueField' => 'province_name_th' 'valueField' => 'province_name_th'
]) ])
->where(['master_country_id =' => $responseUserPersonal['master_country_id']]) ->where(['master_country_id =' => $responseUserPersonal['master_country_id']])
->order(['province_name_th']); ->order(['province_name_th']);
// pr($Province);die; // pr($Province);die;
if(!empty($Province)) $Province = $Province->toArray(); if(!empty($Province)) $Province = $Province->toArray();
...@@ -56,6 +55,8 @@ class ProfilesController extends AppController ...@@ -56,6 +55,8 @@ class ProfilesController extends AppController
$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'])) {
// pr($this->request->data['email']);die;
$data = $this->request->data; $data = $this->request->data;
// pr($this->request->data);die; // pr($this->request->data);die;
...@@ -68,23 +69,27 @@ class ProfilesController extends AppController ...@@ -68,23 +69,27 @@ class ProfilesController extends AppController
] ]
] ]
)->first(); )->first();
// pr($this->request->data['email']);die;
if($userPersonals['email'] == $this->request->data['UserPersonals']['email']){ if($userPersonals['email'] == $this->request->data['email']){
$chkemail = true; $chkemail = true;
}else{ }else{
$userPersonals = $this->UserPersonals->find('all', $useremails = $this->UserPersonals->find('all',
[ [
'limit' => 1, 'limit' => 1,
'conditions' => [ 'conditions' => [
'email' => $data['UserPersonals']['email'] 'email' => $data['email']
] ]
] ]
)->toArray(); )->first();
if(empty($userPersonals)){ if(empty($useremails)){
$chkemail = true; $chkemail = true;
// pr('true');die;
}else{ }else{
$chkemail = false; // pr('false');die;
$chkemail = false;
} }
} }
...@@ -92,17 +97,20 @@ class ProfilesController extends AppController ...@@ -92,17 +97,20 @@ class ProfilesController extends AppController
$birthdate = explode("/", $this->request->data['UserPersonals']['birthdate']); $birthdate = explode("/", $this->request->data['UserPersonals']['birthdate']);
$birthdate = $birthdate[2].'-'.$birthdate[1].'-'.$birthdate[0]; $birthdate = $birthdate[2].'-'.$birthdate[1].'-'.$birthdate[0];
// pr($userPersonals);die;
$userPersonals = $this->UserPersonals->patchEntity($userPersonals, $data['UserPersonals']); // $userPersonals = $this->UserPersonals->patchEntity($userPersonals, $data['UserPersonals']);
$userPersonals['firstname_th'] = $this->request->data['UserPersonals']['firstname_th']; $userPersonals['firstname_th'] = $this->request->data['UserPersonals']['firstname_th'];
$userPersonals['lastname_th'] = $this->request->data['UserPersonals']['lastname_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['birthdate'] = $birthdate;
$userPersonals['user_id'] = $data['Users']['user_id']; $userPersonals['user_id'] = $data['Users']['user_id'];
$userPersonals['master_country_id'] = $this->request->data['master_country_id']; $userPersonals['master_country_id'] = $this->request->data['master_country_id'];
$userPersonals['master_province_id'] = $this->request->data['master_province_id']; $userPersonals['master_province_id'] = $this->request->data['master_province_id'];
$userPersonals['modified_by'] = $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)) { if ($this->UserPersonals->save($userPersonals)) {
$this->Flash->success(__('Update Complete.')); $this->Flash->success(__('Update Complete.'));
return $this->redirect(['action' => 'index']); return $this->redirect(['action' => 'index']);
...@@ -113,7 +121,7 @@ class ProfilesController extends AppController ...@@ -113,7 +121,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', 'responseUserPersonal')); $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']);
} }
/*****************************************************************************/ /*****************************************************************************/
......
...@@ -262,6 +262,7 @@ class UserCardsController extends AppController ...@@ -262,6 +262,7 @@ class UserCardsController extends AppController
$this->loadModel('MasterOrganizations'); $this->loadModel('MasterOrganizations');
if ($this->request->is('post')) { if ($this->request->is('post')) {
// pr($this->request->data());die; // pr($this->request->data());die;
// pr($this->Auth->user('id'));die;
$birthdate = explode("/", $this->request->data['UserCards']['birthdate']); $birthdate = explode("/", $this->request->data['UserCards']['birthdate']);
$birthdate = $birthdate['2'].'-'.$birthdate['1'].'-'.$birthdate['0']; $birthdate = $birthdate['2'].'-'.$birthdate['1'].'-'.$birthdate['0'];
$TempUserCards = $this->TempUserCards->find('all', [ $TempUserCards = $this->TempUserCards->find('all', [
...@@ -305,8 +306,27 @@ class UserCardsController extends AppController ...@@ -305,8 +306,27 @@ class UserCardsController extends AppController
$userCard['user_id'] = $this->Auth->user('id'); $userCard['user_id'] = $this->Auth->user('id');
// pr($userCard);die; // pr($userCard);die;
if ($this->UserCards->save($userCard)) { if ($this->UserCards->save($userCard)) {
// pr('sdsd');die;
$TempUserCards['is_used'] = 0; $TempUserCards['is_used'] = 0;
$this->TempUserCards->save($TempUserCards); $this->TempUserCards->save($TempUserCards);
$this->loadModel('UserEntities');
$UserEntities = $this->UserEntities->find('all', [
'conditions' => [
'user_id' => $this->Auth->user('id'),
'entity_code' => $TempUserCards['organize_id']
]
])->first();
if(empty($UserEntities)){
// pr('sdsd');die;
$UserEntities = $this->UserEntities->newEntity();
$UserEntities['entity_code'] = $TempUserCards['organize_id'];
$UserEntities['user_id'] = $this->Auth->user('id');
$UserEntities['created_by'] = $this->Auth->user('id');
$UserEntities['modified_by'] = $this->Auth->user('id');
$this->UserEntities->save($UserEntities);
}
$this->Flash->success(__('บันทึกสำเร็จ')); $this->Flash->success(__('บันทึกสำเร็จ'));
return $this->redirect(['controller' => 'Profiles', 'action' => 'index']); return $this->redirect(['controller' => 'Profiles', 'action' => 'index']);
} }
......
...@@ -117,13 +117,12 @@ class UsersController extends AppController { ...@@ -117,13 +117,12 @@ class UsersController extends AppController {
'keyField' => 'id', 'keyField' => 'id',
'valueField' => 'province_name_th' 'valueField' => 'province_name_th'
] ]
); );
if(!empty($provinces)) $provinces = $provinces->toArray(); if(!empty($provinces)) $provinces = $provinces->toArray();
$this->set(compact('provinces','countries')); $this->set(compact('provinces','countries'));
$this->viewBuilder()->layout('blank'); $this->viewBuilder()->layout('blank');
} }
#--------------------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------------------
#Signup #Signup
......
<?php
namespace App\Model\Entity;
use Cake\ORM\Entity;
/**
* Building Entity
*/
class UserEntity extends Entity
{
/**
* Fields that can be mass assigned using newEntity() or patchEntity().
*
* Note that when '*' is set to true, this allows all unspecified fields to
* be mass assigned. For security purposes, it is advised to set '*' to false
* (or remove it), and explicitly make individual fields accessible as needed.
*
* @var array
*/
}
<?php
namespace App\Model\Table;
use Cake\ORM\Query;
use Cake\ORM\RulesChecker;
use Cake\ORM\Table;
use Cake\Validation\Validator;
class UserEntitiesTable extends Table
{
/**
* Initialize method
*
* @param array $config The configuration for the Table.
* @return void
*/
public function initialize(array $config)
{
parent::initialize($config);
$this->setTable('core.user_entities');
$this->setDisplayField('id');
$this->setPrimaryKey('id');
$this->addBehavior('Timestamp');
}
/**
* Default validation rules.
*
* @param \Cake\Validation\Validator $validator Validator instance.
* @return \Cake\Validation\Validator
*/
public function validationDefault(Validator $validator)
{
// return $validator;
}
/**
* Returns a rules checker object that will be used for validating
* application integrity.
*
* @param \Cake\ORM\RulesChecker $rules The rules object to be modified.
* @return \Cake\ORM\RulesChecker
*/
/**
* Returns the database connection name to use by default.
*
* @return string
*/
public static function defaultConnectionName()
{
return 'core';
}
}
<?php <?php
class QRGenerator { class QRGenerator {
protected $size; protected $size;
protected $data; protected $data;
protected $encoding; protected $encoding;
protected $errorCorrectionLevel; protected $errorCorrectionLevel;
protected $marginInRows; protected $marginInRows;
protected $debug; protected $debug;
public function __construct($data='1334554 5454 545',$size='300',$encoding='UTF-8',$errorCorrectionLevel='L',$marginInRows=4,$debug=false) { public function __construct($data='1334554 5454 545',$size='300',$encoding='UTF-8',$errorCorrectionLevel='L',$marginInRows=4,$debug=false) {
$this->data=urlencode($data); $this->data=urlencode($data);
$this->size=($size>100 && $size<800)? $size : 300; $this->size=($size>100 && $size<800)? $size : 300;
$this->encoding=($encoding == 'Shift_JIS' || $encoding == 'ISO-8859-1' || $encoding == 'UTF-8') ? $encoding : 'UTF-8'; $this->encoding=($encoding == 'Shift_JIS' || $encoding == 'ISO-8859-1' || $encoding == 'UTF-8') ? $encoding : 'UTF-8';
$this->errorCorrectionLevel=($errorCorrectionLevel == 'L' || $errorCorrectionLevel == 'M' || $errorCorrectionLevel == 'Q' || $errorCorrectionLevel == 'H') ? $errorCorrectionLevel : 'L'; $this->errorCorrectionLevel=($errorCorrectionLevel == 'L' || $errorCorrectionLevel == 'M' || $errorCorrectionLevel == 'Q' || $errorCorrectionLevel == 'H') ? $errorCorrectionLevel : 'L';
$this->marginInRows=($marginInRows>0 && $marginInRows<10) ? $marginInRows:4; $this->marginInRows=($marginInRows>0 && $marginInRows<10) ? $marginInRows:4;
$this->debug = ($debug==true)? true:false; $this->debug = ($debug==true)? true:false;
} }
public function generate(){ public function generate(){
$QRLink = "https://chart.googleapis.com/chart?cht=qr&chs=".$this->size."x".$this->size. "&chl=" . $this->data . $QRLink = "https://chart.googleapis.com/chart?cht=qr&chs=".$this->size."x".$this->size. "&chl=" . $this->data .
"&choe=" . $this->encoding . "&choe=" . $this->encoding .
"&chld=" . $this->errorCorrectionLevel . "|" . $this->marginInRows; "&chld=" . $this->errorCorrectionLevel . "|" . $this->marginInRows;
if ($this->debug) echo $QRLink; if ($this->debug) echo $QRLink;
return $QRLink; return $QRLink;
}
} }
}
?> ?>
<div class="row"> <div class="row">
...@@ -50,32 +50,32 @@ public function generate(){ ...@@ -50,32 +50,32 @@ public function generate(){
<br><br> <br><br>
<div class="row"> <div class="row">
<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->create('UserProfiles', ['id' => 'frmSignIn', 'type' => 'file', 'name' => 'frmSignIn']); ?> <?php echo $this->Form->create('UserProfiles', ['id' => 'frmSignIn', 'type' => 'file','name' => 'frmSignIn','role' => 'form', 'onsubmit' => 'return validateForm()']); ?>
<?php echo $this->Flash->render() ?> <?php echo $this->Flash->render() ?>
<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->hidden('Users.user_id', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'value' => $responseUserProfile['id'], 'id' => 'userId', 'type' => 'text', 'label' => __('ชื่อผู้ใช้งาน'), 'placeholder' => 'USERNAME']); ?> <?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' => __('ชื่อผู้ใช้งาน'), 'placeholder' => 'USERNAME']); ?>
<?php echo $this->Form->input('Users.username', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'value' => $username, 'id' => 'username', 'type' => 'text', 'label' => __('ชื่อผู้ใช้งาน'), 'placeholder' => 'USERNAME', 'readonly']); ?> <?php echo $this->Form->input('Users.username', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $username, 'id' => 'username', 'type' => 'text', 'label' => __('ชื่อผู้ใช้งาน'), 'placeholder' => 'USERNAME', 'readonly']); ?>
<?php // echo $this->Form->input('user_id', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'value' => $userProfile->username, 'id' => 'userId', 'type' => 'text', 'label' => __('ชื่อผู้ใช้งาน'), 'placeholder' => 'USERNAME']); ?> <?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>
<?php // foreach ($userProfile->user['user_personals'] as $k => $userProfiles): ?> <?php // foreach ($userProfile->user['user_personals'] as $k => $userProfiles): ?>
<?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' => $responseUserPersonal['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', 'value' => $responseUserPersonal['firstname_th'], 'id' => 'firstname_th', 'type' => 'text', 'label' => __('ชื่อ'), 'placeholder' => 'ชื่อ']); ?>
<?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' => 'ชื่อ - นามสกุล']); ?>
</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' => $responseUserPersonal['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', 'value' => $responseUserPersonal['lastname_th'], 'id' => 'lastname_th', 'type' => 'text', 'label' => __('นามสกุล'), 'placeholder' => 'นามสกุล']); ?>
<?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' => 'ชื่อ - นามสกุล']); ?>
</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.birthdate', ['class' => 'form-control-reg border-bottom-from required', 'value' => $dateNow, 'id' => 'datepicker', 'type' => 'text', 'label' => __('วันเดือนปีเกิด'), 'placeholder' => 'DD-MM-YYYY', 'required']); ?> <?php echo $this->Form->input('UserPersonals.birthdate', ['class' => 'form-control-reg border-bottom-from', 'value' => $dateNow, 'id' => 'datepicker', 'type' => 'text', 'label' => __('วันเดือนปีเกิด'), 'placeholder' => 'DD-MM-YYYY']); ?>
<span class="glyphicon glyphicon-calendar form-control-feedback datepicker"></span> <span class="glyphicon glyphicon-calendar form-control-feedback datepicker"></span>
</div> </div>
</div> </div>
...@@ -114,19 +114,21 @@ public function generate(){ ...@@ -114,19 +114,21 @@ public function generate(){
</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' => $responseUserPersonal['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', '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' => $responseUserPersonal['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', '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']); ?> <?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> </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' => $responseUserPersonal['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', '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>
...@@ -142,7 +144,7 @@ public function generate(){ ...@@ -142,7 +144,7 @@ public function generate(){
'value' => $responseUserPersonal['master_country_id'], 'value' => $responseUserPersonal['master_country_id'],
'empty' => '---Select---', 'empty' => '---Select---',
'default' => !empty($responseUserPersonal['master_country_id'])? $responseUserPersonal['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',
'style' => 'width:100%' 'style' => 'width:100%'
)); ));
?> ?>
...@@ -160,7 +162,7 @@ public function generate(){ ...@@ -160,7 +162,7 @@ public function generate(){
'value' => $responseUserPersonal['master_province_id'], 'value' => $responseUserPersonal['master_province_id'],
'empty' => '---Select---', 'empty' => '---Select---',
'default' => !empty($responseUserPersonal['master_province_id'])? $responseUserPersonal['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',
'style' => 'width:100%' 'style' => 'width:100%'
)); ));
?> ?>
...@@ -204,87 +206,257 @@ public function generate(){ ...@@ -204,87 +206,257 @@ public function generate(){
</div> </div>
</div> </div>
</div> </div>
<?php $this->append('scriptBottom'); ?>
<script> <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("อีเมลล์นี้มีในระบบแล้ว");
return false;
}
});
});
});
function validateForm() { function validateForm() {
var firstname = document.forms["createAccount"]["firstname"].value; var firstname_th = document.getElementById("firstname_th").value;
if (firstname == null || firstname == "") { if (firstname_th == null || firstname_th == "") {
alert("กรุณากรอกชื่อ"); alert("กรุณากรอกชื่อ");
return false; return false;
} }
var lastname = document.forms["createAccount"]["lastname"].value; var lastname_th = document.getElementById("lastname_th").value;
if (lastname == null || lastname == "") { if (lastname_th == null || lastname_th == "") {
alert("กรุณากรอกนามสกุล"); alert("กรุณากรอกนามสกุล");
return false; return false;
} }
var username = document.forms["createAccount"]["username"].value;
if (username == null || username == "") { var birthdate = document.getElementById("datepicker").value;
alert("กรุณากรอกชื่อผู้ใช้งานของท่าน"); if (birthdate == null || birthdate == "") {
return false; alert("กรุณากรอก วันเดือนปีเกิดของท่าน");
return false;
} }
// var birthdate = document.forms["createAccount"]["birthdate"].value; var moblieNo = document.getElementById("moblieNo").value;
// if (birthdate == null || birthdate == "") { if (moblieNo == null || moblieNo == "") {
// alert("กรุณากรอก วันเดือนปีเกิดของท่าน"); alert("กรุณากรอก เบอร์โทรศัพท์ของท่าน");
// return false; return false;
// }
// var person_card_no = document.forms["createAccount"]["person_card_no"].value;
// if (person_card_no == null || person_card_no == "") {
// alert("กรุณากรอกเลขบัตรประชาชน");
// return false;
// }
// if(document.forms["createAccount"]["data[person_card_no]"].value.length < 13 || document.forms["createAccount"]["data[person_card_no]"].value.length > 13)
// {
// alert('กรุณากรอกเลขบัตรประชาชนให้ครบ 13 หลัก');
// return false;
// }
var phone_no = document.forms["createAccount"]["phone_no"].value;
// if (phone_no == null || phone_no == "") {
// alert("กรุณากรอก เบอร์โทรศัพท์ของท่าน");
// return false;
} }
if(document.forms["createAccount"]["phone_no"].value.length < 10 || document.forms["createAccount"]["phone_no"].value.length > 10) if(document.getElementById("moblieNo").value.length != 12)
{ {
alert('กรุณากรอกเบอร์โทรศัพท์ ให้ครบ 10 หลัก'); alert('กรุณากรอกเบอร์โทรศัพท์ ให้ครบ 10 หลัก');
return false; return false;
} }
// var lastname = document.forms["createAccount"]["data[lastname]"].value;
// if (lastname == null || lastname == "") {
// alert("กรุณากรอกรหัสผ่าน");
// return false;
// }
var email = document.forms["createAccount"]["email"].value; var email = document.getElementById("email").value;
if (email == null || email == "") { if (email == null || email == "") {
alert("กรุณากรอกอีเมลล์"); alert("กรุณากรอกอีเมลล์");
return false; return false;
} }
// Validate Email
var email = $("#fremail").val(); var email = $("#email").val();
if ((/(.+)@(.+){2,}\.(.+){2,}/.test(email)) || email=="" || email==null) { } else { if (/(.+)@(.+){2,}\.(.+){2,}/.test(email)) { } else {
alert("รูปแบบที่อยู่อีเมลล์ผิด กรุณากรอกให้ถูกต้อง"); alert("รูปแบบที่อยู่อีเมลล์ผิด กรุณากรอกให้ถูกต้อง");
return false; 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;
// }
// });
$("body").delegate(".is_active", "click", function () {
$('.is_active').not(this).prop('checked', false);
return true;
});
}
</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>
<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> </script>
<script type="text/javascript">
<?php $this->append('scriptBottom'); ?>
<script type="text/javascript">
$(function () { $(function () {
$('#moblieNo').inputmask('999-999-9999'); $('#moblieNo').inputmask('999-999-9999');
$('#officePhone').inputmask('99-999-9999'); $('#officePhone').inputmask('99-999-9999');
//================================================== //==================================================
// CHANGE Date Times // CHANGE Date Times
//================================================== //==================================================
$('#datepicker').datepicker({ $('#datepicker').datepicker({
format: 'dd/mm/yyyy' format: 'dd/mm/yyyy'
}); });
}); });
//================================================== //==================================================
// CHANGE Province According Country // CHANGE Province According Country
//================================================== //==================================================
$(document).ready(function () { $(document).ready(function () {
$("#master_country_id").on('change', function () { $("#master_country_id").on('change', function () {
var id = $(this).val(); var id = $(this).val();
......
...@@ -10,6 +10,7 @@ use Cake\I18n\Time; ...@@ -10,6 +10,7 @@ use Cake\I18n\Time;
</div> </div>
</div> </div>
<div class="col-xs-9 col-sm-9 col-md-9 box-card"> <div class="col-xs-9 col-sm-9 col-md-9 box-card">
<div data-toggle="modal" data-target="#defaultModal" style="text-align: center; cursor: pointer;">
<div class="row"> <div class="row">
<div class="col-xs-1"> <div class="col-xs-1">
</div> </div>
...@@ -26,9 +27,9 @@ use Cake\I18n\Time; ...@@ -26,9 +27,9 @@ use Cake\I18n\Time;
</div> </div>
</div> </div>
<div class="col-xs-4"> <div class="col-xs-4">
<div data-toggle="modal" data-target="#defaultModal" style="text-align: center; cursor: pointer;">
<img src="/img/core/img/user-profile@3x.png" class="img-responsive"> <img src="/img/core/img/user-profile@3x.png" class="img-responsive">
</div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
...@@ -65,8 +66,10 @@ use Cake\I18n\Time; ...@@ -65,8 +66,10 @@ use Cake\I18n\Time;
<div class="col-xs-5"> <div class="col-xs-5">
<label style="font-size: 17px">วันหมดออายุ</label> <label style="font-size: 17px">วันหมดออายุ</label>
</div> </div>
</div> </div>
</div>
</div> </div>
<!--/.box-card -->
<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">
<div> <div>
<i class = "fa fa-angle-right next" ></i> <i class = "fa fa-angle-right next" ></i>
...@@ -153,18 +156,18 @@ use Cake\I18n\Time; ...@@ -153,18 +156,18 @@ use Cake\I18n\Time;
</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('UserCards.employee', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'id' => 'employee', 'type' => 'text', 'label' => __('Ref 1'), 'placeholder' => 'รหัสพนักงาน / รหัสนักศึกษา', 'disabled', 'required']); ?> <?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']); ?>
</div> </div>
</div> </div>
<div class="form-group has-feedback bootstrap-iso"> <div class="form-group has-feedback bootstrap-iso">
<div class="col-xs-12 col-sm-12 col-md-12"> <div class="col-xs-12 col-sm-12 col-md-12">
<label class="label-text-sub"><?php echo __('Ref 2');?></label> <label class="label-text-sub"><?php echo __('Ref 2');?></label>
<input type="text" name="UserCards[birthdate]" id="date" placeholder="กรุณาระบุวันเดือนปีเกิด" value="" placeholder="DD-MM-YYYY" data-date-format="mm/dd/yyyy" class="form-control-reg border-bottom-from" disabled> <input type="text" name="UserCards[birthdate]" id="date" placeholder="Ref 2" value="" 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> <span class="glyphicon glyphicon-calendar form-control-feedback"></span>
</div> </div>
</div> </div>
<div> <div>
<button type="submit" class="btn btn-quaternary mr-xs mb-sm button-text-profile">ตรวจสอบ</button> <button type="submit" class="btn btn-quaternary mr-xs mb-sm button-text-profile" id="checkbutton">ตรวจสอบ</button>
</div> </div>
<?php echo $this->Form->end(); ?> <?php echo $this->Form->end(); ?>
</div> </div>
...@@ -175,10 +178,11 @@ use Cake\I18n\Time; ...@@ -175,10 +178,11 @@ use Cake\I18n\Time;
<div class="row"> <div class="row">
<div class="col-xs-12 col-sm-12 col-md-12"> <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 fade" id="defaultModal" tabindex="-1" role="dialog" aria-labelledby="defaultModalLabel" aria-hidden="true">
<div class="modal-dialog"> <div class="modal-dialog box-ads">
<div class="col-md-6"> <a class="close-modal" data-dismiss="modal">X </a>
<div class="container login-container">
<div class = ""> <div class = "">
<div class="owl-carousel owl-theme" data-plugin-options="{'items': 1, 'margin': 10}"> <div class="owl-carousel owl-theme" data-plugin-options="{'items': 1}">
<div class = "row rotate270 form_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;')); ?> <?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="row date-name"> <div class="row date-name">
...@@ -197,9 +201,7 @@ use Cake\I18n\Time; ...@@ -197,9 +201,7 @@ use Cake\I18n\Time;
</div> </div>
</div> </div>
<div class="col-xs-4"> <div class="col-xs-4">
<div data-toggle="modal" data-target="#defaultModal" style="text-align: center; cursor: pointer;"> <img src="/img/core/img/user-profile@3x.png" class="img-responsive">
<img src="/img/core/img/user-profile@3x.png" class="img-responsive">
</div>
</div> </div>
</div> </div>
<div class="row date-position"> <div class="row date-position">
...@@ -237,11 +239,14 @@ use Cake\I18n\Time; ...@@ -237,11 +239,14 @@ use Cake\I18n\Time;
<label style="font-size: 17px">วันหมดออายุ</label> <label style="font-size: 17px">วันหมดออายุ</label>
</div> </div>
</div> </div>
<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;')); ?>
</div>
</div> </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;')); ?>
</div>
<!--/ .back-card-->
</div> </div>
<!--/.owl-carousel-->
</div> </div>
</div> </div>
</div> </div>
...@@ -250,6 +255,113 @@ use Cake\I18n\Time; ...@@ -250,6 +255,113 @@ use Cake\I18n\Time;
</div> </div>
<style> <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>
<style>
.box-card{ .box-card{
border: 1px solid #ccc; border: 1px solid #ccc;
height: 200px; height: 200px;
...@@ -265,62 +377,141 @@ use Cake\I18n\Time; ...@@ -265,62 +377,141 @@ use Cake\I18n\Time;
cursor: pointer; 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;
}
.rotate270 .row{ .rotate270 .row{
-webkit-transform: rotate(270deg); -webkit-transform: rotate(270deg);
-moz-transform: rotate(270deg); -moz-transform: rotate(270deg);
-o-transform: rotate(270deg); -o-transform: rotate(270deg);
writing-mode: rl-tb; writing-mode: rl-tb;
position: absolute; position: absolute;
font-size: 20px;
} }
.form_1 .date-name{ .form_1 .date-name{
width: 150px; width: 350px;
margin: 100% 0% 0% 62%; margin: 70% 0% 0% -20%;
} }
.form_1 .date-position{ .form_1 .date-position{
width: 150px; width: 350px;
margin: 100% 0% 0% 62%; margin: 55% 0% 0% 5%;
} }
.form_1 .date-time{ .form_1 .date-time{
width: 150px; width: 350px;
margin: 100% 0% 0% 62%; margin: 70% 0% 0% 17%;
} }
.form_1 .date-label{ .form_1 .date-label{
width: 150px; width: 350px;
margin: 100% 0% 0% 62%; margin: 70% 0% 0% 25%;
} }
</style> </style>
<?php $this->append('scriptBottom'); ?> <?php $this->append('scriptBottom'); ?>
<script type="text/javascript"> <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";
$('.owl-carousel').owlCarousel({ h1 = alertObj.appendChild(d.createElement("h1"));
loop:false, h1.appendChild(d.createTextNode(ALERT_TITLE));
items:1,
rewindNav : false,
onTranslated:callBack
});
owl = $('.owl-carousel').owlCarousel();
$(".prev").click(function () {
owl.trigger('prev.owl.carousel');
});
$(".next").click(function () { msg = alertObj.appendChild(d.createElement("p"));
owl.trigger('next.owl.carousel'); //msg.appendChild(d.createTextNode(txt));
}); msg.innerHTML = txt;
function callBack(){ btn = alertObj.appendChild(d.createElement("a"));
if($('.owl-carousel .owl-item').last().hasClass('active')){ btn.id = "closeBtn";
$('.next').hide(); btn.appendChild(d.createTextNode(ALERT_BUTTON_TEXT));
$('.prev').show(); btn.href = "#";
btn.focus();
}else if($('.owl-carousel .owl-item').first().hasClass('active')){ btn.onclick = function () {
$('.prev').hide(); removeCustomAlert();
$('.next').show(); return false;
}
alertObj.style.display = "block";
} }
}
function removeCustomAlert() {
document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer"));
}
function ful() {
alert('Alert this pages');
}
</script>
<script type="text/javascript">
$('.owl-carousel').owlCarousel({
loop:false,
items:1,
rewindNav : false,
onTranslated:callBack
});
owl = $('.owl-carousel').owlCarousel();
$(".prev").click(function () {
owl.trigger('prev.owl.carousel');
});
$(".next").click(function () {
owl.trigger('next.owl.carousel');
});
function callBack(){
if($('.owl-carousel .owl-item').last().hasClass('active')){
$('.next').hide();
$('.prev').show();
}else if($('.owl-carousel .owl-item').first().hasClass('active')){
$('.prev').hide();
$('.next').show();
}
}
var organize_id = $("#organize_id"); var organize_id = $("#organize_id");
var employee = $("#employee"); var employee = $("#employee");
...@@ -328,6 +519,12 @@ function callBack(){ ...@@ -328,6 +519,12 @@ function callBack(){
$(document).ready(function() { $(document).ready(function() {
$("#organize_code").on('change',function(){ $("#organize_code").on('change',function(){
var organize_code = $("#organize_code").val(); 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) { $.post("/UserCards/checkOrg", {organize_code: organize_code}, function(data) {
if(data!='false'){ if(data!='false'){
data = jQuery.parseJSON(data); data = jQuery.parseJSON(data);
...@@ -343,6 +540,7 @@ function callBack(){ ...@@ -343,6 +540,7 @@ function callBack(){
}else if(data['chkuser'] == false){ }else if(data['chkuser'] == false){
$("#nameorg_th").text(data[0]['org_name_th']); $("#nameorg_th").text(data[0]['org_name_th']);
$("#noorg_th").text(''); $("#noorg_th").text('');
$("#checkbutton").removeAttr("disabled");
$("#employee").removeAttr("disabled"); $("#employee").removeAttr("disabled");
$("#date").removeAttr("disabled"); $("#date").removeAttr("disabled");
organize_id.val(data[0]['id']); organize_id.val(data[0]['id']);
...@@ -361,12 +559,14 @@ function callBack(){ ...@@ -361,12 +559,14 @@ function callBack(){
}); });
function check() { function check() {
if (employee.val() == '') { if (employee.val() == '') {
alert('กรุณากรอก Ref1');
employee.focus(); employee.focus();
return false; return false;
} }
if (date.val() == '') { if (date.val() == '') {
return false; alert('กรุณากรอก Ref2');
date.focus(); date.focus();
return false;
} }
} }
$(document).ready(function(){ $(document).ready(function(){
...@@ -381,4 +581,4 @@ function callBack(){ ...@@ -381,4 +581,4 @@ function callBack(){
date_input.datepicker(options); date_input.datepicker(options);
}) })
</script> </script>
<?php $this->end();?> <?php $this->end();?>
\ No newline at end of file
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,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 __('ชื่อ');?><em>* </em></label> <label class="label-text-sub"><?php echo __('ชื่อ');?><em>* </em></label>
<input type="text" name="firstname" value="" placeholder="FIRSTNAME" class="form-control-reg border-bottom-from" id="inputSuccess"> <input type="text" name="firstname" id="firstname" value="" placeholder="FIRSTNAME" class="form-control-reg border-bottom-from">
</div> </div>
</div> </div>
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,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 __('นามสกุล');?><em>* </em></label> <label class="label-text-sub"><?php echo __('นามสกุล');?><em>* </em></label>
<input type="text" name="lastname" value="" placeholder="LASTNAME" class="form-control-reg border-bottom-from" id="inputSuccess"> <input type="text" name="lastname" id="lastname" value="" placeholder="LASTNAME" class="form-control-reg border-bottom-from">
</div> </div>
</div> </div>
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,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 __('ชื่อผู้ใช้งาน');?><em>* </em></label> <label class="label-text-sub"><?php echo __('ชื่อผู้ใช้งาน');?><em>* </em></label>
<input type="text" name="username" value="" placeholder="USERNAME" class="form-control-reg border-bottom-from" id="inputSuccess"> <input type="text" name="username" id="username" value="" placeholder="USERNAME" class="form-control-reg border-bottom-from">
</div> </div>
</div> </div>
...@@ -92,8 +92,7 @@ ...@@ -92,8 +92,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 __('เบอร์โทรศัพท์');?><em>* </em></label> <label class="label-text-sub"><?php echo __('เบอร์โทรศัพท์');?><em>* </em></label>
<input type="text" name="phone_no" onkeypress="check_phone();" value="" maxlength="10" placeholder="0000000000" class="mask form-control-reg border-bottom-from" id="inputSuccess"> <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> </div>
</div> </div>
...@@ -101,7 +100,7 @@ ...@@ -101,7 +100,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 __('อีเมลล์');?><em>* </em></label> <label class="label-text-sub"><?php echo __('อีเมลล์');?><em>* </em></label>
<input type="text" name="email" id="fremail" value="" placeholder="mail@xxx.com" class="form-control-reg border-bottom-from" id="inputSuccess"> <input type="text" name="email" id="fremail" value="" placeholder="mail@xxx.com" class="form-control-reg border-bottom-from">
</div> </div>
</div> </div>
...@@ -110,7 +109,7 @@ ...@@ -110,7 +109,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 __('รหัสผ่าน');?><em>* </em></label> <label class="label-text-sub"><?php echo __('รหัสผ่าน');?><em>* </em></label>
<input data-toggle="password" data-placement="before" type="password" name="password" value="" placeholder="********" class="form-control input-lg color-button-border border-bottom-from" id="FALSE" style="padding:0px 0px !important;"> <input data-toggle="password" data-placement="before" type="password" name="password" id="password" value="" placeholder="********" class="form-control input-lg color-button-border border-bottom-from" style="padding:0px 0px !important;">
<!--<input type="password" name="data[password]" id="password" value="" placeholder="********" class="form-control-reg border-bottom-from" onkeyup='check();'>--> <!--<input type="password" name="data[password]" id="password" value="" placeholder="********" class="form-control-reg border-bottom-from" onkeyup='check();'>-->
<!--<span class="glyphicon glyphicon-eye-close form-control-feedback"></span>--> <!--<span class="glyphicon glyphicon-eye-close form-control-feedback"></span>-->
</div> </div>
...@@ -120,7 +119,7 @@ ...@@ -120,7 +119,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 __('ยืนยันรหัสผ่าน');?><em>* </em></label> <label class="label-text-sub"><?php echo __('ยืนยันรหัสผ่าน');?><em>* </em></label>
<input data-toggle="password" data-placement="before" type="password" name="confirm_password" value="" placeholder="********" class="form-control input-lg color-button-border border-bottom-from" id="FALSE" style="padding:0px 0px !important;"> <input data-toggle="password" data-placement="before" type="password" name="confirm_password" id="confirm_password" value="" placeholder="********" class="form-control input-lg color-button-border border-bottom-from" style="padding:0px 0px !important;">
<!--<input type="password" id="confirm_password" name="data[confirm_password]" value="" placeholder="********" class="form-control-reg border-bottom-from" onkeyup='check();'>--> <!--<input type="password" id="confirm_password" name="data[confirm_password]" value="" placeholder="********" class="form-control-reg border-bottom-from" onkeyup='check();'>-->
<!--<span class="glyphicon glyphicon-eye-close form-control-feedback" id='message'></span>--> <!--<span class="glyphicon glyphicon-eye-close form-control-feedback" id='message'></span>-->
<span id='message'></span> <span id='message'></span>
...@@ -165,75 +164,109 @@ ...@@ -165,75 +164,109 @@
</div> </div>
</div> </div>
<!-- ------------------------------- popup ----------------------------------- --> <!-- ------------------------------- popup ----------------------------------- -->
<script type="text/javascript">
$(function () {
$('#phone_no').inputmask('999-999-9999');
//==================================================
// CHANGE Date Times
//==================================================
$('#datepicker').datepicker({
format: 'dd/mm/yyyy'
});
});
</script>
<script> <script>
$(document).ready(function() {
$("#fremail").on('change',function(){
var email = document.getElementById("fremail").value;
$.post("/Checkemails/checkemail", {email: email}, function(data) {
console.log(data);
data = jQuery.parseJSON(data);
if(data['chk'] == 'false'){
alert("อีเมลล์นี้มีในระบบแล้ว");
return false;
}
});
});
});
function validateForm() { function validateForm() {
var firstname = document.forms["createAccount"]["firstname"].value; var firstname = document.getElementById("firstname").value;
if (firstname == null || firstname == "") { if (firstname == null || firstname == "") {
alert("กรุณากรอกชื่อ"); alert("กรุณากรอกชื่อ");
return false; return false;
} }
var lastname = document.forms["createAccount"]["lastname"].value; var lastname = document.getElementById("lastname").value;
if (lastname == null || lastname == "") { if (lastname == null || lastname == "") {
alert("กรุณากรอกนามสกุล"); alert("กรุณากรอกนามสกุล");
return false; return false;
} }
var username = document.forms["createAccount"]["username"].value; var username = document.getElementById("username").value;
if (username == null || username == "") { if (username == null || username == "") {
alert("กรุณากรอกชื่อผู้ใช้งานของท่าน"); alert("กรุณากรอกชื่อผู้ใช้งานของท่าน");
return false; return false;
} }
if(document.forms["createAccount"]["username"].value.length < 5) if(document.getElementById("username").value.length < 5)
{ {
alert('กรุณาระบุชื่อผู้ใช้งานอย่างน้อย 5 ตัวอักษร'); alert('กรุณาระบุชื่อผู้ใช้งานอย่างน้อย 5 ตัวอักษร');
return false; return false;
} }
var master_country_id = document.getElementById("master_country_id").value;
if (master_country_id == null || master_country_id == "") {
alert("กรุณาระบุประเทศ");
// var birthdate = document.forms["createAccount"]["birthdate"].value; return false;
// if (birthdate == null || birthdate == "") { }
// alert("กรุณากรอก วันเดือนปีเกิดของท่าน"); var master_province_id = document.getElementById("master_province_id").value;
// return false; if (master_province_id == null || master_province_id == "") {
// } alert("กรุณาระบุจังหวัด");
// var person_card_no = document.forms["createAccount"]["person_card_no"].value; return false;
// if (person_card_no == null || person_card_no == "") { }
// alert("กรุณากรอกเลขบัตรประชาชน");
// return false;
// } var birthdate = document.getElementById("date").value;
// if(document.forms["createAccount"]["data[person_card_no]"].value.length < 13 || document.forms["createAccount"]["data[person_card_no]"].value.length > 13) if (birthdate == null || birthdate == "") {
// { alert("กรุณากรอก วันเดือนปีเกิดของท่าน");
// alert('กรุณากรอกเลขบัตรประชาชนให้ครบ 13 หลัก'); return false;
// return false; }
// }
var phone_no = document.forms["createAccount"]["phone_no"].value; var phone_no = document.getElementById("phone_no").value;
if (phone_no == null || phone_no == "") { if (phone_no == null || phone_no == "") {
alert("กรุณากรอก เบอร์โทรศัพท์ของท่าน"); alert("กรุณากรอก เบอร์โทรศัพท์ของท่าน");
return false; return false;
} }
if(document.forms["createAccount"]["phone_no"].value.length < 10 || document.forms["createAccount"]["phone_no"].value.length > 10) if(document.getElementById("phone_no").value.length != 12)
{ {
alert('กรุณากรอกเบอร์โทรศัพท์ ให้ครบ 10 หลัก'); alert('กรุณากรอกเบอร์โทรศัพท์ ให้ครบ 10 หลัก');
return false; return false;
} }
// var lastname = document.forms["createAccount"]["data[lastname]"].value;
// if (lastname == null || lastname == "") {
// alert("กรุณากรอกรหัสผ่าน");
// return false;
// }
var email = document.forms["createAccount"]["email"].value; var email = document.getElementById("fremail").value;
if (email == null || email == "") { if (email == null || email == "") {
alert("กรุณากรอกอีเมลล์"); alert("กรุณากรอกอีเมลล์");
return false; return false;
} }
// Validate Email // Validate Email
var email = $("#fremail").val(); var email = $("#fremail").val();
if ((/(.+)@(.+){2,}\.(.+){2,}/.test(email)) || email=="" || email==null) { } else { if (/(.+)@(.+){2,}\.(.+){2,}/.test(email)) { } else {
alert("รูปแบบที่อยู่อีเมลล์ผิด กรุณากรอกให้ถูกต้อง"); alert("รูปแบบที่อยู่อีเมลล์ผิด กรุณากรอกให้ถูกต้อง");
return false; return false;
} }
var password = document.forms["createAccount"]["password"].value; // var email = document.getElementById("fremail").value;
// $.post("/Checkemails/checkemailregister", {email: email}, function(data) {
// data = jQuery.parseJSON(data);
// if(data['chk'] == 'false'){
// alert("อีเมลล์นี้มีในระบบแล้ว");
// return false;
// } else {
// alert("ssss");
// return true;
// }
// });
var password = document.getElementById("password").value;
if (password == null || password == "") { if (password == null || password == "") {
alert("กรุณากรอกรหัสผ่าน"); alert("กรุณากรอกรหัสผ่าน");
return false; return false;
...@@ -243,13 +276,13 @@ ...@@ -243,13 +276,13 @@
alert('กรุณาระบุรหัสผ่านอย่างน้อย 8 ตัวอักษร'); alert('กรุณาระบุรหัสผ่านอย่างน้อย 8 ตัวอักษร');
return false; return false;
} }
var confirm_password = document.forms["createAccount"]["confirm_password"].value; var confirm_password = document.getElementById("confirm_password").value;
if (confirm_password == null || confirm_password == "") { if (confirm_password == null || confirm_password == "") {
alert("กรุณายืนยันรหัสผ่าน"); alert("กรุณายืนยันรหัสผ่าน");
return false; return false;
} }
if(document.forms["createAccount"]["password"].value != document.forms["createAccount"]["confirm_password"].value){ if(confirm_password = document.getElementById("password").value != document.getElementById("confirm_password").value){
alert('กรุณาระบุรหัสผ่านให้ตรงกัน'); alert('กรุณาระบุรหัสผ่านให้ตรงกัน');
//document.createAccount.confirm_password.focus(); //document.createAccount.confirm_password.focus();
return false; 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