diff --git a/src/app/manage-learn/core/services/project.service.ts b/src/app/manage-learn/core/services/project.service.ts index 46ccf0d32..a84256ead 100644 --- a/src/app/manage-learn/core/services/project.service.ts +++ b/src/app/manage-learn/core/services/project.service.ts @@ -45,6 +45,7 @@ export class ProjectService { private share: SharingFeatureService, private syncService: SyncService, private popupService: GenericPopUpService, + ) { this.networkFlag = this.commonUtilService.networkInfo.isNetworkAvailable; this._networkSubscription = this.commonUtilService.networkAvailability$.subscribe(async (available: boolean) => { @@ -201,7 +202,7 @@ export class ProjectService { return payload; } - async startAssessment(projectId, id) { + async startAssessment(projectId, id, programName?) { this.networkFlag = this.commonUtilService.networkInfo.isNetworkAvailable; if (!this.networkFlag) { this.toast.showMessage('FRMELEMNTS_MSG_YOU_ARE_WORKING_OFFLINE_TRY_AGAIN', 'danger'); @@ -246,7 +247,9 @@ export class ProjectService { observationId: data.observationId, entityId: data.entityId, entityName: data.entityName, - programJoined: true + programJoined: true, + name:data.solutionDetails.name, + programName:programName }, }); }, (error) => { @@ -254,7 +257,7 @@ export class ProjectService { }) } - async checkReport(projectId, taskId) { + async checkReport(projectId, taskId, programName?) { this.networkFlag = this.commonUtilService.networkInfo.isNetworkAvailable; if (!this.networkFlag) { this.toast.showMessage('FRMELEMNTS_MSG_YOU_ARE_WORKING_OFFLINE_TRY_AGAIN', 'danger'); @@ -272,8 +275,7 @@ export class ProjectService { this.toast.showMessage('FRMELEMNTS_MSG_CANNOT_GET_PROJECT_DETAILS', "danger"); return; } - let data = success.result; - + let data = success.result; this.router.navigate([`/${RouterLinks.OBSERVATION}/${RouterLinks.OBSERVATION_SUBMISSION}`], { queryParams: { programId: data.programId, @@ -281,6 +283,8 @@ export class ProjectService { observationId: data.observationId, entityId: data.entityId, entityName: data.entityName, + name:data.solutionDetails.name, + programName:programName }, }); diff --git a/src/app/manage-learn/observation/observation-submission/observation-submission.component.ts b/src/app/manage-learn/observation/observation-submission/observation-submission.component.ts index c1264cb1e..26e51f75a 100644 --- a/src/app/manage-learn/observation/observation-submission/observation-submission.component.ts +++ b/src/app/manage-learn/observation/observation-submission/observation-submission.component.ts @@ -84,11 +84,17 @@ export class ObservationSubmissionComponent implements OnInit { this.entityName = params.entityName; this.disableObserveAgain = params.disableObserveAgain == "true"; this.programJoined = params.programJoined == 'true' + let data = { observationId: this.observationId, entityId: this.entityId }; this.generatedKey = this.utils.getUniqueKey(data,storageKeys.submissionsList); + params?.name ? this.observationService.obsTraceObj.name = params?.name :'' + params.observationId ? this.observationService.obsTraceObj.observationId = params.observationId: '' + params.programId ? this.observationService.obsTraceObj.programId = params.programId :''; + params.programName ? this.observationService.obsTraceObj.programName = params.programName :''; + params.solutionId ? this.observationService.obsTraceObj.solutionId = params.solutionId : ''; }); } diff --git a/src/app/manage-learn/shared/components/task-card/task-card.component.ts b/src/app/manage-learn/shared/components/task-card/task-card.component.ts index 0eb344079..a3eab5a56 100644 --- a/src/app/manage-learn/shared/components/task-card/task-card.component.ts +++ b/src/app/manage-learn/shared/components/task-card/task-card.component.ts @@ -6,6 +6,7 @@ import { menuConstants } from '../../../../../app/manage-learn/core/constants/me import { PopoverController, AlertController } from '@ionic/angular'; import { TranslateService } from '@ngx-translate/core'; import { PopoverComponent } from '../popover/popover.component'; +import { ObservationService } from '../../../observation/observation.service'; // import * as _ from 'underscore'; @Component({ @@ -30,7 +31,9 @@ export class TaskCardComponent implements OnInit { private translate: TranslateService, private alert: AlertController, private db: DbService, - private util: UtilsService + private util: UtilsService, + public obsService: ObservationService + ) { } ngOnInit() { @@ -59,7 +62,7 @@ export class TaskCardComponent implements OnInit { return; } const submissionDetails = this.data?.tasks[index]?.submissionDetails; - if(submissionDetails?.observationId) { + if(!submissionDetails?.observationId) { this.router.navigate([`/${RouterLinks.OBSERVATION}/${RouterLinks.OBSERVATION_SUBMISSION}`], { queryParams: { programId: submissionDetails.programId, @@ -70,14 +73,20 @@ export class TaskCardComponent implements OnInit { disableObserveAgain: this.data?.tasks[index].status === statusType.completed, programJoined:true }, + }) + .then(() => { + this.obsService.obsTraceObj.programId = submissionDetails.programId; + this.obsService.obsTraceObj.solutionId = submissionDetails.solutionId; + this.obsService.obsTraceObj.name = this.data?.tasks[index].solutionDetails?.name; + this.obsService.obsTraceObj.programName = this.data.programName; }); } else { - this.projectService.startAssessment(this.data._id, task._id); + this.projectService.startAssessment(this.data._id, task._id,this.data.programName); } } checkReport(task) { - this.projectService.checkReport(this.data._id, task._id); + this.projectService.checkReport(this.data._id, task._id,this.data.programName); } openResources(task) { this.router.navigate([`${RouterLinks.PROJECT}/${RouterLinks.LEARNING_RESOURCES}`, this.data._id, task._id]);