Commit 3e1fe137 by Teeradone-PIM

Merge branch 'integration' into teeradone

parents 3fad2af2 5681bf63
...@@ -3,3 +3,4 @@ www/logs/ ...@@ -3,3 +3,4 @@ www/logs/
www/tmp/ www/tmp/
www/webroot/img/img/demos/shop/products/shop8/product2.jpg www/webroot/img/img/demos/shop/products/shop8/product2.jpg
www/webroot/img/img/demos/ www/webroot/img/img/demos/
www/src/Controller/UsersController.php.bg20180515
...@@ -24,8 +24,7 @@ class ProfilesController extends AppController ...@@ -24,8 +24,7 @@ class ProfilesController extends AppController
$this->loadModel('MasterCountries'); $this->loadModel('MasterCountries');
$Country = $this->MasterCountries->find('list', [ $Country = $this->MasterCountries->find('list', [
'conditions' => [ 'conditions' => [
'is_used' => true, 'is_used' => true],
'MasterCountries.id' => 1],
'keyField' => 'id', 'keyField' => 'id',
'valueField' => 'country_name_th' 'valueField' => 'country_name_th'
]); ]);
...@@ -35,8 +34,7 @@ class ProfilesController extends AppController ...@@ -35,8 +34,7 @@ class ProfilesController extends AppController
$this->loadModel('MasterProvinces'); $this->loadModel('MasterProvinces');
$Province = $this->MasterProvinces->find('list', [ $Province = $this->MasterProvinces->find('list', [
'conditions' => [ 'conditions' => [
'is_used' => true, 'is_used' => true],
'master_country_id' => 1],
'keyField' => 'id', 'keyField' => 'id',
'valueField' => 'province_name_th' 'valueField' => 'province_name_th'
]); ]);
...@@ -86,6 +84,7 @@ class ProfilesController extends AppController ...@@ -86,6 +84,7 @@ 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];
$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'];
...@@ -110,9 +109,6 @@ class ProfilesController extends AppController ...@@ -110,9 +109,6 @@ class ProfilesController extends AppController
} }
/*****************************************************************************/ /*****************************************************************************/
/*****************************************************************************/
public function settingProfile() public function settingProfile()
{ {
//prr($this->request->getHeaderLine('Accept-Language')); //prr($this->request->getHeaderLine('Accept-Language'));
...@@ -593,30 +589,4 @@ if (!empty($SubjectEnrolls)) { ...@@ -593,30 +589,4 @@ if (!empty($SubjectEnrolls)) {
$this->viewBuilder()->layout('blank'); $this->viewBuilder()->layout('blank');
} }
// public function getProvince() {
// $this->autoRender = false;
// $this->loadModel('MasterProvinces');
// $states = array();
// // pr($this->request->data);die;
// // echo 'jjjj';
// $states = $this->MasterProvinces->find('list', array(
// 'keyField' => 'id',
// 'valueField' => 'province_name_th',
// 'conditions' => array(
// 'master_country_id' => 2
// )
// ))->toArray();
// $arr = array();
// foreach($states as $key => $val){
// $arr[$key] = $val;
// }
// //pr($states);die;
// // $arr['1'] = "ไทยยยย";
// // $arr['2'] = "ไทยยยยยยยยยย";
// echo json_encode($arr);
// // $data = jQuery.parseJSON($f);
// // pr($data);die;
// }
} }
...@@ -231,6 +231,7 @@ class UserCardsController extends AppController ...@@ -231,6 +231,7 @@ class UserCardsController extends AppController
} }
public function viewCard($user_id = null){ public function viewCard($user_id = null){
$this->viewBuilder()->layout('blank'); $this->viewBuilder()->layout('blank');
// $user = $this->Auth();
$this->loadModel('UserCards'); $this->loadModel('UserCards');
$UserCards = $this->UserCards->find('all') $UserCards = $this->UserCards->find('all')
->select($this->UserCards) ->select($this->UserCards)
......
...@@ -99,6 +99,6 @@ ...@@ -99,6 +99,6 @@
<?php echo $this->Html->script('custom'); ?> <?php echo $this->Html->script('custom'); ?>
<!-- Theme Initialization Files --> <!-- Theme Initialization Files -->
<?php echo $this->Html->script('theme.init'); ?> <?php echo $this->Html->script('theme.init'); ?>
<?php echo $this->fetch('scriptBottom'); ?>
</body> </body>
</html> </html>
<?php
class QRGenerator {
protected $size;
protected $data;
protected $encoding;
protected $errorCorrectionLevel;
protected $marginInRows;
protected $debug;
public function __construct($data='1334554 5454 545',$size='300',$encoding='UTF-8',$errorCorrectionLevel='L',$marginInRows=4,$debug=false) {
$this->data=urlencode($data);
$this->size=($size>100 && $size<800)? $size : 300;
$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->marginInRows=($marginInRows>0 && $marginInRows<10) ? $marginInRows:4;
$this->debug = ($debug==true)? true:false;
}
public function generate(){
$QRLink = "https://chart.googleapis.com/chart?cht=qr&chs=".$this->size."x".$this->size. "&chl=" . $this->data .
"&choe=" . $this->encoding .
"&chld=" . $this->errorCorrectionLevel . "|" . $this->marginInRows;
if ($this->debug) echo $QRLink;
return $QRLink;
}
}
?>
<div class="row"> <div class="row">
<div class="col-xs-12 col-sm-12 col-md-12"> <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 style="position: absolute;z-index: 2;"> <div data-toggle="modal" data-target="#defaultModal" style="text-align: center; cursor: pointer;">
<a href="profile_setting"><img src="/img/core/img/setting-icon@3x.png"/></a> <img src="/img/core/img/card-bg-front@3x-V2.png" class="img-responsive" id="img-upload" alt="Profile picture">
</div>
<div class="box">
<div class="absolute-right"><img src="/img/core/img/location-profile-icon@3x.png"/> สีลม ,บางรัก</div>
</div> </div>
<div style="text-align: center;"> </div>
<!--<div class="">-->
<?php //echo @$this->Html->image($responseUserProfile['UserProfiles']['img_path'], ['class' => 'imgCircle profile-img', 'id' => 'img-upload', 'alt' => 'Profile picture']); ?> <div class="col-xs-1 col-sm-1 col-md-1 box-arrow" >
<!-- <img src="/porto/core/img/profile-img@3x.png" class="imgCircle profile-img" id="img-upload" alt="Profile picture"> --> <i class = "fa fa-angle-right"></i>
<img src="/img/core/img/profile-img@3x.png" class="imgCircle profile-img" id="img-upload" alt="Profile picture"> </div>
<!--</div>--> <div style="clear: both"></div>
<input type="file" id="uploadProfile" class="profile-img form-control form-input Profile-input-file" name="data[UserProfiles][img_path]" >
</div>
<div class="bg-profile"></div>
<!--<div class="col-xs-12 col-sm-12 col-md-12" style="padding-top: 20px;">-->
</div><!--/col-xs-12-->
</div><!--/row--> </div><!--/row-->
<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']); ?> <?php echo $this->Form->create('UserProfiles', ['id' => 'frmSignIn', 'type' => 'file']); ?>
<?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 required', '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 required', '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 required', '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">
<!--<label class="label-text-sub">เพศ</label>--> <?php echo $this->Form->input('UserPersonals.firstname_th', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'value' => $responseUserProfile['firstname_th'], 'id' => 'firstname_th', 'type' => 'text', 'label' => __('ชื่อ'), 'placeholder' => 'ชื่อ', 'required']); ?>
<?php echo __('เพศ'); ?> <?php // echo $this->Form->input('fullname', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->firstname_th . ' ' . $userProfiles->lastname_th, 'id' => 'fullName', 'type' => 'text', 'label' => __('ชื่อ - นามสกุล'), 'placeholder' => 'ชื่อ - นามสกุล', 'required']); ?>
<div class="radio-group">
<label class="radio-inline">
<input type="radio" name="UserPersonals[gender]" id="male" value="M" <?php echo ($responseUserProfile['gender'] == 'M') ? 'checked="checked"' : null; ?>> <?php echo __('ชาย'); ?>
</label>
<label class="radio-inline">
<input type="radio" name="UserPersonals[gender]" id="female" value="F" <?php echo ($responseUserProfile['gender'] == 'F') ? 'checked="checked"' : null; ?>> <?php echo __('หญิง'); ?>
</label>
</div> </div>
</div> </div>
</div> <div class="form-group has-feedback">
<div class="form-group has-feedback"> <div class="col-xs-12 col-sm-12 col-md-12">
<div class="col-xs-12 col-sm-12 col-md-12"> <?php echo $this->Form->input('UserPersonals.lastname_th', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'value' => $responseUserProfile['lastname_th'], 'id' => 'lastname_th', 'type' => 'text', 'label' => __('นามสกุล'), 'placeholder' => 'นามสกุล', 'required']); ?>
<?php echo $this->Form->input('UserPersonals.firstname_th', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'value' => $responseUserProfile['firstname_th'], 'id' => 'firstname_th', 'type' => 'text', 'label' => __('ชื่อ'), 'placeholder' => 'ชื่อ', 'required']); ?> <?php // echo $this->Form->input('fullname', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->firstname_th . ' ' . $userProfiles->lastname_th, 'id' => 'fullName', 'type' => 'text', 'label' => __('ชื่อ - นามสกุล'), 'placeholder' => 'ชื่อ - นามสกุล', 'required']); ?>
<?php // echo $this->Form->input('fullname', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->firstname_th . ' ' . $userProfiles->lastname_th, 'id' => 'fullName', 'type' => 'text', 'label' => __('ชื่อ - นามสกุล'), 'placeholder' => 'ชื่อ - นามสกุล', 'required']); ?> </div>
</div> </div>
</div> <div class="form-group has-feedback">
<div class="form-group has-feedback"> <div class="col-xs-12 col-sm-12 col-md-12">
<div class="col-xs-12 col-sm-12 col-md-12"> <?php echo $this->Form->input('UserPersonals.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.lastname_th', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'value' => $responseUserProfile['lastname_th'], 'id' => 'lastname_th', 'type' => 'text', 'label' => __('นามสกุล'), 'placeholder' => 'นามสกุล', 'required']); ?> <span class="glyphicon glyphicon-calendar form-control-feedback datepicker"></span>
<?php // echo $this->Form->input('fullname', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->firstname_th . ' ' . $userProfiles->lastname_th, 'id' => 'fullName', 'type' => 'text', 'label' => __('ชื่อ - นามสกุล'), 'placeholder' => 'ชื่อ - นามสกุล', 'required']); ?> </div>
</div> </div>
</div> <div class="form-group has-feedback">
<div class="form-group has-feedback"> <div class="col-xs-12 col-sm-12 col-md-12">
<div class="col-xs-12 col-sm-12 col-md-12"> <!--<label class="label-text-sub">เพศ</label>-->
<?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 __('เพศ'); ?>
<span class="glyphicon glyphicon-calendar form-control-feedback datepicker"></span> <div class="radio-group">
<label class="radio-inline">
<input type="radio" name="UserPersonals[gender]" id="male" value="M" <?php echo ($responseUserProfile['gender'] == 'M') ? 'checked="checked"' : null; ?>> <?php echo __('ชาย'); ?>
</label>
<label class="radio-inline">
<input type="radio" name="UserPersonals[gender]" id="female" value="F" <?php echo ($responseUserProfile['gender'] == 'F') ? 'checked="checked"' : null; ?>> <?php echo __('หญิง'); ?>
</label>
</div>
</div>
</div> </div>
</div> <div class="form-group has-feedback">
<div class="form-group has-feedback"> <div class="col-xs-12 col-sm-12 col-md-12">
<div class="col-xs-12 col-sm-12 col-md-12"> <?php echo __('กรุ๊ปเลือด'); ?>
<?php echo __('กรุ๊ปเลือด'); ?> <div class="radio-group">
<div class="radio-group"> <label class="radio-inline">
<label class="radio-inline"> <input type="radio" name="UserPersonals[blood_group]" id="blood-A" value="A" <?php echo ($responseUserProfile['blood_group'] == 'A') ? 'checked="checked"' : null; ?>> <?php echo __('A'); ?>
<input type="radio" name="UserPersonals[blood_group]" id="blood-A" value="A" <?php echo ($responseUserProfile['blood_group'] == 'A') ? 'checked="checked"' : null; ?>> <?php echo __('A'); ?> </label>
</label> <label class="radio-inline">
<label class="radio-inline"> <input type="radio" name="UserPersonals[blood_group]" id="blood-B" value="B" <?php echo ($responseUserProfile['blood_group'] == 'B') ? 'checked="checked"' : null; ?>> <?php echo __('B'); ?>
<input type="radio" name="UserPersonals[blood_group]" id="blood-B" value="B" <?php echo ($responseUserProfile['blood_group'] == 'B') ? 'checked="checked"' : null; ?>> <?php echo __('B'); ?> </label>
</label> <label class="radio-inline">
<label class="radio-inline"> <input type="radio" name="UserPersonals[blood_group]" id="blood-AB" value="AB" <?php echo ($responseUserProfile['blood_group'] == 'AB') ? 'checked="checked"' : null; ?>> <?php echo __('AB'); ?>
<input type="radio" name="UserPersonals[blood_group]" id="blood-AB" value="AB" <?php echo ($responseUserProfile['blood_group'] == 'AB') ? 'checked="checked"' : null; ?>> <?php echo __('AB'); ?> </label>
</label> <label class="radio-inline">
<label class="radio-inline"> <input type="radio" name="UserPersonals[blood_group]" id="blood-O" value="O" <?php echo ($responseUserProfile['blood_group'] == 'O') ? 'checked="checked"' : null; ?>> <?php echo __('O'); ?>
<input type="radio" name="UserPersonals[blood_group]" id="blood-O" value="O" <?php echo ($responseUserProfile['blood_group'] == 'O') ? 'checked="checked"' : null; ?>> <?php echo __('O'); ?> </label>
</label> </div>
</div> </div>
</div> </div>
</div> <div class="form-group has-feedback">
<div class="form-group has-feedback"> <div class="col-xs-12 col-sm-12 col-md-12">
<div class="col-xs-12 col-sm-12 col-md-12"> <?php echo $this->Form->input('UserPersonals.moblie_no', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'value' => $responseUserProfile['moblie_no'], 'id' => 'moblieNo', 'type' => 'text', 'label' => __('เบอร์โทรศัพท์'), 'placeholder' => '000-000-0000']); ?>
<?php echo $this->Form->input('UserPersonals.moblie_no', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'value' => $responseUserProfile['moblie_no'], 'id' => 'moblieNo', 'type' => 'text', 'label' => __('เบอร์โทรศัพท์'), 'placeholder' => '000-000-0000']); ?> <?php // echo $this->Form->input('moblie_no', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->moblie_no, 'id' => 'moblieNo', 'type' => 'text', 'label' => __('เบอร์โทรศัพท์'), 'placeholder' => '000-000-0000']); ?>
<?php // echo $this->Form->input('moblie_no', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->moblie_no, 'id' => 'moblieNo', 'type' => 'text', 'label' => __('เบอร์โทรศัพท์'), 'placeholder' => '000-000-0000']); ?> </div>
</div> </div>
</div> <div class="form-group has-feedback">
<div class="form-group has-feedback"> <div class="col-xs-12 col-sm-12 col-md-12">
<div class="col-xs-12 col-sm-12 col-md-12"> <?php echo $this->Form->input('UserPersonals.email', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'value' => $responseUserProfile['email'], 'id' => 'email', 'type' => 'email', 'label' => __('Email'), 'placeholder' => 'mail@xxx.com']); ?>
<?php echo $this->Form->input('UserPersonals.email', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'value' => $responseUserProfile['email'], 'id' => 'email', 'type' => 'email', 'label' => __('Email'), 'placeholder' => 'mail@xxx.com']); ?> <?php // echo $this->Form->input('email', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->email, 'id' => 'email', 'type' => 'email', 'label' => __('Email'), 'placeholder' => 'mail@xxx.com']); ?>
<?php // echo $this->Form->input('email', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->email, 'id' => 'email', 'type' => 'email', 'label' => __('Email'), 'placeholder' => 'mail@xxx.com']); ?> </div>
</div> </div>
</div> <div class="form-group has-feedback">
<div class="form-group has-feedback"> <div class="col-xs-12 col-sm-12 col-md-12">
<div class="col-xs-12 col-sm-12 col-md-12"> <?php echo $this->Form->input('UserPersonals.address', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'value' => $responseUserProfile['address'], 'id' => 'address', 'type' => 'text', 'label' => __('ที่อยู่อาศัย'), 'placeholder' => __('112/3 สุขุมวิท 22 ทองหล่อ กทม 10523')]); ?>
<?php echo $this->Form->input('UserPersonals.address', ['class' => 'form-control-reg border-bottom-from label-text-sub required', 'value' => $responseUserProfile['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> <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 __('ประเทศ'); ?>
<?php echo __('ประเทศ'); ?> <?php
<?php echo $this->Form->input( 'master_country_id', array(
echo $this->Form->input( 'master_country_id', array( 'id' => 'master_country_id',
'id' => 'master_country_id', 'label' => false,
'label' => false, 'type' => 'select',
'type' => 'select', 'options' => $Country,
'options' => $Country, 'value' => $responseUserProfile['master_country_id'],
'value' => $responseUserProfile['master_country_id'], 'empty' => '---Select---',
'empty' => '---Select---', 'default' => !empty($responseUserProfile['master_country_id'])? $responseUserProfile['master_country_id']:'',
'default' => !empty($responseUserProfile['master_country_id'])? $responseUserProfile['master_country_id']:'', 'class' => 'form-control border-bottom-from label-text-sub required',
'class' => 'form-control border-bottom-from label-text-sub required', 'style' => 'width:100%'
'style' => 'width:100%' ));
)); ?>
?> </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 __('จังหวัด'); ?>
<?php echo __('จังหวัด'); ?> <?php
<?php echo $this->Form->input( 'master_province_id', array(
echo $this->Form->input( 'master_province_id', array( 'id' => 'master_province_id',
'id' => 'master_province_id', 'label' => false,
'label' => false, 'type' => 'select',
'type' => 'select', 'options' => $Province,
'options' => $Province, 'value' => $responseUserProfile['master_province_id'],
'value' => $responseUserProfile['master_province_id'], 'empty' => '---Select---',
'empty' => '---Select---', 'default' => !empty($responseUserProfile['master_province_id'])? $responseUserProfile['master_province_id']:'',
'default' => !empty($responseUserProfile['master_province_id'])? $responseUserProfile['master_province_id']:'', 'class' => 'form-control border-bottom-from label-text-sub required',
'class' => 'form-control border-bottom-from label-text-sub required', 'style' => 'width:100%'
'style' => 'width:100%' ));
)); ?>
?> </div>
</div> </div>
</div>
<?php // endforeach; ?> <?php // endforeach; ?>
<div> <div>
<?php // echo $this->Form->submit(__('SAVE')) ?> <?php // echo $this->Form->submit(__('SAVE')) ?>
...@@ -146,85 +168,103 @@ ...@@ -146,85 +168,103 @@
<?php echo $this->Form->end(); ?> <?php echo $this->Form->end(); ?>
</div> </div>
</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/card-bg-front@3x.png" class="img-responsive" id="img-upload" alt="Profile picture">
</div>
<div>
<div class="qrcode-profile"><br>
<?php echo __('แสดง QR Code เพื่อรับสิทธิ์');?>
</div>
<img src="/img/core/img/card-bg-back@3x.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>
<script type="text/javascript"> <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 UNIVERSITY PROFILES // CHANGE Date Times
//==================================================
$("#OrganizetionId").change(function () {
getDepartment();
});
$("#DepartmentId").change(function () {
getSection();
});
$("#SectionId").change(function () {
updateChosen();
});
//==================================================
// CHANGE COMPAMY PROFILES
//================================================== //==================================================
$("#companyName").change(function () {
getCompanyDepartment();
});
$("#department").change(function () {
getCompanySection();
});
$("#cottonId").change(function () {
getCompanyPosition();
});
$(".datepicker").change(function () {
updateChosen();
});
$('#datepicker').datepicker({ $('#datepicker').datepicker({
format: 'dd/mm/yyyy' format: 'dd/mm/yyyy'
}); });
});
//================================================== //==================================================
// CHANGE PROFILES PICTURE // CHANGE Province According Country
//================================================== //==================================================
$("#uploadProfile").change(function () { $(document).ready(function () {
readURL(this); $("#master_country_id").on('change', function () {
var id = $(this).val();
if (id) {
var dataString = 'id=' + id;
$.ajax({
type: "POST",
url: '/users/getProvince',
data: dataString,
cache: false,
success: function (html) {
$("#master_province_id").html(html);
}
});
}
}); });
}); });
function readURL(input) { </script>
if (input.files && input.files[0]) { <style>
var reader = new FileReader(); .box-arrow{
reader.onload = function (e) { font-size:36px;
$('#img-upload') height: 200px;
.attr('src', e.target.result) padding-top:20%;
.width(150) cursor: pointer;
.height(150);
}
reader.readAsDataURL(input.files[0]);
}
} }
.box-ads{
//================================================== width: 1%;
// CHANGE Province According Country display: table;
//================================================== margin: auto;
// $(document).ready(function() { position: relative;
// $("#loding1").hide(); padding-top: 10px;
// $("#loding2").hide(); margin-top: 5px;
// $("#master_country_id").on('change',function() { }
// var id = $(this).val(); .box-ads .close-modal{
// // alert('dddd'); position:absolute;
// $("#loding1").show(); top:0;
// $("#master_province_id").find('option').remove(); right: 0;
// if (id) { width: 40px;
// var dataString = 'id='+ id; height: 40px;
// alert(dataString); background-color: #000;
// $.post("/Profiles/getProvince", {id: id}, function(data) { color: #fff;
// console.log(data); cursor: pointer;
// data = jQuery.parseJSON(data); font-size: 20px;
// console.log(data); border-radius: 20px;
// }); padding-top: 10px;
// // $('<option>').val('').text('---Select---'); margin-right: 10px;
// // $('<option>').val(key).text(value).appendTo($("#master_province_id")); text-align: center;
// } z-index: 9999;
// }); }
// }); .box-ads .close-modal:hover{
</script> text-decoration: none;
\ No newline at end of file }
</style>
\ No newline at end of file
<div class="row"> <div class="row">
<!--
<div style="position: absolute;z-index: 2;"> <div style="position: absolute;z-index: 2;">
<a href="settingProfile"><img src="webroot/porto/core/img/setting-icon@3x.png"/></a> <a href="../core/Profiles/settingProfile">
<?php echo $this->Html->image('/img/core/img/setting-icon@3x.png', ['alt' => 'setting-icon']); ?>
</a>
</div> </div>
-->
<div class="box"> <!------------------------------->
<div class="absolute-right"><img src="webroot/porto/core/img/location-profile-icon@3x.png"/> สีลม ,บางรัก</div>
<?php
class QRGenerator {
protected $size;
protected $data;
protected $encoding;
protected $errorCorrectionLevel;
protected $marginInRows;
protected $debug;
public function __construct($data='1334554 5454 545',$size='300',$encoding='UTF-8',$errorCorrectionLevel='L',$marginInRows=4,$debug=false) {
$this->data=urlencode($data);
$this->size=($size>100 && $size<800)? $size : 300;
$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->marginInRows=($marginInRows>0 && $marginInRows<10) ? $marginInRows:4;
$this->debug = ($debug==true)? true:false;
}
public function generate(){
$QRLink = "https://chart.googleapis.com/chart?cht=qr&chs=".$this->size."x".$this->size. "&chl=" . $this->data .
"&choe=" . $this->encoding .
"&chld=" . $this->errorCorrectionLevel . "|" . $this->marginInRows;
if ($this->debug) echo $QRLink;
return $QRLink;
}
}
?>
<!------------------------------->
<div class="box">
<div class="absolute-right">
<?php echo $this->Html->image('/img/core/img/location-profile-icon@3x.png', ['alt' => 'location-profile-icon']); ?> สีลม ,บางรัก</div>
</div> </div>
<div style="text-align: center;"> <div style="text-align: center;">
<img src="<?php echo !empty($Profiles['UserProfiles']['img_path'])? $Profiles['UserProfiles']['img_path']:'http://connect06.pakgon.com/core/webroot/img/user/user128x128.png'?>" class="profile-img"/> <?php if (empty($Profiles['UserProfiles'][0]['img_path'])) { ?>
<?php echo $this->Html->image('/img/core/img/user-profile@3x.png', array('div' => false, 'class' => 'profile-img','id'=>'output','style'=>'width: 169px;height: 169px;-webkit-border-radius: 85px;
-moz-border-radius: 85px;
border-radius: 85px;')); ?>
<?php }else{ ?>
<img src="<?php echo $Profiles['UserProfiles'][0]['img_path'];?>" class="profile-img" id="output" style="width: 169px;height: 169px;-webkit-border-radius: 85px;-moz-border-radius: 85px;border-radius: 85px;"/>
<?php }?>
</div> </div>
<div data-toggle="modal" data-target="#defaultModal" style="text-align: center;"> <div data-toggle="modal" data-target="#defaultModal" style="text-align: center;">
<a href="#"><img src="webroot/porto/core/img/id-card-button@3x.png" class="id-card-button"/></a> <a href="#">
<?php echo $this->Html->image('/img/core/img/id-card-button@3x.png', array('div' => false, 'class' => 'id-card-button')); ?>
</a>
</div> </div>
<div class="bg-profile"></div>
<div class="bg-profile"></div>
<div style="margin: 11% 0% -12% 0%;text-align: center;position: relative;"><?php echo $this->Flash->render() ?></div>
<div style="padding: 40px 20px 0px 20px;"> <div style="padding: 40px 20px 0px 20px;">
<ul class="list list-icons list-primary list-borders"> <ul class="list list-icons list-primary list-borders">
<li class="promotion-li"> <li class="promotion-li">
<a href="../Homes/promotion"> <a href="#">
<div class="row"> <div class="row">
<div class="col-xs-6 col-sm-7 color-profile"> <div class="col-xs-6 col-sm-7 color-profile">
<!--<img src="webroot/porto/core/img/View-the-latest-icon@3x.png" width="53" height="53" style="vertical-align: middle;"/> --> <!--<img src="../img/core/img/eWallet-icon@3x.png" width="53" height="53" style="vertical-align: middle;"/> -->
<?php echo __('ดูล่าสุด'); ?>
</div>
<div class="col-xs-6 col-sm-5 right-icon-view">
ที่เคยดูล่าสุด <img src="webroot/porto/core/img/next-icon-profile@3x.png" style="vertical-align: middle;"/>
</div>
</div>
</a>
</li>
<li class="promotion-li">
<a href="../Homes/promotion">
<div class="row">
<div class="col-xs-6 col-sm-7 color-profile">
<!--<img src="webroot/porto/core/img/eWallet-icon@3x.png" width="53" height="53" style="vertical-align: middle;"/> -->
My eWallet by Connect My eWallet by Connect
</div> </div>
<div class="col-xs-6 col-sm-5 right-icon-view"> <div class="col-xs-6 col-sm-5 right-icon-view">
$150 <img src="webroot/porto/core/img/next-icon-profile@3x.png" style="vertical-align: middle;"/> $150 <?php echo $this->Html->image('/img/core/img/next-icon-profile@3x.png', array('div' => false, 'style' => 'vertical-align: middle;')); ?>
<!--<img src="../img/core/img/next-icon-profile@3x.png" style="vertical-align: middle;"/>-->
</div> </div>
</div> </div>
</a> </a>
</li> </li>
<li class="promotion-li"> <li class="promotion-li">
<a href="../Homes/promotion"> <a href="#">
<div class="row"> <div class="row">
<div class="col-xs-6 col-sm-7 color-profile"> <div class="col-xs-6 col-sm-7 color-profile">
<!--<img src="webroot/porto/core/img/point-icon@3x.png" width="53" height="53" style="vertical-align: middle;"/> --> <!--<img src="../img/core/img/point-icon@3x.png" width="53" height="53" style="vertical-align: middle;"/> -->
Point ของฉัน Point ของฉัน
</div> </div>
<div class="col-xs-6 col-sm-5 right-icon-view"> <div class="col-xs-6 col-sm-5 right-icon-view">
P200 <img src="webroot/porto/core/img/next-icon-profile@3x.png" style="vertical-align: middle;"/> P200 <?php echo $this->Html->image('/img/core/img/next-icon-profile@3x.png', array('div' => false, 'style' => 'vertical-align: middle;')); ?>
</div> <!--<img src="../img/core/img/next-icon-profile@3x.png" style="vertical-align: middle;"/>-->
</div>
</a>
</li>
<li class="promotion-li">
<a href="../Homes/promotion">
<div class="row">
<div class="col-xs-6 col-sm-7 color-profile">
<!--<img src="webroot/porto/core/img/Transcript@3x.png" width="53" height="53" style="vertical-align: middle;"/> -->
ผลการศึกษา
</div>
<div class="col-xs-6 col-sm-5 right-icon-view">
<img src="webroot/porto/core/img/next-icon-profile@3x.png" style="vertical-align: middle;"/>
</div>
</div>
</a>
</li>
<li class="promotion-li">
<a href="../Homes/promotion">
<div class="row">
<div class="col-xs-6 col-sm-7 color-profile">
<!--<img src="webroot/porto/core/img/Talent-icon@3x.png" width="53" height="53" style="vertical-align: middle;"/> -->
แบบทดสอบพรสวรรค์
</div>
<div class="col-xs-6 col-sm-5 right-icon-view">
<img src="webroot/porto/core/img/next-icon-profile@3x.png" style="vertical-align: middle;"/>
</div>
</div>
</a>
</li>
<li class="promotion-li">
<a href="../Homes/promotion">
<div class="row">
<div class="col-xs-6 col-sm-7 color-profile">
<!--<img src="webroot/porto/core/img/graph-icon@3x.png" width="53" height="53" style="vertical-align: middle;"/> -->
ผลกราฟพรสวรรค์
</div>
<div class="col-xs-6 col-sm-5 right-icon-view">
<img src="webroot/porto/core/img/next-icon-profile@3x.png" style="vertical-align: middle;"/>
</div> </div>
</div> </div>
</a> </a>
</li> </li>
</ul> </ul>
</div> </div>
</div> </div>
<!---------------------------------------------------------> <!--------------------------------------------------------->
<style type="text/css">
</style>
<!--------------------------------------------------------->
<style type="text/css">
</style>
<?php //debug($Profiles);?>
<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">
<div class=""> <div class="">
...@@ -108,10 +112,63 @@ ...@@ -108,10 +112,63 @@
<div class="col-md-6"> <div class="col-md-6">
<div class="owl-carousel owl-theme" data-plugin-options="{'items': 1, 'margin': 10}"> <div class="owl-carousel owl-theme" data-plugin-options="{'items': 1, 'margin': 10}">
<div> <div>
<img alt="" class="img-responsive img-rounded" src="webroot/porto/core/img/crad01@3x.png">
<div class="idcard-profile"><?php echo __('ID Card');?></div>
<?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 if (empty($Profiles['UserProfiles'][0]['img_path'])) { ?>
<?php echo $this->Html->image('/img/core/img/user-profile@3x.png', array('div' => false, 'class' => '','style' => 'position: absolute;width: 150px; margin: 85% 0% 0% 20%; -webkit-transform: rotate(270deg);
-moz-transform: rotate(270deg); -o-transform: rotate(270deg);')); ?>
<?php }else{ ?>
<img src="<?php echo $Profiles['UserProfiles'][0]['img_path'];?>" class="" id="" style="position: absolute;width: 150px; height: 150px; margin: 85% 0% 0% 20%; -webkit-border-radius: 85px;-moz-border-radius: 85px;border-radius: 85px; -webkit-transform: rotate(270deg);
-moz-transform: rotate(270deg); -o-transform: rotate(270deg);"/>
<?php }?>
<div class="idcard-text"><?php echo __('เลขบัตรประจำตัว');?></div>
<div class="idcard-number"><?php echo $Profiles['UserProfiles'][0]['card_code'];?></div>
<div class="idcard-name-th"><?php echo $Profiles['UserPersonals']['firstname_th'];?> <?php echo $Profiles['UserPersonals']['lastname_th'];?></div>
<div class="idcard-name-en"><?php echo $Profiles['UserPersonals']['firstname_en'];?> <?php echo $Profiles['UserPersonals']['lastname_en'];?></div>
<?php if (!empty($Profiles['UserProfiles'][0]['dept_id'])) { ?>
<div class="idcard-faculty"><b><?php echo __('คณะ');?></b> <?php echo $MasterDepartments_v[0]['dept_name_th'];?></div>
<?php }else{?>
<div class="idcard-faculty"><b><?php echo __('คณะ');?></b> <?php echo __('-');?></div>
<?php }?>
<?php if (!empty($Profiles['UserProfiles'][0]['section_id'])) { ?>
<div class="idcard-branch"><b><?php echo __('สาขา');?></b> <?php echo $MasterSections_v[0]['section_name_th'];?></div>
<?php }else{?>
<div class="idcard-branch"><b><?php echo __('สาขา');?></b> <?php echo __('-');?></div>
<?php }?>
<!-- <div class="idcard-faculty"><b><?php //echo __('คณะ');?></b> <?php //echo __('วิทยาการจัดการ');?></div>
<div class="idcard-branch"><b><?php //echo __('สาขา');?></b> <?php //echo __('คอมพิวเตอร์ธุรกิจ');?></div>-->
<div class="idcard-tel"><b><?php echo __('เบอร์');?></b> <?php echo $Profiles['UserProfiles'][0]['phone_no'];?></div>
<div class="idcard-email"><b><?php echo __('email');?></b> <?php echo $Profiles['UserPersonals']['email'];?></div>
<?php echo $this->Html->image('/img/core/img/thumbs-id@3x.png', array('div' => false, 'class' => '','style' => 'width:78px;height:78px;position: absolute;margin: -4px 0px 0px 96px;')); ?>
</div> </div>
<div> <div>
<img alt="" class="img-responsive img-rounded" src="webroot/porto/core/img/crad02@3x.png"> <div class="qrcode-profile"><?php echo __('แสดง QR Code เพื่อรับสิทธิ์');?></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 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 class="qrcode-faculty"><?php echo __('Date of Issue');?> <?php echo date("m/Y",strtotime($Profiles['Users']['created']));?></div>
<div class="qrcode-branch">| &nbsp;&nbsp;<?php echo __('Date of Expire');?> <?php echo date("m/Y",strtotime($Profiles['Users']['token_expiry'])); ?></div>
<?php echo $this->Html->image('/img/core/img/card-university-logo.png', array('div' => false, 'class' => '','style' => 'width: 25px;position: absolute;margin: -17% 0% 0% 86%;')); ?>
<?php if (!empty($Profiles['UserProfiles'][0]['organize_id'])) { ?>
<div class="qrcode-university"><?php echo $MasterDepartmentEducations[0]['org_name_th'];?></div>
<?php }else{?>
<div class="qrcode-university"><?php echo __('-');?></div>
<?php }?>
<?php //echo __('มหาวิทยาลัยราชภัฏจันทรเกษม');?>
<?php echo $this->Html->image('/img/core/img/card-logo-connect.png', array('div' => false, 'class' => '','style' => 'width: 26px;position: absolute;margin: -114% 0% 0% 86%;')); ?>
<div class="qrcode-connect"><?php echo __('connect');?></div>
<?php echo $this->Html->image('/img/core/img/thumbs-id2@3x.png', array('div' => false, 'class' => '','style' => 'width:78px;height:78px;position: absolute;margin: -152% 0% 0% 28%;')); ?>
</div> </div>
</div> </div>
</div> </div>
...@@ -120,3 +177,4 @@ ...@@ -120,3 +177,4 @@
</div> </div>
</div> </div>
</div> </div>
<!------------------------------------------------------------------------------->
\ No newline at end of file
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
var date = document.getElementById("date"); var date = document.getElementById("date");
$(document).ready(function() { $(document).ready(function() {
$("#organize_code").on('change',function(){ $("#organize_code").on('change',function(){
var organize_code = document.getElementById("organize_code").value var organize_code = document.getElementById("organize_code").value;
alert(organize_code); alert(organize_code);
$.post("/UserCards/checkOrg", {organize_code: organize_code}, function(data) { $.post("/UserCards/checkOrg", {organize_code: organize_code}, function(data) {
if(data!='false'){ if(data!='false'){
...@@ -94,8 +94,7 @@ ...@@ -94,8 +94,7 @@
date.focus(); date.focus();
} }
} }
</script>
<script>
$(document).ready(function(){ $(document).ready(function(){
var date_input=$('input[id="date"]'); //our date input has the name "date" 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 container=$('.bootstrap-iso form').length>0 ? $('.bootstrap-iso form').parent() : "body";
......
<?php
use Cake\I18n\Time;
?>
<div class="owl-carousel owl-theme" data-plugin-options="{'items': 1}"> <div class="owl-carousel owl-theme" data-plugin-options="{'items': 1}">
<?php foreach ($UserCards as $value) { #pr($value);die;?> <?php foreach ($UserCards as $value) { #pr($value);die;?>
<div class="row"> <div class="row">
<div class="col-xs-1 col-sm-1 col-md-1"> <div class="col-xs-1 col-sm-1 col-md-1 box-arrow">
< <div>
</div> <i class = "fa fa-angle-left prev" > </i>
<div class="col-xs-10 col-sm-10 col-md-10" style=" border: 1px solid red; height: 200px; margin-top: 10px;"> </div>
</div>
<div class="col-xs-9 col-sm-9 col-md-9 box-card">
<div class="row"> <div class="row">
<div class="col-xs-1"> <div class="col-xs-1">
</div> </div>
...@@ -35,10 +40,18 @@ ...@@ -35,10 +40,18 @@
<div class="col-xs-1"> <div class="col-xs-1">
</div> </div>
<div class="col-xs-5"> <div class="col-xs-5">
<?php echo $value['date_issued'] ?> <?php
$now = new Time($value['date_issued']);
$dateIssued = $now->i18nFormat('yyyy-MM-dd');
echo $this->DateFormat->formatDateThai($dateIssued);
?>
</div> </div>
<div class="col-xs-5"> <div class="col-xs-5">
<?php echo $value['date_expiry'] ?> <?php
$now = new Time($value['date_expiry']);
$dateExpiry = $now->i18nFormat('yyyy-MM-dd');
echo $this->DateFormat->formatDateThai($dateIssued);
?>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
...@@ -52,6 +65,11 @@ ...@@ -52,6 +65,11 @@
</div> </div>
</div> </div>
</div> </div>
<div class="col-xs-1 col-sm-1 col-md-1 box-arrow">
<div>
<i class = "fa fa-angle-right next" ></i>
</div>
</div>
<div class="col-xs-12 col-sm-12 col-md-12"> <div class="col-xs-12 col-sm-12 col-md-12">
<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">
...@@ -91,16 +109,180 @@ ...@@ -91,16 +109,180 @@
<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">
<label style="font-size: 17px" class="col-xs-4 col-sm-4 col-md-4">วันที่ออกบัตร</label> <label style="font-size: 17px" class="col-xs-4 col-sm-4 col-md-4">วันที่ออกบัตร</label>
<?php echo $value['date_issued'] ?> <?php
$now = new Time($value['date_issued']);
$dateIssued = $now->i18nFormat('yyyy-MM-dd');
echo $this->DateFormat->formatDateThai($dateIssued);
?>
</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">
<label style="font-size: 17px" class="col-xs-4 col-sm-4 col-md-4">วันที่หมดอายุ</label> <label style="font-size: 17px" class="col-xs-4 col-sm-4 col-md-4">วันที่หมดอายุ</label>
<?php echo $value['date_expiry'] ?> <?php
$now = new Time($value['date_expiry']);
$dateExpiry = $now->i18nFormat('yyyy-MM-dd');
echo $this->DateFormat->formatDateThai($dateIssued);
?>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<?php } ?> <?php } ?>
</div> <div class="row">
\ No newline at end of file <div class="col-xs-1 col-sm-1 col-md-1 box-arrow">
<i class = "fa fa-angle-left prev" > </i>
</div>
<div class="col-xs-9 col-sm-9 col-md-9">
<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"></div>
<!--- s -->
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo $this->Form->create('UserCards', ['id' => 'frmSignIn', 'type' => 'file', 'onsubmit' => 'return check();']); ?>
<!-- <div style="position: absolute;z-index: 2;">
<a href="profile_setting"><img src="/img/core/img/setting-icon@3x.png"/></a>
</div> -->
<!-- <div class="bg-profile"></div> -->
<!--<div class="col-xs-12 col-sm-12 col-md-12" style="padding-top: 20px;">-->
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<?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', 'required']); ?>
<?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', 'required']); ?>
<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' => __('รหัสพนักงาน / รหัสนักศึกษา'), 'placeholder' => 'รหัสพนักงาน / รหัสนักศึกษา', 'disabled', 'required']); ?>
</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 __('วันเกิด');?></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>
<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">ตรวจสอบ</button>
</div>
<?php echo $this->Form->end(); ?>
</div>
</div>
<!-- e -->
</div>
</div>
<style>
.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;
}
</style>
<?php $this->append('scriptBottom'); ?>
<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 employee = $("#employee");
var date = $("#date");
$(document).ready(function() {
$("#organize_code").on('change',function(){
var organize_code = $("#organize_code").val();
$.post("/UserCards/checkOrg", {organize_code: organize_code}, function(data) {
if(data!='false'){
data = jQuery.parseJSON(data);
console.log(data);
employee.val('sssss');
if(data['chkuser'] == true){
$("#noorg_th").text('ลงทะเบียนกับ '+data[0]['org_name_th']+' แล้ว');
$("#nameorg_th").text('');
$('#employee').attr("disabled",true);
$('#date').attr("disabled",true);
organize_id.val('');
employee.val('');
date.val('');
}else if(data['chkuser'] == false){
$("#nameorg_th").text(data[0]['org_name_th']);
$("#noorg_th").text('');
$("#employee").removeAttr("disabled");
$("#date").removeAttr("disabled");
organize_id.val(data[0]['id']);
}
}else{
$("#noorg_th").text('ไม่พบข้อมูล');
$("#nameorg_th").text('');
$('#employee').attr("disabled",true);
$('#date').attr("disabled",true);
organize_id.val('');
employee.val('');
date.val('');
}
});
});
});
function check() {
if (employee.val() == '') {
employee.focus();
return false;
}
if (date.val() == '') {
return false;
date.focus();
}
}
$(document).ready(function(){
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);
})
</script>
<?php $this->end();?>
<?php
namespace App\View\Helper;
use Cake\View\Helper\HtmlHelper;
class DateFormatHelper extends HtmlHelper {
/*
PHP Options for Date formatting. See http://php.net/manual/en/function.date.php for more info
Day
-------------------------------------------------------------------------------
d Day of the month, 2 digits with leading zeros 01 to 31
D A textual representation of a day, three letters Mon through Sun
j Day of the month without leading zeros 1 to 31
l (lowercase 'L') A full textual representation of the day of the week Sunday through Saturday
N ISO-8601 numeric representation of the day of the week (added in PHP 5.1.0) 1 (for Monday) through 7 (for Sunday)
S English ordinal suffix for the day of the month, 2 characters st, nd, rd or th. Works well with j
w Numeric representation of the day of the week 0 (for Sunday) through 6 (for Saturday)
z The day of the year (starting from 0) 0 through 365
Week
-------------------------------------------------------------------------------
W ISO-8601 week number of year, weeks starting on Monday (added in PHP 4.1.0) Example: 42 (the 42nd week in the year)
Month
-------------------------------------------------------------------------------
F A full textual representation of a month, such as January or March January through December
m Numeric representation of a month, with leading zeros 01 through 12
M A short textual representation of a month, three letters Jan through Dec
n Numeric representation of a month, without leading zeros 1 through 12
t Number of days in the given month 28 through 31
Year
-------------------------------------------------------------------------------
L Whether it's a leap year 1 if it is a leap year, 0 otherwise.
o ISO-8601 year number. This has the same value as Y, except that if the ISO week number (W) belongs to the previous or next year, that year is used instead. (added in PHP 5.1.0) Examples: 1999 or 2003
Y A full numeric representation of a year, 4 digits Examples: 1999 or 2003
y A two digit representation of a year Examples: 99 or 03
Time
-------------------------------------------------------------------------------
a Lowercase Ante meridiem and Post meridiem am or pm
A Uppercase Ante meridiem and Post meridiem AM or PM
B Swatch Internet time 000 through 999
g 12-hour format of an hour without leading zeros 1 through 12
G 24-hour format of an hour without leading zeros 0 through 23
h 12-hour format of an hour with leading zeros 01 through 12
H 24-hour format of an hour with leading zeros 00 through 23
i Minutes with leading zeros 00 to 59
s Seconds, with leading zeros 00 through 59
u Microseconds (added in PHP 5.2.2). Note that date() will always generate 000000 since it takes an integer parameter, whereas DateTime::format() does support microseconds. Example: 654321
Timezone
-------------------------------------------------------------------------------
e Timezone identifier (added in PHP 5.1.0) Examples: UTC, GMT, Atlantic/Azores
I (capital i) Whether or not the date is in daylight saving time 1 if Daylight Saving Time, 0 otherwise.
O Difference to Greenwich time (GMT) in hours Example: +0200
P Difference to Greenwich time (GMT) with colon between hours and minutes (added in PHP 5.1.3) Example: +02:00
T Timezone abbreviation Examples: EST, MDT ...
Z Timezone offset in seconds. The offset for timezones west of UTC is always negative, and for those east of UTC is always positive. -43200 through 50400
Full Date/Time
-------------------------------------------------------------------------------
c ISO 8601 date (added in PHP 5) 2004-02-12T15:19:21+00:00
r » RFC 2822 formatted date Example: Thu, 21 Dec 2000 16:01:07 +0200
U Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)
*/
/**
* Date Only Format
* Change this string to set the format when returning Date only
*
* @var string
*/
var $dateOnlyFormat = 'M j, Y';
/**
* Time Only Format
* Change this string to set the format when returning Time only
*
* @var string
*/
var $timeOnlyFormat = 'g:i A';
/**
* Date and Time Format
* Change this string to set the format when returning both Date and Time
*
* @var string
*/
var $dateTimeFormat = 'M j, Y g:i A';
/**
* Default Date Part Display
* Default for option displayDatePart
*
* @var bool
*/
var $defaultDatePartDisplay = true;
/**
* Default Time Part Display
* Default for option displayTimePart
*
* @var bool
*/
var $defaultTimePartDisplay = true;
/**
* Default Offset
* Default for option offset
*
* @var bool
*/
var $defaultOffset = 0;
/**
* formatDate method
*
* Wrapper for the PHP date() function. Used to set the format of date/time
* in one location.
*
* INPUT $dateTime: The date/time as string
* $options=(
* displayDatePart: True/False - display date
* displayTimePart: True/False - display time
* offset: Offset in hours, used to adjust for a given timezone
* )
*
* OUTPUT returns formatted date/time
*/
public function formatDate($dateTime = null, $options) {
$defaults = array('displayDatePart'=>$this->defaultDatePartDisplay, 'displayTimePart'=>$this->defaultTimePartDisplay, 'offset'=>$this->defaultOffset);
$options = Set::merge($defaults, $options);
// Convert offset to minutes
$offsetMinutes = $options['offset'] * 60;
$formatDate = null;
if (!is_null($dateTime)) {
if ($options['displayDatePart'] AND $options['displayTimePart']) {
$formatDate = date($this->dateTimeFormat, strtotime($dateTime . ' +' . $offsetMinutes . ' minutes'));
}
if ($options['displayDatePart'] AND !$options['displayTimePart']) {
$formatDate = date($this->dateOnlyFormat, strtotime($dateTime . ' +' . $offsetMinutes . ' minutes'));
}
if (!$options['displayDatePart'] AND $options['displayTimePart']) {
$formatDate = date($this->timeOnlyFormat, strtotime($dateTime . ' +' . $offsetMinutes . ' minutes'));
}
}
return $formatDate;
} // END function formatDate
public function formatDateThai($dateTime = null,$option=null) {
$strYear = date("Y",strtotime($dateTime))+543;
$strMonth= date("n",strtotime($dateTime));
$strDay= date("j",strtotime($dateTime));
$strHour= date("H",strtotime($dateTime));
$strMinute= date("i",strtotime($dateTime));
$strSeconds= date("s",strtotime($dateTime));
$strMonthCut = Array("","ม.ค.","ก.พ.","มี.ค.","เม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค.");
//$thai_day_arr=array("อาทิตย์","จันทร์","อังคาร","พุธ","พฤหัสบดี","ศุกร์","เสาร์");
/*
$thai_month_arr=array(
"0"=>"",
"1"=>"มกราคม",
"2"=>"กุมภาพันธ์",
"3"=>"มีนาคม",
"4"=>"เมษายน",
"5"=>"พฤษภาคม",
"6"=>"มิถุนายน",
"7"=>"กรกฎาคม",
"8"=>"สิงหาคม",
"9"=>"กันยายน",
"10"=>"ตุลาคม",
"11"=>"พฤศจิกายน",
"12"=>"ธันวาคม"
);
*/
$strMonthThai=$strMonthCut[$strMonth];
if(!empty($option)){
if (array_key_exists('Y', $option)) $strYear = substr($strYear, -2);
}
//return "$strDay $strMonthThai $strYear, $strHour:$strMinute";
//return $strDay .' '. $strMonthThai .' '. $yearThai($strYear);
//return $strDay .' '. $strMonthThai .' '. $strYear;
return $strDay .' '. $strMonthThai .' '. $strYear;
} // END function formatDate
public function formatFullDateThai($dateTime = null,$option=null) {
$dateTime = json_decode(json_encode($dateTime),true);
$strYear = date("Y",strtotime($dateTime))+543;
$strMonth= date("n",strtotime($dateTime));
$strDay= date("j",strtotime($dateTime));
$strHour= date("H",strtotime($dateTime));
$strMinute= date("i",strtotime($dateTime));
$strSeconds= date("s",strtotime($dateTime));
$strMonthCut = Array("","ม.ค.","ก.พ.","มี.ค.","เม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค.");
//$thai_day_arr=array("อาทิตย์","จันทร์","อังคาร","พุธ","พฤหัสบดี","ศุกร์","เสาร์");
$thai_month_arr=array(
"0"=>"",
"1"=>"มกราคม",
"2"=>"กุมภาพันธ์",
"3"=>"มีนาคม",
"4"=>"เมษายน",
"5"=>"พฤษภาคม",
"6"=>"มิถุนายน",
"7"=>"กรกฎาคม",
"8"=>"สิงหาคม",
"9"=>"กันยายน",
"10"=>"ตุลาคม",
"11"=>"พฤศจิกายน",
"12"=>"ธันวาคม"
);
$strMonthThai=$thai_month_arr[$strMonth];
if(!empty($option)){
if (array_key_exists('Y', $option)) $strYear = substr($strYear, -2);
}
//return "$strDay $strMonthThai $strYear, $strHour:$strMinute";
//return $strDay .' '. $strMonthThai .' '. $yearThai($strYear);
//return $strDay .' '. $strMonthThai .' '. $strYear;
return $strDay .' '. $strMonthThai .' '. $strYear;
} // END function formatDate
public function formatDateTimeThai($dateTime = null,$option=null) {
$strYear = date("Y",strtotime($dateTime))+543;
$strMonth= date("n",strtotime($dateTime));
$strDay= date("j",strtotime($dateTime));
$strHour= date("H",strtotime($dateTime));
$strMinute= date("i",strtotime($dateTime));
$strSeconds= date("s",strtotime($dateTime));
$strMonthCut = Array("","ม.ค.","ก.พ.","มี.ค.","เม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค.");
//$thai_day_arr=array("อาทิตย์","จันทร์","อังคาร","พุธ","พฤหัสบดี","ศุกร์","เสาร์");
/*
$thai_month_arr=array(
"0"=>"",
"1"=>"มกราคม",
"2"=>"กุมภาพันธ์",
"3"=>"มีนาคม",
"4"=>"เมษายน",
"5"=>"พฤษภาคม",
"6"=>"มิถุนายน",
"7"=>"กรกฎาคม",
"8"=>"สิงหาคม",
"9"=>"กันยายน",
"10"=>"ตุลาคม",
"11"=>"พฤศจิกายน",
"12"=>"ธันวาคม"
);
*/
$strMonthThai=$strMonthCut[$strMonth];
if(!empty($option)){
if (array_key_exists('Y', $option)) $strYear = substr($strYear, -2);
}
//return "$strDay $strMonthThai $strYear, c";
//return $strDay .' '. $strMonthThai .' '. $yearThai($strYear);
//return $strDay .' '. $strMonthThai .' '. $strYear;
return $strDay .' '. $strMonthThai .' '. $strYear.' '.$strHour.":".$strMinute.":".$strSeconds;
} // END function formatDate
public function formatYearThai($dateTime = null,$length=null) {
$strYear = $this->yearThai(date("Y",strtotime($dateTime)));
if(!empty($length)) $strYear = substr($strYear, -$length);
return $strYear;
} // END function formatYear
public function formatThaiDate($dateTime = null,$length=null) {
$strDayMonth = date('d/m/',strtotime($dateTime));
$strYear = $this->yearThai(date("Y",strtotime($dateTime)));
if(!empty($length)) $strYear = substr($strYear, -$length);
return $strDayMonth.$strYear;
} // END function formatYear
public function yearThai($year = null) {
return $year+543;
} // END function formatDate
public function getDay($date){
$str_day = date('d', strtotime($date));
return $str_day;
}
public function getMonth($date){
$str_month = date('m', strtotime($date));
return $str_month;
}
public function getYear($date){
$str_year = date('Y', strtotime($date));
return $str_year;
}
function convertDateTodmY($date){
return date('d/m/Y', strtotime($date));
}
function convertDateTodmY_TH($date){
$date = json_decode(json_encode($date),true);
$strYear = date("Y",strtotime($date))+543;
$strMonth = date("m",strtotime($date));
$strDay = date("d",strtotime($date));
return $strDay.'/'.$strMonth.'/'.$strYear;
}
function convertDateTodmY_Hi_TH($date){
$strYear = date("Y",strtotime($date))+543;
$strMonth = date("m",strtotime($date));
$strDay = date("d",strtotime($date));
return $strDay.'/'.$strMonth.'/'.$strYear.' ' .date("H:i",strtotime($date));
}
function convertDateTomY_TH($date){
$date = json_decode(json_encode($date),true);
$strYear = date("Y",strtotime($date))+543;
$strMonth = date("m",strtotime($date));
return $strMonth.'/'.$strYear;
}
function convertDateToYmd($date){
return date('Y-m-d', strtotime($date));
}
function convertDateToYmdHis($date){
return date('Y-m-d H:i:s', strtotime($date));
}
function convertDateTod_m_Y($date){
return date('d-m-Y', strtotime($date));
}
function convertDateTodmYHis($date){
return date('d-m-Y H:i:s', strtotime($date));
}
function convertDateToHi($date){
$date = json_decode(json_encode($date),true);
return date('H:i', strtotime($date));
}
}
\ 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