Commit 3e1fe137 by Teeradone-PIM

Merge branch 'integration' into teeradone

parents 3fad2af2 5681bf63
......@@ -3,3 +3,4 @@ www/logs/
www/tmp/
www/webroot/img/img/demos/shop/products/shop8/product2.jpg
www/webroot/img/img/demos/
www/src/Controller/UsersController.php.bg20180515
......@@ -24,8 +24,7 @@ class ProfilesController extends AppController
$this->loadModel('MasterCountries');
$Country = $this->MasterCountries->find('list', [
'conditions' => [
'is_used' => true,
'MasterCountries.id' => 1],
'is_used' => true],
'keyField' => 'id',
'valueField' => 'country_name_th'
]);
......@@ -35,8 +34,7 @@ class ProfilesController extends AppController
$this->loadModel('MasterProvinces');
$Province = $this->MasterProvinces->find('list', [
'conditions' => [
'is_used' => true,
'master_country_id' => 1],
'is_used' => true],
'keyField' => 'id',
'valueField' => 'province_name_th'
]);
......@@ -86,6 +84,7 @@ class ProfilesController extends AppController
$birthdate = explode("/", $this->request->data['UserPersonals']['birthdate']);
$birthdate = $birthdate[2].'-'.$birthdate[1].'-'.$birthdate[0];
$userPersonals = $this->UserPersonals->patchEntity($userPersonals, $data['UserPersonals']);
$userPersonals['firstname_th'] = $this->request->data['UserPersonals']['firstname_th'];
$userPersonals['lastname_th'] = $this->request->data['UserPersonals']['lastname_th'];
......@@ -110,9 +109,6 @@ class ProfilesController extends AppController
}
/*****************************************************************************/
/*****************************************************************************/
public function settingProfile()
{
//prr($this->request->getHeaderLine('Accept-Language'));
......@@ -593,30 +589,4 @@ if (!empty($SubjectEnrolls)) {
$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
}
public function viewCard($user_id = null){
$this->viewBuilder()->layout('blank');
// $user = $this->Auth();
$this->loadModel('UserCards');
$UserCards = $this->UserCards->find('all')
->select($this->UserCards)
......
......@@ -99,6 +99,6 @@
<?php echo $this->Html->script('custom'); ?>
<!-- Theme Initialization Files -->
<?php echo $this->Html->script('theme.init'); ?>
<?php echo $this->fetch('scriptBottom'); ?>
</body>
</html>
......@@ -49,7 +49,7 @@
var date = document.getElementById("date");
$(document).ready(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);
$.post("/UserCards/checkOrg", {organize_code: organize_code}, function(data) {
if(data!='false'){
......@@ -94,8 +94,7 @@
date.focus();
}
}
</script>
<script>
$(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";
......
<?php
use Cake\I18n\Time;
?>
<div class="owl-carousel owl-theme" data-plugin-options="{'items': 1}">
<?php foreach ($UserCards as $value) { #pr($value);die;?>
<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>
<i class = "fa fa-angle-left prev" > </i>
</div>
</div>
<div class="col-xs-10 col-sm-10 col-md-10" style=" border: 1px solid red; height: 200px; margin-top: 10px;">
<div class="col-xs-9 col-sm-9 col-md-9 box-card">
<div class="row">
<div class="col-xs-1">
</div>
......@@ -35,10 +40,18 @@
<div class="col-xs-1">
</div>
<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 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 class="row">
......@@ -52,6 +65,11 @@
</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="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
......@@ -91,16 +109,180 @@
<div class="form-group has-feedback">
<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>
<?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="form-group has-feedback">
<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>
<?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>
<?php } ?>
<div class="row">
<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();?>
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