diff --git a/src/app/app.component.html b/src/app/app.component.html index 6f04aafca..8132056c0 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -1,6 +1,6 @@ - + diff --git a/src/app/app.component.ts b/src/app/app.component.ts index dfa8e9b6c..b6d0043dc 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -65,13 +65,13 @@ export class AppComponent { { text: texts['CANCEL'], role: 'cancel', - cssClass: "alert-button", + cssClass: "alert-button-bg-white", handler: () => { } }, { text: texts['CONFIRM'], role: 'confirm', - cssClass: "alert-button-bg-white", + cssClass: "alert-button", handler: () => { navigator['app'].exitApp(); } diff --git a/src/app/core/constants/formConstant.ts b/src/app/core/constants/formConstant.ts index efef3e6ec..998c271b2 100644 --- a/src/app/core/constants/formConstant.ts +++ b/src/app/core/constants/formConstant.ts @@ -43,8 +43,8 @@ export const PLATFORMS: IFORM = { } export const HELP: IFORM = { - "type": "help", - "subType": "helpForm", - "action": "helpFields", + "type": "helpApp", + "subType": "helpAppForm", + "action": "helpAppFields", "templateName":"defaultTemplate" } \ No newline at end of file diff --git a/src/app/core/services/attachment/attachment.service.ts b/src/app/core/services/attachment/attachment.service.ts index b91a414f8..8284b3919 100644 --- a/src/app/core/services/attachment/attachment.service.ts +++ b/src/app/core/services/attachment/attachment.service.ts @@ -66,7 +66,15 @@ export class AttachmentService { let data ={ type:'removeCurrentPhoto' } + this.translate + .get([ + "REMOVE_CURRENT_PHOTO" + ]) + .subscribe((data) => { + this.texts = data; + }); this.actionSheetController.dismiss(data); + this.presentToast(this.texts["REMOVE_CURRENT_PHOTO"], "success"); } async selectImage(type) { this.translate diff --git a/src/app/core/services/auth/auth.service.ts b/src/app/core/services/auth/auth.service.ts index d64e7e4e0..00b8b2409 100644 --- a/src/app/core/services/auth/auth.service.ts +++ b/src/app/core/services/auth/auth.service.ts @@ -17,6 +17,7 @@ import { TranslateService } from '@ngx-translate/core'; }) export class AuthService { baseUrl: any; + user: any; constructor( private localStorage: LocalStorageService, private httpService: HttpService, @@ -67,7 +68,8 @@ export class AuthService { if (!result.access_token) { throw Error(); }; this.userService.token = result; await this.localStorage.setLocalData(localKeys.TOKEN, result); - const userData = await this.profileService.getProfileDetailsAPI(); + this.user = data.result.user; + const userData = await this.profileService.getProfileDetailsFromAPI(this.user.isAMentor,this.user._id); if (!userData) { this.localStorage.delete(localKeys.TOKEN); throw Error(); @@ -82,7 +84,6 @@ export class AuthService { } async logoutAccount(skipApiCall?: boolean) { - await this.loaderService.startLoader(); const config = { url: urlConstants.API_URLS.LOGOUT_ACCOUNT, payload: { @@ -97,13 +98,11 @@ export class AuthService { this.localStorage.delete(localKeys.TOKEN); this.userService.token = null; this.userService.userEvent.next(null); - await this.loaderService.stopLoader(); this.router.navigate([`/${CommonRoutes.AUTH}/${CommonRoutes.LOGIN}`], { replaceUrl: true }); } catch (error) { - await this.loaderService.stopLoader(); } } diff --git a/src/app/core/services/http/http.service.ts b/src/app/core/services/http/http.service.ts index b59ff8101..f9634b2f4 100644 --- a/src/app/core/services/http/http.service.ts +++ b/src/app/core/services/http/http.service.ts @@ -166,7 +166,12 @@ export class HttpService { break case 401: let auth = this.injector.get(AuthService); - auth.logoutAccount(true); + this.localStorage.getLocalData(localKeys.USER_DETAILS).then(async (data)=>{ + if(data._id){ + await auth.logoutAccount(true); + this.toastService.showToast(msg ? msg.message : 'SOMETHING_WENT_WRONG', 'danger') + } + }) break default: this.toastService.showToast(msg ? msg.message : 'SOMETHING_WENT_WRONG', 'danger') diff --git a/src/app/core/services/profile/profile.service.ts b/src/app/core/services/profile/profile.service.ts index 40234c3a5..2ad031553 100644 --- a/src/app/core/services/profile/profile.service.ts +++ b/src/app/core/services/profile/profile.service.ts @@ -39,8 +39,9 @@ export class ProfileService { let userDetails = await this.localStorage.getLocalData(localKeys.USER_DETAILS); userDetails.user = null; let profileData = await this.getProfileDetailsAPI(); - await this.localStorage.setLocalData(localKeys.USER_DETAILS, profileData); - this.userService.userEvent.next(profileData); + let profileDatas = await {...userDetails, ...profileData}; + await this.localStorage.setLocalData(localKeys.USER_DETAILS, profileDatas); + this.userService.userEvent.next(profileDatas); this.loaderService.stopLoader(); this._location.back(); (showToast)?this.toast.showToast(data.message, "success"):null; diff --git a/src/app/core/services/util/util.service.ts b/src/app/core/services/util/util.service.ts index a8b999379..00acf66ab 100644 --- a/src/app/core/services/util/util.service.ts +++ b/src/app/core/services/util/util.service.ts @@ -51,20 +51,21 @@ export class UtilService { header: texts[msg.header], message: texts[msg.message], buttons: [ + { + text: texts[msg.submit], + cssClass: 'alert-button-bg-white', + handler: () => { + resolve(true); + } + }, { text: texts[msg.cancel], role: 'cancel', - cssClass: 'alert-button-bg-white', + cssClass: 'alert-button-red', handler: (blah) => { resolve(false); } - }, { - text: texts[msg.submit], - cssClass: 'alert-button-red', - handler: () => { - resolve(true); - } - } + }, ] }); await alert.present(); @@ -76,7 +77,7 @@ export class UtilService { this.translate .get([ "ADD_PHOTO", - "REMOVE_CURRENT_PHOTO", + "REMOVE_CURRENT_PHOTO_LABEL", "CHOOSE_FROM_LIBRARY", "TAKE_PHOTO", "CANCEL", @@ -92,7 +93,7 @@ export class UtilService { case 'profile': buttons = [ { - text: texts["REMOVE_CURRENT_PHOTO"], + text: texts["REMOVE_CURRENT_PHOTO_LABEL"], type: 'remove', action: 'remove' }, @@ -106,7 +107,7 @@ export class UtilService { case 'session': buttons = [ { - text: texts["REMOVE_CURRENT_PHOTO"], + text: texts["REMOVE_CURRENT_PHOTO_LABEL"], type: 'remove', action: 'remove' }, diff --git a/src/app/pages/auth/login/login.page.ts b/src/app/pages/auth/login/login.page.ts index 61a0c36db..964f0f835 100644 --- a/src/app/pages/auth/login/login.page.ts +++ b/src/app/pages/auth/login/login.page.ts @@ -2,7 +2,6 @@ import { Component, OnInit, ViewChild } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { MenuController } from '@ionic/angular'; import { TranslateService } from '@ngx-translate/core'; -import { localKeys } from 'src/app/core/constants/localStorage.keys'; import { AuthService, LocalStorageService } from 'src/app/core/services'; import { DynamicFormComponent, JsonFormData } from 'src/app/shared/components/dynamic-form/dynamic-form.component'; import { CommonRoutes } from 'src/global.routes'; diff --git a/src/app/pages/create-session/create-session.page.html b/src/app/pages/create-session/create-session.page.html index 5e1096a98..af2eb4269 100644 --- a/src/app/pages/create-session/create-session.page.html +++ b/src/app/pages/create-session/create-session.page.html @@ -1,53 +1,56 @@ - - - - 1 - {{ firstStepperTitle | translate}} - - - 2 - {{"MEETING_LINK" | translate}} - - - - - - - - - - - - - - - {{"SELECT_MEETING_PLATFORM" | translate}} - - - - - - {{ option.name }} - - - - - {{selectedHint}} - - - - - - - - + + + + + 1 + {{ firstStepperTitle | translate}} + + + 2 + {{"MEETING_LINK" | translate}} + + + + + + + + + + + + + + + {{"SELECT_MEETING_PLATFORM" | translate}} + + + + + + {{ option.name }} + + + + + {{selectedHint}} + + + + + + + + + - + - {{'PUBLISH_AND_ADD_LINK' | translate}} + {{'PUBLISH_AND_ADD_LINK' | translate}} + {{'SAVE' | translate}} {{'SET_IT_LATER' | translate}} diff --git a/src/app/pages/create-session/create-session.page.scss b/src/app/pages/create-session/create-session.page.scss index 8eed97edd..2ab53f39f 100644 --- a/src/app/pages/create-session/create-session.page.scss +++ b/src/app/pages/create-session/create-session.page.scss @@ -25,6 +25,7 @@ ion-label{ } .btns{ width: 100%; + background: var(--white) !important; } .icon-2{ background: var(--ion-color-primary); @@ -35,4 +36,8 @@ ion-label{ display: flex; align-items: center; justify-content: center; +} +.form-content{ + max-height: 100% !important; + overflow-y: scroll !important; } \ No newline at end of file diff --git a/src/app/pages/create-session/create-session.page.ts b/src/app/pages/create-session/create-session.page.ts index 2ccd1be05..3873dec37 100644 --- a/src/app/pages/create-session/create-session.page.ts +++ b/src/app/pages/create-session/create-session.page.ts @@ -83,13 +83,7 @@ export class CreateSessionPage implements OnInit { this.type = params?.get('type')? params?.get('type'): 'default'; this.firstStepperTitle = (this.id) ? "EDIT_SESSION_LABEL":"CREATE_NEW_SESSION"; if (this.id) { - let response = await this.sessionService.getSessionDetailsAPI(this.id); - this.sessionDetails= response; - this.profileImageData.image = response.image; - this.profileImageData.isUploaded = true; - response.startDate = moment.unix(response.startDate).format("YYYY-MM-DDTHH:mm"); - response.endDate = moment.unix(response.endDate).format("YYYY-MM-DDTHH:mm"); - this.preFillData(response); + this.getSessionDetailsUpdate() } else { this.showForm = true; } @@ -99,6 +93,15 @@ export class CreateSessionPage implements OnInit { this.profileImageData.isUploaded = true; this.changeDetRef.detectChanges(); } + async getSessionDetailsUpdate(){ + let response = await this.sessionService.getSessionDetailsAPI(this.id); + this.sessionDetails= response; + this.profileImageData.image = response.image; + this.profileImageData.isUploaded = true; + response.startDate = moment.unix(response.startDate).format("YYYY-MM-DDTHH:mm"); + response.endDate = moment.unix(response.endDate).format("YYYY-MM-DDTHH:mm"); + this.preFillData(response); + } async getPlatformFormDetails() { let form = await this.form.getForm(PLATFORMS); @@ -111,21 +114,22 @@ export class CreateSessionPage implements OnInit { if(this.type=='default'){ if (!this.form1?.myForm.pristine || this.profileImageData.haveValidationError) { let texts: any; - this.translate.get(['SESSION_FORM_UNSAVED_DATA', 'EXIT', 'BACK']).subscribe(text => { + this.translate.get(['SESSION_FORM_UNSAVED_DATA', 'EXIT', 'CANCEL', 'EXIT_HEADER_LABEL']).subscribe(text => { texts = text; }) const alert = await this.alert.create({ + header: texts['EXIT_HEADER_LABEL'], message: texts['SESSION_FORM_UNSAVED_DATA'], buttons: [ { text: texts['EXIT'], - cssClass: "alert-button", + cssClass: "alert-button-bg-white", role: 'exit', handler: () => { } }, { - text: texts['BACK'], - cssClass: "alert-button-bg-white", + text: texts['CANCEL'], + cssClass: "alert-button-red", role: 'cancel', handler: () => { } } @@ -160,7 +164,6 @@ export class CreateSessionPage implements OnInit { form.timeZone = timezone; this.form1.myForm.markAsPristine(); let result = await this.sessionService.createSession(form, this.id); - this.id = this.id ? this.id : result._id; if (result) { this.sessionDetails = _.isEmpty(result) ? this.sessionDetails : result; this.isSubmited = true; @@ -168,7 +171,11 @@ export class CreateSessionPage implements OnInit { this.headerConfig.label = this.id ? "EDIT_SESSION":"CREATE_NEW_SESSION"; result.startDate = moment.unix(result.startDate).format("YYYY-MM-DDTHH:mm"); result.endDate = moment.unix(result.endDate).format("YYYY-MM-DDTHH:mm"); - this.router.navigate([CommonRoutes.CREATE_SESSION], { queryParams: { id: this.id , type: 'segment'}, replaceUrl: true }); + if(!this.id && result._id){ + this.router.navigate([CommonRoutes.CREATE_SESSION], { queryParams: { id: result._id , type: 'segment'}, replaceUrl: true }); + }else { + this.type = 'segment'; + } } else { this.profileImageData.image = this.lastUploadedImage; this.profileImageData.isUploaded = false; @@ -207,7 +214,7 @@ export class CreateSessionPage implements OnInit { } preFillData(existingData) { - for(let j=0;j password?.name == 'password') if(existingData.meetingInfo.link){ obj.value = existingData?.meetingInfo?.link; - meetingId = existingData?.meetingInfo?.meta?.meetingId; - password = existingData?.meetingInfo?.meta?.password; + } + if(existingData?.meetingInfo?.meta?.meetingId){ + meetingId.value = existingData?.meetingInfo?.meta?.meetingId; + password.value = existingData?.meetingInfo?.meta?.password; } } } @@ -247,8 +256,11 @@ export class CreateSessionPage implements OnInit { this.profileImageData.isUploaded = true; this.profileImageData.haveValidationError = false; } - segmentChanged(event){ + async segmentChanged(event){ this.type = event.target.value; + if(this.id){ + this.getSessionDetailsUpdate(); + } } isValid(event){ this.isSubmited = event; diff --git a/src/app/pages/edit-profile/edit-profile.page.ts b/src/app/pages/edit-profile/edit-profile.page.ts index eb3efe845..c4571a2e3 100644 --- a/src/app/pages/edit-profile/edit-profile.page.ts +++ b/src/app/pages/edit-profile/edit-profile.page.ts @@ -64,11 +64,10 @@ export class EditProfilePage implements OnInit, isDeactivatable { } async ngOnInit() { const response = await this.form.getForm(EDIT_PROFILE_FORM); - var result = await this.profileService.getProfileDetailsAPI(); - this.profileImageData.image = result.image; this.profileImageData.isUploaded = true; this.formData = _.get(response, 'result.data.fields'); this.userDetails = await this.localStorage.getLocalData(localKeys.USER_DETAILS); + this.profileImageData.image = this.userDetails.image; this.preFillData(this.userDetails); } @@ -76,23 +75,24 @@ export class EditProfilePage implements OnInit, isDeactivatable { if (!this.form1.myForm.pristine || !this.profileImageData.isUploaded) { let texts: any; this.translate - .get(['FORM_UNSAVED_DATA', 'CANCEL', 'OK']) + .get(['FORM_UNSAVED_DATA', 'CANCEL', 'OK', 'EXIT_HEADER_LABEL']) .subscribe((text) => { texts = text; }); const alert = await this.alert.create({ + header: texts['EXIT_HEADER_LABEL'], message: texts['FORM_UNSAVED_DATA'], buttons: [ { text: texts['CANCEL'], - cssClass: 'alert-button', + cssClass: 'alert-button-bg-white', role: 'exit', handler: () => {}, }, { text: texts['OK'], role: 'cancel', - cssClass: 'alert-button-bg-white', + cssClass: 'alert-button-red', handler: () => {}, }, ], diff --git a/src/app/pages/feedback/feedback.page.html b/src/app/pages/feedback/feedback.page.html index 08ffc312c..ef175ad3d 100644 --- a/src/app/pages/feedback/feedback.page.html +++ b/src/app/pages/feedback/feedback.page.html @@ -8,10 +8,10 @@ - {{"MENTOR_FEEDBACK_HEADER" | translate}} + {{"THANK_FOR_HOSTING" | translate}} '{{sessionTitle}}'! {{"HELP_US_IMPROVE" | translate}} - {{"MENTEE_FEEDBACK_HEADER" | translate}} + {{"THANK_FOR_ATTENDING" | translate}} '{{sessionTitle}}' {{"BY" | translate}} '{{mentorName}}'! {{"HELP_US_IMPROVE" | translate}} diff --git a/src/app/pages/feedback/feedback.page.ts b/src/app/pages/feedback/feedback.page.ts index 914aaf593..ef1c058fd 100644 --- a/src/app/pages/feedback/feedback.page.ts +++ b/src/app/pages/feedback/feedback.page.ts @@ -24,6 +24,8 @@ export class FeedbackPage implements OnInit { }; sessionData: any; isMentor: boolean; + mentorName: any; + sessionTitle: any; constructor(private sessionService: SessionService, private toast: ToastService, private router: Router, @@ -39,6 +41,8 @@ export class FeedbackPage implements OnInit { async isMentorChecking() { let userDetails = await this.localStorage.getLocalData(localKeys.USER_DETAILS); var response = await this.sessionService.getSessionDetailsAPI(this.sessionData._id); + this.mentorName = response.mentorName; + this.sessionTitle = response.title; this.isMentor = userDetails?._id == response?.userId ? true : false; this.formData.controls = this.sessionData.form; this.feedbackData.feedbackAs = this.isMentor ? "mentor" : "mentee"; diff --git a/src/app/pages/help/help.page.scss b/src/app/pages/help/help.page.scss index 6dd93be88..f1114c429 100644 --- a/src/app/pages/help/help.page.scss +++ b/src/app/pages/help/help.page.scss @@ -15,4 +15,10 @@ } .input{ margin-top: 10px; + } + ion-select::part(text) { + color: var(--black); + } + .select { + padding: unset; } \ No newline at end of file diff --git a/src/app/pages/help/help.page.ts b/src/app/pages/help/help.page.ts index d15221aad..35c6129b9 100644 --- a/src/app/pages/help/help.page.ts +++ b/src/app/pages/help/help.page.ts @@ -74,20 +74,22 @@ export class HelpPage implements OnInit { } async deteteAccount(){ let texts: any; - this.translate.get(['DELETE_ALERT_MSG', 'YES', 'NO']).subscribe(text => { + this.translate.get(['DELETE_ALERT_MSG', 'YES', 'NO', 'DELETE_ACCOUNT']).subscribe(text => { texts = text; }) const alert = await this.alert.create({ + header: texts['DELETE_ACCOUNT'], message: texts['DELETE_ALERT_MSG'], buttons: [ { text: texts['YES'], - cssClass: "alert-button", + cssClass: "alert-button-bg-white", + role: 'yes', handler: () => { } }, { text: texts['NO'], - cssClass: "alert-button-bg-white", + cssClass: "alert-button", role: 'no', handler: () => { } } @@ -95,7 +97,7 @@ export class HelpPage implements OnInit { }); await alert.present(); let data = await alert.onDidDismiss(); - if(data.role == 'no'){ + if(data.role == 'yes'){ this.submitHelpReport(); } } @@ -108,7 +110,7 @@ export class HelpPage implements OnInit { } clickOptions(event:any){ this.selectedOption.form = event.detail.value.form; - this.message = (this.userDetails.isAMentor) ? this.selectedOption?.menterMessage : this.selectedOption?.menteeMessage; - this.form1.createForm(this.selectedOption.form.controls); + this.message = (this.userDetails?.isAMentor) ? this.selectedOption?.menterMessage : this.selectedOption?.menteeMessage; + this.form1?.createForm(this.selectedOption.form.controls); } } \ No newline at end of file diff --git a/src/app/pages/home-search/home-search.page.html b/src/app/pages/home-search/home-search.page.html index 710f9d718..a595ae582 100644 --- a/src/app/pages/home-search/home-search.page.html +++ b/src/app/pages/home-search/home-search.page.html @@ -1,7 +1,7 @@ - + diff --git a/src/app/pages/home-search/home-search.page.ts b/src/app/pages/home-search/home-search.page.ts index f33b4bf08..5cbb405e3 100644 --- a/src/app/pages/home-search/home-search.page.ts +++ b/src/app/pages/home-search/home-search.page.ts @@ -53,8 +53,11 @@ export class HomeSearchPage implements OnInit { this.searching = false; } - checkInput(){ - this.searchText=this.searchText.replace(/^ +/gm, '') + checkInput(event: any){ + this.searchText=this.searchText.replace(/^ +/gm, ''); + if(event.keyCode == 13){ + this.search(); + } } search(){ diff --git a/src/app/pages/session-detail/session-detail.page.html b/src/app/pages/session-detail/session-detail.page.html index fdceb8812..e69fae671 100644 --- a/src/app/pages/session-detail/session-detail.page.html +++ b/src/app/pages/session-detail/session-detail.page.html @@ -22,7 +22,7 @@ {{detailData?.data?.title}} - {{"START_SESSIONS" | translate}} @@ -33,8 +33,8 @@ {{detailData?.data?.title}} {{"UN_ENROLL" | translate}} - - {{"JOIN" | translate}} + + {{"JOIN" | translate}} \ No newline at end of file diff --git a/src/app/pages/session-detail/session-detail.page.scss b/src/app/pages/session-detail/session-detail.page.scss index 26f542ba8..0db0c3191 100644 --- a/src/app/pages/session-detail/session-detail.page.scss +++ b/src/app/pages/session-detail/session-detail.page.scss @@ -48,4 +48,7 @@ ion-item { --padding-end: 0px; --inner-padding-end: 0px; --padding-start: 0px; - } \ No newline at end of file + } +.join-button{ + background: var(--white); +} \ No newline at end of file diff --git a/src/app/pages/session-detail/session-detail.page.ts b/src/app/pages/session-detail/session-detail.page.ts index d0800fef7..b9fa985d5 100644 --- a/src/app/pages/session-detail/session-detail.page.ts +++ b/src/app/pages/session-detail/session-detail.page.ts @@ -25,6 +25,9 @@ export class SessionDetailPage implements OnInit { endDate: any; sessionDatas: any; snackbarRef: any; + skipWhenDelete: boolean= false; + dismissWhenBack: boolean = false; + platformOff: any; constructor(private localStorage: LocalStorageService, private router: Router, private activatedRoute: ActivatedRoute, private sessionService: SessionService, @@ -32,11 +35,11 @@ export class SessionDetailPage implements OnInit { this.id = this.activatedRoute.snapshot.paramMap.get('id') } ngOnInit() { - App.addListener('appStateChange', (state: AppState) => { - if (state.isActive == true) { - this.fetchSessionDetails(); - } - }); + App.addListener('appStateChange', (state: AppState) => { + if (state.isActive == true && this.id && this.sessionDatas && !this.dismissWhenBack) { + this.fetchSessionDetails(); + } + }); } async ionViewWillEnter() { @@ -131,7 +134,7 @@ export class SessionDetailPage implements OnInit { let readableStartDate = moment.unix(response.startDate).toLocaleString(); let currentTimeInSeconds=Math.floor(Date.now()/1000); if(response.isEnrolled){ - this.isEnabled = ((response.startDate - currentTimeInSeconds) < 300 || response.status=='live') ? true : false + this.isEnabled = ((response.startDate - currentTimeInSeconds) < 600 || response.status=='live') ? true : false } else { this.isEnabled = ((response.startDate-currentTimeInSeconds)<600 || response.status=='live')?true:false; } @@ -140,21 +143,23 @@ export class SessionDetailPage implements OnInit { this.detailData.data.meetingInfo = response.meetingInfo.platform; this.startDate = (response.startDate>0)?moment.unix(response.startDate).toLocaleString():this.startDate; this.endDate = (response.endDate>0)?moment.unix(response.endDate).toLocaleString():this.endDate; + this.platformOff = (response?.meetingInfo?.platform == 'OFF') ? true : false; } - if((response.meetingInfo.platform == 'OFF') && this.isCreator && response.status=='published'){ - this.showToasts('ADD_MEETING_LINK', 0 , [ - { - text: 'Add meeting link', - role: 'cancel', - handler: () => { - this.router.navigate([CommonRoutes.CREATE_SESSION], { queryParams: { id: this.id , type: 'segment'} }); + if((response?.meetingInfo?.platform == 'OFF') && this.isCreator && response.status=='published'){ + this.showToasts('ADD_MEETING_LINK', 0 , [ + { + text: 'Add meeting link', + role: 'cancel', + handler: () => { + this.router.navigate([CommonRoutes.CREATE_SESSION], { queryParams: { id: this.id , type: 'segment'} }); + } } - } - ]) - } + ]) + } + this.dismissWhenBack = true; } ionViewWillLeave(){ - this.snackbarRef = this.toaster.dismiss(); + if(!this.skipWhenDelete){this.snackbarRef = this.toaster.dismiss()} } setPageHeader(response) { @@ -216,8 +221,11 @@ export class SessionDetailPage implements OnInit { if (data) { let result = await this.sessionService.deleteSession(this.id); if (result.responseCode == "OK") { + this.skipWhenDelete= true; + this.id = null; this.toast.showToast(result.message, "success"); - this._location.back(); + this.router.navigate([`/${CommonRoutes.TABS}/${CommonRoutes.HOME}`], { replaceUrl: true }); + this.snackbarRef = this.toaster.dismiss(); } } }).catch(error => { }) @@ -254,8 +262,8 @@ export class SessionDetailPage implements OnInit { let msg = { header: 'CANCEL_SESSION', message: 'CANCEL_CONFIRM_MESSAGE', - cancel: 'CLOSE', - submit: 'CANCEL' + cancel: 'CANCEL', + submit: 'UN_ENROLL' } this.utilService.alertPopup(msg).then(async data => { if (data) { diff --git a/src/app/pages/tabs/home/home.page.ts b/src/app/pages/tabs/home/home.page.ts index b5109968a..c6001e679 100644 --- a/src/app/pages/tabs/home/home.page.ts +++ b/src/app/pages/tabs/home/home.page.ts @@ -57,13 +57,15 @@ export class HomePage implements OnInit { ngOnInit() { App.addListener('appStateChange', (state: AppState) => { - if (state.isActive == true) { - this.getSessions(); - var obj = { page: this.page, limit: this.limit, searchText: "" }; - this.sessionService.getAllSessionsAPI(obj).then((data)=>{ - this.createdSessions = data; - }) - } + this.localStorage.getLocalData(localKeys.USER_DETAILS).then(data => { + if (state.isActive == true && data) { + this.getSessions(); + var obj = { page: this.page, limit: this.limit, searchText: "" }; + this.sessionService.getAllSessionsAPI(obj).then((data)=>{ + this.createdSessions = data; + }) + } + }) }); this.getUser(); this.userService.userEventEmitted$.subscribe(data => { @@ -71,6 +73,7 @@ export class HomePage implements OnInit { this.user = data; } }) + this.user = this.localStorage.getLocalData(localKeys.USER_DETAILS) } gotToTop() { this.content.scrollToTop(1000); @@ -83,6 +86,7 @@ export class HomePage implements OnInit { this.createdSessions = await this.sessionService.getAllSessionsAPI(obj); } async eventAction(event) { + if(this.user.about){ switch (event.type) { case 'cardSelect': (this.selectedSegment=="my-sessions")?this.router.navigate([`/${CommonRoutes.SESSIONS_DETAILS}/${event.data.sessionId}`]):this.router.navigate([`/${CommonRoutes.SESSIONS_DETAILS}/${event.data._id}`]); @@ -108,6 +112,9 @@ export class HomePage implements OnInit { }) break; } + }else { + this.router.navigate([`/${CommonRoutes.EDIT_PROFILE}`]); + } } viewMore(data) { this.router.navigate([`/${CommonRoutes.SESSIONS}`], { queryParams: { type: data } }); diff --git a/src/app/pages/tabs/mentor-directory/mentor-directory.page.html b/src/app/pages/tabs/mentor-directory/mentor-directory.page.html index 33df616d3..5c3b0dfcf 100644 --- a/src/app/pages/tabs/mentor-directory/mentor-directory.page.html +++ b/src/app/pages/tabs/mentor-directory/mentor-directory.page.html @@ -17,6 +17,10 @@ + + + +