+
\ No newline at end of file
diff --git a/src/app/pages/buyer/confirm/confirm.component.scss b/src/app/pages/buyer/confirm/confirm.component.scss
index d56fc8291..44d1eef36 100644
--- a/src/app/pages/buyer/confirm/confirm.component.scss
+++ b/src/app/pages/buyer/confirm/confirm.component.scss
@@ -1,11 +1,14 @@
-app-buyer-confirm {
- input[type=radio] {
- width: 150px;
- height: 50px;
- margin-right: 10px;
- top: 3px;
- }
- // input[type='radio']:checked:after {
- // background-color: #ffa500;
- // }
-}
\ No newline at end of file
+// Task 7271: Code Climate - Complex Logical Expression
+// Not in use will be removed in some time
+
+// app-buyer-confirm {
+// input[type=radio] {
+// width: 150px;
+// height: 50px;
+// margin-right: 10px;
+// top: 3px;
+// }
+// // input[type='radio']:checked:after {
+// // background-color: #ffa500;
+// // }
+// }
\ No newline at end of file
diff --git a/src/app/pages/buyer/confirm/confirm.component.spec.ts b/src/app/pages/buyer/confirm/confirm.component.spec.ts
index a7db52853..141b25c8b 100644
--- a/src/app/pages/buyer/confirm/confirm.component.spec.ts
+++ b/src/app/pages/buyer/confirm/confirm.component.spec.ts
@@ -1,71 +1,74 @@
-import { ComponentFixture, TestBed } from '@angular/core/testing';
-import { ReactiveFormsModule, FormGroup } from '@angular/forms';
-import { ActivatedRoute, Router } from '@angular/router';
-import { Store } from '@ngrx/store';
-import { Observable, of } from 'rxjs';
-import { BuyerConfirmComponent } from './confirm.component';
-import { HttpClientTestingModule } from '@angular/common/http/testing';
-import { TranslateModule } from '@ngx-translate/core';
+// Task 7271: Code Climate - Complex Logical Expression
+// Not in use will be removed in some time
-describe('BuyerConfirmComponent', () => {
- let component: BuyerConfirmComponent;
- let fixture: ComponentFixture
;
- let mockRouter: any;
- let mockStore: any;
+// import { ComponentFixture, TestBed } from '@angular/core/testing';
+// import { ReactiveFormsModule, FormGroup } from '@angular/forms';
+// import { ActivatedRoute, Router } from '@angular/router';
+// import { Store } from '@ngrx/store';
+// import { Observable, of } from 'rxjs';
+// import { BuyerConfirmComponent } from './confirm.component';
+// import { HttpClientTestingModule } from '@angular/common/http/testing';
+// import { TranslateModule } from '@ngx-translate/core';
- beforeEach(async () => {
- mockRouter = jasmine.createSpyObj('Router', ['navigateByUrl']);
- const activatedRouteStub = () => ({
- params: { subscribe: (f: any) => f({ id: '123' }) },
- });
- mockStore = jasmine.createSpyObj('Store', ['dispatch']);
+// describe('BuyerConfirmComponent', () => {
+// let component: BuyerConfirmComponent;
+// let fixture: ComponentFixture;
+// let mockRouter: any;
+// let mockStore: any;
- await TestBed.configureTestingModule({
- imports: [
- ReactiveFormsModule,
- HttpClientTestingModule,
- TranslateModule.forRoot(),
- ],
- declarations: [BuyerConfirmComponent],
- providers: [
- { provide: Router, useValue: mockRouter },
- { provide: ActivatedRoute, useFactory: activatedRouteStub },
- { provide: Store, useValue: mockStore },
- ],
- }).compileComponents();
- });
+// beforeEach(async () => {
+// mockRouter = jasmine.createSpyObj('Router', ['navigateByUrl']);
+// const activatedRouteStub = () => ({
+// params: { subscribe: (f: any) => f({ id: '123' }) },
+// });
+// mockStore = jasmine.createSpyObj('Store', ['dispatch']);
- beforeEach(() => {
- fixture = TestBed.createComponent(BuyerConfirmComponent);
- component = fixture.componentInstance;
- fixture.detectChanges();
- });
+// await TestBed.configureTestingModule({
+// imports: [
+// ReactiveFormsModule,
+// HttpClientTestingModule,
+// TranslateModule.forRoot(),
+// ],
+// declarations: [BuyerConfirmComponent],
+// providers: [
+// { provide: Router, useValue: mockRouter },
+// { provide: ActivatedRoute, useFactory: activatedRouteStub },
+// { provide: Store, useValue: mockStore },
+// ],
+// }).compileComponents();
+// });
- it('should create the component', () => {
- expect(component).toBeTruthy();
- });
+// beforeEach(() => {
+// fixture = TestBed.createComponent(BuyerConfirmComponent);
+// component = fixture.componentInstance;
+// fixture.detectChanges();
+// });
- it('should initialize the form correctly', () => {
- expect(component.userProfileForm).toBeTruthy();
- expect(component.userProfileForm instanceof FormGroup).toBeTrue();
- expect(component.rolesToAdd).toEqual([]);
- expect(component.rolesToDelete).toEqual([]);
- });
+// it('should create the component', () => {
+// expect(component).toBeTruthy();
+// });
- it('should handle the "onChange" method correctly', () => {
- const event = { target: { checked: true } };
- let defaultValue = true;
- const role = { roleId: 1, enabled: true, roleKey: '1', roleName: '1' };
+// it('should initialize the form correctly', () => {
+// expect(component.userProfileForm).toBeTruthy();
+// expect(component.userProfileForm instanceof FormGroup).toBeTrue();
+// expect(component.rolesToAdd).toEqual([]);
+// expect(component.rolesToDelete).toEqual([]);
+// });
- component.onChange(event, defaultValue, role);
+// it('should handle the "onChange" method correctly', () => {
+// const event = { target: { checked: true } };
+// let defaultValue = true;
+// const role = { roleId: 1, enabled: true, roleKey: '1', roleName: '1' };
- expect(component.rolesToDelete).toEqual([]);
+// component.onChange(event, defaultValue, role);
- event.target.checked = false;
- defaultValue = false;
+// expect(component.rolesToDelete).toEqual([]);
- component.onChange(event, defaultValue, role);
+// event.target.checked = false;
+// defaultValue = false;
- expect(component.rolesToAdd).toEqual([]);
- });
-});
+// component.onChange(event, defaultValue, role);
+
+// expect(component.rolesToAdd).toEqual([]);
+// });
+// });
diff --git a/src/app/pages/buyer/confirm/confirm.component.ts b/src/app/pages/buyer/confirm/confirm.component.ts
index be17866fc..c30f2a21b 100644
--- a/src/app/pages/buyer/confirm/confirm.component.ts
+++ b/src/app/pages/buyer/confirm/confirm.component.ts
@@ -1,305 +1,308 @@
-import {
- Component,
- ElementRef,
- OnInit,
- ViewChild,
- ViewEncapsulation,
-} from '@angular/core';
-import { FormBuilder, FormGroup } from '@angular/forms';
-import { Store } from '@ngrx/store';
-import { ActivatedRoute, Router } from '@angular/router';
+// Task 7271: Code Climate - Complex Logical Expression
+// Not in use will be removed in some time
-import { BaseComponent } from 'src/app/components/base/base.component';
-import { slideAnimation } from 'src/app/animations/slide.animation';
-import { UIState } from 'src/app/store/ui.states';
-import { OrganisationService } from 'src/app/services/postgres/organisation.service';
-import { Observable } from 'rxjs';
-import { share } from 'rxjs/operators';
-import { Role } from 'src/app/models/organisationGroup';
-import { WrapperOrganisationGroupService } from 'src/app/services/wrapper/wrapper-org--group-service';
-import { WrapperConfigurationService } from 'src/app/services/wrapper/wrapper-configuration.service';
-import { ScrollHelper } from 'src/app/services/helper/scroll-helper.services';
-import { ViewportScroller } from '@angular/common';
-import { DataLayerService } from 'src/app/shared/data-layer.service';
+// import {
+// Component,
+// ElementRef,
+// OnInit,
+// ViewChild,
+// ViewEncapsulation,
+// } from '@angular/core';
+// import { FormBuilder, FormGroup } from '@angular/forms';
+// import { Store } from '@ngrx/store';
+// import { ActivatedRoute, Router } from '@angular/router';
-@Component({
- selector: 'app-buyer-confirm',
- templateUrl: './confirm.component.html',
- styleUrls: ['./confirm.component.scss'],
- animations: [
- slideAnimation({
- close: { transform: 'translateX(12.5rem)' },
- open: { left: '-12.5rem' },
- }),
- ],
- encapsulation: ViewEncapsulation.None,
-})
-export class BuyerConfirmComponent extends BaseComponent implements OnInit {
- public organisation: any;
- public org$!: Observable;
- public verified: boolean = false;
- private id!: string;
- userProfileForm: FormGroup;
- orgRoles: Role[];
- roles: Role[];
- public orgEligableRoles$!: Observable;
- public orgRoles$!: Observable;
- eRoles: Role[];
- rolesToAdd: Role[];
- rolesToDelete: Role[];
+// import { BaseComponent } from 'src/app/components/base/base.component';
+// import { slideAnimation } from 'src/app/animations/slide.animation';
+// import { UIState } from 'src/app/store/ui.states';
+// import { OrganisationService } from 'src/app/services/postgres/organisation.service';
+// import { Observable } from 'rxjs';
+// import { share } from 'rxjs/operators';
+// import { Role } from 'src/app/models/organisationGroup';
+// import { WrapperOrganisationGroupService } from 'src/app/services/wrapper/wrapper-org--group-service';
+// import { WrapperConfigurationService } from 'src/app/services/wrapper/wrapper-configuration.service';
+// import { ScrollHelper } from 'src/app/services/helper/scroll-helper.services';
+// import { ViewportScroller } from '@angular/common';
+// import { DataLayerService } from 'src/app/shared/data-layer.service';
- @ViewChild('isBuyerTrue') isBuyerTrue!: ElementRef;
- @ViewChild('isBuyerFalse') isBuyerFalse!: ElementRef;
+// @Component({
+// selector: 'app-buyer-confirm',
+// templateUrl: './confirm.component.html',
+// styleUrls: ['./confirm.component.scss'],
+// animations: [
+// slideAnimation({
+// close: { transform: 'translateX(12.5rem)' },
+// open: { left: '-12.5rem' },
+// }),
+// ],
+// encapsulation: ViewEncapsulation.None,
+// })
+// export class BuyerConfirmComponent extends BaseComponent implements OnInit {
+// public organisation: any;
+// public org$!: Observable;
+// public verified: boolean = false;
+// private id!: string;
+// userProfileForm: FormGroup;
+// orgRoles: Role[];
+// roles: Role[];
+// public orgEligableRoles$!: Observable;
+// public orgRoles$!: Observable;
+// eRoles: Role[];
+// rolesToAdd: Role[];
+// rolesToDelete: Role[];
- constructor(
- private formBuilder: FormBuilder,
- private organisationService: OrganisationService,
- private wrapperConfigService: WrapperConfigurationService,
- public router: Router,
- private route: ActivatedRoute,
- protected uiStore: Store,
- private organisationGroupService: WrapperOrganisationGroupService,
- protected viewportScroller: ViewportScroller,
- protected scrollHelper: ScrollHelper,
- private dataLayerService: DataLayerService
- ) {
- super(uiStore, viewportScroller, scrollHelper);
- this.orgRoles = [];
- this.eRoles = [];
- this.roles = [];
- this.userProfileForm = this.formBuilder.group({
- userTitle: ['', null],
- });
- this.rolesToAdd = [];
- this.rolesToDelete = [];
- }
+// @ViewChild('isBuyerTrue') isBuyerTrue!: ElementRef;
+// @ViewChild('isBuyerFalse') isBuyerFalse!: ElementRef;
- ngOnInit() {
- this.route.params.subscribe((params) => {
- if (params.id) {
- this.id = params.id;
- this.org$ = this.organisationService.getById(params.id).pipe(share());
- this.org$.subscribe({
- next: (data) => {
- this.organisation = data;
- this.verified = data.rightToBuy;
- this.getOrgRoles();
- },
- });
- }
- });
- this.dataLayerService.pushPageViewEvent({id: this.id});
- }
+// constructor(
+// private formBuilder: FormBuilder,
+// private organisationService: OrganisationService,
+// private wrapperConfigService: WrapperConfigurationService,
+// public router: Router,
+// private route: ActivatedRoute,
+// protected uiStore: Store,
+// private organisationGroupService: WrapperOrganisationGroupService,
+// protected viewportScroller: ViewportScroller,
+// protected scrollHelper: ScrollHelper,
+// private dataLayerService: DataLayerService
+// ) {
+// super(uiStore, viewportScroller, scrollHelper);
+// this.orgRoles = [];
+// this.eRoles = [];
+// this.roles = [];
+// this.userProfileForm = this.formBuilder.group({
+// userTitle: ['', null],
+// });
+// this.rolesToAdd = [];
+// this.rolesToDelete = [];
+// }
- public onSelect(verified: boolean) {
- this.verified = verified;
- this.rolesToAdd = [];
- this.rolesToDelete = [];
+// ngOnInit() {
+// this.route.params.subscribe((params) => {
+// if (params.id) {
+// this.id = params.id;
+// this.org$ = this.organisationService.getById(params.id).pipe(share());
+// this.org$.subscribe({
+// next: (data) => {
+// this.organisation = data;
+// this.verified = data.rightToBuy;
+// this.getOrgRoles();
+// },
+// });
+// }
+// });
+// this.dataLayerService.pushPageViewEvent({id: this.id});
+// }
- if (verified) {
- this.isBuyerTrue.nativeElement.checked = true;
- this.isBuyerFalse.nativeElement.checked = false;
- } else {
- this.isBuyerTrue.nativeElement.checked = false;
- this.isBuyerFalse.nativeElement.checked = true;
- }
+// public onSelect(verified: boolean) {
+// this.verified = verified;
+// this.rolesToAdd = [];
+// this.rolesToDelete = [];
- if (verified && !this.organisation.rightToBuy) {
- const currentRoles = this.roles.filter(
- (x) =>
- x.enabled &&
- x.subscriptionTypeEligibility === 0 &&
- x.tradeEligibility !== 0 &&
- x.orgTypeEligibility !== 0
- );
- const previousRoles = this.roles.filter(
- (x) =>
- x.enabled &&
- x.subscriptionTypeEligibility === 0 &&
- x.tradeEligibility !== 1 &&
- x.orgTypeEligibility !== 0
- );
- previousRoles.forEach((r) => {
- const match = currentRoles.includes(r);
- if (!match) {
- this.rolesToDelete.push(r);
- }
- });
- currentRoles.forEach((r) => {
- const match = previousRoles.includes(r);
- if (!match) {
- this.rolesToAdd.push(r);
- }
- });
- const currentRoles2 = this.roles.filter(
- (x) =>
- x.enabled &&
- x.subscriptionTypeEligibility === 1 &&
- x.tradeEligibility !== 0 &&
- x.orgTypeEligibility !== 0
- );
- const previousRoles2 = this.roles.filter(
- (x) =>
- x.enabled &&
- x.subscriptionTypeEligibility === 1 &&
- x.tradeEligibility !== 1 &&
- x.orgTypeEligibility !== 0
- );
- previousRoles2.forEach((r) => {
- const match = currentRoles2.includes(r);
- if (!match) {
- this.rolesToDelete.push(r);
- }
- });
- currentRoles2.forEach((r) => {
- const match = previousRoles2.includes(r);
- if (!match) {
- this.rolesToAdd.push(r);
- }
- });
- console.log('to insert:');
- console.log(this.rolesToAdd);
- console.log('to remove:');
- console.log(this.rolesToDelete);
- } else if (!verified && this.organisation.rightToBuy) {
- const currentRoles = this.roles.filter(
- (x) =>
- x.enabled &&
- x.subscriptionTypeEligibility === 0 &&
- x.tradeEligibility !== 1 &&
- x.orgTypeEligibility !== 0
- );
- const previousRoles = this.roles.filter(
- (x) =>
- x.enabled &&
- x.subscriptionTypeEligibility === 0 &&
- x.tradeEligibility !== 0 &&
- x.orgTypeEligibility !== 0
- );
- currentRoles.forEach((r) => {
- const match = previousRoles.includes(r);
- if (!match) {
- this.rolesToAdd.push(r);
- }
- });
- previousRoles.forEach((r) => {
- const match = currentRoles.includes(r);
- if (!match) {
- this.rolesToDelete.push(r);
- }
- });
- const currentRoles2 = this.roles.filter(
- (x) =>
- x.enabled &&
- x.subscriptionTypeEligibility === 1 &&
- x.tradeEligibility !== 1 &&
- x.orgTypeEligibility !== 0
- );
- const previousRoles2 = this.roles.filter(
- (x) =>
- x.enabled &&
- x.subscriptionTypeEligibility === 1 &&
- x.tradeEligibility !== 0 &&
- x.orgTypeEligibility !== 0
- );
- currentRoles2.forEach((r) => {
- const match = previousRoles2.includes(r);
- if (!match) {
- this.rolesToAdd.push(r);
- }
- });
- previousRoles2.forEach((r) => {
- const match = currentRoles2.includes(r);
- if (!match) {
- this.rolesToDelete.push(r);
- }
- });
- console.log('to insert:');
- console.log(this.rolesToAdd);
- console.log('to remove:');
- console.log(this.rolesToDelete);
- }
- }
+// if (verified) {
+// this.isBuyerTrue.nativeElement.checked = true;
+// this.isBuyerFalse.nativeElement.checked = false;
+// } else {
+// this.isBuyerTrue.nativeElement.checked = false;
+// this.isBuyerFalse.nativeElement.checked = true;
+// }
- onChange(event: any, defaultValue: any, role: any) {
- if (defaultValue === true && !event.target.checked) {
- this.rolesToDelete.push(role);
- } else if (defaultValue == true && event.target.checked) {
- const index = this.rolesToDelete.indexOf(role);
- if (index > -1) {
- this.rolesToDelete.splice(index, 1);
- }
- }
- if (defaultValue === false && event.target.checked) {
- this.rolesToAdd.push(role);
- } else if (defaultValue == false && !event.target.checked) {
- const index = this.rolesToAdd.indexOf(role);
- if (index > -1) {
- this.rolesToAdd.splice(index, 1);
- }
- }
- }
+// if (verified && !this.organisation.rightToBuy) {
+// const currentRoles = this.roles.filter(
+// (x) =>
+// x.enabled &&
+// x.subscriptionTypeEligibility === 0 &&
+// x.tradeEligibility !== 0 &&
+// x.orgTypeEligibility !== 0
+// );
+// const previousRoles = this.roles.filter(
+// (x) =>
+// x.enabled &&
+// x.subscriptionTypeEligibility === 0 &&
+// x.tradeEligibility !== 1 &&
+// x.orgTypeEligibility !== 0
+// );
+// previousRoles.forEach((r) => {
+// const match = currentRoles.includes(r);
+// if (!match) {
+// this.rolesToDelete.push(r);
+// }
+// });
+// currentRoles.forEach((r) => {
+// const match = previousRoles.includes(r);
+// if (!match) {
+// this.rolesToAdd.push(r);
+// }
+// });
+// const currentRoles2 = this.roles.filter(
+// (x) =>
+// x.enabled &&
+// x.subscriptionTypeEligibility === 1 &&
+// x.tradeEligibility !== 0 &&
+// x.orgTypeEligibility !== 0
+// );
+// const previousRoles2 = this.roles.filter(
+// (x) =>
+// x.enabled &&
+// x.subscriptionTypeEligibility === 1 &&
+// x.tradeEligibility !== 1 &&
+// x.orgTypeEligibility !== 0
+// );
+// previousRoles2.forEach((r) => {
+// const match = currentRoles2.includes(r);
+// if (!match) {
+// this.rolesToDelete.push(r);
+// }
+// });
+// currentRoles2.forEach((r) => {
+// const match = previousRoles2.includes(r);
+// if (!match) {
+// this.rolesToAdd.push(r);
+// }
+// });
+// console.log('to insert:');
+// console.log(this.rolesToAdd);
+// console.log('to remove:');
+// console.log(this.rolesToDelete);
+// } else if (!verified && this.organisation.rightToBuy) {
+// const currentRoles = this.roles.filter(
+// (x) =>
+// x.enabled &&
+// x.subscriptionTypeEligibility === 0 &&
+// x.tradeEligibility !== 1 &&
+// x.orgTypeEligibility !== 0
+// );
+// const previousRoles = this.roles.filter(
+// (x) =>
+// x.enabled &&
+// x.subscriptionTypeEligibility === 0 &&
+// x.tradeEligibility !== 0 &&
+// x.orgTypeEligibility !== 0
+// );
+// currentRoles.forEach((r) => {
+// const match = previousRoles.includes(r);
+// if (!match) {
+// this.rolesToAdd.push(r);
+// }
+// });
+// previousRoles.forEach((r) => {
+// const match = currentRoles.includes(r);
+// if (!match) {
+// this.rolesToDelete.push(r);
+// }
+// });
+// const currentRoles2 = this.roles.filter(
+// (x) =>
+// x.enabled &&
+// x.subscriptionTypeEligibility === 1 &&
+// x.tradeEligibility !== 1 &&
+// x.orgTypeEligibility !== 0
+// );
+// const previousRoles2 = this.roles.filter(
+// (x) =>
+// x.enabled &&
+// x.subscriptionTypeEligibility === 1 &&
+// x.tradeEligibility !== 0 &&
+// x.orgTypeEligibility !== 0
+// );
+// currentRoles2.forEach((r) => {
+// const match = previousRoles2.includes(r);
+// if (!match) {
+// this.rolesToAdd.push(r);
+// }
+// });
+// previousRoles2.forEach((r) => {
+// const match = currentRoles2.includes(r);
+// if (!match) {
+// this.rolesToDelete.push(r);
+// }
+// });
+// console.log('to insert:');
+// console.log(this.rolesToAdd);
+// console.log('to remove:');
+// console.log(this.rolesToDelete);
+// }
+// }
- pushDataLayerEvent(buttonText:string) {
- this.dataLayerService.pushClickEvent(buttonText);
- }
+// onChange(event: any, defaultValue: any, role: any) {
+// if (defaultValue === true && !event.target.checked) {
+// this.rolesToDelete.push(role);
+// } else if (defaultValue == true && event.target.checked) {
+// const index = this.rolesToDelete.indexOf(role);
+// if (index > -1) {
+// this.rolesToDelete.splice(index, 1);
+// }
+// }
+// if (defaultValue === false && event.target.checked) {
+// this.rolesToAdd.push(role);
+// } else if (defaultValue == false && !event.target.checked) {
+// const index = this.rolesToAdd.indexOf(role);
+// if (index > -1) {
+// this.rolesToAdd.splice(index, 1);
+// }
+// }
+// }
- public onSubmitClick(buttonText:string) {
- let selection = {
- org: this.organisation,
- toDelete: this.rolesToDelete,
- toAdd: this.rolesToAdd,
- rightToBuy: this.verified,
- hasChanges:
- this.organisation.rightToBuy === this.verified &&
- this.rolesToAdd.length === 0 &&
- this.rolesToDelete.length === 0
- ? false
- : true,
- };
- localStorage.setItem(
- `mse_org_${this.organisation.ciiOrganisationId}`,
- JSON.stringify(selection)
- );
- this.router.navigateByUrl(
- `buyer/confirm-changes/${this.organisation.ciiOrganisationId}`
- );
- this.pushDataLayerEvent(buttonText);
- }
+// pushDataLayerEvent(buttonText:string) {
+// this.dataLayerService.pushClickEvent(buttonText);
+// }
- public onCancelClick(buttonText:string) {
- localStorage.removeItem(`mse_org_${this.organisation.ciiOrganisationId}`);
- this.router.navigateByUrl('buyer-supplier/search');
- this.pushDataLayerEvent(buttonText);
- }
+// public onSubmitClick(buttonText:string) {
+// let selection = {
+// org: this.organisation,
+// toDelete: this.rolesToDelete,
+// toAdd: this.rolesToAdd,
+// rightToBuy: this.verified,
+// hasChanges:
+// this.organisation.rightToBuy === this.verified &&
+// this.rolesToAdd.length === 0 &&
+// this.rolesToDelete.length === 0
+// ? false
+// : true,
+// };
+// localStorage.setItem(
+// `mse_org_${this.organisation.ciiOrganisationId}`,
+// JSON.stringify(selection)
+// );
+// this.router.navigateByUrl(
+// `buyer/confirm-changes/${this.organisation.ciiOrganisationId}`
+// );
+// this.pushDataLayerEvent(buttonText);
+// }
- getOrgRoles() {
- this.orgRoles$ = this.wrapperConfigService.getRoles().pipe(share());
- this.orgRoles$.subscribe({
- next: (orgRoles: Role[]) => {
- this.roles = orgRoles;
- this.orgEligableRoles$ = this.organisationGroupService
- .getGroupOrganisationRoles(this.organisation.ciiOrganisationId)
- .pipe(share());
- this.orgEligableRoles$.subscribe({
- next: (eRoles: Role[]) => {
- this.roles.forEach((r) => {
- r.enabled = eRoles.some(
- (x) =>
- x.roleName == r.roleName && x.serviceName == r.serviceName
- );
- });
- this.eRoles = eRoles;
- setTimeout(() => {}, 100);
- },
- error: (err: any) => {
- console.log(err);
- },
- });
- },
- error: (err: any) => {
- console.log(err);
- },
- });
- }
-}
+// public onCancelClick(buttonText:string) {
+// localStorage.removeItem(`mse_org_${this.organisation.ciiOrganisationId}`);
+// this.router.navigateByUrl('buyer-supplier/search');
+// this.pushDataLayerEvent(buttonText);
+// }
+
+// getOrgRoles() {
+// this.orgRoles$ = this.wrapperConfigService.getRoles().pipe(share());
+// this.orgRoles$.subscribe({
+// next: (orgRoles: Role[]) => {
+// this.roles = orgRoles;
+// this.orgEligableRoles$ = this.organisationGroupService
+// .getGroupOrganisationRoles(this.organisation.ciiOrganisationId)
+// .pipe(share());
+// this.orgEligableRoles$.subscribe({
+// next: (eRoles: Role[]) => {
+// this.roles.forEach((r) => {
+// r.enabled = eRoles.some(
+// (x) =>
+// x.roleName == r.roleName && x.serviceName == r.serviceName
+// );
+// });
+// this.eRoles = eRoles;
+// setTimeout(() => {}, 100);
+// },
+// error: (err: any) => {
+// console.log(err);
+// },
+// });
+// },
+// error: (err: any) => {
+// console.log(err);
+// },
+// });
+// }
+// }
diff --git a/src/app/pages/buyer/details/details.component.ts b/src/app/pages/buyer/details/details.component.ts
index 23397bbb4..399c341df 100644
--- a/src/app/pages/buyer/details/details.component.ts
+++ b/src/app/pages/buyer/details/details.component.ts
@@ -57,7 +57,7 @@ export class BuyerDetailsComponent extends BaseComponent implements OnInit {
public onContinueClick(buttonText:string) {
if(environment.appSetting.hideAutoValidation){
- this.router.navigateByUrl(`buyer/confirm/${this.selectedOrgId}`);
+ // this.router.navigateByUrl(`buyer/confirm/${this.selectedOrgId}`);
}
else if (environment.appSetting.hideSimplifyRole) {
let data = {
From 41e12052c23f84ba0e8e1689fe92f24e6602f165 Mon Sep 17 00:00:00 2001
From: madhumathivenkatesan-bc
Date: Mon, 11 Mar 2024 18:34:12 +0530
Subject: [PATCH 10/10] Bug 7288: Manage your delegated access - Application
getting logout, when user click on the switch Organisations button twice fix
done.
---
.../delegated-organisation.component.ts | 14 ++++++++++++--
src/app/services/auth/auth.service.ts | 7 ++++++-
2 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/src/app/pages/manage-delegated/user/delegated-organisation/delegated-organisation.component.ts b/src/app/pages/manage-delegated/user/delegated-organisation/delegated-organisation.component.ts
index caf19aaf8..74ea09b0f 100644
--- a/src/app/pages/manage-delegated/user/delegated-organisation/delegated-organisation.component.ts
+++ b/src/app/pages/manage-delegated/user/delegated-organisation/delegated-organisation.component.ts
@@ -5,6 +5,7 @@ import { environment } from 'src/environments/environment';
import { ManageDelegateService } from '../../service/manage-delegate.service';
import { DataLayerService } from 'src/app/shared/data-layer.service';
import { SessionService } from 'src/app/shared/session.service';
+import { LoadingIndicatorService } from 'src/app/services/helper/loading-indicator.service';
@Component({
selector: 'app-delegated-organisation',
@@ -29,6 +30,7 @@ export class DelegatedOrganisationComponent implements OnInit {
private router: Router,
private dataLayerService: DataLayerService,
private sessionService:SessionService,
+ private loadingIndicatorService: LoadingIndicatorService
) {
this.isOrgAdmin = JSON.parse(localStorage.getItem('isOrgAdmin') || 'false');
if(this.isDeleagation === true){
@@ -95,8 +97,16 @@ export class DelegatedOrganisationComponent implements OnInit {
this.roleInfo = orgDetails.delegatedOrgId;
}
onSubmit(buttonText:string) {
- this.DelegateService.setDelegatedOrg(this.roleInfo,'home');
- this.pushDataLayerEvent(buttonText);
+ try {
+ this.loadingIndicatorService.isLoading.next(true);
+ this.loadingIndicatorService.isCustomLoading.next(true);
+ this.DelegateService.setDelegatedOrg(this.roleInfo,'home');
+ this.pushDataLayerEvent(buttonText);
+ }
+ catch (err) {
+ this.loadingIndicatorService.isLoading.next(false);
+ this.loadingIndicatorService.isCustomLoading.next(false);
+ }
}
public Cancel(buttonText:string) {
window.history.back();
diff --git a/src/app/services/auth/auth.service.ts b/src/app/services/auth/auth.service.ts
index 46051214d..a041bf9e1 100644
--- a/src/app/services/auth/auth.service.ts
+++ b/src/app/services/auth/auth.service.ts
@@ -16,6 +16,7 @@ import { Router } from '@angular/router';
import { Location } from '@angular/common';
import { RollbarErrorService } from 'src/app/shared/rollbar-error.service';
import { SessionService } from 'src/app/shared/session.service';
+import { LoadingIndicatorService } from 'src/app/services/helper/loading-indicator.service';
@Injectable()
export class AuthService {
@@ -26,7 +27,7 @@ export class AuthService {
ccsServices: CcsServiceInfo[] = [];
constructor(public readonly workerService: WorkerService, private router: Router, private location: Location,private RollbarErrorService:RollbarErrorService,
- private readonly httpService: HttpClient, private readonly tokenService: TokenService,private sessionService:SessionService) {
+ private readonly httpService: HttpClient, private readonly tokenService: TokenService,private sessionService:SessionService,private loadingIndicatorService: LoadingIndicatorService) {
this.servicePermission = [];
}
@@ -88,6 +89,8 @@ export class AuthService {
localStorage.setItem('at_exp', decodedAccessToken.exp);
localStorage.setItem('show_loading_indicator', 'false');
if (url.length > 0) {
+ this.loadingIndicatorService.isLoading.next(false);
+ this.loadingIndicatorService.isCustomLoading.next(false);
this.router.navigateByUrl(url, { replaceUrl: true });
}
this.RollbarErrorService.RollbarDebug('renewAccessToken:'+ JSON.stringify(data))
@@ -95,6 +98,8 @@ export class AuthService {
},
(err) => {
localStorage.setItem('show_loading_indicator', 'false');
+ this.loadingIndicatorService.isLoading.next(false);
+ this.loadingIndicatorService.isCustomLoading.next(false);
this.RollbarErrorService.RollbarDebug('renewAccessTokenError:'+ JSON.stringify(err))
// This could due to invalid refresh token (refresh token rotation)
if (err.error == "INVALID_CREDENTIALS" || err.error.error_description == "PENDING_PASSWORD_CHANGE"