Skip to content

Commit

Permalink
Merge pull request #537 from ELEVATE-Project/release-3.0.0
Browse files Browse the repository at this point in the history
Release 3.0.0
  • Loading branch information
kiranharidas187 authored Jul 30, 2024
2 parents bd921b2 + 640fe2e commit 61eeffb
Show file tree
Hide file tree
Showing 29 changed files with 346 additions and 171 deletions.
1 change: 1 addition & 0 deletions src/app/core/constants/urlConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export const urlConstants = {
ENROLLED_MENTEES_LIST:"/mentoring/v1/sessions/enrolledMentees/",
GET_PLATFORM_CONFIG: "/mentoring/v1/platform/config",
CHANGE_PASSWORD: "/user/v1/account/changePassword",
UPDATE_LANGUAGE: "/user/v1/user/setLanguagePreference",
LOGIN_ACTIVITY: "/user/v1/account/sessions",
ENTITY_LIST: "/mentoring/v1/entity/list?"
}
Expand Down
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 @@ -92,7 +92,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
15 changes: 15 additions & 0 deletions src/app/core/services/profile/profile.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,4 +233,19 @@ export class ProfileService {
}
}

async updateLanguage(formData, showToast=true){
const config = {
url: urlConstants.API_URLS.UPDATE_LANGUAGE,
payload: formData,
};
try {
let data: any = await this.httpService.patch(config);
(showToast)?this.toast.showToast(data.message, "success"):null;
return data;
}
catch (error) {
this.loaderService.stopLoader();
}
}

}
48 changes: 46 additions & 2 deletions src/app/core/services/util/util.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import { TranslateService } from '@ngx-translate/core';
import { ISocialSharing } from '../../interface/soical-sharing-interface';
import { ModelComponent } from 'src/app/shared/components/model/model.component';
import * as Bowser from "bowser"
import { Subject } from 'rxjs';
import { BehaviorSubject, Subject } from 'rxjs';
import * as Papa from 'papaparse';
import { localKeys } from '../../constants/localStorage.keys';
import { LocalStorageService } from '../localstorage.service';

@Injectable({
Expand All @@ -16,6 +15,10 @@ import { LocalStorageService } from '../localstorage.service';
export class UtilService {
modal: any;
public canIonMenuShow = new Subject<boolean>();
private searchTextSource = new BehaviorSubject<string>('');
private criteriaChipSource = new BehaviorSubject<string>('');
currentSearchText = this.searchTextSource.asObservable();
currentCriteriaChip = this.criteriaChipSource.asObservable();

ionMenuShow(data:boolean) {
this.canIonMenuShow.next(data);
Expand Down Expand Up @@ -229,5 +232,46 @@ 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;
}

subscribeSearchText(searchText: string) {
this.searchTextSource.next(searchText);
}
subscribeCriteriaChip(criteriaChip: string) {
this.criteriaChipSource.next(criteriaChip);
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<app-page-header [config]="headerConfig">
<div class="d-flex flex-justify-center my-8">
<div class="d-flex flex-justify-center my-8" *ngIf="segmentType === 'manage-session'">
<ion-searchbar class="top-padding search-bar" debounce="1000" placeholder="{{'SSESSIONS_MENTOR_SEARCH_PLACEHOLDER' | translate}}"
[(ngModel)]="searchText" (ionChange)="onSearch()"></ion-searchbar>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export class ManageSessionComponent implements OnInit {

modal.onDidDismiss().then(async (dataReturned) => {
this.filteredDatas = []
if (dataReturned !== null) {
if (dataReturned.data && dataReturned.data.data) {
if (dataReturned.data.data.selectedFilters) {
for (let key in dataReturned.data.data.selectedFilters) {
this.filteredDatas[key] = dataReturned.data.data.selectedFilters[key].slice(0, dataReturned.data.data.selectedFilters[key].length).map(obj => obj.value).join(',').toString()
Expand Down Expand Up @@ -207,7 +207,7 @@ export class ManageSessionComponent implements OnInit {
});
}
this.tableData = data;
this.noDataMessage = this.searchText ? "SEARCH_RESULT_NOT_FOUND" : "THIS_SPACE_LOOKS_EMPTY"
this.noDataMessage = this.searchText ? "SEARCH_RESULT_NOT_FOUND" : "SEARCH_RESULT_NOT_FOUND"
}

createSession(){
Expand Down
27 changes: 19 additions & 8 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 All @@ -128,7 +139,7 @@ export class EditProfilePage implements OnInit, isDeactivatable {
}
}

onSubmit() {
async onSubmit() {
this.form1.onSubmit();
if (this.form1.myForm.valid) {
if (this.profileImageData.image && !this.profileImageData.isUploaded) {
Expand All @@ -140,7 +151,7 @@ export class EditProfilePage implements OnInit, isDeactivatable {
form[entityKey] = control.multiple ? _.map(form[entityKey], 'value') : form[entityKey]
});
this.form1.myForm.markAsPristine();
const updated = this.profileService.profileUpdate(form);
const updated = await this.profileService.profileUpdate(form);
if(updated){ this.router.navigate([`${CommonRoutes.TABS}/${CommonRoutes.HOME}`], { replaceUrl: true })}
}
} else {
Expand Down
14 changes: 8 additions & 6 deletions src/app/pages/home-search/home-search.page.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<app-page-header [config]="headerConfig">
<div class="d-flex flex-justify-center my-8">
<ion-searchbar class="search-bar" [debounce]="1000" placeholder="{{'HOME_SEARCH_PLACEHOLDER' | translate}}" #event [(ngModel)]="searchText" (keyup.enter)="search(event.value)"
<ion-searchbar class="search-bar" [debounce]="1000" placeholder="{{'HOME_SEARCH_PLACEHOLDER' | translate}}"
#event [value]="searchText"
(keyup.enter)="search(event.value)"
cdkOverlayOrigin #trigger="cdkOverlayOrigin" (click)="isOpen = !isOpen">
</ion-searchbar>
</div>
</app-page-header>
<ion-toolbar class="padding-top-10">
<ion-toolbar>
<ng-template
cdkConnectedOverlay
[cdkConnectedOverlayOrigin]="trigger"
Expand All @@ -22,7 +24,7 @@
*ngFor="let chip of overlayChips; let i = index"
(click)="selectChip(chip)"
[ngClass]="{'selected-chip': criteriaChip?.label === chip.label}">
<ion-icon name="close-circle" color="white"></ion-icon>
<ion-icon name="close-circle" style="pointer-events: none;" color="white"></ion-icon>
<ion-label class="chip-label">{{ chip.label }}</ion-label>
</ion-chip>
</ion-row>
Expand All @@ -31,16 +33,16 @@
</ng-template>
<ion-grid>
<ion-row>
<ion-col *ngIf="criteriaChip" size="auto">
<ion-col *ngIf="showSelectedCriteria" size="auto">
<div style="width: auto">
<ion-chip class="chip">
<ion-icon name="close-circle" color="white" (click)="closeCriteriaChip()"></ion-icon>
<ion-label class="chip-label">{{criteriaChip?.label}}</ion-label>
<ion-label class="chip-label">{{showSelectedCriteria?.label}}</ion-label>
</ion-chip>
</div>
</ion-col>
<ion-col size="auto">
<div *ngIf="chips.length && criteriaChip" class="verticalLine"><hr></div>
<div *ngIf="chips.length && showSelectedCriteria" class="verticalLine"><hr></div>
</ion-col>
<ion-col class="chip-container">
<ion-row>
Expand Down
Loading

0 comments on commit 61eeffb

Please sign in to comment.