/
home
/
efamember
/
domains
/
efa-member.com
/
public_html
/
main
/
jobs
/
up file
home
<?php require('header.php'); include('../../config/main_function.php'); $secure = "cAh3DrJACzw4RbU"; $connection = connectDB($secure); $member_id = $_SESSION['login_code']; $temp_id = explode(".", $member_id); $member_id = bigsara_decode($temp_id[0], $temp_id[1]); $sql = "SELECT * FROM tbl_member_payment WHERE member_id = '$member_id'"; $res = mysqli_query($connection, $sql); $row = mysqli_fetch_assoc($res); $transfer_date = $row['transfer_date']; $password = 'sd32f43q5we'; $originalMessage = "CXgvsdf542sdfg"; $encryptedMessage = encryptMessage($originalMessage, $password); ?> <div class="main-body animated fadeInRight"> <?php if ($transfer_date == '') { ?> <div class="row mb-3 fade-in"> <div class="col-12"> <div class="card text-center "> <div class="card-header"> <!-- ชำระเงิน --> </div> <div class="card-body"> <h3 class="card-title text-danger">กรุณาเลือกระดับ และชำระเงิน เพื่อทำรายการถัดไป</h3> <!-- <p class="card-text"></p> <a href="member_payment" class="btn btn-primary">ชำระเงิน</a> --> </div> <div class="card-footer text-muted"> </div> </div> </div> </div> <?php } ?> <div class="row"> <div class="col-12"> <ul class="nav nav-tabs" id="myTab" role="tablist"> <li class="nav-item" role="presentation"> <button class="nav-link active" id="profile-tab" data-toggle="tab" data-target="#profile" type="button" role="tab" aria-controls="profile" aria-selected="true">ข้อมูลส่วนตัว</button> </li> <li class="nav-item" role="presentation"> <button class="nav-link" id="work-tab" data-toggle="tab" data-target="#work" type="button" role="tab" aria-controls="work" aria-selected="false">ประวัติการทำงาน</button> </li> <li class="nav-item" role="presentation"> <button class="nav-link" id="application-tab" data-toggle="tab" data-target="#application" type="button" role="tab" aria-controls="application" aria-selected="false">เอกสารประกอบการสมัคร</button> </li> </ul> <div id="Loading"> <div class="spiner-example"> <div class="sk-spinner sk-spinner-cube-grid"> <div class="sk-cube"></div> <div class="sk-cube"></div> <div class="sk-cube"></div> <div class="sk-cube"></div> <div class="sk-cube"></div> <div class="sk-cube"></div> <div class="sk-cube"></div> <div class="sk-cube"></div> <div class="sk-cube"></div> </div> </div> </div> <div class="tab-content" id="myTabContent"> <div class="tab-pane fade show active" id="profile" role="tabpanel" aria-labelledby="profile-tab"> </div> <div class="tab-pane fade" id="work" role="tabpanel" aria-labelledby="work-tab"> </div> <div class="tab-pane fade" id="application" role="tabpanel" aria-labelledby="application-tab"> </div> </div> </div> </div> </div> <div class="modal fade" id="myModal" role="dialog" aria-hidden="true"> <div class="modal-dialog modal-md modal-dialog-centered"> <div class="modal-content animated fadeIn"> <div id="showModal"></div> </div> </div> </div> <?php require('footer.php') ?> <script> $(document).ready(function() { GetProfile() }); // window.addEventListener('beforeunload', function(e) { // e.preventDefault(); // e.returnValue = ''; // }); function GetProfile() { let member_id = localStorage.getItem("member_id"); $("#profile").load("ajax/profile/profile.php", { member_id: member_id }, function() { $(".select2").select2({ width: '100%' }); $("#Loading").hide(); GetMoreInfo() }); $("#work").load("ajax/profile/work.php", { member_id: member_id }); $("#application").load("ajax/profile/application.php", { member_id: member_id }); } $(document).on('click', '#profile-tab', function(event) { e.preventDefault(); let member_id = localStorage.getItem("member_id"); $("#profile").load("ajax/profile/profile.php", { member_id: member_id }, function() { $(".select2").select2({ width: '100%' }); $("#Loading").hide(); GetMoreInfo() }); }); $(document).on('click', '#work-tab', function(event) { e.preventDefault(); let member_id = localStorage.getItem("member_id"); $("#work").load("ajax/profile/work.php", { member_id: member_id }, function() { $("#Loading").hide(); }); }); $(document).on('click', '#application-tab', function(event) { e.preventDefault(); let member_id = localStorage.getItem("member_id"); $("#application").load("ajax/profile/application.php", { member_id: member_id }, function() { $("#Loading").hide(); }); }); function GetModalAddWork() { let member_id = localStorage.getItem("member_id"); $("#myModal").modal("show"); $("#showModal").load("ajax/profile/get_modal_work.php", { member_id: member_id }, function() { $(".select2").select2({ width: '100%' }); }); } function isValidDate(dateStr) { // กำหนดรูปแบบของวันที่ var datePattern = /^(0[1-9]|1[0-2])\/(0[1-9]|[12][0-9]|3[01])\/\d{4}$/; // แยกวันที่, เดือน, ปี var parts = dateStr.split("/"); var day = parseInt(parts[0], 10); var month = parseInt(parts[1], 10); var year = parseInt(parts[2], 10); // ตรวจสอบความถูกต้องของวันที่และเดือน if (month === 0 || month > 12 || day === 0 || day > 31) { return false; } // ตรวจสอบวันที่ที่มีจริงในเดือน var daysInMonth = new Date(year, month, 0).getDate(); if (day > daysInMonth) { return false; } // ผ่านการตรวจสอบทั้งหมด return true; } function checkDate(name) { var data = document.getElementById(name); var dataValue = data.value; let date = new Date().toLocaleDateString(); /// get year var parts = dataValue.split("/"); var year = parseInt(parts[2], 10); // current year var partsn = date.split("/"); var current_year = parseInt(partsn[2], 10); if (name == 'birth_date') { if (year > current_year + 543) { swal({ title: "เกิดข้อผิดพลาด", text: "ปีเกิดมากกว่าปีปัจจุบัน", type: "error", }); $('#' + name).val(""); } } // เช็ค คศ. หรือ พศ. ถ้า input แล้ว if (year + 500 > current_year + 543) { // input เป็น พศ. console.log(year); } else { // input เป็น คศ. console.log(year + 543); } if (!isValidDate(dataValue)) { swal({ title: "เกิดข้อผิดพลาด", text: "กรุณากรอกวันที่ให้ถูกต้อง (รูปแบบ: dd/mm/YYYY)", type: "error", }); $('#' + name).val(""); } } function SubmitProfileForm() { let formData = new FormData($("#frm_profile")[0]); $.ajax({ type: "POST", url: "ajax/profile/add_profile.php", data: formData, cache: false, contentType: false, processData: false, dataType: "json", success: function(data) { if (data.result == 1) { swal({ title: 'บันทึกข้อมูลสำเร็จ', type: 'success', showConfirmButton: false, timer: 1500 }, function() { swal.close(); $("#myModal").modal('hide'); GetProfile(); }); } else if (data.result == 0) { swal({ title: 'แจ้งเตือน', text: data.message, type: 'warning', showConfirmButton: false, timer: 1500 }); } else if (data.result == 9) { swal({ title: 'แจ้งเตือน', text: data.message, type: 'warning', showConfirmButton: false, timer: 1500 }); } }, error: function(jqXHR, exception) { var msg = ''; if (jqXHR.status === 0) { msg = 'Not connect. Verify Network.'; } else if (jqXHR.status == 404) { msg = 'Requested page not found. [404]'; } else if (jqXHR.status == 500) { msg = 'Internal Server Error [500].'; } else if (exception === 'parsererror') { msg = 'Requested JSON parse failed.'; } else if (exception === 'timeout') { msg = 'Time out error.'; } else if (exception === 'abort') { msg = 'Ajax request aborted.'; } else { msg = 'Uncaught Error. ' + jqXHR.responseText; } swal({ title: "แจ้งเตือน", text: "พบปัญหาการบันทึก กรุณาติดต่อผู้ดูแลระบบ" + msg, type: "error", showConfirmButton: true }); } }); } function SubmitWorkForm() { let formData = new FormData($("#frm_work")[0]); $.ajax({ type: "POST", url: "ajax/profile/add_work.php", data: formData, cache: false, contentType: false, processData: false, dataType: "json", success: function(data) { if (data.result == 1) { swal({ title: 'บันทึกข้อมูลสำเร็จ', type: 'success', showConfirmButton: false, timer: 1500 }, function() { swal.close(); $("#myModal").modal('hide'); GetProfile(); }); } else if (data.result == 0) { swal({ title: 'แจ้งเตือน', text: data.message, type: 'warning', showConfirmButton: false, timer: 1500 }); } else if (data.result == 9) { swal({ title: 'แจ้งเตือน', text: data.message, type: 'warning', showConfirmButton: false, timer: 1500 }); } }, error: function(jqXHR, exception) { var msg = ''; if (jqXHR.status === 0) { msg = 'Not connect. Verify Network.'; } else if (jqXHR.status == 404) { msg = 'Requested page not found. [404]'; } else if (jqXHR.status == 500) { msg = 'Internal Server Error [500].'; } else if (exception === 'parsererror') { msg = 'Requested JSON parse failed.'; } else if (exception === 'timeout') { msg = 'Time out error.'; } else if (exception === 'abort') { msg = 'Ajax request aborted.'; } else { msg = 'Uncaught Error. ' + jqXHR.responseText; } swal({ title: "แจ้งเตือน", text: "พบปัญหาการบันทึก กรุณาติดต่อผู้ดูแลระบบ" + msg, type: "error", showConfirmButton: true }); } }); } function ImportFile() { var formData = new FormData($("#import_document")[0]); $.ajax({ type: "POST", url: "ajax/profile/add_application.php", data: formData, cache: false, contentType: false, processData: false, dataType: "json", success: function(data) { if (data.result == 1) { swal({ title: 'บันทึกสำเร็จ', type: 'success', showConfirmButton: false, timer: 1500 }, function() { swal.close(); $("#myModal").modal('hide'); GetProfile(); }); } else if (data.result == 0) { swal({ title: 'แจ้งเตือน', text: data.message, type: 'warning', showConfirmButton: false, timer: 1500 }); } else if (data.result == 9) { swal({ title: 'แจ้งเตือน', text: data.message, type: 'warning', showConfirmButton: false, timer: 1500 }); } }, error: function(jqXHR, exception) { var msg = ''; if (jqXHR.status === 0) { msg = 'Not connect. Verify Network.'; } else if (jqXHR.status == 404) { msg = 'Requested page not found. [404]'; } else if (jqXHR.status == 500) { msg = 'Internal Server Error [500].'; } else if (exception === 'parsererror') { msg = 'Requested JSON parse failed.'; } else if (exception === 'timeout') { msg = 'Time out error.'; } else if (exception === 'abort') { msg = 'Ajax request aborted.'; } else { msg = 'Uncaught Error. ' + jqXHR.responseText; } swal({ title: "แจ้งเตือน", text: "พบปัญหาการบันทึก กรุณาติดต่อผู้ดูแลระบบ" + msg, type: "error", showConfirmButton: true }); } }); } function DeleteApp(document_id) { let encryptedMessage = '<?php echo $encryptedMessage ?>'; swal({ title: 'กรุณายืนยันเพื่อทำรายการ', type: 'warning', showCancelButton: true, confirmButtonColor: '#3085d6', cancelButtonColor: '#d33', cancelButtonText: 'ยกเลิก', confirmButtonText: 'ยืนยัน', closeOnConfirm: false }, function() { $.ajax({ type: "POST", url: "ajax/profile/delete_application.php", data: { document_id: document_id, decryptedMessage: encryptedMessage }, dataType: "json", success: function(data) { if (data.result == 1) { swal({ title: 'ลบข้อมูลเรียบร้อย', type: 'success', showConfirmButton: false, timer: 1500 }, function() { swal.close(); GetProfile(); }); } else if (data.result == 0) { swal({ title: 'แจ้งเตือน', text: data.message, type: 'warning', showConfirmButton: false, timer: 1500 }); } else if (data.result == 9) { swal({ title: 'แจ้งเตือน', text: data.message, type: 'warning', showConfirmButton: false, timer: 1500 }); } }, error: function(jqXHR, exception) { var msg = ''; if (jqXHR.status === 0) { msg = 'Not connect. Verify Network.'; } else if (jqXHR.status == 404) { msg = 'Requested page not found. [404]'; } else if (jqXHR.status == 500) { msg = 'Internal Server Error [500].'; } else if (exception === 'parsererror') { msg = 'Requested JSON parse failed.'; } else if (exception === 'timeout') { msg = 'Time out error.'; } else if (exception === 'abort') { msg = 'Ajax request aborted.'; } else { msg = 'Uncaught Error. ' + jqXHR.responseText; } swal({ title: "แจ้งเตือน", text: "พบปัญหาการบันทึก กรุณาติดต่อผู้ดูแลระบบ" + msg, type: "error", showConfirmButton: true }); } }); }) } function GetMoreInfo() { let member_id = localStorage.getItem("member_id"); let register_type = $("#register_type").val(); let type; switch (register_type) { case '1': type = 'employee' break; case '2': type = 'company' break; case '3': type = 'agency' break; case '4': type = 'worker' break; default: break; } $("#specifics").html(''); $.ajax({ type: "POST", url: "ajax/profile/specifics/specifics_" + type + ".php", data: { member_id: member_id }, dataType: "html", success: function(response) { $("#specifics").html(response); selectZipCode() } }); } function SendProfile() { let member_id = localStorage.getItem('member_id'); let encryptedMessage = '<?php echo $encryptedMessage ?>'; $.ajax({ type: "POST", url: "ajax/profile/send_profile.php", data: { member_id: member_id, decryptedMessage: encryptedMessage }, dataType: "json", success: function(data) { if (data.result == 1) { swal({ title: 'ลงทะเบียนสำเร็จ', type: 'success', showConfirmButton: false, timer: 1500 }, function() { swal.close(); $("#myModal").modal('hide'); window.open('member_payment'); }); } } }); } function selectPostCode() { var postcode = $('#postcode').val(); var checkboxaddress = document.getElementById("checkboxaddress"); $.ajax({ type: "GET", data: { postcode: postcode, nameform: 'card_district_id', namefn: "card" }, dataType: 'json', url: "ajax/profile/getpostcode.php", success: function(response) { if (response.status == 200) { $('#show_district1').html(response.data.district); $('#show_ampoe1').html(response.data.amphoe); $('#show_province1').html(response.data.province); if (checkboxaddress.checked == true) { $('#zipcode').attr('disabled', true); $('#zipcode').val(postcode); $('#show_ampoe2').html($('#show_ampoe1').html()); $('#show_province2').html($('#show_province1').html()); // $('#show_district2').html($('#show_district1').html()); var select = document.getElementById("card_district_id"); var selectedOption = select.options[select.selectedIndex].text; $('#show_district2').html(selectedOption); } } else if (response.status == 500) { swal({ title: "คำเตือน", text: response.message, type: "warning" }); $('#postcode').val(null); $('#show_district1').html(response.data.district); $('#show_ampoe1').html(response.data.amphoe); $('#show_province1').html(response.data.province); if (checkboxaddress.checked == true) { $('#zipcode').val(null); $('#show_ampoe2').html("กรุณากรอกรหัส ปณ."); $('#show_province2').html("กรุณากรอกรหัส ปณ."); $('#show_district2').html("กรุณากรอกรหัส ปณ."); } } } }); } function selectZipCode() { var zipcode = $('#zipcode').val(); $.ajax({ type: "GET", data: { postcode: zipcode, nameform: 'company_district_id', namefn: "company" }, dataType: 'json', url: "ajax/profile/getpostcode.php", success: function(response) { if (response.status == 200) { $('#show_district2').html(response.data.district); $('#show_ampoe2').html(response.data.amphoe); $('#show_province2').html(response.data.province); } else if (response.status == 500) { swal({ title: "คำเตือน", text: response.message, type: "warning" }); $('#zipcode').val(null); $('#show_district2').html(response.data.district); $('#show_ampoe2').html(response.data.amphoe); $('#show_province2').html(response.data.province); } } }); } function selectZipCode2() { var zipcode2 = $('#zipcode2').val(); $.ajax({ type: "GET", data: { postcode: zipcode2, nameform: 'invoice_district_id', namefn: 'invoice' }, dataType: 'json', url: "ajax/profile/getpostcode.php", success: function(response) { if (response.status == 200) { $('#show_district3').html(response.data.district); $('#show_ampoe3').html(response.data.amphoe); $('#show_province3').html(response.data.province); $("#invoice_district").val($('#invoice_district_id').val()); } else if (response.status == 500) { swal({ title: "คำเตือน", text: response.message, type: "warning" }); $('#zipcode2').val(null); $('#show_district3').html(response.data.district); $('#show_ampoe3').html(response.data.amphoe); $('#show_province3').html(response.data.province); } } }); } function card_districtChange() { let card_district_id = $("#card_district_id").val(); $.ajax({ type: "post", url: "ajax/profile/getdistric.php", data: { district_id: card_district_id, }, dataType: "json", success: function(response) { $('#show_ampoe1').html(response.data.amphoe); $('#show_province1').html(response.data.province); } }); } function company_districtChange() { let company_district_id = $("#company_district_id").val(); $.ajax({ type: "post", url: "ajax/profile/getdistric.php", data: { district_id: company_district_id, }, dataType: "json", success: function(response) { $('#show_ampoe2').html(response.data.amphoe); $('#show_province2').html(response.data.province); } }); } function chkNumber(ele) { var vchar = String.fromCharCode(event.keyCode); if ((vchar < '0' || vchar > '9') && (vchar != '.')) return false; ele.onKeyPress = vchar; let citizen_no = $("#citizen_no").val(); if (citizen_no != '') { if (citizen_no.length < 13) { $('#citizen_no_ch').prop('hidden', false); } else { $('#citizen_no_ch').prop('hidden', true); } } let passport_no = $("#passport_no").val(); if (passport_no != '') { if (passport_no.length < 13) { $('#passport_no_ch').attr('hidden', false); } else { $('#passport_no_ch').attr('hidden', true); } } let company_tax_no = $("#company_tax_no").val(); if (company_tax_no != '') { if (company_tax_no.length < 13) { $('#company_tax_ch').attr('hidden', false); } else { $('#company_tax_ch').attr('hidden', true); } } let invoice_tax = $("#invoice_tax").val(); if (invoice_tax != '') { if (invoice_tax.length < 13) { $('#invoice_tax_ch').attr('hidden', false); } else { $('#invoice_tax_ch').attr('hidden', true); } } } function isValidDate(dateStr) { // กำหนดรูปแบบของวันที่ var datePattern = /^(0[1-9]|1[0-2])\/(0[1-9]|[12][0-9]|3[01])\/\d{4}$/; // แยกวันที่, เดือน, ปี var parts = dateStr.split("/"); var day = parseInt(parts[0], 10); var month = parseInt(parts[1], 10); var year = parseInt(parts[2], 10); // ตรวจสอบความถูกต้องของวันที่และเดือน if (month === 0 || month > 12 || day === 0 || day > 31) { return false; } // ตรวจสอบวันที่ที่มีจริงในเดือน var daysInMonth = new Date(year, month, 0).getDate(); if (day > daysInMonth) { return false; } // ผ่านการตรวจสอบทั้งหมด return true; } function checkDate(name) { var data = document.getElementById(name); var dataValue = data.value; let date = new Date().toLocaleDateString(); /// get year var parts = dataValue.split("/"); var year = parseInt(parts[2], 10); // current year var partsn = date.split("/"); var current_year = parseInt(partsn[2], 10); if (name == 'birth_date') { if (year > current_year + 543) { swal({ title: "เกิดข้อผิดพลาด", text: "ปีเกิดมากกว่าปีปัจจุบัน", type: "error", }); $('#' + name).val(""); } } // เช็ค คศ. หรือ พศ. ถ้า input แล้ว if (year + 500 > current_year + 543) { // input เป็น พศ. console.log(year); } else { // input เป็น คศ. console.log(year + 543); } if (!isValidDate(dataValue)) { swal({ title: "เกิดข้อผิดพลาด", text: "กรุณากรอกวันที่ให้ถูกต้อง (รูปแบบ: dd/mm/YYYY)", type: "error", }); $('#' + name).val(""); } } </script>