diff --git a/library/ws-widget/collection/src/lib/_common/tips-for-learner/tips-for-learner-card/tips-for-learner-card.component.html b/library/ws-widget/collection/src/lib/_common/tips-for-learner/tips-for-learner-card/tips-for-learner-card.component.html new file mode 100644 index 0000000000..a9d017fc01 --- /dev/null +++ b/library/ws-widget/collection/src/lib/_common/tips-for-learner/tips-for-learner-card/tips-for-learner-card.component.html @@ -0,0 +1,30 @@ +
+
+
+ +
+
+
+

Tips for Learners

+ +
+
+
+ {{randomlearnAdvisoryObj?.content}} +
+
+

{{randomlearnAdvisoryObj?.content}}

+
+
+ {{randomlearnAdvisoryObj?.id}}/{{learnAdvisoryData?.length}} +
+
+
\ No newline at end of file diff --git a/library/ws-widget/collection/src/lib/_common/tips-for-learner/tips-for-learner-card/tips-for-learner-card.component.scss b/library/ws-widget/collection/src/lib/_common/tips-for-learner/tips-for-learner-card/tips-for-learner-card.component.scss new file mode 100644 index 0000000000..ed5eb050c3 --- /dev/null +++ b/library/ws-widget/collection/src/lib/_common/tips-for-learner/tips-for-learner-card/tips-for-learner-card.component.scss @@ -0,0 +1,128 @@ +.tips-container { + background-color: #F9CB97; + padding: 16px; + padding-bottom: 0px; + border-radius: 8px; + display: flex; + flex-direction: column; + justify-content: space-between; + margin-bottom: 1rem; + overflow: hidden; + width: 385px; + box-sizing: border-box; + + + } + + @media screen and (max-width: 1000px) { + .tips-container { + width: 100%; + + } + } + + .tips-header { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 8px; + z-index: 10; + } + + .tips-header h3 { + margin: 0; + font-size: 1.2em; + color: #000000; + font-family: Montserrat; + font-size: 16px; + z-index: 10; + } + + .tips-header button { + background: none; + border: none; + color: #01468f; + cursor: pointer; + font-family: Lato; + font-size: 14px; + z-index: 10; + } + + .tip-content { + display: flex; + justify-content: space-between; + z-index: 10; + padding-top: 6px; + margin-bottom: 8px; + } + + .tip-content p { + margin-left: 8px; + color: #000000; + font-family: Lato; + font-size: 14px; + z-index: 10; + padding: 0px 4px; + line-height: 16px; + } + + .tip-count { + display: flex; + justify-content: center; + align-items: center; + color: #000000; + font-family: Montserrat !important; + font-size: 16px !important; + padding: 10px 3px; + z-index: 10; + font-weight: 600; + line-height: 19.5px; + width: 45px; + } + + .tip-data { + width: calc(100% - 110px); + } + + + .background-circle { + position: absolute; + z-index: 1; + right: -6.5em; + top: 2.8em; + width: 178px; + height: 178px; + border-radius: 100%; + background-color: #fcd2a3; + } + + .circle-box { + position: relative; + width: 100%; + height: 0px; + } + + .book-icon { + width: 32px; + height: 32px; + padding: 5px; + } + + .background { + background-color: white; + width: 56px; + height: 42px; + border-radius: 5px; + text-align: center; + } + .view-more { + display: flex; + align-items: center; + text-align: center; + height: 40px; + justify-content: center; + } + + .view-more:hover { + background-color: #DCDFE5; + } \ No newline at end of file diff --git a/library/ws-widget/collection/src/lib/_common/tips-for-learner/tips-for-learner-card/tips-for-learner-card.component.spec.ts b/library/ws-widget/collection/src/lib/_common/tips-for-learner/tips-for-learner-card/tips-for-learner-card.component.spec.ts new file mode 100644 index 0000000000..86378221a3 --- /dev/null +++ b/library/ws-widget/collection/src/lib/_common/tips-for-learner/tips-for-learner-card/tips-for-learner-card.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { TipsForLearnerCardComponent } from './tips-for-learner-card.component'; + +describe('TipsForLearnerCardComponent', () => { + let component: TipsForLearnerCardComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ TipsForLearnerCardComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(TipsForLearnerCardComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/library/ws-widget/collection/src/lib/_common/tips-for-learner/tips-for-learner-card/tips-for-learner-card.component.ts b/library/ws-widget/collection/src/lib/_common/tips-for-learner/tips-for-learner-card/tips-for-learner-card.component.ts new file mode 100644 index 0000000000..f434983630 --- /dev/null +++ b/library/ws-widget/collection/src/lib/_common/tips-for-learner/tips-for-learner-card/tips-for-learner-card.component.ts @@ -0,0 +1,31 @@ +import { Component, Input, OnInit } from '@angular/core' +import { Router } from '@angular/router' + +@Component({ + selector: 'ws-widget-tips-for-learner-card', + templateUrl: './tips-for-learner-card.component.html', + styleUrls: ['./tips-for-learner-card.component.scss'], +}) +export class TipsForLearnerCardComponent implements OnInit { + randomlearnAdvisoryObj: any + learnAdvisoryDataLength: any + @Input() learnAdvisoryData: any + constructor(private router: Router) { } + + ngOnInit() { + this.displayRandomlearnAdvisoryData() + } + + displayRandomlearnAdvisoryData(): void { + if (this.learnAdvisoryData && this.learnAdvisoryData.length) { + const randomIndex = Math.floor(Math.random() * this.learnAdvisoryData.length) + this.randomlearnAdvisoryObj = this.learnAdvisoryData[randomIndex] + } + + } + + showAllTips() { + this.router.navigate(['/learner-advisory']) + } + +} diff --git a/library/ws-widget/collection/src/lib/_common/tips-for-learner/tips-for-learner.module.ts b/library/ws-widget/collection/src/lib/_common/tips-for-learner/tips-for-learner.module.ts new file mode 100644 index 0000000000..4cd47cfba5 --- /dev/null +++ b/library/ws-widget/collection/src/lib/_common/tips-for-learner/tips-for-learner.module.ts @@ -0,0 +1,18 @@ +import { NgModule } from '@angular/core' +import { CommonModule } from '@angular/common' +import { TipsForLearnerCardComponent } from './tips-for-learner-card/tips-for-learner-card.component' +import { MatIconModule } from '@angular/material' +import { TranslateModule } from '@ngx-translate/core' + +@NgModule({ + declarations: [TipsForLearnerCardComponent], + imports: [ + CommonModule, + MatIconModule, + TranslateModule, + ], + exports: [ + TipsForLearnerCardComponent, + ], +}) +export class TipsForLearnerModule { } diff --git a/library/ws-widget/collection/src/lib/_services/widget-content.service.ts b/library/ws-widget/collection/src/lib/_services/widget-content.service.ts index 4bf75bfc01..14b6f6cb2c 100644 --- a/library/ws-widget/collection/src/lib/_services/widget-content.service.ts +++ b/library/ws-widget/collection/src/lib/_services/widget-content.service.ts @@ -462,21 +462,22 @@ export class WidgetContentService { async getResourseLink(content: any) { const enrolledCourseData: any = this.getEnrolledData(content.identifier) if (enrolledCourseData) { - if (enrolledCourseData.content.courseCategory === NsContent.ECourseCategory.BLENDED_PROGRAM || - enrolledCourseData.content.courseCategory === NsContent.ECourseCategory.INVITE_ONLY_PROGRAM || - enrolledCourseData.content.courseCategory === NsContent.ECourseCategory.MODERATED_PROGRAM || - enrolledCourseData.content.primaryCategory === NsContent.EPrimaryCategory.BLENDED_PROGRAM || - enrolledCourseData.content.primaryCategory === NsContent.EPrimaryCategory.PROGRAM) { - if (!this.isBatchInProgress(enrolledCourseData.batch)) { - return this.gotoTocPage(content) - } + if (enrolledCourseData && enrolledCourseData.content && enrolledCourseData.content.status && + enrolledCourseData.content.status.toLowerCase() !== 'retired') { + if (enrolledCourseData.content.courseCategory === NsContent.ECourseCategory.BLENDED_PROGRAM || + enrolledCourseData.content.courseCategory === NsContent.ECourseCategory.INVITE_ONLY_PROGRAM || + enrolledCourseData.content.courseCategory === NsContent.ECourseCategory.MODERATED_PROGRAM || + enrolledCourseData.content.primaryCategory === NsContent.EPrimaryCategory.BLENDED_PROGRAM || + enrolledCourseData.content.primaryCategory === NsContent.EPrimaryCategory.PROGRAM) { + if (!this.isBatchInProgress(enrolledCourseData.batch)) { + return this.gotoTocPage(content) + } + } else { const data = await this.checkForDataToFormUrl(content, enrolledCourseData) return data - } { - const data = await this.checkForDataToFormUrl(content, enrolledCourseData) - return data + } } - + return '' } return this.gotoTocPage(content) diff --git a/library/ws-widget/collection/src/lib/btn-page-back/btn-page-back.component.html b/library/ws-widget/collection/src/lib/btn-page-back/btn-page-back.component.html index 3369fff6c2..169fa9d336 100644 --- a/library/ws-widget/collection/src/lib/btn-page-back/btn-page-back.component.html +++ b/library/ws-widget/collection/src/lib/btn-page-back/btn-page-back.component.html @@ -24,12 +24,7 @@ {{ title?.title }} - +
diff --git a/library/ws-widget/collection/src/lib/btn-profile/btn-profile.component.ts b/library/ws-widget/collection/src/lib/btn-profile/btn-profile.component.ts index db1ac6813a..7ca28c779c 100644 --- a/library/ws-widget/collection/src/lib/btn-profile/btn-profile.component.ts +++ b/library/ws-widget/collection/src/lib/btn-profile/btn-profile.component.ts @@ -229,7 +229,7 @@ export class BtnProfileComponent extends WidgetBaseComponent } redirectToLearnersPage() { this.raiseTelemetry('Tips For Learners') - this.router.navigate(['/public/learner-advisory']) + this.router.navigate(['/learner-advisory']) } // rasieProfileMenuTelemetry(tabname: string) { diff --git a/library/ws-widget/collection/src/lib/card-content-v2/card-content-v2.component.html b/library/ws-widget/collection/src/lib/card-content-v2/card-content-v2.component.html index 50c3a1f77e..1212521732 100644 --- a/library/ws-widget/collection/src/lib/card-content-v2/card-content-v2.component.html +++ b/library/ws-widget/collection/src/lib/card-content-v2/card-content-v2.component.html @@ -1099,8 +1099,8 @@

{{'cardcon - -
+ +
video_library {{'cardcon
-
+
diff --git a/library/ws-widget/collection/src/lib/card-content-v2/card-content-v2.component.scss b/library/ws-widget/collection/src/lib/card-content-v2/card-content-v2.component.scss index 9403ae5b8d..b827b39237 100644 --- a/library/ws-widget/collection/src/lib/card-content-v2/card-content-v2.component.scss +++ b/library/ws-widget/collection/src/lib/card-content-v2/card-content-v2.component.scss @@ -1753,4 +1753,8 @@ $title-line-count: 2; } .card-standard-container:hover { transform: scale(1.02); +} +.retiredCards { + opacity: 0.5; + cursor: default; } \ No newline at end of file diff --git a/library/ws-widget/collection/src/lib/card-content-v2/card-content-v2.component.ts b/library/ws-widget/collection/src/lib/card-content-v2/card-content-v2.component.ts index 8d6b14cb19..7194e1a2e9 100644 --- a/library/ws-widget/collection/src/lib/card-content-v2/card-content-v2.component.ts +++ b/library/ws-widget/collection/src/lib/card-content-v2/card-content-v2.component.ts @@ -418,6 +418,7 @@ export class CardContentV2Component extends WidgetBaseComponent } } async getRedirectUrlData(content: any,contentType?:any){ + const contentCategory = content && content.primaryCategory ? content.primaryCategory : 'Content' if(contentType) { this.router.navigate([`/app/gyaan-karmayogi/player/${VIEWER_ROUTE_FROM_MIME(content.mimeType)}/${content.identifier}`],{ queryParams : { @@ -426,14 +427,19 @@ export class CardContentV2Component extends WidgetBaseComponent } }) } else { - let urlData = await this.contSvc.getResourseLink(content) - this.router.navigate( - [urlData.url], - { - queryParams: urlData.queryParams - }) + // if (content && content.status && content.status.toLowerCase() !== 'retired') { + let urlData = await this.contSvc.getResourseLink(content) + if (urlData && urlData.url ) { + this.router.navigate( + [urlData.url], + { + queryParams: urlData.queryParams + }) + } else { + // const contentType = urlData; + this.snackBar.open(`This ${contentCategory} has been archived and is no longer available.`, 'X', { duration: 2000 }); + } } - } diff --git a/library/ws-widget/collection/src/lib/content-strip-with-tabs/content-strip-with-tabs.component.ts b/library/ws-widget/collection/src/lib/content-strip-with-tabs/content-strip-with-tabs.component.ts index 74919e4179..005008bbe2 100644 --- a/library/ws-widget/collection/src/lib/content-strip-with-tabs/content-strip-with-tabs.component.ts +++ b/library/ws-widget/collection/src/lib/content-strip-with-tabs/content-strip-with-tabs.component.ts @@ -324,9 +324,15 @@ export class ContentStripWithTabsComponent extends WidgetBaseComponent let contentNew: NsContent.IContent[] let tabResults: any[] = [] const queryParams = _.get(strip.request.enrollmentList, 'queryParams') + // if (queryParams && queryParams.batchDetails) { + // if (!queryParams.batchDetails.includes('&retiredCoursesEnabled=true')) { + // queryParams.batchDetails += '&retiredCoursesEnabled=true' + // } + // } if (this.configSvc.userProfile) { userId = this.configSvc.userProfile.userId } + // this.userSvc.resetTime('enrollmentService') // tslint:disable-next-line: deprecation this.userSvc.fetchUserBatchList(userId, queryParams).subscribe( (result: any) => { @@ -445,7 +451,36 @@ export class ContentStripWithTabsComponent extends WidgetBaseComponent strip: NsContentStripWithTabs.IContentStripUnit) { const inprogress: any[] = [] const completed: any[] = [] - array.forEach((e: any, idx: number, arr: any[]) => (customFilter(e, idx, arr) ? inprogress : completed).push(e)) + // array.forEach((e: any, idx: number, arr: any[]) => (customFilter(e, idx, arr) ? inprogress : completed).push(e)) + array.forEach((e, idx, arr) => { + const status = e.status ? (e.status as string).toLowerCase() : '' + const statusRetired = status === 'retired' + if (customFilter(e, idx, arr)) { + if (!statusRetired) { + inprogress.push(e) + } + } else { + completed.push(e) + } + }) + // Sort the completed array with 'Live' status first and 'Retired' status second + completed.sort((a: any, b: any) => { + const statusA = a.status ? a.status.toLowerCase() : '' + const statusB = b.status ? b.status.toLowerCase() : '' + if (statusA === 'live' && statusB !== 'live') { + return -1 + } + if (statusA !== 'live' && statusB === 'live') { + return 1 + } + if (statusA === 'retired' && statusB !== 'retired') { + return 1 + } + if (statusA !== 'retired' && statusB === 'retired') { + return -1 + } + return 0 + }) return [ { value: 'inprogress', widgets: this.transformContentsToWidgets(inprogress, strip) }, { value: 'completed', widgets: this.transformContentsToWidgets(completed, strip) }] diff --git a/library/ws-widget/collection/src/lib/grid-layout/grid-layout.component.html b/library/ws-widget/collection/src/lib/grid-layout/grid-layout.component.html index 1d16186ebb..43934fbc11 100644 --- a/library/ws-widget/collection/src/lib/grid-layout/grid-layout.component.html +++ b/library/ws-widget/collection/src/lib/grid-layout/grid-layout.component.html @@ -5,12 +5,12 @@
- + diff --git a/project/ws/app/src/lib/routes/app-toc/components/app-toc-cios-home/app-toc-cios-home.component.scss b/project/ws/app/src/lib/routes/app-toc/components/app-toc-cios-home/app-toc-cios-home.component.scss index bee1f40b71..bc583282a3 100644 --- a/project/ws/app/src/lib/routes/app-toc/components/app-toc-cios-home/app-toc-cios-home.component.scss +++ b/project/ws/app/src/lib/routes/app-toc/components/app-toc-cios-home/app-toc-cios-home.component.scss @@ -808,4 +808,15 @@ mat-divider { ul{ padding: 0 !important; +} + +.kpi-values { + min-width: 64px; + padding: 8px; + text-align: center; +} + +.kpi-values[_ngcontent-feq-c30] img[_ngcontent-feq-c30] { + height: 24px; + width: 24px; } \ No newline at end of file diff --git a/project/ws/app/src/lib/routes/app-toc/components/app-toc-cios-home/app-toc-cios-home.component.ts b/project/ws/app/src/lib/routes/app-toc/components/app-toc-cios-home/app-toc-cios-home.component.ts index 04ea591171..aaae1fa1e6 100644 --- a/project/ws/app/src/lib/routes/app-toc/components/app-toc-cios-home/app-toc-cios-home.component.ts +++ b/project/ws/app/src/lib/routes/app-toc/components/app-toc-cios-home/app-toc-cios-home.component.ts @@ -2,7 +2,7 @@ import { AfterViewInit, Component, ElementRef, HostListener, OnInit, ViewChild } import { ActivatedRoute } from '@angular/router' import { TranslateService } from '@ngx-translate/core' import { CommonMethodsService } from '@sunbird-cb/consumption' -import { MultilingualTranslationsService } from '@sunbird-cb/utils-v2' +import { ConfigurationsService, MultilingualTranslationsService } from '@sunbird-cb/utils-v2' @Component({ selector: 'ws-app-app-toc-cios-home', @@ -42,6 +42,7 @@ export class AppTocCiosHomeComponent implements OnInit, AfterViewInit { constructor(private route: ActivatedRoute, private commonSvc: CommonMethodsService, private translate: TranslateService, + private configSvc: ConfigurationsService, private langtranslations: MultilingualTranslationsService, ) { this.route.data.subscribe((data: any) => { @@ -75,5 +76,12 @@ export class AppTocCiosHomeComponent implements OnInit, AfterViewInit { this.rcElem.offSetTop = this.rcElement.nativeElement.offsetTop } } - + redirectToContent(contentData: any) { + const userData: any = this.configSvc.userProfileV2 + const extUrl: string = contentData.redirectUrl.replace('', userData.email) + return extUrl + } + replaceText(str: any, replaceTxt: any) { + return str.replaceAll(replaceTxt, '') + } } diff --git a/project/ws/app/src/lib/routes/app-toc/components/app-toc-home/app-toc-home.component.html b/project/ws/app/src/lib/routes/app-toc/components/app-toc-home/app-toc-home.component.html index 8167309465..a0892326a2 100755 --- a/project/ws/app/src/lib/routes/app-toc/components/app-toc-home/app-toc-home.component.html +++ b/project/ws/app/src/lib/routes/app-toc/components/app-toc-home/app-toc-home.component.html @@ -409,11 +409,18 @@ +
+
+ +
+
+
+
@@ -621,27 +628,12 @@
-
-
-
- -
-
-
-

Tips for Learners

- -
-
-
- Use the new section Gyaan Karmayogi regularly, to go over case studies and other learning material. -
-

{{'learnerAdvisory.useGyaanKarmayogi' | translate}}

-
- 1/13 -
-
-
+
+ +
+
+ +

diff --git a/project/ws/app/src/lib/routes/app-toc/components/app-toc-home/app-toc-home.component.scss b/project/ws/app/src/lib/routes/app-toc/components/app-toc-home/app-toc-home.component.scss index c4d145c506..edf0b79fc4 100755 --- a/project/ws/app/src/lib/routes/app-toc/components/app-toc-home/app-toc-home.component.scss +++ b/project/ws/app/src/lib/routes/app-toc/components/app-toc-home/app-toc-home.component.scss @@ -40,7 +40,7 @@ background-color: $colorGreen; border: 1px solid $colorGreen; } - + .rating-chip { border: 1px solid rgba($color: #000000, $alpha: 0.6); border-radius: 20px; @@ -127,7 +127,7 @@ background-color: #ccc; border-top-left-radius: 12px; border-top-right-radius: 12px; - + img { max-width: 384px; width: 100%; @@ -180,13 +180,18 @@ } .right-content { - background-color: #FFF; - border-radius: 12px; + position: fixed; z-index: 10; top: 132px; + padding-bottom: 1rem; + } + + .right-content-inner { + background-color: #FFF; + border-radius: 12px; width: 384px; - margin-bottom: 2rem; + margin-bottom: 1rem; box-shadow: 0 2px 6px -1px rgba(0, 0, 0, 0.5), 0 -4px 4px -2px rgba(0, 0, 0, 0.5); } @@ -194,13 +199,25 @@ border-bottom: 1px solid rgba($color: #000, $alpha: 0.2); } + .view-more { + display: flex; + align-items: center; + text-align: center; + height: 40px; + justify-content: center; + } + + .view-more:hover { + background-color: #DCDFE5; + } + .info-div { background-color: #FEF7ED; border: none; border-radius: 8px; padding: 8px 12px; font-size: 14px; - + .mat-icon { width: 18px; height: 18px; @@ -218,7 +235,7 @@ height: 20px; } } - + } .batch-info { @@ -234,110 +251,24 @@ line-height: 1rem; } } -.tips-container { - background-color: #F9CB97; - padding: 16px; - padding-bottom: 0px; - border-radius: 8px; - display: flex; - flex-direction: column; - justify-content: space-between; - margin-bottom: 20px; - overflow: hidden; - position: fixed; - top: 560px; - left: 1166px; - width: 358px; -} - -.tips-header { - display: flex; - justify-content: space-between; - align-items: center; - margin-bottom: 8px; - z-index: 10; -} - -.tips-header h3 { - margin: 0; - font-size: 1.2em; - color: #000000; - font-family: Montserrat; - font-size: 16px; - z-index: 10; -} - -.tips-header button { - background: none; - border: none; - color: #01468f; - cursor: pointer; - font-family: Lato; - font-size: 14px; - z-index: 10; -} - -.tip-content { - display: flex; - justify-content: space-between; - align-items: center; - z-index: 10; -} - -.tip-content p { - margin-left: 10px; - color: #000000; - font-family: Lato; - font-size: 14px; - z-index: 10; - padding: 5px; - line-height: 16.8px; -} -.tip-count { - display: flex; - justify-content: center; - align-items: center; - color: #000000; - font-family : Montserrat !important; - font-size: 16px !important; - padding: 10px 3px; - align-self: flex-end; - border-radius: 50% 0 0 50%; - z-index: 10; - font-weight: 600; - line-height: 19.5px; -} - -.background-circle { - position: absolute; - z-index: 1; - right: -6.5em; - top: 2.8em; - width: 178px; - height: 178px; - border-radius: 100%; - background-color: #fcd2a3; + +.mob-tip-for-learner { + display: none; } -.circle-box { - position: relative; +@media screen and (max-width: 1000px) { + .mob-tip-for-learner { + display: block; width: 100%; - height: 0px; -} + padding: 0px 16px; + overflow: hidden; + box-sizing: border-box; -.book-icon{ - width: 32px; - height: 32px; - padding: 5px; -} -.background{ - background-color: white; - width: 56px; - height: 42px; - border-radius: 5px; + } } + .button { border-radius: 64px; letter-spacing: 0.25px; @@ -395,7 +326,7 @@ .confirmation-modal { max-width: 420px !important; width: 100% !important; - + .mat-dialog-container { border-radius: 12px; padding: 0px; @@ -408,7 +339,7 @@ &::after { -webkit-backdrop-filter: blur(5px); - /* Use for Safari 9+, Edge 17+ (not a mistake) and iOS Safari 9.2+ */ + /* Use for Safari 9+, Edge 17+ (not a mistake) and iOS Safari 9.2+ */ backdrop-filter: blur(5px); content: ""; display: block; @@ -424,7 +355,9 @@ } @media screen and (max-width: 1000px) { - .confirmation-modal, .enroll-modal { + + .confirmation-modal, + .enroll-modal { max-width: 90vw !important; } } @@ -466,7 +399,9 @@ a.action-button { } @media screen and (min-width: 1201px) { - .mobile-enroll-div, .mob-share { + + .mobile-enroll-div, + .mob-share { display: none !important; } @@ -486,6 +421,7 @@ a.action-button { } $title-line-count: 2; + .sourceEllipsis { white-space: break-spaces; position: relative; @@ -501,12 +437,13 @@ $title-line-count: 2; %container-padding { padding: $size-xl 2 * $size-xl; + @include breakpoint-xs { padding: $size-m $size-l; } } -.text-white{ +.text-white { color: #fff !important; } @@ -586,8 +523,8 @@ mat-divider { } } -.blue-border{ - border: 2px solid #0074b6 !important; +.blue-border { + border: 2px solid #0074b6 !important; } .hidden-xs-inline { @@ -622,21 +559,23 @@ mat-divider { width: 100%; } } + .font-bold-imp { font-weight: 700 !important; } + .info-section { width: 20%; min-width: 250px; - .custom-button{ + .custom-button { background: #0074B6 0% 0% no-repeat padding-box !important; border-radius: 4px; } @include breakpoint-xs { width: 100%; - margin-left: 0!important; + margin-left: 0 !important; } .glance-container { @@ -652,6 +591,7 @@ mat-divider { vertical-align: middle; font-size: 20px; } + img { width: 20px; height: 20px; @@ -746,7 +686,7 @@ mat-divider { background: transparent; margin-bottom: 24px; } - + .author-card { min-width: 291px; width: 291px; @@ -824,8 +764,8 @@ mat-divider { top: auto; } -.actbutton{ - border: 1px solid rgba(0,0,0,0.16); +.actbutton { + border: 1px solid rgba(0, 0, 0, 0.16); border-radius: 4px; padding: 0 15px; width: 100%; @@ -833,7 +773,7 @@ mat-divider { overflow: hidden !important; text-overflow: ellipsis !important; - .mat-icon{ + .mat-icon { margin-right: 6px; } } @@ -854,7 +794,7 @@ mat-divider { .cb-plan-wrap { opacity: 1; - color: rgba(27,76,161,1); + color: rgba(27, 76, 161, 1); font-family: "Lato-Regular"; font-size: 12px; font-weight: 400; @@ -868,9 +808,9 @@ mat-divider { padding: 4px 8px; border: 1px solid #d13924; background-color: #d13924 !important; - color: rgba(255,255,255,1) !important; + color: rgba(255, 255, 255, 1) !important; opacity: 1; - + } .cb-success { @@ -878,7 +818,7 @@ mat-divider { border-radius: 2px; border: 1px solid #1d8922; background-color: #1d8922 !important; - color: rgba(255,255,255,1) !important; + color: rgba(255, 255, 255, 1) !important; opacity: 1; } @@ -887,10 +827,11 @@ mat-divider { border-radius: 2px; border: 1px solid #ef951e; background-color: #ef951e !important; - color: rgba(255,255,255,1) !important; + color: rgba(255, 255, 255, 1) !important; opacity: 1; } } + .bg-white { background-color: white; } diff --git a/project/ws/app/src/lib/routes/app-toc/components/app-toc-home/app-toc-home.component.ts b/project/ws/app/src/lib/routes/app-toc/components/app-toc-home/app-toc-home.component.ts index 4621083fb0..9c238f55ae 100755 --- a/project/ws/app/src/lib/routes/app-toc/components/app-toc-home/app-toc-home.component.ts +++ b/project/ws/app/src/lib/routes/app-toc/components/app-toc-home/app-toc-home.component.ts @@ -193,6 +193,10 @@ export class AppTocHomeComponent implements OnInit, OnDestroy, AfterViewChecked, rootOrgId: any certId: any mobile1200: any + assessmentStrip: any + learnAdvisoryData: any + // randomlearnAdvisoryObj: any + // learnAdvisoryDataLength: any @HostListener('window:scroll', ['$event']) handleScroll() { @@ -290,7 +294,15 @@ export class AppTocHomeComponent implements OnInit, OnDestroy, AfterViewChecked, } } }) + + if (this.route.snapshot.data.pageData && this.route.snapshot.data.pageData.data) { + this.learnAdvisoryData = this.route.snapshot.data.pageData.data.learnerAdvisory + // this.learnAdvisoryDataLength = this.learnAdvisoryData.length + + } + this.getServerDateTime() + // this.displayRandomlearnAdvisoryData() this.selectedBatchSubscription = this.tocSvc.getSelectedBatch.subscribe(batchData => { this.selectedBatchData = batchData @@ -441,6 +453,11 @@ export class AppTocHomeComponent implements OnInit, OnDestroy, AfterViewChecked, } } + // displayRandomlearnAdvisoryData(): void { + // const randomIndex = Math.floor(Math.random() * this.learnAdvisoryData.length) + // this.randomlearnAdvisoryObj = this.learnAdvisoryData[randomIndex] + // } + getKarmapointsLimit() { if (!this.forPreview) { this.contentSvc.userKarmaPoints().subscribe((res: any) => { @@ -652,9 +669,10 @@ export class AppTocHomeComponent implements OnInit, OnDestroy, AfterViewChecked, get getStartDate() { if (this.content) { + const now = moment(this.serverDate).format('YYYY-MM-DD') const batch = _.first(_.filter(this.content['batches'], { batchId: this.currentCourseBatchId }) || []) if (_.get(batch, 'startDate') && moment(_.get(batch, 'startDate')).isAfter()) { - return moment(_.get(batch, 'startDate')).fromNow() + return moment(_.get(batch, 'startDate')).from(now) } if (_.get(batch, 'endDate') && moment(_.get(batch, 'endDate')).isBefore()) { return 'NA' @@ -1830,7 +1848,5 @@ export class AppTocHomeComponent implements OnInit, OnDestroy, AfterViewChecked, programEnrollCall(batchData: any) { this.autoEnrollCuratedProgram(NsContent.ECourseCategory.MODERATED_PROGRAM, batchData) } - showAllTips() { - this.router.navigate(['public/learner-advisory']); - } + } diff --git a/project/ws/app/src/lib/routes/karma-programs/karma-programs-microsite/karma-programs-microsite.component.html b/project/ws/app/src/lib/routes/karma-programs/karma-programs-microsite/karma-programs-microsite.component.html index e516169b67..118c5eea8d 100644 --- a/project/ws/app/src/lib/routes/karma-programs/karma-programs-microsite/karma-programs-microsite.component.html +++ b/project/ws/app/src/lib/routes/karma-programs/karma-programs-microsite/karma-programs-microsite.component.html @@ -38,6 +38,13 @@

{{data.title || programName}}

{{data?.description | slice:0:descriptionMaxLength}} ...

+ + +

+ {{ref?.label}} : {{'contentstripmultiple.clickHere' | translate}} +

+
+
@@ -64,6 +71,14 @@

{{data?.title}}

{{data?.description | slice:0:descriptionMaxLength}} ...

+ + +

+ {{ref?.label}} : {{'contentstripmultiple.clickHere' | translate}} +

+
+
+ diff --git a/project/ws/app/src/lib/routes/karma-programs/karma-programs-microsite/karma-programs-microsite.component.scss b/project/ws/app/src/lib/routes/karma-programs/karma-programs-microsite/karma-programs-microsite.component.scss index b80cc9c2e0..877b6cebdb 100644 --- a/project/ws/app/src/lib/routes/karma-programs/karma-programs-microsite/karma-programs-microsite.component.scss +++ b/project/ws/app/src/lib/routes/karma-programs/karma-programs-microsite/karma-programs-microsite.component.scss @@ -93,4 +93,12 @@ .zindex { z-index: 99 + } + + .ref-links { + font-weight: 700 !important; + text-decoration: underline !important; + color: #F3962F !important; + position: relative; + z-index: 999999; } \ No newline at end of file diff --git a/project/ws/app/src/lib/routes/see-all/components/see-all-home/see-all-home.component.ts b/project/ws/app/src/lib/routes/see-all/components/see-all-home/see-all-home.component.ts index 4baf0bd7a9..d6b742b1e7 100644 --- a/project/ws/app/src/lib/routes/see-all/components/see-all-home/see-all-home.component.ts +++ b/project/ws/app/src/lib/routes/see-all/components/see-all-home/see-all-home.component.ts @@ -176,7 +176,35 @@ export class SeeAllHomeComponent implements OnInit, OnDestroy { strip: NsContentStripWithTabs.IContentStripUnit) { const inprogress: any[] = [] const completed: any[] = [] - array.forEach((e: any, idx: number, arr: any[]) => (customFilter(e, idx, arr) ? inprogress : completed).push(e)) + array.forEach((e, idx, arr) => { + const status = e.status ? (e.status as string).toLowerCase() : '' + const statusRetired = status === 'retired' + if (customFilter(e, idx, arr)) { + if (!statusRetired) { + inprogress.push(e) + } + } else { + completed.push(e) + } + }) + // Sort the completed array with 'live' status first and 'Retired' status second + completed.sort((a: any, b: any) => { + const statusA = a.status ? a.status.toLowerCase() : '' + const statusB = b.status ? b.status.toLowerCase() : '' + if (statusA === 'live' && statusB !== 'live') { + return -1 + } + if (statusA !== 'live' && statusB === 'live') { + return 1 + } + if (statusA === 'retired' && statusB !== 'retired') { + return 1 + } + if (statusA !== 'retired' && statusB === 'retired') { + return -1 + } + return 0 + }) return [ { value: 'inprogress', widgets: this.transformContentsToWidgets(inprogress, strip) }, { value: 'completed', widgets: this.transformContentsToWidgets(completed, strip) }] @@ -247,10 +275,16 @@ export class SeeAllHomeComponent implements OnInit, OnDestroy { let contentNew: NsContent.IContent[] this.tabResults = [] const queryParams = _.get(strip.request.enrollmentList, 'queryParams') + // if (queryParams && queryParams.batchDetails) { + // if (!queryParams.batchDetails.includes('&retiredCoursesEnabled=true')) { + // queryParams.batchDetails += '&retiredCoursesEnabled=true' + // } + // } if (this.configSvc.userProfile) { userId = this.configSvc.userProfile.userId } // tslint:disable-next-line: deprecation + // this.userSvc.resetTime('enrollmentService') this.userSvc.fetchUserBatchList(userId, queryParams).subscribe( (result: any) => { const courses = result && result.courses diff --git a/project/ws/app/src/lib/routes/see-all/components/see-all-with-pills/see-all-with-pills.component.html b/project/ws/app/src/lib/routes/see-all/components/see-all-with-pills/see-all-with-pills.component.html new file mode 100644 index 0000000000..e8f3191e05 --- /dev/null +++ b/project/ws/app/src/lib/routes/see-all/components/see-all-with-pills/see-all-with-pills.component.html @@ -0,0 +1,46 @@ +
+ + +
+
+ +
+
+
+ + + + {{translateLabels(tab?.label,'seeAllHome')}}   + ({{tab?.widgets?.length}}) + +
+
+ + + + + {{pill?.label}} + + + +
+
+
+ +
+
+
+
+
+
+
+
diff --git a/project/ws/app/src/lib/routes/see-all/components/see-all-with-pills/see-all-with-pills.component.scss b/project/ws/app/src/lib/routes/see-all/components/see-all-with-pills/see-all-with-pills.component.scss new file mode 100644 index 0000000000..f2e1b3a4ae --- /dev/null +++ b/project/ws/app/src/lib/routes/see-all/components/see-all-with-pills/see-all-with-pills.component.scss @@ -0,0 +1,30 @@ +.seeAll-home-container { + max-width: 1200px; +} +.page-header { + font-size: 16px; + font-weight: bold; +} +@media only screen and (max-width: 768px) { + .seeAll-home-container { + // margin-top: 192px; + flex-direction: column; + padding: 0 16px; + } +} + + + +.active { + .pill-name { + color: white !important; + } + background: #1B4CA1 !important; + } + + ::ng-deep .content-pill .mat-chip-selected{ + background-color: #1B4CA1 !important; + .pill-name { + color: white !important; + } + } \ No newline at end of file diff --git a/project/ws/app/src/lib/routes/see-all/components/see-all-with-pills/see-all-with-pills.component.spec.ts b/project/ws/app/src/lib/routes/see-all/components/see-all-with-pills/see-all-with-pills.component.spec.ts new file mode 100644 index 0000000000..473fd71ee3 --- /dev/null +++ b/project/ws/app/src/lib/routes/see-all/components/see-all-with-pills/see-all-with-pills.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing' + +import { SeeAllWithPillsComponent } from './see-all-with-pills.component' + +describe('SeeAllWithPillsComponent', () => { + let component: SeeAllWithPillsComponent + let fixture: ComponentFixture + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [SeeAllWithPillsComponent], + }) + .compileComponents() + })) + + beforeEach(() => { + fixture = TestBed.createComponent(SeeAllWithPillsComponent) + component = fixture.componentInstance + fixture.detectChanges() + }) + + it('should create', () => { + expect(component).toBeTruthy() + }) +}) diff --git a/project/ws/app/src/lib/routes/see-all/components/see-all-with-pills/see-all-with-pills.component.ts b/project/ws/app/src/lib/routes/see-all/components/see-all-with-pills/see-all-with-pills.component.ts new file mode 100644 index 0000000000..d8507d9bc3 --- /dev/null +++ b/project/ws/app/src/lib/routes/see-all/components/see-all-with-pills/see-all-with-pills.component.ts @@ -0,0 +1,578 @@ +import { + Component, + OnInit, + OnDestroy, +} from '@angular/core' +import { + ActivatedRoute, +} from '@angular/router' +// tslint:disable-next-line +import * as _ from 'lodash' +import { ConfigurationsService, EventService, MultilingualTranslationsService, WsEvents, NsContent } from '@sunbird-cb/utils-v2' +import { SeeAllService } from '../../services/see-all.service' +import { MatTabChangeEvent } from '@angular/material' +import { NsContentStripWithTabsAndPills } from '@sunbird-cb/consumption/lib/_common/strips/content-strip-with-tabs-pills/content-strip-with-tabs-pills.model' + +@Component({ + selector: 'ws-app-see-all-with-pills', + templateUrl: './see-all-with-pills.component.html', + styleUrls: ['./see-all-with-pills.component.scss'], +}) +export class SeeAllWithPillsComponent implements OnInit, OnDestroy { + + seeAllPageConfig: any + keyData: any + contentDataList: any = [] + throttle = 100 + scrollDistance = 0.2 + offsetForPage = 0 + totalCount = 0 + page = 1 + totalPages = 0 + tabResults: any[] = [] + tabSelected: any + dynamicTabIndex = 0 + pillSelected: any + pillResults: any[] = [] + dynamicPillIndex = 0 + + constructor( + private activated: ActivatedRoute, + // private router: Router, + private seeAllSvc: SeeAllService, + private configSvc: ConfigurationsService, + private eventSvc: EventService, + private langtranslations: MultilingualTranslationsService, + ) { + + } + + async ngOnInit() { + this.activated.queryParams.subscribe((res: any) => { + this.keyData = (res.key) ? res.key : '' + this.tabSelected = (res.tabSelected) ? res.tabSelected : '' + this.pillSelected = (res.pillSelected) ? res.pillSelected : '' + }) + const configData = await this.seeAllSvc.getSeeAllConfigJson().catch(_error => {}) + // configData.homeStrips.forEach((ele: any) => { + // if (ele && ele.strips.length > 0) { + // ele.strips.forEach((subEle: any) => { + // if (subEle.key === this.keyData) { + // this.seeAllPageConfig = subEle + // } + // }) + // } + // }) + if (!this.seeAllPageConfig) { + if (configData) { + configData.assessmentData.forEach((ele: any) => { + if (ele && ele.strips && ele.strips.length > 0) { + ele.strips.forEach((subEle: any) => { + if (subEle.key === this.keyData) { + this.seeAllPageConfig = subEle + } + }) + } + }) + } + } + if (!this.seeAllPageConfig) { + if (configData) { + configData.newHomeStrip.forEach((ele: any) => { + if (ele && ele.strips && ele.strips.length > 0) { + ele.strips.forEach((subEle: any) => { + if (subEle.key === this.keyData) { + this.seeAllPageConfig = subEle + } + }) + } + }) + } + } + if ( + this.tabSelected && + this.seeAllPageConfig.tabs && + this.seeAllPageConfig.tabs.length + ) { + this.tabResults = this.seeAllPageConfig.tabs + this.dynamicTabIndex = _.findIndex(this.tabResults, (v: any) => v.value === this.tabSelected) + } + if ( + this.tabSelected && + this.seeAllPageConfig.tabs && + this.seeAllPageConfig.tabs.length + ) { + this.pillResults = this.seeAllPageConfig.tabs[this.dynamicTabIndex].pillsData + this.dynamicPillIndex = _.findIndex(this.pillResults, (v: any) => v.value === this.pillSelected) + this.seeAllPageConfig.tabs[this.dynamicTabIndex].pillsData[this.dynamicPillIndex]['selected'] = true + } + this.contentDataList = this.transformSkeletonToWidgets(this.seeAllPageConfig) + + if (this.seeAllPageConfig.request && this.seeAllPageConfig.key === 'forYou') { + this.fetchForYouData(this.seeAllPageConfig) + } + + } + + checkForDateFilters(filters: any) { + if (filters && filters.hasOwnProperty('batches.endDate')) { + // tslint:disable-next-line + filters['batches.endDate']['>='] = eval(filters['batches.endDate']['>=']) + } else if (filters && filters.hasOwnProperty('batches.enrollmentEndDate')) { + // tslint:disable-next-line + filters['batches.enrollmentEndDate']['>='] = eval(filters['batches.enrollmentEndDate']['>=']) + } + return filters + } + + private getFiltersFromArray(v6filters: any) { + const filters: any = {} + if (v6filters.constructor === Array) { + v6filters.forEach(((f: any) => { + Object.keys(f).forEach(key => { + filters[key] = f[key] + }) + })) + return filters + } + return v6filters + } + + private transformSkeletonToWidgets( + strip: any + ) { + return [1, 2, 3, 4, 5, 6, 7, 7, 8, 9, 10].map(_content => ({ + widgetType: 'card', + widgetSubType: 'cardContent', + widgetHostClass: 'mb-2', + widgetData: { + cardSubType: strip.viewMoreUrl && strip.viewMoreUrl.loaderConfig + && strip.viewMoreUrl.loaderConfig.cardSubType || 'card-portrait-skeleton', + }, + })) + } + + private transformContentsToWidgets( + contents: NsContent.IContent[], + strip: any, + ) { + return (contents || []).map((content, idx) => ({ + widgetType: 'card', + widgetSubType: 'cardContent', + widgetHostClass: 'mb-2', + widgetData: { + content, + ...(content.batch && { + batch: content.batch, + }), + cardSubType: strip.viewMoreUrl && strip.viewMoreUrl.stripConfig + && strip.viewMoreUrl.stripConfig.cardSubType, + context: { + pageSection: strip.key, + position: idx, + }, + intranetMode: strip.stripConfig && strip.stripConfig.intranetMode, + deletedMode: strip.stripConfig && strip.stripConfig.deletedMode, + contentTags: strip.stripConfig && strip.stripConfig.contentTags, + }, + })) + } + + private transformSearchV6FiltersV2(v6filters: any) { + const filters: any = {} + if (v6filters.constructor === Array) { + v6filters.forEach(((f: any) => { + Object.keys(f).forEach(key => { + filters[key] = f[key] + }) + })) + return filters + } + return v6filters + } + + async searchV6Request(strip: NsContentStripWithTabsAndPills.IContentStripUnit, + request: NsContentStripWithTabsAndPills.IContentStripUnit['request'], + _calculateParentStatus: boolean + ): Promise { + const originalFilters: any = [] + // console.log('calling -- ') + return new Promise ((resolve, reject) => { + if (request && request.searchV6) { + this.seeAllSvc.searchV6(request.searchV6).subscribe(results => { + const showViewMore = Boolean( + results.result.content && results.result.content.length > 5 && strip.stripConfig && strip.stripConfig.postCardForSearch, + ) + const viewMoreUrl = showViewMore ? + { + path: strip.viewMoreUrl && strip.viewMoreUrl.path || '', + queryParams: { + tab: 'Learn', + q: strip.viewMoreUrl && strip.viewMoreUrl.queryParams, + f: request && + request.searchV6 && + request.searchV6.request && + request.searchV6.request.filters ? + JSON.stringify( + this.transformSearchV6FiltersV2( + originalFilters, + ) + ) : + {}, + }, + } : + null + resolve({ + results, + viewMoreUrl, + }) + }, (error: any) => { + reject(error) + }) + } + }) + } + + async fetchFromTrendingContent(strip: NsContentStripWithTabsAndPills.IContentStripUnit, calculateParentStatus = true) { + if (strip.request && strip.request.trendingSearch && Object.keys(strip.request.trendingSearch).length) { + // let originalFilters: any = [] + if (strip.request && + strip.request.trendingSearch && + strip.request.trendingSearch.request && + strip.request.trendingSearch.request.filters) { + // originalFilters = strip.request.trendingSearch.request.filters + strip.request.trendingSearch.request.filters = this.checkForDateFilters(strip.request.trendingSearch.request.filters) + strip.request.trendingSearch.request.filters = this.getFiltersFromArray( + strip.request.trendingSearch.request.filters, + ) + } + if (strip.tabs && strip.tabs.length) { + // TODO: Have to extract requestRequired to outer level of tabs config + const firstTab = strip.tabs[this.dynamicTabIndex] + if (firstTab.requestRequired) { + if (this.seeAllPageConfig.tabs) { + const allTabs = this.seeAllPageConfig.tabs + const currentTabFromMap = (allTabs && allTabs.length && + allTabs[this.dynamicTabIndex]) as NsContentStripWithTabsAndPills.IContentStripTab + this.getTabDataByNewReqTrending(strip, this.dynamicTabIndex, 0, currentTabFromMap, + calculateParentStatus) + } + } + + } else { + try { + const response = await this.trendingSearchRequest(strip, strip.request, calculateParentStatus) + if (response && response.results && response.results.response) { + const content = response.results.response[strip.request.trendingSearch.responseKey] || [] + this.contentDataList = this.transformContentsToWidgets(content, strip) + } + } catch (error) {} + } + } + } + + onScrollEnd() { + this.page += 1 + if (this.page <= this.totalPages) { + if (this.contentDataList[0].widgetData.content) { + if (this.seeAllPageConfig.request.searchV6) { + this.offsetForPage = this.seeAllPageConfig.request.searchV6.request.limit + this.offsetForPage + // this.fetchFromSearchV6(this.seeAllPageConfig) + } + } + } + } + + ngOnDestroy() {} + + translateLabels(label: string, type: any) { + return this.langtranslations.translateLabel(label.toLowerCase(), type, '') + } + + fetchForYouData(strip: NsContentStripWithTabsAndPills.IContentStripUnit) { + if (strip && strip.type === 'forYou') { + if (strip.tabs && strip.tabs.length) { + const tabIndex: any = this.dynamicTabIndex || 0 + const pillIndex: any = this.dynamicPillIndex || 0 + const firstTab = strip.tabs[tabIndex] + const pillData = firstTab.pillsData[pillIndex] + if (pillData.requestRequired) { + if (this.seeAllPageConfig && this.seeAllPageConfig.tabs) { + const allPills = this.seeAllPageConfig.tabs[tabIndex].pillsData + const currenPillsFromMap = (allPills && allPills.length && + allPills[pillIndex]) as NsContentStripWithTabsAndPills.IContentStripTab + if (currenPillsFromMap.request.searchV6) { + this.getTabDataByNewReqSearchV6(strip, tabIndex, pillIndex, currenPillsFromMap, true) + } else if (currenPillsFromMap.request.trendingSearch) { + this.getTabDataByNewReqTrending(strip, tabIndex, pillIndex, currenPillsFromMap, true) + } + } + } + + } + } + } + + async getTabDataByNewReqTrending( + strip: NsContentStripWithTabsAndPills.IContentStripUnit, + tabIndex: number, + pillIndex: number, + currentTab: NsContentStripWithTabsAndPills.IContentStripTab, + calculateParentStatus: boolean + ) { + try { + const response = await this.trendingSearchRequest(strip, currentTab.request, calculateParentStatus) + if (response && response.results && response.results.response) { + const content = response.results.response[currentTab.value] || [] + const widgets = this.transformContentsToWidgets(content, strip) + + if (this.seeAllPageConfig && this.seeAllPageConfig.tabs) { + const allTabs = this.seeAllPageConfig.tabs + const allPills = this.seeAllPageConfig.tabs[tabIndex].pillsData + this.resetSelectedPill(allPills) + if (allTabs && allTabs.length && allTabs[tabIndex]) { + if (allPills && allPills.length && allPills[pillIndex]) { + allPills[pillIndex] = { + ...allPills[pillIndex], + widgets, + fetchTabStatus: 'done', + selected: true, + } + } + allTabs[tabIndex] = { + ...allTabs[tabIndex], + widgets, + fetchTabStatus: 'done', + } + } + } + } else { + if (this.seeAllPageConfig && this.seeAllPageConfig.tabs) { + const allTabs = this.seeAllPageConfig.tabs + const allPills = this.seeAllPageConfig.tabs[tabIndex].pillsData + this.resetSelectedPill(allPills) + if (allTabs && allTabs.length && allTabs[tabIndex]) { + if (allPills && allPills.length && allPills[pillIndex]) { + allPills[pillIndex] = { + ...allPills[pillIndex], + widgets: [], + fetchTabStatus: 'done', + selected: true, + } + } + allTabs[tabIndex] = { + ...allTabs[tabIndex], + widgets: [], + fetchTabStatus: 'done', + } + } + } + // this.processStrip(strip, [], 'done', calculateParentStatus, null); + } + } catch (_error) { + // Handle errors + // this.processStrip(strip, [], 'error', calculateParentStatus, null); + } + } + + async getTabDataByNewReqSearchV6( + strip: NsContentStripWithTabsAndPills.IContentStripUnit, + tabIndex: number, + pillIndex: number, + currentTab: NsContentStripWithTabsAndPills.IContentStripTab, + calculateParentStatus: boolean + ) { + try { + const response = await this.searchV6Request(strip, currentTab.request, calculateParentStatus) + if (response && response.results) { + const widgets = this.transformContentsToWidgets(response.results.result.content, strip) + if (this.seeAllPageConfig && this.seeAllPageConfig.tabs) { + const allTabs = this.seeAllPageConfig.tabs + const allPills = this.seeAllPageConfig.tabs[tabIndex].pillsData + this.resetSelectedPill(allPills) + if (allTabs && allTabs.length && allTabs[tabIndex]) { + if (allPills && allPills.length && allPills[pillIndex]) { + allPills[pillIndex] = { + ...allPills[pillIndex], + widgets, + fetchTabStatus: 'done', + selected: true, + } + } + allTabs[tabIndex] = { + ...allTabs[tabIndex], + widgets, + fetchTabStatus: 'done', + } + } + } + } else { + // this.processStrip(strip, [], 'error', calculateParentStatus, null); + } + } catch (error) { + // Handle errors + // console.error('Error:', error); + } + } + + async trendingSearchRequest(strip: NsContentStripWithTabsAndPills.IContentStripUnit, + request: NsContentStripWithTabsAndPills.IContentStripUnit['request'], + _calculateParentStatus: boolean + ): Promise { + const originalFilters: any = [] + return new Promise((resolve, reject) => { + if (request && request.trendingSearch) { + // check for the request if it has dynamic values] + if (request.trendingSearch.request.filters.organisation && + request.trendingSearch.request.filters.organisation.indexOf('') >= 0 + ) { + let userRootOrgId + if (this.configSvc.userProfile) { + userRootOrgId = this.configSvc.userProfile.rootOrgId + } + request.trendingSearch.request.filters.organisation = userRootOrgId + } + this.seeAllSvc.trendingContentSearch(request.trendingSearch).subscribe((result: any) => { + let results: any = result + const showViewMore = Boolean( + results.result && + strip.request && + results.result[strip.request.trendingSearch.responseKey] && + results.result[strip.request.trendingSearch.responseKey].length > 5 && + strip.stripConfig && strip.stripConfig.postCardForSearch, + ) + + const viewMoreUrl = showViewMore + ? { + path: strip.viewMoreUrl && strip.viewMoreUrl.path || '', + queryParams: { + tab: 'Learn', + q: strip.viewMoreUrl && strip.viewMoreUrl.queryParams, + f: + request && + request.trendingSearch && + request.trendingSearch.request && + request.trendingSearch.request.filters + ? JSON.stringify( + this.transformSearchV6FiltersV2( + originalFilters, + ) + ) + : {}, + }, + } + : null + + const proccesedResult: any = [] + if (results && results.response && results.response.certifications) { + results = { response: { certifications: proccesedResult } } + } + resolve({ results, viewMoreUrl }) + }, (error: any) => { + if (error.error && error.error.status === 400) { + // this.processStrip(strip, [], 'done', calculateParentStatus, null); + } + // this.processStrip(strip, [], 'done', calculateParentStatus, null) + reject(error) + }) + } + }) + } + resetSelectedPill(pillData: any) { + if (pillData && pillData.length) { + pillData.forEach((pill: any) => { + pill['selected'] = false + }) + } + } + + pillClicked(stripMap: any, pillIndex: any, tabIndex: any) { + if (stripMap && stripMap.tabs && stripMap.tabs[tabIndex]) { + stripMap.tabs[tabIndex].pillsData[pillIndex].fetchTabStatus = 'inprogress' + stripMap.tabs[tabIndex].pillsData[pillIndex].tabLoading = true + stripMap.showOnLoader = true + } + const currentTabFromMap: any = stripMap.tabs && stripMap.tabs[tabIndex] + const currentPillFromMap: any = stripMap.tabs && stripMap.tabs[tabIndex].pillsData[pillIndex] + const currentStrip = this.seeAllPageConfig + + if (currentStrip && currentTabFromMap && !currentTabFromMap.computeDataOnClick && currentPillFromMap) { + if (currentPillFromMap.requestRequired && currentPillFromMap.request) { + // call API to get tab data and process + // this.processStrip(currentStrip, [], 'fetching', true, null) + if (currentPillFromMap.request.searchV6) { + this.getTabDataByNewReqSearchV6(currentStrip, tabIndex, pillIndex, currentPillFromMap, true) + } else if (currentPillFromMap.request.trendingSearch) { + this.getTabDataByNewReqTrending(currentStrip, tabIndex, pillIndex, currentPillFromMap, true) + } + // if (stripMap && stripMap.tabs && stripMap.tabs[tabEvent.index]) { + // stripMap.tabs[tabEvent.index].tabLoading = false; + // } + + stripMap.tabs[tabIndex].pillsData[pillIndex].tabLoading = false + } else { + // this.getTabDataByfilter(currentStrip, currentTabFromMap, true); + // setTimeout(() => { + + // if (stripMap && stripMap.tabs && stripMap.tabs[tabIndex]) { + // stripMap.tabs[tabIndex].pillsData[pillIndex].fetchTabStatus = 'inprogress'; + // stripMap.tabs[tabIndex].pillsData[pillIndex].tabLoading = false; + // stripMap.showOnLoader = false; + // this.resetSelectedPill(stripMap.tabs[tabIndex].pillsData) + // stripMap.tabs[tabIndex].pillsData[pillIndex]['selected']=true + // } + // }, 200); + } + } + } + public tabClicked(tabEvent: MatTabChangeEvent, stripMap: any, _stripKey: string, pillIndex: any) { + if (stripMap && stripMap.tabs && stripMap.tabs[tabEvent.index]) { + stripMap.tabs[tabEvent.index].pillsData[pillIndex].fetchTabStatus = 'inprogress' + stripMap.tabs[tabEvent.index].pillsData[pillIndex].tabLoading = true + stripMap.showOnLoader = true + } + const data: WsEvents.ITelemetryTabData = { + label: `${tabEvent.tab.textLabel}`, + index: tabEvent.index, + } + this.eventSvc.raiseInteractTelemetry( + { + type: WsEvents.EnumInteractTypes.CLICK, + subType: WsEvents.EnumInteractSubTypes.HOME_PAGE_STRIP_TABS, + id: `${_.camelCase(data.label)}-tab`, + }, + {}, + { + module: WsEvents.EnumTelemetrymodules.HOME, + } + ) + + const currentTabFromMap: any = stripMap.tabs && stripMap.tabs[tabEvent.index] + const currentPillFromMap: any = stripMap.tabs && stripMap.tabs[tabEvent.index].pillsData[pillIndex] + const currentStrip = this.seeAllPageConfig + + if (currentStrip && currentTabFromMap && !currentTabFromMap.computeDataOnClick && currentPillFromMap) { + if (currentPillFromMap.requestRequired && currentPillFromMap.request) { + // call API to get tab data and process + // this.processStrip(currentStrip, [], 'fetching', true, null) + if (currentPillFromMap.request.searchV6) { + this.getTabDataByNewReqSearchV6(currentStrip, tabEvent.index, 0, currentPillFromMap, true) + } else if (currentPillFromMap.request.trendingSearch) { + this.getTabDataByNewReqTrending(currentStrip, tabEvent.index, 0, currentPillFromMap, true) + } + + stripMap.tabs[tabEvent.index].pillsData[pillIndex].tabLoading = false + } + } + } + + getSelectedPillIndex(tabdata: any) { + if (tabdata.pillsData && tabdata.pillsData.length) { + const index = tabdata.pillsData.findIndex((pill: any) => { + return pill.selected + }) + return index + } + return 0 + } +} diff --git a/project/ws/app/src/lib/routes/see-all/seeAll-routing.module.ts b/project/ws/app/src/lib/routes/see-all/seeAll-routing.module.ts index 8f035dfecd..6fc700f2cb 100644 --- a/project/ws/app/src/lib/routes/see-all/seeAll-routing.module.ts +++ b/project/ws/app/src/lib/routes/see-all/seeAll-routing.module.ts @@ -3,6 +3,7 @@ import { Routes, RouterModule } from '@angular/router' import { CommonModule } from '@angular/common' // import { PageResolve } from '@sunbird-cb/utils-v2' import { SeeAllHomeComponent } from './components/see-all-home/see-all-home.component' +import { SeeAllWithPillsComponent } from './components/see-all-with-pills/see-all-with-pills.component' const routes: Routes = [ { @@ -18,6 +19,19 @@ const routes: Routes = [ // searchPageData: PageResolve, // }, }, + { + path: 'new', + pathMatch: 'full', + component: SeeAllWithPillsComponent, + data: { + pageType: 'feature', + pageKey: 'seeAll', + pageId: '', + }, + // resolve: { + // searchPageData: PageResolve, + // }, + }, ] @NgModule({ declarations: [], diff --git a/project/ws/app/src/lib/routes/see-all/seeAll.module.ts b/project/ws/app/src/lib/routes/see-all/seeAll.module.ts index 0ae5c08bbc..01ceef37b9 100644 --- a/project/ws/app/src/lib/routes/see-all/seeAll.module.ts +++ b/project/ws/app/src/lib/routes/see-all/seeAll.module.ts @@ -46,10 +46,12 @@ import { SeeAllRoutingModule } from './seeAll-routing.module' import { SeeAllHomeComponent } from './components/see-all-home/see-all-home.component' import { CardContentV2Module } from '@sunbird-cb/collection/src/lib/card-content-v2/card-content-v2.module' import { TranslateModule } from '@ngx-translate/core' +import { SeeAllWithPillsComponent } from './components/see-all-with-pills/see-all-with-pills.component' @NgModule({ declarations: [ SeeAllHomeComponent, + SeeAllWithPillsComponent, ], imports: [ CommonModule, diff --git a/project/ws/viewer/src/lib/plugins/html/html.component.html b/project/ws/viewer/src/lib/plugins/html/html.component.html index 1e6a901fbd..640bdec817 100755 --- a/project/ws/viewer/src/lib/plugins/html/html.component.html +++ b/project/ws/viewer/src/lib/plugins/html/html.component.html @@ -105,7 +105,7 @@

{{'playerbrief.openScorm' | translate}}

-
- - {{'playerbrief.maxAllowedRetake' | translate}} + {{'playerbrief.maxAllowedRetake' | translate}}
@@ -162,10 +162,10 @@

{{ 'practiceoverview.summary' | translate }}

- - {{'playerbrief.maxAllowedRetake' | translate}} + {{'playerbrief.maxAllowedRetake' | translate}}
diff --git a/project/ws/viewer/src/lib/plugins/practice/components/overview/overview.component.scss b/project/ws/viewer/src/lib/plugins/practice/components/overview/overview.component.scss index 654f83b47b..fe05243697 100755 --- a/project/ws/viewer/src/lib/plugins/practice/components/overview/overview.component.scss +++ b/project/ws/viewer/src/lib/plugins/practice/components/overview/overview.component.scss @@ -261,6 +261,12 @@ color: #666666 } + + +::ng-deep .consent-checkbox .mat-checkbox-checked.mat-accent .mat-checkbox-background { + background-color: #1a4ca1 !important; +} + @media only screen and (max-width: 767px) { .box-height { // min-height: 100%; diff --git a/project/ws/viewer/src/lib/plugins/practice/components/overview/overview.component.ts b/project/ws/viewer/src/lib/plugins/practice/components/overview/overview.component.ts index 4dbad87547..b5b13b0512 100755 --- a/project/ws/viewer/src/lib/plugins/practice/components/overview/overview.component.ts +++ b/project/ws/viewer/src/lib/plugins/practice/components/overview/overview.component.ts @@ -62,11 +62,11 @@ export class OverviewComponent implements OnInit, OnChanges, OnDestroy { ngOnChanges() { if (!this.forPreview) { - if (this.canAttempt && (this.canAttempt.attemptsMade >= this.canAttempt.attemptsAllowed)) { + if (this.canAttempt && (this.canAttempt.attemptsMade >= this.canAttempt.attemptsAllowed) && + this.questionTYP.FINAL_ASSESSMENT === this.primaryCategory) { if (!this.maxAttempPopup) { this.showAssessmentPopup() } - } } diff --git a/project/ws/viewer/src/lib/plugins/practice/components/question/fitb/fitb.component.html b/project/ws/viewer/src/lib/plugins/practice/components/question/fitb/fitb.component.html index 60281ccd1a..cdd1d80eaa 100644 --- a/project/ws/viewer/src/lib/plugins/practice/components/question/fitb/fitb.component.html +++ b/project/ws/viewer/src/lib/plugins/practice/components/question/fitb/fitb.component.html @@ -1,5 +1,5 @@ - Instruction + {{ question?.instructions || 'Fill in the blank with the best word'}}

diff --git a/project/ws/viewer/src/lib/plugins/practice/components/question/fitb/fitb.component.ts b/project/ws/viewer/src/lib/plugins/practice/components/question/fitb/fitb.component.ts index caa8c64d55..e737212582 100644 --- a/project/ws/viewer/src/lib/plugins/practice/components/question/fitb/fitb.component.ts +++ b/project/ws/viewer/src/lib/plugins/practice/components/question/fitb/fitb.component.ts @@ -140,7 +140,7 @@ export class FillInTheBlankComponent implements OnInit, OnChanges, AfterViewInit let fromRichTextEditor = false for (let i = 0; i < iterationNumber; i += 1) { // tslint:disable-next-line - if(this.localQuestion.includes('/_______________/') ) { + if(this.localQuestion.includes('_______________') ) { this.localQuestion = this.localQuestion.replace('_______________', 'idMarkerForReplacement') } else if (this.localQuestion.includes('input style="border-style:none none solid none"')) { // tslint:disable-next-line @@ -216,7 +216,7 @@ export class FillInTheBlankComponent implements OnInit, OnChanges, AfterViewInit functionChangeBlankBorder() { if (this.question.questionType === 'ftb' && this.showAns) { let iterationNumber: any = 0 - if (this.localQuestion.includes('/_______________/')) { + if (this.localQuestion.includes('_______________')) { iterationNumber = ((this.localQuestion.match(/_______________/g) || []).length) } else if (this.localQuestion.includes('input style="border-style:none none solid none"')) { iterationNumber = ((this.localQuestion.match(/input style="border-style:none none solid none"/g) || []).length) diff --git a/project/ws/viewer/src/lib/plugins/practice/components/question/mtf/mtf.component.html b/project/ws/viewer/src/lib/plugins/practice/components/question/mtf/mtf.component.html index 78fca58394..786bfeab2f 100644 --- a/project/ws/viewer/src/lib/plugins/practice/components/question/mtf/mtf.component.html +++ b/project/ws/viewer/src/lib/plugins/practice/components/question/mtf/mtf.component.html @@ -28,7 +28,7 @@ Option - {{ element.text }} + diff --git a/project/ws/viewer/src/lib/plugins/practice/components/question/mtf/mtf.component.scss b/project/ws/viewer/src/lib/plugins/practice/components/question/mtf/mtf.component.scss index 98059bbc6c..bd83960d30 100644 --- a/project/ws/viewer/src/lib/plugins/practice/components/question/mtf/mtf.component.scss +++ b/project/ws/viewer/src/lib/plugins/practice/components/question/mtf/mtf.component.scss @@ -11,7 +11,10 @@ r: 3; } circle:hover { - r: 10; + r: 3; + } + circle:active { + r: 3; } } } diff --git a/project/ws/viewer/src/lib/plugins/practice/components/question/mtf/mtf.component.ts b/project/ws/viewer/src/lib/plugins/practice/components/question/mtf/mtf.component.ts index 3ae21dfa1c..9f334d45f8 100644 --- a/project/ws/viewer/src/lib/plugins/practice/components/question/mtf/mtf.component.ts +++ b/project/ws/viewer/src/lib/plugins/practice/components/question/mtf/mtf.component.ts @@ -256,6 +256,7 @@ export class MatchTheFollowingQuesComponent implements OnInit, OnChanges, AfterV if (match && match.trim()) {/** === selectors[0].innerText.trim() */ this.jsPlumbInstance.connect({ endpoint: ['Dot', { + radius: 3, cssClass: 'amit icon-svg', PaintStyle: { stroke: 'rgba(0,0,0,0.5)', diff --git a/project/ws/viewer/src/lib/plugins/practice/components/question/question.component.html b/project/ws/viewer/src/lib/plugins/practice/components/question/question.component.html index 3c07ab2d1d..7fcc0b2b14 100755 --- a/project/ws/viewer/src/lib/plugins/practice/components/question/question.component.html +++ b/project/ws/viewer/src/lib/plugins/practice/components/question/question.component.html @@ -71,7 +71,8 @@ (update)="update($event)"> - +
{{ 'practiceoverview.option' | translate }} - {{ element.text }} + @@ -164,7 +165,8 @@
- +
@@ -182,7 +184,8 @@

- + @@ -208,7 +211,10 @@

-

{{question?.marks}} {{ 'practiceoverview.marks' | translate }}

+

+ {{question?.marks}} {{ 'practiceoverview.mark' | translate }} + {{question?.marks}} {{ 'practiceoverview.marks' | translate }} +

{{questionNumber}}/{{ total }}

@@ -224,7 +230,8 @@

+ (update)="update($event)" + >

@@ -240,7 +247,8 @@

- +
-

{{question?.marks}} {{ 'practiceoverview.marks' | translate }}

+

+ {{question?.marks}} {{ 'practiceoverview.mark' | translate }} + {{question?.marks}} {{ 'practiceoverview.marks' | translate }} +

{{questionNumber}}/{{ total }}

@@ -298,7 +309,8 @@

- +

@@ -316,7 +328,8 @@

- +

diff --git a/project/ws/viewer/src/lib/plugins/practice/components/result/result.component.scss b/project/ws/viewer/src/lib/plugins/practice/components/result/result.component.scss index 383b239a25..d0d55935ce 100755 --- a/project/ws/viewer/src/lib/plugins/practice/components/result/result.component.scss +++ b/project/ws/viewer/src/lib/plugins/practice/components/result/result.component.scss @@ -904,6 +904,7 @@ color: #212529 !important; font-size: 14px; font-weight: 400; + padding: 0 10px; } } diff --git a/project/ws/viewer/src/lib/plugins/practice/practice.component.html b/project/ws/viewer/src/lib/plugins/practice/practice.component.html index 86a861a151..a26c2d47d3 100644 --- a/project/ws/viewer/src/lib/plugins/practice/practice.component.html +++ b/project/ws/viewer/src/lib/plugins/practice/practice.component.html @@ -1722,7 +1722,7 @@

-
+
diff --git a/project/ws/viewer/src/lib/plugins/practice/practice.component.scss b/project/ws/viewer/src/lib/plugins/practice/practice.component.scss index fdef4f4b25..901f3250a9 100644 --- a/project/ws/viewer/src/lib/plugins/practice/practice.component.scss +++ b/project/ws/viewer/src/lib/plugins/practice/practice.component.scss @@ -874,7 +874,7 @@ $nav-height: 40px; } ::ng-deep .section-dd-container .mat-form-field-type-mat-native-select .mat-input-element { - padding-right: 35px; + padding-right: 65px; } ::ng-deep .section-dd .mat-form-field-underline { diff --git a/project/ws/viewer/src/lib/plugins/practice/practice.component.ts b/project/ws/viewer/src/lib/plugins/practice/practice.component.ts index cc581f361c..73692e3607 100644 --- a/project/ws/viewer/src/lib/plugins/practice/practice.component.ts +++ b/project/ws/viewer/src/lib/plugins/practice/practice.component.ts @@ -552,7 +552,7 @@ export class PracticeComponent implements OnInit, OnChanges, OnDestroy { const setStartIndex = this.noOfQuestionsPerSet * this.currentSetNumber const setEndIndex = setStartIndex + this.noOfQuestionsPerSet const secQuestions = qq.slice(setStartIndex, setEndIndex) - return secQuestions + return this.selectedAssessmentCompatibilityLevel < 6 ? qq : secQuestions } get hasNextSet(): boolean { @@ -655,7 +655,10 @@ export class PracticeComponent implements OnInit, OnChanges, OnDestroy { } } getMultiQuestions(ids: string[]) { - return this.quizSvc.getQuestions(ids, this.identifier).toPromise() + if (this.selectedAssessmentCompatibilityLevel < 6) { + return this.quizSvc.getQuestionsV4(ids, this.identifier).toPromise() + } + return this.quizSvc.getQuestions(ids, this.identifier).toPromise() } getRhsValue(question: NSPractice.IQuestionV2) { if (question && question.qType) { @@ -1305,6 +1308,7 @@ export class PracticeComponent implements OnInit, OnChanges, OnDestroy { timeSpent: timeSpent.toString(), editorState: { options: [] }, } + if (sq.options.length === 0 && this.questionAnswerHash[sq.questionId]) { const ftbAns = this.questionAnswerHash[sq.questionId][0].split(',') ftbAns.forEach((ans: string, index) => { @@ -1313,10 +1317,29 @@ export class PracticeComponent implements OnInit, OnChanges, OnDestroy { selectedAnswer: ans, }) }) + } else if( this.questionAnswerHash[sq.questionId]) { + const ftbAns = this.questionAnswerHash[sq.questionId][0].split(',') + ftbAns.forEach((ans: string, index) => { + ftb.editorState.options.push({ + index: index.toString(), + selectedAnswer: ans, + }) + }) } responseQ.push(ftb) break case 'mtf': + let optionAll:any = [] + optionAll = _.compact(_.map(sq.options, (_o: any) => { + if (_o.userSelected && this.questionAnswerHash[sq.questionId]) { + return { + index: (_o.optionId).toString(), + selectedAnswer: _o.response, + } as NSPractice.IResponseOptions + } + return null + + })) const mtf: NSPractice.IMCQ_MTF = { identifier: sq.questionId, mimeType: NsContent.EMimeTypes.QUESTION, @@ -1328,19 +1351,7 @@ export class PracticeComponent implements OnInit, OnChanges, OnDestroy { timeTaken: timeSpent.toString(), timeSpent: timeSpent.toString(), editorState: { - options: _.compact(_.map(sq.options, (_o: NSPractice.IOption) => { - if (_o.userSelected) { - return { - index: (_o.optionId).toString(), - selectedAnswer: _o.response, - } as NSPractice.IResponseOptions - } - return { - index: (_o.optionId).toString(), - selectedAnswer: _o.response, - } as NSPractice.IResponseOptions - - })), + options: optionAll.filter((o:any) => { return o.hasOwnProperty('index'); }).length > 0 ? optionAll : [], }, } responseQ.push(mtf) @@ -1394,28 +1405,51 @@ export class PracticeComponent implements OnInit, OnChanges, OnDestroy { } else { this.viewState = 'answer' } - if (this.selectedAssessmentCompatibilityLevel < 6) { - const quizV4Res: any = await this.quizSvc.submitQuizV4(this.generateRequest).toPromise().catch(_error => {}) - if (quizV4Res && quizV4Res.params && quizV4Res.params.status.toLowerCase() === 'success') { - if (quizV4Res.result.primaryCategory === 'Course Assessment') { - setTimeout(() => { - this.getQuizResult() - }, environment.quizResultTimeout) - } else if (quizV4Res.result.primaryCategory === 'Practice Question Set') { - this.assignQuizResult(quizV4Res.result) - } - } - } else { - const quizV4Res: any = await this.quizSvc.submitQuizV5(this.generateRequest).toPromise().catch(_error => {}) - if (quizV4Res && quizV4Res.params && quizV4Res.params.status.toLowerCase() === 'success') { - if (quizV4Res.result.primaryCategory === 'Course Assessment') { - setTimeout(() => { - this.getQuizResult() - }, environment.quizResultTimeout) - } else if (quizV4Res.result.primaryCategory === 'Practice Question Set') { - this.assignQuizResult(quizV4Res.result) - } + + let allPromiseResolvedCount = 0 + if(this.paperSections && this.paperSections.length) { + for(let i =0 ; i< this.paperSections.length;i++) { + let section = this.paperSections[i]; + const lst = _.chunk(section.childNodes || [], 1000) + const prom: any[] = [] + _.each(lst, l => { + prom.push(this.getMultiQuestions(l)) + }) + Promise.all(prom).then(qqr => { + console.log('qqr', qqr) + allPromiseResolvedCount++; + const question = { questions: _.flatten(_.map(qqr, 'result.questions')) } + const codes = _.compact(_.map(this.quizJson.questions, 'section') || []) + // console.log(this.quizSvc.secAttempted.value) + _.eachRight(question.questions, q => { + // const qHtml = document.createElement('div') + // qHtml.innerHTML = q.editorState.question + if (codes.indexOf(section.identifier) === -1) { + this.quizJson.questions.push({ + section: section.identifier, + question: q.body, // qHtml.textContent || qHtml.innerText || '', + multiSelection: ((q.qType || '').toLowerCase() === 'mcq-mca' ? true : false), + questionType: (q.qType || '').toLowerCase(), + questionId: q.identifier, + instructions: null, + options: this.getOptions(q), + editorState: q.editorState, + questionLevel: q.questionLevel, + marks: q.totalMarks, + rhsChoices: this.getRhsValue(q), + }) + } + }) + + + if(this.paperSections && this.paperSections.length === allPromiseResolvedCount) { + // console.log('this.quizJson',this.quizJson) + // console.log('this.generateRequest',this.generateRequest) + this.submitAfterAllPromiseResolved(); + } + }) } + } // this.quizSvc.submitQuizV3(this.generateRequest).subscribe( @@ -1448,6 +1482,32 @@ export class PracticeComponent implements OnInit, OnChanges, OnDestroy { // }, // ) } + + async submitAfterAllPromiseResolved() { + if (this.selectedAssessmentCompatibilityLevel < 6) { + const quizV4Res: any = await this.quizSvc.submitQuizV4(this.generateRequest).toPromise().catch(_error => {}) + if (quizV4Res && quizV4Res.params && quizV4Res.params.status.toLowerCase() === 'success') { + if (quizV4Res.result.primaryCategory === 'Course Assessment') { + setTimeout(() => { + this.getQuizResult() + }, environment.quizResultTimeout) + } else if (quizV4Res.result.primaryCategory === 'Practice Question Set') { + this.assignQuizResult(quizV4Res.result) + } + } + } else { + const quizV4Res: any = await this.quizSvc.submitQuizV5(this.generateRequest).toPromise().catch(_error => {}) + if (quizV4Res && quizV4Res.params && quizV4Res.params.status.toLowerCase() === 'success') { + if (quizV4Res.result.primaryCategory === 'Course Assessment') { + setTimeout(() => { + this.getQuizResult() + }, environment.quizResultTimeout) + } else if (quizV4Res.result.primaryCategory === 'Practice Question Set') { + this.assignQuizResult(quizV4Res.result) + } + } + } + } showAnswers() { this.showMtfAnswers() this.showFitbAnswers() @@ -1627,15 +1687,17 @@ export class PracticeComponent implements OnInit, OnChanges, OnDestroy { if(this.selectedAssessmentCompatibilityLevel < 6) { this.init() } else { - this.quizSvc.canAttendV5(this.identifier).subscribe(response => { - if (response) { - this.canAttempt = response - // this.canAttempt = { - // attemptsAllowed: 1, - // attemptsMade: 0, - // } - } - }) + if(this.ePrimaryCategory.FINAL_ASSESSMENT == this.primaryCategory) { + this.quizSvc.canAttendV5(this.identifier).subscribe(response => { + if (response) { + this.canAttempt = response + // this.canAttempt = { + // attemptsAllowed: 1, + // attemptsMade: 0, + // } + } + }) + } this.retakeAssessment() } diff --git a/project/ws/viewer/src/lib/plugins/practice/practice.service.ts b/project/ws/viewer/src/lib/plugins/practice/practice.service.ts index 40ba376120..43a4df6f2e 100755 --- a/project/ws/viewer/src/lib/plugins/practice/practice.service.ts +++ b/project/ws/viewer/src/lib/plugins/practice/practice.service.ts @@ -163,11 +163,16 @@ export class PracticeService { const stringRemoveSlashN = this.extractContent(question.options[i].text.replace(/\n/g, '').replace(/\</g, '<').replace(/\>/g, '>')) const idxOfSource = _.indexOf(mtfSrc[question.questionId].source, stringRemoveSlashN.replace(/<(.|\n)*?>/g, '')) const targetId = mtfSrc[question.questionId].target[idxOfSource] - const lastChar = targetId.slice(-1) - if (question) { - question.options[i].response = question.rhsChoices && question.rhsChoices[Number(lastChar) - 1] + if (targetId) { + const lastChar = targetId.slice(-1) + if (question && lastChar) { + question.options[i].response = question.rhsChoices && question.rhsChoices[Number(lastChar) - 1] + } + question.options[i].userSelected = true + } else { + question.options[i].userSelected = false } - question.options[i].userSelected = true + // } // } } else { diff --git a/project/ws/viewer/src/lib/viewer.component.ts b/project/ws/viewer/src/lib/viewer.component.ts index 97216da0c0..cecec14f6a 100755 --- a/project/ws/viewer/src/lib/viewer.component.ts +++ b/project/ws/viewer/src/lib/viewer.component.ts @@ -261,9 +261,11 @@ export class ViewerComponent implements OnInit, OnDestroy, AfterViewChecked { }) if (this.collectionId) { - const enrollCourseData = JSON.parse((localStorage.getItem('enrollmentMapData') as any))[this.collectionId] - if (enrollCourseData && (enrollCourseData.completionPercentage === 100 || enrollCourseData.status === 2)) { - this.downloadCertificate(enrollCourseData) + if (!this.forPreview) { + const enrollCourseData = JSON.parse((localStorage.getItem('enrollmentMapData') as any))[this.collectionId] + if (enrollCourseData && (enrollCourseData.completionPercentage === 100 || enrollCourseData.status === 2)) { + this.downloadCertificate(enrollCourseData) + } } } } diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 2b3ac4b906..35c85feedc 100755 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -841,6 +841,15 @@ const routes: Routes = [ }, canActivate: [GeneralGuard], }, + { + path: 'learner-advisory', + component: LearnerAdvisoryComponent, + canActivate: [GeneralGuard], + // data: { + // module: 'learner-advisory', + // // pageId: 'page/learner-advisory', + // }, + }, { path: 'page/explore/:tags', data: { @@ -953,14 +962,7 @@ const routes: Routes = [ pageId: 'public/privacy-policy', }, }, - { - path: 'public/learner-advisory', - component: LearnerAdvisoryComponent, - data: { - module: 'learner-advisory', - pageId: 'public/learner-advisory', - }, - }, + { path: 'public/google/sso', component: PublicLoginWGComponent, diff --git a/src/app/component/client-slider/client-slider.component.html b/src/app/component/client-slider/client-slider.component.html index e145da40e9..612508c59a 100644 --- a/src/app/component/client-slider/client-slider.component.html +++ b/src/app/component/client-slider/client-slider.component.html @@ -7,7 +7,7 @@ {{ 'home.topProviderSliders' | translate }}

- --> + +
+
-
+
-

Upcoming Assessment +

+ Upcoming Assessment

+ [routerLink]="['/app/discussion-forum']">START
desktop_mac @@ -76,7 +96,8 @@

Tips for Learners

{{ credMessage }}
- {{showCreds ? 'keyboard_arrow_up' : 'keyboard_arrow_down'}} + {{showCreds ? + 'keyboard_arrow_up' : 'keyboard_arrow_down'}}
@@ -84,14 +105,16 @@

Tips for Learners

Username
{{assessmentsData.userName}} - content_copy + content_copy
Password
{{assessmentsData.password}} - content_copy + content_copy
@@ -128,27 +151,66 @@

Tips for Learners

-
+
{{ 'home.myDiscussions' | translate }} - + chevron_right
- +
- +
-
+
-
+
+
+
+ +
+ +
\ No newline at end of file diff --git a/src/app/component/in-sight-side-bar/in-sight-side-bar.component.scss b/src/app/component/in-sight-side-bar/in-sight-side-bar.component.scss index b19dfc54cd..f328ed519b 100644 --- a/src/app/component/in-sight-side-bar/in-sight-side-bar.component.scss +++ b/src/app/component/in-sight-side-bar/in-sight-side-bar.component.scss @@ -143,18 +143,21 @@ .tip-content { display: flex; justify-content: space-between; - align-items: center; + // align-items: center; z-index: 10; + padding-top: 6px; + margin-bottom: 8px; } .tip-content p { - margin-left: 10px; + margin-left: 8px; color: #000000; font-family: Lato; font-size: 14px; z-index: 10; - padding: 5px; - line-height: 16.8px; + padding: 0px 4px; + line-height: 16px; + word-break: break-all; } .tip-count { @@ -165,11 +168,25 @@ font-family : Montserrat !important; font-size: 16px !important; padding: 10px 3px; - align-self: flex-end; - border-radius: 50% 0 0 50%; + // align-self: flex-end; + // border-radius: 50% 0 0 50%; z-index: 10; font-weight: 600; line-height: 19.5px; + width:45px; + } + .tip-data { + width: calc(100% - 110px); + } + .view-more { + display: flex; + align-items: center; + text-align: center; + height: 40px; + justify-content: center; +} + .view-more:hover { + background-color: #DCDFE5; } .background-circle { @@ -196,7 +213,8 @@ } .background{ background-color: white; - width: 56px; + width: 55px; height: 42px; border-radius: 5px; + text-align: center; } \ No newline at end of file diff --git a/src/app/component/in-sight-side-bar/in-sight-side-bar.component.ts b/src/app/component/in-sight-side-bar/in-sight-side-bar.component.ts index 3d35ed76c1..76dcc4036e 100644 --- a/src/app/component/in-sight-side-bar/in-sight-side-bar.component.ts +++ b/src/app/component/in-sight-side-bar/in-sight-side-bar.component.ts @@ -75,6 +75,9 @@ export class InsightSideBarComponent implements OnInit { assessmentsData: any isLeaderboardExist = false assessmentStrip: any + learnAdvisoryData: any + randomlearnAdvisoryObj: any + learnAdvisoryDataLength: any constructor( private homePageSvc: HomePageService, @@ -96,11 +99,15 @@ export class InsightSideBarComponent implements OnInit { this.userData = this.configSvc && this.configSvc.userProfile if (this.activatedRoute.snapshot.data.pageData && this.activatedRoute.snapshot.data.pageData.data) { this.homePageData = this.activatedRoute.snapshot.data.pageData.data + this.learnAdvisoryData = this.activatedRoute.snapshot.data.pageData.data.learnerAdvisory } + + // this.learnAdvisoryDataLength = this.learnAdvisoryData.length this.getInsights() this.getPendingRequestData() this.noDataValue = noData this.getDiscussionsData() + // this.displayRandomlearnAdvisoryData() if (this.activatedRoute.snapshot.data.pageData && this.activatedRoute.snapshot.data.pageData.data.assessmentData) { this.assessmentStrip = this.activatedRoute.snapshot.data.pageData.data.assessmentData @@ -109,6 +116,11 @@ export class InsightSideBarComponent implements OnInit { // this.getAssessmentData() } + // displayRandomlearnAdvisoryData(): void { + // const randomIndex = Math.floor(Math.random() * this.learnAdvisoryData.length) + // this.randomlearnAdvisoryObj = this.learnAdvisoryData[randomIndex] + // } + getInsights() { this.profileDataLoading = true const request = { @@ -334,7 +346,5 @@ export class InsightSideBarComponent implements OnInit { duration, }) } - showAllTips() { - this.router.navigate(['public/learner-advisory']) - } + } diff --git a/src/app/component/root/root.component.ts b/src/app/component/root/root.component.ts index b4529a6e36..92c00b9c97 100755 --- a/src/app/component/root/root.component.ts +++ b/src/app/component/root/root.component.ts @@ -340,7 +340,7 @@ export class RootComponent implements OnInit, AfterViewInit, AfterViewChecked { this.showNavbar = true this.isNavBarRequired = true } - if (window.location.pathname.includes('/public/learner-advisory')) { + if (window.location.pathname.includes('/learner-advisory')) { this.showNavbar = true this.isNavBarRequired = true this.showBottomNav = true diff --git a/src/app/home/home.module.ts b/src/app/home/home.module.ts index e9b50ed48f..685e6a5c73 100644 --- a/src/app/home/home.module.ts +++ b/src/app/home/home.module.ts @@ -15,6 +15,7 @@ import { SkeletonLoaderModule } from '@sunbird-cb/collection/src/lib/_common/ske import { ProfileCardStatsModule } from '@sunbird-cb/collection/src/lib/_common/profile-card-stats/profile-card-stats.module' import { PipeRelativeTimeModule } from '@sunbird-cb/utils-v2' import { WeeklyClapsModule } from '@sunbird-cb/collection/src/lib/_common/weekly-claps/weekly-claps.module' +import { TipsForLearnerModule } from '@sunbird-cb/collection/src/lib/_common/tips-for-learner/tips-for-learner.module' import { UpdatePostsModule } from '@sunbird-cb/collection/src/lib/_common/update-posts/update-posts.module' import { DiscussionsModule } from '@sunbird-cb/collection/src/lib/_common/discussions/discussions.module' import { RecentRequestsModule } from '@sunbird-cb/collection/src/lib/_common/recent-requests/recent-requests.module' @@ -63,6 +64,7 @@ import { ContentStripWithTabsLibModule, ContentStripWithTabsPillsModule } from ' UserLeaderboardModule, MatIconModule, WeeklyClapsModule, + TipsForLearnerModule, UpdatePostsModule, DiscussionsModule, RecentRequestsModule, diff --git a/src/app/home/home/home.component.ts b/src/app/home/home/home.component.ts index ecb7f41cdb..3eb28b41b2 100644 --- a/src/app/home/home/home.component.ts +++ b/src/app/home/home/home.component.ts @@ -379,6 +379,7 @@ export class HomeComponent implements OnInit, AfterViewInit { } fetchProfile() { + this.handleMDOMsgstatus() this.router.navigate(['/app/person-profile/me']) } @@ -438,7 +439,7 @@ export class HomeComponent implements OnInit, AfterViewInit { } this.userProfileService.editProfileDetails(reqUpdates).subscribe((res: any) => { if (res) { - + this.isMDOMsgOpen = true } }, (error: HttpErrorResponse) => { if (!error.ok) { diff --git a/src/app/learner-advisory/learner-advisory.component.html b/src/app/learner-advisory/learner-advisory.component.html index 4ecc3e2933..fb574352ee 100644 --- a/src/app/learner-advisory/learner-advisory.component.html +++ b/src/app/learner-advisory/learner-advisory.component.html @@ -1,7 +1,10 @@ + + +
- +
Watch content at a speed that ensures understanding and retention. diff --git a/src/app/learner-advisory/learner-advisory.component.scss b/src/app/learner-advisory/learner-advisory.component.scss index 54ed4c323c..4a05670025 100644 --- a/src/app/learner-advisory/learner-advisory.component.scss +++ b/src/app/learner-advisory/learner-advisory.component.scss @@ -1,16 +1,22 @@ .tips-container { - max-width: 900px; + max-width: 800px; + width: 800px; margin: 0 auto; - padding: 20px; + // padding: 20px; background-color: #f3f4f6; + + @media only screen and (max-width: 768px) { + width: 100%; + padding: 0px 0.5rem; + } } .banner img { - padding: 1px; + // padding: 1px; border-radius: 8px; - width: 100vw; - margin-left: calc(-50vw + 50%); - margin-right: calc(-50vw + 50%); + width: 100%; + // margin-left: calc(-50vw + 50%); + // margin-right: calc(-50vw + 50%); } .tips-list { margin-top: 20px; diff --git a/src/app/learner-advisory/learner-advisory.component.ts b/src/app/learner-advisory/learner-advisory.component.ts index b7d3184d32..5450b4de2c 100644 --- a/src/app/learner-advisory/learner-advisory.component.ts +++ b/src/app/learner-advisory/learner-advisory.component.ts @@ -7,9 +7,13 @@ import { Component, OnInit } from '@angular/core' }) export class LearnerAdvisoryComponent implements OnInit { + titles = [ + { title: 'Tips for Learners', url: 'none', icon: '' }, + ] constructor() { } ngOnInit() { + } } diff --git a/src/app/routes/public/public-logout/public-logout.component.html b/src/app/routes/public/public-logout/public-logout.component.html index fd20ff365f..a51d43c385 100644 --- a/src/app/routes/public/public-logout/public-logout.component.html +++ b/src/app/routes/public/public-logout/public-logout.component.html @@ -1,23 +1,18 @@
+ style="background: url(/assets/instances/eagle/banners/home/9/BG.png) center center fixed;">
-
+ -
+ +
- @@ -25,6 +20,11 @@ +
--> +
+
+ What's New @ iGOT? +

diff --git a/src/app/routes/public/public-logout/public-logout.component.scss b/src/app/routes/public/public-logout/public-logout.component.scss index 509d6aa2b9..fbb3bae3ce 100644 --- a/src/app/routes/public/public-logout/public-logout.component.scss +++ b/src/app/routes/public/public-logout/public-logout.component.scss @@ -22,11 +22,23 @@ } } +// .left_container { +// padding: 5rem 6rem; +// box-sizing: border-box; +// width: 55%; +// height: 100vh; + +// @include breakpoint-xs { +// display: none !important; +// } +// } .left_container { - padding: 5rem 6rem; - box-sizing: border-box; - width: 55%; - height: 100vh; + flex: 1; + // display: flex; + // align-items: center; + // justify-content: center; + position: relative; + max-width: 100%; @include breakpoint-xs { display: none !important; @@ -124,3 +136,16 @@ width:300px; text-decoration: underline; cursor: pointer; } + +.features-image { + display: flex; + justify-content: center; + align-items: center; +} +.features-image img { + max-width: 90%; + // position: absolute; + // top: 10%; + // // left: 50%; + // transform: translate(-50%, -50%); +} diff --git a/src/app/services/init.service.ts b/src/app/services/init.service.ts index 73e3a70aac..c679e19b2f 100755 --- a/src/app/services/init.service.ts +++ b/src/app/services/init.service.ts @@ -651,6 +651,10 @@ export class InitService { const publicConfig = await this.http .get(`${this.configSvc.sitePath}/site.config.json`) .toPromise() + if (publicConfig.npsCategory) { + localStorage.setItem('npsCategory', publicConfig.npsCategory) + } + this.configSvc.instanceConfig = publicConfig this.configSvc.rootOrg = publicConfig.rootOrg this.configSvc.org = publicConfig.org @@ -843,7 +847,13 @@ export class InitService { localStorage.platformratingTime = currentTime localStorage.setItem('ratingformID', JSON.stringify(item.data.actionData.formId)) localStorage.setItem('ratingfeedID', JSON.stringify(feedId)) - + } else if (item.category === 'NPS2' && item && item.data && item.data.actionData && item.data.actionData.formId) { + feedId.push(item.id) + // console.log(feedId, "feed id items============") + const currentTime = moment() + localStorage.platformratingTime = currentTime + localStorage.setItem('ratingformID', JSON.stringify(item.data.actionData.formId)) + localStorage.setItem('ratingfeedID', JSON.stringify(feedId)) } }) }