|
- {{ currentLanguageSet?.inventory?.batchNo }}
+ {{ currentLanguageSet?.inventory?.quantityinHand }}
|
{{ selectedItem?.quantityInHand }}
@@ -130,7 +130,7 @@ {{ currentLanguageSet?.inventory?.itemSelection }}
*matHeaderRowDef="[
'itemCode',
'itemName',
- 'batchNo',
+ 'quantityinHand',
'itemCategory',
'itemForm',
'pharmacologicalCategory',
@@ -145,7 +145,7 @@ {{ currentLanguageSet?.inventory?.itemSelection }}
columns: [
'itemCode',
'itemName',
- 'batchNo',
+ 'quantityinHand',
'itemCategory',
'itemForm',
'pharmacologicalCategory',
diff --git a/src/app/app-modules/core/components/rx-batch-view/rx-batch-view.component.html b/src/app/app-modules/core/components/rx-batch-view/rx-batch-view.component.html
index 30a90ca..ae9eb56 100644
--- a/src/app/app-modules/core/components/rx-batch-view/rx-batch-view.component.html
+++ b/src/app/app-modules/core/components/rx-batch-view/rx-batch-view.component.html
@@ -13,10 +13,9 @@
autocomplete="off"
type="text"
name="prescribed"
- [readonly]="true"
+ [disabled]="true"
matInput
[(ngModel)]="prescribed"
-
/>
@@ -28,11 +27,10 @@
@@ -68,9 +66,7 @@
-
+
{{
currentLanguageSet?.itemDispense?.batchNo
}}
@@ -78,18 +74,14 @@
autocomplete="off"
matInput
defaultNull
- readonly="true"
name="batchNo"
formControlName="batchNo"
-
/>
-
+
{{
currentLanguageSet?.itemDispense?.quantityinHand
}}
@@ -97,16 +89,14 @@
autocomplete="off"
matInput
defaultNull
- readonly="true"
name="quantityInHand"
formControlName="quantityInHand"
-
/>
{{
@@ -117,7 +107,6 @@
matInput
defaultNull
[required]="batch.value.selection"
- [readonly]="editSelection === 1"
name="quantity"
formControlName="quantity"
(blur)="
@@ -127,15 +116,12 @@
-
+
{{
currentLanguageSet?.itemDispense?.expiryDate
}}
diff --git a/src/app/app-modules/core/components/rx-batch-view/rx-batch-view.component.ts b/src/app/app-modules/core/components/rx-batch-view/rx-batch-view.component.ts
index 586957f..32c555c 100644
--- a/src/app/app-modules/core/components/rx-batch-view/rx-batch-view.component.ts
+++ b/src/app/app-modules/core/components/rx-batch-view/rx-batch-view.component.ts
@@ -63,7 +63,7 @@ export class RxBatchViewComponent implements OnInit, DoCheck {
const formArray = this.initBatchListArray(items, this.editSelection);
console.log('this.editSelection', this.editSelection);
this.itemsForm?.addControl('formArray', formArray);
- this.setDispensed(formArray.value);
+ this.setDispensed(formArray.getRawValue());
}
setDispensed(formArray: any, index = -1) {
this.checkQuant(formArray, index);
@@ -111,16 +111,16 @@ export class RxBatchViewComponent implements OnInit, DoCheck {
save() {
const formItems = this.itemsForm.controls['formArray'];
if (!formItems.invalid) {
- console.log('formItems1', formItems.value);
- formItems.value.forEach((item: any) => {
+ console.log('formItems1', formItems.getRawValue());
+ formItems.getRawValue().forEach((item: any) => {
const newExpDate: any = new Date(item.expiryDate);
console.log('newExpDate', newExpDate);
item.expiryDate = newExpDate;
});
- console.log('formItems2', formItems.value);
+ console.log('formItems2', formItems.getRawValue());
this.dialogRef.close({
- selectionBatchList: formItems.value,
- batchList: formItems.value.filter(
+ selectionBatchList: formItems.getRawValue(),
+ batchList: formItems.getRawValue().filter(
(item: any) => item.selection === true,
),
dispensed: this.dispensed > 0 ? this.dispensed : null,
@@ -153,7 +153,7 @@ export class RxBatchViewComponent implements OnInit, DoCheck {
currentGroup.patchValue({
quantity: null,
});
- this.setDispensed(formItems.value, index);
+ this.setDispensed(formItems.getRawValue(), index);
}
}
@@ -165,10 +165,10 @@ export class RxBatchViewComponent implements OnInit, DoCheck {
'MM/dd/yyyy',
);
return this.fb.group({
- expiryDate: formatedExpDate,
- batchNo: batch.batchNo,
- quantity: batch.quantity,
- quantityInHand: batch.qty || batch.quantityInHand,
+ expiryDate: [{ value: formatedExpDate, disabled: true }],
+ batchNo: [{ value: batch.batchNo, disabled: true }],
+ quantity: [{ value: batch.quantity, disabled: selection === 1 ? true : false }],
+ quantityInHand: [{ value: batch.qty || batch.quantityInHand, disabled: true }],
expiresIn: batch.expiresIn,
itemStockEntryID: batch.itemStockEntryID,
selection: batch.selection || selection === 1 ? true : false,
diff --git a/src/app/app-modules/core/components/search/search.component.ts b/src/app/app-modules/core/components/search/search.component.ts
index 78cad09..2a399a7 100644
--- a/src/app/app-modules/core/components/search/search.component.ts
+++ b/src/app/app-modules/core/components/search/search.component.ts
@@ -35,6 +35,7 @@ import { environment } from 'src/environments/environment';
import { MatDialogRef } from '@angular/material/dialog';
import { MatTableDataSource } from '@angular/material/table';
import { MatPaginator } from '@angular/material/paginator';
+import { SessionStorageService } from 'Common-UI/src/registrar/services/session-storage.service';
interface Beneficary {
firstName: string;
@@ -84,6 +85,7 @@ export class SearchComponent implements OnInit, DoCheck {
public http_service: LanguageService,
private changeDetectorRef: ChangeDetectorRef,
private inventoryService: InventoryService,
+ public sessionstorage: SessionStorageService
) {}
ngOnInit() {
@@ -146,7 +148,8 @@ export class SearchComponent implements OnInit, DoCheck {
firstName: this.beneficiary.firstName,
lastName: this.beneficiary.lastName,
genderID: this.beneficiary.gender,
- providerServiceMapID: localStorage.getItem('providerServiceID'),
+ // providerServiceMapID: localStorage.getItem('providerServiceID'),
+ providerServiceMapID: this.sessionstorage.getItem('providerServiceID'),
i_bendemographics: {
stateID: this.beneficiary.stateID,
districtID: this.beneficiary.districtID,
@@ -221,7 +224,8 @@ export class SearchComponent implements OnInit, DoCheck {
if (benID) {
this.inventoryService
.getBeneficaryVisitDetail({
- providerServiceMapID: localStorage.getItem('providerServiceID'),
+ // providerServiceMapID: localStorage.getItem('providerServiceID'),
+ providerServiceMapID: this.sessionstorage.getItem('providerServiceID'),
beneficiaryID: benID,
})
.subscribe((res) => {
diff --git a/src/app/app-modules/core/services/auth.service.ts b/src/app/app-modules/core/services/auth.service.ts
index 42b8655..0472a2c 100644
--- a/src/app/app-modules/core/services/auth.service.ts
+++ b/src/app/app-modules/core/services/auth.service.ts
@@ -38,12 +38,22 @@ export class AuthService {
getAPIVersionAndCommitDetails() {
return this.http.get(environment.apiVersionUrl);
}
- login(userName: string, password: string, doLogout: any) {
- return this.http.post(environment.loginUrl, {
+ login(userName: string, password: string, doLogout: any, captchaToken?:string) {
+ const requestBody: any = {
userName: userName,
password: password,
doLogout: doLogout,
- });
+ withCredentials: true,
+ };
+
+ if (captchaToken) {
+ requestBody.captchaToken = captchaToken;
+ }
+ return this.http.post(environment.loginUrl, requestBody);
+ }
+
+ getUserDetails() {
+ return this.http.post(environment.getSessionExistsURL, {});
}
// /* AN4085822 - Concurrent login issue*/
diff --git a/src/app/app-modules/core/services/batch-search.service.ts b/src/app/app-modules/core/services/batch-search.service.ts
index 25bf298..dfb50d2 100644
--- a/src/app/app-modules/core/services/batch-search.service.ts
+++ b/src/app/app-modules/core/services/batch-search.service.ts
@@ -20,17 +20,23 @@
* along with this program. If not, see https://www.gnu.org/licenses/.
*/
import { HttpClient } from '@angular/common/http';
-import { Injectable } from '@angular/core';
+import { Injectable, Inject } from '@angular/core';
import { environment } from 'src/environments/environment';
+import { SessionStorageService } from 'Common-UI/src/registrar/services/session-storage.service';
@Injectable()
export class BatchSearchService {
- constructor(private http: HttpClient) {}
+ constructor(
+ private http: HttpClient,
+ readonly sessionstorage:SessionStorageService
+ ) {
+
+ }
searchItemBatch(searchTerms: string) {
const body = {
itemName: searchTerms,
- facilityID: localStorage.getItem('facilityID'),
+ facilityID: this.sessionstorage.getItem('facilityID')
};
return this.http.post(environment.searchBatchUrl, body);
@@ -39,7 +45,7 @@ export class BatchSearchService {
searchAdjustmentBatch(searchTerms: string) {
const body = {
itemName: searchTerms,
- facilityID: localStorage.getItem('facilityID'),
+ facilityID: this.sessionstorage.getItem('facilityID'),
};
return this.http.post(environment.searchBatchUrl, body);
@@ -47,7 +53,7 @@ export class BatchSearchService {
searchItem(searchTerm: string) {
const reqObj = {
itemName: searchTerm,
- facilityID: localStorage.getItem('facilityID'),
+ facilityID: this.sessionstorage.getItem('facilityID'),
};
return this.http.post(environment.searchItemListUrl, reqObj);
}
diff --git a/src/app/app-modules/core/services/captcha.service.ts b/src/app/app-modules/core/services/captcha.service.ts
new file mode 100644
index 0000000..c9d67b6
--- /dev/null
+++ b/src/app/app-modules/core/services/captcha.service.ts
@@ -0,0 +1,33 @@
+import { Injectable } from '@angular/core';
+import { environment } from 'src/environments/environment';
+
+@Injectable({
+ providedIn:'root'
+})
+export class CaptchaService {
+ private scriptLoaded = false;
+
+ loadScript(): Promise {
+ return new Promise((resolve, reject) => {
+ if (this.scriptLoaded) return resolve();
+
+ const script = document.createElement('script');
+ script.src = environment.captchaChallengeURL;
+ script.async = true;
+ script.defer = true;
+ script.onload = () => {
+ this.scriptLoaded = true;
+ resolve();
+ };
+ script.onerror = (event) => {
+ this.scriptLoaded = false;
+ reject(
+ new Error(
+ `Failed to load CAPTCHA script from ${environment.captchaChallengeURL}: ${event}`,
+ ),
+ );
+ };
+ document.head.appendChild(script);
+ });
+ }
+}
\ No newline at end of file
diff --git a/src/app/app-modules/core/services/item-search.service.ts b/src/app/app-modules/core/services/item-search.service.ts
index b103e79..9703d3e 100644
--- a/src/app/app-modules/core/services/item-search.service.ts
+++ b/src/app/app-modules/core/services/item-search.service.ts
@@ -20,16 +20,20 @@
* along with this program. If not, see https://www.gnu.org/licenses/.
*/
import { HttpClient } from '@angular/common/http';
-import { Injectable } from '@angular/core';
+import { Injectable, Inject } from '@angular/core';
import { environment } from 'src/environments/environment';
+import { SessionStorageService } from 'Common-UI/src/registrar/services/session-storage.service';
@Injectable()
export class ItemSearchService {
- constructor(private http: HttpClient) {}
+ constructor(
+ private http: HttpClient,
+ public sessionstorage:SessionStorageService) {
+ }
searchDrugItem(searchTerms: string) {
const body = {
itemName: searchTerms,
- facilityID: localStorage.getItem('facilityID'),
+ facilityID: this.sessionstorage.getItem('facilityID'),
};
return this.http.post(environment.searchItemUrl, body);
@@ -38,7 +42,7 @@ export class ItemSearchService {
searchDrugItemforTransfer(search: any, facilityTo: any) {
const body = {
itemName: search,
- transferFromFacilityID: localStorage.getItem('facilityID'),
+ transferFromFacilityID: this.sessionstorage.getItem('facilityID'),
transferToFacilityID: facilityTo,
};
@@ -48,7 +52,7 @@ export class ItemSearchService {
getItemDetailsByName(searchTerms: string) {
const searchedItem = {
itemName: searchTerms,
- facilityID: localStorage.getItem('facilityID'),
+ facilityID: this.sessionstorage.getItem('facilityID'),
};
return this.http.post(
environment.getItemDetailsByNameUrl,
diff --git a/src/app/app-modules/core/services/session-storage.service.spec.ts b/src/app/app-modules/core/services/session-storage.service.spec.ts
new file mode 100644
index 0000000..a710205
--- /dev/null
+++ b/src/app/app-modules/core/services/session-storage.service.spec.ts
@@ -0,0 +1,16 @@
+import { TestBed } from '@angular/core/testing';
+
+import { SessionStorageService } from 'Common-UI/src/registrar/services/session-storage.service';
+
+describe('SessionStorageService', () => {
+ let service: SessionStorageService;
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({});
+ service = TestBed.inject(SessionStorageService);
+ });
+
+ it('should be created', () => {
+ expect(service).toBeTruthy();
+ });
+});
diff --git a/src/app/app-modules/core/services/session-storage.service.ts b/src/app/app-modules/core/services/session-storage.service.ts
new file mode 100644
index 0000000..d4732b9
--- /dev/null
+++ b/src/app/app-modules/core/services/session-storage.service.ts
@@ -0,0 +1,43 @@
+import { Injectable } from '@angular/core';
+import { environment } from "../../../../environments/environment";
+import { StorageService } from 'ng-cryptostore';
+
+@Injectable({
+ providedIn: 'root'
+})
+export class SessionStorageService {
+
+ userID:any;
+ userName:any;
+ username:any;
+ fullName:any;
+ facilityID:any;
+ facilityDetail:any;
+ benFlowID:any;
+ healthID:any;
+ providerServiceID:any;
+ services:any;
+ SECRET_KEY = environment.encKey;
+
+
+ constructor(
+ private store:StorageService
+ ) {}
+
+ setItem(key: string, value: any): void {
+ this.store.set(key, value, this.SECRET_KEY);
+ }
+
+ getItem(key: string): any | null {
+ return this.store.get(key, this.SECRET_KEY);
+ }
+
+ removeItem(key: string): void {
+ sessionStorage.removeItem(key);
+ }
+
+ clear(): void {
+ sessionStorage.clear();
+ }
+
+}
diff --git a/src/app/app-modules/inventory/indent/indent-order-worklist/indent-order-worklist.component.ts b/src/app/app-modules/inventory/indent/indent-order-worklist/indent-order-worklist.component.ts
index d4f08cf..6ad2a53 100644
--- a/src/app/app-modules/inventory/indent/indent-order-worklist/indent-order-worklist.component.ts
+++ b/src/app/app-modules/inventory/indent/indent-order-worklist/indent-order-worklist.component.ts
@@ -23,6 +23,7 @@ import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { ConfirmationService } from 'src/app/app-modules/core/services';
import { InventoryService } from '../../shared/service/inventory.service';
+import { SessionStorageService } from 'Common-UI/src/registrar/services/session-storage.service';
@Component({
selector: 'app-indent-order-worklist',
templateUrl: './indent-order-worklist.component.html',
@@ -36,6 +37,7 @@ export class IndentOrderWorklistComponent implements OnInit {
private router: Router,
private inventoryService: InventoryService,
private confirmationService: ConfirmationService,
+ readonly sessionstorage:SessionStorageService,
) {}
ngOnInit() {
@@ -44,10 +46,10 @@ export class IndentOrderWorklistComponent implements OnInit {
showOrderWorklistBasedOnID() {
this.isMainStore = JSON.parse(
- localStorage.getItem('facilityDetail') || '{}',
+ this.sessionstorage.getItem('facilityDetail') || '{}',
).isMainFacility;
this.mainFacilityID = JSON.parse(
- localStorage.getItem('facilityDetail') || '{}',
+ this.sessionstorage.getItem('facilityDetail') || '{}',
).mainFacilityID;
if (
!this.isMainStore &&
diff --git a/src/app/app-modules/inventory/indent/indent-order-worklist/main-store-indent-order-worklist/indent-dispenses/manual-indent-dispense/manual-indent-dispense.component.ts b/src/app/app-modules/inventory/indent/indent-order-worklist/main-store-indent-order-worklist/indent-dispenses/manual-indent-dispense/manual-indent-dispense.component.ts
index c80dcca..13fd33b 100644
--- a/src/app/app-modules/inventory/indent/indent-order-worklist/main-store-indent-order-worklist/indent-dispenses/manual-indent-dispense/manual-indent-dispense.component.ts
+++ b/src/app/app-modules/inventory/indent/indent-order-worklist/main-store-indent-order-worklist/indent-dispenses/manual-indent-dispense/manual-indent-dispense.component.ts
@@ -32,6 +32,7 @@ import { SetLanguageComponent } from 'src/app/app-modules/core/components/set-la
import { LanguageService } from 'src/app/app-modules/core/services/language.service';
import { MatPaginator } from '@angular/material/paginator';
import { MatTableDataSource } from '@angular/material/table';
+import { SessionStorageService } from 'Common-UI/src/registrar/services/session-storage.service';
@Component({
selector: 'app-manual-indent-dispense',
@@ -79,6 +80,7 @@ export class ManualIndentDispenseComponent implements OnInit, DoCheck {
private inventoryService: InventoryService,
private confirmationService: ConfirmationService,
private activatedRoute: ActivatedRoute,
+ readonly sessionstorage:SessionStorageService
) {}
ngOnInit() {
@@ -125,7 +127,7 @@ export class ManualIndentDispenseComponent implements OnInit, DoCheck {
) {
const batchlistObj = {
itemID: selectedItem.itemID,
- facilityID: localStorage.getItem('facilityID'),
+ facilityID: this.sessionstorage.getItem('facilityID'),
};
this.inventoryService
.viewBatchlistForIndentItem(batchlistObj)
diff --git a/src/app/app-modules/inventory/indent/indent-order-worklist/main-store-indent-order-worklist/main-store-indent-order-worklist.component.ts b/src/app/app-modules/inventory/indent/indent-order-worklist/main-store-indent-order-worklist/main-store-indent-order-worklist.component.ts
index c6c21fc..1a84836 100644
--- a/src/app/app-modules/inventory/indent/indent-order-worklist/main-store-indent-order-worklist/main-store-indent-order-worklist.component.ts
+++ b/src/app/app-modules/inventory/indent/indent-order-worklist/main-store-indent-order-worklist/main-store-indent-order-worklist.component.ts
@@ -30,6 +30,7 @@ import { SetLanguageComponent } from 'src/app/app-modules/core/components/set-la
import { LanguageService } from 'src/app/app-modules/core/services/language.service';
import { MatPaginator, MatPaginatorModule } from '@angular/material/paginator';
import { MatTableDataSource } from '@angular/material/table';
+import { SessionStorageService } from 'Common-UI/src/registrar/services/session-storage.service';
@Component({
selector: 'app-main-store-indent-order-worklist',
@@ -66,11 +67,12 @@ export class MainStoreIndentOrderWorklistComponent implements OnInit, DoCheck {
public http_service: LanguageService,
private confirmationService: ConfirmationService,
private router: Router,
+ readonly sessionstorage:SessionStorageService
) {}
ngOnInit() {
this.orderReqObject = {
- facilityID: localStorage.getItem('facilityID'),
+ facilityID: this.sessionstorage.getItem('facilityID'),
};
this.showMainStoreOrderWorklist(this.orderReqObject);
this.navigateToIndentReceipt();
@@ -125,10 +127,10 @@ export class MainStoreIndentOrderWorklistComponent implements OnInit, DoCheck {
}
navigateToIndentReceipt() {
this.isMainStore = JSON.parse(
- localStorage.getItem('facilityDetail') || '{}',
+ this.sessionstorage.getItem('facilityDetail') || '{}',
).isMainFacility;
this.mainFacilityID = JSON.parse(
- localStorage.getItem('facilityDetail') || '{}',
+ this.sessionstorage.getItem('facilityDetail') || '{}',
).mainFacilityID;
if (this.isMainStore && this.mainFacilityID !== undefined) {
diff --git a/src/app/app-modules/inventory/indent/indent-order-worklist/sub-store-indent-order-worklist/indent-request/indent-request.component.html b/src/app/app-modules/inventory/indent/indent-order-worklist/sub-store-indent-order-worklist/indent-request/indent-request.component.html
index 52549b9..ae055f3 100644
--- a/src/app/app-modules/inventory/indent/indent-order-worklist/sub-store-indent-order-worklist/indent-request/indent-request.component.html
+++ b/src/app/app-modules/inventory/indent/indent-order-worklist/sub-store-indent-order-worklist/indent-request/indent-request.component.html
@@ -29,9 +29,7 @@ {{ currentLanguageSet?.inventory?.indentRequest }}
-
+
{{ currentLanguageSet?.inventory?.referenceNo }}
@@ -45,9 +43,7 @@ {{ currentLanguageSet?.inventory?.indentRequest }}
-
+
{{ currentLanguageSet?.inventory?.reason }}
@@ -270,9 +266,9 @@ {{ currentLanguageSet?.inventory?.indentRequest }}
|