Commit 4f81c251 by Zen-PC\Zen

Zen : update big card

parent a9028a7d
...@@ -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;
// }
} }
...@@ -94,7 +94,7 @@ class UsersController extends AppController ...@@ -94,7 +94,7 @@ class UsersController extends AppController
$countries = $this->MasterCountries->find('list', $countries = $this->MasterCountries->find('list',
[ [
'conditions' => ['is_used' => true,'id'=>1], 'conditions' => ['is_used' => true],
'keyField' => 'id', 'keyField' => 'id',
'valueField' => ['country_name_th'] 'valueField' => ['country_name_th']
] ]
...@@ -103,7 +103,7 @@ class UsersController extends AppController ...@@ -103,7 +103,7 @@ class UsersController extends AppController
$provinces = $this->MasterProvinces->find('list', $provinces = $this->MasterProvinces->find('list',
[ [
'conditions' => ['is_used' => true,'master_country_id'=>1], 'conditions' => ['is_used' => true],
'keyField' => 'id', 'keyField' => 'id',
'valueField' => 'province_name_th' 'valueField' => 'province_name_th'
] ]
...@@ -217,7 +217,7 @@ class UsersController extends AppController ...@@ -217,7 +217,7 @@ class UsersController extends AppController
$user_personals = $this->UserPersonals->patchEntity($user_personals, $this->request->getData()); $user_personals = $this->UserPersonals->patchEntity($user_personals, $this->request->getData());
$this->UserPersonals->save($user_personals); $this->UserPersonals->save($user_personals);
$this->Flash->success(__('The register success.')); // $this->Flash->success(__('The register success.'));
return $this->redirect(['controller' => 'Users', 'action' => 'pinCode/'.$users['token']]); return $this->redirect(['controller' => 'Users', 'action' => 'pinCode/'.$users['token']]);
return $this->redirect(['action' => 'signin']); return $this->redirect(['action' => 'signin']);
} }
...@@ -356,55 +356,94 @@ class UsersController extends AppController ...@@ -356,55 +356,94 @@ class UsersController extends AppController
#--------------------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------------------
#Change Password #Change Password
// public function changePassword()
// {
// $users = $this->Users->newEntity();
// // $this->viewBuilder()->layout('blank');
// $data = $this->request->data();#debug($data);exit();
// // pr($data);die;
// // if(!empty($data)){
// // if($this->validateAccount($data)){
// if ($this->request->is('post')) {
// $data['ip'] = $this->request->clientIp();#debug($data);exit();
// $hasher = new DefaultPasswordHasher();
// $data['id'] = 59445;
// $users = $this->Users->find('all',[
// 'conditions'=>[
// 'Users.id' => $data['id'],
// ]
// ])->first();
// // pr($data['password']);
// // pr($users['password']);die;
// // $sss = check( $data['password'] , $users['password'] );
// $user['password'] = $hasher->hash($data['password']);
// // pr($user);die;
// $users = $this->Users->patchEntity($users, $this->request->getData());
// $this->Users->save($users);
// $this->Flash->error(__('Change Password Success'));
// // return $this->redirect(['controller' => 'Users', 'action' => 'signin']);
// // $response = json_decode($users['password'],'_full');
// // pr($response);die;
// #debug($response);exit();
// // pr($data);die;
// // if(!empty($response)){
// // // pr($response);die;
// // #if(trim($response['status']) == 'Success' && !empty($response['result']['type'])){
// // if(trim($response['status']) == 'Success'){
// // #$this->response->withHeader('Authorization', 'Bearer '.$response['result']['token']);
// // #$url = $this->Url->build(['controller' => 'Homes', 'action' => 'index'], true);
// // $url = Router::url(['controller' => 'Users', 'action' => 'signup'], true);
// // #echo "<script>Login.onLogin('".$response['result']['token']."','".$url."');</script>";die;
// // $this->Flash->success(__('change Password completed.'));
// // return $this->redirect(['controller' => 'Users', 'action' => 'signin']);
// // }else{
// // $this->Flash->error(__('change Password Fail'));
// // return $this->redirect(['controller' => 'Users', 'action' => 'signup']);
// // }
// // }
// }else{
// $this->Flash->error(__('Data Empty'));
// return $this->redirect(['controller' => 'Users', 'action' => 'signin']);
// }
// // }
// }
public function changePassword() public function changePassword()
{ {
$this->viewBuilder()->layout('blank'); // $users = $this->Users->newEntity();
$data = $this->request->data();#debug($data);exit(); if ($this->request->is('post')) {
// pr($data);die; $hasher = new DefaultPasswordHasher();
// pr($this->validateAccount($data));die; $confirm_password = $this->request->data['confirm_password'];
if(!empty($data)){ $this->request->data['password'] = $hasher->hash($this->request->data['password']);
// pr($data);die; $userid = 59445;
if($this->validateAccount($data)){ $users = $this->Users->find('all',[
$data['data']['ip'] = $this->request->clientIp();#debug($data);exit(); 'conditions' => [
'Users.id' => $userid
// pr($data);die; ]
$api_core_change_password = Configure::read('Config.apiCore.changePassword');#debug($api_core_change_password);exit(); ])->first();
$http = new Client(); // if($this->request->data['old']!=$users['password'])
// pr($http);die; $users = $this->Users->patchEntity($users, $this->request->getData());
#$response = json_decode($http->post($api_core_change_password,$data)->body(),'_full'); $this->Users->save($users);
$response = $http->post($api_core_change_password,$data)->body(); pr($users);die;
// pr($data);die; // return $this->redirect(['controller' => 'Users', 'action' => 'pinCode/'.$users['token']]);
#debug($response);exit(); return $this->redirect(['action' => 'signin']);
$response = json_decode($response,'_full'); // }
// pr($response);die; // $this->Flash->error(__('Username or Email Address already used by others.'));
#debug($response);exit(); // return $this->redirect(['action' => 'signup']);
if(!empty($response)){
// pr($response);die;
#if(trim($response['status']) == 'Success' && !empty($response['result']['type'])){
if(trim($response['status']) == 'Success'){
#$this->response->withHeader('Authorization', 'Bearer '.$response['result']['token']);
#$url = $this->Url->build(['controller' => 'Homes', 'action' => 'index'], true);
$url = Router::url(['controller' => 'Users', 'action' => 'signup'], true);
#echo "<script>Login.onLogin('".$response['result']['token']."','".$url."');</script>";die;
$this->Flash->success(__('change Password completed.'));
return $this->redirect(['controller' => 'Users', 'action' => 'signin']);
}else{
$this->Flash->error(__('change Password Fail'));
return $this->redirect(['controller' => 'Users', 'action' => 'signup']);
}
}
}else{ // $this->Flash->error(__('The article could not be saved. Please, try again.'));
$this->Flash->error(__('Data Empty'));
return $this->redirect(['controller' => 'Users', 'action' => 'signin']);
}
} }
} }
#--------------------------------------------------------------------------------------------------- #---------------------------------------------------------------------------------------------------
public function signout() public function signout()
...@@ -413,4 +452,28 @@ class UsersController extends AppController ...@@ -413,4 +452,28 @@ class UsersController extends AppController
} }
public function getProvince() {
$this->autoRender = false;
$this->loadModel('MasterProvinces');
$states = array();
$id = $this->request->data('id');
$states = $this->MasterProvinces->find('list', array(
'keyField' => 'id',
'valueField' => 'province_name_th',
'conditions' => array(
'master_country_id' =>$id
)
))->toArray();
$arr = array();
if(!empty($states)){
echo '<option value=""> ---Select--- </option>';
foreach($states as $key => $val){
echo '<option value="' . $key . '">' . $val. '</option>';
}
}else{
return false;
}
}
} }
<?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" style="font-size:36px; height: 200px; padding-top:20%;" >
</div>
<div class="col-xs-10 col-sm-10 col-md-10">
<div data-toggle="modal" data-target="#defaultModal" style="text-align: center;">
<img src="/img/core/img/card-bg-front@3x-V2.png" class="img-responsive" id="img-upload" alt="Profile picture">
</div>
</div>
<div style="position: absolute;z-index: 2;"> <div class="col-xs-1 col-sm-1 col-md-1" style="font-size:36px; height: 200px; padding-top:20%;" >
<a href="profile_setting"><img src="/img/core/img/setting-icon@3x.png"/></a> <div >
</div> <i class = "fa fa-angle-right">
<div class="box"> </i>
<div class="absolute-right"><img src="/img/core/img/location-profile-icon@3x.png"/> สีลม ,บางรัก</div> </div>
</div> </div>
<div style="text-align: center;"> <div style="clear: both"></div>
<!--<div class="">-->
<?php //echo @$this->Html->image($responseUserProfile['UserProfiles']['img_path'], ['class' => 'imgCircle profile-img', 'id' => 'img-upload', 'alt' => 'Profile picture']); ?>
<!-- <img src="/porto/core/img/profile-img@3x.png" class="imgCircle profile-img" id="img-upload" alt="Profile picture"> -->
<img src="/img/core/img/profile-img@3x.png" class="imgCircle profile-img" id="img-upload" alt="Profile picture">
<!--</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">
...@@ -81,7 +109,6 @@ ...@@ -81,7 +109,6 @@
<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">
...@@ -146,6 +173,40 @@ ...@@ -146,6 +173,40 @@
<?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">
<div class="">
<div class="">
<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>
</div>
</div>
<script type="text/javascript"> <script type="text/javascript">
$(function () { $(function () {
$('#moblieNo').inputmask('999-999-9999'); $('#moblieNo').inputmask('999-999-9999');
...@@ -206,25 +267,23 @@ ...@@ -206,25 +267,23 @@
//================================================== //==================================================
// CHANGE Province According Country // CHANGE Province According Country
//================================================== //==================================================
// $(document).ready(function() {
// $("#loding1").hide(); $(document).ready(function () {
// $("#loding2").hide(); $("#master_country_id").on('change', function () {
// $("#master_country_id").on('change',function() { var id = $(this).val();
// var id = $(this).val(); if (id) {
// // alert('dddd'); var dataString = 'id=' + id;
// $("#loding1").show(); $.ajax({
// $("#master_province_id").find('option').remove(); type: "POST",
// if (id) { url: '/users/getProvince',
// var dataString = 'id='+ id; data: dataString,
// alert(dataString); cache: false,
// $.post("/Profiles/getProvince", {id: id}, function(data) { success: function (html) {
// console.log(data); $("#master_province_id").html(html);
// data = jQuery.parseJSON(data); }
// console.log(data); });
// }); }
// // $('<option>').val('').text('---Select---'); });
// // $('<option>').val(key).text(value).appendTo($("#master_province_id")); });
// }
// });
// });
</script> </script>
\ 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