Commit 7c9408b0 by Zen-PC\Zen

Merge branch 'integration' into kraikrit

parents aed586b3 5d33e689
......@@ -45,6 +45,7 @@ class AppController extends Controller {
public function initialize() {
parent::initialize();
//$this->viewBuilder()->theme('Porto');
I18n::setLocale('th_TH');
$this->loadComponent('RequestHandler');
$this->loadComponent('Flash');
......
......@@ -108,6 +108,33 @@ class UsersController extends AppController {
}
}
/**
*
* Function mobile re-authorized use automatically by mobile application
* @author sarawutt.b
* @return void
*/
public function reautorize() {
$this->viewBuilder()->layout(false);
$reauthorizeAPI = Configure::read('Config.apiCore.reauthorize');
$http = new Client();
$data['data']['username'] = 'pakgon.demo';
$data['data']['password'] = 'deio$5679@qETY';
$data['data']['ip'] = $this->request->clientIp();
$response = $http->post(
$reauthorizeAPI, $data['data'], ['headers' => [
'Authorization' => $this->request->getHeaderLine('Authorization'),
'Accept-Language' => $this->request->getHeaderLine('Accept-Language')
]])->body();
$response = json_decode($response, true);
if (!empty($response['result']['user'])) {
$response['result']['user']['id'] = $response['result']['user']['user_id'];
$this->Auth->setUser($response['result']['user']);
return $this->redirect(Configure::read('RedirectApplicationURL'));
} else {
return $this->redirect(['controller' => 'Users', 'action' => 'signin']);
}
}
public function signup() {
$this->loadModel('MasterCountries');
$this->loadModel('MasterProvinces');
......@@ -492,21 +519,6 @@ class UsersController extends AppController {
#---------------------------------------------------------------------------------------------------
/**
*
* Function user logout / signout
* @author sarawutt.b
* @since 2018/05/22 16:44:20
* @license PAKGON
* @return void
*/
public function signout() {
$http = new Client();
$result = $http->delete(Configure::read('OAUTH2_PROVIDER.TOKEN_DETETE') . '/' . $this->Auth->user('id'))->body();
$this->Flash->success(__('You are now logged out.'));
return $this->redirect($this->Auth->logout());
}
public function forgotsendpin($token=null) {
$this->loadModel('UserPersonals');
......@@ -568,4 +580,21 @@ class UsersController extends AppController {
return $this->redirect(['action' => 'pin_code/'.$token]);
}
/**
*
* Function user logout / signout
* @author sarawutt.b
* @since 2018/05/22 16:44:20
* @license PAKGON
* @return void
*/
public function signout() {
$http = new Client();
$result = $http->delete(Configure::read('OAUTH2_PROVIDER.TOKEN_DETETE') . '/' . $this->Auth->user('id'))->body();
$this->Flash->success(__('You are now logged out.'));
return $this->redirect($this->Auth->logout());
}
}
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12">
<div class="modal fade" id="defaultModal_<?php echo $i;?>" tabindex="-1" role="dialog" aria-labelledby="defaultModalLabel"
aria-hidden="true">
<div class="modal-dialog box-ads">
<a class="close-modal" data-dismiss="modal">X </a>
<div class="container login-container">
<div class="">
<div class="owl-carousel owl-theme" data-plugin-options="{'items': 1}">
<div class="row rotate270 form_1">
<?php echo $this->Html->image('/img/core/img/card-bg-front@3x.png', array('div' => false, 'class' => 'img-responsive img-rounded','style' => 'position: absolute;')); ?>
<div class="row date-name">
<div class="col-xs-8 ">
<br>
<div>
<label>id</label>
</div>
<div>
<?php echo $value['card_code'] ?>
</div>
<div>
<labe>ชื่อ</label>
<?php echo $value['prefix_name_th'].$value['firstname_th'].' '.$value['lastname_th'] ?>
</div>
</div>
<div class="col-xs-4">
<img src="/img/core/img/user-profile@3x.png" class="img-responsive">
</div>
</div>
<div class="row date-position">
<div class="col-xs-12">
<label>ตำแหน่ง</label>
<?php echo $value['position_name'] ?>
</div>
</div>
<div class="row text-center date-time">
<div class="col-xs-6">
<?php
$now = new Time($value['date_issued']);
$dateIssued = $now->i18nFormat('yyyy-MM-dd');
echo $this->DateFormat->formatDateThai($dateIssued);
?>
</div>
<div class="col-xs-6">
<?php
$now = new Time($value['date_expiry']);
$dateExpiry = $now->i18nFormat('yyyy-MM-dd');
echo $this->DateFormat->formatDateThai($dateExpiry);
?>
</div>
</div>
<div class="row text-center date-label">
<div class="col-xs-6">
<label>วันออกบัตร</label>
</div>
<div class="col-xs-6">
<label>วันหมดออายุ</label>
</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>
<!--/.owl-carousel-->
</div>
</div>
<!--/.container -->
</div>
<!--/.box-ads -->
</div>
<!--/.defaultModal -->
</div>
</div>
......@@ -13,7 +13,7 @@ use Cake\I18n\Time;
</div>
<div class="col-xs-10 col-sm-10 col-md-10">
<div class="box-card">
<div data-toggle="modal" data-target="#defaultModal_<?php echo $i;?>" style="cursor: pointer; padding-right: 10px; padding-left: 10px;">
<div data-toggle="modal" data-target="#card_<?php echo $i;?>" style="cursor: pointer; padding-right: 10px; padding-left: 10px;">
<div class="row">
<div class="col-xs-8">
<div style="font-size: 17px">
......@@ -128,9 +128,10 @@ use Cake\I18n\Time;
</div>
</div>
<!--/.col-xs-12 -->
</div>
<!--/.row -->
<?php
$i++;
}
......@@ -148,11 +149,11 @@ use Cake\I18n\Time;
<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();',
'url' => ['controller' => 'user-cards', 'action' => 'view-card']
]); ?>
'id' => 'frmSignIn',
'type' => 'file',
'onsubmit' => 'return check();',
'url' => ['controller' => 'user-cards', 'action' => 'view-card']
]); ?>
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo $this->Flash->render(); ?>
......@@ -190,82 +191,17 @@ use Cake\I18n\Time;
<!--/.row -->
</div>
<!--/.owl-carousel -->
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12">
<div class="modal fade" id="defaultModal_<?php echo $i;?>" tabindex="-1" role="dialog" aria-labelledby="defaultModalLabel" aria-hidden="true">
<div class="modal-dialog box-ads">
<a class="close-modal" data-dismiss="modal">X </a>
<div class="container login-container">
<div class="">
<div class="owl-carousel owl-theme" data-plugin-options="{'items': 1}">
<div class="row rotate270 form_1">
<?php echo $this->Html->image('/img/core/img/card-bg-front@3x.png', array('div' => false, 'class' => 'img-responsive img-rounded','style' => 'position: absolute;')); ?>
<div class="row date-name">
<div class="col-xs-8 ">
<br>
<div>
<label>id</label>
</div>
<div>
<?php echo $value['card_code'] ?>
</div>
<div>
<labe>ชื่อ</label>
<?php echo $value['prefix_name_th'].$value['firstname_th'].' '.$value['lastname_th'] ?>
</div>
</div>
<div class="col-xs-4">
<img src="/img/core/img/user-profile@3x.png" class="img-responsive">
</div>
</div>
<div class="row date-position">
<div class="col-xs-12">
<label>ตำแหน่ง</label>
<?php echo $value['position_name'] ?>
</div>
</div>
<div class="row text-center date-time">
<div class="col-xs-6">
<?php
$now = new Time($value['date_issued']);
$dateIssued = $now->i18nFormat('yyyy-MM-dd');
echo $this->DateFormat->formatDateThai($dateIssued);
?>
</div>
<div class="col-xs-6">
<?php
$now = new Time($value['date_expiry']);
$dateExpiry = $now->i18nFormat('yyyy-MM-dd');
echo $this->DateFormat->formatDateThai($dateExpiry);
?>
</div>
</div>
<div class="row text-center date-label">
<div class="col-xs-6">
<label>วันออกบัตร</label>
</div>
<div class="col-xs-6">
<label>วันหมดออายุ</label>
</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>
<!--/.owl-carousel-->
</div>
</div>
<!--/.container -->
</div>
<!--/.box-ads -->
</div>
<!--/.defaultModal -->
</div>
</div>
<?php
$i=0;
foreach ($UserCards as $value) {
echo $this->element('card_from/from_0',array('value' => $value,'i'=> $i));
$i++;
}
?>
</div>
<style>
#alertBox {
position: relative;
......@@ -661,3 +597,4 @@ use Cake\I18n\Time;
</script>
<?php $this->end();?>
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