Commit bfaab62b by Teeradone-PIM

teeradone: script

parent c9ff32ad
...@@ -231,7 +231,7 @@ class UserCardsController extends AppController ...@@ -231,7 +231,7 @@ 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 = $this->Auth();
$this->loadModel('UserCards'); $this->loadModel('UserCards');
$UserCards = $this->UserCards->find('all') $UserCards = $this->UserCards->find('all')
->select($this->UserCards) ->select($this->UserCards)
...@@ -301,8 +301,8 @@ class UserCardsController extends AppController ...@@ -301,8 +301,8 @@ class UserCardsController extends AppController
$userCard['date_expiry'] = $TempUserCards['date_expiry']; $userCard['date_expiry'] = $TempUserCards['date_expiry'];
$userCard['signature'] = $TempUserCards['signature']; $userCard['signature'] = $TempUserCards['signature'];
$userCard['is_used'] = $TempUserCards['is_used']; $userCard['is_used'] = $TempUserCards['is_used'];
$userCard['created_by'] = $this->Auth->user('id'); $userCard['created_by'] = 1;
$userCard['user_id'] = $this->Auth->user('id'); $userCard['user_id'] = 1;
// pr($userCard);die; // pr($userCard);die;
if ($this->UserCards->save($userCard)) { if ($this->UserCards->save($userCard)) {
$TempUserCards['is_used'] = 0; $TempUserCards['is_used'] = 0;
......
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
<?php // debug($userProfiles); exit;?> <?php // debug($userProfiles); exit;?>
<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('firstname_th', ['class' => 'form-control-reg border-bottom-from label-text-sub', 'value' => $responseUserPersonal['firstname_th'], 'id' => 'firstname_th', 'type' => 'text', 'label' => __('ชื่อ'), 'placeholder' => 'ชื่อ']); ?> <?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' => __('ชื่อ'), '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' => 'ชื่อ - นามสกุล']); ?> <?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>
...@@ -206,20 +206,20 @@ ...@@ -206,20 +206,20 @@
</div> </div>
<script> <script>
// $(document).ready(function() { $(document).ready(function() {
// $("#fremail").on('change',function(){ $("#email").on('change',function(){
// var email = document.getElementById("fremail"); var userId = document.getElementById("userId").value;
// alert("sssss"); var email = document.getElementById("email").value;
// $.post("/Checkemails/checkemail", {email: 'email'}, function(data) { $.post("/Checkemails/checkemailedit", {email: email,userId: userId}, function(data) {
// if(data == false){ // console.log(data);
// alert("sssss"); data = jQuery.parseJSON(data);
// return false; if(data['chk'] == 'false'){
// } else { alert("อีเมลล์นี้มีในระบบแล้ว");
// return true; return false;
// } }
// }); });
// }); });
// }); });
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 == "") {
...@@ -260,10 +260,14 @@ ...@@ -260,10 +260,14 @@
alert("รูปแบบที่อยู่อีเมลล์ผิด กรุณากรอกให้ถูกต้อง"); alert("รูปแบบที่อยู่อีเมลล์ผิด กรุณากรอกให้ถูกต้อง");
return false; return false;
} }
// if (email=="stratos0231@gmail.com") { } else { // var email = document.getElementById("email").value;
// alert("aaaaaaaaaaaaaaaaaaaa"); // $.post("/Checkemails/checkemail", {email: email}, function(data) {
// return false; // data = jQuery.parseJSON(data);
// } // if(data['chk'] == 'false'){
// alert("อีเมลล์นี้มีในระบบแล้ว");
// 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);
......
...@@ -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 __('ชื่อผู้ใช้งาน');?><em>* </em></label> <label class="label-text-sub"><?php echo __('ชื่อผู้ใช้งาน');?><em>* </em></label>
<input type="text" name="username" id="firstname" 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">
</div> </div>
</div> </div>
...@@ -165,23 +165,21 @@ ...@@ -165,23 +165,21 @@
</div> </div>
<!-- ------------------------------- popup ----------------------------------- --> <!-- ------------------------------- popup ----------------------------------- -->
<script> <script>
// $(document).ready(function() {
// $("#fremail").on('change',function(){ $(document).ready(function() {
// var email = document.getElementById("fremail"); $("#fremail").on('change',function(){
// // alert('email'); var email = document.getElementById("fremail").value;
// $.post("/Checkemails/checkemail", {email: 'email'}, function(data) { $.post("/Checkemails/checkemailregister", {email: email}, function(data) {
// alert('data'); // console.log(data);
// console.log(data); data = jQuery.parseJSON(data);
// if(data == 'false'){ if(data['chk'] == 'false'){
// alert("ddddddd"); alert("อีเมลล์นี้มีในระบบแล้ว");
// return false; return false;
// } else { }
// alert("aaaaaaa"); });
// return true; });
// } });
// });
// });
// });
function validateForm() { function validateForm() {
var firstname = document.getElementById("firstname").value; var firstname = document.getElementById("firstname").value;
if (firstname == null || firstname == "") { if (firstname == null || firstname == "") {
...@@ -203,7 +201,16 @@ ...@@ -203,7 +201,16 @@
alert('กรุณาระบุชื่อผู้ใช้งานอย่างน้อย 5 ตัวอักษร'); alert('กรุณาระบุชื่อผู้ใช้งานอย่างน้อย 5 ตัวอักษร');
return false; return false;
} }
var master_country_id = document.getElementById("master_country_id").value;
if (master_country_id == null || master_country_id == "") {
alert("กรุณาระบุประเทศ");
return false;
}
var master_province_id = document.getElementById("master_province_id").value;
if (master_province_id == null || master_province_id == "") {
alert("กรุณาระบุจังหวัด");
return false;
}
var birthdate = document.getElementById("date").value; var birthdate = document.getElementById("date").value;
...@@ -234,18 +241,17 @@ ...@@ -234,18 +241,17 @@
alert("รูปแบบที่อยู่อีเมลล์ผิด กรุณากรอกให้ถูกต้อง"); alert("รูปแบบที่อยู่อีเมลล์ผิด กรุณากรอกให้ถูกต้อง");
return false; return false;
} }
// var email = document.forms["createAccount"]["email"].value; // var email = document.getElementById("fremail").value;
// $.post("/Checkemails/checkemail", {email: 'email'}, function(data){ // $.post("/Checkemails/checkemailregister", {email: email}, function(data) {
// alert('sadasd'); // data = jQuery.parseJSON(data);
// if(data=='false'){ // if(data['chk'] == 'false'){
// alert("อีเมลล์นี้มีอยู่ในระบบแล้ว"); // alert("อีเมลล์นี้มีในระบบแล้ว");
// return false; // return false;
// } else {
// alert("ssss");
// return true;
// } // }
// } // });
// if (email=="stratos0231@gmail.com") { } else {
// alert(email);
// return false;
// }
......
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