From d7424a0a394a8b09d88d90a54eefdb669d7de7bc Mon Sep 17 00:00:00 2001 From: "christopher.fernandes" Date: Thu, 7 Jul 2022 11:21:32 +0530 Subject: [PATCH 1/2] Task #58726: Enabled logo click to home page if details are filled --- .../component/app-nav-bar/app-nav-bar.component.html | 8 +++++++- .../component/app-nav-bar/app-nav-bar.component.ts | 12 ++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/app/component/app-nav-bar/app-nav-bar.component.html b/src/app/component/app-nav-bar/app-nav-bar.component.html index 2a3c57059..9eb379d36 100644 --- a/src/app/component/app-nav-bar/app-nav-bar.component.html +++ b/src/app/component/app-nav-bar/app-nav-bar.component.html @@ -77,10 +77,16 @@ diff --git a/src/app/component/app-nav-bar/app-nav-bar.component.ts b/src/app/component/app-nav-bar/app-nav-bar.component.ts index 230557aa7..a59b7e326 100644 --- a/src/app/component/app-nav-bar/app-nav-bar.component.ts +++ b/src/app/component/app-nav-bar/app-nav-bar.component.ts @@ -32,6 +32,7 @@ export class AppNavBarComponent implements OnInit, OnChanges { isTourGuideAvailable = false isTourGuideClosed = false showAppNavBar = false + isSetUpPage = false popupTour: any constructor( private domSanitizer: DomSanitizer, @@ -47,6 +48,7 @@ export class AppNavBarComponent implements OnInit, OnChanges { if (event instanceof NavigationStart) { this.cancelTour() } else if (event instanceof NavigationEnd) { + this.routeSubs(event) this.cancelTour() } }) @@ -93,6 +95,16 @@ export class AppNavBarComponent implements OnInit, OnChanges { }) } + routeSubs(e: NavigationEnd) { + // this.router.events.subscribe((e: Event) => { + // if (e instanceof NavigationEnd) { + if (e.url.includes('/app/setup')) { + this.isSetUpPage = true + } else { + this.isSetUpPage = false + } + } + ngOnChanges(changes: SimpleChanges) { for (const property in changes) { if (property === 'mode') { From 82d632433bdd9f5fe34af050aeffd357065a04c1 Mon Sep 17 00:00:00 2001 From: "christopher.fernandes" Date: Thu, 7 Jul 2022 11:22:42 +0530 Subject: [PATCH 2/2] Task #58726: conditional validation based on previous user selections --- .../consultancy/consultancy.component.ts | 25 ++++++++- .../routes/research/research.component.ts | 26 ++++++++- .../training-rograms.component.html | 30 +++++----- .../training-rograms.component.ts | 55 ++++++++++++++++++- 4 files changed, 115 insertions(+), 21 deletions(-) diff --git a/project/ws/app/src/lib/routes/state-profile/routes/consultancy/consultancy.component.ts b/project/ws/app/src/lib/routes/state-profile/routes/consultancy/consultancy.component.ts index 7f1d891fa..5ed9b9106 100644 --- a/project/ws/app/src/lib/routes/state-profile/routes/consultancy/consultancy.component.ts +++ b/project/ws/app/src/lib/routes/state-profile/routes/consultancy/consultancy.component.ts @@ -26,6 +26,7 @@ export class ConsultancyComponent implements OnInit { deleteBodyRef: ElementRef | null = null editValue: any textBoxActive = false + isConsultancy = false constructor( private orgSvc: OrgProfileService, @@ -46,15 +47,28 @@ export class ConsultancyComponent implements OnInit { // If projects are added then only validation is required, so by default validation is true, so that user can go to next tab this.orgSvc.updateFormStatus('consultancy', true) + } + + ngOnInit() { // pre poluate form fields when data is available (edit mode) if (this.configSvc.unMappedUser && this.configSvc.unMappedUser.orgProfile) { const consultancyData = _.get(this.configSvc.unMappedUser.orgProfile, 'profileDetails.consultancy') this.addedconsultancies = _.get(consultancyData, 'projects') || [] this.orgSvc.updateFormStatus('consultancy', true) } - } - ngOnInit() { + // if Roles and functions tab has "Research" checked then check for atleast 1 prject + let rolesAndFunctions: any + if (JSON.stringify(this.orgSvc.formValues.rolesAndFunctions) === '{}') { + rolesAndFunctions = _.get(this.configSvc.unMappedUser.orgProfile, 'profileDetails.rolesAndFunctions') + } else { + rolesAndFunctions = _.get(this.orgSvc.formValues, 'rolesAndFunctions') + } + if (rolesAndFunctions.consultancy) { + this.isConsultancy = true + // this.removeValidators() + this.orgSvc.updateFormStatus('consultancy', (this.addedconsultancies.length > 0)) + } } addProject() { @@ -141,7 +155,12 @@ export class ConsultancyComponent implements OnInit { } this.orgSvc.updateLocalFormValue('consultancy', localData) // this.orgSvc.updateFormStatus('consultancy', (this.addedconsultancies.length > 0)) - this.orgSvc.updateFormStatus('consultancy', true) + if (this.isConsultancy) { + // tslint:disable-next-line: max-line-length + this.orgSvc.updateFormStatus('consultancy', (this.addedconsultancies.length > 0)) + } else { + this.orgSvc.updateFormStatus('consultancy', true) + } } resetConsultancyForm() { diff --git a/project/ws/app/src/lib/routes/state-profile/routes/research/research.component.ts b/project/ws/app/src/lib/routes/state-profile/routes/research/research.component.ts index 5ba490f4a..9909cc61f 100644 --- a/project/ws/app/src/lib/routes/state-profile/routes/research/research.component.ts +++ b/project/ws/app/src/lib/routes/state-profile/routes/research/research.component.ts @@ -34,6 +34,7 @@ export class ResearchComponent implements OnInit { editPaperValue: any textBoxActive = false textBoxActive1 = false + isResearch = false constructor( private orgSvc: OrgProfileService, @@ -58,6 +59,9 @@ export class ResearchComponent implements OnInit { // setting this to true so that form validation is not required based on number added projects or papers this.orgSvc.updateFormStatus('research', true) + } + + ngOnInit() { // pre poluate form fields when data is available (edit mode) if (this.configSvc.unMappedUser && this.configSvc.unMappedUser.orgProfile) { const researchData = _.get(this.configSvc.unMappedUser.orgProfile, 'profileDetails.research') @@ -67,9 +71,19 @@ export class ResearchComponent implements OnInit { // this.orgSvc.updateFormStatus('research', (this.addedPapers.length > 0 && this.addedPrograms.length > 0)) this.orgSvc.updateFormStatus('research', true) } - } - ngOnInit() { + // if Roles and functions tab has "Research" checked then check for atleast 1 prject + let rolesAndFunctions: any + if (JSON.stringify(this.orgSvc.formValues.rolesAndFunctions) === '{}') { + rolesAndFunctions = _.get(this.configSvc.unMappedUser.orgProfile, 'profileDetails.rolesAndFunctions') + } else { + rolesAndFunctions = _.get(this.orgSvc.formValues, 'rolesAndFunctions') + } + if (rolesAndFunctions.research) { + this.isResearch = true + // this.removeValidators() + this.orgSvc.updateFormStatus('research', (this.addedPrograms.length > 0)) + } } addProgram() { @@ -234,7 +248,13 @@ export class ResearchComponent implements OnInit { researchPapers: this.addedPapers, } this.orgSvc.updateLocalFormValue('research', localData) - this.orgSvc.updateFormStatus('research', true) + if (this.isResearch) { + // tslint:disable-next-line: max-line-length + this.orgSvc.updateFormStatus('research', (this.addedPrograms.length > 0)) + } else { + this.orgSvc.updateFormStatus('research', true) + } + // this.orgSvc.updateFormStatus('research', (this.addedPapers.length > 0 && this.addedPrograms.length > 0)) } diff --git a/project/ws/app/src/lib/routes/state-profile/routes/training-rograms/training-rograms.component.html b/project/ws/app/src/lib/routes/state-profile/routes/training-rograms/training-rograms.component.html index 6ea7535dc..a1fd418c0 100644 --- a/project/ws/app/src/lib/routes/state-profile/routes/training-rograms/training-rograms.component.html +++ b/project/ws/app/src/lib/routes/state-profile/routes/training-rograms/training-rograms.component.html @@ -13,9 +13,9 @@

Training Programs

-
@@ -51,8 +51,8 @@

Training Programs

-