diff --git a/app/Views/billing/Patient_V.php b/app/Views/billing/Patient_V.php index 7d6d3bb..6953549 100644 --- a/app/Views/billing/Patient_V.php +++ b/app/Views/billing/Patient_V.php @@ -44,6 +44,7 @@ +
@@ -757,41 +758,8 @@
- -
-
-

Enter the patient's mobile number linked to ABDM/ABHA. OTP will be sent for verification.

-
-
- - -
-
-
-
- -
-
-
-

Enter the 6-digit OTP sent to the patient's mobile.

-
-
- - -
-
-
-
- - - -
-
-
+ +
@@ -1384,10 +1352,29 @@ if (method === 'number') { $('#abhareg_panel_number').addClass('d-none'); openAbhaAccountVerification('', null); + } else if (method === 'mobile') { + $('#abhareg_panel_mobile').addClass('d-none'); + openAbhaMobileVerification(); } else if (method === 'qr') { openAbhaQrScan(); } if (method === 'facility') { loadFacilityQr(false); } }; + function openAbhaMobileVerification() { + if (!window.AbhaMobileModal) { + alert('ABHA mobile verification modal is unavailable. Reload the page and try again.'); + return; + } + window.AbhaMobileModal.open('', function(profile) { + if (profile && profile.need_confirmation === false && Number(profile.patient_id || 0) > 0) { + showRegResult(profile); + return; + } + window.AbhaPatientMatchModal.open(profile, profile.candidates || [], function(finalResponse) { + showRegResult(finalResponse); + }); + }); + } + function openAbhaQrScan() { if (!window.AbhaQrModal) { regAlert('abhareg_qr_result', 'danger', 'ABHA QR modal is unavailable. Reload the page and try again.'); @@ -1446,9 +1433,6 @@ $('#abhareg_num_stepB,#abhareg_num_stepC').addClass('d-none'); $('#abhareg_num_stepA').removeClass('d-none'); $('#abhareg_goto_stepB').addClass('d-none'); - $('#abhareg_mob_mobile,#abhareg_mob_otp_input').val(''); - $('#abhareg_mob_step2').addClass('d-none'); - $('#abhareg_mob_step1_alert,#abhareg_mob_step2_alert').html(''); }; function loadFacilityQr(force, onReady) { @@ -1679,27 +1663,6 @@ $('#abhareg_num_otp_input').val(''); }); - // Method 4 Send/Verify - $('#abhareg_mob_send_btn').on('click', function() { - sendOtpToMobile($('#abhareg_mob_mobile').val().trim(), 'abhareg_mob_step1_alert', 'abhareg_mob_send_spinner', 'abhareg_mob_send_btn', function(mobile) { - $('#abhareg_mob_step2').removeClass('d-none'); - regAlert('abhareg_mob_step1_alert', 'success', 'OTP sent to mobile ending ' + mobile.slice(-4) + '.'); - $('#abhareg_mob_otp_input').focus(); - }); - }); - $('#abhareg_mob_verify_btn').on('click', function() { - verifyOtpFromMobile($('#abhareg_mob_otp_input').val().trim(), 'abhareg_mob_step2_alert', 'abhareg_mob_verify_spinner', 'abhareg_mob_verify_btn', $('#abhareg_mob_mobile').val().trim()); - }); - $('#abhareg_mob_resend_btn').on('click', function() { - $('#abhareg_mob_step2').addClass('d-none'); - $('#abhareg_mob_otp_input').val(''); - $('#abhareg_mob_send_btn').trigger('click'); - }); - $('#abhareg_mob_back_btn').on('click', function() { - $('#abhareg_mob_step2').addClass('d-none'); - regAlert('abhareg_mob_step2_alert', '', ''); - }); - // --- Method 2: QR Scanner --- $('#abhareg_qr_open_modal_btn').on('click', function() { openAbhaQrScan(); }); $('#abhareg_facility_print_launch_btn').on('click', function() { @@ -1719,9 +1682,6 @@ $('#abhareg_num_otp_input').on('keypress', function(e) { if (e.which === 13) { $('#abhareg_num_verify_otp_btn').trigger('click'); } }); - $('#abhareg_mob_otp_input').on('keypress', function(e) { - if (e.which === 13) { $('#abhareg_mob_verify_btn').trigger('click'); } - }); $('#abhareg_result_profile_btn').on('click', function() { var url = ($(this).attr('data-url') || '').toString().trim(); diff --git a/app/Views/partials/abha_mobile_modal.php b/app/Views/partials/abha_mobile_modal.php new file mode 100644 index 0000000..d637e7c --- /dev/null +++ b/app/Views/partials/abha_mobile_modal.php @@ -0,0 +1,283 @@ + + * Then call: window.AbhaMobileModal.open(function (profile) { ... }); + */ +?> + + + + +