From 7cf1f1c151045dd2c9f08130eb3e5c10a1b9e9aa Mon Sep 17 00:00:00 2001 From: swayangjit Date: Tue, 28 Mar 2023 13:48:13 +0530 Subject: [PATCH 01/29] Issue #SB-000 chore: Updated ReadMe.md. --- README.md | 63 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 025fc9eda..5e23834a9 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,30 @@ -Recommended Branch - release-4.9.0 -Kindly mail back to sunbird to get the starter kit Which consists of two files: -a) google-services.json - To be Copied at the root of the project -b) sunbird.properties. - To be Copied into buildConfig/ folder +[![Circle CI - master branch](https://circleci.com/gh/Sunbird-Ed/SunbirdEd-portal/tree/master.svg?style=svg)](https://circleci.com/gh/Sunbird-Ed/SunbirdEd-mobile-app/tree/master.svg?style=svg) +[![Circle CI Badge](https://circleci.com/gh/Sunbird-Ed/SunbirdEd-mobile-app.svg?style=shield)]((https://circleci.com/gh/Sunbird-Ed/SunbirdEd-mobile-app.svg?style=shield)) +[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=Sunbird-Ed_SunbirdEd-mobile-app&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=Sunbird-Ed_SunbirdEd-portal) +[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=Sunbird-Ed_SunbirdEd-mobile-app&metric=coverage)](https://sonarcloud.io/summary/new_code?id=Sunbird-Ed_SunbirdEd-mobile-app) +[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=Sunbird-Ed_SunbirdEd-mobile-app&metric=ncloc)](https://sonarcloud.io/summary/new_code?id=Sunbird-Ed_SunbirdEd-mobile-app) +[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=Sunbird-Ed_SunbirdEd-portal&metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=Sunbird-Ed_SunbirdEd-mobile-app) +## What is the Sunbird Mobile app? +The Sunbird Mobile app is the app-based interface for the Sunbird application stack. It provides a app(android/ios) through which all functionality of Sunbird can be accessed. -**Dependencies:** -NPM Version - above 6 -Node Version - 14 (Recommended) -Cordova Version - 9 (Recommended) +Latest release- [release-5.1.0](https://github.com/Sunbird-Ed/SunbirdEd-mobile-app/releases/tag/release-5.1.0.9_RC1) + +Ongoing release- [release-5.2.0](https://github.com/Sunbird-Ed/SunbirdEd-mobile-app/tree/release-5.2.0) + +**Prerequisites:** +|Package| Version | Recommended Version | +|--|--|--| +[Node](https://nodejs.org/en/) | 12+ | 12.22.10 +[NPM](https://nodejs.org/en/) | 6+ | 6.14.16 +[Cordova](https://cordova.apache.org/) | 10+ | 10.1.2 +[Ionic](https://ionicframework.com/docs/intro/cli) | 5 | 5.7.0 +[Java(For Android)](https://www.oracle.com/in/java/technologies/downloads/) | 11+ | 11.0.15.1 +[Gradle(For Android)](https://gradle.org/install/) | 7+ | 7.0.2 +[CocoaPods(For Ios)](https://cocoapods.org/) | 1.11.3 | + +**Project Setup** **1. Ionic-Android build Setup** - [Install java](https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) @@ -26,15 +42,12 @@ Cordova Version - 9 (Recommended) CLI Setup - `npm install -g ionic` - `npm install -g cordova` - **2. Project Setup** - git clone the repo(https://github.com/Sunbird-Ed/SunbirdEd-mobile-app). - Rename `sunbird.properties.example` file to `sunbird.properties` and put all the valid credentials and api endpoint. - Run `./build.sh` - **3. Onboarding/Tabs Configuration** Onboarding steps and Tabs can be configured via this configuration settings. - **Onboarding Configurations** |Name|Description|Options| |----|-----|-----| @@ -42,7 +55,6 @@ Cordova Version - 9 (Recommended) |User Role Selection|User should select their role|If want to skip User Type selection, set skip as false and provide default user type| |Profile Settings|User should set their profile by choosing their framework fields|Provide deafult profile values to skip profile settings page| |District Maping|Here user need to provide details related to their location|To skip this page deafult location values are required| - #### Language Selection ``` { @@ -58,7 +70,6 @@ Cordova Version - 9 (Recommended) ] } ``` - #### User Role Selection ``` { @@ -71,7 +82,6 @@ Cordova Version - 9 (Recommended) ] } ``` - #### Profile Settings ``` { @@ -115,11 +125,8 @@ Cordova Version - 9 (Recommended) ] } ``` - **Tabs Page COnfigurations** - Configure the tabs page according to the requirement. Fllowing are the configurable settings for tabs. - ``` { "tabs": [ @@ -143,7 +150,6 @@ Configure the tabs page according to the requirement. Fllowing are the configura ] } ``` - |Property|Description|Value| |----|----|----| |`root`|On which page the tab should be shown.|`home`| @@ -159,19 +165,18 @@ Configure the tabs page according to the requirement. Fllowing are the configura |`status`|To display to a spefic user criteria|ex: 'logIn' will show to logged in users only| |`userTypeAdmin`|Wheather to show for only Admin users|Boolean value| - **4. How to build apk** - - To check attached devices do `adb devices` - - `npm run ionic-build` (Make sure you have attached device) - - `ionic cordova run android --prod` - - Apk location `project_folder/platforms/android/app/build/outputs/apk/staging/debug/apk_name.apk` - + - To check attached devices do `adb devices` + - `npm run ionic-build` (Make sure you have attached device) + - `ionic cordova run android --prod` + - Apk location `project_folder/platforms/android/app/build/outputs/apk/staging/debug/apk_name.apk` + **5. How to debug apk** - - Open chrome and enter `chrome://inspect` - - Select app + - Open chrome and enter `chrome://inspect` + - Select app --------------------------------------- -# IOS Development setup +## IOS Development setup ## Prerequisites 1. Node js version 10.18.1 2. Ionic 5.4.16 using `npm i ionic@5.4.16 -g` @@ -180,7 +185,6 @@ Configure the tabs page according to the requirement. Fllowing are the configura 5. ios-deploy 1.11.4 - using `brew install ios-deploy` all of the above should be installed globally Xcode 12.4 Build version 12D4e or above - NOTE: For M1 chipset users please go through FAQ section for ROSETA 2 compatibility and usage. ## Steps @@ -208,5 +212,4 @@ Configure the tabs page according to the requirement. Fllowing are the configura Check is JAVA_HOME is set by runnig `echo $JAVA_HOME`, if you get the installation path as output then JAVA_HOME is set For Further details follow the link - https://stackoverflow.com/a/50683158/4259981 4. (iOS Setup only) POD installation - https://cocoapods.org/ -5. (Android Setup only) Gradle installation - https://gradle.org/install/ - +5. (Android Setup only) Gradle installation - https://gradle.org/install/ \ No newline at end of file From 9c52829de2738fc32c497e0626aec51fe3f8868a Mon Sep 17 00:00:00 2001 From: Vishwanath Date: Fri, 12 May 2023 00:05:57 +0530 Subject: [PATCH 02/29] ISSUE #ED-1514 feat : Deleting evidence attached while creating new task --- .../project/add-file/add-file.page.ts | 4 ++-- .../attachment-listing.page.ts | 16 +++++++++++++--- .../add-link-modal/add-link-modal.component.ts | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/app/manage-learn/project/add-file/add-file.page.ts b/src/app/manage-learn/project/add-file/add-file.page.ts index c34639324..1ba9a2670 100644 --- a/src/app/manage-learn/project/add-file/add-file.page.ts +++ b/src/app/manage-learn/project/add-file/add-file.page.ts @@ -159,8 +159,8 @@ export class AddFilePage implements OnInit { delete(index) { this.attachments.splice(index, 1); - this.update('delete'); - this.task.isEdit = true; + this.update('save'); + this.taskId ? this.task.isEdit = true :''; } async onAction(event) { diff --git a/src/app/manage-learn/project/attachment-listing/attachment-listing.page.ts b/src/app/manage-learn/project/attachment-listing/attachment-listing.page.ts index 9487f0bab..6e71c7d8a 100644 --- a/src/app/manage-learn/project/attachment-listing/attachment-listing.page.ts +++ b/src/app/manage-learn/project/attachment-listing/attachment-listing.page.ts @@ -100,15 +100,13 @@ export class AttachmentListingPage implements OnInit { project: {}, tasks: [] }; - if (this.project.status == this.statuses.submitted) { + if (this.project.remarks || (this.project.attachments && this.project.attachments.length)) { let evidence = { title: this.project.title, remarks: this.project.remarks ? this.project.remarks : '', attachments: [] } - if(this.project.attachments && this.project.attachments.length){ this.getEvidences(this.project.attachments, evidence); - } if ((this.type && evidence.remarks) || evidence.attachments.length) { this.attachments.project=evidence; } @@ -214,6 +212,18 @@ export class AttachmentListingPage implements OnInit { this.deleteConfirmation(event.data); } deleteAttachment(attachment) { + let ProjectLoopAgain : boolean = true; + if(this.project.attachments &&this.project.attachments.length ){ + let i = _.findIndex( this.project.attachments, (item) => { + if(item.type == this.type){ + return item.name == attachment.name; + } + }); + if(i >= 0){ + this.project.attachments.splice(i, 1); + ProjectLoopAgain = false; + } + } if (this.project.tasks && this.project.tasks.length) { let loopAgain : boolean = true; this.project.tasks.forEach(task => { diff --git a/src/app/manage-learn/shared/components/add-link-modal/add-link-modal.component.ts b/src/app/manage-learn/shared/components/add-link-modal/add-link-modal.component.ts index ee2b459e9..f25770bb7 100644 --- a/src/app/manage-learn/shared/components/add-link-modal/add-link-modal.component.ts +++ b/src/app/manage-learn/shared/components/add-link-modal/add-link-modal.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit, Output, EventEmitter } from '@angular/core'; -import { ToastService } from '@app/app/manage-learn/core'; +import {ToastService} from '../../../core/services/toast/toast.service'; @Component({ selector: 'app-add-link-modal', templateUrl: './add-link-modal.component.html', From 1b91cb8cd70268c64a4fffde84b809a8d477136e Mon Sep 17 00:00:00 2001 From: Vishwanath Date: Fri, 12 May 2023 12:13:56 +0530 Subject: [PATCH 03/29] ISSUE datepickerIssue fix: Date picker issue fix in angular 13 --- .../project-operation.page.html | 25 ++++---- .../project-operation.page.ts | 15 ++++- .../project/task-view/task-view.page.html | 16 ++--- .../project/task-view/task-view.page.ts | 7 +++ .../create-task-form.component.html | 59 +++++++++++-------- .../create-task-form.component.scss | 47 ++++++++++++++- .../date-type-input.component.html | 15 +++-- .../date-type-input.component.ts | 8 +++ 8 files changed, 137 insertions(+), 55 deletions(-) diff --git a/src/app/manage-learn/project/project-operation/project-operation.page.html b/src/app/manage-learn/project/project-operation/project-operation.page.html index 5b9832dbe..a3b3a8325 100644 --- a/src/app/manage-learn/project/project-operation/project-operation.page.html +++ b/src/app/manage-learn/project/project-operation/project-operation.page.html @@ -24,34 +24,35 @@ - {{'FRMELEMNTS_LBL_FROM' | translate }} + {{'FRMELEMNTS_LBL_FROM' | translate }} - - + + + placeholder={{today}} (ngModelChange)="resetEndDate($event)"> - - + - {{'FRMELEMNTS_LBL_TO' | translate}} + {{'FRMELEMNTS_LBL_TO' | translate }} - - + + + value={{today}} [(ngModel)]="template.endDate" class="project-date" placeholder={{today}} (ngModelChange)="setEndDate(false)"> - - + diff --git a/src/app/manage-learn/project/project-operation/project-operation.page.ts b/src/app/manage-learn/project/project-operation/project-operation.page.ts index 3dc2c9824..2ef8d93ba 100644 --- a/src/app/manage-learn/project/project-operation/project-operation.page.ts +++ b/src/app/manage-learn/project/project-operation/project-operation.page.ts @@ -37,6 +37,9 @@ export class ProjectOperationPage { templateCopy; viewProjectAlert; private backButtonFunc: Subscription; + projectEndDateModalOpen : boolean = false; + projecStartDateModalOpen : boolean = false; + headerConfig = { showHeader: true, showBurgerMenu: false, @@ -256,10 +259,11 @@ export class ProjectOperationPage { } resetEndDate(event) { - if (event.detail && event.detail.value && (event.detail.value != this.templateCopy.startDate)) { - this.endDateMin = moment(event.detail.value).format("YYYY-MM-DD"); + if (event && (event != this.templateCopy.startDate)) { + this.endDateMin = moment(event).format("YYYY-MM-DD"); this.template.endDate = this.template.endDate ? '' : ''; } + this.projecStartDateModalOpen = false; } isMandatoryFieldsFilled() { const isProgramPresent = (this.selectedProgram && this.selectedProgram.name) || (this.selectedProgram && this.selectedProgram._id); @@ -346,4 +350,11 @@ export class ProjectOperationPage { this.viewProjectAlert.dismiss(); } } + + setEndDate(isOpen: boolean) { + this.projectEndDateModalOpen = isOpen; + } + setStartDate(isOpen: boolean) { + this.projecStartDateModalOpen = isOpen; + } } diff --git a/src/app/manage-learn/project/task-view/task-view.page.html b/src/app/manage-learn/project/task-view/task-view.page.html index 2635e7243..2cc129f5f 100644 --- a/src/app/manage-learn/project/task-view/task-view.page.html +++ b/src/app/manage-learn/project/task-view/task-view.page.html @@ -10,14 +10,14 @@

{{task?.name}}

- - - - - - - + + + + + + + diff --git a/src/app/manage-learn/project/task-view/task-view.page.ts b/src/app/manage-learn/project/task-view/task-view.page.ts index 2468d10f1..5b5f20687 100644 --- a/src/app/manage-learn/project/task-view/task-view.page.ts +++ b/src/app/manage-learn/project/task-view/task-view.page.ts @@ -52,6 +52,7 @@ export class TaskViewPage { }; viewOnlyMode: boolean = false; stateData; + taskDateModalOpen = false; constructor( private router: Router, @@ -422,4 +423,10 @@ export class TaskViewPage { return this.subTaskCount > 0; } } + setOpen(isOpen: boolean, type ? : any) { + this.taskDateModalOpen = isOpen; + if(type && type =='update'){ + this.update(); + } + } } \ No newline at end of file diff --git a/src/app/manage-learn/shared/components/create-task-form/create-task-form.component.html b/src/app/manage-learn/shared/components/create-task-form/create-task-form.component.html index a4ec295f1..9011eb88e 100644 --- a/src/app/manage-learn/shared/components/create-task-form/create-task-form.component.html +++ b/src/app/manage-learn/shared/components/create-task-form/create-task-form.component.html @@ -16,25 +16,22 @@ +
{{'FRMELEMNTS_LBL_END_DATE' | translate}} - - - - - - Close - - - -
- Close -
-
-
+
+
+ + + + + + + + +
@@ -50,21 +47,31 @@
-

- - {{file.name}} -

+
+
+ + + + {{file.name}}
+
+ +
+
- - +
{{'FRMELEMNTS_LBL_ADD_TASK' | translate}} diff --git a/src/app/manage-learn/shared/components/create-task-form/create-task-form.component.scss b/src/app/manage-learn/shared/components/create-task-form/create-task-form.component.scss index dc68b6c7d..9e80ae701 100644 --- a/src/app/manage-learn/shared/components/create-task-form/create-task-form.component.scss +++ b/src/app/manage-learn/shared/components/create-task-form/create-task-form.component.scss @@ -19,7 +19,7 @@ font-size: $font-size-base; color: #999999; padding: 0px; - margin: 0px; + margin: 15px auto; } } .custom-datetime-label{ @@ -33,7 +33,7 @@ margin-bottom: 15px; } .file-list{ - margin: auto; + margin: auto 0px; font-size: 1.5rem; } .custom-item{ @@ -48,6 +48,7 @@ --border-color: #999999 !important; } .attachments-box{ + color: $black-color !important; background: $white; margin-bottom: 35px; height: auto; @@ -61,9 +62,21 @@ color: #{$blue}; text-align:right; float: right; - margin: 10px 10px; + margin: 10px 0px; } } + + .attachment-label{ + ion-icon{ + font-size: 1.25rem; + position: absolute; + } + span{ + margin-left:25px; + word-break: break-all; + } + } + .img{ margin: 5px 5px; margin-bottom: -5px; @@ -77,6 +90,27 @@ margin-bottom: 5px; font-weight: 500; } + .align-item{ + align-items: baseline; + margin: 5px 0px; + } + .action-btn{ + background: transparent; + box-shadow: none !important; + margin-top: -7px; + p{ + margin-bottom: 0px; + font-size: 0.75rem !important; + margin-top: -5px; + text-align: center; + font-weight: 600; + color: $black-color !important; + } + } + ion-icon{ + font-size: 1.25rem; + color: $black-color !important; + } } .container { margin-top: env(safe-area-inset-top); @@ -85,4 +119,11 @@ ion-content ion-button { font-size: 0.875rem; height: 2.25rem; +} + +.text-right { + text-align: right; + } +.flex{ + display: flex; } \ No newline at end of file diff --git a/src/app/manage-learn/shared/components/date-type-input/date-type-input.component.html b/src/app/manage-learn/shared/components/date-type-input/date-type-input.component.html index f92a3c1c5..7a1431673 100644 --- a/src/app/manage-learn/shared/components/date-type-input/date-type-input.component.html +++ b/src/app/manage-learn/shared/components/date-type-input/date-type-input.component.html @@ -11,25 +11,32 @@

{{'FRMELEMENTS_LBL_DATE'| translate}} - + + + - - - + + diff --git a/src/app/manage-learn/shared/components/date-type-input/date-type-input.component.ts b/src/app/manage-learn/shared/components/date-type-input/date-type-input.component.ts index b7b210ab7..99257fcc1 100644 --- a/src/app/manage-learn/shared/components/date-type-input/date-type-input.component.ts +++ b/src/app/manage-learn/shared/components/date-type-input/date-type-input.component.ts @@ -24,6 +24,7 @@ export class DateTypeInputComponent implements OnInit { questionValid: boolean; currentDate; futureDate; + calendarOpen : boolean = false; constructor( private utils: UtilsService, @@ -60,6 +61,7 @@ export class DateTypeInputComponent implements OnInit { this.data.validation.max = this.data.validation.max === "currentDate" ? new Date().toISOString().split('T')[0] : this.data.validation.max; this.data.validation.min = this.data.validation.min === "currentDate" ? new Date().toISOString().split('T')[0] : this.data.validation.min; this.checkForValidation(); + if(this.data?.dateFormat)this.data.dateFormat = this.data?.dateFormat.replace("DD", "dd") this.data.startTime = this.data.startTime ? this.data.startTime : Date.now(); } @@ -71,6 +73,12 @@ export class DateTypeInputComponent implements OnInit { checkForValidation(): void { this.data.isCompleted = this.utils.isQuestionComplete(this.data); this.data.endTime = this.questionValid ? Date.now() : ""; + this. calendarPopover(false); } + calendarPopover(isOpen : boolean){ + if(!this.data?.autoCapture){ + this.calendarOpen = isOpen; + } + } } From 9a5286bc786d99f8988eccfea9c0920b1d112a23 Mon Sep 17 00:00:00 2001 From: Vinod-V3 Date: Fri, 12 May 2023 16:44:17 +0530 Subject: [PATCH 04/29] ISSUE #ED-431 feat : Added program details page UI --- scripts/deleteUnUsableIosIcon.js | 4 +- .../program-details.component.html | 50 +++++ .../program-details.component.scss | 79 ++++++++ .../program-details.component.ts | 173 ++++++++++++++++++ .../program-listing.component.ts | 2 +- .../manage-learn/programs/programs.module.ts | 9 +- .../manage-learn/shared/components/index.ts | 2 + .../pii-consent-popup.component.html | 42 +++++ .../pii-consent-popup.component.scss | 76 ++++++++ .../pii-consent-popup.component.ts | 114 ++++++++++++ .../share-profile-data.component.html | 40 ++++ .../share-profile-data.component.scss | 66 +++++++ .../share-profile-data.component.ts | 36 ++++ src/app/manage-learn/shared/generic.popup.ts | 40 ++++ src/app/manage-learn/shared/shared.module.ts | 12 +- src/assets/i18n/en.json | 16 +- 16 files changed, 754 insertions(+), 7 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.ts create mode 100644 src/app/manage-learn/shared/components/pii-consent-popup/pii-consent-popup.component.html create mode 100644 src/app/manage-learn/shared/components/pii-consent-popup/pii-consent-popup.component.scss create mode 100644 src/app/manage-learn/shared/components/pii-consent-popup/pii-consent-popup.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..ee33da904 --- /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':(programDetails?.programEndDate | 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.ts b/src/app/manage-learn/programs/program-details/program-details.component.ts new file mode 100644 index 000000000..4115ea284 --- /dev/null +++ b/src/app/manage-learn/programs/program-details/program-details.component.ts @@ -0,0 +1,173 @@ +import { Component, OnInit } from '@angular/core'; +import { AppHeaderService } from '../../../../../src/services/app-header.service'; +import { LibraryFiltersLayout } from '@project-sunbird/common-consumption'; +import { TranslateService } from '@ngx-translate/core'; +import { GenericPopUpService } from '../../shared'; +import { ActivatedRoute } from '@angular/router'; +import { urlConstants } from '../../core/constants/urlConstants'; +import { LoaderService, UtilsService, ToastService } from '../../core'; +import { KendraApiService } from '../../core/services/kendra-api.service'; + +@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={} + solutionsList:any=[] + filteredList:any=[] + sharingStatus='ACTIVE' + programId + count = 0; + limit = 25; + page = 1; + + constructor(private headerService: AppHeaderService, private translate: TranslateService, private popupService: GenericPopUpService, + private activatedRoute: ActivatedRoute, private loader: LoaderService, private utils: UtilsService, private kendraService: KendraApiService, + private toastService: ToastService) { + this.translate.get(['ALL','FRMELEMNTS_LBL_PROJECTS','FRMELEMNTS_LBL_OBSERVATIONS','FRMELEMNTS_LBL_SURVEY']).subscribe((translation)=>{ + this.filtersList = Object.keys(translation).map(translateItem => { return translation[translateItem]}) + }) + activatedRoute.params.subscribe((param)=>{ + this.programId = param.id + this.getSolutions() + }) + } + + ngOnInit() {} + + ionViewWillEnter(){ + this.headerConfig = this.headerService.getDefaultPageConfig() + this.headerConfig.showHeader = true + this.headerConfig.showBurgerMenu = false + this.headerConfig.actionButtons = [] + this.headerService.updatePageConfig(this.headerConfig) + } + + 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(){ + 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=='survey'?data.type: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:2 + this.solutionsList.push({sectionName:sectionName,sectionList:[data],order:order}) + } + }); + this.filteredList=this.solutionsList.sort((a,b)=>{return a.order - b.order}) + } + + onFilterChange(event){ + this.selectedFilterIndex = event.data.index + this.filteredList=this.solutionsList + this.selectedSection = '' + if(event.data.index!==0){ + this.filteredList = this.solutionsList.filter((data)=>{ + return data.sectionName == event.data.text.toLowerCase() + }) + this.selectedSection = event.data.text.toLowerCase() + } + } + + joinProgram(){ + // this.popupService.showJoinProgramForProjectPopup("FRMELEMNTS_LBL_JOIN_PROGRAM_POPUP",this.programDetails.programName,'program', + // "FRMELEMNTS_LBL_JOIN_PROGRAM_POPUP","FRMELEMNTS_LBL_JOIN_PROGRAM_MSG2").then( + // (data:any)=>{ + // if(data){ + // this.showConsentPopup() + // } + // } + // ) + } + + showConsentPopup(message?){ + this.popupService.showConsent('program').then((data)=>{ + if(data!==undefined){ + this.programDetails.programJoined = true + if(message){ + this.toastService.openToast(message) + } + } + }) + } + + cardClick(){ + if(!this.programDetails.programJoined){ + this.joinProgram() + } + } + + save(event){ + let message + this.translate.get(['FRMELEMNTS_MSG_DATA_SETTINGS_UPDATE_SUCCESS']).subscribe((msg)=>{ + message = msg['FRMELEMNTS_MSG_DATA_SETTINGS_UPDATE_SUCCESS'] + }) + if(this.sharingStatus!==event){ + this.showConsentPopup(message) + this.sharingStatus=event + }else{ + this.toastService.openToast(message) + } + } + + ionViewWillLeave(){ + this.popupService.closeConsent() + } + + selectSection(name){ + this.selectedSection = name + } +} \ 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 53c1fee13..c6eda6b6b 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}/${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 933c901ea..e54c60641 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.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: `${RouterLinks.DETAILS}/:id`, + 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 ] }) export class ProgramsModule {} diff --git a/src/app/manage-learn/shared/components/index.ts b/src/app/manage-learn/shared/components/index.ts index 81e34234c..fd58fa45e 100644 --- a/src/app/manage-learn/shared/components/index.ts +++ b/src/app/manage-learn/shared/components/index.ts @@ -32,3 +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 './share-profile-data/share-profile-data.component'; +export * from './pii-consent-popup/pii-consent-popup.component' diff --git a/src/app/manage-learn/shared/components/pii-consent-popup/pii-consent-popup.component.html b/src/app/manage-learn/shared/components/pii-consent-popup/pii-consent-popup.component.html new file mode 100644 index 000000000..d7828f869 --- /dev/null +++ b/src/app/manage-learn/shared/components/pii-consent-popup/pii-consent-popup.component.html @@ -0,0 +1,42 @@ + + + {{'PROFILE_DETAILS_TITLE' | translate}} + + + +
+
+
+
+

+ {{element.key}} + {{element.value}} +

+
+
+ +
+
\ No newline at end of file diff --git a/src/app/manage-learn/shared/components/pii-consent-popup/pii-consent-popup.component.scss b/src/app/manage-learn/shared/components/pii-consent-popup/pii-consent-popup.component.scss new file mode 100644 index 000000000..e9f8c93f6 --- /dev/null +++ b/src/app/manage-learn/shared/components/pii-consent-popup/pii-consent-popup.component.scss @@ -0,0 +1,76 @@ +@import "src/assets/styles/base/_variables.scss"; +@import "src/assets/styles/_variables.scss"; +@import "src/assets/styles/_custom-mixins.scss"; + + +ion-header{ + background-color: white !important; +} + +#main-content { + overflow-y: scroll; + background-color: var(--app-secondary-background); +} + +.consent-popover-info { + overflow: hidden; + padding: 14px; +} + +.body { + flex-grow: 1; + flex-shrink: 1; + height: 38vh; + overflow-y: scroll; +} + +.footer { + flex-grow: 0; + flex-shrink: 0; +} + +.terms-checkbox{ + --background-checked: #{$blue}; + --border-color: #{$blue}; + --border-radius: 4px; + --border-width: 0.063rem; + --border-color-checked:#{$blue}; +} + +.button-section{ + ion-button{ + flex: 1; + height: 45px; + margin-left: 15px; + margin-right: 15px; + font-size: 16px; + color: var(--app-primary); + --background: white !important; + --border-radius: 15px !important + } + + .disable{ + pointer-events: none; + } + + .enable{ + color: white; + --background : var(--app-primary) !important + } +} + +.profile-info{ + color: map-get($colors, granite_gray); + font-family: "Noto Sans", sans-serif; + font-size: $font-size-base; + letter-spacing: 0; +} + +.profile-info-section{ + display: grid; + grid-template-columns: 100px 227px; +} + +.terms-info{ + color: $blue +} \ No newline at end of file diff --git a/src/app/manage-learn/shared/components/pii-consent-popup/pii-consent-popup.component.ts b/src/app/manage-learn/shared/components/pii-consent-popup/pii-consent-popup.component.ts new file mode 100644 index 000000000..41cb03636 --- /dev/null +++ b/src/app/manage-learn/shared/components/pii-consent-popup/pii-consent-popup.component.ts @@ -0,0 +1,114 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { AppGlobalService, CommonUtilService, FormAndFrameworkUtilService, UtilityService } from '../../../../../../src/services'; +import { PopoverController } from '@ionic/angular'; +@Component({ + selector: 'app-pii-consent-popup', + templateUrl: './pii-consent-popup.component.html', + styleUrls: ['./pii-consent-popup.component.scss'], +}) +export class PiiConsentPopupComponent implements OnInit { + + @Input() consentMessage1 + @Input() consentMessage2 + @Input() consentMessage3 + @Input() redirectLink + isAgreed=false + profile + detailsList=[] + + constructor(private appGlobalService: AppGlobalService, private formAndFrameworkUtilService: FormAndFrameworkUtilService, + private commonUtilService: CommonUtilService, private popoverCtrl: PopoverController, private utilityService: UtilityService) { } + + ngOnInit() {} + + async ionViewWillEnter() { + this.profile = this.appGlobalService.getCurrentUser(); + const profileKeys = await this.formAndFrameworkUtilService.getConsentFormConfig(); + profileKeys.forEach(element => { + this.detailsList.push({ + key: this.commonUtilService.getTranslatedValue(element.templateOptions.placeHolder, + JSON.parse(element.templateOptions.placeHolder)['en']), + value: this.convertDataSrcToObject(element) + }); + }); +} + + +convertDataSrcToObject(ele) { + const dataSrc = ele.templateOptions.dataSrc; + switch (dataSrc.marker) { + case 'SERVER_PROFILE': + if (ele.code === 'emailId' || ele.code === 'phoneNumber') { + if (ele.code === 'emailId') { + return this.profile.serverProfile['email'] ? this.profile.serverProfile['email'] : + (this.profile.serverProfile['maskedEmail'] ? this.profile.serverProfile['maskedEmail'] : '-'); + } else { + return this.profile.serverProfile['phone'] ? this.profile.serverProfile['phone'] : + (this.profile.serverProfile['maskedPhone'] ? this.profile.serverProfile['maskedPhone'] : '-'); + } + } else { + if (ele.code === 'externalIds') { + let externalId = '-'; + if (this.profile.serverProfile[dataSrc.params.categoryCode] ) { + this.profile.serverProfile[dataSrc.params.categoryCode].forEach((externaleId) => { + if (externaleId.provider === this.profile.serverProfile.channel) { + externalId = externaleId.id; + } + }); + } + return externalId; + } else { + return this.profile.serverProfile[dataSrc.params.categoryCode] ? + this.profile.serverProfile[dataSrc.params.categoryCode] : '-'; + } + } + case 'SERVER_PROFILE_LOCATIONS': + let location = '-'; + if (this.profile.serverProfile.userLocations && this.profile.serverProfile.userLocations.length) { + this.profile.serverProfile.userLocations.forEach(element => { + if (element.type === ele.code) { + location = element.name; + } else if (ele.code === 'schoolId' && element.type === 'school' ) { + location = element.code; + } + }); + } + return location; + case 'SERVER_PROFILE_DECLARED': + if (this.profile.serverProfile.declarations.length && this.profile.serverProfile.declarations[0].info) { + return this.profile.serverProfile.declarations[0].info[dataSrc.params.categoryCode] ? + this.profile.serverProfile.declarations[0].info[dataSrc.params.categoryCode] : '-'; + } else if (ele.code === 'emailId' || ele.code === 'phoneNumber') { + if (ele.code === 'emailId') { + return this.profile.serverProfile['maskedEmail'] ? this.profile.serverProfile['maskedEmail'] : '-'; + } else { + return this.profile.serverProfile['maskedPhone'] ? this.profile.serverProfile['maskedPhone'] : '-'; + } + } + return '-'; + default: + return '-'; + } +} + + + async openTermsOfUse(){ + const baseUrl = await this.utilityService.getBuildConfigValue('TOU_BASE_URL'); + const url = baseUrl + this.redirectLink; + const options = 'hardwareback=yes,clearcache=no,zoom=no,toolbar=yes,disallowoverscroll=yes'; + (window as any).cordova.InAppBrowser.open(url, '_blank', options); + } + + changeEvent(event) { + this.isAgreed = event.target.checked; + } + + share() { + this.popoverCtrl.dismiss(true) + } + + dontShare() { + this.popoverCtrl.dismiss(false) + } + +} 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/generic.popup.ts b/src/app/manage-learn/shared/generic.popup.ts index 9bd148295..88d519c96 100644 --- a/src/app/manage-learn/shared/generic.popup.ts +++ b/src/app/manage-learn/shared/generic.popup.ts @@ -4,11 +4,14 @@ import { PopoverController } from '@ionic/angular'; import { SbGenericPopoverComponent } from '../../../app/components/popups/sb-generic-popover/sb-generic-popover.component'; import { CommonUtilService } from '../../../services/common-util.service'; import { StartImprovementComponent } from './components/start-improvement/start-improvement.component'; +import { PiiConsentPopupComponent } from './components/pii-consent-popup/pii-consent-popup.component'; +import { RouterLinks } from '../../../app/app.constant'; @Injectable({ providedIn: 'root', }) export class GenericPopUpService { + consentPopup: any constructor(private popOverCtrl: PopoverController, private commonUtils: CommonUtilService) {} async showPPPForProjectPopUp(message, message1, linkLabel, header, link, type) { @@ -73,4 +76,41 @@ export class GenericPopUpService { const { data } = await alert.onDidDismiss(); return data; } + +async showConsent(type?){ + let componentProps={} + switch (type) { + case 'program': + componentProps={ + consentMessage1 : "FRMELEMNTS_LBL_CONSENT_POPUP_MSG1", + consentMessage2 : "FRMELEMNTS_LBL_CONSENT_POPUP_POLICY_MSG", + consentMessage3 : "FRMELEMNTS_LBL_CONSENT_POPUP_MSG2", + redirectLink : RouterLinks.TERM_OF_USE + } + break; + + default: + componentProps={ + consentMessage1 : "FRMELEMNTS_LBL_CONSENT_POPUP_MSG1", + consentMessage2 : "FRMELEMNTS_LBL_CONSENT_POPUP_POLICY_MSG", + consentMessage3 : "FRMELEMNTS_LBL_CONSENT_POPUP_MSG2", + redirectLink : RouterLinks.TERM_OF_USE + } + break; + } + this.consentPopup = await this.popOverCtrl.create({ + component : PiiConsentPopupComponent, + componentProps : componentProps, + cssClass: 'sb-popover back-drop-hard', + backdropDismiss: false + }) + await this.consentPopup.present() + let {data} = await this.consentPopup.onDidDismiss() + return data +} + +async closeConsent(){ + this.consentPopup ? await this.consentPopup.dismiss() : null +} + } \ No newline at end of file diff --git a/src/app/manage-learn/shared/shared.module.ts b/src/app/manage-learn/shared/shared.module.ts index 963a42469..89890a7eb 100644 --- a/src/app/manage-learn/shared/shared.module.ts +++ b/src/app/manage-learn/shared/shared.module.ts @@ -36,7 +36,9 @@ import { AttachmentListsComponent, ReportListComponent, EntitySearchLocalComponent, - StartImprovementComponent + StartImprovementComponent, + ShareProfileDataComponent, + PiiConsentPopupComponent } from './components'; import { TranslateModule } from '@ngx-translate/core'; @@ -131,7 +133,9 @@ import { EntitySearchPipe } from './pipe/entity-local-search'; ReportListComponent, EntitySearchPipe, EntitySearchLocalComponent, - StartImprovementComponent + StartImprovementComponent, + ShareProfileDataComponent, + PiiConsentPopupComponent ], imports: [CommonModule, FormsModule, IonicModule, ReactiveFormsModule, TranslateModule, ChartsModule], schemas: [CUSTOM_ELEMENTS_SCHEMA], @@ -189,7 +193,9 @@ import { EntitySearchPipe } from './pipe/entity-local-search'; AttachmentListsComponent, EntitySearchPipe, EntitySearchLocalComponent, - StartImprovementComponent + StartImprovementComponent, + ShareProfileDataComponent, + PiiConsentPopupComponent ], providers: [ Camera, diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index a987f2a86..d9013addb 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -1374,5 +1374,19 @@ "FRMELEMNTS_MSG_NOT_MET_CERTIFCATE":" Sorry ! You have not met the certificate criteria for this Improvement Project.", "INCREASE_FONT": "Increase font size", "DEFAULT_FONT": "Default font size", - "DECREASE_FONT": "Decrease font size" + "DECREASE_FONT": "Decrease font size", + "FRMELEMNTS_LBL_JOIN_PROGRAM_POPUP":"Join program", + "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", + "FRMELEMNTS_LBL_CONSENT_POPUP_MSG1": "I consent to share my details with the administrators of this program. All program administrators are bound by the ", + "FRMELEMNTS_LBL_CONSENT_POPUP_MSG2":"in their use of my data", + "FRMELEMNTS_LBL_CONSENT_POPUP_POLICY_MSG": "Privacy Policy and DIKSHA Terms ", + "FRMELEMNTS_LBL_JOIN_PROGRAM_MSG2":"Please join {{name}} {{type}} to view and access all the resources in this {{type}}.", + "FRMELEMNTS_MSG_DATA_SETTINGS_UPDATE_SUCCESS":"Your data setting has been updated successfully" } \ No newline at end of file From 9f0e13272816bb6f2c4ca85dbffef39cf916ca0c Mon Sep 17 00:00:00 2001 From: Vinod-V3 Date: Tue, 16 May 2023 14:14:59 +0530 Subject: [PATCH 05/29] ISSUE #ED-430 feat : New Programs Listing page --- .../program-listing.component.html | 40 ++++++++---------- .../program-listing.component.scss | 42 ++++++++++++------- .../program-listing.component.ts | 8 +++- .../item-list-card.component.html | 12 ++++++ .../item-list-card.component.scss | 9 +++- .../item-list-card.component.ts | 2 + src/assets/i18n/en.json | 4 +- 7 files changed, 75 insertions(+), 42 deletions(-) diff --git a/src/app/manage-learn/programs/program-listing/program-listing.component.html b/src/app/manage-learn/programs/program-listing/program-listing.component.html index 7238915f3..6974fa7e6 100644 --- a/src/app/manage-learn/programs/program-listing/program-listing.component.html +++ b/src/app/manage-learn/programs/program-listing/program-listing.component.html @@ -1,24 +1,18 @@ - - - -
- -
{{'PROGRAMS' | translate }}
-
-
{{'PROGRAMS_DESC' | translate}}
-
-
-
-
-
- - - - -
-
- - {{ 'FRMELEMNTS_BTN_VIEW_MORE' | translate }} + +
+
{{'EXPLORE_PROGRAMS' | translate }}
+
{{ description }}
+ + +
+ + + + + {{ 'FRMELEMNTS_BTN_LOAD_MORE' | translate }} -
\ No newline at end of file + \ No newline at end of file diff --git a/src/app/manage-learn/programs/program-listing/program-listing.component.scss b/src/app/manage-learn/programs/program-listing/program-listing.component.scss index d22f35733..46098942e 100644 --- a/src/app/manage-learn/programs/program-listing/program-listing.component.scss +++ b/src/app/manage-learn/programs/program-listing/program-listing.component.scss @@ -1,28 +1,38 @@ +@import "../../../../assets/styles/variables"; + .desc { - color: #555; - white-space: normal; - padding: 5px 0px 30px 0px; - margin-bottom: 10px; - font-size: 1rem; + font-size: 14px; + margin: 5px 0px; } .title{ - font-size: 1rem; + font-size: 20px; font-weight: bold; - // color: $black; - color: black; -} - -.list-md { - padding-top: 0px !important; - padding-bottom: 0px !important; } .button-native { background: #DFE7F1 !important; } -ion-button { - font-size: 0.875rem; - height: 2.25rem; +.ui-container { + &::after { + height: 12.75rem !important; + background-image: none !important; + } + } + +.header-section{ + position: sticky; + top: 0px; + z-index: 1; + padding: 0px 20px; + margin-bottom: 20px; +} + +.load-more{ + --background: var(--app-primary-background) !important; + --border-color: var(--app-primary-medium) !important; + --color: var(--app-primary-medium) !important; + height: 44px; + font-size: 16px; } \ 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 c6eda6b6b..5c21bdc07 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 @@ -26,6 +26,7 @@ export class ProgramListingComponent implements OnInit { description; page = 1; limit = 25; + search = '' constructor(private router: Router, private location: Location, @@ -41,7 +42,7 @@ export class ProgramListingComponent implements OnInit { let payload = await this.utils.getProfileInfo(); if (payload) { const config = { - url: urlConstants.API_URLS.PROGRAM_LISTING +false+ '&page=' + this.page + '&limit=' + this.limit + '&search=', + url: urlConstants.API_URLS.PROGRAM_LISTING +false+ '&page=' + this.page + '&limit=' + this.limit + '&search=' + encodeURIComponent(this.search), payload: payload } this.kendraService.post(config).subscribe(success => { @@ -96,4 +97,9 @@ export class ProgramListingComponent implements OnInit { this.getPrograms(); } + searchPrograms(event){ + this.programs=[] + this.getPrograms() + } + } diff --git a/src/app/manage-learn/shared/components/item-list-card/item-list-card.component.html b/src/app/manage-learn/shared/components/item-list-card/item-list-card.component.html index 216b09398..ff9e77464 100644 --- a/src/app/manage-learn/shared/components/item-list-card/item-list-card.component.html +++ b/src/app/manage-learn/shared/components/item-list-card/item-list-card.component.html @@ -25,6 +25,18 @@ +
+
{{ "STATE" | translate }} :
+
+
{{data}}
+
+
+
+
{{ "FRMELEMNTS_LBL_RECOMMENDED_FOR" | translate }} :
+
+
{{data}}
+
+
diff --git a/src/app/manage-learn/shared/components/item-list-card/item-list-card.component.scss b/src/app/manage-learn/shared/components/item-list-card/item-list-card.component.scss index 95ea2fcf1..8173be6ba 100644 --- a/src/app/manage-learn/shared/components/item-list-card/item-list-card.component.scss +++ b/src/app/manage-learn/shared/components/item-list-card/item-list-card.component.scss @@ -37,4 +37,11 @@ ion-card-header { border-bottom-right-radius: initial !important; margin-bottom: 2px; } - \ No newline at end of file + +.role-item{ + background-color: map-get($colors, light_grayish_green); + color: map-get($colors, office_green); + height: fit-content; + padding: 0px 5px; + border-radius: 10px; +} \ No newline at end of file diff --git a/src/app/manage-learn/shared/components/item-list-card/item-list-card.component.ts b/src/app/manage-learn/shared/components/item-list-card/item-list-card.component.ts index 897d43161..3f87bcc7a 100644 --- a/src/app/manage-learn/shared/components/item-list-card/item-list-card.component.ts +++ b/src/app/manage-learn/shared/components/item-list-card/item-list-card.component.ts @@ -17,6 +17,8 @@ export class ItemListCardComponent implements OnChanges { @Input() ellipsis:Boolean =false @Input() arrIndex:any; @Input() selectedEvidenceIndex:any; + @Input() state:any =[] + @Input() roles:any =[] constructor(private commonUtilService: CommonUtilService) {} ngOnChanges(changes: SimpleChanges): void { diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index 4717c871b..d8f62c1b0 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -1390,5 +1390,7 @@ "FRMELEMNTS_LBL_CONSENT_POPUP_POLICY_MSG": "Privacy Policy and DIKSHA Terms ", "FRMELEMNTS_LBL_JOIN_PROGRAM_MSG2":"Please join {{name}} {{type}} to view and access all the resources in this {{type}}.", "FRMELEMNTS_MSG_DATA_SETTINGS_UPDATE_SUCCESS":"Your data setting has been updated successfully", - "FRMELEMNTS_MSG_EVIDENCE_UPLOAD_FAILED":"Evidence upload failed, please try again" + "FRMELEMNTS_MSG_EVIDENCE_UPLOAD_FAILED":"Evidence upload failed, please try again", + "EXPLORE_PROGRAMS":"Explore Programs", + "FRMELEMNTS_LBL_SEARCH_PROGRAMS_PLACEHOLDER":"Search your programs here" } \ No newline at end of file From 9200c6275ce714732e9e30a3cbb4b007a2ee5455 Mon Sep 17 00:00:00 2001 From: Vinod-V3 Date: Wed, 17 May 2023 19:20:19 +0530 Subject: [PATCH 06/29] ISSUE #ED-431 feat : Added Join program popup in program details page --- .../program-details.component.html | 22 +-- .../program-details.component.ts | 156 ++++++++++++++++-- .../manage-learn/shared/components/index.ts | 3 +- .../join-program/join-program.component.html | 25 +++ .../join-program/join-program.component.scss | 76 +++++++++ .../join-program/join-program.component.ts | 25 +++ src/app/manage-learn/shared/generic.popup.ts | 21 ++- src/app/manage-learn/shared/shared.module.ts | 9 +- src/assets/i18n/en.json | 1 + 9 files changed, 309 insertions(+), 29 deletions(-) create mode 100644 src/app/manage-learn/shared/components/join-program/join-program.component.html create mode 100644 src/app/manage-learn/shared/components/join-program/join-program.component.scss create mode 100644 src/app/manage-learn/shared/components/join-program/join-program.component.ts 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 ee33da904..f3d76f0fb 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 @@ -6,15 +6,17 @@ {{ (showMore ? 'READ_LESS' : 'READ_MORE') | translate }} -
- - {{"FRMELEMNTS_LBL_JOIN_PROGRAM_POPUP" | translate}} - - -
- {{"FRMELEMNTS_MSG_PROGRAM_JOINED" | translate:{'date':(programDetails?.programEndDate | date: 'd/M/yyyy')} }} -
-
+
+
+ + {{"FRMELEMNTS_LBL_JOIN_PROGRAM_POPUP" | translate}} + + +
+ {{"FRMELEMNTS_MSG_PROGRAM_JOINED" | translate:{'date':(programDetails?.programEndDate | date: 'd/M/yyyy')} }} +
+
+
@@ -32,7 +34,7 @@
- +
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 4115ea284..5c125e458 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,10 +3,15 @@ import { AppHeaderService } from '../../../../../src/services/app-header.service import { LibraryFiltersLayout } from '@project-sunbird/common-consumption'; import { TranslateService } from '@ngx-translate/core'; import { GenericPopUpService } from '../../shared'; -import { ActivatedRoute } from '@angular/router'; +import { ActivatedRoute, Router } from '@angular/router'; import { urlConstants } from '../../core/constants/urlConstants'; -import { LoaderService, UtilsService, ToastService } from '../../core'; +import { LoaderService, UtilsService, ToastService, LocalStorageService } from '../../core'; import { KendraApiService } from '../../core/services/kendra-api.service'; +import { RouterLinks } from '../../../../app/app.constant'; +import { SurveyProviderService } from '../../core/services/survey-provider.service'; +import { UpdateLocalSchoolDataService } from '../../core/services/update-local-school-data.service'; +import { storageKeys } from '../../storageKeys'; +import { AppGlobalService } from '../../../../services/app-global-service.service'; @Component({ selector: 'app-program-details', @@ -34,10 +39,13 @@ export class ProgramDetailsComponent implements OnInit { count = 0; limit = 25; page = 1; + isNewProgram = false + userId constructor(private headerService: AppHeaderService, private translate: TranslateService, private popupService: GenericPopUpService, private activatedRoute: ActivatedRoute, private loader: LoaderService, private utils: UtilsService, private kendraService: KendraApiService, - private toastService: ToastService) { + private toastService: ToastService, private router: Router, private surveyProvider: SurveyProviderService, private ulsdp: UpdateLocalSchoolDataService, + private localStorage: LocalStorageService, private appGlobalService: AppGlobalService) { this.translate.get(['ALL','FRMELEMNTS_LBL_PROJECTS','FRMELEMNTS_LBL_OBSERVATIONS','FRMELEMNTS_LBL_SURVEY']).subscribe((translation)=>{ this.filtersList = Object.keys(translation).map(translateItem => { return translation[translateItem]}) }) @@ -47,7 +55,9 @@ export class ProgramDetailsComponent implements OnInit { }) } - ngOnInit() {} + ngOnInit() { + this.userId = this.appGlobalService.getUserId() + } ionViewWillEnter(){ this.headerConfig = this.headerService.getDefaultPageConfig() @@ -71,6 +81,7 @@ export class ProgramDetailsComponent implements OnInit { if (success.result.data) { this.programDetails = success.result this.count = success.result.count; + this.isNewProgram = success.result.hasOwnProperty('requestForPIIConsent') this.formatList() this.readMoreOrLess() } @@ -123,14 +134,14 @@ export class ProgramDetailsComponent implements OnInit { } joinProgram(){ - // this.popupService.showJoinProgramForProjectPopup("FRMELEMNTS_LBL_JOIN_PROGRAM_POPUP",this.programDetails.programName,'program', - // "FRMELEMNTS_LBL_JOIN_PROGRAM_POPUP","FRMELEMNTS_LBL_JOIN_PROGRAM_MSG2").then( - // (data:any)=>{ - // if(data){ - // this.showConsentPopup() - // } - // } - // ) + this.popupService.showJoinProgramForProjectPopup("FRMELEMNTS_LBL_JOIN_PROGRAM_POPUP",this.programDetails.programName,'program', + "FRMELEMNTS_LBL_JOIN_PROGRAM_POPUP","FRMELEMNTS_LBL_JOIN_PROGRAM_MSG2").then( + (data:any)=>{ + if(data){ + this.showConsentPopup() + } + } + ) } showConsentPopup(message?){ @@ -144,9 +155,23 @@ export class ProgramDetailsComponent implements OnInit { }) } - cardClick(){ - if(!this.programDetails.programJoined){ + cardClick(data){ + if(!this.programDetails?.programJoined && this.isNewProgram){ this.joinProgram() + }else{ + switch (data.type) { + case 'improvementProject': + this.redirectProject(data); + break; + case 'observation': + this.redirectObservation(data); + break; + case 'survey': + this.onSurveyClick(data); + break; + default: + break; + } } } @@ -170,4 +195,107 @@ export class ProgramDetailsComponent implements OnInit { selectSection(name){ this.selectedSection = name } + + redirectProject(data) { + let projectId = ''; + if (data.projectId) { + projectId = data.projectId; + } + if (!projectId) { + this.router.navigate([`${RouterLinks.PROJECT}/${RouterLinks.PROJECT_TEMPLATE}`, data._id], { + queryParams: { + programId: this.programId, + solutionId: data._id, + type: 'assignedToMe', + listing: 'program' + }, + }); + } else { + this.router.navigate([`${RouterLinks.PROJECT}/${RouterLinks.DETAILS}`], { + queryParams: { + projectId: projectId, + programId: this.programId, + solutionId: data._id, + type: 'assignedToMe' + }, + }); + } + } + + redirectObservation(data) { + let observationId = ''; + if (data.observationId) { + observationId = data.observationId; + } + this.router.navigate( + [`/${RouterLinks.OBSERVATION}/${RouterLinks.OBSERVATION_DETAILS}`], + { + queryParams: { + programId: this.programId, + solutionId: data._id, + observationId: observationId, + solutionName: data.name, + entityType: data.entityType ? data.entityType : '' + }, + } + ); + } + + onSurveyClick(data) { + if (data.submissionId && data.submissionId.length) { + this.localStorage + .getLocalStorage(storageKeys.submissionIdArray) + .then((allId) => { + if (allId.includes(data.submissionId)) { + this.redirect(data.submissionId); + } else { + this.surveyRedirect(data); + } + }) + .catch(error => { + this.surveyRedirect(data); + }) + } else { + this.surveyRedirect(data); + } + } + + surveyRedirect(data) { + let surveyId = ''; + if (data.surveyId) { + surveyId = data.surveyId; + } + this.surveyProvider + .getDetailsById(surveyId, data._id) + .then((res) => { + if (res.result && res.result.status == 'completed') { + // this.toast.openToast(res.message) + this.surveyProvider.showMsg('surveyCompleted'); + return; + } + const survey = res.result; + this.ulsdp.mapSubmissionDataToQuestion(survey, false, true); + this.storeRedirect(survey); + }) + .catch((err) => { + console.log(err); + }); + } + + storeRedirect(survey): void { + this.surveyProvider + .storeSurvey(survey.assessment.submissionId, survey) + .then((survey) => this.redirect(survey.assessment.submissionId)); + } + + redirect(submissionId: any): void { + this.router.navigate([RouterLinks.QUESTIONNAIRE], { + queryParams: { + submisssionId: submissionId, + evidenceIndex: 0, + sectionIndex: 0, + isSurvey:true + }, + }); + } } \ No newline at end of file diff --git a/src/app/manage-learn/shared/components/index.ts b/src/app/manage-learn/shared/components/index.ts index fd58fa45e..25b5e8500 100644 --- a/src/app/manage-learn/shared/components/index.ts +++ b/src/app/manage-learn/shared/components/index.ts @@ -33,4 +33,5 @@ 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 './share-profile-data/share-profile-data.component'; -export * from './pii-consent-popup/pii-consent-popup.component' +export * from './pii-consent-popup/pii-consent-popup.component'; +export * from './join-program/join-program.component' 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 new file mode 100644 index 000000000..7564ec88a --- /dev/null +++ b/src/app/manage-learn/shared/components/join-program/join-program.component.html @@ -0,0 +1,25 @@ + + + {{header | translate}} ? + + + + +
+ +
+
\ No newline at end of file diff --git a/src/app/manage-learn/shared/components/join-program/join-program.component.scss b/src/app/manage-learn/shared/components/join-program/join-program.component.scss new file mode 100644 index 000000000..32fc05de3 --- /dev/null +++ b/src/app/manage-learn/shared/components/join-program/join-program.component.scss @@ -0,0 +1,76 @@ +@import "../../../../../assets/styles/base/_variables.scss"; +@import "../../../../../assets/styles/_variables.scss"; +@import "../../../../../assets/styles/_custom-mixins.scss"; + +#main-content { + overflow-y: scroll; +} + +.consent-popover-info { + overflow: hidden; +} + +.flex-container { + width: 100%; + height: 100%; + display: flex; + flex-direction: column; +} + +.footer { + flex-grow: 0; + flex-shrink: 0; + padding: 0px 10px; +} +.save-changes{ + color: white; + background-color: $blue; + font-size: 1rem; + padding: 12px 20px; + margin-left: 18px; + border: 2px solid $blue; +// width: 80%; + border-radius: 18px !important; +} + +.btn-info{ + padding: 12px; +// text-align: center; + float: right; +} + + +.sb-popover-header { + border-radius: 4px 4px 0 0; + background-color: $info-color; + &::after { + background-image: none; + } + .sb-popover-toolbar { + min-height: 6rem !important; + max-height: 6rem !important; + background-color: $info-color; + border-radius: 4px 4px 0 0; + text-align: center; + // @include padding(($base-block-space * 0.5), ($base-block-space * 1)); + .toolbar-background { + border-radius: 4px 4px 0 0; + background-color: $info-color; + } + .sb-popover-close-btn { + color: $white-color; + } + .sb-popover-title { + font-size: 22px !important; + font-weight: 700 !important; + text-align: left !important; + margin: 10px 0px; + text-transform: capitalize; + } + } +} + +.popover-message{ + margin-left: 10px; + margin-bottom: 30px; +} \ No newline at end of file diff --git a/src/app/manage-learn/shared/components/join-program/join-program.component.ts b/src/app/manage-learn/shared/components/join-program/join-program.component.ts new file mode 100644 index 000000000..d0922c4a4 --- /dev/null +++ b/src/app/manage-learn/shared/components/join-program/join-program.component.ts @@ -0,0 +1,25 @@ +import { Component, OnInit, Input } from '@angular/core'; +import { PopoverController } from '@ionic/angular'; + +@Component({ + selector: 'app-join-program', + templateUrl: './join-program.component.html', + styleUrls: ['./join-program.component.scss'], +}) +export class JoinProgramComponent implements OnInit { + + @Input() header + @Input() name + @Input() type + @Input() button + @Input() message? + + constructor(private popOverCtrl:PopoverController) { } + + ngOnInit() {} + + start(){ + this.popOverCtrl.dismiss(true) + } + +} \ No newline at end of file diff --git a/src/app/manage-learn/shared/generic.popup.ts b/src/app/manage-learn/shared/generic.popup.ts index 88d519c96..99d4bed06 100644 --- a/src/app/manage-learn/shared/generic.popup.ts +++ b/src/app/manage-learn/shared/generic.popup.ts @@ -6,6 +6,7 @@ import { CommonUtilService } from '../../../services/common-util.service'; import { StartImprovementComponent } from './components/start-improvement/start-improvement.component'; import { PiiConsentPopupComponent } from './components/pii-consent-popup/pii-consent-popup.component'; import { RouterLinks } from '../../../app/app.constant'; +import { JoinProgramComponent } from './components/join-program/join-program.component'; @Injectable({ providedIn: 'root', @@ -77,7 +78,25 @@ export class GenericPopUpService { return data; } -async showConsent(type?){ +async showJoinProgramForProjectPopup(header,name,type,button,message?){ + const alert = await this.popOverCtrl.create({ + component : JoinProgramComponent, + componentProps: { + header: header, + name: name, + type:type, + button: button, + message: message + }, + cssClass: 'sb-popover', + }); + await alert.present(); + const {data} = await alert.onDidDismiss(); + return data + +} + +async showConsent(type){ let componentProps={} switch (type) { case 'program': diff --git a/src/app/manage-learn/shared/shared.module.ts b/src/app/manage-learn/shared/shared.module.ts index 89890a7eb..5cae40fe0 100644 --- a/src/app/manage-learn/shared/shared.module.ts +++ b/src/app/manage-learn/shared/shared.module.ts @@ -38,7 +38,8 @@ import { EntitySearchLocalComponent, StartImprovementComponent, ShareProfileDataComponent, - PiiConsentPopupComponent + PiiConsentPopupComponent, + JoinProgramComponent } from './components'; import { TranslateModule } from '@ngx-translate/core'; @@ -135,7 +136,8 @@ import { EntitySearchPipe } from './pipe/entity-local-search'; EntitySearchLocalComponent, StartImprovementComponent, ShareProfileDataComponent, - PiiConsentPopupComponent + PiiConsentPopupComponent, + JoinProgramComponent ], imports: [CommonModule, FormsModule, IonicModule, ReactiveFormsModule, TranslateModule, ChartsModule], schemas: [CUSTOM_ELEMENTS_SCHEMA], @@ -195,7 +197,8 @@ import { EntitySearchPipe } from './pipe/entity-local-search'; EntitySearchLocalComponent, StartImprovementComponent, ShareProfileDataComponent, - PiiConsentPopupComponent + PiiConsentPopupComponent, + JoinProgramComponent ], providers: [ Camera, diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index 4717c871b..02d74cd8e 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -1377,6 +1377,7 @@ "DEFAULT_FONT": "Default font size", "DECREASE_FONT": "Decrease font size", "FRMELEMNTS_LBL_JOIN_PROGRAM_POPUP":"Join program", + "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", From b43c06ea43cb0f3badf7a37fa1c8f6a57cf6c402 Mon Sep 17 00:00:00 2001 From: Vinod-V3 Date: Sat, 20 May 2023 19:45:12 +0530 Subject: [PATCH 07/29] ISSUE #ED-431 feat : Api integration done for program details page --- .../core/constants/urlConstants.ts | 3 +- .../program-details.component.html | 5 +- .../program-details.component.ts | 88 ++++++++++++------- .../pii-consent-popup.component.ts | 4 +- src/app/manage-learn/shared/generic.popup.ts | 44 +++++++++- 5 files changed, 105 insertions(+), 39 deletions(-) diff --git a/src/app/manage-learn/core/constants/urlConstants.ts b/src/app/manage-learn/core/constants/urlConstants.ts index 23a28f8a1..2b90d41df 100644 --- a/src/app/manage-learn/core/constants/urlConstants.ts +++ b/src/app/manage-learn/core/constants/urlConstants.ts @@ -53,6 +53,7 @@ export const urlConstants = { PROJECT_CERTIFICATES:'/api/userProjects/mlprojects/v1/certificates', GET_PROJECT_CERTIFICATE:'/api/v1/ProjectCertificate/', PROJECT_CERTIFICATE_DOWNLOAD:'/api/rc/projectCertificate/v1/download/', - CERTIFICATE_VERIFY:'/api/rc/certificate/v1/key/' + CERTIFICATE_VERIFY:'/api/rc/certificate/v1/key/', + JOIN_PROGRAM:'/api/programs/mlcore/v1/join/' }, }; \ No newline at end of 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 index f3d76f0fb..fb683cfa2 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 @@ -8,7 +8,7 @@
- + {{"FRMELEMNTS_LBL_JOIN_PROGRAM_POPUP" | translate}} @@ -47,6 +47,7 @@
{{"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 5c125e458..4b716261a 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 @@ -11,7 +11,7 @@ import { RouterLinks } from '../../../../app/app.constant'; import { SurveyProviderService } from '../../core/services/survey-provider.service'; import { UpdateLocalSchoolDataService } from '../../core/services/update-local-school-data.service'; import { storageKeys } from '../../storageKeys'; -import { AppGlobalService } from '../../../../services/app-global-service.service'; +import { CommonUtilService } from '../../../../services/common-util.service'; @Component({ selector: 'app-program-details', @@ -34,18 +34,20 @@ export class ProgramDetailsComponent implements OnInit { programDetails:any={} solutionsList:any=[] filteredList:any=[] - sharingStatus='ACTIVE' + sharingStatus:any='REVOKED' programId count = 0; limit = 25; page = 1; isNewProgram = false - userId + lastUpdatedOn:any + consentShared = false + payload constructor(private headerService: AppHeaderService, private translate: TranslateService, private popupService: GenericPopUpService, private activatedRoute: ActivatedRoute, private loader: LoaderService, private utils: UtilsService, private kendraService: KendraApiService, private toastService: ToastService, private router: Router, private surveyProvider: SurveyProviderService, private ulsdp: UpdateLocalSchoolDataService, - private localStorage: LocalStorageService, private appGlobalService: AppGlobalService) { + private localStorage: LocalStorageService, private commonUtils: CommonUtilService) { this.translate.get(['ALL','FRMELEMNTS_LBL_PROJECTS','FRMELEMNTS_LBL_OBSERVATIONS','FRMELEMNTS_LBL_SURVEY']).subscribe((translation)=>{ this.filtersList = Object.keys(translation).map(translateItem => { return translation[translateItem]}) }) @@ -55,9 +57,7 @@ export class ProgramDetailsComponent implements OnInit { }) } - ngOnInit() { - this.userId = this.appGlobalService.getUserId() - } + ngOnInit() {} ionViewWillEnter(){ this.headerConfig = this.headerService.getDefaultPageConfig() @@ -76,14 +76,24 @@ export class ProgramDetailsComponent implements OnInit { payload: payload, }; this.kendraService.post(config).subscribe( - (success) => { + async(success) => { this.loader.stopLoader(); if (success.result.data) { this.programDetails = success.result this.count = success.result.count; this.isNewProgram = success.result.hasOwnProperty('requestForPIIConsent') + this.payload = {consumerId: success.result.rootOrganisations, objectId: success.result.programId} this.formatList() this.readMoreOrLess() + if(this.isNewProgram && this.programDetails.programJoined && this.programDetails?.requestForPIIConsent){ + await this.popupService.getConsent('Program',this.payload).then((response)=>{ + if(response){ + this.sharingStatus = response.status + this.lastUpdatedOn = response.lastUpdatedOn + this.consentShared = true + } + }) + } } }, (error) => { @@ -136,23 +146,45 @@ export class ProgramDetailsComponent implements OnInit { joinProgram(){ this.popupService.showJoinProgramForProjectPopup("FRMELEMNTS_LBL_JOIN_PROGRAM_POPUP",this.programDetails.programName,'program', "FRMELEMNTS_LBL_JOIN_PROGRAM_POPUP","FRMELEMNTS_LBL_JOIN_PROGRAM_MSG2").then( - (data:any)=>{ + async (data:any)=>{ if(data){ - this.showConsentPopup() + this.join() } } ) } + + async join(hideConsent?){ + let payload = await this.utils.getProfileInfo(); + if (payload) { + const config = { + url:`${urlConstants.API_URLS.JOIN_PROGRAM}${this.programId}`, + payload: {userRoleInformation:payload, consentShared:this.consentShared} + }; + this.kendraService.post(config).subscribe( + (response) => { + if(response.status==200){ + this.programDetails.programJoined = true + if(!hideConsent){ + this.showConsentPopup() + } + } + }, + (error) => {} + ); + } + } - showConsentPopup(message?){ - this.popupService.showConsent('program').then((data)=>{ - if(data!==undefined){ - this.programDetails.programJoined = true - if(message){ - this.toastService.openToast(message) + showConsentPopup(){ + if(this.programDetails?.requestForPIIConsent){ + this.popupService.showConsent('Program',this.payload).then(async(data)=>{ + if(data){ + this.sharingStatus = data + this.consentShared = true + await this.join(true) } - } - }) + }) + } } cardClick(data){ @@ -176,19 +208,17 @@ export class ProgramDetailsComponent implements OnInit { } save(event){ - let message - this.translate.get(['FRMELEMNTS_MSG_DATA_SETTINGS_UPDATE_SUCCESS']).subscribe((msg)=>{ - message = msg['FRMELEMNTS_MSG_DATA_SETTINGS_UPDATE_SUCCESS'] - }) if(this.sharingStatus!==event){ - this.showConsentPopup(message) - this.sharingStatus=event + this.showConsentPopup() }else{ - this.toastService.openToast(message) + this.commonUtils.showToast('FRMELEMNTS_MSG_DATA_SETTINGS_UPDATE_SUCCESS'); } } ionViewWillLeave(){ + this.solutionsList = [] + this.filteredList = [] + this.selectedSection = '' this.popupService.closeConsent() } @@ -277,9 +307,7 @@ export class ProgramDetailsComponent implements OnInit { this.ulsdp.mapSubmissionDataToQuestion(survey, false, true); this.storeRedirect(survey); }) - .catch((err) => { - console.log(err); - }); + .catch((err) => {}); } storeRedirect(survey): void { @@ -297,5 +325,5 @@ export class ProgramDetailsComponent implements OnInit { isSurvey:true }, }); - } -} \ No newline at end of file + } +} diff --git a/src/app/manage-learn/shared/components/pii-consent-popup/pii-consent-popup.component.ts b/src/app/manage-learn/shared/components/pii-consent-popup/pii-consent-popup.component.ts index 41cb03636..0612c13a0 100644 --- a/src/app/manage-learn/shared/components/pii-consent-popup/pii-consent-popup.component.ts +++ b/src/app/manage-learn/shared/components/pii-consent-popup/pii-consent-popup.component.ts @@ -104,11 +104,11 @@ convertDataSrcToObject(ele) { } share() { - this.popoverCtrl.dismiss(true) + this.popoverCtrl.dismiss('ACTIVE') } dontShare() { - this.popoverCtrl.dismiss(false) + this.popoverCtrl.dismiss('REVOKED') } } diff --git a/src/app/manage-learn/shared/generic.popup.ts b/src/app/manage-learn/shared/generic.popup.ts index 99d4bed06..491e977fd 100644 --- a/src/app/manage-learn/shared/generic.popup.ts +++ b/src/app/manage-learn/shared/generic.popup.ts @@ -1,4 +1,4 @@ -import { Injectable } from '@angular/core'; +import { Inject, Injectable } from '@angular/core'; import { PrivacyPolicyAndTCComponent } from './components/privacy-policy-and-tc/privacy-policy-and-tc.component'; import { PopoverController } from '@ionic/angular'; import { SbGenericPopoverComponent } from '../../../app/components/popups/sb-generic-popover/sb-generic-popover.component'; @@ -7,13 +7,17 @@ import { StartImprovementComponent } from './components/start-improvement/start- import { PiiConsentPopupComponent } from './components/pii-consent-popup/pii-consent-popup.component'; import { RouterLinks } from '../../../app/app.constant'; import { JoinProgramComponent } from './components/join-program/join-program.component'; +import { ProfileService } from '@project-sunbird/sunbird-sdk'; +import { ConsentStatus } from '@project-sunbird/client-services/models'; +import { AppGlobalService } from '../../../services/app-global-service.service'; @Injectable({ providedIn: 'root', }) export class GenericPopUpService { consentPopup: any - constructor(private popOverCtrl: PopoverController, private commonUtils: CommonUtilService) {} + constructor(private popOverCtrl: PopoverController, private commonUtils: CommonUtilService, @Inject('PROFILE_SERVICE') private profileService: ProfileService, + private appGlobalService: AppGlobalService) {} async showPPPForProjectPopUp(message, message1, linkLabel, header, link, type) { const alert = await this.popOverCtrl.create({ @@ -96,9 +100,10 @@ async showJoinProgramForProjectPopup(header,name,type,button,message?){ } -async showConsent(type){ +async showConsent(type, payload){ let componentProps={} - switch (type) { + let payloadData:any = { userId : this.appGlobalService.getUserId(), objectType: type, ...payload } + switch (type.toLowerCase()) { case 'program': componentProps={ consentMessage1 : "FRMELEMNTS_LBL_CONSENT_POPUP_MSG1", @@ -125,6 +130,23 @@ async showConsent(type){ }) await this.consentPopup.present() let {data} = await this.consentPopup.onDidDismiss() + if(data){ + const request = { ...payloadData, status : data } + const loader = await this.commonUtils.getLoader(); + await loader.present(); + await this.profileService.updateConsent(request).toPromise() + .then(async (response) => { + this.commonUtils.showToast('FRMELEMNTS_MSG_DATA_SETTINGS_UPDATE_SUCCESS'); + await loader.dismiss(); + }) + .catch((e) => { + data='' + loader.dismiss(); + if (e.code === 'NETWORK_ERROR') { + this.commonUtils.showToast('ERROR_NO_INTERNET_MESSAGE'); + } + }); + } return data } @@ -132,4 +154,18 @@ async closeConsent(){ this.consentPopup ? await this.consentPopup.dismiss() : null } + async getConsent(type, payload){ + const request = { userId : this.appGlobalService.getUserId(), ...payload } + let data:any='' + await this.profileService.getConsent(request).toPromise().then((response)=>{ + data=response.consents[0] + }).catch(async (error)=>{ + if (!error.response.body.result.consent && error.response.responseCode === 404) { + await this.showConsent(type, payload); + } else if (error.code === 'NETWORK_ERROR') { + this.commonUtils.showToast('ERROR_NO_INTERNET_MESSAGE'); + } + }) + return data + } } \ No newline at end of file From 434f13fc7b6f44d06d2356a048d5977479449cd5 Mon Sep 17 00:00:00 2001 From: Vishwanath Date: Thu, 25 May 2023 06:08:50 +0530 Subject: [PATCH 08/29] Issue #ED-1682 fix : Ionic migration 5 to 6 --- src/app/manage-learn/core/services/project.service.ts | 5 ++++- .../observation-submission.component.ts | 6 ++++++ .../project/project-listing/project-listing.component.ts | 1 + src/app/manage-learn/project/task-view/task-view.page.html | 2 +- src/assets/i18n/en.json | 3 +-- 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/app/manage-learn/core/services/project.service.ts b/src/app/manage-learn/core/services/project.service.ts index 38c49460c..a99db1a74 100644 --- a/src/app/manage-learn/core/services/project.service.ts +++ b/src/app/manage-learn/core/services/project.service.ts @@ -152,7 +152,7 @@ export class ProjectService { } else { id = resource.link.split('/').pop() } - + this.networkFlag = this.commonUtilService.networkInfo.isNetworkAvailable; if (!this.networkFlag) { this.toast.showMessage('FRMELEMNTS_MSG_PLEASE_GO_ONLINE', 'danger'); return; @@ -196,6 +196,7 @@ export class ProjectService { } async startAssessment(projectId, id) { + this.networkFlag = this.commonUtilService.networkInfo.isNetworkAvailable; if (!this.networkFlag) { this.toast.showMessage('FRMELEMNTS_MSG_YOU_ARE_WORKING_OFFLINE_TRY_AGAIN', 'danger'); return; @@ -247,6 +248,7 @@ export class ProjectService { } async checkReport(projectId, taskId) { + this.networkFlag = this.commonUtilService.networkInfo.isNetworkAvailable; if (!this.networkFlag) { this.toast.showMessage('FRMELEMNTS_MSG_YOU_ARE_WORKING_OFFLINE_TRY_AGAIN', 'danger'); return; @@ -316,6 +318,7 @@ export class ProjectService { } } async openSyncSharePopup(type, name, project, taskId?) { + this.networkFlag = this.commonUtilService.networkInfo.isNetworkAvailable; if (this.networkFlag) { let data; this.project = project; diff --git a/src/app/manage-learn/observation/observation-submission/observation-submission.component.ts b/src/app/manage-learn/observation/observation-submission/observation-submission.component.ts index f62024e2e..5489581ab 100644 --- a/src/app/manage-learn/observation/observation-submission/observation-submission.component.ts +++ b/src/app/manage-learn/observation/observation-submission/observation-submission.component.ts @@ -210,6 +210,7 @@ export class ObservationSubmissionComponent implements OnInit { } } getAssessmentDetails(submission) { + this.networkFlag = this.commonUtilService.networkInfo.isNetworkAvailable; if (this.networkFlag) { this.showActionsheet = false; this.showEntityActionsheet = false; @@ -249,6 +250,7 @@ export class ObservationSubmissionComponent implements OnInit { } async pushToLocal(submission) { + this.networkFlag = this.commonUtilService.networkInfo.isNetworkAvailable; if (!this.networkFlag) { this.toast.showMessage("FRMELEMENTS_MSG_FEATURE_USING_OFFLINE", "danger"); return @@ -343,6 +345,7 @@ export class ObservationSubmissionComponent implements OnInit { }); } async openMenu(event, submission, index) { + this.networkFlag = this.commonUtilService.networkInfo.isNetworkAvailable; if (!this.networkFlag) { this.toast.showMessage("FRMELEMENTS_MSG_FEATURE_USING_OFFLINE", "danger"); } else { @@ -387,6 +390,7 @@ export class ObservationSubmissionComponent implements OnInit { } // entity actions entityActions(e) { + this.networkFlag = this.commonUtilService.networkInfo.isNetworkAvailable; if (!this.networkFlag) { this.toast.showMessage("FRMELEMENTS_MSG_FEATURE_USING_OFFLINE", "danger"); } else { @@ -477,6 +481,7 @@ export class ObservationSubmissionComponent implements OnInit { await popover.present(); } async deleteSubmission(submissionId) { + this.networkFlag = this.commonUtilService.networkInfo.isNetworkAvailable; if (!this.networkFlag) { this.toast.showMessage("FRMELEMENTS_MSG_FEATURE_USING_OFFLINE", "danger"); return @@ -555,6 +560,7 @@ export class ObservationSubmissionComponent implements OnInit { } async observeAgain() { + this.networkFlag = this.commonUtilService.networkInfo.isNetworkAvailable; if (!this.networkFlag) { this.toast.showMessage("FRMELEMENTS_MSG_FEATURE_USING_OFFLINE", "danger"); } else { diff --git a/src/app/manage-learn/project/project-listing/project-listing.component.ts b/src/app/manage-learn/project/project-listing/project-listing.component.ts index fd03fc718..1c64a7a9e 100644 --- a/src/app/manage-learn/project/project-listing/project-listing.component.ts +++ b/src/app/manage-learn/project/project-listing/project-listing.component.ts @@ -206,6 +206,7 @@ export class ProjectListingComponent { fetchProjectList() { this.projects = []; + this.networkFlag = this.commonUtilService.networkInfo.isNetworkAvailable; if (this.networkFlag) { this.selectedFilterIndex !== 2 ? this.getProjectList() : this.getCreatedProjects() } else { diff --git a/src/app/manage-learn/project/task-view/task-view.page.html b/src/app/manage-learn/project/task-view/task-view.page.html index 04535d692..8618c63c8 100644 --- a/src/app/manage-learn/project/task-view/task-view.page.html +++ b/src/app/manage-learn/project/task-view/task-view.page.html @@ -72,7 +72,7 @@

{{'FRMELEMNTS_LBL_SUBTASKS' | translate}}

- + diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index 65a84cc13..c2b46ae48 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -1384,7 +1384,7 @@ "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_MSG_PROGRAM_NO_RESOURCES":"Change profile details to view resources of this program", "FRMELEMNTS_LBL_OBSERVATIONS":"Observations", "FRMELEMNTS_LBL_COURSES":"Courses", "FRMELEMNTS_LBL_SURVEYS":"Surveys", @@ -1393,7 +1393,6 @@ "FRMELEMNTS_LBL_CONSENT_POPUP_POLICY_MSG": "Privacy Policy and DIKSHA Terms ", "FRMELEMNTS_LBL_JOIN_PROGRAM_MSG2":"Please join {{name}} {{type}} to view and access all the resources in this {{type}}.", "FRMELEMNTS_MSG_DATA_SETTINGS_UPDATE_SUCCESS":"Your data setting has been updated successfully", - "FRMELEMNTS_MSG_EVIDENCE_UPLOAD_FAILED":"Evidence upload failed, please try again", "EXPLORE_PROGRAMS":"Explore Programs", "FRMELEMNTS_LBL_SEARCH_PROGRAMS_PLACEHOLDER":"Search your programs here" } \ No newline at end of file From fde8630d530beaddf784ed085f4b9ce0ac8f771e Mon Sep 17 00:00:00 2001 From: Vishwanath Date: Thu, 25 May 2023 06:11:27 +0530 Subject: [PATCH 09/29] Issue #ED-98 feat : User consent for PII data for improvement projects --- .../program-details.component.html | 3 ++ .../program-details.component.ts | 2 +- .../project-templateview.page.ts | 22 ++++++++- src/app/manage-learn/shared/generic.popup.ts | 49 ++++++++++++++++++- 4 files changed, 73 insertions(+), 3 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 fb683cfa2..6389ae789 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 @@ -35,6 +35,9 @@
+
+ {{'CERTIFICATE' | translate}} +
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 4b716261a..c0371a782 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 @@ -48,7 +48,7 @@ export class ProgramDetailsComponent implements OnInit { private activatedRoute: ActivatedRoute, private loader: LoaderService, private utils: UtilsService, private kendraService: KendraApiService, private toastService: ToastService, private router: Router, private surveyProvider: SurveyProviderService, private ulsdp: UpdateLocalSchoolDataService, private localStorage: LocalStorageService, private commonUtils: CommonUtilService) { - this.translate.get(['ALL','FRMELEMNTS_LBL_PROJECTS','FRMELEMNTS_LBL_OBSERVATIONS','FRMELEMNTS_LBL_SURVEY']).subscribe((translation)=>{ + this.translate.get(['ALL','FRMELEMNTS_LBL_PROJECTS','FRMELEMNTS_LBL_OBSERVATIONS','FRMELEMNTS_LBL_SURVEYS']).subscribe((translation)=>{ this.filtersList = Object.keys(translation).map(translateItem => { return translation[translateItem]}) }) activatedRoute.params.subscribe((param)=>{ diff --git a/src/app/manage-learn/project/project-templateview/project-templateview.page.ts b/src/app/manage-learn/project/project-templateview/project-templateview.page.ts index 3ebd0c35b..ff76698d7 100644 --- a/src/app/manage-learn/project/project-templateview/project-templateview.page.ts +++ b/src/app/manage-learn/project/project-templateview/project-templateview.page.ts @@ -169,6 +169,10 @@ export class ProjectTemplateviewPage implements OnInit { this.actionItems = await actions.PROJECT_ACTIONS; let resp = await this.projectService.getTemplateBySoluntionId(this.id); this.project = resp.result; + if( this.project.hasOwnProperty('requestForPIIConsent') && this.project.programJoined && this.project?.requestForPIIConsent){ + let payloadData = {consumerId: this.project.rootOrganisations, objectId: this.project.programInformation.programId} + await this.popupService.getConsent('Program',payloadData); + } if(this.project.criteria){ let criteria = Object.keys(this.project?.criteria?.conditions); criteria.forEach(element => { @@ -220,7 +224,22 @@ export class ProjectTemplateviewPage implements OnInit { this.projectService.openResources(resource); } - doAction() { + doAction() { + if(!this.project?.programJoined && this.project.hasOwnProperty('requestForPIIConsent')){ + this.popupService.joinProgram(this.project) + .then(async resp => { + if(resp){ + let profileData = await this.utils.getProfileInfo(); + this.popupService.join(this.project,profileData).then((data :any) =>{ + if(data){ + this.project.programJoined = true + let payload = {consumerId: this.project.rootOrganisations, objectId: this.project.programInformation.programId}; + this.popupService.getConsent('Program',payload); + } + },error =>{}) + } + }); + }else{ if(!this.hideNameConfirmPopup && this.project.criteria && !this.isStarted && this.project.hasAcceptedTAndC && (this.isAssignedProject || this.isTargeted || this.isATargetedSolution)){ this.showProfileNameConfirmationPopup(); }else{ @@ -252,6 +271,7 @@ export class ProjectTemplateviewPage implements OnInit { } } } +} } gotoDetails() { diff --git a/src/app/manage-learn/shared/generic.popup.ts b/src/app/manage-learn/shared/generic.popup.ts index 491e977fd..3a8edd0a7 100644 --- a/src/app/manage-learn/shared/generic.popup.ts +++ b/src/app/manage-learn/shared/generic.popup.ts @@ -10,6 +10,8 @@ import { JoinProgramComponent } from './components/join-program/join-program.com import { ProfileService } from '@project-sunbird/sunbird-sdk'; import { ConsentStatus } from '@project-sunbird/client-services/models'; import { AppGlobalService } from '../../../services/app-global-service.service'; +import { KendraApiService } from '../core/services/kendra-api.service'; +import { urlConstants } from '../core/constants/urlConstants'; @Injectable({ providedIn: 'root', @@ -17,7 +19,9 @@ import { AppGlobalService } from '../../../services/app-global-service.service'; export class GenericPopUpService { consentPopup: any constructor(private popOverCtrl: PopoverController, private commonUtils: CommonUtilService, @Inject('PROFILE_SERVICE') private profileService: ProfileService, - private appGlobalService: AppGlobalService) {} + private appGlobalService: AppGlobalService, + private kendra : KendraApiService + ) {} async showPPPForProjectPopUp(message, message1, linkLabel, header, link, type) { const alert = await this.popOverCtrl.create({ @@ -168,4 +172,47 @@ async closeConsent(){ }) return data } + + joinProgram(payloadData){ + let programName = payloadData?.programName ? payloadData?.programName : payloadData?.programInformation?.programName + return this.showJoinProgramForProjectPopup("FRMELEMNTS_LBL_JOIN_PROGRAM_POPUP",programName,'program', + "FRMELEMNTS_LBL_JOIN_PROGRAM_POPUP","FRMELEMNTS_LBL_JOIN_PROGRAM_MSG2").then( + async (data:any)=>{ + if(data){ + return data; + } + } + ) + } + async join(payloadData,profileData){ + // let payload = await this.utils.getProfileInfo(); + let programId = payloadData.programId ?payloadData.programId :payloadData?.programInformation?.programId; + if (profileData) { + const config = { + url:`${urlConstants.API_URLS.JOIN_PROGRAM}${programId}`, + payload: {userRoleInformation:profileData, consentShared:payloadData.consentShared} + }; + this.kendra.post(config).subscribe((response) => { + if(response.status == 200){ + return true; + } + }, + (error) => { + return false; + } + ); + } + } + + +async showConsentPopup(data,profileData){ + if(!data?.requestForPIIConsent){ + let payload = {consumerId: data.rootOrganisations, objectId: data.programId} + this.showConsent('Program',payload).then(resp =>{ + if(data){ + this.join(true,profileData) + } + }) + } + } } \ No newline at end of file From 384606e4150f78d23102d86e2d34dd784273f9c7 Mon Sep 17 00:00:00 2001 From: Vishwanath Date: Thu, 25 May 2023 08:02:34 +0530 Subject: [PATCH 10/29] Issue #ED-432 fix : QA issue fix --- .../programs/program-details/program-details.component.html | 6 +++--- .../programs/program-details/program-details.component.ts | 2 +- 2 files changed, 4 insertions(+), 4 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 6389ae789..304877306 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 @@ -26,13 +26,13 @@ -
+
{{data?.sectionName}}
- +
-
+
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 c0371a782..4c9ac1e6f 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 @@ -223,7 +223,7 @@ export class ProgramDetailsComponent implements OnInit { } selectSection(name){ - this.selectedSection = name + name.show = !name.show; } redirectProject(data) { From b085ac4f80acec7bdd3954dd5c29486bd633dd19 Mon Sep 17 00:00:00 2001 From: Vishwanath Date: Thu, 25 May 2023 08:03:46 +0530 Subject: [PATCH 11/29] Issue #ED-432 fix : QA issue fix --- src/assets/i18n/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index c2b46ae48..e6e0ce56b 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -1380,7 +1380,7 @@ "DECREASE_FONT": "Decrease font size", "FRMELEMNTS_LBL_JOIN_PROGRAM_POPUP":"Join program", "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_NO_SOLUTIONS_FOR_PROGRAM":"There are no {{type}} added 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", From a1082fc9f420258009b74953b1cd484d67e2e57b Mon Sep 17 00:00:00 2001 From: Vinod-V3 Date: Mon, 29 May 2023 20:54:57 +0530 Subject: [PATCH 12/29] ISSUE #ED-431 fix : Changes done for PII consent and QA fixes --- .../program-details.component.html | 8 ++- .../program-details.component.scss | 35 ++++++---- .../program-details.component.ts | 64 ++++++++----------- src/app/manage-learn/shared/generic.popup.ts | 29 +++++---- src/assets/i18n/en.json | 6 +- 5 files changed, 75 insertions(+), 67 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 304877306..71eea7d20 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,5 +1,6 @@ - +
+
{{programDetails?.programName}}
{{description}} @@ -18,6 +19,7 @@
+
{{data?.sectionName}}
- +
-
+
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 index 463a39c4d..712c6d7fd 100644 --- a/src/app/manage-learn/programs/program-details/program-details.component.scss +++ b/src/app/manage-learn/programs/program-details/program-details.component.scss @@ -3,20 +3,27 @@ @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; - } + background-color: var(--app-primary-background); + position: sticky; + top: 0px; + z-index: 3; + padding-top: 5px; + ion-card{ + 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 { 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 4c9ac1e6f..d46f9532a 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 @@ -41,7 +41,6 @@ export class ProgramDetailsComponent implements OnInit { page = 1; isNewProgram = false lastUpdatedOn:any - consentShared = false payload constructor(private headerService: AppHeaderService, private translate: TranslateService, private popupService: GenericPopUpService, @@ -86,11 +85,11 @@ export class ProgramDetailsComponent implements OnInit { this.formatList() this.readMoreOrLess() if(this.isNewProgram && this.programDetails.programJoined && this.programDetails?.requestForPIIConsent){ - await this.popupService.getConsent('Program',this.payload).then((response)=>{ + let profileData = await this.utils.getProfileInfo(); + await this.popupService.getConsent('Program',this.payload,this.programDetails,profileData).then((response)=>{ if(response){ this.sharingStatus = response.status this.lastUpdatedOn = response.lastUpdatedOn - this.consentShared = true } }) } @@ -119,7 +118,7 @@ export class ProgramDetailsComponent implements OnInit { formatList(){ this.programDetails.data.forEach(data => { - let sectionName=data.type=='improvementProject'?'projects':data.type=='survey'?data.type:data.type+'s' + 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) @@ -144,44 +143,33 @@ export class ProgramDetailsComponent implements OnInit { } joinProgram(){ - this.popupService.showJoinProgramForProjectPopup("FRMELEMNTS_LBL_JOIN_PROGRAM_POPUP",this.programDetails.programName,'program', - "FRMELEMNTS_LBL_JOIN_PROGRAM_POPUP","FRMELEMNTS_LBL_JOIN_PROGRAM_MSG2").then( - async (data:any)=>{ - if(data){ - this.join() - } + this.popupService.joinProgram(this.programDetails,'program',"FRMELEMNTS_LBL_JOIN_PROGRAM_MSG2").then(async(data)=>{ + if(data){ + this.join() } - ) + }) } - async join(hideConsent?){ - let payload = await this.utils.getProfileInfo(); - if (payload) { - const config = { - url:`${urlConstants.API_URLS.JOIN_PROGRAM}${this.programId}`, - payload: {userRoleInformation:payload, consentShared:this.consentShared} - }; - this.kendraService.post(config).subscribe( - (response) => { - if(response.status==200){ - this.programDetails.programJoined = true - if(!hideConsent){ - this.showConsentPopup() - } - } - }, - (error) => {} - ); - } + async join(){ + let profileData = await this.utils.getProfileInfo(); + await this.popupService.join(this.programDetails,profileData).then(async(response:any)=>{ + if(response){ + this.programDetails.programJoined = true + this.showConsentPopup() + if(!this.programDetails.requestForPIIConsent){ + this.commonUtils.showToast('FRMELEMNTS_MSG_PROGRAM_JOINED_SUCCESS'); + } + } + }) } - showConsentPopup(){ + async showConsentPopup(){ + let profileData = await this.utils.getProfileInfo(); if(this.programDetails?.requestForPIIConsent){ - this.popupService.showConsent('Program',this.payload).then(async(data)=>{ + this.popupService.showConsent('Program',this.payload,this.programDetails, profileData).then(async(data)=>{ if(data){ this.sharingStatus = data - this.consentShared = true - await this.join(true) + this.programDetails.consentShared = true } }) } @@ -222,8 +210,12 @@ export class ProgramDetailsComponent implements OnInit { this.popupService.closeConsent() } - selectSection(name){ - name.show = !name.show; + selectSection(data){ + if(data.sectionName == this.selectedSection){ + this.selectedSection = '' + }else{ + this.selectedSection = data.sectionName + } } redirectProject(data) { diff --git a/src/app/manage-learn/shared/generic.popup.ts b/src/app/manage-learn/shared/generic.popup.ts index 3a8edd0a7..3fcac2c9d 100644 --- a/src/app/manage-learn/shared/generic.popup.ts +++ b/src/app/manage-learn/shared/generic.popup.ts @@ -104,7 +104,7 @@ async showJoinProgramForProjectPopup(header,name,type,button,message?){ } -async showConsent(type, payload){ +async showConsent(type, payload, details, profileData, message?){ let componentProps={} let payloadData:any = { userId : this.appGlobalService.getUserId(), objectType: type, ...payload } switch (type.toLowerCase()) { @@ -140,7 +140,13 @@ async showConsent(type, payload){ await loader.present(); await this.profileService.updateConsent(request).toPromise() .then(async (response) => { - this.commonUtils.showToast('FRMELEMNTS_MSG_DATA_SETTINGS_UPDATE_SUCCESS'); + if(message){ + this.commonUtils.showToast(message,'','',9000,'top'); + }else{ + this.commonUtils.showToast('FRMELEMNTS_MSG_DATA_SETTINGS_UPDATE_SUCCESS'); + } + details.consentShared = true + await this.join(details,profileData) await loader.dismiss(); }) .catch((e) => { @@ -158,14 +164,14 @@ async closeConsent(){ this.consentPopup ? await this.consentPopup.dismiss() : null } - async getConsent(type, payload){ + async getConsent(type, payload, details, profileData,message?){ const request = { userId : this.appGlobalService.getUserId(), ...payload } let data:any='' await this.profileService.getConsent(request).toPromise().then((response)=>{ data=response.consents[0] }).catch(async (error)=>{ if (!error.response.body.result.consent && error.response.responseCode === 404) { - await this.showConsent(type, payload); + await this.showConsent(type, payload, details, profileData,message); } else if (error.code === 'NETWORK_ERROR') { this.commonUtils.showToast('ERROR_NO_INTERNET_MESSAGE'); } @@ -173,10 +179,10 @@ async closeConsent(){ return data } - joinProgram(payloadData){ + joinProgram(payloadData,type,message?){ let programName = payloadData?.programName ? payloadData?.programName : payloadData?.programInformation?.programName - return this.showJoinProgramForProjectPopup("FRMELEMNTS_LBL_JOIN_PROGRAM_POPUP",programName,'program', - "FRMELEMNTS_LBL_JOIN_PROGRAM_POPUP","FRMELEMNTS_LBL_JOIN_PROGRAM_MSG2").then( + return this.showJoinProgramForProjectPopup("FRMELEMNTS_LBL_JOIN_PROGRAM_POPUP",programName,type, + "FRMELEMNTS_LBL_JOIN_PROGRAM_POPUP",message).then( async (data:any)=>{ if(data){ return data; @@ -185,20 +191,19 @@ async closeConsent(){ ) } async join(payloadData,profileData){ - // let payload = await this.utils.getProfileInfo(); let programId = payloadData.programId ?payloadData.programId :payloadData?.programInformation?.programId; if (profileData) { const config = { url:`${urlConstants.API_URLS.JOIN_PROGRAM}${programId}`, payload: {userRoleInformation:profileData, consentShared:payloadData.consentShared} }; - this.kendra.post(config).subscribe((response) => { + return await this.kendra.post(config).subscribe((response) => { if(response.status == 200){ - return true; + return true } }, (error) => { - return false; + return false } ); } @@ -208,7 +213,7 @@ async closeConsent(){ async showConsentPopup(data,profileData){ if(!data?.requestForPIIConsent){ let payload = {consumerId: data.rootOrganisations, objectId: data.programId} - this.showConsent('Program',payload).then(resp =>{ + this.showConsent('Program',payload, data,profileData).then(resp =>{ if(data){ this.join(true,profileData) } diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index e6e0ce56b..1c06f0d4c 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -1379,7 +1379,7 @@ "DEFAULT_FONT": "Default font size", "DECREASE_FONT": "Decrease font size", "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}} added 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", @@ -1394,5 +1394,7 @@ "FRMELEMNTS_LBL_JOIN_PROGRAM_MSG2":"Please join {{name}} {{type}} to view and access all the resources in this {{type}}.", "FRMELEMNTS_MSG_DATA_SETTINGS_UPDATE_SUCCESS":"Your data setting has been updated successfully", "EXPLORE_PROGRAMS":"Explore Programs", - "FRMELEMNTS_LBL_SEARCH_PROGRAMS_PLACEHOLDER":"Search your programs here" + "FRMELEMNTS_LBL_SEARCH_PROGRAMS_PLACEHOLDER":"Search your programs here", + "FRMELEMNTS_LBL_JOIN_PROGRAM_MSG_FOR_OBSERVATION":"You must join {{name}} program to view and access this {{type}}.", + "FRMELEMNTS_MSG_PROGRAM_JOINED_SUCCESS":"You have joined this program successfully" } \ No newline at end of file From d935cfb4340a36eab360a93fd3f7e2022a41f2f0 Mon Sep 17 00:00:00 2001 From: Vinod-V3 Date: Mon, 29 May 2023 20:58:34 +0530 Subject: [PATCH 13/29] ISSUE #ED-430 fix : QA issue fix --- .../programs/program-listing/program-listing.component.scss | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/manage-learn/programs/program-listing/program-listing.component.scss b/src/app/manage-learn/programs/program-listing/program-listing.component.scss index 46098942e..13b45e817 100644 --- a/src/app/manage-learn/programs/program-listing/program-listing.component.scss +++ b/src/app/manage-learn/programs/program-listing/program-listing.component.scss @@ -16,7 +16,6 @@ .ui-container { &::after { - height: 12.75rem !important; background-image: none !important; } } @@ -27,6 +26,9 @@ z-index: 1; padding: 0px 20px; margin-bottom: 20px; + padding-bottom: 10px; + border-bottom-left-radius: 20px; + background-color: var(--app-primary-header); } .load-more{ From 2fa7bd916fa4d541650afc732148fa3232a66e29 Mon Sep 17 00:00:00 2001 From: Vinod-V3 Date: Mon, 29 May 2023 21:08:35 +0530 Subject: [PATCH 14/29] ISSUE #ED-98 fix : Fix done related to PII consent flow for projects --- .../project-templateview.page.html | 6 ++-- .../project-templateview.page.scss | 3 ++ .../project-templateview.page.ts | 34 +++++++++++++++---- 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/src/app/manage-learn/project/project-templateview/project-templateview.page.html b/src/app/manage-learn/project/project-templateview/project-templateview.page.html index 702c94b96..a43c45b42 100644 --- a/src/app/manage-learn/project/project-templateview/project-templateview.page.html +++ b/src/app/manage-learn/project/project-templateview/project-templateview.page.html @@ -34,8 +34,10 @@
-
- +
+
+ +
\ No newline at end of file diff --git a/src/app/manage-learn/project/project-templateview/project-templateview.page.scss b/src/app/manage-learn/project/project-templateview/project-templateview.page.scss index e69de29bb..2821231d1 100644 --- a/src/app/manage-learn/project/project-templateview/project-templateview.page.scss +++ b/src/app/manage-learn/project/project-templateview/project-templateview.page.scss @@ -0,0 +1,3 @@ +.no-action{ + pointer-events: none; +} \ No newline at end of file diff --git a/src/app/manage-learn/project/project-templateview/project-templateview.page.ts b/src/app/manage-learn/project/project-templateview/project-templateview.page.ts index ff76698d7..5618ee86a 100644 --- a/src/app/manage-learn/project/project-templateview/project-templateview.page.ts +++ b/src/app/manage-learn/project/project-templateview/project-templateview.page.ts @@ -13,6 +13,7 @@ import { GenericPopUpService } from '../../shared'; import { AppGlobalService } from '../../../../services/app-global-service.service'; import { PreferenceKey } from '../../../../app/app.constant'; import { Subscription } from 'rxjs'; +import { CommonUtilService } from '../../../../services/common-util.service'; import { SharedPreferences @@ -89,7 +90,8 @@ export class ProjectTemplateviewPage implements OnInit { private alert: AlertController, private toast :ToastService, private platform : Platform, - private location :Location + private location :Location, + private commonUtils: CommonUtilService ) { params.params.subscribe((parameters) => { this.id = parameters.id; @@ -171,7 +173,12 @@ export class ProjectTemplateviewPage implements OnInit { this.project = resp.result; if( this.project.hasOwnProperty('requestForPIIConsent') && this.project.programJoined && this.project?.requestForPIIConsent){ let payloadData = {consumerId: this.project.rootOrganisations, objectId: this.project.programInformation.programId} - await this.popupService.getConsent('Program',payloadData); + let profileData = await this.utils.getProfileInfo(); + await this.popupService.getConsent('Program',payloadData,this.project,profileData,'FRMELEMNTS_MSG_PROGRAM_JOINED_SUCCESS').then((data)=>{ + if(data){ + this.project.programJoined = true + } + }) } if(this.project.criteria){ let criteria = Object.keys(this.project?.criteria?.conditions); @@ -226,7 +233,7 @@ export class ProjectTemplateviewPage implements OnInit { doAction() { if(!this.project?.programJoined && this.project.hasOwnProperty('requestForPIIConsent')){ - this.popupService.joinProgram(this.project) + this.popupService.joinProgram(this.project,'project') .then(async resp => { if(resp){ let profileData = await this.utils.getProfileInfo(); @@ -234,11 +241,21 @@ export class ProjectTemplateviewPage implements OnInit { if(data){ this.project.programJoined = true let payload = {consumerId: this.project.rootOrganisations, objectId: this.project.programInformation.programId}; - this.popupService.getConsent('Program',payload); + if(this.project.requestForPIIConsent){ + this.popupService.showConsent('Program',payload,this.project,profileData,'FRMELEMNTS_MSG_PROGRAM_JOINED_SUCCESS').then(async (data)=>{ + if(data){ + this.project.programJoined = true + } + }) + }else{ + this.commonUtils.showToast('FRMELEMNTS_MSG_PROGRAM_JOINED_SUCCESS','','',9000,'top'); + } + } },error =>{}) } }); + return }else{ if(!this.hideNameConfirmPopup && this.project.criteria && !this.isStarted && this.project.hasAcceptedTAndC && (this.isAssignedProject || this.isTargeted || this.isATargetedSolution)){ this.showProfileNameConfirmationPopup(); @@ -298,7 +315,7 @@ export class ProjectTemplateviewPage implements OnInit { if(this.programlisting){ await this.router.navigate([`/${RouterLinks.HOME}`]); await this.router.navigate([`/${RouterLinks.PROGRAM}`]); - await this.router.navigate([`/${RouterLinks.PROGRAM}/${RouterLinks.SOLUTIONS}`, this.programId]); + await this.router.navigate([`/${RouterLinks.PROGRAM}/${RouterLinks.DETAILS}`, this.programId]); } setTimeout(() => { if (this.stateData?.referenceFrom === 'link') { @@ -391,7 +408,8 @@ export class ProjectTemplateviewPage implements OnInit { }); await alert.present(); } - openStartIMPPopup(){ + openStartIMPPopup(event){ + event.stopPropagation() if(!this.project?.projectId){ this.popupService.showStartIMPForProjectPopUp('FRMELEMNTS_LBL_START_IMPROVEMENT', 'FRMELEMNTS_LBL_START_IMP_POPUP_MSG1', 'FRMELEMNTS_LBL_START_IMP_POPUP_MSG2',).then((data: any) => { if(data){ @@ -443,4 +461,8 @@ export class ProjectTemplateviewPage implements OnInit { } } } + + ionViewWillLeave(){ + this.popupService.closeConsent() + } } \ No newline at end of file From b9722905f845256a888fcd2a6aef5054c0f6bd0b Mon Sep 17 00:00:00 2001 From: Vishwanath Date: Tue, 30 May 2023 09:27:45 +0530 Subject: [PATCH 15/29] Issue #ED-1682 fix : Ionic migration 5 to 6 --- src/app/manage-learn/core/services/project.service.ts | 9 ++++----- .../domain-ecm-lsiting/domain-ecm-lsiting.component.ts | 2 +- .../observation-detail/observation-detail.component.ts | 2 +- .../observation-home/observation-home.component.ts | 2 +- .../observation-submission.component.ts | 9 +-------- .../learning-resources/learning-resources.page.ts | 2 +- .../project/project-details/project-details.component.ts | 7 ++++--- .../project/project-listing/project-listing.component.ts | 3 +-- 8 files changed, 14 insertions(+), 22 deletions(-) diff --git a/src/app/manage-learn/core/services/project.service.ts b/src/app/manage-learn/core/services/project.service.ts index a99db1a74..123826eb4 100644 --- a/src/app/manage-learn/core/services/project.service.ts +++ b/src/app/manage-learn/core/services/project.service.ts @@ -48,7 +48,7 @@ export class ProjectService { ) { this.networkFlag = this.commonUtilService.networkInfo.isNetworkAvailable; this._networkSubscription = this.commonUtilService.networkAvailability$.subscribe(async (available: boolean) => { - this.networkFlag = available; + this.networkFlag = this.commonUtilService.networkInfo.isNetworkAvailable; }) } async getTemplateBySoluntionId(id) { @@ -79,6 +79,9 @@ export class ProjectService { this.loader.startLoader(); let payload = isProfileInfoRequired ? await this.utils.getProfileInfo() : {}; const url = `${projectId ? '/' + projectId : ''}?${templateId ? 'templateId=' + encodeURIComponent(templateId) : ''}${solutionId ? ('&&solutionId=' + solutionId) : ''}`; + if(detailsPayload && isProfileInfoRequired){ + detailsPayload = {detailsPayload, ...payload} + } const config = { url: urlConstants.API_URLS.GET_PROJECT + url, payload: detailsPayload ? detailsPayload : payload @@ -152,7 +155,6 @@ export class ProjectService { } else { id = resource.link.split('/').pop() } - this.networkFlag = this.commonUtilService.networkInfo.isNetworkAvailable; if (!this.networkFlag) { this.toast.showMessage('FRMELEMNTS_MSG_PLEASE_GO_ONLINE', 'danger'); return; @@ -196,7 +198,6 @@ export class ProjectService { } async startAssessment(projectId, id) { - this.networkFlag = this.commonUtilService.networkInfo.isNetworkAvailable; if (!this.networkFlag) { this.toast.showMessage('FRMELEMNTS_MSG_YOU_ARE_WORKING_OFFLINE_TRY_AGAIN', 'danger'); return; @@ -248,7 +249,6 @@ export class ProjectService { } async checkReport(projectId, taskId) { - this.networkFlag = this.commonUtilService.networkInfo.isNetworkAvailable; if (!this.networkFlag) { this.toast.showMessage('FRMELEMNTS_MSG_YOU_ARE_WORKING_OFFLINE_TRY_AGAIN', 'danger'); return; @@ -318,7 +318,6 @@ export class ProjectService { } } async openSyncSharePopup(type, name, project, taskId?) { - this.networkFlag = this.commonUtilService.networkInfo.isNetworkAvailable; if (this.networkFlag) { let data; this.project = project; diff --git a/src/app/manage-learn/domain-ecm-listing/domain-ecm-lsiting/domain-ecm-lsiting.component.ts b/src/app/manage-learn/domain-ecm-listing/domain-ecm-lsiting/domain-ecm-lsiting.component.ts index d0b323aaa..7421c5599 100644 --- a/src/app/manage-learn/domain-ecm-listing/domain-ecm-lsiting/domain-ecm-lsiting.component.ts +++ b/src/app/manage-learn/domain-ecm-listing/domain-ecm-lsiting/domain-ecm-lsiting.component.ts @@ -70,7 +70,7 @@ export class DomainEcmLsitingComponent { this.networkFlag = this.commonUtilService.networkInfo.isNetworkAvailable; this._networkSubscription = this.commonUtilService.networkAvailability$.subscribe( async (available: boolean) => { - this.networkFlag = available; + this.networkFlag = this.commonUtilService.networkInfo.isNetworkAvailable; } ); this.translate.get(['FRMELEMENTS_MSG_FORM_DOWNLOADING']).subscribe(data => { diff --git a/src/app/manage-learn/observation/observation-detail/observation-detail.component.ts b/src/app/manage-learn/observation/observation-detail/observation-detail.component.ts index 8f775abca..dd6438a7b 100644 --- a/src/app/manage-learn/observation/observation-detail/observation-detail.component.ts +++ b/src/app/manage-learn/observation/observation-detail/observation-detail.component.ts @@ -77,7 +77,7 @@ export class ObservationDetailComponent implements OnInit { }); this._networkSubscription = this.commonUtilService.networkAvailability$.subscribe( (available: boolean) => { - this.networkFlag = available; + this.networkFlag = this.commonUtilService.networkInfo.isNetworkAvailable; this.networkFlag ? this.getObservationEntities() : this.getLocalData(); } ); diff --git a/src/app/manage-learn/observation/observation-home/observation-home.component.ts b/src/app/manage-learn/observation/observation-home/observation-home.component.ts index a8640ae42..f987aafa0 100644 --- a/src/app/manage-learn/observation/observation-home/observation-home.component.ts +++ b/src/app/manage-learn/observation/observation-home/observation-home.component.ts @@ -48,7 +48,7 @@ export class ObservationHomeComponent implements OnInit { ) { this._networkSubscription = this.commonUtilService.networkAvailability$.subscribe( async (available: boolean) => { - this.networkFlag = available; + this.networkFlag = this.commonUtilService.networkInfo.isNetworkAvailable; this.getProfileInfo(); } ); diff --git a/src/app/manage-learn/observation/observation-submission/observation-submission.component.ts b/src/app/manage-learn/observation/observation-submission/observation-submission.component.ts index 5489581ab..96afee947 100644 --- a/src/app/manage-learn/observation/observation-submission/observation-submission.component.ts +++ b/src/app/manage-learn/observation/observation-submission/observation-submission.component.ts @@ -91,10 +91,9 @@ export class ObservationSubmissionComponent implements OnInit { } ngOnInit() { - this._networkSubscription = this.commonUtilService.networkAvailability$.subscribe( async (available: boolean) => { - this.networkFlag = available; + this.networkFlag = this.commonUtilService.networkInfo.isNetworkAvailable; this.networkFlag ? this.getProgramFromStorage() : this.getLocalData(); } ); @@ -210,7 +209,6 @@ export class ObservationSubmissionComponent implements OnInit { } } getAssessmentDetails(submission) { - this.networkFlag = this.commonUtilService.networkInfo.isNetworkAvailable; if (this.networkFlag) { this.showActionsheet = false; this.showEntityActionsheet = false; @@ -250,7 +248,6 @@ export class ObservationSubmissionComponent implements OnInit { } async pushToLocal(submission) { - this.networkFlag = this.commonUtilService.networkInfo.isNetworkAvailable; if (!this.networkFlag) { this.toast.showMessage("FRMELEMENTS_MSG_FEATURE_USING_OFFLINE", "danger"); return @@ -345,7 +342,6 @@ export class ObservationSubmissionComponent implements OnInit { }); } async openMenu(event, submission, index) { - this.networkFlag = this.commonUtilService.networkInfo.isNetworkAvailable; if (!this.networkFlag) { this.toast.showMessage("FRMELEMENTS_MSG_FEATURE_USING_OFFLINE", "danger"); } else { @@ -390,7 +386,6 @@ export class ObservationSubmissionComponent implements OnInit { } // entity actions entityActions(e) { - this.networkFlag = this.commonUtilService.networkInfo.isNetworkAvailable; if (!this.networkFlag) { this.toast.showMessage("FRMELEMENTS_MSG_FEATURE_USING_OFFLINE", "danger"); } else { @@ -481,7 +476,6 @@ export class ObservationSubmissionComponent implements OnInit { await popover.present(); } async deleteSubmission(submissionId) { - this.networkFlag = this.commonUtilService.networkInfo.isNetworkAvailable; if (!this.networkFlag) { this.toast.showMessage("FRMELEMENTS_MSG_FEATURE_USING_OFFLINE", "danger"); return @@ -560,7 +554,6 @@ export class ObservationSubmissionComponent implements OnInit { } async observeAgain() { - this.networkFlag = this.commonUtilService.networkInfo.isNetworkAvailable; if (!this.networkFlag) { this.toast.showMessage("FRMELEMENTS_MSG_FEATURE_USING_OFFLINE", "danger"); } else { diff --git a/src/app/manage-learn/project/learning-resources/learning-resources.page.ts b/src/app/manage-learn/project/learning-resources/learning-resources.page.ts index 6e1b17edb..a5f71c517 100644 --- a/src/app/manage-learn/project/learning-resources/learning-resources.page.ts +++ b/src/app/manage-learn/project/learning-resources/learning-resources.page.ts @@ -63,7 +63,7 @@ export class LearningResourcesPage { }); this.networkFlag = this.commonUtilService.networkInfo.isNetworkAvailable; this._networkSubscription = this.commonUtilService.networkAvailability$.subscribe(async (available: boolean) => { - this.networkFlag = available; + this.networkFlag = this.commonUtilService.networkInfo.isNetworkAvailable; }) } diff --git a/src/app/manage-learn/project/project-details/project-details.component.ts b/src/app/manage-learn/project/project-details/project-details.component.ts index 6e5a269cb..ef7fc692a 100644 --- a/src/app/manage-learn/project/project-details/project-details.component.ts +++ b/src/app/manage-learn/project/project-details/project-details.component.ts @@ -67,7 +67,7 @@ export class ProjectDetailsComponent implements OnInit { params.queryParams.subscribe((parameters) => { this.networkFlag = this.commonUtilService.networkInfo.isNetworkAvailable; this._networkSubscription = this.commonUtilService.networkAvailability$.subscribe(async (available: boolean) => { - this.networkFlag = available; + this.networkFlag = this.commonUtilService.networkInfo.isNetworkAvailable; }) this.setHeaderConfig(); this.projectId = parameters.projectId; @@ -362,8 +362,9 @@ export class ProjectDetailsComponent implements OnInit { } submitImprovment() { - if (!this.network.isNetworkAvailable) { - this.toast.showMessage('FRMELEMNTS_MSG_YOU_ARE_WORKING_OFFLINE_TRY_AGAIN', 'danger') + if (!this.networkFlag) { + this.toast.showMessage('FRMELEMNTS_MSG_YOU_ARE_WORKING_OFFLINE_TRY_AGAIN', 'danger'); + return; } this.router.navigate([`${RouterLinks.PROJECT}/${RouterLinks.ADD_FILE}`, this.projectDetails._id]) } diff --git a/src/app/manage-learn/project/project-listing/project-listing.component.ts b/src/app/manage-learn/project/project-listing/project-listing.component.ts index 0c8bfd7bd..ea8e08faf 100644 --- a/src/app/manage-learn/project/project-listing/project-listing.component.ts +++ b/src/app/manage-learn/project/project-listing/project-listing.component.ts @@ -80,7 +80,7 @@ export class ProjectListingComponent { this._networkSubscription = this.commonUtilService.networkAvailability$.subscribe(async (available: boolean) => { this.clearFields(); - this.networkFlag = available; + this.networkFlag = this.commonUtilService.networkInfo.isNetworkAvailable; this.projects = []; this.fetchProjectList(); }); @@ -205,7 +205,6 @@ export class ProjectListingComponent { fetchProjectList() { this.projects = []; - this.networkFlag = this.commonUtilService.networkInfo.isNetworkAvailable; if (this.networkFlag) { this.selectedFilterIndex !== 2 ? this.getProjectList() : this.getCreatedProjects() } else { From 981b690cceebdc9741c40946a40c632764d1bfeb Mon Sep 17 00:00:00 2001 From: Vishwanath Date: Tue, 30 May 2023 15:51:57 +0530 Subject: [PATCH 16/29] Issue #ED-542 feat : Program tile for teachers --- src/app/home/user-home/user-home.page.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app/home/user-home/user-home.page.ts b/src/app/home/user-home/user-home.page.ts index 3ad3bcda2..1de3801ab 100644 --- a/src/app/home/user-home/user-home.page.ts +++ b/src/app/home/user-home/user-home.page.ts @@ -846,7 +846,7 @@ export class UserHomePage implements OnInit, OnDestroy, OnTabViewWillEnter { this.events.publish('onPreferenceChange:showReport', false); } } catch (error) { - this.otherCategories = []; + // this.otherCategories = []; this.events.publish('onPreferenceChange:showReport', false); } } @@ -889,6 +889,9 @@ export class UserHomePage implements OnInit, OnDestroy, OnTabViewWillEnter { case 'project': this.router.navigate([RouterLinks.PROJECT], {}); break; + case 'program': + this.router.navigate([RouterLinks.PROGRAM], {}); + break; default: break; } From a6b915f954778d0af54a8eb1879f46a5d8ababdc Mon Sep 17 00:00:00 2001 From: Vinod-V3 Date: Tue, 30 May 2023 18:27:36 +0530 Subject: [PATCH 17/29] ISSUE #ED-99 feat : User consent for PII data for Observations --- .../observation-detail.component.ts | 55 ++++++++++++++++++- .../observation-home.component.ts | 3 +- 2 files changed, 54 insertions(+), 4 deletions(-) diff --git a/src/app/manage-learn/observation/observation-detail/observation-detail.component.ts b/src/app/manage-learn/observation/observation-detail/observation-detail.component.ts index 8f775abca..7966d78ed 100644 --- a/src/app/manage-learn/observation/observation-detail/observation-detail.component.ts +++ b/src/app/manage-learn/observation/observation-detail/observation-detail.component.ts @@ -19,7 +19,7 @@ import { TranslateService } from "@ngx-translate/core"; import { ObservationService } from "../observation.service"; import { storageKeys } from "../../storageKeys"; import { Subscription } from "rxjs"; -import { EntitySearchLocalComponent } from "../../shared"; +import { EntitySearchLocalComponent, GenericPopUpService } from "../../shared"; import { AppHeaderService } from "../../../../services/app-header.service"; import { CommonUtilService } from "../../../../services/common-util.service"; @Component({ @@ -47,6 +47,9 @@ export class ObservationDetailComponent implements OnInit { private _networkSubscription?: Subscription; networkFlag; searchQuery : string; + programName= '' + isNewProgram= false + payload: {} constructor( private headerService: AppHeaderService, private router: Router, @@ -62,6 +65,7 @@ export class ObservationDetailComponent implements OnInit { private observationService: ObservationService, private localStorage: LocalStorageService, public commonUtilService: CommonUtilService, + private popupService: GenericPopUpService, ) { this.routerParam.queryParams.subscribe(params => { this.observationId = params.observationId; @@ -69,6 +73,7 @@ export class ObservationDetailComponent implements OnInit { this.programId = params.programId; this.solutionName = params.solutionName; this.entityType =params.entityType; + this.programName = params.programName let parameters = { solutionId: this.solutionId, programId: this.programId, @@ -117,13 +122,23 @@ export class ObservationDetailComponent implements OnInit { }; this.loader.startLoader(); this.assessmentService.post(config).subscribe( - success => { + async success => { this.loader.stopLoader(); if (success && success.result && success.result.entities) { this.disableAddEntity = false; - this.solutionData = success.result; + this.solutionData = {...success.result, programId:this.programId, programName:this.programName||''}; this.entities = success.result.entities; this.entityType = success.result.entityType; + this.isNewProgram = success.result.hasOwnProperty('requestForPIIConsent') + this.payload = {consumerId: success.result.rootOrganisations, objectId: this.programId} + if(this.isNewProgram && this.solutionData?.programJoined && this.solutionData?.requestForPIIConsent){ + let profileData = await this.utils.getProfileInfo(); + await this.popupService.getConsent('Program',this.payload,this.solutionData,profileData,'FRMELEMNTS_MSG_PROGRAM_JOINED_SUCCESS').then((response)=>{ + if(response){ + this.solutionData.consentShared = true + } + }) + } if (!this.observationId) { this.observationId = success.result._id; // for autotargeted if get observationId } @@ -178,6 +193,10 @@ export class ObservationDetailComponent implements OnInit { } async addEntity() { + if(!this.solutionData.programJoined && this.isNewProgram){ + this.joinProgram() + return + } if(this.networkFlag){ let entityListModal; entityListModal = await this.modalCtrl.create({ @@ -283,6 +302,10 @@ export class ObservationDetailComponent implements OnInit { } async entityClickAction(e):Promise{ + if(!this.solutionData.programJoined && this.isNewProgram){ + this.joinProgram() + return + } if (this.solutionData.allowMultipleAssessemts) { this.goToObservationSubmission(e); return; @@ -329,6 +352,7 @@ export class ObservationDetailComponent implements OnInit { if (this._networkSubscription) { this._networkSubscription.unsubscribe(); } + this.popupService.closeConsent() } async localSearch(){ let entityListModal; @@ -353,4 +377,29 @@ export class ObservationDetailComponent implements OnInit { } }); } + + async joinProgram(){ + this.popupService.joinProgram(this.solutionData,'observation',"FRMELEMNTS_LBL_JOIN_PROGRAM_MSG_FOR_OBSERVATION").then(async(data)=>{ + if(data){ + let profileData = await this.utils.getProfileInfo(); + this.popupService.join(this.solutionData,profileData).then(async(response:any)=>{ + if(response){ + this.solutionData.programJoined = true + this.showConsent() + } + }) + } + }) + } + + async showConsent(){ + let profileData = await this.utils.getProfileInfo(); + if(this.solutionData?.requestForPIIConsent){ + this.popupService.showConsent('Program',this.payload,this.solutionData,profileData,'FRMELEMNTS_MSG_PROGRAM_JOINED_SUCCESS').then(async(data)=>{ + if(data){ + this.solutionData.consentShared = true + } + }) + } + } } diff --git a/src/app/manage-learn/observation/observation-home/observation-home.component.ts b/src/app/manage-learn/observation/observation-home/observation-home.component.ts index a8640ae42..2b54e4873 100644 --- a/src/app/manage-learn/observation/observation-home/observation-home.component.ts +++ b/src/app/manage-learn/observation/observation-home/observation-home.component.ts @@ -134,7 +134,8 @@ export class ObservationHomeComponent implements OnInit { solutionId: solutionId, observationId: observationId, solutionName: solutionName, - entityType : solution.entityType ? solution.entityType :'' + entityType : solution.entityType ? solution.entityType :'', + programName: programName } } ) From 070e99acc6cd71366836af03755999bd7d3cb8fc Mon Sep 17 00:00:00 2001 From: Vinod-V3 Date: Tue, 30 May 2023 20:23:01 +0530 Subject: [PATCH 18/29] ISSUE #ED-22 feat : Modification done for the Start improvement popup --- .../project/project-templateview/project-templateview.page.ts | 3 ++- .../start-improvement/start-improvement.component.html | 2 +- .../start-improvement/start-improvement.component.ts | 1 + src/app/manage-learn/shared/generic.popup.ts | 3 ++- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/app/manage-learn/project/project-templateview/project-templateview.page.ts b/src/app/manage-learn/project/project-templateview/project-templateview.page.ts index 5618ee86a..bb4c7c939 100644 --- a/src/app/manage-learn/project/project-templateview/project-templateview.page.ts +++ b/src/app/manage-learn/project/project-templateview/project-templateview.page.ts @@ -411,7 +411,8 @@ export class ProjectTemplateviewPage implements OnInit { openStartIMPPopup(event){ event.stopPropagation() if(!this.project?.projectId){ - this.popupService.showStartIMPForProjectPopUp('FRMELEMNTS_LBL_START_IMPROVEMENT', 'FRMELEMNTS_LBL_START_IMP_POPUP_MSG1', 'FRMELEMNTS_LBL_START_IMP_POPUP_MSG2',).then((data: any) => { + this.popupService.showStartIMPForProjectPopUp('FRMELEMNTS_LBL_START_IMPROVEMENT', 'FRMELEMNTS_LBL_START_IMP_POPUP_MSG1', 'FRMELEMNTS_LBL_START_IMP_POPUP_MSG2', 'FRMELEMNTS_LBL_START_IMPROVEMENT') + .then((data: any) => { if(data){ this.doAction(); } diff --git a/src/app/manage-learn/shared/components/start-improvement/start-improvement.component.html b/src/app/manage-learn/shared/components/start-improvement/start-improvement.component.html index 7d3ec52df..6f878d055 100644 --- a/src/app/manage-learn/shared/components/start-improvement/start-improvement.component.html +++ b/src/app/manage-learn/shared/components/start-improvement/start-improvement.component.html @@ -21,7 +21,7 @@
+ (click)="start()">{{button | translate}}
diff --git a/src/app/manage-learn/shared/components/start-improvement/start-improvement.component.ts b/src/app/manage-learn/shared/components/start-improvement/start-improvement.component.ts index d6f3174af..4bff3505e 100644 --- a/src/app/manage-learn/shared/components/start-improvement/start-improvement.component.ts +++ b/src/app/manage-learn/shared/components/start-improvement/start-improvement.component.ts @@ -10,6 +10,7 @@ export class StartImprovementComponent { @Input() header; @Input() message; @Input() message1; + @Input() button; constructor( private popOverCtrl: PopoverController, ) { } diff --git a/src/app/manage-learn/shared/generic.popup.ts b/src/app/manage-learn/shared/generic.popup.ts index 3fcac2c9d..02f626bcd 100644 --- a/src/app/manage-learn/shared/generic.popup.ts +++ b/src/app/manage-learn/shared/generic.popup.ts @@ -71,13 +71,14 @@ export class GenericPopUpService { return data.isLeftButtonClicked; } - async showStartIMPForProjectPopUp(header,message, message1, ) { + async showStartIMPForProjectPopUp(header,message, message1, button) { const alert = await this.popOverCtrl.create({ component: StartImprovementComponent, componentProps: { message: message, message1: message1, header: header, + button: button }, cssClass: 'sb-popover', }); From f9ab1bbf726309974cc889b69644ed34c1d08296 Mon Sep 17 00:00:00 2001 From: Vinod-V3 Date: Tue, 30 May 2023 20:33:28 +0530 Subject: [PATCH 19/29] ISSUE #ED-540 feat : Added PII popup for survey and observation, Start improvement popup for observation --- .../deeplink-redirect.component.ts | 3 +- .../questionnaire/questionnaire.page.html | 2 + .../questionnaire/questionnaire.page.ts | 98 +++++++++++++++++-- src/assets/i18n/en.json | 5 +- 4 files changed, 100 insertions(+), 8 deletions(-) diff --git a/src/app/manage-learn/deeplink-redirect/deeplink-redirect/deeplink-redirect.component.ts b/src/app/manage-learn/deeplink-redirect/deeplink-redirect/deeplink-redirect.component.ts index 487338ba7..266503141 100644 --- a/src/app/manage-learn/deeplink-redirect/deeplink-redirect/deeplink-redirect.component.ts +++ b/src/app/manage-learn/deeplink-redirect/deeplink-redirect/deeplink-redirect.component.ts @@ -149,6 +149,7 @@ export class DeeplinkRedirectComponent implements OnInit { if (success.result) { success.result.isATargetedSolution = data.isATargetedSolution; success.result.programId = data.programId; + success.result.programName = data.programName; this.redirectObservation(success.result); }else{ this.location.back(); @@ -163,7 +164,7 @@ export class DeeplinkRedirectComponent implements OnInit { async goToEntities(data) { await this.router.navigate([`/${RouterLinks.HOME}`]) this.router.navigate([`/${RouterLinks.OBSERVATION}/${RouterLinks.OBSERVATION_DETAILS}`], { - queryParams: { solutionId: data.solutionId, solutionName: data.name, programId: data.programId } + queryParams: { solutionId: data.solutionId, solutionName: data.name, programId: data.programId, programName: data.programName } }); } diff --git a/src/app/manage-learn/questionnaire/questionnaire.page.html b/src/app/manage-learn/questionnaire/questionnaire.page.html index 34ba80d14..6d878d4a9 100644 --- a/src/app/manage-learn/questionnaire/questionnaire.page.html +++ b/src/app/manage-learn/questionnaire/questionnaire.page.html @@ -1,4 +1,5 @@ +
@@ -38,6 +39,7 @@

{{question?.sectionHeade

+
{ this.submissionId = params.submisssionId; @@ -115,7 +118,7 @@ export class QuestionnairePage implements OnInit, OnDestroy { } } - getQuestions(data){ + async getQuestions(data){ this.schoolData = data; const currentEvidences = this.schoolData['assessment']['evidences']; this.enableQuestionReadOut = this.schoolData['solution']['enableQuestionReadOut']; @@ -140,8 +143,17 @@ export class QuestionnairePage implements OnInit, OnDestroy { sectionName: currentEvidences[this.selectedEvidenceIndex]['sections'][this.selectedSectionIndex].name, currentViewIndex: this.start, }; + this.payload = {consumerId: data.rootOrganisations||'', objectId: data.programId||data.program._id} this.isCurrentEvidenceSubmitted = currentEvidences[this.selectedEvidenceIndex].isSubmitted; - if (!this.isSurvey && this.isCurrentEvidenceSubmitted || this.isViewOnly) { + if(data.hasOwnProperty('requestForPIIConsent') && data.programJoined && data?.requestForPIIConsent){ + let profileData = await this.utils.getProfileInfo(); + await this.popupService.getConsent('Program',this.payload,this.schoolData,profileData,'FRMELEMNTS_MSG_PROGRAM_JOINED_SUCCESS').then((response)=>{ + if(response){ + } + }) + } + + if ((!this.isSurvey && this.isCurrentEvidenceSubmitted || this.isViewOnly)|| (!this.schoolData.programJoined) ) { document.getElementById('stop').style.pointerEvents = 'none'; } } @@ -155,9 +167,18 @@ export class QuestionnairePage implements OnInit, OnDestroy { } allowStart(){ - this.schoolData['assessment']['evidences'][this.selectedEvidenceIndex].startTime = Date.now(); - this.isViewOnly = false; - document.getElementById('stop').style.pointerEvents = 'auto'; + if(this.schoolData?.programJoined){ + this.popupService.showStartIMPForProjectPopUp('FRMELEMNTS_LBL_START_OBSERVATION_POPUP', 'FRMELEMNTS_LBL_START_OBSERVATION_POPUP_MSG1', + 'FRMELEMNTS_LBL_START_OBSERVATION_POPUP_MSG2','FRMELEMNTS_LBL_START_OBSERVATION_POPUP').then((data:any)=>{ + if(data){ + this.schoolData['assessment']['evidences'][this.selectedEvidenceIndex].startTime = Date.now(); + this.isViewOnly = false; + document.getElementById('stop').style.pointerEvents = 'auto'; + } + }) + }else{ + this.joinProgram() + } } async startAction(){ await this.router.navigate([`/${RouterLinks.HOME}`]); @@ -168,6 +189,15 @@ export class QuestionnairePage implements OnInit, OnDestroy { ionViewDidLoad() {} async openQuestionMap() { + this.headerConfig = this.headerService.getDefaultPageConfig(); + this.headerConfig.actionButtons = ['questionMap']; + this.headerConfig.showHeader = true; + this.headerConfig.showBurgerMenu = false; + this.headerService.updatePageConfig(this.headerConfig); + if(this.isSurvey && !this.schoolData.programJoined){ + this.joinProgram() + return + } const questionModal = await this.modalCtrl.create({ component: QuestionMapModalComponent, componentProps: { @@ -185,6 +215,10 @@ export class QuestionnairePage implements OnInit, OnDestroy { // images_CO_5bebcfcf92ec921dcf114828 next(status?: string) { + if(this.isSurvey && !this.schoolData.programJoined){ + this.joinProgram() + return + } this.pageTop.scrollToTop(); if (this.questions[this.start].responseType === 'pageQuestions') { this.questions[this.start].endTime = this.questions[this.start] ? Date.now() : ''; @@ -494,6 +528,7 @@ export class QuestionnairePage implements OnInit, OnDestroy { ionViewWillLeave() { this.headerConfig.actionButtons = []; this.headerService.updatePageConfig(this.headerConfig); + this.popupService.closeConsent() } showMessageForNONTargetUsers(){ @@ -503,4 +538,55 @@ export class QuestionnairePage implements OnInit, OnDestroy { this.toast.openToast(msg,'','top'); }); } + + joinProgram(){ + let solutionType = this.isSurvey ? 'survey' : 'observation' + let programName = this.schoolData.programName || this.schoolData.program.name + this.popupService.showJoinProgramForProjectPopup("FRMELEMNTS_LBL_JOIN_PROGRAM_POPUP",programName, solutionType, + "FRMELEMNTS_LBL_JOIN_PROGRAM_POPUP","FRMELEMNTS_LBL_JOIN_PROGRAM_MSG_FOR_OBSERVATION").then( + async (data:any)=>{ + if(data){ + this.join() + } + } + ) + } + + async join(){ + let profileData = await this.utils.getProfileInfo(); + await this.popupService.join(this.schoolData,profileData).then(async(response:any)=>{ + if(response){ + this.schoolData.programJoined = true + this.showConsentPopup() + if(!this.schoolData.requestForPIIConsent){ + this.commonUtilService.showToast('FRMELEMNTS_MSG_PROGRAM_JOINED_SUCCESS'); + if(this.isSurvey){ + document.getElementById('stop').style.pointerEvents = 'auto'; + } + } + } + }) + } + + async showConsentPopup(){ + let profileData = await this.utils.getProfileInfo(); + if(this.schoolData?.requestForPIIConsent){ + this.popupService.showConsent('Program',this.payload,this.schoolData, profileData,'FRMELEMNTS_MSG_PROGRAM_JOINED_SUCCESS').then(async(data)=>{ + if(data){ + if(this.isSurvey){ + document.getElementById('stop').style.pointerEvents = 'auto'; + } + } + }) + } + } + + showPopup(){ + if(!this.schoolData?.programJoined){ + this.joinProgram() + }else if(this.schoolData.programJoined && !this.isSurvey && this.isViewOnly){ + this.allowStart() + } + } + } \ No newline at end of file diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index 1c06f0d4c..66b40da54 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -1396,5 +1396,8 @@ "EXPLORE_PROGRAMS":"Explore Programs", "FRMELEMNTS_LBL_SEARCH_PROGRAMS_PLACEHOLDER":"Search your programs here", "FRMELEMNTS_LBL_JOIN_PROGRAM_MSG_FOR_OBSERVATION":"You must join {{name}} program to view and access this {{type}}.", - "FRMELEMNTS_MSG_PROGRAM_JOINED_SUCCESS":"You have joined this program successfully" + "FRMELEMNTS_MSG_PROGRAM_JOINED_SUCCESS":"You have joined this program successfully", + "FRMELEMNTS_LBL_START_OBSERVATION_POPUP":"Start observation", + "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" } \ No newline at end of file From 45e5dbc253200b200d2cc17840ea9f93913f8468 Mon Sep 17 00:00:00 2001 From: Vinod-V3 Date: Tue, 30 May 2023 20:33:28 +0530 Subject: [PATCH 20/29] ISSUE #ED-540 feat : Added PII popup for survey and observation, Start improvement popup for observation --- .../deeplink-redirect.component.ts | 3 +- .../questionnaire/questionnaire.page.html | 2 + .../questionnaire/questionnaire.page.ts | 98 +++++++++++++++++-- src/assets/i18n/en.json | 5 +- 4 files changed, 100 insertions(+), 8 deletions(-) diff --git a/src/app/manage-learn/deeplink-redirect/deeplink-redirect/deeplink-redirect.component.ts b/src/app/manage-learn/deeplink-redirect/deeplink-redirect/deeplink-redirect.component.ts index 487338ba7..266503141 100644 --- a/src/app/manage-learn/deeplink-redirect/deeplink-redirect/deeplink-redirect.component.ts +++ b/src/app/manage-learn/deeplink-redirect/deeplink-redirect/deeplink-redirect.component.ts @@ -149,6 +149,7 @@ export class DeeplinkRedirectComponent implements OnInit { if (success.result) { success.result.isATargetedSolution = data.isATargetedSolution; success.result.programId = data.programId; + success.result.programName = data.programName; this.redirectObservation(success.result); }else{ this.location.back(); @@ -163,7 +164,7 @@ export class DeeplinkRedirectComponent implements OnInit { async goToEntities(data) { await this.router.navigate([`/${RouterLinks.HOME}`]) this.router.navigate([`/${RouterLinks.OBSERVATION}/${RouterLinks.OBSERVATION_DETAILS}`], { - queryParams: { solutionId: data.solutionId, solutionName: data.name, programId: data.programId } + queryParams: { solutionId: data.solutionId, solutionName: data.name, programId: data.programId, programName: data.programName } }); } diff --git a/src/app/manage-learn/questionnaire/questionnaire.page.html b/src/app/manage-learn/questionnaire/questionnaire.page.html index 34ba80d14..6d878d4a9 100644 --- a/src/app/manage-learn/questionnaire/questionnaire.page.html +++ b/src/app/manage-learn/questionnaire/questionnaire.page.html @@ -1,4 +1,5 @@ +
@@ -38,6 +39,7 @@

{{question?.sectionHeade

+
{ this.submissionId = params.submisssionId; @@ -115,7 +118,7 @@ export class QuestionnairePage implements OnInit, OnDestroy { } } - getQuestions(data){ + async getQuestions(data){ this.schoolData = data; const currentEvidences = this.schoolData['assessment']['evidences']; this.enableQuestionReadOut = this.schoolData['solution']['enableQuestionReadOut']; @@ -140,8 +143,17 @@ export class QuestionnairePage implements OnInit, OnDestroy { sectionName: currentEvidences[this.selectedEvidenceIndex]['sections'][this.selectedSectionIndex].name, currentViewIndex: this.start, }; + this.payload = {consumerId: data.rootOrganisations||'', objectId: data.programId||data.program._id} this.isCurrentEvidenceSubmitted = currentEvidences[this.selectedEvidenceIndex].isSubmitted; - if (!this.isSurvey && this.isCurrentEvidenceSubmitted || this.isViewOnly) { + if(data.hasOwnProperty('requestForPIIConsent') && data.programJoined && data?.requestForPIIConsent){ + let profileData = await this.utils.getProfileInfo(); + await this.popupService.getConsent('Program',this.payload,this.schoolData,profileData,'FRMELEMNTS_MSG_PROGRAM_JOINED_SUCCESS').then((response)=>{ + if(response){ + } + }) + } + + if ((!this.isSurvey && this.isCurrentEvidenceSubmitted || this.isViewOnly)|| (!this.schoolData.programJoined) ) { document.getElementById('stop').style.pointerEvents = 'none'; } } @@ -155,9 +167,18 @@ export class QuestionnairePage implements OnInit, OnDestroy { } allowStart(){ - this.schoolData['assessment']['evidences'][this.selectedEvidenceIndex].startTime = Date.now(); - this.isViewOnly = false; - document.getElementById('stop').style.pointerEvents = 'auto'; + if(this.schoolData?.programJoined){ + this.popupService.showStartIMPForProjectPopUp('FRMELEMNTS_LBL_START_OBSERVATION_POPUP', 'FRMELEMNTS_LBL_START_OBSERVATION_POPUP_MSG1', + 'FRMELEMNTS_LBL_START_OBSERVATION_POPUP_MSG2','FRMELEMNTS_LBL_START_OBSERVATION_POPUP').then((data:any)=>{ + if(data){ + this.schoolData['assessment']['evidences'][this.selectedEvidenceIndex].startTime = Date.now(); + this.isViewOnly = false; + document.getElementById('stop').style.pointerEvents = 'auto'; + } + }) + }else{ + this.joinProgram() + } } async startAction(){ await this.router.navigate([`/${RouterLinks.HOME}`]); @@ -168,6 +189,15 @@ export class QuestionnairePage implements OnInit, OnDestroy { ionViewDidLoad() {} async openQuestionMap() { + this.headerConfig = this.headerService.getDefaultPageConfig(); + this.headerConfig.actionButtons = ['questionMap']; + this.headerConfig.showHeader = true; + this.headerConfig.showBurgerMenu = false; + this.headerService.updatePageConfig(this.headerConfig); + if(this.isSurvey && !this.schoolData.programJoined){ + this.joinProgram() + return + } const questionModal = await this.modalCtrl.create({ component: QuestionMapModalComponent, componentProps: { @@ -185,6 +215,10 @@ export class QuestionnairePage implements OnInit, OnDestroy { // images_CO_5bebcfcf92ec921dcf114828 next(status?: string) { + if(this.isSurvey && !this.schoolData.programJoined){ + this.joinProgram() + return + } this.pageTop.scrollToTop(); if (this.questions[this.start].responseType === 'pageQuestions') { this.questions[this.start].endTime = this.questions[this.start] ? Date.now() : ''; @@ -494,6 +528,7 @@ export class QuestionnairePage implements OnInit, OnDestroy { ionViewWillLeave() { this.headerConfig.actionButtons = []; this.headerService.updatePageConfig(this.headerConfig); + this.popupService.closeConsent() } showMessageForNONTargetUsers(){ @@ -503,4 +538,55 @@ export class QuestionnairePage implements OnInit, OnDestroy { this.toast.openToast(msg,'','top'); }); } + + joinProgram(){ + let solutionType = this.isSurvey ? 'survey' : 'observation' + let programName = this.schoolData.programName || this.schoolData.program.name + this.popupService.showJoinProgramForProjectPopup("FRMELEMNTS_LBL_JOIN_PROGRAM_POPUP",programName, solutionType, + "FRMELEMNTS_LBL_JOIN_PROGRAM_POPUP","FRMELEMNTS_LBL_JOIN_PROGRAM_MSG_FOR_OBSERVATION").then( + async (data:any)=>{ + if(data){ + this.join() + } + } + ) + } + + async join(){ + let profileData = await this.utils.getProfileInfo(); + await this.popupService.join(this.schoolData,profileData).then(async(response:any)=>{ + if(response){ + this.schoolData.programJoined = true + this.showConsentPopup() + if(!this.schoolData.requestForPIIConsent){ + this.commonUtilService.showToast('FRMELEMNTS_MSG_PROGRAM_JOINED_SUCCESS'); + if(this.isSurvey){ + document.getElementById('stop').style.pointerEvents = 'auto'; + } + } + } + }) + } + + async showConsentPopup(){ + let profileData = await this.utils.getProfileInfo(); + if(this.schoolData?.requestForPIIConsent){ + this.popupService.showConsent('Program',this.payload,this.schoolData, profileData,'FRMELEMNTS_MSG_PROGRAM_JOINED_SUCCESS').then(async(data)=>{ + if(data){ + if(this.isSurvey){ + document.getElementById('stop').style.pointerEvents = 'auto'; + } + } + }) + } + } + + showPopup(){ + if(!this.schoolData?.programJoined){ + this.joinProgram() + }else if(this.schoolData.programJoined && !this.isSurvey && this.isViewOnly){ + this.allowStart() + } + } + } \ No newline at end of file diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index 1c06f0d4c..66b40da54 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -1396,5 +1396,8 @@ "EXPLORE_PROGRAMS":"Explore Programs", "FRMELEMNTS_LBL_SEARCH_PROGRAMS_PLACEHOLDER":"Search your programs here", "FRMELEMNTS_LBL_JOIN_PROGRAM_MSG_FOR_OBSERVATION":"You must join {{name}} program to view and access this {{type}}.", - "FRMELEMNTS_MSG_PROGRAM_JOINED_SUCCESS":"You have joined this program successfully" + "FRMELEMNTS_MSG_PROGRAM_JOINED_SUCCESS":"You have joined this program successfully", + "FRMELEMNTS_LBL_START_OBSERVATION_POPUP":"Start observation", + "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" } \ No newline at end of file From 5107611c87bcc7cbc7f2e45ee38ce7b1a8ffe231 Mon Sep 17 00:00:00 2001 From: swayangjit Date: Fri, 2 Jun 2023 13:46:08 +0530 Subject: [PATCH 21/29] Issue #SB-000 chore: Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5e23834a9..8ac71aae2 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,9 @@ ## What is the Sunbird Mobile app? The Sunbird Mobile app is the app-based interface for the Sunbird application stack. It provides a app(android/ios) through which all functionality of Sunbird can be accessed. -Latest release- [release-5.1.0](https://github.com/Sunbird-Ed/SunbirdEd-mobile-app/releases/tag/release-5.1.0.9_RC1) +Latest release- [release-5.2.0](https://github.com/Sunbird-Ed/SunbirdEd-mobile-app/releases/tag/release-5.2.0_RC13) -Ongoing release- [release-5.2.0](https://github.com/Sunbird-Ed/SunbirdEd-mobile-app/tree/release-5.2.0) +Ongoing release- [release-6.0.0](https://github.com/Sunbird-Ed/SunbirdEd-mobile-app/tree/release-6.0.0_v13) **Prerequisites:** |Package| Version | Recommended Version | From 8b3804d66c5f810983b6ded211945133153f9900 Mon Sep 17 00:00:00 2001 From: Vinod-V3 Date: Fri, 2 Jun 2023 21:54:34 +0530 Subject: [PATCH 22/29] ISSUE #ED-99 fix : QA issue fix --- .../domain-ecm-lsiting.component.ts | 5 ++- .../observation-detail.component.ts | 6 ++- .../observation-submission.component.ts | 5 ++- .../questionnaire/questionnaire.page.ts | 38 +++++++++++-------- src/assets/i18n/en.json | 2 +- 5 files changed, 34 insertions(+), 22 deletions(-) diff --git a/src/app/manage-learn/domain-ecm-listing/domain-ecm-lsiting/domain-ecm-lsiting.component.ts b/src/app/manage-learn/domain-ecm-listing/domain-ecm-lsiting/domain-ecm-lsiting.component.ts index d0b323aaa..fb5a4b6f9 100644 --- a/src/app/manage-learn/domain-ecm-listing/domain-ecm-lsiting/domain-ecm-lsiting.component.ts +++ b/src/app/manage-learn/domain-ecm-listing/domain-ecm-lsiting/domain-ecm-lsiting.component.ts @@ -19,7 +19,7 @@ import { GenericPopUpService } from '../../shared'; }) export class DomainEcmLsitingComponent { entityName: any; - entityData: any; + entityData: any={}; entityEvidences: any; generalQuestions: any; recentlyUpdatedEntity: any; @@ -62,6 +62,7 @@ export class DomainEcmLsitingComponent { this.submissionId = params.submisssionId; this.entityName = params.schoolName; this.allowMultipleAssessemts = params.allowMultipleAssessemts; + this.entityData.programJoined = params.programJoined == 'true' }); this.extrasState = this.router.getCurrentNavigation().extras.state; } @@ -96,7 +97,7 @@ export class DomainEcmLsitingComponent { } getAssessmentDetails(successData){ - this.entityData = successData; + this.entityData = {...this.entityData, ...successData}; if(this.submissionId){ this.entityEvidences = this.updateTracker.getLastModifiedInEvidences( this.entityData['assessment']['evidences'], diff --git a/src/app/manage-learn/observation/observation-detail/observation-detail.component.ts b/src/app/manage-learn/observation/observation-detail/observation-detail.component.ts index 7966d78ed..0695ed10a 100644 --- a/src/app/manage-learn/observation/observation-detail/observation-detail.component.ts +++ b/src/app/manage-learn/observation/observation-detail/observation-detail.component.ts @@ -186,7 +186,8 @@ export class ObservationDetailComponent implements OnInit { solutionId: this.solutionId, observationId: this.observationId, entityId: entity._id, - entityName: entity.name + entityName: entity.name, + programJoined: this.solutionData.programJoined } } ); @@ -344,7 +345,8 @@ export class ObservationDetailComponent implements OnInit { this.router.navigate([RouterLinks.DOMAIN_ECM_LISTING], { queryParams: { submisssionId: submissionId, - schoolName: entityName + schoolName: entityName, + programJoined: this.solutionData.programJoined } }); } diff --git a/src/app/manage-learn/observation/observation-submission/observation-submission.component.ts b/src/app/manage-learn/observation/observation-submission/observation-submission.component.ts index 5489581ab..dfb729817 100644 --- a/src/app/manage-learn/observation/observation-submission/observation-submission.component.ts +++ b/src/app/manage-learn/observation/observation-submission/observation-submission.component.ts @@ -56,6 +56,7 @@ export class ObservationSubmissionComponent implements OnInit { generatedKey; downloadedSubmissionList: any = []; msgs:any + programJoined: boolean = false constructor( private headerService: AppHeaderService, private observationService: ObservationService, @@ -82,6 +83,7 @@ export class ObservationSubmissionComponent implements OnInit { this.entityId = params.entityId; this.entityName = params.entityName; this.disableObserveAgain = params.disableObserveAgain == "true"; + this.programJoined = params.programJoined == 'true' let data = { observationId: this.observationId, entityId: this.entityId @@ -301,7 +303,8 @@ export class ObservationSubmissionComponent implements OnInit { queryParams: { submisssionId: submissionId, schoolName: heading, - allowMultipleAssessemts:true + allowMultipleAssessemts:true, + programJoined: this.programJoined } }); diff --git a/src/app/manage-learn/questionnaire/questionnaire.page.ts b/src/app/manage-learn/questionnaire/questionnaire.page.ts index 53ee4b982..f4ec43754 100644 --- a/src/app/manage-learn/questionnaire/questionnaire.page.ts +++ b/src/app/manage-learn/questionnaire/questionnaire.page.ts @@ -51,6 +51,7 @@ export class QuestionnairePage implements OnInit, OnDestroy { isTargeted :boolean; isSurvey : boolean = false; payload: {} + isNewProgram: boolean = false constructor( // public navCtrl: NavController, // public navParams: NavParams, @@ -145,7 +146,8 @@ export class QuestionnairePage implements OnInit, OnDestroy { }; this.payload = {consumerId: data.rootOrganisations||'', objectId: data.programId||data.program._id} this.isCurrentEvidenceSubmitted = currentEvidences[this.selectedEvidenceIndex].isSubmitted; - if(data.hasOwnProperty('requestForPIIConsent') && data.programJoined && data?.requestForPIIConsent){ + this.isNewProgram = data.hasOwnProperty('requestForPIIConsent') || data.program.hasOwnProperty('requestForPIIConsent') + if(this.isNewProgram && data.programJoined && data?.requestForPIIConsent){ let profileData = await this.utils.getProfileInfo(); await this.popupService.getConsent('Program',this.payload,this.schoolData,profileData,'FRMELEMNTS_MSG_PROGRAM_JOINED_SUCCESS').then((response)=>{ if(response){ @@ -153,7 +155,7 @@ export class QuestionnairePage implements OnInit, OnDestroy { }) } - if ((!this.isSurvey && this.isCurrentEvidenceSubmitted || this.isViewOnly)|| (!this.schoolData.programJoined) ) { + if ((!this.isSurvey && this.isCurrentEvidenceSubmitted || this.isViewOnly)|| (!this.schoolData.programJoined && this.isNewProgram) ) { document.getElementById('stop').style.pointerEvents = 'none'; } } @@ -167,20 +169,24 @@ export class QuestionnairePage implements OnInit, OnDestroy { } allowStart(){ - if(this.schoolData?.programJoined){ - this.popupService.showStartIMPForProjectPopUp('FRMELEMNTS_LBL_START_OBSERVATION_POPUP', 'FRMELEMNTS_LBL_START_OBSERVATION_POPUP_MSG1', - 'FRMELEMNTS_LBL_START_OBSERVATION_POPUP_MSG2','FRMELEMNTS_LBL_START_OBSERVATION_POPUP').then((data:any)=>{ - if(data){ - this.schoolData['assessment']['evidences'][this.selectedEvidenceIndex].startTime = Date.now(); - this.isViewOnly = false; - document.getElementById('stop').style.pointerEvents = 'auto'; - } - }) - }else{ + if(!this.schoolData?.programJoined && this.isNewProgram){ this.joinProgram() + return } + this.popupService.showStartIMPForProjectPopUp('FRMELEMNTS_LBL_START_OBSERVATION_POPUP', 'FRMELEMNTS_LBL_START_OBSERVATION_POPUP_MSG1', + 'FRMELEMNTS_LBL_START_OBSERVATION_POPUP_MSG2','FRMELEMNTS_LBL_START_OBSERVATION_POPUP').then((data:any)=>{ + if(data){ + this.schoolData['assessment']['evidences'][this.selectedEvidenceIndex].startTime = Date.now(); + this.isViewOnly = false; + document.getElementById('stop').style.pointerEvents = 'auto'; + } + }) } async startAction(){ + if(!this.schoolData?.programJoined && this.isNewProgram){ + this.joinProgram() + return + } await this.router.navigate([`/${RouterLinks.HOME}`]); this.router.navigate([`/${RouterLinks.OBSERVATION}/${RouterLinks.OBSERVATION_DETAILS}`], {queryParams: {solutionId: this.extrasState.solution._id, programId: this.extrasState.programId, @@ -194,7 +200,7 @@ export class QuestionnairePage implements OnInit, OnDestroy { this.headerConfig.showHeader = true; this.headerConfig.showBurgerMenu = false; this.headerService.updatePageConfig(this.headerConfig); - if(this.isSurvey && !this.schoolData.programJoined){ + if(this.isSurvey && !this.schoolData.programJoined && this.isNewProgram){ this.joinProgram() return } @@ -215,7 +221,7 @@ export class QuestionnairePage implements OnInit, OnDestroy { // images_CO_5bebcfcf92ec921dcf114828 next(status?: string) { - if(this.isSurvey && !this.schoolData.programJoined){ + if(this.isSurvey && !this.schoolData.programJoined && this.isNewProgram){ this.joinProgram() return } @@ -582,9 +588,9 @@ export class QuestionnairePage implements OnInit, OnDestroy { } showPopup(){ - if(!this.schoolData?.programJoined){ + if(!this.schoolData?.programJoined && this.isNewProgram){ this.joinProgram() - }else if(this.schoolData.programJoined && !this.isSurvey && this.isViewOnly){ + }else if(this.schoolData.programJoined && !this.isSurvey && this.isViewOnly && this.isNewProgram){ this.allowStart() } } diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index 66b40da54..f92e84169 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -1395,7 +1395,7 @@ "FRMELEMNTS_MSG_DATA_SETTINGS_UPDATE_SUCCESS":"Your data setting has been updated successfully", "EXPLORE_PROGRAMS":"Explore Programs", "FRMELEMNTS_LBL_SEARCH_PROGRAMS_PLACEHOLDER":"Search your programs here", - "FRMELEMNTS_LBL_JOIN_PROGRAM_MSG_FOR_OBSERVATION":"You must join {{name}} program to view and access this {{type}}.", + "FRMELEMNTS_LBL_JOIN_PROGRAM_MSG_FOR_OBSERVATION":"Please join {{name}} program to view and access this {{type}}.", "FRMELEMNTS_MSG_PROGRAM_JOINED_SUCCESS":"You have joined this program successfully", "FRMELEMNTS_LBL_START_OBSERVATION_POPUP":"Start observation", "FRMELEMNTS_LBL_START_OBSERVATION_POPUP_MSG1":"You must click on the Start observation button to access and edit the observation.", From eb72ce4583c58ff2f15f289af40ecc6a1cd4990f Mon Sep 17 00:00:00 2001 From: Vinod-V3 Date: Fri, 2 Jun 2023 21:55:00 +0530 Subject: [PATCH 23/29] ISSUE #ED-431 fix : QA issue fix --- .../programs/program-details/program-details.component.ts | 4 ++-- src/app/manage-learn/shared/generic.popup.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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 d46f9532a..ff2765d39 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 @@ -157,7 +157,7 @@ export class ProgramDetailsComponent implements OnInit { this.programDetails.programJoined = true this.showConsentPopup() if(!this.programDetails.requestForPIIConsent){ - this.commonUtils.showToast('FRMELEMNTS_MSG_PROGRAM_JOINED_SUCCESS'); + this.commonUtils.showToast('FRMELEMNTS_MSG_PROGRAM_JOINED_SUCCESS','','',9000); } } }) @@ -199,7 +199,7 @@ export class ProgramDetailsComponent implements OnInit { if(this.sharingStatus!==event){ this.showConsentPopup() }else{ - this.commonUtils.showToast('FRMELEMNTS_MSG_DATA_SETTINGS_UPDATE_SUCCESS'); + this.commonUtils.showToast('FRMELEMNTS_MSG_DATA_SETTINGS_UPDATE_SUCCESS','','',9000); } } diff --git a/src/app/manage-learn/shared/generic.popup.ts b/src/app/manage-learn/shared/generic.popup.ts index 02f626bcd..f71e6db90 100644 --- a/src/app/manage-learn/shared/generic.popup.ts +++ b/src/app/manage-learn/shared/generic.popup.ts @@ -144,7 +144,7 @@ async showConsent(type, payload, details, profileData, message?){ if(message){ this.commonUtils.showToast(message,'','',9000,'top'); }else{ - this.commonUtils.showToast('FRMELEMNTS_MSG_DATA_SETTINGS_UPDATE_SUCCESS'); + this.commonUtils.showToast('FRMELEMNTS_MSG_DATA_SETTINGS_UPDATE_SUCCESS','','',9000) } details.consentShared = true await this.join(details,profileData) From 7f0259e72989fd6a433fc78dc4dd0fdac4bede5e Mon Sep 17 00:00:00 2001 From: Vinod-V3 Date: Fri, 2 Jun 2023 21:56:33 +0530 Subject: [PATCH 24/29] ISSUE #ED-98 fix : QA issue fix --- .../project-templateview.page.ts | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/app/manage-learn/project/project-templateview/project-templateview.page.ts b/src/app/manage-learn/project/project-templateview/project-templateview.page.ts index bb4c7c939..3389e0095 100644 --- a/src/app/manage-learn/project/project-templateview/project-templateview.page.ts +++ b/src/app/manage-learn/project/project-templateview/project-templateview.page.ts @@ -6,7 +6,7 @@ import { TranslateService } from '@ngx-translate/core'; import { statuses } from '../../core/constants/statuses.constant'; import { UtilsService } from '../../../../app/manage-learn/core/services/utils.service'; import { AppHeaderService } from '../../../../services/app-header.service'; -import { ProjectService, ToastService } from '../../core'; +import { ProjectService, ToastService, LoaderService } from '../../core'; import { RouterLinks } from '../../../../app/app.constant'; import { actions } from '../../core/constants/actions.constants'; import { GenericPopUpService } from '../../shared'; @@ -91,7 +91,8 @@ export class ProjectTemplateviewPage implements OnInit { private toast :ToastService, private platform : Platform, private location :Location, - private commonUtils: CommonUtilService + private commonUtils: CommonUtilService, + private loader: LoaderService ) { params.params.subscribe((parameters) => { this.id = parameters.id; @@ -168,18 +169,11 @@ export class ProjectTemplateviewPage implements OnInit { this.location.back(); } async getProjectApi() { + this.loader.startLoader(); this.actionItems = await actions.PROJECT_ACTIONS; let resp = await this.projectService.getTemplateBySoluntionId(this.id); this.project = resp.result; - if( this.project.hasOwnProperty('requestForPIIConsent') && this.project.programJoined && this.project?.requestForPIIConsent){ - let payloadData = {consumerId: this.project.rootOrganisations, objectId: this.project.programInformation.programId} - let profileData = await this.utils.getProfileInfo(); - await this.popupService.getConsent('Program',payloadData,this.project,profileData,'FRMELEMNTS_MSG_PROGRAM_JOINED_SUCCESS').then((data)=>{ - if(data){ - this.project.programJoined = true - } - }) - } + this.loader.stopLoader(); if(this.project.criteria){ let criteria = Object.keys(this.project?.criteria?.conditions); criteria.forEach(element => { @@ -193,14 +187,25 @@ export class ProjectTemplateviewPage implements OnInit { title: this.project?.title, subTitle: this.project?.programInformation ? this.project?.programInformation?.programName : '' } + if( this.project.hasOwnProperty('requestForPIIConsent') && this.project.programJoined && this.project?.requestForPIIConsent){ + let payloadData = {consumerId: this.project.rootOrganisations, objectId: this.project.programInformation.programId} + let profileData = await this.utils.getProfileInfo(); + await this.popupService.getConsent('Program',payloadData,this.project,profileData,'FRMELEMNTS_MSG_PROGRAM_JOINED_SUCCESS').then((data)=>{ + if(data){ + this.project.programJoined = true + } + }) + } // if (this.project.tasks && this.project.tasks.length) // this.projectProgress = this.utils.getCompletedTaskCount(this.project.tasks); } async getTemplateByExternalId() { + this.loader.startLoader(); let resp = await this.projectService.getTemplateByExternalId(this.id); this.programId = resp?.result?.programInformation?.programId || null; this.project = resp?.result; + this.loader.stopLoader(); if(this.project.certificate){ let criteria = Object.keys(this.project?.criteria?.conditions); criteria.forEach(element => { From 7c91b902b6fd08f301e02ea4e858c574c75107c9 Mon Sep 17 00:00:00 2001 From: Vinod-V3 Date: Mon, 5 Jun 2023 20:06:48 +0530 Subject: [PATCH 25/29] ISSUE #ED-99 fix : QA issue fix --- .../domain-ecm-lsiting.component.ts | 3 ++- .../observation-submission.component.ts | 6 ++++-- .../questionnaire/questionnaire.page.ts | 16 ++++++++++++---- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/app/manage-learn/domain-ecm-listing/domain-ecm-lsiting/domain-ecm-lsiting.component.ts b/src/app/manage-learn/domain-ecm-listing/domain-ecm-lsiting/domain-ecm-lsiting.component.ts index fb5a4b6f9..511bcac6c 100644 --- a/src/app/manage-learn/domain-ecm-listing/domain-ecm-lsiting/domain-ecm-lsiting.component.ts +++ b/src/app/manage-learn/domain-ecm-listing/domain-ecm-lsiting/domain-ecm-lsiting.component.ts @@ -234,13 +234,14 @@ export class DomainEcmLsitingComponent { this.evidenceSections[selectedSection].progressStatus = this.currentEvidence.startTime ? 'inProgress' : ''; this.localStorage.setLocalStorage(this.utils.getAssessmentLocalStorageKey(this.submissionId), this.entityData); } - + this.router.navigate([RouterLinks.QUESTIONNAIRE], { queryParams: { submisssionId: this.submissionId, evidenceIndex: this.selectedEvidenceIndex, sectionIndex: selectedSection, schoolName: this.entityName, + programJoined: this.entityData?.programJoined }, state: this.extrasState //State is using for Template view for Deeplink. }); } diff --git a/src/app/manage-learn/observation/observation-submission/observation-submission.component.ts b/src/app/manage-learn/observation/observation-submission/observation-submission.component.ts index dfb729817..b72839744 100644 --- a/src/app/manage-learn/observation/observation-submission/observation-submission.component.ts +++ b/src/app/manage-learn/observation/observation-submission/observation-submission.component.ts @@ -320,7 +320,8 @@ export class ObservationSubmissionComponent implements OnInit { submisssionId: submissionId, evidenceIndex: 0, sectionIndex: 0, - schoolName: this.entityName + schoolName: this.entityName, + programJoined: this.programJoined } }); } else { @@ -343,7 +344,8 @@ export class ObservationSubmissionComponent implements OnInit { submisssionId: assessment._id, evidenceIndex: 0, sectionIndex: 0, - schoolName: this.entityName + schoolName: this.entityName, + programJoined: this.programJoined } }); } diff --git a/src/app/manage-learn/questionnaire/questionnaire.page.ts b/src/app/manage-learn/questionnaire/questionnaire.page.ts index f4ec43754..65f1c5a6d 100644 --- a/src/app/manage-learn/questionnaire/questionnaire.page.ts +++ b/src/app/manage-learn/questionnaire/questionnaire.page.ts @@ -34,7 +34,7 @@ export class QuestionnairePage implements OnInit, OnDestroy { selectedSectionIndex: any = 0; start: number = 0; end: number = 1; - schoolData: any; + schoolData: any = {}; isLast: boolean; isFirst: boolean; selectedEvidenceId: string; @@ -82,6 +82,7 @@ export class QuestionnairePage implements OnInit, OnDestroy { this.selectedSectionIndex = params.sectionIndex ? parseInt(params.sectionIndex): 0; this.schoolName = params.schoolName; this.isSurvey = params.isSurvey == 'true'; + this.schoolData.programJoined = params?.programJoined == 'true' }); // State is using for Template view for Deeplink. this.extrasState = this.router.getCurrentNavigation().extras.state; @@ -120,7 +121,7 @@ export class QuestionnairePage implements OnInit, OnDestroy { } async getQuestions(data){ - this.schoolData = data; + this.schoolData = {...this.schoolData, ...data}; const currentEvidences = this.schoolData['assessment']['evidences']; this.enableQuestionReadOut = this.schoolData['solution']['enableQuestionReadOut']; this.captureGpsLocationAtQuestionLevel = this.schoolData['solution']['captureGpsLocationAtQuestionLevel']; @@ -147,6 +148,9 @@ export class QuestionnairePage implements OnInit, OnDestroy { this.payload = {consumerId: data.rootOrganisations||'', objectId: data.programId||data.program._id} this.isCurrentEvidenceSubmitted = currentEvidences[this.selectedEvidenceIndex].isSubmitted; this.isNewProgram = data.hasOwnProperty('requestForPIIConsent') || data.program.hasOwnProperty('requestForPIIConsent') + if(!data.programJoined && this.isNewProgram && this.isSurvey){ + this.joinProgram() + } if(this.isNewProgram && data.programJoined && data?.requestForPIIConsent){ let profileData = await this.utils.getProfileInfo(); await this.popupService.getConsent('Program',this.payload,this.schoolData,profileData,'FRMELEMNTS_MSG_PROGRAM_JOINED_SUCCESS').then((response)=>{ @@ -553,6 +557,10 @@ export class QuestionnairePage implements OnInit, OnDestroy { async (data:any)=>{ if(data){ this.join() + }else{ + if(this.isSurvey){ + this.location.back() + } } } ) @@ -565,7 +573,7 @@ export class QuestionnairePage implements OnInit, OnDestroy { this.schoolData.programJoined = true this.showConsentPopup() if(!this.schoolData.requestForPIIConsent){ - this.commonUtilService.showToast('FRMELEMNTS_MSG_PROGRAM_JOINED_SUCCESS'); + this.commonUtilService.showToast('FRMELEMNTS_MSG_PROGRAM_JOINED_SUCCESS','','',9000,'top'); if(this.isSurvey){ document.getElementById('stop').style.pointerEvents = 'auto'; } @@ -594,5 +602,5 @@ export class QuestionnairePage implements OnInit, OnDestroy { this.allowStart() } } - + } \ No newline at end of file From f0dfe0ce47d3259108a5ff245e502f87ad564de6 Mon Sep 17 00:00:00 2001 From: Vinod-V3 Date: Mon, 5 Jun 2023 20:07:51 +0530 Subject: [PATCH 26/29] ISSUE #ED-431 fix : QA issue fix --- .../programs/program-details/program-details.component.scss | 6 ++++++ 1 file changed, 6 insertions(+) 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 index 712c6d7fd..83c5cd2df 100644 --- a/src/app/manage-learn/programs/program-details/program-details.component.scss +++ b/src/app/manage-learn/programs/program-details/program-details.component.scss @@ -45,6 +45,12 @@ color: $blue; text-decoration-line: underline; font-weight: 600; + display: inline-block; + text-transform: lowercase; +} + +.read-more::first-letter{ + text-transform: capitalize; } .section-filter{ From 05af02068d4a1194843f411131238cd9de273534 Mon Sep 17 00:00:00 2001 From: Vishwanath Date: Fri, 9 Jun 2023 09:09:50 +0530 Subject: [PATCH 27/29] Issue #ED-430 fix : QA issue fix --- .../program-details.component.html | 8 +++-- .../program-details.component.scss | 8 ++++- .../program-details.component.ts | 29 ++++++++++++++++--- .../program-listing.component.html | 6 ++-- 4 files changed, 40 insertions(+), 11 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 71eea7d20..eb732206e 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 @@ -27,14 +27,15 @@
- + +
{{data?.sectionName}}
- +
-
+
@@ -43,6 +44,7 @@
+
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 index 83c5cd2df..b2613fa0b 100644 --- a/src/app/manage-learn/programs/program-details/program-details.component.scss +++ b/src/app/manage-learn/programs/program-details/program-details.component.scss @@ -61,8 +61,9 @@ .section-card{ border-radius: 25px !important; padding: 5px; - margin: 10px 0px; + margin: 10px 5px; background-color: var(--app-secondary-background); + box-shadow: var(--button-style-shadow)!important; .icon{ background-color: $white; box-shadow: var(--button-style-shadow); @@ -89,4 +90,9 @@ font-size: 16px; margin-bottom: 10px; } +} +.custom-card-style{ + background-color: transparent; + box-shadow: none !important; + margin: 0px; } \ 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 ff2765d39..59e1db677 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 @@ -128,15 +128,29 @@ export class ProgramDetailsComponent implements OnInit { } }); this.filteredList=this.solutionsList.sort((a,b)=>{return a.order - b.order}) + if(this.selectedSection){ + this.filteredList.forEach(element => { + if(this.selectedSection == element.sectionName){ + element.show =true; + }else{ + element.show =false; + } + }); + } } onFilterChange(event){ this.selectedFilterIndex = event.data.index this.filteredList=this.solutionsList this.selectedSection = '' + this.solutionsList.filter((data)=>{ + data.show = false; + }) if(event.data.index!==0){ this.filteredList = this.solutionsList.filter((data)=>{ - return data.sectionName == event.data.text.toLowerCase() + return ( + data.show = true, + data.sectionName == event.data.text.toLowerCase()) }) this.selectedSection = event.data.text.toLowerCase() } @@ -206,13 +220,20 @@ export class ProgramDetailsComponent implements OnInit { ionViewWillLeave(){ this.solutionsList = [] this.filteredList = [] - this.selectedSection = '' + // this.selectedSection = '' this.popupService.closeConsent() } selectSection(data){ - if(data.sectionName == this.selectedSection){ - this.selectedSection = '' + this.filteredList.forEach(element => { + if(data.sectionName == element.sectionName){ + data.show = ! data.show; + }else{ + element.show =false; + } + }); + if(data.sectionName != this.selectedSection){ + this.selectedSection = ''; }else{ this.selectedSection = data.sectionName } diff --git a/src/app/manage-learn/programs/program-listing/program-listing.component.html b/src/app/manage-learn/programs/program-listing/program-listing.component.html index 6974fa7e6..0423e4811 100644 --- a/src/app/manage-learn/programs/program-listing/program-listing.component.html +++ b/src/app/manage-learn/programs/program-listing/program-listing.component.html @@ -11,8 +11,8 @@ (cardSelect)="selectedProgram($event)" *ngFor="let data of programs"> - + {{ 'FRMELEMNTS_BTN_LOAD_MORE' | translate }} - - \ No newline at end of file + \ No newline at end of file From 7c097696b85bab2351f96075fd0bac0be2b5debc Mon Sep 17 00:00:00 2001 From: Vishwanath Date: Mon, 12 Jun 2023 18:26:01 +0530 Subject: [PATCH 28/29] Issue #ED-98,#ED-522 fix : QA issue fixes. --- src/app/manage-learn/core/services/utils.service.ts | 1 + .../programs/program-details/program-details.component.ts | 2 +- .../project-templateview/project-templateview.page.ts | 8 +++++++- .../add-link-modal/add-link-modal.component.html | 2 +- .../components/add-link-modal/add-link-modal.component.ts | 3 +++ 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/app/manage-learn/core/services/utils.service.ts b/src/app/manage-learn/core/services/utils.service.ts index e31c2d06b..60fdf3b02 100644 --- a/src/app/manage-learn/core/services/utils.service.ts +++ b/src/app/manage-learn/core/services/utils.service.ts @@ -634,6 +634,7 @@ export class UtilsService { for (const org of profileData["organisations"]) { if (org.isSchool) { obj["school"] = org.externalId; + break; } } const roles = []; 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 59e1db677..03ca478ee 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 @@ -84,7 +84,7 @@ export class ProgramDetailsComponent implements OnInit { this.payload = {consumerId: success.result.rootOrganisations, objectId: success.result.programId} this.formatList() this.readMoreOrLess() - if(this.isNewProgram && this.programDetails.programJoined && this.programDetails?.requestForPIIConsent){ + if(this.isNewProgram && this.programDetails.programJoined && this.programDetails?.requestForPIIConsent && !this.programDetails?.consentShared){ let profileData = await this.utils.getProfileInfo(); await this.popupService.getConsent('Program',this.payload,this.programDetails,profileData).then((response)=>{ if(response){ diff --git a/src/app/manage-learn/project/project-templateview/project-templateview.page.ts b/src/app/manage-learn/project/project-templateview/project-templateview.page.ts index 3389e0095..a7c1d108e 100644 --- a/src/app/manage-learn/project/project-templateview/project-templateview.page.ts +++ b/src/app/manage-learn/project/project-templateview/project-templateview.page.ts @@ -141,6 +141,9 @@ export class ProjectTemplateviewPage implements OnInit { const extraPramas = `?link=${this.id}` this.projectService.getTemplateByExternalId(null,extraPramas ).then(data =>{ this.project = data?.result; + if (this.project?.projectId) { + this.buttonLabel = 'FRMELEMNTS_LBL_CONTINUE_IMPROVEMENT' + } this.metaData = { title: this.project?.title, subTitle: this.project?.programInformation ? this.project?.programInformation?.programName : '' @@ -183,11 +186,14 @@ export class ProjectTemplateviewPage implements OnInit { this.certificateCriteria.push(config); }) } + if (this.project?.projectId) { + this.buttonLabel = 'FRMELEMNTS_LBL_CONTINUE_IMPROVEMENT' + } this.metaData = { title: this.project?.title, subTitle: this.project?.programInformation ? this.project?.programInformation?.programName : '' } - if( this.project.hasOwnProperty('requestForPIIConsent') && this.project.programJoined && this.project?.requestForPIIConsent){ + if( this.project.hasOwnProperty('requestForPIIConsent') && this.project.programJoined && this.project?.requestForPIIConsent && !this.project.consentShared){ let payloadData = {consumerId: this.project.rootOrganisations, objectId: this.project.programInformation.programId} let profileData = await this.utils.getProfileInfo(); await this.popupService.getConsent('Program',payloadData,this.project,profileData,'FRMELEMNTS_MSG_PROGRAM_JOINED_SUCCESS').then((data)=>{ diff --git a/src/app/manage-learn/shared/components/add-link-modal/add-link-modal.component.html b/src/app/manage-learn/shared/components/add-link-modal/add-link-modal.component.html index 0bff8995d..3360110c9 100644 --- a/src/app/manage-learn/shared/components/add-link-modal/add-link-modal.component.html +++ b/src/app/manage-learn/shared/components/add-link-modal/add-link-modal.component.html @@ -17,7 +17,7 @@
{{'CANCEL' | translate}} - + {{'FRMELEMNTS_BTN_ADD_LINK' | translate}}
diff --git a/src/app/manage-learn/shared/components/add-link-modal/add-link-modal.component.ts b/src/app/manage-learn/shared/components/add-link-modal/add-link-modal.component.ts index a73c0afc3..92623c284 100644 --- a/src/app/manage-learn/shared/components/add-link-modal/add-link-modal.component.ts +++ b/src/app/manage-learn/shared/components/add-link-modal/add-link-modal.component.ts @@ -8,6 +8,7 @@ import { ToastService} from '../../../core'; export class AddLinkModalComponent implements OnInit { links:string=''; isSubmit : boolean = false; + invalidLink = false; @Output() eventEmit = new EventEmitter(); constructor(private toastService:ToastService) { } @@ -39,8 +40,10 @@ export class AddLinkModalComponent implements OnInit { validateLink(link){ let invalidCharacters = /^[^!@~#$%^*(){}><,\n; ]+$/ if(invalidCharacters.test(link)){ + this.invalidLink = false; return false }else{ + this.invalidLink = true; this.toastService.showMessage('FRMELEMNTS_MSG_INVALID_ADDED_LINK','danger') return true } From b37f1c68dd97beb17365804a976c33c87d98a945 Mon Sep 17 00:00:00 2001 From: Vinod-V3 Date: Mon, 12 Jun 2023 21:52:57 +0530 Subject: [PATCH 29/29] ISSUE #ED-540 feat : Pii consent flow changes done for Survey --- .../questionnaire/questionnaire.page.ts | 60 ++++++++++++-- src/app/manage-learn/shared/generic.popup.ts | 2 +- .../survey-home/survey-home.component.ts | 82 +++++++++++++++++-- 3 files changed, 131 insertions(+), 13 deletions(-) diff --git a/src/app/manage-learn/questionnaire/questionnaire.page.ts b/src/app/manage-learn/questionnaire/questionnaire.page.ts index 65f1c5a6d..9838811f7 100644 --- a/src/app/manage-learn/questionnaire/questionnaire.page.ts +++ b/src/app/manage-learn/questionnaire/questionnaire.page.ts @@ -11,6 +11,8 @@ import { Network } from '@awesome-cordova-plugins/network/ngx'; import { AppHeaderService } from '../../../services/app-header.service'; import { CommonUtilService } from '../../../services/common-util.service'; import { GenericPopUpService } from '../shared'; +import { SurveyProviderService } from '../core/services/survey-provider.service'; +import { UpdateLocalSchoolDataService } from '../core/services/update-local-school-data.service'; @Component({ selector: 'app-questionnaire', @@ -52,6 +54,7 @@ export class QuestionnairePage implements OnInit, OnDestroy { isSurvey : boolean = false; payload: {} isNewProgram: boolean = false + surveyId constructor( // public navCtrl: NavController, // public navParams: NavParams, @@ -74,7 +77,9 @@ export class QuestionnairePage implements OnInit, OnDestroy { private translate: TranslateService, private router: Router, private commonUtilService:CommonUtilService, - private popupService: GenericPopUpService + private popupService: GenericPopUpService, + private surveyProvider: SurveyProviderService, + private ulsdp: UpdateLocalSchoolDataService ) { this.routerParam.queryParams.subscribe((params) => { this.submissionId = params.submisssionId; @@ -83,13 +88,15 @@ export class QuestionnairePage implements OnInit, OnDestroy { this.schoolName = params.schoolName; this.isSurvey = params.isSurvey == 'true'; this.schoolData.programJoined = params?.programJoined == 'true' + this.surveyId = params.surveyId }); // State is using for Template view for Deeplink. this.extrasState = this.router.getCurrentNavigation().extras.state; if(this.extrasState){ this.isTargeted = this.extrasState.isATargetedSolution; + this.isSurvey = this.extrasState?.isSurvey || false } - if(this.extrasState && !this.isTargeted){ + if(this.extrasState && !this.isTargeted && !this.isSurvey){ this.showMessageForNONTargetUsers(); } this._appHeaderSubscription = this.headerService.headerEventEmitted$.subscribe((eventName) => { @@ -151,10 +158,13 @@ export class QuestionnairePage implements OnInit, OnDestroy { if(!data.programJoined && this.isNewProgram && this.isSurvey){ this.joinProgram() } - if(this.isNewProgram && data.programJoined && data?.requestForPIIConsent){ + if(this.isNewProgram && data.programJoined && data?.requestForPIIConsent && !data?.consentShared){ let profileData = await this.utils.getProfileInfo(); await this.popupService.getConsent('Program',this.payload,this.schoolData,profileData,'FRMELEMNTS_MSG_PROGRAM_JOINED_SUCCESS').then((response)=>{ if(response){ + if(this.isSurvey){ + this.getSurveyDetails() + } } }) } @@ -574,9 +584,10 @@ export class QuestionnairePage implements OnInit, OnDestroy { this.showConsentPopup() if(!this.schoolData.requestForPIIConsent){ this.commonUtilService.showToast('FRMELEMNTS_MSG_PROGRAM_JOINED_SUCCESS','','',9000,'top'); - if(this.isSurvey){ - document.getElementById('stop').style.pointerEvents = 'auto'; - } + } + if(this.isSurvey){ + document.getElementById('stop').style.pointerEvents = 'auto'; + } } }) @@ -589,6 +600,7 @@ export class QuestionnairePage implements OnInit, OnDestroy { if(data){ if(this.isSurvey){ document.getElementById('stop').style.pointerEvents = 'auto'; + this.getSurveyDetails() } } }) @@ -602,5 +614,39 @@ export class QuestionnairePage implements OnInit, OnDestroy { this.allowStart() } } - + + async getSurveyDetails(){ + this.surveyProvider + .getDetailsById(this.surveyId, this.schoolData.solution._id) + .then(async(res) => { + if (res.result == false) { + this.surveyProvider.showMsg('surveyExpired'); + this.location.back() + return; + } + this.ulsdp.mapSubmissionDataToQuestion(res.result,false,true); + await this.surveyProvider + .storeSurvey(res.result.assessment.submissionId, res.result) + .then((survey) => { + this.extrasState = null + this.submissionId = survey.assessment.submissionId + this.redirect(survey.assessment.submissionId) + }); + }); + } + + + redirect(submissionId){ + this.router.navigate([RouterLinks.QUESTIONNAIRE], { + replaceUrl: true, + queryParams: { + submisssionId: submissionId, + evidenceIndex: 0, + sectionIndex: 0, + isSurvey:true, + }, + }); + this.ngOnInit() + } + } \ No newline at end of file diff --git a/src/app/manage-learn/shared/generic.popup.ts b/src/app/manage-learn/shared/generic.popup.ts index f71e6db90..2258487bc 100644 --- a/src/app/manage-learn/shared/generic.popup.ts +++ b/src/app/manage-learn/shared/generic.popup.ts @@ -172,7 +172,7 @@ async closeConsent(){ data=response.consents[0] }).catch(async (error)=>{ if (!error.response.body.result.consent && error.response.responseCode === 404) { - await this.showConsent(type, payload, details, profileData,message); + data = await this.showConsent(type, payload, details, profileData,message); } else if (error.code === 'NETWORK_ERROR') { this.commonUtils.showToast('ERROR_NO_INTERNET_MESSAGE'); } diff --git a/src/app/manage-learn/survey/survey-home/survey-home.component.ts b/src/app/manage-learn/survey/survey-home/survey-home.component.ts index a7660f8d1..b1835c937 100644 --- a/src/app/manage-learn/survey/survey-home/survey-home.component.ts +++ b/src/app/manage-learn/survey/survey-home/survey-home.component.ts @@ -9,6 +9,7 @@ import { SurveyProviderService } from '../../core/services/survey-provider.servi import { KendraApiService } from '../../core/services/kendra-api.service'; import { Router } from '@angular/router'; import { UpdateLocalSchoolDataService } from '../../core/services/update-local-school-data.service'; +import { AssessmentApiService } from '../../core/services/assessment-api.service'; @Component({ selector: 'app-survey-home', templateUrl: './survey-home.component.html', @@ -28,6 +29,7 @@ export class SurveyHomeComponent { submissionArr: any; count: any; isReport: boolean = false; + surveyId constructor( private headerService: AppHeaderService, private router: Router, @@ -38,6 +40,7 @@ export class SurveyHomeComponent { private kendra: KendraApiService, private toast: ToastService, private ulsdp: UpdateLocalSchoolDataService, + private assessmentService: AssessmentApiService ) { const extrasState = this.router.getCurrentNavigation().extras.state; if (extrasState) { @@ -52,7 +55,7 @@ export class SurveyHomeComponent { ionViewWillEnter() { this.page=1 this.surveyList = []; - this.link ? this.deepLinkRedirect() : this.getSurveyListing(); + this.link ? this.verifyLink(this.link) : this.getSurveyListing(); this.headerConfig = this.headerService.getDefaultPageConfig(); this.headerConfig.actionButtons = []; @@ -107,7 +110,6 @@ export class SurveyHomeComponent { applySubmission(): void { this.surveyList.map((survey) => { - console.log(this.submissionArr.includes(survey.submissionsId)); this.submissionArr.includes(survey.submissionId) ? (survey.downloaded = true) : null; }); } @@ -134,7 +136,8 @@ export class SurveyHomeComponent { }); } - onSurveyClick(survey) { + async onSurveyClick(survey) { + this.surveyId = survey._id if (!this.isReport) { if (survey.status == 'expired') { @@ -144,6 +147,11 @@ export class SurveyHomeComponent { } // surveyId changed to _id + if(!survey.submissionId){ + this.getSurveyTemplateDetails(survey) + return + } + survey.downloaded ? this.redirect(survey.submissionId) : this.getSurveyById(survey._id, survey.solutionId, survey.isCreator); @@ -153,15 +161,17 @@ export class SurveyHomeComponent { } - redirect(submissionId: any): void { + redirect(submissionId: any,data?): void { this.router.navigate([RouterLinks.QUESTIONNAIRE], { replaceUrl: this.link ? true : false, queryParams: { submisssionId: submissionId, evidenceIndex: 0, sectionIndex: 0, - isSurvey:true + isSurvey:true, + surveyId:this.surveyId }, + state:data?{...data,isSurvey:true}:null }); } @@ -231,4 +241,66 @@ export class SurveyHomeComponent { this.page = this.page + 1; this.getSurveyListing(); } + + async getSurveyTemplateDetails(data) { + let payload = await this.utils.getProfileData(); + const config = { + url: urlConstants.API_URLS.TEMPLATE_DETAILS + data.solutionId, + payload: payload, + }; + this.assessmentService.post(config).subscribe((success) => { + if (success.result) { + if(success.result.hasOwnProperty('requestForPIIConsent') && !success.result.programJoined){ + this.redirect(success.result.assessment.submissionId,success.result); + }else{ + data.downloaded + ? this.redirect(data.submissionId) + : this.getSurveyById(data._id, data.solutionId, data.isCreator); + } + }else{ + this.toast.showMessage('FRMELEMNTS_MSG_TEMPLATE_DETAILS_NOTFOUND','danger'); + } + },error =>{ + this.toast.showMessage('FRMELEMNTS_MSG_TEMPLATE_DETAILS_NOTFOUND','danger'); + }); + } + + async verifyLink(link) { + this.loader.startLoader(); + let payload = await this.utils.getProfileData('SERVER'); + const config = { + url: urlConstants.API_URLS.DEEPLINK.VERIFY_LINK + link+'?createProject=false', + payload: payload, + }; + let resp = await this.kendra.post(config).toPromise(); + if (resp && resp.result) { + this.loader.stopLoader(); + switch (resp.result.type) { + case 'survey': + let details = resp.result + await this.localStorage + .getLocalStorage(storageKeys.submissionIdArray) + .then(async (allId) => { + await allId.includes(details.submissionId) ? (details.downloaded = true) : null; + }); + resp.result.submissionId ? this.checkIsDownloaded(details) : this.getSurveyTemplateDetails(details); + default: + break; + } + }else{ + this.loader.stopLoader(); + if(resp && resp.status){ + this.toast.showMessage('FRMELEMNTS_MSG_INVALID_LINK','danger'); + } + } + } + + async checkIsDownloaded(details){ + if(details.downloaded){ + this.redirect(details.submissionId) + }else{ + this.getSurveyById(details.surveyId, details.solutionId, details.isCreator) + } + } + }