From 20536b88a0554d75ecfe322703bcf295eb339196 Mon Sep 17 00:00:00 2001 From: Vinod-V3 Date: Fri, 7 Apr 2023 20:51:06 +0530 Subject: [PATCH 1/8] ISSUE #ED-431 feat : Added Program details page --- scripts/deleteUnUsableIosIcon.js | 4 +- .../program-details.component.html | 50 +++++++ .../program-details.component.scss | 79 +++++++++++ .../program-details.component.spec.data.ts | 103 +++++++++++++++ .../program-details.component.ts | 123 ++++++++++++++++++ .../program-listing.component.ts | 2 +- .../manage-learn/programs/programs.module.ts | 9 +- .../manage-learn/shared/components/index.ts | 3 +- .../share-profile-data.component.html | 40 ++++++ .../share-profile-data.component.scss | 66 ++++++++++ .../share-profile-data.component.ts | 36 +++++ src/app/manage-learn/shared/shared.module.ts | 12 +- src/assets/i18n/en.json | 10 +- 13 files changed, 528 insertions(+), 9 deletions(-) create mode 100644 src/app/manage-learn/programs/program-details/program-details.component.html create mode 100644 src/app/manage-learn/programs/program-details/program-details.component.scss create mode 100644 src/app/manage-learn/programs/program-details/program-details.component.spec.data.ts create mode 100644 src/app/manage-learn/programs/program-details/program-details.component.ts create mode 100644 src/app/manage-learn/shared/components/share-profile-data/share-profile-data.component.html create mode 100644 src/app/manage-learn/shared/components/share-profile-data/share-profile-data.component.scss create mode 100644 src/app/manage-learn/shared/components/share-profile-data/share-profile-data.component.ts diff --git a/scripts/deleteUnUsableIosIcon.js b/scripts/deleteUnUsableIosIcon.js index 618d4049d..f6747d260 100644 --- a/scripts/deleteUnUsableIosIcon.js +++ b/scripts/deleteUnUsableIosIcon.js @@ -134,7 +134,9 @@ function deleteUnUsableIosIcon(ionicIconFilePath) { "arrow-up-circle-outline.svg", "arrow-down-circle-outline.svg", "caret-forward-circle.svg", - "ribbon.svg" + "ribbon.svg", + "chevron-up.svg", + "chevron-down.svg" ].includes(file))) { fs.unlinkSync(ionicIconFilePath + '/' + file); } diff --git a/src/app/manage-learn/programs/program-details/program-details.component.html b/src/app/manage-learn/programs/program-details/program-details.component.html new file mode 100644 index 000000000..1f9c935bb --- /dev/null +++ b/src/app/manage-learn/programs/program-details/program-details.component.html @@ -0,0 +1,50 @@ + + +
{{programDetails.programName}}
+
{{description}} + + {{ (showMore ? 'READ_LESS' : 'READ_MORE') | translate }} + +
+
+ + {{"FRMELEMNTS_LBL_JOIN_PROGRAM_POPUP" | translate}} + + +
+ {{"FRMELEMNTS_MSG_PROGRAM_JOINED" | translate:{'date':(endDate | date: 'd/M/yyyy')} }} +
+
+
+ +
+ + +
+ + +
+
{{data?.sectionName}}
+
+ +
+
+
+
+ + +
+
+
+ +
+ +
+
+
{{"EMPTY_SEARCH_RESULTS" | translate}}.
+
{{"FRMELEMNTS_MSG_NO_SOLUTIONS_FOR_PROGRAM" | translate:{'type':selectedSection} }}
+
+ + +
\ No newline at end of file diff --git a/src/app/manage-learn/programs/program-details/program-details.component.scss b/src/app/manage-learn/programs/program-details/program-details.component.scss new file mode 100644 index 000000000..463a39c4d --- /dev/null +++ b/src/app/manage-learn/programs/program-details/program-details.component.scss @@ -0,0 +1,79 @@ +@import 'src/assets/styles/_custom-mixins'; +@import "src/assets/styles/variables"; +@import "src/assets/styles/_variables.scss"; + +.details-block{ + margin-left: 0px; + padding: 15px; + .title{ + font-size: 18px; + font-weight: 700; + padding: 0px 15px; + margin-bottom: 10px; + color: $black; + } + .description{ + color: $black; + padding: 0px 15px; + font-weight: 600; + } +} + +.hr-line { + height: 1px; + border: 1px solid map-get($colors, medium_gray); + margin: 10px 0px; +} + +.program-joined-message{ + background-color: map-get($colors, light_red); + padding: 10px; + font-weight: 700; + margin: 0px 15px; + border-radius: 10px; + font-size: 12px; +} + +.read-more{ + color: $blue; + text-decoration-line: underline; + font-weight: 600; +} + +.section-filter{ + background-color: var(--app-secondary-background); + border-radius: 25px; +} + +.section-card{ + border-radius: 25px !important; + padding: 5px; + margin: 10px 0px; + background-color: var(--app-secondary-background); + .icon{ + background-color: $white; + box-shadow: var(--button-style-shadow); + height: 22px; + border-radius: 50%; + } +} + +.section-details{ + .section-name{ + font-size: 18px; + font-weight: 600; + color: map-get($colors, bright_blue); + text-transform:capitalize; + } + ion-icon{ + font-size: 22px; + } +} + +.no-data{ + margin: 100px 0px 50px 0px; + .message-1{ + font-size: 16px; + margin-bottom: 10px; + } +} \ No newline at end of file diff --git a/src/app/manage-learn/programs/program-details/program-details.component.spec.data.ts b/src/app/manage-learn/programs/program-details/program-details.component.spec.data.ts new file mode 100644 index 000000000..ab2950362 --- /dev/null +++ b/src/app/manage-learn/programs/program-details/program-details.component.spec.data.ts @@ -0,0 +1,103 @@ +export const solutionsList=[ + { + "_id": "60f80e3df87ea2376653e4fd", + "language": [ + "English" + ], + "externalId": "mutiple domains 4", + "name": "mutiple domains - multiple submission =false V2", + "description": "mutiple domains - multiple submission =false ", + "entityType": "state", + "type": "observation", + "endDate": "2022-07-21T12:08:29.023Z", + "link": "9d5692113b81824f4d9eb22f0e11fe8e", + "creator": "Diksha" + }, + { + "_id": "6051c03bd2c9fe2d56c365a5", + "language": [ + "English" + ], + "externalId": "mutiple domains", + "name": "mutiple domains", + "description": "mutiple domains", + "entityType": "state", + "type": "course", + "endDate": "2022-03-17T08:39:23.972Z", + "link": "2265710e82abd31b521e6175dc0fb913" + }, + { + "_id": "6052eb7e79c5f153ae7f27b8", + "language": [ + "English" + ], + "externalId": "a2e0ccbe-87ae-11eb-9117-441ca8998ea1-OBSERVATION-TEMPLATE_CHILD", + "name": "Test-observation-upload-pointBased", + "description": "This is a test observation upload for point based scoring system.", + "entityType": "state", + "type": "observation", + "endDate": "2022-03-18T05:56:14.599Z", + "link": "cd6cb122c0893c9b90434d5a536c53e3" + }, + { + "_id": "6051d9b2f39f6f3d6a493d27", + "language": [ + "English" + ], + "externalId": "mutiple domains 3", + "name": "mutiple domains - multiple submission =false", + "description": "mutiple domains - multiple submission =false ", + "entityType": "state", + "type": "course", + "endDate": "2022-03-17T10:28:02.170Z", + "link": "51e57c1e1b961d56810b038f7251fb73" + }, + { + "_id": "6051b4976fdee62367dfce62", + "language": [ + "English" + ], + "externalId": "multiple domain test", + "name": "multiple domain test", + "description": "multiple domain and multiple criteria without multipleAssessments", + "entityType": "state", + "type": "course", + "endDate": "2022-03-17T07:49:43.685Z", + "link": "3dbcec334041f542a37051a2b27989df" + }, + { + "_id": "605089da2df993615443f091", + "language": [ + "English" + ], + "externalId": "multiple domain and without multipleAssessments", + "name": "multiple domain and multipleAssessments", + "description": "multiple domain and multiple criteria without multipleAssessments", + "entityType": "state", + "type": "improvementProject", + "endDate": "2022-03-16T10:35:06.035Z", + "link": "5a60ff164f9d3e2ff837af7fc15bca80" + }, + { + "_id": "605084a02df993615443f06a", + "language": [ + "English" + ], + "externalId": "multiple domain and multiple criteria 2", + "name": "multiple domain and multiple criteria 2", + "description": "multiple domain and multiple criteria with multiple submission", + "entityType": "state", + "type": "course", + "endDate": "2022-03-16T10:12:48.159Z", + "link": "8a72ff5cf7589b46dd67f55f2b357755" + }, + { + "_id": "5ff9dc1b9259097d48017bbe", + "externalId": "MAHARASTHA-IMPROVEMENT-PROJECT", + "description": "Maharashtha improvement project description", + "name": "Come See Our School!- Parent Mela", + "projectTemplateId": "5ffbd53f5fc92a7dbc972906", + "projectId": "620531e1eaef6900071176b7", + "type": "improvementProject" + } + ] \ No newline at end of file diff --git a/src/app/manage-learn/programs/program-details/program-details.component.ts b/src/app/manage-learn/programs/program-details/program-details.component.ts new file mode 100644 index 000000000..cde823a91 --- /dev/null +++ b/src/app/manage-learn/programs/program-details/program-details.component.ts @@ -0,0 +1,123 @@ +import { Component, OnInit } from '@angular/core'; +import { AppHeaderService } from '@app/services'; +import { LibraryFiltersLayout } from '@project-sunbird/common-consumption'; +import { TranslateService } from '@ngx-translate/core'; +import { GenericPopUpService } from '../../shared'; +import { solutionsList } from './program-details.component.spec.data' + +@Component({ + selector: 'app-program-details', + templateUrl: './program-details.component.html', + styleUrls: ['./program-details.component.scss'], +}) +export class ProgramDetailsComponent implements OnInit { + headerConfig = { + showHeader : true, + showBurgerMenu : false, + actionButtons : [] + } + filtersList : any = [] + selectedFilterIndex = 0 + layout = LibraryFiltersLayout.ROUND + selectedSection: any + showMore:boolean=false + description + characterLimit = 150 + programDetails:any={ + data: solutionsList, + programJoined:false, + requestForPIIConsent:true, + count: 3, + programName: 'TEST_SCOPE_PROGRAM', + programId: '5ff438b04698083dbfab7284', + description: "View and participate in educational programs active in your location and designed for your role." + } + solutionsList:any=[] + filteredList:any=[] + sharingStatus='ACTIVE' + endDate=Date() + + constructor(private headerService: AppHeaderService, private translate: TranslateService, private popupService: GenericPopUpService) { + this.translate.get(['ALL','FRMELEMNTS_LBL_PROJECTS','FRMELEMNTS_LBL_OBSERVATIONS','FRMELEMNTS_LBL_COURSES','FRMELEMNTS_LBL_SURVEYS']).subscribe((translation)=>{ + this.filtersList = Object.keys(translation).map(translateItem => { return translation[translateItem]}) + }) + } + + ngOnInit() {} + + ionViewWillEnter(){ + this.headerConfig = this.headerService.getDefaultPageConfig() + this.headerConfig.showHeader = true + this.headerConfig.showBurgerMenu = false + this.headerConfig.actionButtons = [] + this.headerService.updatePageConfig(this.headerConfig) + this.readMoreOrLess() + this.formatList() + } + + readMoreOrLess(){ + if(this.showMore){ + this.description = this.programDetails.description + }else{ + if(this.programDetails.description.length > this.characterLimit){ + this.description = this.programDetails.description.slice(0,this.characterLimit)+'...' + }else{ + this.description = this.programDetails.description + } + } + } + + formatList(){ + this.programDetails.data.forEach(data => { + let sectionName=data.type=='improvementProject'?'projects':data.type+'s' + let index = this.solutionsList.findIndex((val)=>{return val.sectionName==sectionName}) + if(index!==-1){ + this.solutionsList[index].sectionList.push(data) + }else{ + let order=data.type=='improvementProject'?0:data.type=='observation'?1:data.type=='course'?2:3 + this.solutionsList.push({sectionName:sectionName,sectionList:[data],order:order}) + } + }); + this.filteredList=this.solutionsList.sort((a,b)=>{return a.order - b.order}) + this.selectedSection=this.solutionsList[0]?.sectionName + } + + onFilterChange(event){ + this.selectedFilterIndex = event.data.index + this.filteredList=this.solutionsList + if(event.data.index==0){ + this.selectedSection=this.solutionsList[0]?.sectionName + }else{ + let index =this.solutionsList.findIndex((data)=>{ + return data.sectionName == event.data.text.toLowerCase() + }) + if(index==-1){ + this.filteredList=[] + } + this.selectedSection = event.data.text.toLowerCase() + } + } + + joinProgram(){ + this.popupService.showJoinProgramForProjectPopup("FRMELEMNTS_LBL_JOIN_PROGRAM_POPUP",this.programDetails.programName,"all the resources in this program","FRMELEMNTS_LBL_JOIN_PROGRAM_POPUP").then( + (data:any)=>{ + if(data){ + this.programDetails.programJoined = true + } + } + ) + } + + showConsentPopup(){} + + cardClick(){ + if(!this.programDetails.programJoined){ + this.joinProgram() + } + } + + save(event){ + this.showConsentPopup() + } + +} \ No newline at end of file diff --git a/src/app/manage-learn/programs/program-listing/program-listing.component.ts b/src/app/manage-learn/programs/program-listing/program-listing.component.ts index 947581ba8..2f1b1461e 100644 --- a/src/app/manage-learn/programs/program-listing/program-listing.component.ts +++ b/src/app/manage-learn/programs/program-listing/program-listing.component.ts @@ -84,7 +84,7 @@ export class ProgramListingComponent implements OnInit { } selectedProgram(id) { - this.router.navigate([`/${RouterLinks.PROGRAM}/${RouterLinks.SOLUTIONS}`, id]); + this.router.navigate([`/${RouterLinks.PROGRAM}/details`]); } handleNavBackButton() { diff --git a/src/app/manage-learn/programs/programs.module.ts b/src/app/manage-learn/programs/programs.module.ts index 612a1d86f..20a0ae7d2 100644 --- a/src/app/manage-learn/programs/programs.module.ts +++ b/src/app/manage-learn/programs/programs.module.ts @@ -9,6 +9,8 @@ import { RouterLinks } from '@app/app/app.constant'; import { TranslateModule } from '@ngx-translate/core'; import { FormsModule } from '@angular/forms'; import { CoreModule } from '../core/core.module'; +import { ProgramDetailsComponent } from './program-details/program-details.component'; +import { CommonConsumptionModule } from '@project-sunbird/common-consumption'; const routes: Routes = [ { @@ -19,10 +21,14 @@ const routes: Routes = [ path: `${RouterLinks.SOLUTIONS}/:id`, component: SolutionListingComponent, }, + { + path: `details`, + component: ProgramDetailsComponent, + }, ]; @NgModule({ - declarations: [ProgramListingComponent, SolutionListingComponent], + declarations: [ProgramListingComponent, SolutionListingComponent, ProgramDetailsComponent], imports: [ CommonModule, RouterModule.forChild(routes), @@ -31,6 +37,7 @@ const routes: Routes = [ IonicModule, FormsModule, CoreModule, + CommonConsumptionModule, ], entryComponents:[] }) diff --git a/src/app/manage-learn/shared/components/index.ts b/src/app/manage-learn/shared/components/index.ts index fc933f6ff..947e71108 100644 --- a/src/app/manage-learn/shared/components/index.ts +++ b/src/app/manage-learn/shared/components/index.ts @@ -32,4 +32,5 @@ export * from './attachment-lists/attachment-lists.component'; export * from './report-list/report-list.component'; export * from './entity-search-local/entity-search-local.component'; export * from './start-improvement/start-improvement.component'; -export * from './join-program/join-program.component' +export * from './join-program/join-program.component'; +export * from './share-profile-data/share-profile-data.component' diff --git a/src/app/manage-learn/shared/components/share-profile-data/share-profile-data.component.html b/src/app/manage-learn/shared/components/share-profile-data/share-profile-data.component.html new file mode 100644 index 000000000..3ee3e2889 --- /dev/null +++ b/src/app/manage-learn/shared/components/share-profile-data/share-profile-data.component.html @@ -0,0 +1,40 @@ + +
+
+ {{'FRMELEMNTS_LBL_DATA_SETTINGS' | translate}} + +
+
+
{{'FRMELEMNTS_LBL_DATA_SHARING_ON' | translate}}
+
{{'FRMELEMNTS_LBL_DATA_SHARING_OFF' | translate}}
+

{{"FRMELEMNTS_MSG_SHARE_DATA_INFO" | translate:{'type':type} }} +
{{'DFLT_TRK_FRMELEMNTS_LBL_COURSE_LAST_UPDATED_ON' | translate:{'last_updated_on_date': lastUpdatedOn | date: 'dd/MM/yyyy'} }} +

+

{{"FRMELEMNTS_MSG_DONOT_SHARE_DATA_INFO" | translate:{'type':type} }}

+
{{ (showShareData ? 'FRMELEMNTS_BTN_CLOSE' : 'FRMELEMNTS_BTN_EDIT_SETTING') | translate }}
+
+
+
+
+
+ + {{'FRMELEMNTS_LBL_UPDATE_DATA_SETTINGS' | translate}} + + + + + {{'FRMELEMNTS_LBL_SHARE_PROFILE_INFORMATION' | translate}} + + + + {{'FRMELEMNTS_LBL_DONOT_SHARE_PROFILE_INFO' |translate}} + + + + +
+ {{'SAVE' | translate}} +
+
+
+
\ No newline at end of file diff --git a/src/app/manage-learn/shared/components/share-profile-data/share-profile-data.component.scss b/src/app/manage-learn/shared/components/share-profile-data/share-profile-data.component.scss new file mode 100644 index 000000000..02d31c8a5 --- /dev/null +++ b/src/app/manage-learn/shared/components/share-profile-data/share-profile-data.component.scss @@ -0,0 +1,66 @@ +@import 'src/assets/styles/_custom-mixins'; +@import "src/assets/styles/variables"; +@import "src/assets/styles/_variables.scss"; + + +ion-card{ + border-radius: 10px; +} + +.heading-icon-block{ + font-size: 1rem !important; + margin-top: 8px; + color: $black; + ion-icon{ + font-size: 1.5rem; + color: #024f9d; + } +} + +.data-share-header{ + margin-top: 10px; + .data-share-info{ + padding: 5px 0px; + font-size: 16px; + text-transform: uppercase; + } + p{ + font-size: 14px; + } +} + +.edit-setting{ + float: right; + padding: 12px; + color: $blue; + font-weight: bold; +} + +.hr{ + height: 1px; + border: 1px solid #E9DED3; + margin-top: 8px; +} + +.label-margin-bottom{ + margin-bottom: 3px !important; + padding-top: 10px; + font-size: 16px; +} + +.data-list{ + background: unset !important; +} + +.radio-item{ + --padding-start: 0px; +} + +.radio-detail{ + font-size: 14px; + color: map-get($colors, primary_black); +} + +ion-button{ + width: 8rem; +} \ No newline at end of file diff --git a/src/app/manage-learn/shared/components/share-profile-data/share-profile-data.component.ts b/src/app/manage-learn/shared/components/share-profile-data/share-profile-data.component.ts new file mode 100644 index 000000000..e45166d41 --- /dev/null +++ b/src/app/manage-learn/shared/components/share-profile-data/share-profile-data.component.ts @@ -0,0 +1,36 @@ +import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; + +@Component({ + selector: 'app-share-profile-data', + templateUrl: './share-profile-data.component.html', + styleUrls: ['./share-profile-data.component.scss'], +}) +export class ShareProfileDataComponent implements OnInit { + @Input() dataSharingStatus + @Input() type + @Input() lastUpdatedOn + @Output() save = new EventEmitter() + showShareData = false; + isDataShare = false; + + constructor() { } + + ngOnInit() {} + + toggleDataShare() { + this.isDataShare = !this.isDataShare; + this.showShareData = false; + } + + toggleEditSettings(){ + this.showShareData = !this.showShareData; + } + + saveChanges(){ + this.isDataShare = false + this.showShareData = false; + this.save.emit(this.dataSharingStatus) + + } + +} diff --git a/src/app/manage-learn/shared/shared.module.ts b/src/app/manage-learn/shared/shared.module.ts index a8dfef041..891556345 100644 --- a/src/app/manage-learn/shared/shared.module.ts +++ b/src/app/manage-learn/shared/shared.module.ts @@ -37,7 +37,8 @@ import { ReportListComponent, EntitySearchLocalComponent, StartImprovementComponent, - JoinProgramComponent + JoinProgramComponent, + ShareProfileDataComponent } from './components'; import { TranslateModule } from '@ngx-translate/core'; @@ -133,7 +134,8 @@ import { EntitySearchPipe } from './pipe/entity-local-search'; EntitySearchPipe, EntitySearchLocalComponent, StartImprovementComponent, - JoinProgramComponent + JoinProgramComponent, + ShareProfileDataComponent ], imports: [CommonModule, FormsModule, IonicModule, ReactiveFormsModule, TranslateModule, ChartsModule], @@ -193,7 +195,8 @@ import { EntitySearchPipe } from './pipe/entity-local-search'; EntitySearchPipe, EntitySearchLocalComponent, StartImprovementComponent, - JoinProgramComponent + JoinProgramComponent, + ShareProfileDataComponent ], providers: [ Camera, @@ -233,7 +236,8 @@ import { EntitySearchPipe } from './pipe/entity-local-search'; ReportListComponent, EntitySearchLocalComponent, StartImprovementComponent, - JoinProgramComponent + JoinProgramComponent, + ShareProfileDataComponent ], }) diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index 55ffa1053..f0690cb46 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -1379,5 +1379,13 @@ "FRMELEMNTS_LBL_START_OBSERVATION_POPUP_MSG1":"You must click on the Start observation button to access and edit the observation.", "FRMELEMNTS_LBL_START_OBSERVATION_POPUP_MSG2":"Click on the Start observation to get complete access to the content", "FRMELEMNTS_LBL_JOIN_PROGRAM_POPUP":"Join program", - "FRMELEMNTS_LBL_JOIN_PROGRAM_MSG":"Please join {{name}} program to view and access this {{type}}." + "FRMELEMNTS_LBL_JOIN_PROGRAM_MSG":"Please join {{name}} program to view and access this {{type}}.", + "FRMELEMNTS_MSG_NO_SOLUTIONS_FOR_PROGRAM":"There are no {{type}} attached to this program", + "FRMELEMNTS_MSG_PROGRAM_JOINED":"You have joined this program, please complete the resources by {{date}}", + "FRMELEMNTS_MSG_SHARE_DATA_INFO": "You have agreed to share your profile details with the {{type}} administrator", + "FRMELEMNTS_MSG_DONOT_SHARE_DATA_INFO": "You have not agreed to share your profile details with the {{type}} administrator", + "FRMELEMNTS_MSG_PROGRAM_NO_RESOURCES":"Please change and update your profile details to view program resources", + "FRMELEMNTS_LBL_OBSERVATIONS":"Observations", + "FRMELEMNTS_LBL_COURSES":"Courses", + "FRMELEMNTS_LBL_SURVEYS":"Surveys" } \ No newline at end of file From 9d05b0c0d026b597fa4945ee20d0a7f03dc85eb9 Mon Sep 17 00:00:00 2001 From: Vinod-V3 Date: Mon, 10 Apr 2023 19:06:28 +0530 Subject: [PATCH 2/8] Fetching details from api done --- .../program-details.component.html | 12 ++-- .../program-details.component.ts | 55 ++++++++++++++----- .../program-listing.component.ts | 2 +- .../manage-learn/programs/programs.module.ts | 2 +- 4 files changed, 50 insertions(+), 21 deletions(-) diff --git a/src/app/manage-learn/programs/program-details/program-details.component.html b/src/app/manage-learn/programs/program-details/program-details.component.html index 1f9c935bb..42368fba1 100644 --- a/src/app/manage-learn/programs/program-details/program-details.component.html +++ b/src/app/manage-learn/programs/program-details/program-details.component.html @@ -1,13 +1,13 @@ -
{{programDetails.programName}}
+
{{programDetails?.programName}}
{{description}} - + {{ (showMore ? 'READ_LESS' : 'READ_MORE') | translate }}
- + {{"FRMELEMNTS_LBL_JOIN_PROGRAM_POPUP" | translate}} @@ -31,8 +31,8 @@
-
- +
+
@@ -45,6 +45,6 @@
{{"EMPTY_SEARCH_RESULTS" | translate}}.
{{"FRMELEMNTS_MSG_NO_SOLUTIONS_FOR_PROGRAM" | translate:{'type':selectedSection} }}
- +
\ No newline at end of file diff --git a/src/app/manage-learn/programs/program-details/program-details.component.ts b/src/app/manage-learn/programs/program-details/program-details.component.ts index cde823a91..b3e3123c1 100644 --- a/src/app/manage-learn/programs/program-details/program-details.component.ts +++ b/src/app/manage-learn/programs/program-details/program-details.component.ts @@ -3,7 +3,10 @@ import { AppHeaderService } from '@app/services'; import { LibraryFiltersLayout } from '@project-sunbird/common-consumption'; import { TranslateService } from '@ngx-translate/core'; import { GenericPopUpService } from '../../shared'; -import { solutionsList } from './program-details.component.spec.data' +import { ActivatedRoute } from '@angular/router'; +import { urlConstants } from '../../core/constants/urlConstants'; +import { LoaderService, UtilsService } from '../../core'; +import { KendraApiService } from '../../core/services/kendra-api.service'; @Component({ selector: 'app-program-details', @@ -23,24 +26,25 @@ export class ProgramDetailsComponent implements OnInit { showMore:boolean=false description characterLimit = 150 - programDetails:any={ - data: solutionsList, - programJoined:false, - requestForPIIConsent:true, - count: 3, - programName: 'TEST_SCOPE_PROGRAM', - programId: '5ff438b04698083dbfab7284', - description: "View and participate in educational programs active in your location and designed for your role." - } + programDetails:any={} solutionsList:any=[] filteredList:any=[] sharingStatus='ACTIVE' endDate=Date() + programId + count = 0; + limit = 25; + page = 1; - constructor(private headerService: AppHeaderService, private translate: TranslateService, private popupService: GenericPopUpService) { + constructor(private headerService: AppHeaderService, private translate: TranslateService, private popupService: GenericPopUpService, + private activatedRoute: ActivatedRoute, private loader: LoaderService, private utils: UtilsService, private kendraService: KendraApiService) { this.translate.get(['ALL','FRMELEMNTS_LBL_PROJECTS','FRMELEMNTS_LBL_OBSERVATIONS','FRMELEMNTS_LBL_COURSES','FRMELEMNTS_LBL_SURVEYS']).subscribe((translation)=>{ this.filtersList = Object.keys(translation).map(translateItem => { return translation[translateItem]}) }) + activatedRoute.params.subscribe((param)=>{ + this.programId = param.id + this.getSolutions() + }) } ngOnInit() {} @@ -51,8 +55,33 @@ export class ProgramDetailsComponent implements OnInit { this.headerConfig.showBurgerMenu = false this.headerConfig.actionButtons = [] this.headerService.updatePageConfig(this.headerConfig) - this.readMoreOrLess() - this.formatList() + } + + async getSolutions() { + this.loader.startLoader(); + let payload = await this.utils.getProfileInfo(); + if (payload) { + const config = { + url:`${urlConstants.API_URLS.SOLUTIONS_LISTING}${this.programId}?page=${this.page}&limit=${this.limit}&search=`, + payload: payload, + }; + this.kendraService.post(config).subscribe( + (success) => { + this.loader.stopLoader(); + if (success.result.data) { + this.programDetails = success.result + this.count = success.result.count; + this.formatList() + this.readMoreOrLess() + } + }, + (error) => { + this.loader.stopLoader(); + } + ); + } else { + this.loader.stopLoader(); + } } readMoreOrLess(){ diff --git a/src/app/manage-learn/programs/program-listing/program-listing.component.ts b/src/app/manage-learn/programs/program-listing/program-listing.component.ts index 2f1b1461e..657eddef6 100644 --- a/src/app/manage-learn/programs/program-listing/program-listing.component.ts +++ b/src/app/manage-learn/programs/program-listing/program-listing.component.ts @@ -84,7 +84,7 @@ export class ProgramListingComponent implements OnInit { } selectedProgram(id) { - this.router.navigate([`/${RouterLinks.PROGRAM}/details`]); + this.router.navigate([`/${RouterLinks.PROGRAM}/${RouterLinks.DETAILS}`,id]); } handleNavBackButton() { diff --git a/src/app/manage-learn/programs/programs.module.ts b/src/app/manage-learn/programs/programs.module.ts index 20a0ae7d2..df3be4964 100644 --- a/src/app/manage-learn/programs/programs.module.ts +++ b/src/app/manage-learn/programs/programs.module.ts @@ -22,7 +22,7 @@ const routes: Routes = [ component: SolutionListingComponent, }, { - path: `details`, + path: `${RouterLinks.DETAILS}/:id`, component: ProgramDetailsComponent, }, ]; From 5c3ebb85b7ec314aa6e680aa72aaeacb1a4f1fe4 Mon Sep 17 00:00:00 2001 From: Vinod-V3 Date: Fri, 14 Apr 2023 11:04:22 +0530 Subject: [PATCH 3/8] Added message input for Join program popup --- .../components/join-program/join-program.component.html | 2 +- .../shared/components/join-program/join-program.component.ts | 1 + src/app/manage-learn/shared/generic.popup.ts | 5 +++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/app/manage-learn/shared/components/join-program/join-program.component.html b/src/app/manage-learn/shared/components/join-program/join-program.component.html index ada73dd23..7564ec88a 100644 --- a/src/app/manage-learn/shared/components/join-program/join-program.component.html +++ b/src/app/manage-learn/shared/components/join-program/join-program.component.html @@ -11,7 +11,7 @@