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
4 changes: 4 additions & 0 deletions src/app/manage-learn/core/services/project.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export class ProjectService {
project;
projectId;
shareTaskId;
showProfileNamepopup : boolean = false;
constructor(
private kendra: KendraApiService,
private utils: UtilsService,
Expand Down Expand Up @@ -454,4 +455,7 @@ export class ProjectService {
};
return links ? link : links;
}
setNamePop(value){
this.showProfileNamepopup = value;
}
}
19 changes: 17 additions & 2 deletions src/app/manage-learn/imp-suggestions/imp-suggestions.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Component } from '@angular/core';
import { Router } from '@angular/router';
import { RouterLinks } from '../../../app/app.constant';
import { AppHeaderService } from '../../../services/app-header.service';
import { ProjectService } from '../core';

@Component({
selector: 'app-imp-suggestions',
Expand All @@ -22,7 +23,8 @@ export class ImpSuggestionsPage {
actionButtons: []
};

constructor(private router: Router, private headerService: AppHeaderService) {
constructor(private router: Router, private headerService: AppHeaderService,
private projectService : ProjectService) {
this.criterias = this.router.getCurrentNavigation().extras.state.data;
this.solutionName = this.router.getCurrentNavigation().extras.state.solutionName;
this.observationId = this.router.getCurrentNavigation().extras.state.observationId;
Expand All @@ -40,7 +42,10 @@ export class ImpSuggestionsPage {
this.headerService.updatePageConfig(this.headerConfig);
}

goToTemplateDetails(criteria, project) {
async goToTemplateDetails(criteria, project) {
let resp = await this.projectService.getTemplateByExternalId(project.externalId);
resp?.result?.projectId ?
this.gotoDetailsPage(resp?.result) :
this.router.navigate([`${RouterLinks.PROJECT}/${RouterLinks.PROJECT_TEMPLATE}`,project.externalId], {
state: {
"referenceFrom": "observation",
Expand All @@ -54,5 +59,15 @@ export class ImpSuggestionsPage {
},
});
}
gotoDetailsPage(project) {
this.router.navigate([`${RouterLinks.PROJECT}/${RouterLinks.DETAILS}`], {
queryParams: {
projectId: project.projectId,
programId: project.programId ? project.programId : project.programInformation.programId,
solutionId: this.solutionId,
hasAcceptedTAndC: project.hasAcceptedTAndC,
}
});
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</ion-toolbar>
<ion-content class="ion-padding">
<app-metadata-details translucent="true" [data]="metaData">
<div class="certificate-tag" certificate *ngIf="project?.certificateTemplateId">
<div class="certificate-tag" certificate *ngIf="project?.criteria">
{{'CERTIFICATE' | translate}}
</div>
<ion-button (click)="doAction()" expand="block" class="ion-text-none ion-margin-top">{{buttonLabel |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,6 @@ export class ProjectTemplateviewPage implements OnInit {
const extraPramas = `?link=${this.id}`
this.projectService.getTemplateByExternalId(null,extraPramas ).then(data =>{
this.project = data?.result;
if (this.project?.projectId) {
this.buttonLabel = 'FRMELEMNTS_LBL_CONTINUE_IMPROVEMENT'
}
this.metaData = {
title: this.project?.title,
subTitle: this.project?.programInformation ? this.project?.programInformation?.programName : ''
Expand All @@ -167,7 +164,7 @@ export class ProjectTemplateviewPage implements OnInit {
this.headerConfig.showHeader = false;
this.headerConfig.showBurgerMenu = false;
this.headerService.updatePageConfig(this.headerConfig);
this.clickedOnProfile ? this.showProfileNameConfirmationPopup():'';
this.clickedOnProfile || this.projectService.showProfileNamepopup ? this.showProfileNameConfirmationPopup() : '';
this.templateDetailsInit();
}
handleBackButton() {
Expand Down Expand Up @@ -244,13 +241,13 @@ export class ProjectTemplateviewPage implements OnInit {
this.projectService.openResources(resource);
}

doAction() {
if(!this.project?.programJoined && this.project.hasOwnProperty('requestForPIIConsent')){
this.popupService.joinProgram(this.project,'project')

consentFlow() {
this.popupService.joinProgram(this.project,'project')
.then(async resp => {
if(resp){
let profileData = await this.utils.getProfileInfo();
this.popupService.join(this.project,profileData).then((data :any) =>{
this.popupService.join(this.project,profileData).then((data:any) =>{
if(data){
this.project.programJoined = true
let payload = {consumerId: this.project.rootOrganisations, objectId: this.project.programId};
Expand All @@ -263,40 +260,52 @@ export class ProjectTemplateviewPage implements OnInit {
}else{
this.commonUtils.showToast('FRMELEMNTS_MSG_PROGRAM_JOINED_SUCCESS','','',9000,'top');
}

}
},error =>{})
}
});
return
}else{
if(!this.hideNameConfirmPopup && this.project.criteria && !this.isStarted && this.project.hasAcceptedTAndC && (this.isAssignedProject || this.isTargeted || this.isATargetedSolution)){
this.showProfileNameConfirmationPopup();
}else{
if(this.templateDetailsPayload?.referenceFrom == "observation" && !this.project?.projectId){
this.startProjectConfirmation();
return;
}
if(!this.appGlobalService.isUserLoggedIn()){
this.toast.showMessage('FRMELEMNTS_MSG_NOT_LOGGEDIN_USER','danger')
this.triggerLogin();
return
}
if ( this.stateData?.referenceFrom != 'observation' && !this.isAssignedProject && !this.project.hasAcceptedTAndC && !this.isTargeted && !this.isATargetedSolution && !this.isStarted) {
this.popupService.showPPPForProjectPopUp('FRMELEMNTS_LBL_PROJECT_PRIVACY_POLICY', 'FRMELEMNTS_LBL_PROJECT_PRIVACY_POLICY_TC', 'FRMELEMNTS_LBL_TCANDCP', 'FRMELEMNTS_LBL_SHARE_PROJECT_DETAILS', 'https://diksha.gov.in/term-of-use.html', 'privacyPolicy').then((data: any) => {
return
}
showPPF() {
this.popupService.showPPPForProjectPopUp('FRMELEMNTS_LBL_PROJECT_PRIVACY_POLICY', 'FRMELEMNTS_LBL_PROJECT_PRIVACY_POLICY_TC', 'FRMELEMNTS_LBL_TCANDCP', 'FRMELEMNTS_LBL_SHARE_PROJECT_DETAILS', 'https://diksha.gov.in/term-of-use.html', 'privacyPolicy').then((data: any) => {
if (data && data.isClicked) {
this.project.hasAcceptedTAndC = data.isChecked;
if(this.project.criteria && !this.isStarted && !this.hideNameConfirmPopup){
this.showProfileNameConfirmationPopup();
}else{
this.start();
this.toast.showMessage('FRMELEMNTS_LBL_PROJECT_STARTED','success');
}
}
})
}
})
}
doAction() {
// Generic functions
// Login
if (!this.appGlobalService.isUserLoggedIn()) {
this.toast.showMessage('FRMELEMNTS_MSG_NOT_LOGGEDIN_USER', 'danger')
this.triggerLogin();
return
}
// consent flow
if (!this.project?.programJoined && this.project.hasOwnProperty('requestForPIIConsent')) {
this.consentFlow();
} else {
// certificate profile name popup
if (!this.hideNameConfirmPopup && this.project.criteria && !this.isStarted && this.project.hasAcceptedTAndC && (this.isAssignedProject || this.isTargeted || this.isATargetedSolution)) {
this.showProfileNameConfirmationPopup();
return;
} else {
if(this.project.criteria && !this.isStarted && !this.hideNameConfirmPopup){
this.showProfileNameConfirmationPopup();
return;
} else {
if (this.templateDetailsPayload?.referenceFrom == "observation" && !this.project?.projectId) {
this.startProjectConfirmation();
return;
}
if (this.stateData?.referenceFrom != 'observation' && !this.isAssignedProject && !this.project.hasAcceptedTAndC && !this.isTargeted && !this.isATargetedSolution && !this.isStarted) {
this.showPPF();
}else{
this.start();
}
Expand Down Expand Up @@ -451,23 +460,27 @@ export class ProjectTemplateviewPage implements OnInit {
}else{
listing = false
}
if(this.stateData && this.stateData.referenceFrom == 'observation'){
this.router.navigate([`${RouterLinks.PROJECT}/${RouterLinks.PROJECT_TEMPLATE}`,this.id,], {
state: this.stateData,
});
}else{
let params ={
isTargeted :this.isTargeted,
programId: this.programId,
solutionId :this.solutionId,
solutionId :this.project.solutionId,
isATargetedSolution :this.isATargetedSolution ,
type :this.isAssignedProject ? 'assignedToMe' : 'createdByMe',
listing : listing
}
this.router.navigate([`${RouterLinks.PROJECT}/${RouterLinks.PROJECT_TEMPLATE}`, this.solutionId], {
this.router.navigate([`${RouterLinks.PROJECT}/${RouterLinks.PROJECT_TEMPLATE}`, this.project.solutionId], {
queryParams: params,
skipLocationChange: false,
replaceUrl: true,
state: {
"referenceFrom": "link",
}})

state: { "referenceFrom": "link"}})
}
this.clickedOnProfile = true;
this.projectService.setNamePop(true);
const popUp = await this.popoverController.create({
component: ProfileNameConfirmationPopoverComponent,
componentProps: {
Expand All @@ -481,6 +494,7 @@ export class ProjectTemplateviewPage implements OnInit {
if (data.buttonClicked) {
this.isStarted = true;
this.clickedOnProfile = false;
this.projectService.setNamePop(false);
this.doAction();
}
}
Expand Down