Commit 7e963e6a by Teeradone-PIM

Merge branch 'integration' into teeradone

parents bfaab62b 986b0ea8
...@@ -4,3 +4,4 @@ www/tmp/ ...@@ -4,3 +4,4 @@ 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 www/src/Controller/UsersController.php.bg20180515
www/config/app.backup
<?php
namespace App\Controller;
use App\Controller\AppController;
class CheckemailsController extends AppController {
public function checkemailregister(){
// 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']!='-'){
$emails['chk'] = 'false';
$data = json_encode($emails);
echo $data;
}else{
$emails['chk'] = 'true';
$data = json_encode($emails);
echo $data;
}
}
}
public function checkemailedit(){
// 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($this->request->data['userId'] == $emails['user_id']){
$emails['chk'] = 'true';
$data = json_encode($emails);
echo $data;
} else {
$emails['chk'] = 'false';
$data = json_encode($emails);
echo $data;
}
}else{
$emails['chk'] = 'true';
$data = json_encode($emails);
echo $data;
}
}
}
}
...@@ -211,7 +211,7 @@ class UserCardsController extends AppController ...@@ -211,7 +211,7 @@ class UserCardsController extends AppController
'user_id', 'user_id',
'organize_id' 'organize_id'
], 'conditions' => [ ], 'conditions' => [
'user_id' => 2, 'user_id' => $this->Auth->user('id'),
'organize_id' => $MasterOrganizations[0]['id'] 'organize_id' => $MasterOrganizations[0]['id']
] ]
])->toArray(); ])->toArray();
...@@ -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'] = 1; $userCard['user_id'] = 1;
// 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']);
} }
......
<?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';
}
}
...@@ -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">
...@@ -67,6 +68,8 @@ use Cake\I18n\Time; ...@@ -67,6 +68,8 @@ use Cake\I18n\Time;
</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>
...@@ -164,7 +167,7 @@ use Cake\I18n\Time; ...@@ -164,7 +167,7 @@ use Cake\I18n\Time;
</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,11 +201,9 @@ use Cake\I18n\Time; ...@@ -197,11 +201,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 date-position"> <div class="row date-position">
<div class="col-xs-1"> <div class="col-xs-1">
</div> </div>
...@@ -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>
<!--/ .font-card-->
<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;')); ?> <?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>
<!--/ .back-card-->
</div> </div>
</div> <!--/.owl-carousel-->
</div> </div>
</div> </div>
</div> </div>
...@@ -372,32 +377,61 @@ use Cake\I18n\Time; ...@@ -372,32 +377,61 @@ 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>
...@@ -485,6 +519,12 @@ use Cake\I18n\Time; ...@@ -485,6 +519,12 @@ use Cake\I18n\Time;
$(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);
...@@ -500,6 +540,7 @@ use Cake\I18n\Time; ...@@ -500,6 +540,7 @@ use Cake\I18n\Time;
}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']);
......
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