Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ export class MedicineDispenseComponent implements OnInit, OnDestroy, DoCheck {
beneficiaryDetail: any;
beneficiaryVisitDetailList: any;
recentBeneficaryVisit: any;
lastCheckedBeneficiaryId: string | null = null;
checkBeneficiary() {
if (this.beneficiaryDetailForm.controls['beneficiaryID'].value === null) {
this.nullifyBeneficiaryDetails();
Expand All @@ -200,6 +201,14 @@ export class MedicineDispenseComponent implements OnInit, OnDestroy, DoCheck {
if (
this.beneficiaryDetailForm.controls['beneficiaryID'].value.length === 12
) {
const currentId =
this.beneficiaryDetailForm.controls['beneficiaryID'].value;
// (keyup) fires on every keypress even once maxlength holds the value at
// 12 chars, so skip re-querying (and re-alerting) an unchanged id.
if (currentId === this.lastCheckedBeneficiaryId) {
return;
}
this.lastCheckedBeneficiaryId = currentId;
this.inventoryService
.getBeneficaryVisitDetail({
providerServiceMapID:
Expand Down Expand Up @@ -273,6 +282,7 @@ export class MedicineDispenseComponent implements OnInit, OnDestroy, DoCheck {
}
}
nullifyBeneficiaryDetails() {
this.lastCheckedBeneficiaryId = null;
this.beneficiaryDetailForm.patchValue({
medicineDispenseType: null,
visitCode: null,
Expand Down
Loading