Commit 73b7189a by Wittaya-PIM

Merge branch 'integration' into wittaya

parents 0f8e2c87 1fe14090
...@@ -43,7 +43,7 @@ class ProfilesController extends AppController ...@@ -43,7 +43,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],
'keyField' => 'id', 'keyField' => 'id',
'valueField' => 'province_name_th' 'valueField' => 'province_name_th'
]) ])
......
...@@ -95,8 +95,8 @@ ...@@ -95,8 +95,8 @@
<?php echo $this->Html->script('/js/magnific-popup/jquery.magnific-popup.min'); ?> <?php echo $this->Html->script('/js/magnific-popup/jquery.magnific-popup.min'); ?>
<?php echo $this->Html->script('/js/vide/vide.min'); ?> <?php echo $this->Html->script('/js/vide/vide.min'); ?>
<?php echo $this->Html->script('/js/validate/jQuery.start.min'); ?> <?php echo $this->Html->script('/js/validate/jQuery.start.min'); ?>
<?php echo $this->Html->script('/js/validate/jQuery.validate.addValidate'); ?>
<?php echo $this->Html->script('/js/validate/jQuery.validate.min'); ?> <?php echo $this->Html->script('/js/validate/jQuery.validate.min'); ?>
<?php echo $this->Html->script('/js/validate/jQuery.validate.addValidate'); ?>
<!-- Theme Base, Components and Settings --> <!-- Theme Base, Components and Settings -->
<?php echo $this->Html->script('theme'); ?> <?php echo $this->Html->script('theme'); ?>
<!-- Theme Custom --> <!-- Theme Custom -->
......
...@@ -65,7 +65,14 @@ use Cake\I18n\Time; ...@@ -65,7 +65,14 @@ use Cake\I18n\Time;
<div class="col-xs-12 col-sm-12 col-md-12"> <div class="col-xs-12 col-sm-12 col-md-12">
<?php echo __('firstname');?> <?php echo __('firstname');?>
<em>* </em> <em>* </em>
<?php echo $this->Form->input('UserPersonals.firstname_th', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $responseUserPersonal['firstname_th'], 'id' => 'firstname_th', 'type' => 'text', 'label' => false, 'placeholder' => 'firstname']); ?> <?php echo $this->Form->input('UserPersonals.firstname_th', [
'class' => 'form-control-reg border-bottom-from label-text-sub required letterthai',
'value' => $responseUserPersonal['firstname_th'],
'id' => 'firstname_th',
'type' => 'text', 'label' => false,
'minlength' => '4',
'placeholder' => 'firstname'
]); ?>
<?php // echo $this->Form->input('fullname', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->firstname_th . ' ' . $userProfiles->lastname_th, 'id' => 'fullName', 'type' => 'text', 'label' => __('ชื่อ - นามสกุล'), 'placeholder' => 'ชื่อ - นามสกุล']); ?> <?php // echo $this->Form->input('fullname', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->firstname_th . ' ' . $userProfiles->lastname_th, 'id' => 'fullName', 'type' => 'text', 'label' => __('ชื่อ - นามสกุล'), 'placeholder' => 'ชื่อ - นามสกุล']); ?>
</div> </div>
</div> </div>
...@@ -73,7 +80,14 @@ use Cake\I18n\Time; ...@@ -73,7 +80,14 @@ use Cake\I18n\Time;
<div class="col-xs-12 col-sm-12 col-md-12"> <div class="col-xs-12 col-sm-12 col-md-12">
<?php echo __('lastname');?> <?php echo __('lastname');?>
<em>* </em> <em>* </em>
<?php echo $this->Form->input('UserPersonals.lastname_th', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $responseUserPersonal['lastname_th'], 'id' => 'lastname_th', 'type' => 'text', 'label' => false, 'placeholder' => 'lastname']); ?> <?php echo $this->Form->input('UserPersonals.lastname_th', [
'class' => 'form-control-reg border-bottom-from label-text-sub required letterthai',
'value' => $responseUserPersonal['lastname_th'],
'id' => 'lastname_th',
'type' => 'text', 'label' => false,
'minlength' => '4',
'placeholder' => 'lastname'
]); ?>
<?php // echo $this->Form->input('fullname', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->firstname_th . ' ' . $userProfiles->lastname_th, 'id' => 'fullName', 'type' => 'text', 'label' => __('ชื่อ - นามสกุล'), 'placeholder' => 'ชื่อ - นามสกุล']); ?> <?php // echo $this->Form->input('fullname', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->firstname_th . ' ' . $userProfiles->lastname_th, 'id' => 'fullName', 'type' => 'text', 'label' => __('ชื่อ - นามสกุล'), 'placeholder' => 'ชื่อ - นามสกุล']); ?>
</div> </div>
</div> </div>
...@@ -81,7 +95,15 @@ use Cake\I18n\Time; ...@@ -81,7 +95,15 @@ use Cake\I18n\Time;
<div class="col-xs-12 col-sm-12 col-md-12"> <div class="col-xs-12 col-sm-12 col-md-12">
<?php echo __('birthdate');?> <?php echo __('birthdate');?>
<em>* </em> <em>* </em>
<?php echo $this->Form->input('UserPersonals.birthdate', ['class' => 'form-control-reg border-bottom-from', 'value' => $dateNow, 'id' => 'datepicker', 'type' => 'text', 'label' => false, 'placeholder' => 'DD-MM-YYYY','readonly'=>'readonly']); ?> <?php echo $this->Form->input('UserPersonals.birthdate', [
'class' => 'form-control-reg border-bottom-from required datepicker',
'value' => $dateNow,
'id' => 'datepicker',
'type' => 'text',
'label' => false,
'placeholder' => 'DD-MM-YYYY',
'readonly'=>'readonly'
]); ?>
<span class="glyphicon glyphicon-calendar form-control-feedback datepicker"></span> <span class="glyphicon glyphicon-calendar form-control-feedback datepicker"></span>
</div> </div>
</div> </div>
...@@ -134,7 +156,16 @@ use Cake\I18n\Time; ...@@ -134,7 +156,16 @@ use Cake\I18n\Time;
<div class="col-xs-12 col-sm-12 col-md-12"> <div class="col-xs-12 col-sm-12 col-md-12">
<?php echo __('mobile');?> <?php echo __('mobile');?>
<em>* </em> <em>* </em>
<?php echo $this->Form->input('UserPersonals.moblie_no', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $responseUserPersonal['moblie_no'], 'id' => 'moblieNo', 'type' => 'text', 'label' => false, 'maxlength' => '10', 'placeholder' => 'mobile']); ?> <?php echo $this->Form->input('UserPersonals.moblie_no', [
'class' => 'form-control-reg border-bottom-from label-text-sub required digits',
'value' => $responseUserPersonal['moblie_no'],
'id' => 'moblieNo',
'type' => 'text',
'label' => false,
'maxlength' => '10',
'minlength' => '10',
'placeholder' => 'mobile'
]); ?>
<?php // echo $this->Form->input('moblie_no', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->moblie_no, 'id' => 'moblieNo', 'type' => 'text', 'label' => __('เบอร์โทรศัพท์'), 'placeholder' => '000-000-0000']); ?> <?php // echo $this->Form->input('moblie_no', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->moblie_no, 'id' => 'moblieNo', 'type' => 'text', 'label' => __('เบอร์โทรศัพท์'), 'placeholder' => '000-000-0000']); ?>
</div> </div>
</div> </div>
...@@ -142,15 +173,30 @@ use Cake\I18n\Time; ...@@ -142,15 +173,30 @@ use Cake\I18n\Time;
<div class="col-xs-12 col-sm-12 col-md-12"> <div class="col-xs-12 col-sm-12 col-md-12">
<?php echo __('email');?> <?php echo __('email');?>
<em>* </em> <em>* </em>
<!-- <?php echo $this->Form->input('UserPersonals.email', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $responseUserPersonal['email'], 'id' => 'email', 'label' => false, 'placeholder' => 'mail@xxx.com']); ?> --> <?php echo $this->Form->input('UserPersonals.email', [
'class' => 'form-control-reg border-bottom-from label-text-sub required email emailtext',
'value' => $responseUserPersonal['email'],
'id' => 'email',
'name' => 'email',
'label' => false,
'placeholder' =>
'mail@xxx.com'
]); ?>
<?php // echo $this->Form->input('email', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->email, 'id' => 'email', 'type' => 'email', 'label' => __('Email'), 'placeholder' => 'mail@xxx.com']); ?> <?php // echo $this->Form->input('email', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->email, 'id' => 'email', 'type' => 'email', 'label' => __('Email'), 'placeholder' => 'mail@xxx.com']); ?>
<input type="text" name="email" id="email" value="<?php echo $responseUserPersonal['email'] ?>" placeholder="mail@xxx.com" <!-- <input type="text" name="email" id="email" value="<?php echo $responseUserPersonal['email'] ?>" placeholder="mail@xxx.com"
class="form-control-reg border-bottom-from"> class="form-control-reg border-bottom-from"> -->
</div> </div>
</div> </div>
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<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->input('UserPersonals.address', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $responseUserPersonal['address'], 'id' => 'address', 'type' => 'text', 'label' => __('address'), 'placeholder' => __('112/3 สุขุมวิท 22 ทองหล่อ กทม 10523')]); ?> <?php echo $this->Form->input('UserPersonals.address', [
'class' => 'form-control-reg border-bottom-from label-text-sub',
'value' => $responseUserPersonal['address'],
'id' => 'address',
'type' => 'text',
'label' => __('address'),
'placeholder' => __('112/3 สุขุมวิท 22 ทองหล่อ กทม 10523')
]); ?>
<?php // echo $this->Form->input('address', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->address, 'id' => 'address', 'type' => 'text', 'label' => __('ที่อยู่อาศัย'), 'placeholder' => __('112/3 สุขุมวิท 22 ทองหล่อ กทม 10523')]); ?> <?php // echo $this->Form->input('address', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $userProfiles->address, 'id' => 'address', 'type' => 'text', 'label' => __('ที่อยู่อาศัย'), 'placeholder' => __('112/3 สุขุมวิท 22 ทองหล่อ กทม 10523')]); ?>
</div> </div>
</div> </div>
...@@ -168,7 +214,7 @@ use Cake\I18n\Time; ...@@ -168,7 +214,7 @@ use Cake\I18n\Time;
'value' => $responseUserPersonal['master_country_id'], 'value' => $responseUserPersonal['master_country_id'],
'empty' => '---Select---', 'empty' => '---Select---',
'default' => !empty($responseUserPersonal['master_country_id'])? $responseUserPersonal['master_country_id']:'', 'default' => !empty($responseUserPersonal['master_country_id'])? $responseUserPersonal['master_country_id']:'',
'class' => 'form-control border-bottom-from label-text-sub require', 'class' => 'form-control border-bottom-from label-text-sub require required',
'style' => 'width:100%' 'style' => 'width:100%'
)); ));
?> ?>
...@@ -188,7 +234,7 @@ use Cake\I18n\Time; ...@@ -188,7 +234,7 @@ use Cake\I18n\Time;
'value' => $responseUserPersonal['master_province_id'], 'value' => $responseUserPersonal['master_province_id'],
'empty' => '---Select---', 'empty' => '---Select---',
'default' => !empty($responseUserPersonal['master_province_id'])? $responseUserPersonal['master_province_id']:'', 'default' => !empty($responseUserPersonal['master_province_id'])? $responseUserPersonal['master_province_id']:'',
'class' => 'form-control border-bottom-from label-text-sub require', 'class' => 'form-control border-bottom-from label-text-sub require required',
'style' => 'width:100%' 'style' => 'width:100%'
)); ));
?> ?>
...@@ -609,14 +655,14 @@ use Cake\I18n\Time; ...@@ -609,14 +655,14 @@ use Cake\I18n\Time;
}); });
}); });
$("#moblieNo").on('change',function(){ // $("#moblieNo").on('change',function(){
var elem = document.getElementById('moblieNo').value; // var elem = document.getElementById('moblieNo').value;
// console.log(elem); // // console.log(elem);
if(!elem.match(/^([A-Za-zก-๙])+$/i)){ // if(!elem.match(/^([A-Za-zก-๙])+$/i)){
alert("<?php echo __('only numbers'); ?>"); // alert("<?php echo __('only numbers'); ?>");
return false; // return false;
} // }
}); // });
//================================================== //==================================================
// CHANGE Province According Country // CHANGE Province According Country
...@@ -654,63 +700,63 @@ use Cake\I18n\Time; ...@@ -654,63 +700,63 @@ use Cake\I18n\Time;
owl.trigger('next.owl.carousel'); owl.trigger('next.owl.carousel');
}); });
function validateForm() { // function validateForm() {
var firstname_th = document.getElementById("firstname_th").value; // var firstname_th = document.getElementById("firstname_th").value;
if (firstname_th == null || firstname_th == "") { // if (firstname_th == null || firstname_th == "") {
alert("<?php echo __('Please enter your firstname.'); ?>"); // alert("<?php echo __('Please enter your firstname.'); ?>");
return false; // return false;
} // }
var lastname_th = document.getElementById("lastname_th").value; // var lastname_th = document.getElementById("lastname_th").value;
if (lastname_th == null || lastname_th == "") { // if (lastname_th == null || lastname_th == "") {
alert("<?php echo __('Please enter your lastname.'); ?>"); // alert("<?php echo __('Please enter your lastname.'); ?>");
return false; // return false;
} // }
var birthdate = document.getElementById("datepicker").value; // var birthdate = document.getElementById("datepicker").value;
if (birthdate == null || birthdate == "") { // if (birthdate == null || birthdate == "") {
alert("<?php echo __('Please enter your birthdate.'); ?>"); // alert("<?php echo __('Please enter your birthdate.'); ?>");
return false; // return false;
} // }
var moblieNo = document.getElementById("moblieNo").value; // var moblieNo = document.getElementById("moblieNo").value;
if (moblieNo == null || moblieNo == "") { // if (moblieNo == null || moblieNo == "") {
alert("<?php echo __('Please enter your mobile.'); ?>"); // alert("<?php echo __('Please enter your mobile.'); ?>");
return false; // return false;
} // }
if(document.getElementById("moblieNo").value.length != 10) // if(document.getElementById("moblieNo").value.length != 10)
{ // {
alert("<?php echo __('Please enter a 10 digit mobile number.'); ?>"); // alert("<?php echo __('Please enter a 10 digit mobile number.'); ?>");
return false; // return false;
} // }
var email = document.getElementById("email").value; // var email = document.getElementById("email").value;
if (email == null || email == "") { // if (email == null || email == "") {
alert("<?php echo __('Please enter your email address.'); ?>"); // alert("<?php echo __('Please enter your email address.'); ?>");
return false; // return false;
} // }
var email = $("#email").val(); // var email = $("#email").val();
if (/(.+)@(.+){2,}\.(.+){2,}/.test(email)) { } else { // if (/(.+)@(.+){2,}\.(.+){2,}/.test(email)) { } else {
alert("<?php echo __('Email address format wrong, Please enter the correct number.'); ?>"); // alert("<?php echo __('Email address format wrong, Please enter the correct number.'); ?>");
return false; // return false;
} // }
var master_country_id = document.getElementById("master_country_id").value; // var master_country_id = document.getElementById("master_country_id").value;
if (master_country_id == null || master_country_id == "") { // if (master_country_id == null || master_country_id == "") {
alert("<?php echo __('Please specify country') ?>"); // alert("<?php echo __('Please specify country') ?>");
return false; // return false;
} // }
var master_province_id = document.getElementById("master_province_id").value; // var master_province_id = document.getElementById("master_province_id").value;
if (master_province_id == null || master_province_id == "") { // if (master_province_id == null || master_province_id == "") {
alert("<?php echo __('Please specify province') ?>"); // alert("<?php echo __('Please specify province') ?>");
return false; // return false;
} // }
$("body").delegate(".is_active", "click", function () { // $("body").delegate(".is_active", "click", function () {
$('.is_active').not(this).prop('checked', false); // $('.is_active').not(this).prop('checked', false);
return true; // return true;
}); // });
} // }
$(function () { $(function () {
//================================================== //==================================================
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<div class="col-md-12"> <div class="col-md-12">
<label class="label-text-sub"><?php echo __('Firstname');?><em>* </em></label> <label class="label-text-sub"><?php echo __('Firstname');?><em>* </em></label>
<input type="text" name="firstname" id="firstname" value="" placeholder="FIRSTNAME" class="form-control-reg border-bottom-from"> <input type="text" name="firstname" id="firstname" value="" placeholder="FIRSTNAME" class="form-control-reg border-bottom-from required letterthai">
</div> </div>
</div> </div>
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<div class="col-md-12"> <div class="col-md-12">
<label class="label-text-sub"><?php echo __('Lastname');?><em>* </em></label> <label class="label-text-sub"><?php echo __('Lastname');?><em>* </em></label>
<input type="text" name="lastname" id="lastname" value="" placeholder="LASTNAME" class="form-control-reg border-bottom-from"> <input type="text" name="lastname" id="lastname" value="" placeholder="LASTNAME" class="form-control-reg border-bottom-from required letterthai">
</div> </div>
</div> </div>
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<div class="col-md-12"> <div class="col-md-12">
<label class="label-text-sub"><?php echo __('Username');?><em>* </em></label> <label class="label-text-sub"><?php echo __('Username');?><em>* </em></label>
<input type="text" name="username" id="username" value="" placeholder="USERNAME" class="form-control-reg border-bottom-from"> <input type="text" name="username" id="username" value="" placeholder="USERNAME" class="form-control-reg border-bottom-from required alphanumeric" minlength=4 maxlength=10>
</div> </div>
</div> </div>
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
<div class="form-group has-feedback bootstrap-iso"> <div class="form-group has-feedback bootstrap-iso">
<div class="col-md-12"> <div class="col-md-12">
<label class="label-text-sub"><?php echo __('Birthdate');?></label> <label class="label-text-sub"><?php echo __('Birthdate');?></label>
<input type="text" name="birthdate" id="date" placeholder="กรุณาระบุวันเดือนปีเกิด" value="" placeholder="DD-MM-YYYY" data-date-format="mm/dd/yyyy" class="form-control-reg border-bottom-from" readonly> <input type="text" name="birthdate" id="date" placeholder="กรุณาระบุวันเดือนปีเกิด" value="" placeholder="DD-MM-YYYY" data-date-format="mm/dd/yyyy" class="form-control-reg border-bottom-from required date" readonly>
<span class="glyphicon glyphicon-calendar form-control-feedback"></span> <span class="glyphicon glyphicon-calendar form-control-feedback"></span>
</div> </div>
</div> </div>
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<div class="col-md-12"> <div class="col-md-12">
<label class="label-text-sub"><?php echo __('Phone Number (Mobile)');?><em>* </em></label> <label class="label-text-sub"><?php echo __('Phone Number (Mobile)');?><em>* </em></label>
<input type="text" name="moblie_no" id="moblie_no" onkeypress="check_phone();" value="" maxlength="10" placeholder="000-000-0000" class="mask form-control-reg border-bottom-from"> <input type="text" name="moblie_no" id="moblie_no" onkeypress="check_phone();" value="" placeholder="000-000-0000" class="mask form-control-reg border-bottom-from required digits" minlength=10 maxlength="10">
</div> </div>
</div> </div>
</div> </div>
...@@ -100,7 +100,7 @@ ...@@ -100,7 +100,7 @@
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<div class="col-md-12"> <div class="col-md-12">
<label class="label-text-sub"><?php echo __('Email');?><em>* </em></label> <label class="label-text-sub"><?php echo __('Email');?><em>* </em></label>
<input type="text" name="email" id="fremail" value="" placeholder="mail@xxx.com" class="form-control-reg border-bottom-from"> <input type="text" name="email" id="fremail" value="" placeholder="mail@xxx.com" class="form-control-reg border-bottom-from required email emailtext">
</div> </div>
</div> </div>
...@@ -109,7 +109,7 @@ ...@@ -109,7 +109,7 @@
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<div class="col-md-12"> <div class="col-md-12">
<label class="label-text-sub"><?php echo __('Password');?><em>* </em></label> <label class="label-text-sub"><?php echo __('Password');?><em>* </em></label>
<input data-toggle="password" data-placement="before" type="password" name="password" id="password" value="" placeholder="********" class="form-control input-lg color-button-border border-bottom-from" style="padding:0px 0px !important;"> <input data-toggle="password" data-placement="before" type="password" name="password" id="password" value="" placeholder="********" class="form-control input-lg color-button-border border-bottom-from required alphanumeric" style="padding:0px 0px !important;" minlength=8>
<!--<input type="password" name="data[password]" id="password" value="" placeholder="********" class="form-control-reg border-bottom-from" onkeyup='check();'>--> <!--<input type="password" name="data[password]" id="password" value="" placeholder="********" class="form-control-reg border-bottom-from" onkeyup='check();'>-->
<!--<span class="glyphicon glyphicon-eye-close form-control-feedback"></span>--> <!--<span class="glyphicon glyphicon-eye-close form-control-feedback"></span>-->
</div> </div>
...@@ -119,7 +119,7 @@ ...@@ -119,7 +119,7 @@
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<div class="col-md-12"> <div class="col-md-12">
<label class="label-text-sub"><?php echo __('Confirm password');?><em>* </em></label> <label class="label-text-sub"><?php echo __('Confirm password');?><em>* </em></label>
<input data-toggle="password" data-placement="before" type="password" name="confirm_password" id="confirm_password" value="" placeholder="********" class="form-control input-lg color-button-border border-bottom-from" style="padding:0px 0px !important;"> <input data-toggle="password" data-placement="before" type="password" name="confirm_password" id="confirm_password" value="" placeholder="********" class="form-control input-lg color-button-border border-bottom-from required alphanumeric" style="padding:0px 0px !important;" minlength=8>
<!--<input type="password" id="confirm_password" name="data[confirm_password]" value="" placeholder="********" class="form-control-reg border-bottom-from" onkeyup='check();'>--> <!--<input type="password" id="confirm_password" name="data[confirm_password]" value="" placeholder="********" class="form-control-reg border-bottom-from" onkeyup='check();'>-->
<!--<span class="glyphicon glyphicon-eye-close form-control-feedback" id='message'></span>--> <!--<span class="glyphicon glyphicon-eye-close form-control-feedback" id='message'></span>-->
<span id='message'></span> <span id='message'></span>
...@@ -166,178 +166,13 @@ ...@@ -166,178 +166,13 @@
<!-- ------------------------------- popup ----------------------------------- --> <!-- ------------------------------- popup ----------------------------------- -->
<script> <script>
$(document).ready(function() {
$("#username").on('change',function(){
var elem = document.getElementById('username').value;
// console.log(elem);
if(!elem.match(/^([A-Za-z0-9])+$/i)){
alert("<?php echo __('Please enter only text in English or numbers.');?>");
return false;
}
})
$("#firstname").on('change',function(){
var elem = document.getElementById('firstname').value;
// console.log(elem);
if(!elem.match(/^([A-Za-z0-9ก-๙])+$/i)){
alert("<?php echo __('Please enter text in English, Thai or only.');?>");
return false;
}
})
$("#lastname").on('change',function(){
var elem = document.getElementById('lastname').value;
// console.log(elem);
if(!elem.match(/^([A-Za-z0-9ก-๙])+$/i)){
alert("<?php echo __('Please enter text in English, Thai or only.');?>");
return false;
}
})
$("#password").on('change',function(){
var elem = document.getElementById('password').value;
// console.log(elem);
if(!elem.match(/^([A-Za-z0-9])+$/i)){
alert("<?php echo __('Please enter only text in English or numbers.');?>");
return false;
}
})
$("#confirm_password").on('change',function(){
var elem = document.getElementById('confirm_password').value;
// console.log(elem);
if(!elem.match(/^([A-Za-z0-9])+$/i)){
alert("<?php echo __('Please enter only text in English or numbers.');?>");
return false;
}
})
$("#fremail").on('change',function(){
var email = document.getElementById("fremail").value;
$.post("/Checkemails/checkemail", {email: email}, 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;
}
});
});
});
function check_phone() {
e_k=event.keyCode
// if (((e_k < 48) || (e_k > 57)) && e_k != 46 ) {
if (e_k = 10 && (e_k < 48) || (e_k > 59)) {
event.returnValue = false;
alert("<?php echo __('Please enter the phone number. Only numbers.');?>");
}
}
function check_notnum() {
var letters = /^[A-Za-zก-๙]+$/;
if(letters.test( event.key )==false){
alert("<?php echo __('Please enter the correct Thai or English text.');?>");
return false;
}
}
function checkeng()
{
e_k=event.keyCode
if ((e_k >= 48 && e_k<=57) || (e_k>=97 && e_k<=122) || ((e_k>=65 && e_k<=90))) {
e_k = true;
}else{
e_k = false;
alert("<?php echo __('Please enter only English letters and numbers.');?>");
}
}
function validateForm() { function validateForm() {
var firstname = document.getElementById("firstname").value;
if (firstname == null || firstname == "") {
alert("<?php echo __('Please enter your firstname.');?>");
return false;
}
var lastname = document.getElementById("lastname").value;
if (lastname == null || lastname == "") {
alert("<?php echo __('Please enter your lastname.');?>");
return false;
}
var username = document.getElementById("username").value;
if (username == null || username == "") {
alert("<?php echo __('Please enter your username.');?>");
return false;
}
if(document.getElementById("username").value.length < 4 || document.getElementById("username").value.length > 10)
{
alert("<?php echo __('Please enter a 4-10 character username.');?>");
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;
}
var birthdate = document.getElementById("date").value;
if (birthdate == null || birthdate == "") {
alert("<?php echo __('Please enter the date of your birth.');?>");
return false;
}
var moblie_no = document.getElementById("moblie_no").value;
if (moblie_no == null || moblie_no == "") {
alert("<?php echo __('Please enter your phone number.');?>");
return false;
}
if(document.getElementById("moblie_no").value.length != 10)
{
alert("<?php echo __('Please enter a 10 digit phone number.');?>");
return false;
}
var email = document.getElementById("fremail").value;
if (email == null || email == "") {
alert("<?php echo __('Please enter your email.');?>");
return false;
}
// Validate Email
var email = $("#fremail").val();
if (/(.+)@(.+){2,}\.(.+){2,}/.test(email)) { } else {
alert("<?php echo __('Wrong email address format Please enter the correct number.');?>");
return false;
}
var password = document.getElementById("password").value; var password = document.getElementById("password").value;
if (password == null || password == "") {
alert("<?php echo __('Please enter your password.');?>");
return false;
}
if(document.forms["createAccount"]["password"].value.length < 8)
{
alert("<?php echo __('Please enter at least 8 characters.');?>");
return false;
}
var confirm_password = document.getElementById("confirm_password").value; var confirm_password = document.getElementById("confirm_password").value;
if (confirm_password == null || confirm_password == "") { if(confirm_password = document.getElementById("password").value != document.getElementById("confirm_password").value){
alert("<?php echo __('Please verify your password.');?>"); alert("<?php echo __('Please provide your password.');?>");
return false; return false;
} }
if(confirm_password = document.getElementById("password").value != document.getElementById("confirm_password").value){
alert("<?php echo __('Please provide your password.');?>");
//document.createAccount.confirm_password.focus();
return false;
}
if($("#accept:checked").length==0){ if($("#accept:checked").length==0){
alert("<?php echo __('Please accept the Terms of Use.');?>"); alert("<?php echo __('Please accept the Terms of Use.');?>");
...@@ -347,12 +182,6 @@ ...@@ -347,12 +182,6 @@
$("body").delegate(".is_active", "click", function () { $("body").delegate(".is_active", "click", function () {
$('.is_active').not(this).prop('checked', false); $('.is_active').not(this).prop('checked', false);
return true; return true;
// var id = $(this).closest('td').find('#idAddresses').val();
// var id_card13 = $(this).closest('td').find('#idCard13Addresses').val();
// console.log(id);
// $.post("/Addresses/currentAddress", {id: id, id_card13 : id_card13}, function(data) {
// location.reload();
// });
}); });
} }
...@@ -552,30 +381,6 @@ ...@@ -552,30 +381,6 @@
}); });
</script> </script>
<!--------------------------------- confirm password ------------------------------ -->
<script>
// function check_phone() {
// e_k=event.keyCode
// //if (((e_k < 48) || (e_k > 57)) && e_k != 46 ) {
// if (e_k = 10 && (e_k < 48) || (e_k > 57)) {
// event.returnValue = false;
// alert("ขออภัยหมายเลขโทรศัพท์ ต้องเป็นตัวเลขเท่านั้น");
// }
// }
/*var check = function() {
if (document.getElementById('password').value ==
document.getElementById('confirm_password').value) {
document.getElementById('message').style.color = 'green';
document.getElementById('message').innerHTML = '';
} else {
document.getElementById('message').style.color = 'red';
document.getElementById('message').innerHTML = '';
}
}*/
</script>
<!--------------------------------- date ------------------------------------->
<script> <script>
$(document).ready(function(){ $(document).ready(function(){
var date_input=$('input[id="date"]'); //our date input has the name "date" var date_input=$('input[id="date"]'); //our date input has the name "date"
......
...@@ -26,6 +26,12 @@ ...@@ -26,6 +26,12 @@
| 19. ckquarter-min ,Example 'ckquarter-min' = '2' | 19. ckquarter-min ,Example 'ckquarter-min' = '2'
| ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------
*/ */
jQuery.validator.addMethod("emailtext", function (value, element) {
return this.optional(element) || /^([a-zA-Z0-9@_.])+$/.test(value);
}, "โปรดระบุที่อยู่อีเมล์ที่ถูกต้อง.");
jQuery.validator.addMethod("letterthai", function (value, element) {
return this.optional(element) || /^([a-zA-Zก-๙])+$/.test(value);
}, "เฉพาะตัวอักษรเท่านั้น.");
jQuery.validator.addMethod("letters", function (value, element) { jQuery.validator.addMethod("letters", function (value, element) {
return this.optional(element) || /^[a-zA-Z]+$/i.test(value); return this.optional(element) || /^[a-zA-Z]+$/i.test(value);
}, "เฉพาะตัวอักษรเท่านั้น."); }, "เฉพาะตัวอักษรเท่านั้น.");
......
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