Commit eb9aa688 by Prasong Putichanchai

update profile

parent 3fe2815c
...@@ -58,8 +58,42 @@ class ProfilesController extends AppController ...@@ -58,8 +58,42 @@ class ProfilesController extends AppController
}else{ }else{
$dateNow = ""; $dateNow = "";
} }
/**
*
* Function show user card
* @Data 01/06/2018
* @author Prasong.p
*
*/
$this->loadModel('UserCards');
$UserCards = $this->UserCards->find('all')
->select($this->UserCards)
->select(
'morg.org_name_th'
)
->join([
'morg' => [
'table' => 'master.master_organizations',
'type' => 'INNER',
'conditions' => [
'morg.id = userCards.organize_id'
],
]
])
->where([
'userCards.user_id' => $id
])
->order(['userCards.id' => 'ASC'])
->toArray();
//$this->set(compact('UserCards'));
//------- save update ---- //------- save update profile ----
if ($this->request->is(['patch', 'post', 'put'])) { if ($this->request->is(['patch', 'post', 'put'])) {
$data = $this->request->data; $data = $this->request->data;
...@@ -123,8 +157,8 @@ class ProfilesController extends AppController ...@@ -123,8 +157,8 @@ class ProfilesController extends AppController
} }
//-------end save update ---- //-------end save update ----
$this->set(compact('userPersonals', 'responseUserProfile', 'dateNow', 'username', 'Country', 'Province', 'responseUserPersonal')); $this->set(compact('userPersonals', 'responseUserProfile', 'dateNow', 'username', 'Country', 'Province', 'responseUserPersonal','UserCards'));
$this->set('_serialize', ['userPersonals', 'responseUserProfile', 'dateNow', 'username', 'Country', 'Province', 'responseUserPersonal']); $this->set('_serialize', ['userPersonals', 'responseUserProfile', 'dateNow', 'username', 'Country', 'Province', 'responseUserPersonal','UserCards']);
} }
......
...@@ -208,33 +208,33 @@ class UserCardsController extends AppController ...@@ -208,33 +208,33 @@ 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_id = $this->Auth->user('id'); // $user_id = $this->Auth->user('id');
$this->loadModel('UserCards'); // $this->loadModel('UserCards');
$UserCards = $this->UserCards->find('all') // $UserCards = $this->UserCards->find('all')
->select($this->UserCards) // ->select($this->UserCards)
->select( // ->select(
'morg.org_name_th' // 'morg.org_name_th'
) // )
->join([ // ->join([
'morg' => [ // 'morg' => [
'table' => 'master.master_organizations', // 'table' => 'master.master_organizations',
'type' => 'INNER', // 'type' => 'INNER',
'conditions' => [ // 'conditions' => [
'morg.id = userCards.organize_id' // 'morg.id = userCards.organize_id'
], // ],
] // ]
]) // ])
->where([ // ->where([
'userCards.user_id' => $user_id // 'userCards.user_id' => $user_id
]) // ])
->order(['userCards.id' => 'ASC']) // ->order(['userCards.id' => 'ASC'])
->toArray(); // ->toArray();
// pr($UserCards);die; // // pr($UserCards);die;
$this->set(compact('UserCards')); // $this->set(compact('UserCards'));
// -----------------------------ในส่วนของการ add------------------------- // -----------------------------ในส่วนของการ add-------------------------
$this->autoRender = false;
$this->loadModel('TempUserCards'); $this->loadModel('TempUserCards');
$this->loadModel('MasterOrganizations'); $this->loadModel('MasterOrganizations');
if($this->request->is('post')) { if($this->request->is('post')) {
...@@ -307,11 +307,13 @@ class UserCardsController extends AppController ...@@ -307,11 +307,13 @@ class UserCardsController extends AppController
} }
}else{ }else{
$this->Flash->error(__('ลงทะเบียนไว้อยู่แล้ว')); $this->Flash->error(__('ลงทะเบียนไว้อยู่แล้ว'));
return $this->redirect(['controller' => 'UserCards', 'action' => 'viewCard']); // return $this->redirect(['controller' => 'UserCards', 'action' => 'viewCard']);
return $this->redirect(['controller' => 'Profiles', 'action' => 'index#box-add-card']);
} }
}else{ }else{
$this->Flash->error(__('ไม่พบข้อมูล')); $this->Flash->error(__('ไม่พบข้อมูล'));
return $this->redirect(['controller' => 'UserCards', 'action' => 'viewCard']); // return $this->redirect(['controller' => 'UserCards', 'action' => 'viewCard']);
return $this->redirect(['controller' => 'Profiles', 'action' => 'index#box-add-card']);
} }
} }
} }
......
...@@ -3,15 +3,16 @@ use Cake\I18n\Time; ...@@ -3,15 +3,16 @@ 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 " id="card_<?php echo $i;?>" tabindex="-1" role="dialog" aria-labelledby="" <div class="modal fade" id="card_<?php echo $i;?>" tabindex="-1" role="dialog" aria-labelledby="defaultModalLabel" aria-hidden="true">
aria-hidden="true">
<div class="modal-dialog box-ads"> <div class="modal-dialog box-ads">
<a class="close-modal" data-dismiss="modal">X </a> <a class="close-modal" data-dismiss="modal">X </a>
<div class="container login-container"> <div class="container login-container">
<div class=""> <div class="">
<div class="owl-carousel owl-theme" data-plugin-options="{'items': 1}"> <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;')); ?> <div class="form_1-card-img">
<?php echo $this->Html->image('/img/core/img/card-bg-front@3x.png', array('div' => false, 'class' => 'img-responsive img-rounded','style' => '')); ?>
</div>
<div class="row date-name"> <div class="row date-name">
<div class="col-xs-8 "> <div class="col-xs-8 ">
<br> <br>
...@@ -63,7 +64,7 @@ use Cake\I18n\Time; ...@@ -63,7 +64,7 @@ use Cake\I18n\Time;
</div> </div>
<!--/ .font-card--> <!--/ .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' => '')); ?>
</div> </div>
<!--/ .back-card--> <!--/ .back-card-->
</div> </div>
...@@ -78,4 +79,57 @@ use Cake\I18n\Time; ...@@ -78,4 +79,57 @@ use Cake\I18n\Time;
</div> </div>
<!--/.col-xs-12 --> <!--/.col-xs-12 -->
</div> </div>
<!--/row modal card--> <!--/row modal card-->
\ No newline at end of file
<style>
.form_1 {
width: 100%;
height: 100%;
margin: auto;
padding: auto;
}
.form_1-card-img {
position: absolute;
width: 100%;
margin: auto;
padding: auto;
}
.form_1-card-img img {
position: relative;
width: 100%;
}
.form_1 .date-name {
width: 500px;
margin: 55% 0% 0% -40%;
border-bottom: 0px solid red;
position: absolute;
z-index: 9999;
display: block;
}
.date-name div div {
height: 35px;
}
.form_1 .date-position {
width: 500px;
margin: 70% 0% 0% -15%;
border-bottom: 0px solid #000;
}
.form_1 .date-time {
width: 500px;
margin: 70% 0% 0% 10%;
border-bottom: 0px solid #000;
}
.form_1 .date-label {
width: 500px;
margin: 70% 0% 0% 20%;
border-bottom: 0px solid #000;
}
</style>
\ No newline at end of file
<div class="col-xs-12" data-hash="box-add-card" id="box-add-card">
<div class="col-xs-1 col-sm-1 col-md-1 box-arrow left">
<i class="fa fa-angle-left prev"> </i>
</div>
<div class="col-xs-10 col-sm-10 col-md-10">
<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 right"></div>
<div class="">
<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']
]); ?>
<div class="form-group has-feedback">
<div class="col-xs-12 col-sm-12 col-md-12">
<?php echo $this->Flash->render(); ?>
<?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']); ?>
<?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']); ?>
<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' => __('Ref 1'), 'placeholder' => 'Ref 1', 'disabled']); ?>
<label id="nameemp_th" style="color: green"></label>
<label id="noepm_th" style="color: red"></label>
</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 __('Ref 2');?>
</label>
<input type="text" name="UserCards[birthdate]" id="date" placeholder="Ref 2" value="" readonly 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" id="checkbutton">ตรวจสอบ</button>
</div>
<?php echo $this->Form->end(); ?>
</div>
<!--/.col-xs-12 -->
</div>
<!--/.row -->
</div>
<!--/.col-xs-12 -->
<?php $this->append('scriptBottom'); ?>
<script type="text/javascript">
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();
$('#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) {
if (data != 'false') {
data = jQuery.parseJSON(data);
if (data['chkuser'] == true) {
$("#noorg_th").text('');
$("#noorg_th").text('ลงทะเบียนกับ ' + data[0]['org_name_th'] +
' แล้ว');
$("#nameorg_th").text('');
$('#employee').attr("disabled", true);
organize_id.val('');
employee.val('');
} else if (data['chkuser'] == false) {
$("#nameorg_th").text('');
$("#nameorg_th").text(data[0]['org_name_th']);
$("#noorg_th").text('');
$("#checkbutton").removeAttr("disabled");
$("#employee").removeAttr("disabled");
organize_id.val(data[0]['id']);
}
} else {
$("#noorg_th").text('');
$("#noorg_th").text('ไม่พบข้อมูล');
$("#nameorg_th").text('');
$("#noepm_th").text('');
$("#nameemp_th").text('');
$('#employee').attr("disabled", true);
organize_id.val('');
employee.val('');
}
});
});
$("#employee").on('change', function () {
var employee_val = employee.val();
var organize_code = $("#organize_code").val();
$('#date').attr("disabled", true);
date.val('');
$.post("/UserCards/checkEmp", {
employee_val: employee_val,
organize_code: organize_code
}, function (data) {
if (data != 'false') {
data = jQuery.parseJSON(data);
if (data['chkuser'] == true) {
$("#noepm_th").text('');
$("#noepm_th").text('ลงทะเบียนแล้ว');
$("#nameemp_th").text('');
$('#date').attr("disabled", true);
date.val('');
} else if (data['chkuser'] == false) {
$("#nameemp_th").text('');
$("#nameemp_th").text(data['prefix_name_th'] + data['firstname_th'] + ' ' + data['lastname_th']);
$("#noepm_th").text('');
$("#date").removeAttr("disabled");
}
} else {
$("#noepm_th").text('');
$("#noepm_th").text('"ไม่พบข้อมูลที่ต้องการ" กรุณากรอกรหัสข้อมูลที่ถูกต้องและกดตรวจสอบ');
$("#nameemp_th").text('');
$('#date').attr("disabled", true);
date.val('');
}
});
});
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);
});
function check() {
if ($("#organize_code").val() == '') {
alert('กรุณากรอก Company Code');
organize_id.focus();
return false;
}
if (employee.val() == '') {
alert('กรุณากรอก Ref1');
employee.focus();
return false;
}
if (date.val() == '') {
alert('กรุณากรอก Ref2');
date.focus();
return false;
}
}
</script>
<style>
#alertBox {
position: relative;
width: 300px;
min-height: 100px;
/*margin-top:50px;*/
border: 1px solid #666;
background-color: #fff;
background-repeat: no-repeat;
background-position: 20px 30px;
left: 0;
right: 0;
top: 100px;
z-index: 2;
}
#modalContainer>#alertBox {
position: fixed;
}
#alertBox h1 {
margin: 0;
font: bold 0.9em verdana, arial;
background-color: #000;
color: #FFF;
border-bottom: 1px solid #000;
padding: 2px 0 2px 5px;
}
#alertBox p {
font-size: 14px;
height: 30px;
padding: 10px;
/* margin-left: 55px; */
text-align: center;
}
#alertBox #closeBtn {
display: block;
position: relative;
margin: 5px auto;
padding: 7px;
border: 0 none;
width: 70px;
font: 0.7em verdana, arial;
text-transform: uppercase;
text-align: center;
color: #FFF;
background-color: #000;
border-radius: 3px;
text-decoration: none;
}
/* unrelated styles */
#mContainer {
position: relative;
width: 600px;
margin: auto;
padding: 5px;
border-top: 2px solid #000;
border-bottom: 2px solid #000;
font: 0.7em verdana, arial;
}
h1,
h2 {
margin: 0;
padding: 4px;
font: bold 1.5em verdana;
border-bottom: 1px solid #000;
text-align: center;
}
code {
font-size: 1.2em;
color: #069;
}
#credits {
position: relative;
margin: 25px auto 0px auto;
width: 350px;
font: 0.7em verdana;
border-top: 1px solid #000;
border-bottom: 1px solid #000;
height: 90px;
padding-top: 4px;
}
#credits img {
float: left;
margin: 5px 10px 5px 0px;
border: 1px solid #000000;
width: 80px;
height: 79px;
}
.important {
background-color: #F5FCC8;
padding: 2px;
}
code span {
color: green;
}
</style>
<?php $this->end();?>
\ No newline at end of file
<?php <?php
use Cake\I18n\Time;
class QRGenerator { class QRGenerator {
protected $size; protected $size;
...@@ -29,28 +31,19 @@ ...@@ -29,28 +31,19 @@
?> ?>
<div class="row"> <div class="row">
<div class="owl-carousel owl-theme" data-plugin-options="{'items': 1}"> <div class="owl-carousel owl-theme" data-plugin-options="{'items': 1}">
<div class="row"> <div class="row">
<div class="col-xs-1 col-sm-1 col-md-1 box-arrow" ></div> <div class="col-xs-1 col-sm-1 col-md-1 box-arrow left">
</div>
<div class="col-xs-10 col-sm-10 col-md-10"> <div class="col-xs-10 col-sm-10 col-md-10">
<div data-toggle="modal" data-target="#defaultModal" style="text-align: center; cursor: pointer;"> <div data-toggle="modal" data-target="#defaultModal" style="text-align: center; cursor: pointer;">
<img src="/img/core/img/connect-card-v3.png" class="img-responsive" id="img-upload" alt="Profile picture"> <img src="/img/core/img/connect-card-v3.png" class="img-responsive" id="img-upload" alt="Profile picture">
</div> </div>
</div> </div>
<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 right">
<a> <i class="fa fa-angle-right next"></i>
<?php echo $this->Html->link(
'<i class = "fa fa-angle-right"></i>',
['controller' => 'UserCards', 'action' => 'viewCard', '_full' => true],['escape' => false]
); ?>
</a>
</div> </div>
<div style="clear: both"></div> <div style="clear: both"></div>
<!-- </div> <br><br>
/.row card img-->
<br><br>
<!-- <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','name' => 'frmSignIn','role' => 'form', 'onsubmit' => 'return validateForm()']); ?> <?php echo $this->Form->create('UserProfiles', ['id' => 'frmSignIn', 'type' => 'file','name' => 'frmSignIn','role' => 'form', 'onsubmit' => 'return validateForm()']); ?>
<?php echo $this->Flash->render() ?> <?php echo $this->Flash->render() ?>
...@@ -210,8 +203,148 @@ ...@@ -210,8 +203,148 @@
<?php echo $this->Form->end(); ?> <?php echo $this->Form->end(); ?>
</div> </div>
</div> </div>
<!--/.row profile--> <!--/.row profile-->
<!-- ************ user card ************ -->
<?php
$i=0;
foreach ($UserCards as $value) {
?>
<div class="row">
<div class="col-xs-1 col-sm-1 col-md-1 box-arrow left">
<i class="fa fa-angle-left prev"> </i>
</div>
<div class="col-xs-10 col-sm-10 col-md-10">
<div class="box-card">
<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">
<br>
<label>id<label>
</div>
<div>
<?php echo $value['card_code'] ?>
</div>
<div>
<label style="font-size: 17px">ชื่อ</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">
<div class="col-xs-10">
<label style="font-size: 17px">ตำแหน่ง</label>
<?php echo $value['position_name'] ?>
</div>
</div>
<div class="row text-center">
<br>
<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">
<div class="col-xs-6">
<label style="font-size: 17px">วันออกบัตร</label>
</div>
<div class="col-xs-6">
<label style="font-size: 17px">วันหมดออายุ</label>
</div>
</div>
</div>
</div>
</div>
<!--/.box-card -->
<div class="col-xs-1 col-sm-1 col-md-1 box-arrow right">
<i class="fa fa-angle-right next"></i>
</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">
<h4>ข้อมูลบริษัท</h4>
</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['prefix_name_th'].$value['firstname_th'] ?>
</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['lastname_th'] ?>
</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['morg']['org_name_th'] ?>
</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['section_name'] ?>
</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['position_name'] ?>
</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
$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
$now = new Time($value['date_expiry']);
$dateExpiry = $now->i18nFormat('yyyy-MM-dd');
echo $this->DateFormat->formatDateThai($dateExpiry);
?>
</div>
</div>
</div>
<!--/.col-xs-12 -->
</div>
<!--/.row -->
<?php
$i++;
}
?>
<!-- ************ end user card ************ -->
<!--- *************** add card ******************* -->
<?php echo $this->element('card_from/from_add_card'); ?>
<!--- *************** end card ******************* -->
</div> </div>
<!--/.owl-carousel --> <!--/.owl-carousel -->
...@@ -257,96 +390,12 @@ ...@@ -257,96 +390,12 @@
} }
?> ?>
<!--- *************** end model list ******************* -->
</div> </div>
<!--/.row top--> <!--/.row top-->
<script> <script type="text/javascript">
$(document).ready(function() {
$("#email").on('change',function(){
var userId = document.getElementById("userId").value;
var email = document.getElementById("email").value;
$.post("/Checkemails/checkemail", {email: email,userId: userId}, function(data) {
// console.log(data);
data = jQuery.parseJSON(data);
if(data['chk'] == 'false'){
alert(<?php echo __('This email is already in the system.'); ?>);
return false;
}
});
});
$("#moblieNo").on('change',function(){
var elem = document.getElementById('moblieNo').value;
// console.log(elem);
if(!elem.match(/^([A-Za-zก-๙])+$/i)){
alert(<?php echo __('only numbers') ?>);
return false;
}
})
});
function validateForm() {
var firstname_th = document.getElementById("firstname_th").value;
if (firstname_th == null || firstname_th == "") {
alert(<?php echo __('Please enter your firstname.') ?>);
return false;
}
var lastname_th = document.getElementById("lastname_th").value;
if (lastname_th == null || lastname_th == "") {
alert(<?php echo __('Please enter your lastname.') ?>);
return false;
}
var birthdate = document.getElementById("datepicker").value;
if (birthdate == null || birthdate == "") {
alert(<?php echo __('Please enter your birthdate.') ?>);
return false;
}
var moblieNo = document.getElementById("moblieNo").value;
if (moblieNo == null || moblieNo == "") {
alert(<?php echo __('Please enter your mobile.') ?>);
return false;
}
if(document.getElementById("moblieNo").value.length != 10)
{
alert(<?php echo __('Please enter a 10 digit mobile number.') ?>);
return false;
}
var email = document.getElementById("email").value;
if (email == null || email == "") {
alert(<?php echo __('Please enter your email address.') ?>);
return false;
}
var email = $("#email").val();
if (/(.+)@(.+){2,}\.(.+){2,}/.test(email)) { } else {
alert(<?php echo __('Email address format wrong, Please enter the correct number.') ?>);
return false;
}
// var email = document.getElementById("email").value;
// $.post("/Checkemails/checkemail", {email: email}, function(data) {
// data = jQuery.parseJSON(data);
// if(data['chk'] == 'false'){
// alert("อีเมลล์นี้มีในระบบแล้ว");
// return false;
// }
// });
var master_country_id = document.getElementById("master_country_id").value;
if (master_country_id == null || master_country_id == "") {
alert(<?php echo __('Please specify country') ?>);
return false;
}
var master_province_id = document.getElementById("master_province_id").value;
if (master_province_id == null || master_province_id == "") {
alert(<?php echo __('Please specify province') ?>);
return false;
}
$("body").delegate(".is_active", "click", function () {
$('.is_active').not(this).prop('checked', false);
return true;
});
}
</script> </script>
<style> <style>
...@@ -458,17 +507,214 @@ ...@@ -458,17 +507,214 @@
.form-control-reg{ .form-control-reg{
height : 50px; height : 50px;
} }
.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;
}
.box-arrow.left {
padding-right: 0px;
text-align: right;
}
.box-arrow.right {
padding-left: 0px;
}
.box-ads {
width: 1%;
display: table;
margin: auto;
padding: 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 {
-webkit-transform: rotate(270deg);
-moz-transform: rotate(270deg);
-o-transform: rotate(270deg);
writing-mode: rl-tb;
position: absolute;
font-size: 30px;
display:block;
z-index:3999;
}
</style> </style>
<script> <?php $this->append('scriptBottom'); ?>
<script type="text/javascript">
var ALERT_TITLE = ""; var ALERT_TITLE = "";
var ALERT_BUTTON_TEXT = "Ok"; var ALERT_BUTTON_TEXT = "Ok";
$(document).ready(function() {
$("#email").on('change',function(){
var userId = document.getElementById("userId").value;
var email = document.getElementById("email").value;
$.post("/Checkemails/checkemail", {email: email,userId: userId}, function(data) {
// console.log(data);
data = jQuery.parseJSON(data);
if(data['chk'] == 'false'){
alert("<?php echo __('This email is already in the system.'); ?>");
return false;
}
});
});
$("#moblieNo").on('change',function(){
var elem = document.getElementById('moblieNo').value;
// console.log(elem);
if(!elem.match(/^([A-Za-zก-๙])+$/i)){
alert("<?php echo __('only numbers'); ?>");
return false;
}
});
//==================================================
// CHANGE Province According Country
//==================================================
$("#master_country_id").on('change', function () {
var id = $(this).val();
if (id) {
var dataString = 'id=' + id;
$.ajax({
type: "POST",
url: '/provinces/getProvince',
data: dataString,
cache: false,
success: function (html) {
$("#master_province_id").html(html);
}
});
}
});
});
$('.owl-carousel').owlCarousel({
loop: false,
items: 1,
rewindNav: false,
startPosition: 'URLHash',
});
owl = $('.owl-carousel').owlCarousel();
$(".prev").click(function () {
owl.trigger('prev.owl.carousel');
});
$(".next").click(function () {
owl.trigger('next.owl.carousel');
});
function validateForm() {
var firstname_th = document.getElementById("firstname_th").value;
if (firstname_th == null || firstname_th == "") {
alert("<?php echo __('Please enter your firstname.'); ?>");
return false;
}
var lastname_th = document.getElementById("lastname_th").value;
if (lastname_th == null || lastname_th == "") {
alert("<?php echo __('Please enter your lastname.'); ?>");
return false;
}
var birthdate = document.getElementById("datepicker").value;
if (birthdate == null || birthdate == "") {
alert("<?php echo __('Please enter your birthdate.'); ?>");
return false;
}
var moblieNo = document.getElementById("moblieNo").value;
if (moblieNo == null || moblieNo == "") {
alert("<?php echo __('Please enter your mobile.'); ?>");
return false;
}
if(document.getElementById("moblieNo").value.length != 10)
{
alert("<?php echo __('Please enter a 10 digit mobile number.'); ?>");
return false;
}
var email = document.getElementById("email").value;
if (email == null || email == "") {
alert("<?php echo __('Please enter your email address.'); ?>");
return false;
}
var email = $("#email").val();
if (/(.+)@(.+){2,}\.(.+){2,}/.test(email)) { } else {
alert("<?php echo __('Email address format wrong, Please enter the correct number.'); ?>");
return false;
}
var master_country_id = document.getElementById("master_country_id").value;
if (master_country_id == null || master_country_id == "") {
alert("<?php echo __('Please specify country') ?>");
return false;
}
var master_province_id = document.getElementById("master_province_id").value;
if (master_province_id == null || master_province_id == "") {
alert("<?php echo __('Please specify province') ?>");
return false;
}
$("body").delegate(".is_active", "click", function () {
$('.is_active').not(this).prop('checked', false);
return true;
});
}
$(function () {
//==================================================
// CHANGE Date Times
//==================================================
$('#datepicker').datepicker({
format: 'dd/mm/yyyy'
});
});
if (document.getElementById) { if (document.getElementById) {
window.alert = function (txt) { window.alert = function (txt) {
createCustomAlert(txt); createCustomAlert(txt);
} }
} }
function createCustomAlert(txt) { function createCustomAlert(txt) {
d = document; d = document;
...@@ -510,78 +756,7 @@ ...@@ -510,78 +756,7 @@
function removeCustomAlert() { function removeCustomAlert() {
document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer")); document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer"));
} }
function ful() {
alert('Alert this pages');
}
</script>
<?php $this->append('scriptBottom'); ?>
<script type="text/javascript">
$(function () {
//==================================================
// CHANGE Date Times
//==================================================
$('#datepicker').datepicker({
format: 'dd/mm/yyyy'
});
});
//==================================================
// CHANGE Province According Country
//==================================================
$(document).ready(function () {
$("#master_country_id").on('change', function () {
var id = $(this).val();
if (id) {
var dataString = 'id=' + id;
$.ajax({
type: "POST",
url: '/provinces/getProvince',
data: dataString,
cache: false,
success: function (html) {
$("#master_province_id").html(html);
}
});
}
});
});
</script> </script>
<?php $this->end();?> <?php $this->end();?>
<style>
.box-arrow{
font-size:36px;
height: 200px;
padding-top:20%;
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;
}
</style>
\ 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