diff --git a/resources/views/form/rapport-pulmocare/1782369496-6603002f-f5ab-4352-86fc-b1b384cc2b60.blade.php b/resources/views/form/rapport-pulmocare/1782369496-6603002f-f5ab-4352-86fc-b1b384cc2b60.blade.php index 08123cd2..c549c7c5 100644 --- a/resources/views/form/rapport-pulmocare/1782369496-6603002f-f5ab-4352-86fc-b1b384cc2b60.blade.php +++ b/resources/views/form/rapport-pulmocare/1782369496-6603002f-f5ab-4352-86fc-b1b384cc2b60.blade.php @@ -266,7 +266,7 @@ }); - $('#field-employee_code, #field-emp_code_previous_employee, #field-l1_managers_emp_code, #field-l2_managers_emp_code').on('input', function () { + $('#field-employee_code_01, #field-emp_code_previous_employee, #field-l1_managers_emp_code, #field-l2_managers_emp_code').on('input', function () { this.value = this.value.replace(/[^0-9]/g, ''); }); @@ -274,7 +274,7 @@ this.value = this.value.replace(/[^a-zA-Z\s]/g, ''); }); - $('#field-email').on('blur', function () { + $('#field-email_01').on('blur', function () { let email = $(this).val().trim(); let emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; @@ -291,13 +291,14 @@ }); $('#field-mobile_number').on('input', function () { - this.value = this.value.replace(/\D/g, '').slice(0, 10); + this.value = this.value.replace(/\D/g, '').slice(0, 10); + + // First digit must be 6,7,8,9 + if (this.value.length > 0 && !/^[6-9]/.test(this.value)) { + this.value = ''; + } +}); - // First digit must be 6,7,8,9 - if (this.value.length > 0 && !/^[6-9]/.test(this.value)) { - this.value = ''; - } - }); $('#field-upload_doctor_list').on('change', function () { let file = this.files[0]; @@ -372,6 +373,20 @@ $('#report-form').on('submit', function(event){ event.preventDefault(); + let mobile = $('#field-mobile_number').val().trim(); + + if (!/^[6-9]\d{9}$/.test(mobile)) { + Swal.fire({ + icon: 'error', + title: 'Invalid Mobile Number', + text: 'Please enter a valid 10-digit mobile number starting with 6, 7, 8, or 9.' + }).then(() => { + $('#field-mobile_number').focus(); + }); + + return false; + } + $("#pageloader").fadeIn(); $.ajax({ type: "POST",