Skip to content

Commit

Permalink
Merge pull request #523 from rahulramakrishnan3/release-3.0.0
Browse files Browse the repository at this point in the history
bug fix 1361, 1393,1508
  • Loading branch information
Cafnanc authored Jul 18, 2024
2 parents 532ce2b + 2fa91ac commit b617ace
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 60 deletions.
2 changes: 1 addition & 1 deletion src/app/core/services/form/form.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export class FormService {

async filterList(obj){
const config = {
url: urlConstants.API_URLS.FILTER_LIST + '&type=' + obj,
url: urlConstants.API_URLS.FILTER_LIST + '&organization=' + obj?.org + '&filter_type=' + obj?.filterType,
payload: {},
};
try {
Expand Down
34 changes: 34 additions & 0 deletions src/app/core/services/util/util.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,5 +230,39 @@ export class UtilService {
});
await alert.present();
}


async transformToFilterData(responseData, obj) {
const result = [];
for (const key in responseData) {
if (key !== 'entity_types') {
const title = key.charAt(0).toUpperCase() + key.slice(1);
const name = 'organization_ids';
const options = responseData[key].map(item => ({
id: item.value,
label: item.name,
value: item.id
}));
const type = "checkbox";
result.push({ title, name, options, type });
}
}
const entityTypes = responseData?.entity_types;

const filterData = Object.keys(entityTypes).map(type => {
const entityType = entityTypes[type][0];
return {
title: entityType.label,
name: entityType.value,
options: entityType.entities.map(entity => ({
label: entity.label,
value: entity.value
})),
type: "checkbox"
};
});
const data = [...filterData, ...result]
return data;
}

}
23 changes: 17 additions & 6 deletions src/app/pages/edit-profile/edit-profile.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { TranslateService } from '@ngx-translate/core';
import { map } from 'rxjs/operators';
import { Router } from '@angular/router';
import { CommonRoutes } from 'src/global.routes';
import { PlatformLocation } from '@angular/common';

@Component({
selector: 'app-edit-profile',
Expand Down Expand Up @@ -60,9 +61,19 @@ export class EditProfilePage implements OnInit, isDeactivatable {
private translate: TranslateService,
private toast: ToastService,
private utilService: UtilService,
private router: Router
private router: Router,
private platformLocation: PlatformLocation
) {
}

ionViewWillEnter() {
if(this.userDetails?.profile_mandatory_fields?.length || !this.userDetails?.about){
history.pushState(null, '', location.href);
this.platformLocation.onPopState(()=>{
history.pushState(null, '', location.href)
})
}
}
async ngOnInit() {
this.userDetails = await this.localStorage.getLocalData(localKeys.USER_DETAILS);
const response = await this.form.getForm(EDIT_PROFILE_FORM);
Expand Down Expand Up @@ -95,22 +106,22 @@ export class EditProfilePage implements OnInit, isDeactivatable {
if (this.form1 && !this.form1.myForm.pristine || !this.profileImageData.isUploaded) {
let texts: any;
this.translate
.get(['FORM_UNSAVED_DATA', 'CANCEL', 'OK', 'EXIT_HEADER_LABEL'])
.get(['PROFILE_FORM_UNSAVED_DATA', 'DONOT_SAVE', 'SAVE', 'PROFILE_EXIT_HEADER_LABEL'])
.subscribe((text) => {
texts = text;
});
const alert = await this.alert.create({
header: texts['EXIT_HEADER_LABEL'],
message: texts['FORM_UNSAVED_DATA'],
header: texts['PROFILE_EXIT_HEADER_LABEL'],
message: texts['PROFILE_FORM_UNSAVED_DATA'],
buttons: [
{
text: texts['CANCEL'],
text: texts['DONOT_SAVE'],
cssClass: 'alert-button-bg-white',
role: 'exit',
handler: () => { },
},
{
text: texts['OK'],
text: texts['SAVE'],
role: 'cancel',
cssClass: 'alert-button-red',
handler: () => { },
Expand Down
33 changes: 7 additions & 26 deletions src/app/pages/home-search/home-search.page.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { Component, EventEmitter, OnInit, Output, ViewChild } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { ModalController } from '@ionic/angular';
import { HttpService, LoaderService, LocalStorageService, ToastService } from 'src/app/core/services';
import { AdminWorkapceService } from 'src/app/core/services/admin-workspace/admin-workapce.service';
import { LocalStorageService, ToastService, UtilService } from 'src/app/core/services';
import { SessionService } from 'src/app/core/services/session/session.service';
import { FilterPopupComponent } from 'src/app/shared/components/filter-popup/filter-popup.component';
import { CommonRoutes } from 'src/global.routes';
import { MatPaginator } from '@angular/material/paginator';
import { paginatorConstants } from 'src/app/core/constants/paginatorConstants';
import { localKeys } from 'src/app/core/constants/localStorage.keys';
import { ProfileService } from 'src/app/core/services/profile/profile.service';
import { Location } from '@angular/common';
Expand Down Expand Up @@ -51,14 +49,15 @@ export class HomeSearchPage implements OnInit {
urlQueryData: string;
pageSize: any;

constructor(private modalCtrl: ModalController, private adminWorkapceService: AdminWorkapceService,private httpService: HttpService, private router: Router, private toast: ToastService,
constructor(private modalCtrl: ModalController, private router: Router, private toast: ToastService,
private sessionService: SessionService,
private localStorage: LocalStorageService,
private profileService: ProfileService,
private location: Location,
private activatedRoute: ActivatedRoute,
private permissionService: PermissionService,
private formService: FormService
private formService: FormService,
private utilService: UtilService
) {
this.activatedRoute.queryParamMap.subscribe(async (params) => {
this.params = params;
Expand All @@ -76,8 +75,9 @@ export class HomeSearchPage implements OnInit {
}

async ionViewWillEnter() {
let data = await this.formService.filterList('session');
this.filterData = this.transformData(data);
const obj = {filterType: 'session', org: false};
let data = await this.formService.filterList(obj);
this.filterData = await this.utilService.transformToFilterData(data, obj);
}

search(event) {
Expand Down Expand Up @@ -186,25 +186,6 @@ export class HomeSearchPage implements OnInit {
this.fetchSessionList()
}

transformData(responseData) {
const entityTypes = responseData.entity_types;

const filterData = Object.keys(entityTypes).map(type => {
const entityType = entityTypes[type][0];
return {
title: entityType.label,
name: entityType.value,
options: entityType.entities.map(entity => ({
label: entity.label,
value: entity.value
})),
type: "checkbox"
};
});

return filterData;
}

selectChip(chip) {
this.criteriaChip = chip;
this.fetchSessionList()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { MatPaginator } from '@angular/material/paginator';
import { ActivatedRoute, Router } from '@angular/router';
import { Router } from '@angular/router';
import { ModalController } from '@ionic/angular';
import { paginatorConstants } from 'src/app/core/constants/paginatorConstants';
import { urlConstants } from 'src/app/core/constants/urlConstants';
import { HttpService, LoaderService } from 'src/app/core/services';
import { UtilService } from 'src/app/core/services';
import { FormService } from 'src/app/core/services/form/form.service';
import { PermissionService } from 'src/app/core/services/permission/permission.service';
import { ProfileService } from 'src/app/core/services/profile/profile.service';
Expand Down Expand Up @@ -49,16 +48,18 @@ export class MentorSearchDirectoryPage implements OnInit {
private profileService: ProfileService,
private modalCtrl: ModalController,
private permissionService: PermissionService,
private formService: FormService
private formService: FormService,
private utilService: UtilService
) { }

async ngOnInit() {
this.getMentors();
this.permissionService.getPlatformConfig().then((config)=>{
this.overlayChips = config?.result?.search_config?.search?.mentor?.fields;
})
let data = await this.formService.filterList('profile')
this.filterData = this.transformData(data)
});
const obj = {filterType: 'mentor', org: true};
let data = await this.formService.filterList(obj);
this.filterData = await this.utilService.transformToFilterData(data, obj);
}

onSearch(){
Expand Down Expand Up @@ -111,25 +112,6 @@ export class MentorSearchDirectoryPage implements OnInit {
modal.present();
}

transformData(responseData) {
const entityTypes = responseData?.entity_types;

const filterData = Object.keys(entityTypes).map(type => {
const entityType = entityTypes[type][0];
return {
title: entityType.label,
name: entityType.value,
options: entityType.entities.map(entity => ({
label: entity.label,
value: entity.value
})),
type: "checkbox"
};
});

return filterData;
}

extractLabels(data) {
this.chips = [];
for (const key in data) {
Expand Down
5 changes: 4 additions & 1 deletion src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -276,5 +276,8 @@
"MENTOR_SEARCH_RESULT": "Mentors search result for",
"SETUP_PROFILE": "Setup profile",
"SETUP_PROFILE_MESSAGE": "Finish setting up your profile to get started",
"NO_SESSION_MESSAGE_DESCRIPTION": "Looks like we couldn’t find what you were looking for, try searching for something else."
"NO_SESSION_MESSAGE_DESCRIPTION": "Looks like we couldn’t find what you were looking for, try searching for something else.",
"PROFILE_FORM_UNSAVED_DATA": "You have unsaved data, would you like to save it before exiting?",
"PROFILE_EXIT_HEADER_LABEL": "Save Data?",
"DONOT_SAVE": "Don't Save"
}

0 comments on commit b617ace

Please sign in to comment.