import { Component, OnInit, HostBinding, Input } from '@angular/core'; import { Router, NavigationEnd } from '@angular/router'; import { AppTitleService } from '../app/utilities/app-title-service'; import { AuthenticationResult } from '@azure/msal-browser'; import { MsalService } from '@azure/msal-angular'; //import { EditMyCompany, PortalDetail } from './models/admin/company/edit-my-company/edit-my-company'; //import { EditMyCompanyService } from './services/admin/company/edit-my-company/edit-my-company.service'; //import { CommonService } from '../../src/app/services/common.service'; //import { Skinning } from '../../src/app/models/admin/company/skinning/skinning'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent implements OnInit { title = 'Siding Portal'; isIframe = false; //skinningTypography = new Skinning(); skinningid = 206; resultData: any; labelName: any = ''; skinStyles: string; fontArray: any; constructor(private router: Router, private appTitleService: AppTitleService, private authService: MsalService) { this.appTitleService.appName = this.title; } @HostBinding("style.--headertitlecolor") @Input() headertitlecolor: string; @HostBinding("style.--pagetitlecolor") @Input() pagetitlecolor: string; @HostBinding("style.--sectiontitlecolor") @Input() sectiontitlecolor: string; @HostBinding("style.--titlecolor") @Input() titlecolor: string; @HostBinding("style.--tablecolumnheadercolor") @Input() tablecolumnheadercolor: string; @HostBinding("style.--tileheadercolor") @Input() tileheadercolor: string; @HostBinding("style.--secondarytablecolumnheadercolor") @Input() secondarytablecolumnheadercolor: string; @HostBinding("style.--tabcolor") @Input() tabcolor: string; @HostBinding("style.--bodycopycolor") @Input() bodycopycolor: string; @HostBinding("style.--secondarybodycolor") @Input() secondarybodycolor: string; @HostBinding("style.--textboxfillcolor") @Input() textboxfillcolor: string; @HostBinding("style.--brdccolor") @Input() brdccolor: string; @HostBinding("style.--loginmessagecolor") @Input() loginmessagecolor: string; @HostBinding("style.--pagefootercolor") @Input() pagefootercolor: string; @HostBinding("style.--portaldesccolor") @Input() portaldesccolor: string; @HostBinding("style.--displaytextcolor") @Input() displaytextcolor: string; @HostBinding("style.--headertitlefontsize") @Input() headertitlefontsize: string; @HostBinding("style.--pagetitlefontsize") @Input() pagetitlefontsize: string; @HostBinding("style.--sectiontitlefontsize") @Input() sectiontitlefontsize: string; @HostBinding("style.--titlefontsize") @Input() titlefontsize: string; @HostBinding("style.--tablecolumnheaderfontsize") @Input() tablecolumnheaderfontsize: string; @HostBinding("style.--tileheaderfontsize") @Input() tileheaderfontsize: string; @HostBinding("style.--secondarytablecolumnheaderfontsize") @Input() secondarytablecolumnheaderfontsize: string; @HostBinding("style.--tabfontsize") @Input() tabfontsize: string; @HostBinding("style.--bodycopyfontsize") @Input() bodycopyfontsize: string; @HostBinding("style.--secondarybodyfontsize") @Input() secondarybodyfontsize: string; @HostBinding("style.--textboxfillfontsize") @Input() textboxfillfontsize: string; @HostBinding("style.--brdcfontsize") @Input() brdcfontsize: string; @HostBinding("style.--loginmessagefontsize") @Input() loginmessagefontsize: string; @HostBinding("style.--pagefooterfontsize") @Input() pagefooterfontsize: string; @HostBinding("style.--btntextfontsize") @Input() btntextfontsize: string; @HostBinding("style.--portaldescfontsize") @Input() portaldescfontsize: string; @HostBinding("style.--displaytextfontsize") @Input() displaytextfontsize: string; @HostBinding("style.--headertitlefontfamily") @Input() headertitlefontfamily: string; @HostBinding("style.--pagetitlefontfamily") @Input() pagetitlefontfamily: string; @HostBinding("style.--sectiontitlefontfamily") @Input() sectiontitlefontfamily: string; @HostBinding("style.--titlefontfamily") @Input() titlefontfamily: string; @HostBinding("style.--tablecolumnheaderfontfamily") @Input() tablecolumnheaderfontfamily: string; @HostBinding("style.--tileheaderfontfamily") @Input() tileheaderfontfamily: string; @HostBinding("style.--secondarytablecolumnheaderfontfamily") @Input() secondarytablecolumnheaderfontfamily: string; @HostBinding("style.--tabfontfamily") @Input() tabfontfamily: string; @HostBinding("style.--bodycopyfontfamily") @Input() bodycopyfontfamily: string; @HostBinding("style.--secondarybodyfontfamily") @Input() secondarybodyfontfamily: string; @HostBinding("style.--textboxfillfontfamily") @Input() textboxfillfontfamily: string; @HostBinding("style.--brdcfontfamily") @Input() brdcfontfamily: string; @HostBinding("style.--loginmessagefontfamily") @Input() loginmessagefontfamily: string; @HostBinding("style.--pagefooterfontfamily") @Input() pagefooterfontfamily: string; @HostBinding("style.--btntextfontfamily") @Input() btntextfontfamily: string; @HostBinding("style.--portaldescfontfamily") @Input() portaldescfontfamily: string; @HostBinding("style.--displaytextfontfamily") @Input() displaytextfontfamily: string; @HostBinding("style.--btntextcolor") @Input() btntextcolor: string; @HostBinding("style.--headertitlebold") @Input() headertitlebold: number = 400; @HostBinding("style.--pagetitlebold") @Input() pagetitlebold: number = 400; @HostBinding("style.--sectiontitlebold") @Input() sectiontitlebold: number = 400; @HostBinding("style.--titlebold") @Input() titlebold: number = 400; @HostBinding("style.--tablecolumnheaderbold") @Input() tablecolumnheaderbold: number = 400; @HostBinding("style.--tileheaderbold") @Input() tileheaderbold: number = 400; @HostBinding("style.--secondarytablecolumnheaderbold") @Input() secondarytablecolumnheaderbold: number = 400; @HostBinding("style.--tabbold") @Input() tabbold: number = 400; @HostBinding("style.--bodycopybold") @Input() bodycopybold: number = 400; @HostBinding("style.--secondarybodybold") @Input() secondarybodybold: number = 400; @HostBinding("style.--textboxfillbold") @Input() textboxfillbold: number = 400; @HostBinding("style.--brdcbold") @Input() brdcbold: number = 400; @HostBinding("style.--loginmessagebold") @Input() loginmessagebold: number = 400; @HostBinding("style.--pagefooterbold") @Input() pagefooterbold: number = 400; @HostBinding("style.--btntextbold") @Input() btntextbold: number = 400; @HostBinding("style.--portaldescbold") @Input() portaldescbold: number = 400; @HostBinding("style.--displaytextbold") @Input() displaytextbold: number = 400; @HostBinding("style.--headertitleitalic") @Input() headertitleitalic: string = ''; @HostBinding("style.--pagetitleitalic") @Input() pagetitleitalic: string = ''; @HostBinding("style.--sectiontitleitalic") @Input() sectiontitleitalic: string = ''; @HostBinding("style.--titleitalic") @Input() titleitalic: string = ''; @HostBinding("style.--tablecolumnheaderitalic") @Input() tablecolumnheaderitalic: string = ''; @HostBinding("style.--tileheaderitalic") @Input() tileheaderitalic: string = ''; @HostBinding("style.--secondarytablecolumnheaderitalic") @Input() secondarytablecolumnheaderitalic: string = ''; @HostBinding("style.--tabitalic") @Input() tabitalic: string = ''; @HostBinding("style.--bodycopyitalic") @Input() bodycopyitalic: string = ''; @HostBinding("style.--secondarybodyitalic") @Input() secondarybodyitalic: string = ''; @HostBinding("style.--textboxfillitalic") @Input() textboxfillitalic: string = ''; @HostBinding("style.--brdcitalic") @Input() brdcitalic: string = ''; @HostBinding("style.--loginmessageitalic") @Input() loginmessageitalic: string = ''; @HostBinding("style.--pagefooteritalic") @Input() pagefooteritalic: string = ''; @HostBinding("style.--btntextitalic") @Input() btntextitalic: string = ''; @HostBinding("style.--portaldescitalic") @Input() portaldescitalic: string = ''; @HostBinding("style.--displaytextitalic") @Input() displaytextitalic: string = ''; @HostBinding("style.--primarycolor") @Input() primarycolor: string = ''; @HostBinding("style.--secondarycolor") @Input() secondarycolor: string = ''; @HostBinding("style.--tertiarycolor") @Input() tertiarycolor: string = ''; _paramId: number = 1; EditMyCompanyAPIResponse: any; //modelEditMyCompany = new EditMyCompany(); //modelPortalDetail = new PortalDetail(); ngOnInit() { this.isIframe = window !== window.parent && !window.opener; this.router.events.subscribe((evt) => { if (!(evt instanceof NavigationEnd)) { return; } window.scrollTo(0, 0); }); //this.service.getById(this._paramId, data => { // this.EditMyCompanyAPIResponse = data; // this.modelEditMyCompany = this.EditMyCompanyAPIResponse.objResponse.responseContent; // this.modelPortalDetail = this.modelEditMyCompany.PortalDetail; // if (document.getElementById('favIcon') != undefined) { // document.getElementById('favIcon').setAttribute('href', this.modelPortalDetail.FavaiconData); // } //}, (error) => { // console.error('Error: ' + error); // return error(error); //}); this.setSkinning(null); //this.common.SkinningOutemit.subscribe(isDrpChange => { // //this.isDrpChange = false; // this.setSkinning(null); //} //); } setSkinning(data: any[] | null) { let color = ''; //this.common.setSkinning(this.skinningid, data => { // this.resultData = data; // this.skinningTypography = this.resultData.objResponse.responseContent; // this.primarycolor = this.skinningTypography.PrimaryColor; // this.secondarycolor = this.skinningTypography.SecondaryColor; // this.tertiarycolor = this.skinningTypography.TertiaryColor; // if (this.skinningTypography.lstTypography != null) { // for (let typography of this.skinningTypography.lstTypography) { // let colorName = typography.Color; // colorName = colorName.replace(/\s/g, ""); // this.labelName = typography.Name.replace(/\s/g, ""); // if (colorName.toUpperCase() == "PRIMARYCOLOR") { // color = this.skinningTypography.PrimaryColor // } // else if (colorName.toUpperCase() == "SECONDARYCOLOR") { // color = this.skinningTypography.SecondaryColor; // } // else if (colorName.toUpperCase() == "TERTIARYCOLOR") { // color = this.skinningTypography.TertiaryColor; // } // else if (colorName.toUpperCase() == "ACCENT1") { // color = this.skinningTypography.Accent1 // } // else if (colorName.toUpperCase() == "ACCENT2") { // color = this.skinningTypography.Accent2 // } // else if (colorName.toUpperCase() == "ACCENT3") { // color = this.skinningTypography.Accent3 // } // else if (colorName.toUpperCase() == "ACCENT4") { // color = this.skinningTypography.Accent4 // } // //font = typography.Font // //fontSize = typography.FontSize; // //this.headertitlefontsize = typography.FontSize; // // "'Arvo', serif" // switch (this.labelName) { // case "HeaderTitle": // this.headertitlecolor = color; // this.headertitlefontsize = typography.FontSize + "px"; // this.fontArray = this.checkFontFamily(typography.Font); // if (this.fontArray.length > 1) { // this.headertitlefontfamily = this.fontArray[1].fontfamily; // this.headertitlebold = this.fontArray[1].titlebold; // this.headertitleitalic = this.fontArray[1].italic; // } // break; // case "PageTitle": // this.pagetitlecolor = color; // this.pagetitlefontsize = typography.FontSize + "px"; // this.fontArray = this.checkFontFamily(typography.Font); // if (this.fontArray.length > 1) { // this.pagetitlefontfamily = this.fontArray[1].fontfamily; // this.pagetitlebold = this.fontArray[1].titlebold; // this.pagetitleitalic = this.fontArray[1].italic; // } // break; // case "SectionTitle": // this.sectiontitlecolor = color; // this.sectiontitlefontsize = typography.FontSize + "px"; // this.fontArray = this.checkFontFamily(typography.Font); // if (this.fontArray.length > 1) { // this.sectiontitlefontfamily = this.fontArray[1].fontfamily; // this.sectiontitlebold = this.fontArray[1].titlebold; // this.sectiontitleitalic = this.fontArray[1].italic; // } // break; // case "Title": // this.titlecolor = color; // this.titlefontsize = typography.FontSize + "px"; // this.fontArray = this.checkFontFamily(typography.Font); // if (this.fontArray.length > 1) { // this.titlefontfamily = this.fontArray[1].fontfamily; // this.titlebold = this.fontArray[1].titlebold; // this.titleitalic = this.fontArray[1].italic; // } // break; // case "TableColumnHeader": // this.tablecolumnheadercolor = color; // this.tablecolumnheaderfontsize = typography.FontSize + "px"; // this.fontArray = this.checkFontFamily(typography.Font); // if (this.fontArray.length > 1) { // this.tablecolumnheaderfontfamily = this.fontArray[1].fontfamily; // this.tablecolumnheaderbold = this.fontArray[1].titlebold; // this.tablecolumnheaderitalic = this.fontArray[1].italic; // } // break; // case "TitleHeader": // this.tileheadercolor = color; // this.tileheaderfontsize = typography.FontSize + "px"; // this.fontArray = this.checkFontFamily(typography.Font); // if (this.fontArray.length > 1) { // this.tileheaderfontfamily = this.fontArray[1].fontfamily; // this.tileheaderbold = this.fontArray[1].titlebold; // this.tileheaderitalic = this.fontArray[1].italic; // } // break; // case "SecondaryTableColumnHeader": // this.secondarytablecolumnheadercolor = color; // this.secondarytablecolumnheaderfontsize = typography.FontSize + "px"; // this.fontArray = this.checkFontFamily(typography.Font); // if (this.fontArray.length > 1) { // this.secondarytablecolumnheaderfontfamily = this.fontArray[1].fontfamily; // this.secondarytablecolumnheaderbold = this.fontArray[1].titlebold; // this.secondarytablecolumnheaderitalic = this.fontArray[1].italic; // } // break; // case "TabText": // this.tabcolor = color; // this.tabfontsize = typography.FontSize + "px"; // this.fontArray = this.checkFontFamily(typography.Font); // if (this.fontArray.length > 1) { // this.tabfontfamily = this.fontArray[1].fontfamily; // this.tabbold = this.fontArray[1].titlebold; // this.tabitalic = this.fontArray[1].italic; // } // break; // case "BodyCopy": // this.bodycopycolor = color; // this.bodycopyfontsize = typography.FontSize + "px"; // this.fontArray = this.checkFontFamily(typography.Font); // if (this.fontArray.length > 1) { // this.bodycopyfontfamily = this.fontArray[1].fontfamily; // this.bodycopybold = this.fontArray[1].titlebold; // this.bodycopyitalic = this.fontArray[1].italic; // } // break; // case "SecondaryBody": // this.secondarybodycolor = color; // this.secondarybodyfontsize = typography.FontSize + "px"; // this.fontArray = this.checkFontFamily(typography.Font); // if (this.fontArray.length > 1) { // this.secondarybodyfontfamily = this.fontArray[1].fontfamily; // this.secondarybodybold = this.fontArray[1].titlebold; // this.secondarybodyitalic = this.fontArray[1].italic; // } // break; // case "Breadcrumbs": // this.brdccolor = color; // this.brdcfontsize = typography.FontSize + "px"; // this.fontArray = this.checkFontFamily(typography.Font); // if (this.fontArray.length > 1) { // this.brdcfontfamily = this.fontArray[1].fontfamily; // this.brdcbold = this.fontArray[1].titlebold; // this.brdcitalic = this.fontArray[1].italic; // } // break; // case "LoginMessage": // this.loginmessagecolor = color; // this.loginmessagefontsize = typography.FontSize + "px"; // this.fontArray = this.checkFontFamily(typography.Font); // if (this.fontArray.length > 1) { // this.loginmessagefontfamily = this.fontArray[1].fontfamily; // this.loginmessagebold = this.fontArray[1].titlebold; // this.loginmessageitalic = this.fontArray[1].italic; // } // break; // case "PageFooter": // this.pagefootercolor = color; // this.pagefooterfontsize = typography.FontSize + "px"; // this.fontArray = this.checkFontFamily(typography.Font); // if (this.fontArray.length > 1) { // this.pagefooterfontfamily = this.fontArray[1].fontfamily; // this.pagefooterbold = this.fontArray[1].titlebold; // this.pagefooteritalic = this.fontArray[1].italic; // } // break; // case "ButtonText": // this.btntextcolor = color; // this.btntextfontsize = typography.FontSize + "px"; // this.fontArray = this.checkFontFamily(typography.Font); // if (this.fontArray.length > 1) { // this.btntextfontfamily = this.fontArray[1].fontfamily; // this.btntextbold = this.fontArray[1].titlebold; // this.btntextitalic = this.fontArray[1].italic; // } // break; // case "PortalDescriptor": // this.portaldesccolor = color; // this.portaldescfontsize = typography.FontSize + "px"; // this.fontArray = this.checkFontFamily(typography.Font); // if (this.fontArray.length > 1) { // this.portaldescfontfamily = this.fontArray[1].fontfamily; // this.portaldescbold = this.fontArray[1].titlebold; // this.portaldescitalic = this.fontArray[1].italic; // } // break; // case "DisplayText": // this.displaytextcolor = color; // this.displaytextfontsize = typography.FontSize + "px"; // this.fontArray = this.checkFontFamily(typography.Font); // if (this.fontArray.length > 1) { // this.displaytextfontfamily = this.fontArray[1].fontfamily; // this.displaytextbold = this.fontArray[1].titlebold; // this.displaytextitalic = this.fontArray[1].italic; // } // break; // } // } // } //}, (error) => { // console.error('Error: ' + error); // return error(error); //}); } checkFontFamily(Font: string) { let fontfamily: any[]; fontfamily = ['']; switch (Font) { case "Arvo": fontfamily.push({ 'fontfamily': "'Arvo', serif", "titlebold": 400, "italic": 'none' }) return fontfamily; case "Arvo Bold": fontfamily.push({ 'fontfamily': "'Arvo Bold', serif", "titlebold": 700, "italic": 'none' }) return fontfamily; case "Arvo Italic": fontfamily.push({ 'fontfamily': "'Arvo Italic', serif", "titlebold": 400, "italic": 'italic' }) return fontfamily; case "HammersmithOne": fontfamily.push({ 'fontfamily': "'HammersmithOne', sans-serif", "titlebold": 400, "italic": 'none' }) return fontfamily; case "HammersmithOne Bold": fontfamily.push({ 'fontfamily': "'HammersmithOne Bold', sans-serif", "titlebold": 700, "italic": 'none' }) return fontfamily; case "HammersmithOne Italic": fontfamily.push({ 'fontfamily': "'HammersmithOne Italic', sans-serif", "titlebold": 400, "italic": 'italic' }) return fontfamily; case "MerriweatherSans": fontfamily.push({ 'fontfamily': "'MerriweatherSans', sans-serif", "titlebold": 400, "italic": 'none' }) return fontfamily; case "Arvo Bold": fontfamily.push({ 'fontfamily': "'MerriweatherSans Bold', sans-serif", "titlebold": 700, "italic": 'none' }) return fontfamily; case "Arvo Italic": fontfamily.push({ 'fontfamily': "'MerriweatherSans Italic', sans-serif", "titlebold": 400, "italic": 'italic' }) return fontfamily; case "Montserrat": fontfamily.push({ 'fontfamily': "'Montserrat', sans-serif", "titlebold": 400, "italic": 'none' }) return fontfamily; case "Arvo Bold": fontfamily.push({ 'fontfamily': "'Montserrat Bold', sans-serif", "titlebold": 700, "italic": 'none' }) return fontfamily; case "Arvo Italic": fontfamily.push({ 'fontfamily': "'Montserrat Italic', sans-serif", "titlebold": 400, "italic": 'italic' }) return fontfamily; case "Nunito": fontfamily.push({ 'fontfamily': "'Nunito', sans-serif", "titlebold": 400, "italic": 'none' }) return fontfamily; case "Nunito Bold": fontfamily.push({ 'fontfamily': "'Nunito Bold', sans-serif", "titlebold": 700, "italic": 'none' }) return fontfamily; case "Nunito Italic": fontfamily.push({ 'fontfamily': "'Nunito Italic', sans-serif", "titlebold": 400, "italic": 'italic' }) return fontfamily; case "OpenSans": fontfamily.push({ 'fontfamily': "'OpenSans', sans-serif", "titlebold": 400, "italic": 'none' }) return fontfamily; case "OpenSans Bold": fontfamily.push({ 'fontfamily': "'OpenSans Bold', sans-serif", "titlebold": 700, "italic": 'none' }) return fontfamily; case "OpenSans Italic": fontfamily.push({ 'fontfamily': "'OpenSans Italic', sans-serif", "titlebold": 400, "italic": 'italic' }) return fontfamily; case "Oswald": fontfamily.push({ 'fontfamily': "'Oswald', sans-serif", "titlebold": 400, "italic": 'none' }) return fontfamily; case "Oswald Bold": fontfamily.push({ 'fontfamily': "'Oswald Bold', sans-serif", "titlebold": 700, "italic": 'none' }) return fontfamily; case "Oswald Italic": fontfamily.push({ 'fontfamily': "'Oswald Italic', sans-serif", "titlebold": 400, "italic": 'italic' }) return fontfamily; case "Roboto": fontfamily.push({ 'fontfamily': "'Roboto', sans-serif", "titlebold": 400, "italic": 'none' }) return fontfamily; case "Roboto Bold": fontfamily.push({ 'fontfamily': "'Roboto Bold', sans-serif", "titlebold": 700, "italic": 'none' }) return fontfamily; case "Roboto Italic": fontfamily.push({ 'fontfamily': "'Roboto Italic', sans-serif", "titlebold": 400, "italic": 'italic' }) return fontfamily; case "Teko": fontfamily.push({ 'fontfamily': "'Teko', sans-serif", "titlebold": 400, "italic": 'none' }) return fontfamily; case "Teko Bold": fontfamily.push({ 'fontfamily': "'Teko Bold', sans-serif", "titlebold": 700, "italic": 'none' }) return fontfamily; case "Teko Italic": fontfamily.push({ 'fontfamily': "'Teko Italic', sans-serif", "titlebold": 400, "italic": 'italic' }) return fontfamily; case "Ubuntu": fontfamily.push({ 'fontfamily': "'Ubuntu', sans-serif", "titlebold": 400, "italic": 'none' }) return fontfamily; case "Ubuntu Bold": fontfamily.push({ 'fontfamily': "'Ubuntu Bold', sans-serif", "titlebold": 700, "italic": 'none' }) return fontfamily; case "Ubuntu Italic": fontfamily.push({ 'fontfamily': "'Ubuntu Italic', sans-serif", "titlebold": 400, "italic": 'italic' }) return fontfamily; case "Varela": fontfamily.push({ 'fontfamily': "'Varela', sans-serif", "titlebold": 400, "italic": 'none' }) return fontfamily; case "Varela Bold": fontfamily.push({ 'fontfamily': "'Varela Bold', sans-serif", "titlebold": 700, "italic": 'none' }) return fontfamily; case "Varela Italic": fontfamily.push({ 'fontfamily': "'Varela Italic', sans-serif", "titlebold": 400, "italic": 'italic' }) return fontfamily; case "Poppins": fontfamily.push({ 'fontfamily': "'Poppins', sans-serif", "titlebold": 400, "italic": 'none' }) return fontfamily; default: return Font; } } }