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
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.iemr.aam-inventory-ui</groupId>
<artifactId>aam-inventory-ui</artifactId>
<version>3.4.0</version>
<version>3.4.1</version>
<name>AAM-Inventory-UI</name>
<description>Piramal - inventory: Module ui</description>
<packaging>war</packaging>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@
'adjustmentReceipt',
'adjustmentIssue',
'closingStock',
'itemEnteredDate'
];
const array = this.consumptionList.filter(function (obj: any) {
for (const key in obj) {
Expand Down Expand Up @@ -234,8 +235,7 @@
finalCellName = newcellPosition + cellPosition + '1';
console.log(finalCellName);
}
const newName = this.modifyHeader(headers, i);
// delete report_worksheet[finalCellName].w; report_worksheet[finalCellName].v = newName;

i++;
if (i === 91 + count * 26) {
// i = 65;
Expand All @@ -247,8 +247,9 @@
const workbook = new ExcelJS.Workbook();
const criteria_worksheet = workbook.addWorksheet('Criteria');
const report_worksheet = workbook.addWorksheet('Report');
const prettyHeaders = headers.map(h => this.modifyHeader(h));

report_worksheet.addRow(headers);
report_worksheet.addRow(prettyHeaders);
criteria_worksheet.addRow(this.criteriaHead);

// Add data
Expand Down Expand Up @@ -298,14 +299,9 @@
}
}

modifyHeader(headers: any, i: any) {
let modifiedHeader: string;
modifiedHeader = headers[i - 65]
.toString()
.replace(/([A-Z])/g, ' $1')
.trim();
modifiedHeader =
modifiedHeader.charAt(0).toUpperCase() + modifiedHeader.substr(1);
modifyHeader(header: string): string {
let modifiedHeader = header.replace(/([A-Z])/g, ' $1').trim();

Check warning on line 303 in src/app/app-modules/inventory/reports/daily-stock-details-report/daily-stock-details-report.component.ts

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Prefer `String#replaceAll()` over `String#replace()`.

See more on https://sonarcloud.io/project/issues?id=PSMRI_HWC-Inventory-UI-NEXT&issues=AZrjSWF8omZkk9IEQf-_&open=AZrjSWF8omZkk9IEQf-_&pullRequest=106
modifiedHeader = modifiedHeader.charAt(0).toUpperCase() + modifiedHeader.substr(1);

Check warning on line 304 in src/app/app-modules/inventory/reports/daily-stock-details-report/daily-stock-details-report.component.ts

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

The signature '(from: number, length?: number | undefined): string' of 'modifiedHeader.substr' is deprecated.

See more on https://sonarcloud.io/project/issues?id=PSMRI_HWC-Inventory-UI-NEXT&issues=AZrjSWF9omZkk9IEQf_A&open=AZrjSWF9omZkk9IEQf_A&pullRequest=106
return modifiedHeader.replace(/I D/g, 'ID');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,6 @@
finalCellName = newcellPosition + cellPosition + '1';
console.log(finalCellName);
}
const newName = this.modifyHeader(headers, i);
// delete report_worksheet[finalCellName].w; report_worksheet[finalCellName].v = newName;
i++;
if (i === 91 + count * 26) {
// i = 65;
Expand All @@ -244,8 +242,9 @@
const workbook = new ExcelJS.Workbook();
const criteria_worksheet = workbook.addWorksheet('Criteria');
const report_worksheet = workbook.addWorksheet('Report');
const prettyHeaders = headers.map(h => this.modifyHeader(h));

report_worksheet.addRow(headers);
report_worksheet.addRow(prettyHeaders);
criteria_worksheet.addRow(this.criteriaHead);

// Add data
Expand Down Expand Up @@ -297,15 +296,9 @@
}
}

modifyHeader(headers: any, i: any) {
let modifiedHeader: string;
modifiedHeader = headers[i - 65]
.toString()
.replace(/([A-Z])/g, ' $1')
.trim();
modifiedHeader =
modifiedHeader.charAt(0).toUpperCase() + modifiedHeader.substr(1);
//console.log(modifiedHeader);
modifyHeader(header: string): string {
let modifiedHeader = header.replace(/([A-Z])/g, ' $1').trim();

Check warning on line 300 in src/app/app-modules/inventory/reports/daily-stock-summary-report/daily-stock-summary-report.component.ts

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Prefer `String#replaceAll()` over `String#replace()`.

See more on https://sonarcloud.io/project/issues?id=PSMRI_HWC-Inventory-UI-NEXT&issues=AZrjSWC2omZkk9IEQf-7&open=AZrjSWC2omZkk9IEQf-7&pullRequest=106
modifiedHeader = modifiedHeader.charAt(0).toUpperCase() + modifiedHeader.substr(1);

Check warning on line 301 in src/app/app-modules/inventory/reports/daily-stock-summary-report/daily-stock-summary-report.component.ts

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

The signature '(from: number, length?: number | undefined): string' of 'modifiedHeader.substr' is deprecated.

See more on https://sonarcloud.io/project/issues?id=PSMRI_HWC-Inventory-UI-NEXT&issues=AZrjSWC2omZkk9IEQf-8&open=AZrjSWC2omZkk9IEQf-8&pullRequest=106
return modifiedHeader.replace(/I D/g, 'ID');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@
'adjustmentReceipt',
'adjustmentIssue',
'closingStock',
'itemEnteredDate'
];
const array = this.consumptionList.filter(function (obj: any) {
for (const key in obj) {
Expand Down Expand Up @@ -230,8 +231,7 @@
finalCellName = newcellPosition + cellPosition + '1';
console.log(finalCellName);
}
const newName = this.modifyHeader(headers, i);
// delete report_worksheet[finalCellName].w; report_worksheet[finalCellName].v = newName;

i++;
if (i === 91 + count * 26) {
// i = 65;
Expand All @@ -242,8 +242,9 @@
const workbook = new ExcelJS.Workbook();
const criteria_worksheet = workbook.addWorksheet('Criteria');
const report_worksheet = workbook.addWorksheet('Report');
const prettyHeaders = headers.map(h => this.modifyHeader(h));

report_worksheet.addRow(headers);
report_worksheet.addRow(prettyHeaders);
criteria_worksheet.addRow(this.criteriaHead);

// Add data
Expand Down Expand Up @@ -293,15 +294,9 @@
}
}

modifyHeader(headers: any, i: any) {
let modifiedHeader: string;
modifiedHeader = headers[i - 65]
.toString()
.replace(/([A-Z])/g, ' $1')
.trim();
modifiedHeader =
modifiedHeader.charAt(0).toUpperCase() + modifiedHeader.substr(1);

modifyHeader(header: string): string {
let modifiedHeader = header.replace(/([A-Z])/g, ' $1').trim();

Check warning on line 298 in src/app/app-modules/inventory/reports/monthly-report/monthly-report.component.ts

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Prefer `String#replaceAll()` over `String#replace()`.

See more on https://sonarcloud.io/project/issues?id=PSMRI_HWC-Inventory-UI-NEXT&issues=AZrjSWFeomZkk9IEQf-9&open=AZrjSWFeomZkk9IEQf-9&pullRequest=106
modifiedHeader = modifiedHeader.charAt(0).toUpperCase() + modifiedHeader.substr(1);

Check warning on line 299 in src/app/app-modules/inventory/reports/monthly-report/monthly-report.component.ts

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

The signature '(from: number, length?: number | undefined): string' of 'modifiedHeader.substr' is deprecated.

See more on https://sonarcloud.io/project/issues?id=PSMRI_HWC-Inventory-UI-NEXT&issues=AZrjSWFeomZkk9IEQf--&open=AZrjSWFeomZkk9IEQf--&pullRequest=106
return modifiedHeader.replace(/I D/g, 'ID');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import { ConfirmationService } from '../../../core/services/confirmation.service';
import { SetLanguageComponent } from 'src/app/app-modules/core/components/set-language.component';
import { LanguageService } from 'src/app/app-modules/core/services/language.service';
import { SessionStorageService } from 'Common-UI/src/registrar/services/session-storage.service';

@Component({
selector: 'app-short-expiry-report',
Expand All @@ -45,6 +46,7 @@
private inventoryService: InventoryService,
private http_service: LanguageService,
private confirmationService: ConfirmationService,
private sessionstorage: SessionStorageService

Check warning on line 49 in src/app/app-modules/inventory/reports/short-expiry-report/short-expiry-report.component.ts

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Member 'sessionstorage: SessionStorageService' is never reassigned; mark it as `readonly`.

See more on https://sonarcloud.io/project/issues?id=PSMRI_HWC-Inventory-UI-NEXT&issues=AZrjSWG6omZkk9IEQf_D&open=AZrjSWG6omZkk9IEQf_D&pullRequest=106
) {}

today!: Date;
Expand Down Expand Up @@ -82,15 +84,9 @@
startDate.setSeconds(0);
startDate.setMilliseconds(0);

console.log(
'Data form value...',
JSON.stringify(this.shortExpiryForm.value),
);
const reqObjForShortExpiryReport = {};
console.log(
'Data form data',
JSON.stringify(reqObjForShortExpiryReport, null, 4),
);
const reqObjForShortExpiryReport = {
facilityID: this.sessionstorage.getItem('facilityID')
};

this.inventoryService
.getShortExpiryReports(reqObjForShortExpiryReport)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,7 @@
finalCellName = newcellPosition + cellPosition + '1';
console.log(finalCellName);
}
const newName = this.modifyHeader(headers, i);
// delete report_worksheet[finalCellName].w; report_worksheet[finalCellName].v = newName;

i++;
if (i === 91 + count * 26) {
// i = 65;
Expand All @@ -211,8 +210,9 @@
const workbook = new ExcelJS.Workbook();
const criteria_worksheet = workbook.addWorksheet('Criteria');
const report_worksheet = workbook.addWorksheet('Report');
const prettyHeaders = headers.map(h => this.modifyHeader(h));

report_worksheet.addRow(headers);
report_worksheet.addRow(prettyHeaders);
criteria_worksheet.addRow(this.criteriaHead);

// Add data
Expand Down Expand Up @@ -263,15 +263,9 @@
}
}

modifyHeader(headers: any, i: any) {
let modifiedHeader: string;
modifiedHeader = headers[i - 65]
.toString()
.replace(/([A-Z])/g, ' $1')
.trim();
modifiedHeader =
modifiedHeader.charAt(0).toUpperCase() + modifiedHeader.substr(1);

modifyHeader(header: string): string {
let modifiedHeader = header.replace(/([A-Z])/g, ' $1').trim();

Check warning on line 267 in src/app/app-modules/inventory/reports/yearly-report/yearly-report.component.ts

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Prefer `String#replaceAll()` over `String#replace()`.

See more on https://sonarcloud.io/project/issues?id=PSMRI_HWC-Inventory-UI-NEXT&issues=AZrjSWGdomZkk9IEQf_B&open=AZrjSWGdomZkk9IEQf_B&pullRequest=106
modifiedHeader = modifiedHeader.charAt(0).toUpperCase() + modifiedHeader.substr(1);

Check warning on line 268 in src/app/app-modules/inventory/reports/yearly-report/yearly-report.component.ts

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

The signature '(from: number, length?: number | undefined): string' of 'modifiedHeader.substr' is deprecated.

See more on https://sonarcloud.io/project/issues?id=PSMRI_HWC-Inventory-UI-NEXT&issues=AZrjSWGdomZkk9IEQf_C&open=AZrjSWGdomZkk9IEQf_C&pullRequest=106
return modifiedHeader.replace(/I D/g, 'ID');
}

Expand Down
15 changes: 15 additions & 0 deletions src/app/login/login.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,21 @@ export class LoginComponent implements OnInit {
let roleObj;
if (loginDataResponse.previlegeObj[0].roles) {
roleObj = loginDataResponse.previlegeObj[0].roles;
const hasPharmacist = roleObj.some(
(role: any) => role.RoleName === 'Pharmacist',
);

if (!hasPharmacist) {
sessionStorage.clear();

this.router.navigate(['/login']).then(() => {
this.confirmationService.alert(
'Designation is not matched with your roles , Please map the Designation or include more roles',
'error',
);
});
return;
}
if (roleObj.length > 0) {
roleObj.forEach((role: any) => {
role.serviceRoleScreenMappings.forEach((serviceRole: any) => {
Expand Down
Loading