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 package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"@ngx-translate/core": "^11.0.1",
"@ngx-translate/http-loader": "^4.0.0",
"@project-sunbird/client-services": "5.0.1",
"@project-sunbird/common-consumption-v9": "5.0.1",
"@project-sunbird/common-consumption-v9": "5.1.0",
"@project-sunbird/common-form-elements-v9": "5.0.3",
"@project-sunbird/content-player": "4.4.0",
"@project-sunbird/discussions-ui-v8": "2.6.0-beta.2",
Expand Down
3 changes: 2 additions & 1 deletion scripts/deleteUnUsableIosIcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ function deleteUnUsableIosIcon(ionicIconFilePath) {
"sync-circle.svg",
"arrow-up-circle-outline.svg",
"arrow-down-circle-outline.svg",
"caret-forward-circle.svg"
"caret-forward-circle.svg",
"ribbon.svg"
].includes(file))) {
fs.unlinkSync(ionicIconFilePath + '/' + file);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</div>
<div class="certificate-head">{{'CERTIFICATE_ISSUED_TO' | translate}}</div>
<div class="certificate-to">{{certificateData.issuedTo}}</div>
<div class="certificate-course">{{'SUCCESSFULLY_COMPLETING_COURSE' | translate}}</div>
<div class="certificate-course">{{content | translate}}</div>
<div class="certificate-course-name">{{certificateData.trainingName}}</div>
<div class="certificate-data">
<span>{{'ON_APPNAME_ON' | translate: {'appName': appName} }}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,18 @@ export class CertificateVerificationPopoverComponent implements OnInit, OnDestro
@Input() actionsButtons: any;
@Input() certificateData: any;
@Input() showHeader = true;
@Input() isProject :boolean;
backButtonFunc: Subscription;
appName: string;

content ='SUCCESSFULLY_COMPLETING_COURSE';
constructor(
private commonUtilService: CommonUtilService,
public popoverCtrl: PopoverController,
private platform: Platform,
private events: Events) { }

ngOnInit() {
this.content = this.isProject ? 'SUCCESSFULLY_COMPLETING_PROJECT' :'SUCCESSFULLY_COMPLETING_COURSE';
this.backButtonFunc = this.platform.backButton.subscribeWithPriority(11, () => {
this.popoverCtrl.dismiss({ isLeftButtonClicked: null });
this.backButtonFunc.unsubscribe();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,28 @@
<img src="assets/imgs/profile_name_confirmation.png" alt="Certificate of completion">
</div>


<div class="sb-popover-content-details">
<div>{{'FRMELEMNTS_LBL_PROFTITLE' | translate}}:</div>
<div class="pnc-profile-name mt-8">
<div class="pnc-profile-name mt-8" [ngClass]="{'word-wrap-name' : projectContent}">
<span>{{ profile?.firstName | titlecase }} {{ profile?.lastName | titlecase }}</span>
<span (click)="onProfilePageClick()">
<img src="assets/imgs/edit-icon.svg" alt="edit-name" />
</span>
</div>
<div class="pnc-padding-32"> {{'FRMELEMNTS_MSG_NAMEONCERT' | categoryKeyTranslate: content }} </div>
<div class="pnc-padding-32" *ngIf="content"> {{'FRMELEMNTS_MSG_NAMEONCERT' | categoryKeyTranslate: content }} </div>
<div class="pnc-padding-32" *ngIf="projectContent"> {{'FRMELEMNTS_MSG_CERTIFICATION_NAME_DISPLAY' | translate }} </div>
<div class="pnc-padding-32"> {{'FRMELEMNTS_MSG_EDITCERTNAME' | translate: {'%appName': appName} }} </div>
<div>
<ion-checkbox class="pnc-checkbox" color="secondary" checked="false" [(ngModel)]="doNotShowAgain">
<ion-checkbox class="pnc-checkbox" [style.color]="projectContent ? 'primary' : 'secondary'" checked="false" [(ngModel)]="doNotShowAgain">
</ion-checkbox>
<p class="pnc-checkbox-desc"> {{'FRMELEMNTS_CKBX_CERTMSG' | translate}} </p>
</div>
</div>
</div>
</ion-content>

<ion-footer>
<div class="sb-popover-footer">
<button class="sb-popover-action-btn popover-color" (click)="onSubmitClick()">
{{'START_LEARNING' | translate}}
<button class="sb-popover-action-btn popover-color" [ngClass]="{'custom-btn-txt-transform-none' : buttonLabel == 'FRMELEMNTS_LBL_START_IMPROVEMENT'}" (click)="onSubmitClick()">
{{buttonLabel | translate}}
</button>
</div>
</ion-footer>
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,10 @@ ion-footer {
.sb-popover-footer {
padding: 16px;
}
}
.word-wrap-name{
word-break: break-all;
overflow-x: auto;
max-height: 8rem;
scroll-behavior: auto;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ import { NavigationService } from '@app/services/navigation-handler.service';
})
export class ProfileNameConfirmationPopoverComponent {
@Input() content;
@Input() projectContent;
appName;
profile;
doNotShowAgain = false;
buttonLabel ="START_LEARNING";

constructor(
@Inject('PROFILE_SERVICE') private profileService: ProfileService,
Expand All @@ -30,6 +32,7 @@ export class ProfileNameConfirmationPopoverComponent {
) { }

async ionViewWillEnter() {
this.buttonLabel = this.projectContent ? "FRMELEMNTS_LBL_START_IMPROVEMENT" : "START_LEARNING";
this.commonUtilService.getAppName().then((res) => { this.appName = res; });

const userId = await this.appGlobalService.getActiveProfileUid();
Expand Down Expand Up @@ -59,7 +62,8 @@ export class ProfileNameConfirmationPopoverComponent {
}

onProfilePageClick() {
this.navService.navigateToEditPersonalDetails(this.profile, PageId.PROFILE_NAME_CONFIRMATION_POPUP);
let payload = this.projectContent ? {code:'name',children:[]} : ''
this.navService.navigateToEditPersonalDetails(this.profile, PageId.PROFILE_NAME_CONFIRMATION_POPUP,payload);
this.closePopover({ editProfileClicked: true });
}

Expand Down
26 changes: 24 additions & 2 deletions src/app/district-mapping/district-mapping.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export class DistrictMappingPage implements OnDestroy {
private formValueSubscription?: Subscription;
private initialFormLoad = true;
private isLocationUpdated = false;
params;
constructor(
@Inject('PROFILE_SERVICE') private profileService: ProfileService,
@Inject('SHARED_PREFERENCES') private preferences: SharedPreferences,
Expand All @@ -88,6 +89,7 @@ export class DistrictMappingPage implements OnDestroy {
this.navigateToCourse = extrasState.noOfStepsToCourseToc;
this.isGoogleSignIn = extrasState.isGoogleSignIn;
this.userData = this.isGoogleSignIn ? extrasState.userData : '';
this.params = extrasState.payload;
}
goBack(isNavClicked: boolean) {
this.telemetryGeneratorService.generateBackClickedNewTelemetry(
Expand Down Expand Up @@ -501,8 +503,11 @@ export class DistrictMappingPage implements OnDestroy {
}
this.initialFormLoad = false;
this.locationFormConfig = locationMappingConfig;
if(this.params){
this.fieldConfig();
}

}

private setDefaultConfig(fieldConfig: FieldConfig<any>): SbLocation {
if (this.presetLocation[fieldConfig.code]) {
return this.presetLocation[fieldConfig.code];
Expand Down Expand Up @@ -699,4 +704,21 @@ export class DistrictMappingPage implements OnDestroy {
redirectToLogin() {
this.router.navigate([RouterLinks.SIGN_IN]);
}
}
fieldConfig(){
this.locationFormConfig.forEach(element => {
if(element.code != this.params.code){
element.templateOptions.hidden = true;
element.templateOptions.disabled = true;
if( this.params.children){
let keys = Object.keys(element.children);
keys.forEach(key => {
element.children[key].forEach(childEl => {
childEl.templateOptions.hidden =true;
childEl.templateOptions.disabled =true;
});
});
}
}
});
}
}
8 changes: 8 additions & 0 deletions src/app/manage-learn/core/constants/actions.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ export const actions = {
}
],

CERTIFICATE_ACTION:{
title: "CERTIFICATE",
icon: "ribbon",
action: "certificate",
color: 'success',
id:'certificate'
},

TASK_FILE_DESCRIPTION:{
label:'FRMELEMNTS_LBL_TASK_ATTACHMENTS_DESCRIPTION'
},
Expand Down
7 changes: 5 additions & 2 deletions src/app/manage-learn/core/constants/urlConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ export const urlConstants = {
VERIFY_LINK: '/api/solutions/mlcore/v1/verifyLink/', //LINK
},
PRESIGNED_URLS: '/api/cloud-services/mlcore/v1/files/preSignedUrls',
IMPORT_LIBRARY_PROJECT:'/api/userProjects/mlprojects/v1/importFromLibrary/' //tempID?isATargetedSolution=false

IMPORT_LIBRARY_PROJECT:'/api/userProjects/mlprojects/v1/importFromLibrary/', //tempID?isATargetedSolution=false
PROJECT_CERTIFICATES:'/api/userProjects/mlprojects/v1/certificates',
GET_PROJECT_CERTIFICATE:'/api/v1/ProjectCertificate/',
PROJECT_CERTIFICATE_DOWNLOAD:'/api/rc/projectCertificate/v1/download/',
CERTIFICATE_VERIFY:'/api/rc/certificate/v1/key/'
},
};
3 changes: 2 additions & 1 deletion src/app/manage-learn/core/interfaces/request-params.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export interface RequestParams {
url: string,
payload?: any
payload?: any,
headers?:any
}
7 changes: 5 additions & 2 deletions src/app/manage-learn/core/services/api.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,14 @@ export class ApiService {
get(requestParam: RequestParams): Observable<any> {
return this.checkTokenValidation().pipe(
mergeMap(session => {
const headers = session ? this.setHeaders(session) : {};
let headers :any = session ? this.setHeaders(session) : {};
if(requestParam?.headers){
headers = {...headers, ...requestParam?.headers}
}
this.ionicHttp.setDataSerializer('json');
return this.ionicHttp.get(this.baseUrl + requestParam.url, '', headers).then(
data => {
return JSON.parse(data.data);
return requestParam?.headers ? data.data : JSON.parse(data.data);
}, error => {
catchError(this.handleError(error))
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { Injectable } from '@angular/core';
import { PopoverController } from '@ionic/angular';
import { urlConstants } from '../constants/urlConstants';
import { UnnatiDataService } from './unnati-data.service';
import { CertificateVerificationPopoverComponent } from '@app/app/components/popups/certificate-verification/certificate-verification-popup.component';
import { CommonUtilService } from '@app/services';

@Injectable({
providedIn: 'root'
})
export class ManageLearnCertificateService {

constructor(
private unanti : UnnatiDataService,
private popoverCtrl: PopoverController,
private commonUtilService : CommonUtilService

) { }
getProjectCertificate(data){
const config ={
url : urlConstants.API_URLS.PROJECT_CERTIFICATE_DOWNLOAD + data.split('certs/')[1].split('?')[0]
}
this.unanti.get(config).subscribe(resp =>{
this.verifyCertificate(resp);
})
}
async verifyCertificate(data){
const config ={
url : urlConstants.API_URLS.CERTIFICATE_VERIFY +data.issuer.kid
}
this.unanti.get(config).subscribe(async resp =>{
if(resp.value) {
let payload ={
issuanceDate : data.completedDate,
trainingName :data.projectName,
issuedTo:data.recipient.name
}
const qrAlert = await this.popoverCtrl.create({
component: CertificateVerificationPopoverComponent,
componentProps: {
certificateData: payload,
isProject : true,
actionsButtons: [
{
btntext: 'OKAY',
btnClass: 'sb-btn sb-btn-sm sb-btn-tertiary'
}
],
},
cssClass: 'sb-popover',
});
await qrAlert.present();
} else {
this.commonUtilService.afterOnBoardQRErrorAlert('INVALID_QR', 'CERTIFICATE_VERIFICATION_FAIL', data);
}
})
}
}
17 changes: 14 additions & 3 deletions src/app/manage-learn/core/services/project.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class ProjectService {
})
}
async getTemplateBySoluntionId(id) {
let payload = await this.utils.getProfileInfo();
let payload = await this.utils.getProfileData();
const config = {
url: urlConstants.API_URLS.TEMPLATE_DETAILS + id,
payload: payload,
Expand All @@ -75,7 +75,7 @@ export class ProjectService {
}

async getProjectDetails({ projectId = '', solutionId, isProfileInfoRequired = false,
programId, templateId = '', hasAcceptedTAndC = false, detailsPayload = null, replaceUrl = true }) {
programId, templateId = '', hasAcceptedTAndC = false, detailsPayload = null, replaceUrl = true ,certificate}) {
this.loader.startLoader();
let payload = isProfileInfoRequired ? await this.utils.getProfileInfo() : {};
const url = `${projectId ? '/' + projectId : ''}?${templateId ? 'templateId=' + encodeURIComponent(templateId) : ''}${solutionId ? ('&&solutionId=' + solutionId) : ''}`;
Expand All @@ -87,6 +87,13 @@ export class ProjectService {
this.loader.stopLoader();
success.result.hasAcceptedTAndC = hasAcceptedTAndC;
let projectDetails = success.result;
if(certificate){
const request = { type:'project',name:projectDetails.title, project: projectDetails._id, certificate: projectDetails.certificate, templateUrl : projectDetails.certificate.templateUrl };
this.router.navigate([`/${RouterLinks.PROFILE}/${RouterLinks.CERTIFICATE_VIEW}`], {
state: { request }
});
return;
}
let newCategories = [];
for (const category of projectDetails.categories) {
if (category._id || category.name) {
Expand Down Expand Up @@ -301,7 +308,8 @@ export class ProjectService {
programId: programId,
solutionId: solutionId,
replaceUrl: false,
hasAcceptedTAndC: hasAcceptedTAndC
hasAcceptedTAndC: hasAcceptedTAndC,
certificate:false
}
this.getProjectDetails(params)
})
Expand Down Expand Up @@ -344,6 +352,9 @@ export class ProjectService {
});
await alert.present();
}else{
if(project.status == statusType['submitted']){
type == 'shareTask' ? this.getPdfUrl(name, taskId) : this.getPdfUrl(project.title);
}else
if (project.isEdit || project.isNew) {
project.isNew
? this.createNewProject(project, true)
Expand Down
3 changes: 2 additions & 1 deletion src/app/manage-learn/core/services/utils.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -528,9 +528,10 @@ export class UtilsService {
? this.requiredFields + " in"
: ""
} your profile to access the feature.`,
cssClass:'central-alert',
buttons: [
{
text: "Update Profile",
text: "Update profile",
role: "cancel",
handler: blah => {
this.router.navigate([`${RouterLinks.HOME}`], {replaceUrl:true});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,6 @@ export class DomainEcmLsitingComponent {

async openAction(assessment, evidenceIndex) {
this.utils.setCurrentimageFolderName(this.entityEvidences[evidenceIndex].externalId, assessment._id);
const options = {
_id: assessment._id,
name: assessment.name,
selectedEvidence: evidenceIndex,
entityDetails: this.entityData,
};
return 'view'
}

Expand All @@ -190,8 +184,6 @@ export class DomainEcmLsitingComponent {
this.evidenceSections = this.currentEvidence['sections'];
this.checkForEvidenceCompletion();
} else {
const entity = { _id: this.submissionId, name: this.entityName };
let action = this.submissionId ? await this.openAction(entity, evidenceIndex) : null;
this.selectedEvidenceIndex = evidenceIndex;
this.currentEvidence = this.entityData['assessment']['evidences'][this.selectedEvidenceIndex];
this.evidenceSections = this.currentEvidence['sections'];
Expand Down Expand Up @@ -234,19 +226,6 @@ export class DomainEcmLsitingComponent {
}

async goToQuestioner(selectedSection) {
const params = {
_id: this.submissionId,
name: this.entityName,
selectedEvidence: this.selectedEvidenceIndex,
selectedSection: selectedSection,
};
// //
// if (!this.entityEvidences[this.selectedEvidenceIndex].startTime) {
// const entity = { _id: this.submissionId, name: this.entityName };
// let action = await this.openAction(entity, this.selectedEvidenceIndex);
// }

// //
if (!this.evidenceSections[selectedSection].progressStatus && this.submissionId) {
this.evidenceSections[selectedSection].progressStatus = this.currentEvidence.startTime ? 'inProgress' : '';
this.localStorage.setLocalStorage(this.utils.getAssessmentLocalStorageKey(this.submissionId), this.entityData);
Expand Down
Loading