Skip to content
Merged
Show file tree
Hide file tree
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
9 changes: 8 additions & 1 deletion src/app/app-modules/core/services/inventory.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Injectable, Inject } from '@angular/core';
import { environment } from '../../../../environments/environment';
import { ConfirmationService } from '../../core/services/confirmation.service';
import { SessionStorageService } from 'Common-UI/src/registrar/services/session-storage.service';
import { HttpServiceService } from './http-service.service';
@Injectable()
export class InventoryService {
inventoryUrl: any;
Expand All @@ -12,7 +13,12 @@ export class InventoryService {
@Inject(DOCUMENT) private document: any,
readonly sessionstorage: SessionStorageService,
private confirmationService: ConfirmationService,
) {}
private httpServiceService: HttpServiceService,
) {
this.httpServiceService.currentLangugae$.subscribe(
(response) => (this.current_language_set = response),
);
}

moveToInventory(
benID: any,
Expand Down Expand Up @@ -78,6 +84,7 @@ export class InventoryService {
getppID() {
const serviceLineDetailsData: any =
this.sessionstorage.getItem('serviceLineDetails');
if (!serviceLineDetailsData) return undefined;
const serviceLineDetails = JSON.parse(serviceLineDetailsData);
return serviceLineDetails.parkingPlaceID;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
</mat-form-field>

<mat-autocomplete #autoDiagnosis="matAutocomplete" appAutocompleteScroller [threshold]="0.6"
(nearEnd)="onAutoNearEnd(i)" (panelReady)="onPanelReady(i, $event)" autoActiveFirstOption
(nearEnd)="onAutoNearEnd(i)" autoActiveFirstOption
[displayWith]="displayDiagnosis" (optionSelected)="onDiagnosisSelected($event.option.value, i)">
<mat-option *ngFor="let diag of suggestedDiagnosisList[i]" [value]="diag">
{{ diag.term }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ export class GeneralOpdDiagnosisComponent
private readonly PAGE_BASE = 0;
pageSize: number | undefined = undefined;

private readonly BOOTSTRAP_MAX_PAGES = 3; // when first page can't scroll, prefill up to this many extra pages

loadingMore: boolean[] = [];
noMore: boolean[] = [];
wantMore: boolean[] = [];
Expand Down Expand Up @@ -316,12 +314,6 @@ export class GeneralOpdDiagnosisComponent
});
}

onPanelReady(index: number, panelEl: HTMLElement) {
if (panelEl.scrollHeight <= panelEl.clientHeight && !this.noMore[index]) {
this.bootstrapUntilScrollable(index, panelEl);
}
}

onAutoNearEnd(index: number) {
if (!this.loadingMore[index] && !this.noMore[index]) {
this.fetchPage(index, true);
Expand All @@ -330,34 +322,6 @@ export class GeneralOpdDiagnosisComponent
}
}

private bootstrapUntilScrollable(rowIndex: number, panelEl: HTMLElement) {
let fetched = 0;

const tryFill = () => {
const scrollable = panelEl.scrollHeight > panelEl.clientHeight;
if (
scrollable ||
this.noMore[rowIndex] ||
fetched >= this.BOOTSTRAP_MAX_PAGES
)
return;

if (this.loadingMore[rowIndex]) {
requestAnimationFrame(tryFill);
return;
}

fetched++;
this.fetchPage(rowIndex, true);

requestAnimationFrame(tryFill);
};

if (this.lastQueryByIndex[rowIndex]?.length >= 3) {
tryFill();
}
}

private fetchPage(index: number, append = false) {
const term = this.lastQueryByIndex[index];
if (!term) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ <h4>{{ current_language_set?.casesheet?.provisionalDiag }}</h4>
</mat-form-field>

<mat-autocomplete #autoDiagnosis="matAutocomplete" appAutocompleteScroller [threshold]="0.6"
(nearEnd)="onAutoNearEnd(i)" (panelReady)="onPanelReady(i, $event)" autoActiveFirstOption
(nearEnd)="onAutoNearEnd(i)" autoActiveFirstOption
[displayWith]="displayDiagnosis" (optionSelected)="onDiagnosisSelected($event.option.value, i)">
<mat-option *ngFor="let diag of suggestedDiagnosisList[i]" [value]="diag">
{{ diag.term }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ export class NcdCareDiagnosisComponent implements OnInit, DoCheck, OnDestroy {
private readonly PAGE_BASE = 0;
pageSize: number | undefined = undefined;

private readonly BOOTSTRAP_MAX_PAGES = 3; // when first page can't scroll, prefill up to this many extra pages

loadingMore: boolean[] = [];
noMore: boolean[] = [];
wantMore: boolean[] = [];
Expand Down Expand Up @@ -340,12 +338,6 @@ export class NcdCareDiagnosisComponent implements OnInit, DoCheck, OnDestroy {
});
}

onPanelReady(index: number, panelEl: HTMLElement) {
if (panelEl.scrollHeight <= panelEl.clientHeight && !this.noMore[index]) {
this.bootstrapUntilScrollable(index, panelEl);
}
}

onAutoNearEnd(index: number) {
if (!this.loadingMore[index] && !this.noMore[index]) {
this.fetchPage(index, true);
Expand All @@ -354,34 +346,6 @@ export class NcdCareDiagnosisComponent implements OnInit, DoCheck, OnDestroy {
}
}

private bootstrapUntilScrollable(rowIndex: number, panelEl: HTMLElement) {
let fetched = 0;

const tryFill = () => {
const scrollable = panelEl.scrollHeight > panelEl.clientHeight;
if (
scrollable ||
this.noMore[rowIndex] ||
fetched >= this.BOOTSTRAP_MAX_PAGES
)
return;

if (this.loadingMore[rowIndex]) {
requestAnimationFrame(tryFill);
return;
}

fetched++;
this.fetchPage(rowIndex, true);

requestAnimationFrame(tryFill);
};

if (this.lastQueryByIndex[rowIndex]?.length >= 3) {
tryFill();
}
}

private fetchPage(index: number, append = false) {
const term = this.lastQueryByIndex[index];
if (!term) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h4 *ngIf="!enableProvisionalDiag">
</mat-form-field>

<mat-autocomplete #autoDiagnosis="matAutocomplete" appAutocompleteScroller [threshold]="0.6"
(nearEnd)="onAutoNearEnd(i)" (panelReady)="onPanelReady(i, $event)" autoActiveFirstOption
(nearEnd)="onAutoNearEnd(i)" autoActiveFirstOption
[displayWith]="displayDiagnosis" (optionSelected)="onDiagnosisSelected($event.option.value, i)">
<mat-option *ngFor="let diag of suggestedDiagnosisList[i]" [value]="diag">
{{ diag.term }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,6 @@ export class NcdScreeningDiagnosisComponent
private readonly PAGE_BASE = 0;
pageSize: number | undefined = undefined;

private readonly BOOTSTRAP_MAX_PAGES = 3; // when first page can't scroll, prefill up to this many extra pages

loadingMore: boolean[] = [];
noMore: boolean[] = [];
wantMore: boolean[] = [];
Expand Down Expand Up @@ -594,12 +592,6 @@ export class NcdScreeningDiagnosisComponent
});
}

onPanelReady(index: number, panelEl: HTMLElement) {
if (panelEl.scrollHeight <= panelEl.clientHeight && !this.noMore[index]) {
this.bootstrapUntilScrollable(index, panelEl);
}
}

onAutoNearEnd(index: number) {
if (!this.loadingMore[index] && !this.noMore[index]) {
this.fetchPage(index, true);
Expand All @@ -608,34 +600,6 @@ export class NcdScreeningDiagnosisComponent
}
}

private bootstrapUntilScrollable(rowIndex: number, panelEl: HTMLElement) {
let fetched = 0;

const tryFill = () => {
const scrollable = panelEl.scrollHeight > panelEl.clientHeight;
if (
scrollable ||
this.noMore[rowIndex] ||
fetched >= this.BOOTSTRAP_MAX_PAGES
)
return;

if (this.loadingMore[rowIndex]) {
requestAnimationFrame(tryFill);
return;
}

fetched++;
this.fetchPage(rowIndex, true);

requestAnimationFrame(tryFill);
};

if (this.lastQueryByIndex[rowIndex]?.length >= 3) {
tryFill();
}
}

private fetchPage(index: number, append = false) {
const term = this.lastQueryByIndex[index];
if (!term) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ <h4>{{ current_language_set?.casesheet?.provisionalDiag }}</h4>
appAutocompleteScroller
[threshold]="0.6"
(nearEnd)="onAutoNearEnd('provisional', i)"
(panelReady)="onPanelReady('provisional', i, $event)"
[displayWith]="displayDiagnosis"
(optionSelected)="
onDiagnosisSelected('provisional', $event.option.value, i)
Expand Down Expand Up @@ -143,7 +142,6 @@ <h4>{{ current_language_set?.common?.confirmDiagnosis }}</h4>
appAutocompleteScroller
[threshold]="0.6"
(nearEnd)="onAutoNearEnd('confirmatory', i)"
(panelReady)="onPanelReady('confirmatory', i, $event)"
[displayWith]="displayDiagnosis"
(optionSelected)="
onDiagnosisSelected('confirmatory', $event.option.value, i)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,6 @@ export class PncDiagnosisComponent
}

private readonly PAGE_BASE = 0;
private readonly BOOTSTRAP_MAX_PAGES = 3;

state: any = {
provisional: {
Expand Down Expand Up @@ -504,17 +503,6 @@ export class PncDiagnosisComponent
});
}

onPanelReady(
type: 'provisional' | 'confirmatory',
index: number,
panelEl: HTMLElement,
) {
const s = this.state[type];
if (panelEl.scrollHeight <= panelEl.clientHeight && !s.noMore[index]) {
this.bootstrapUntilScrollable(type, index, panelEl);
}
}

onAutoNearEnd(type: 'provisional' | 'confirmatory', index: number) {
const s = this.state[type];
if (!s.loadingMore[index] && !s.noMore[index]) {
Expand All @@ -524,32 +512,6 @@ export class PncDiagnosisComponent
}
}

private bootstrapUntilScrollable(
type: 'provisional' | 'confirmatory',
rowIndex: number,
panelEl: HTMLElement,
) {
const s = this.state[type];
let fetched = 0;
const tryFill = () => {
const scrollable = panelEl.scrollHeight > panelEl.clientHeight;
if (
scrollable ||
s.noMore[rowIndex] ||
fetched >= this.BOOTSTRAP_MAX_PAGES
)
return;
if (s.loadingMore[rowIndex]) {
requestAnimationFrame(tryFill);
return;
}
fetched++;
this.fetchPage(type, rowIndex, true);
requestAnimationFrame(tryFill);
};
if (s.lastQueryByIndex[rowIndex]?.length >= 3) tryFill();
}

private fetchPage(
type: 'provisional' | 'confirmatory',
index: number,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,6 @@ <h4>
appAutocompleteScroller
[threshold]="0.6"
(nearEnd)="onAutoNearEnd(i)"
(panelReady)="onPanelReady(i, $event)"
autoActiveFirstOption
[displayWith]="displayDiagnosis"
(optionSelected)="
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,6 @@ export class QuickConsultComponent
suggestedDiagnosisList: any = [];
private readonly PAGE_BASE = 0;

private readonly BOOTSTRAP_MAX_PAGES = 3; // when first page can't scroll, prefill up to this many extra pages

loadingMore: boolean[] = [];
noMore: boolean[] = [];
wantMore: boolean[] = [];
Expand Down Expand Up @@ -1406,12 +1404,6 @@ export class QuickConsultComponent
});
}

onPanelReady(index: number, panelEl: HTMLElement) {
if (panelEl.scrollHeight <= panelEl.clientHeight && !this.noMore[index]) {
this.bootstrapUntilScrollable(index, panelEl);
}
}

onAutoNearEnd(index: number) {
if (!this.loadingMore[index] && !this.noMore[index]) {
this.fetchPage(index, true);
Expand All @@ -1420,34 +1412,6 @@ export class QuickConsultComponent
}
}

private bootstrapUntilScrollable(rowIndex: number, panelEl: HTMLElement) {
let fetched = 0;

const tryFill = () => {
const scrollable = panelEl.scrollHeight > panelEl.clientHeight;
if (
scrollable ||
this.noMore[rowIndex] ||
fetched >= this.BOOTSTRAP_MAX_PAGES
)
return;

if (this.loadingMore[rowIndex]) {
requestAnimationFrame(tryFill);
return;
}

fetched++;
this.fetchPage(rowIndex, true);

requestAnimationFrame(tryFill);
};

if (this.lastQueryByIndex[rowIndex]?.length >= 3) {
tryFill();
}
}

private fetchPage(index: number, append = false) {
const term = this.lastQueryByIndex[index];
if (!term) return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ export class WorklistComponent implements OnInit, OnDestroy, DoCheck {
beneficiary.visitCode,
beneficiary.benFlowID,
beneficiary.beneficiaryRegID,
sessionStorage.getItem('setLanguage') !== undefined
sessionStorage.getItem('setLanguage') !== null
? sessionStorage.getItem('setLanguage')
: 'English',
this.healthIDValue,
Expand Down
Loading