Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue#2103 missing notifications #2105

Merged
merged 4 commits into from
May 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 7 additions & 18 deletions src/app/header/header.component.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<div class="header" [ngClass]="{ 'header-secondary': !isRouter('/') }">
<div [ngClass]="{ 'hide-content': (isAutorizationLoading$ | async) }">
<div fxLayout="row" fxLayoutAlign="space-between">
<div
class="logo-wrapper"
*ngIf="isMobileScreen && !!navigationPaths?.length; then mobileNavTmpl; else logoTmpl"></div>
<div class="logo-wrapper" *ngIf="isMobileScreen && !!navigationPaths?.length; then mobileNavTmpl; else logoTmpl"></div>
<div class="link-wrapper">
<div *ngIf="!isMobileScreen" class="link-wrapper">
<a class="info-link" [routerLink]="'./info/about'"> {{ 'ENUM.NAV_BAR_NAME.ABOUT_PORTAL' | translate | uppercase }}</a>
Expand All @@ -27,8 +25,7 @@
</button>
</div>

<ng-conatiner
*ngIf="(isAuthorized$ | async) && user; then isAuthorizedTmpl; else isUnauthorizedTmpl"></ng-conatiner>
<ng-conatiner *ngIf="(isAuthorized$ | async) && user; then isAuthorizedTmpl; else isUnauthorizedTmpl"></ng-conatiner>
</div>
</div>
<div *ngIf="isRouter('/')" fxLayout="column" fxLayoutAlign="center center">
Expand Down Expand Up @@ -63,7 +60,7 @@ <h2 class="header-descr">{{ headerSubtitle }}</h2>

<ng-template #isAuthorizedTmpl>
<ng-container *ngIf="!isMobileScreen; else menuTmpl">
<app-notifications class="menu" *ngIf="(featuresList$ | async).release2"></app-notifications>
<app-notifications class="menu" *ngIf="(featuresList$ | async)?.release2"></app-notifications>

<button mat-flat-button class="menu" [matMenuTriggerFor]="log">
<mat-icon>account_circle</mat-icon>
Expand All @@ -73,8 +70,7 @@ <h2 class="header-descr">{{ headerSubtitle }}</h2>
</ng-container>

<mat-menu #log="matMenu" class="menu">
<ng-conatiner
*ngIf="user.role !== Role.parent && user.role !== Role.provider; then AdminView; else UserView"></ng-conatiner>
<ng-conatiner *ngIf="user.role !== Role.parent && user.role !== Role.provider; then AdminView; else UserView"></ng-conatiner>
<button mat-menu-item class="logout-btn" (click)="onLogout()">
{{ 'LOGOUT' | translate }}
</button>
Expand All @@ -88,9 +84,7 @@ <h2 class="header-descr">{{ headerSubtitle }}</h2>
<button mat-menu-item>{{ 'ENUM.NAV_BAR_NAME.PERSONAL_INFORMATION' | translate }}</button>
</a>
<a [routerLink]="'./personal-cabinet/' + user.role + '/info'">
<button mat-menu-item>
{{ 'ENUM.NAV_BAR_NAME.INFORMATION_ABOUT' | translate }} {{ RoleLinks[user.role] | translate }}
</button>
<button mat-menu-item>{{ 'ENUM.NAV_BAR_NAME.INFORMATION_ABOUT' | translate }} {{ RoleLinks[user.role] | translate }}</button>
</a>
<a *ngIf="user.role === Role.provider" [routerLink]="'./personal-cabinet/provider/workshops'">
<button mat-menu-item>
Expand All @@ -107,9 +101,7 @@ <h2 class="header-descr">{{ headerSubtitle }}</h2>
{{ 'ENUM.NAV_BAR_NAME.MESSAGES' | translate }}
</button>
</a>
<a
*ngIf="user.role === Role.provider && subrole !== Role.ProviderAdmin"
[routerLink]="'./personal-cabinet/provider/administration'">
<a *ngIf="user.role === Role.provider && subrole !== Role.ProviderAdmin" [routerLink]="'./personal-cabinet/provider/administration'">
<button mat-menu-item>
{{ 'ENUM.NAV_BAR_NAME.ADMINISTRATION' | translate }}
</button>
Expand All @@ -128,10 +120,7 @@ <h2 class="header-descr">{{ headerSubtitle }}</h2>
{{ 'ENUM.NAV_BAR_NAME.PERSONAL_INFORMATION' | translate }}
</button>
</a>
<a
*ngIf="user.role === Role.techAdmin"
[routerLink]="'./admin-tools/platform'"
[queryParams]="{ page: defaultAdminTabs }">
<a *ngIf="user.role === Role.techAdmin" [routerLink]="'./admin-tools/platform'" [queryParams]="{ page: defaultAdminTabs }">
<button mat-menu-item>
{{ 'ENUM.NAV_BAR_NAME.ADMINISTRATION' | translate }}
</button>
Expand Down
36 changes: 10 additions & 26 deletions src/app/shared/components/sidenav-menu/sidenav-menu.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<div class="mobile-sidenav-shell">
<ng-container *ngTemplateOutlet="Language"> </ng-container>

<div class="mobile-sidenav-menu" *ngIf="(featuresList$ | async).release2">
<div class="mobile-sidenav-menu" *ngIf="(featuresList$ | async)?.release2">
<a [routerLink]="'./notifications'" (click)="changeView()" class="full-width notif">
<app-notifications fxLayout="row" fxLayoutAlign="space-between center"> </app-notifications>
</a>
Expand All @@ -35,43 +35,30 @@
<hr class="hr-grey" />

<div class="mobile-sidenav-menu">
<div
*ngIf="
user?.role !== Role.techAdmin && user?.role !== Role.ministryAdmin;
then UserView;
else AdminView
"></div>
<div *ngIf="user?.role !== Role.techAdmin && user?.role !== Role.ministryAdmin; then UserView; else AdminView"></div>
<ng-template #UserView>
<a [routerLink]="'./personal-cabinet/config'" (click)="changeView()">{{
'ENUM.NAV_BAR_NAME.PERSONAL_INFORMATION' | translate
}}</a>
<a [routerLink]="'./personal-cabinet/' + user.role + '/info'" (click)="changeView()">
{{ 'ENUM.NAV_BAR_NAME.INFORMATION_ABOUT' | translate }} {{ RoleLinks[user.role] | translate }}</a
>
<a
*ngIf="user.role === Role.provider"
[routerLink]="'./personal-cabinet/provider/workshops'"
(click)="changeView()"
>{{ 'ENUM.NAV_BAR_NAME.MY_WORKSHOPS' | translate }}</a
>
<a *ngIf="user.role === Role.provider" [routerLink]="'./personal-cabinet/provider/workshops'" (click)="changeView()">{{
'ENUM.NAV_BAR_NAME.MY_WORKSHOPS' | translate
}}</a>
<a [routerLink]="'./personal-cabinet/' + user.role + '/applications'" (click)="changeView()">{{
'ENUM.NAV_BAR_NAME.APPLICATIONS' | translate
}}</a>
<a [routerLink]="'./personal-cabinet/messages'" (click)="changeView()">{{
'ENUM.NAV_BAR_NAME.MESSAGES' | translate
}}</a>
<a [routerLink]="'./personal-cabinet/messages'" (click)="changeView()">{{ 'ENUM.NAV_BAR_NAME.MESSAGES' | translate }}</a>
<a
*ngIf="user.role === Role.provider && (subrole$ | async) !== Role.ProviderAdmin"
[routerLink]="'./personal-cabinet/provider/administration'"
(click)="changeView()"
>{{ 'ENUM.NAV_BAR_NAME.ADMINISTRATION' | translate }}</a
>
<a
*ngIf="user.role === Role.parent"
[routerLink]="'./personal-cabinet/parent/favorite'"
(click)="changeView()"
>{{ 'ENUM.NAV_BAR_NAME.FAVORITE' | translate }}</a
>
<a *ngIf="user.role === Role.parent" [routerLink]="'./personal-cabinet/parent/favorite'" (click)="changeView()">{{
'ENUM.NAV_BAR_NAME.FAVORITE' | translate
}}</a>
</ng-template>
<ng-template #AdminView>
<a [routerLink]="'./personal-cabinet/config'" (click)="changeView()">{{
Expand All @@ -84,10 +71,7 @@
(click)="changeView()">
{{ 'ENUM.NAV_BAR_NAME.ADMINISTRATION' | translate }}
</a>
<a
*ngIf="user.role === Role.ministryAdmin"
[routerLink]="'./admin-tools/data/admins'"
(click)="changeView()">
<a *ngIf="user.role === Role.ministryAdmin" [routerLink]="'./admin-tools/data/admins'" (click)="changeView()">
{{ 'ENUM.NAV_BAR_NAME.ADMINISTRATION' | translate }}
</a>
</ng-template>
Expand Down
100 changes: 52 additions & 48 deletions src/app/shared/services/provider/provider.service.ts
Original file line number Diff line number Diff line change
@@ -1,43 +1,35 @@
import { PaginationElement } from './../../models/paginationElement.model';
import { Observable } from 'rxjs';

import { HttpClient, HttpParams } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Store } from '@ngxs/store';
import { Observable } from 'rxjs';
import { BlockProviderData, LicenseStatusData, Provider, ProviderParameters, ProviderStatusUpdateData } from '../../models/provider.model';
import { SearchResponse } from '../../models/search.model';

import { DataItem } from '../../models/item.model';
import { PaginationElement } from '../../models/paginationElement.model';
import {
BlockProviderData, LicenseStatusData, Provider, ProviderParameters, ProviderStatusUpdateData
} from '../../models/provider.model';
import { SearchResponse } from '../../models/search.model';

@Injectable({
providedIn: 'root'
})
export class ProviderService {
constructor(private http: HttpClient, private store: Store) {}

private setParams(providerParameters: ProviderParameters): HttpParams {
let params = new HttpParams();

if (providerParameters.searchString) {
params = params.set('SearchString', providerParameters.searchString);
}

params = params.set('Size', providerParameters.size.toString()).set('From', providerParameters.from.toString());

return params;
}

/**
* This method get Provider by id
* @param id string
*/
getProviderById(id: string): Observable<Provider> {
public getProviderById(id: string): Observable<Provider> {
return this.http.get<Provider>(`/api/v1/Provider/GetById/${id}`);
}

/**
* This method get filtered Providers from the database
* @param
*/
getFilteredProviders(providerParameters: ProviderParameters): Observable<SearchResponse<Provider[]>> {
public getFilteredProviders(providerParameters: ProviderParameters): Observable<SearchResponse<Provider[]>> {
const options = { params: this.setParams(providerParameters) };

return this.http.get<SearchResponse<Provider[]>>('/api/v1/Provider/GetByFilter', options);
Expand All @@ -47,82 +39,94 @@ export class ProviderService {
* This method create Provider
* @param Provider
*/
createProvider(provider: Provider, isRelease3: boolean): Observable<Provider> {
return isRelease3 ? this.createProviderV2(provider) : this.createProviderV1(provider);
}

createProviderV1(provider: Provider): Observable<Provider> {
return this.http.post<Provider>('/api/v1/Provider/Create', provider);
}

createProviderV2(provider: Provider): Observable<Provider> {
const formData = Provider.createFormData(provider);
return this.http.post<Provider>('/api/v2/Provider/Create', formData);
public createProvider(provider: Provider, isImagesFeature: boolean): Observable<Provider> {
return isImagesFeature ? this.createProviderV2(provider) : this.createProviderV1(provider);
}

/**
* This method get Provider by User id
*/
getProfile(): Observable<Provider> {
public getProfile(): Observable<Provider> {
return this.http.get<Provider>('/api/v1/Provider/GetProfile');
}

/**
* This method update Provider
* @param Provider
*/
updateProvider(provider: Provider, isRelease3: boolean): Observable<Provider> {
return isRelease3 ? this.updateProviderV2(provider) : this.updateProviderV1(provider);
}

updateProviderV1(provider: Provider): Observable<Provider> {
return this.http.put<Provider>('/api/v1/Provider/Update', provider);
}

updateProviderV2(provider: Provider): Observable<Provider> {
const formData = Provider.createFormData(provider);
return this.http.put<Provider>('/api/v2/Provider/Update', formData);
public updateProvider(provider: Provider, isImagesFeature: boolean): Observable<Provider> {
return isImagesFeature ? this.updateProviderV2(provider) : this.updateProviderV1(provider);
}

/**
* This method update Provider status
*/
updateProviderStatus(updateStatus: ProviderStatusUpdateData): Observable<ProviderStatusUpdateData> {
public updateProviderStatus(updateStatus: ProviderStatusUpdateData): Observable<ProviderStatusUpdateData> {
return this.http.put<ProviderStatusUpdateData>('/api/v1/Provider/StatusUpdate', updateStatus);
}

/**
* This method update Provider status
*/
updateProviderLicenseStatus(licenseStatusData: LicenseStatusData): Observable<LicenseStatusData> {
public updateProviderLicenseStatus(licenseStatusData: LicenseStatusData): Observable<LicenseStatusData> {
return this.http.put<LicenseStatusData>('/api/v1/Provider/LicenseStatusUpdate', licenseStatusData);
}

/**
* This method get all institution statuses
*/
getInstitutionStatuses(): Observable<DataItem[]> {
public getInstitutionStatuses(): Observable<DataItem[]> {
return this.http.get<DataItem[]>('/api/v1/InstitutionStatus/Get');
}

/**
* This method get all provider types
*/
getProviderTypes(): Observable<DataItem[]> {
public getProviderTypes(): Observable<DataItem[]> {
return this.http.get<DataItem[]>('/api/v1/ProviderType/Get');
}

/**
* This method delete a specific Provider from the database
*/
deleteProviderById(id: string): Observable<void> {
public deleteProviderById(id: string): Observable<void> {
return this.http.delete<void>(`/api/v1/Provider/Delete/${id}`);
}

/**
* This method block a specific Provider from the database
*/
blockProvider(provider: BlockProviderData): Observable<void> {
return this.http.put<void>(`/api/v1/Provider/Block`, provider);
public blockProvider(provider: BlockProviderData): Observable<void> {
return this.http.put<void>('/api/v1/Provider/Block', provider);
}

private setParams(providerParameters: ProviderParameters): HttpParams {
let params = new HttpParams();

if (providerParameters.searchString) {
params = params.set('SearchString', providerParameters.searchString);
}

params = params.set('Size', providerParameters.size.toString()).set('From', providerParameters.from.toString());

return params;
}

private createProviderV1(provider: Provider): Observable<Provider> {
return this.http.post<Provider>('/api/v1/Provider/Create', provider);
}

private createProviderV2(provider: Provider): Observable<Provider> {
const formData = Provider.createFormData(provider);
return this.http.post<Provider>('/api/v2/Provider/Create', formData);
}

private updateProviderV1(provider: Provider): Observable<Provider> {
return this.http.put<Provider>('/api/v1/Provider/Update', provider);
}

private updateProviderV2(provider: Provider): Observable<Provider> {
const formData = Provider.createFormData(provider);
return this.http.put<Provider>('/api/v2/Provider/Update', formData);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ import { FeaturesList } from '../../../models/featuresList.model';
import { TruncatedItem } from '../../../models/item.model';
import { PaginationElement } from '../../../models/paginationElement.model';
import { SearchResponse } from '../../../models/search.model';
import { ProviderWorkshopCard, Workshop, WorkshopCard, WorkshopCardParameters, WorkshopStatus } from '../../../models/workshop.model';
import {
ProviderWorkshopCard, Workshop, WorkshopCard, WorkshopCardParameters, WorkshopStatus
} from '../../../models/workshop.model';
import { MetaDataState } from '../../../store/meta-data.state';

@Injectable({
providedIn: 'root'
})
export class UserWorkshopService {
private isRelease3: boolean;
private isImagesFeature: boolean;

constructor(private http: HttpClient, private store: Store) {}

Expand Down Expand Up @@ -78,8 +80,8 @@ export class UserWorkshopService {
* @param workshop: Workshop
*/
public createWorkshop(workshop: Workshop): Observable<Workshop> {
this.isRelease3 = this.store.selectSnapshot<FeaturesList>(MetaDataState.featuresList).release3;
return this.isRelease3 ? this.createWorkshopV2(workshop) : this.createWorkshopV1(workshop);
this.isImagesFeature = this.store.selectSnapshot<FeaturesList>(MetaDataState.featuresList).images;
return this.isImagesFeature ? this.createWorkshopV2(workshop) : this.createWorkshopV1(workshop);
}

public createWorkshopV1(workshop: Workshop): Observable<Workshop> {
Expand All @@ -96,8 +98,8 @@ export class UserWorkshopService {
* @param workshop: Workshop
*/
public updateWorkshop(workshop: Workshop): Observable<Workshop> {
this.isRelease3 = this.store.selectSnapshot<FeaturesList>(MetaDataState.featuresList).release2;
return this.isRelease3 ? this.updateWorkshopV2(workshop) : this.updateWorkshopV1(workshop);
this.isImagesFeature = this.store.selectSnapshot<FeaturesList>(MetaDataState.featuresList).images;
return this.isImagesFeature ? this.updateWorkshopV2(workshop) : this.updateWorkshopV1(workshop);
}

public updateWorkshopV1(workshop: Workshop): Observable<Workshop> {
Expand Down
4 changes: 2 additions & 2 deletions src/app/shared/store/provider.actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export class OnDeleteWorkshopFail {

export class CreateProvider {
static readonly type = '[provider] create Provider';
constructor(public payload: Provider, public isRelease3: boolean) {}
constructor(public payload: Provider, public isImagesFeature: boolean) {}
}

export class OnCreateProviderFail {
Expand All @@ -159,7 +159,7 @@ export class OnCreateProviderSuccess {

export class UpdateProvider {
static readonly type = '[provider] update Provider';
constructor(public payload: Provider, public isRelease3: boolean) {}
constructor(public payload: Provider, public isImagesFeature: boolean) {}
}

export class OnUpdateProviderFail {
Expand Down
Loading