fix(patient): hide ABHA Create/Verify tab when patient already has an ABHA profile
This commit is contained in:
parent
734b9a2bc4
commit
140c4908ee
|
|
@ -17,8 +17,9 @@ if ($patientAbhaAddress === '' && preg_match('/abha_address\s*:\s*([A-Za-z0-9._-
|
|||
}
|
||||
$abhaVerifiedStatus = strtoupper(trim((string) ($patient->abha_verified_status ?? '')));
|
||||
$abhaKycVerified = (int) ($patient->abha_kyc_verified ?? 0) === 1;
|
||||
$abhaMobileVerified = (int) ($patient->abha_mobile_verified ?? 0) === 1;
|
||||
$abhaIsVerified = $abhaVerifiedStatus === 'VERIFIED' || ($abhaKycVerified && $abhaMobileVerified);
|
||||
$abhaIsVerified = in_array($abhaVerifiedStatus, ['VERIFIED', 'ACTIVE', 'LINKED', '1', 'YES', 'Y', 'TRUE'], true)
|
||||
|| strtoupper(trim((string) ($patient->abha_verification_type ?? ''))) === 'VERIFIED'
|
||||
|| ($abhaKycVerified && $abhaMobileVerified);
|
||||
$hasAbhaIdentity = $patientAbhaAddress !== '' || $patientAbhaId !== '' || $abhaIsVerified;
|
||||
$totalOpdVisits = (int) ($totalOpdVisits ?? 0);
|
||||
$lastVisitDateRaw = trim((string) ($lastVisitDate ?? ''));
|
||||
|
|
|
|||
|
|
@ -17,8 +17,10 @@
|
|||
$abhaKycVerified = (int) ($data[0]->abha_kyc_verified ?? 0) === 1;
|
||||
$abhaMobileVerified = (int) ($data[0]->abha_mobile_verified ?? 0) === 1;
|
||||
$abhaLinkedAt = trim((string) ($data[0]->abdm_linked_at ?? ''));
|
||||
$abhaPhotoAvailable = trim((string) ($data[0]->abha_profile_photo_base64 ?? '')) !== '';
|
||||
$abhaVerifiedLocked = $patientAbhaId !== '' && strtoupper($abhaVerifiedStatus) === 'VERIFIED';
|
||||
$isAbhaVerified = in_array(strtoupper($abhaVerifiedStatus), ['VERIFIED', 'ACTIVE', 'LINKED', '1', 'YES', 'Y', 'TRUE'], true)
|
||||
|| strtoupper($abhaVerificationType) === 'VERIFIED'
|
||||
|| ($abhaKycVerified && $abhaMobileVerified);
|
||||
$abhaVerifiedLocked = $patientAbhaId !== '' && $isAbhaVerified;
|
||||
$canEditNameAnytime = is_object($user) && method_exists($user, 'can') ? $user->can('billing.patient.edit-name-anytime') : false;
|
||||
$isAdmin = is_object($user) && method_exists($user, 'inGroup') ? $user->inGroup('admin') : false;
|
||||
$abhaLockNotice = $abhaVerifiedLocked ? 'ABHA verified: name, gender, ABHA ID, and date of birth are locked.' : '';
|
||||
|
|
|
|||
|
|
@ -57,7 +57,11 @@
|
|||
$abhaMobileVerified = (int) ($data[0]->abha_mobile_verified ?? 0) === 1;
|
||||
$abhaLinkedAt = trim((string) ($data[0]->abdm_linked_at ?? ''));
|
||||
$abhaPhotoAvailable = trim((string) ($data[0]->abha_profile_photo_base64 ?? '')) !== '';
|
||||
$isAbhaLinkedAndVerified = $patientAbhaId !== '' && in_array(strtoupper($abhaVerifiedStatus), ['VERIFIED', 'LINKED'], true);
|
||||
$hasExistingAbha = ($patientAbhaId !== '' || $abhaAddress !== '' || $abhaLinkedAt !== '');
|
||||
$isAbhaStatusVerified = in_array(strtoupper($abhaVerifiedStatus), ['VERIFIED', 'LINKED', 'ACTIVE', '1', 'YES', 'Y', 'TRUE'], true)
|
||||
|| strtoupper($abhaVerificationType) === 'VERIFIED'
|
||||
|| ($abhaKycVerified && $abhaMobileVerified);
|
||||
$isAbhaLinkedAndVerified = $hasExistingAbha && ($isAbhaStatusVerified || $abhaLinkedAt !== '');
|
||||
?>
|
||||
<?php
|
||||
$user = auth()->user();
|
||||
|
|
@ -141,7 +145,7 @@
|
|||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" data-bs-toggle="tab" data-bs-target="#profile-insurance" type="button" role="tab">Insurance</button>
|
||||
</li>
|
||||
<?php if (!$isAbhaLinkedAndVerified) : ?>
|
||||
<?php if (!$hasExistingAbha && !$isAbhaLinkedAndVerified) : ?>
|
||||
<li class="nav-item" role="presentation">
|
||||
<button class="nav-link" data-bs-toggle="tab" data-bs-target="#profile-abha" type="button" role="tab">
|
||||
<i class="bi bi-person-check me-1"></i>ABHA Create/Verify
|
||||
|
|
@ -492,7 +496,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (!$isAbhaLinkedAndVerified) : ?>
|
||||
<?php if (!$hasExistingAbha && !$isAbhaLinkedAndVerified) : ?>
|
||||
<div class="tab-pane fade pt-3" id="profile-abha" role="tabpanel">
|
||||
<h5 class="card-title mb-1">ABHA Number Create and Verify</h5>
|
||||
<p class="text-muted small mb-3">Create a new ABHA or link an existing ABHA profile to this patient.</p>
|
||||
|
|
@ -510,7 +514,7 @@
|
|||
</form>
|
||||
</section>
|
||||
|
||||
<?php if (!$isAbhaLinkedAndVerified) : ?>
|
||||
<?php if (!$hasExistingAbha && !$isAbhaLinkedAndVerified) : ?>
|
||||
<?= view('partials/abha_patient_match_modal') ?>
|
||||
<?= view('partials/abha_create_modal') ?>
|
||||
<?php endif; ?>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ $patientId = (int) (($person->id ?? null) ?: ($ipd->p_id ?? 0));
|
|||
$abhaNumber = trim((string) (($person->abha_id ?? '') ?: ($person->abha_no ?? '') ?: ($person->abha ?? '')));
|
||||
$abhaAddress = trim((string) ($person->abha_address ?? ''));
|
||||
$abhaVerifiedRaw = strtolower(trim((string) (($person->abha_verified_status ?? '') ?: ($person->abha_status ?? '') ?: ($person->abha_verified ?? ''))));
|
||||
$abhaLooksVerified = in_array($abhaVerifiedRaw, ['1', 'verified', 'yes', 'y', 'true'], true);
|
||||
$abhaLooksVerified = in_array($abhaVerifiedRaw, ['1', 'verified', 'yes', 'y', 'true', 'active', 'linked'], true);
|
||||
$canUseM3 = $patientId > 0 && $abhaAddress !== '' && $abhaLooksVerified;
|
||||
?>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user