Merged in feature/notification-bawah-umur (pull request #216)

Feature/notification bawah umur
This commit is contained in:
Muhd hafifie
2024-12-23 02:39:15 +00:00
@@ -530,6 +530,34 @@
function newcustomer(){
var id_type = $('#customerIDType').val();
var nokp = $('#noic').val();
const date = nokp.substring(0, 6);
const year = parseInt(date.substring(0, 2), 10);
const month = parseInt(date.substring(2, 4), 10) - 1;
const day = parseInt(date.substring(4, 6), 10);
const cutofYear = 20;
const fullYear = year < cutofYear ? 2000 + year : 1900 + year;
const dateconvert = new Date(fullYear, month, day);
const today = new Date();
const eighteenthBirthday = new Date(dateconvert);
eighteenthBirthday.setFullYear(dateconvert.getFullYear() + 18);
console.log(today,eighteenthBirthday);
if (today < eighteenthBirthday) {
Swal.fire({
icon: 'error',
title: 'Amaran!',
text: 'Pelanggan Ini Dibawah Umur!'
});
event.preventDefault();
return false;
}
if(id_type=='nokp'){
$('#daftar_pelanggan').modal('show');
}else if(id_type=='passport'){
@@ -1225,6 +1253,31 @@
var id_type = $('#customerIDType').val();
var nokp = $('#noic').val();
if(id_type=='nokp'){
const date = nokp.substring(0, 6);
const year = parseInt(date.substring(0, 2), 10);
const month = parseInt(date.substring(2, 4), 10) - 1;
const day = parseInt(date.substring(4, 6), 10);
const cutofYear = 20;
const fullYear = year < cutofYear ? 2000 + year : 1900 + year;
const dateconvert = new Date(fullYear, month, day);
const today = new Date();
const eighteenthBirthday = new Date(dateconvert);
eighteenthBirthday.setFullYear(dateconvert.getFullYear() + 18);
if (today < eighteenthBirthday) {
Swal.fire({
icon: 'error',
title: 'Amaran!',
text: 'Pelanggan Ini Dibawah Umur!'
});
event.preventDefault();
return false;
}
if($.isNumeric(nokp) == false){
if(nokp.substr(-1) != '*')
{