Skip to content
Snippets Groups Projects
Commit f46892d7 authored by Makhtar DIAGNE's avatar Makhtar DIAGNE Committed by pybelecalo
Browse files

[TECH] Fix Typo : AttachementType => AttachmentType

parent c84804b5
No related branches found
No related tags found
No related merge requests found
export enum AttachementType {
export enum AttachmentType {
Header = 'HEADER',
Footer = 'FOOTER',
Portal = 'PORTAL'
......
export * from './attachementType.enum';
export * from './attachmentType.enum';
export * from './color.interface';
export * from './logo.interface';
export * from './customer-theme.interface';
......
import { AttachementType } from './attachementType.enum';
import { AttachmentType } from './attachmentType.enum';
export interface Logo {
attr: AttachementType;
attr: AttachmentType;
file: File;
}
......@@ -45,7 +45,7 @@ import { ApplicationId } from './application-id.enum';
import { AuthService } from './auth.service';
import { WINDOW_LOCATION } from './injection-tokens';
import { Logger } from './logger/logger';
import { AppConfiguration, AttachementType, AuthUser, Color } from './models';
import { AppConfiguration, AttachmentType, AuthUser, Color } from './models';
import {ThemeService} from './theme.service';
const WARNING_DURATION = 2000;
......@@ -87,12 +87,12 @@ export class StartupService {
this.authService.logoutRedirectUiUrl = this.configurationData.LOGOUT_REDIRECT_UI_URL;
})
.then(() => this.refreshUser().toPromise())
.then(() => this.applicationApi.getAsset([AttachementType.Header, AttachementType.Footer, AttachementType.Portal]).toPromise())
.then(() => this.applicationApi.getAsset([AttachmentType.Header, AttachmentType.Footer, AttachmentType.Portal]).toPromise())
.then((data) => {
this.configurationData.HEADER_LOGO = data[AttachementType.Header];
this.configurationData.FOOTER_LOGO = data[AttachementType.Footer];
this.configurationData.PORTAL_LOGO = data[AttachementType.Portal];
this.configurationData.LOGO = data[AttachementType.Portal];
this.configurationData.HEADER_LOGO = data[AttachmentType.Header];
this.configurationData.FOOTER_LOGO = data[AttachmentType.Footer];
this.configurationData.PORTAL_LOGO = data[AttachmentType.Portal];
this.configurationData.LOGO = data[AttachmentType.Portal];
})
.then(() => {
......
......@@ -38,7 +38,7 @@ import { HttpClient, HttpHeaders, HttpParams, HttpResponse } from '@angular/comm
import { Inject, Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { BASE_URL, BaseHttpClient, Customer, Logger, Logo, PageRequest, PaginatedResponse } from 'ui-frontend-common';
import { AttachementType } from '../../customer/attachment.enum';
import { AttachmentType } from '../../customer/attachment.enum';
@Injectable({
providedIn: 'root'
......
......@@ -42,7 +42,7 @@ import { Injectable } from '@angular/core';
import { HttpResponse } from '@angular/common/http';
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
import { AttachementType } from '../customer/attachment.enum';
import { AttachmentType } from '../customer/attachment.enum';
import { VitamUISnackBar, VitamUISnackBarComponent } from '../shared/vitamui-snack-bar';
import { CustomerApiService } from './api/customer-api.service';
......@@ -130,14 +130,14 @@ export class CustomerService {
);
}
public getLogoUrl(id: string, type: AttachementType): Observable<SafeResourceUrl> {
public getLogoUrl(id: string, type: AttachmentType): Observable<SafeResourceUrl> {
return this.customerApi.getLogo(id, type).pipe(
map((res: HttpResponse<Blob>) => {
if (res.status === 204) {
switch (type) {
case AttachementType.Header: return this.themeService.defaultTheme.headerUrl; break;
case AttachementType.Footer: return this.themeService.defaultTheme.footerUrl; break;
case AttachementType.Portal: return this.themeService.defaultTheme.portalUrl; break;
case AttachmentType.Header: return this.themeService.defaultTheme.headerUrl; break;
case AttachmentType.Footer: return this.themeService.defaultTheme.footerUrl; break;
case AttachmentType.Portal: return this.themeService.defaultTheme.portalUrl; break;
}
return null;
}
......@@ -148,9 +148,9 @@ export class CustomerService {
}
public getLogos(customerId: string): Observable<SafeResourceUrl[]> {
const headerLogo$ = this.getLogoUrl(customerId, AttachementType.Header);
const footerLogo$ = this.getLogoUrl(customerId, AttachementType.Footer);
const portalLogo$ = this.getLogoUrl(customerId, AttachementType.Portal);
const headerLogo$ = this.getLogoUrl(customerId, AttachmentType.Header);
const footerLogo$ = this.getLogoUrl(customerId, AttachmentType.Footer);
const portalLogo$ = this.getLogoUrl(customerId, AttachmentType.Portal);
return zip(headerLogo$, footerLogo$, portalLogo$);
}
}
export enum AttachementType {
export enum AttachmentType {
Header = 'HEADER',
Footer = 'FOOTER',
Portal = 'PORTAL'
......
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { AttachementType, Logo, ThemeService } from 'ui-frontend-common';
import { AttachmentType, Logo, ThemeService } from 'ui-frontend-common';
@Component({
selector: 'app-graphic-identity-form',
......@@ -18,7 +18,7 @@ export class GraphicIdentityFormComponent implements OnInit {
@Output()
public formChange = new EventEmitter<{form: FormGroup, logos: Logo[]}>();
public ATTACHMENT_TYPE = AttachementType;
public ATTACHMENT_TYPE = AttachmentType;
public logosSize = {width: 280, height: 100};
private logos: Logo[] = [];
......@@ -45,7 +45,7 @@ export class GraphicIdentityFormComponent implements OnInit {
this.themeService.overloadLocalTheme(colors, '#toOverride');
}
public addOrReplaceLogo(type: AttachementType, data: File): void {
public addOrReplaceLogo(type: AttachmentType, data: File): void {
const logo: Logo = { attr: type, file: data };
const index = this.logos.findIndex((e: Logo) => e.attr === logo.attr);
if (index === -1) {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment