2022-12-02 12:01:26 +01:00
|
|
|
import {Component, Input} from '@angular/core';
|
2018-12-07 12:07:19 +01:00
|
|
|
import {ActivatedRoute} from '@angular/router';
|
2019-06-03 15:20:36 +02:00
|
|
|
import 'rxjs';
|
2022-12-02 12:01:26 +01:00
|
|
|
import {MenuItem} from './menu';
|
|
|
|
import {ConfigurationService} from '../utils/configuration/configuration.service';
|
2019-06-05 15:33:18 +02:00
|
|
|
import {EnvProperties} from "../utils/properties/env-properties";
|
2020-07-13 00:19:30 +02:00
|
|
|
import {Subscription} from "rxjs";
|
2020-09-15 15:53:18 +02:00
|
|
|
import {properties} from '../../../environments/environment';
|
2021-05-25 00:15:50 +02:00
|
|
|
import {HelperService} from "../utils/helper/helper.service";
|
2017-12-19 13:53:46 +01:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'bottom',
|
2018-04-03 10:39:17 +02:00
|
|
|
templateUrl: 'bottom.component.html'
|
2017-12-19 13:53:46 +01:00
|
|
|
})
|
|
|
|
export class BottomComponent {
|
2022-12-02 12:01:26 +01:00
|
|
|
@Input() showSocialButtons: boolean = true;
|
|
|
|
@Input() showOpenaire: boolean = true;
|
|
|
|
@Input() showMenuItems: boolean = false;
|
|
|
|
@Input() showCommision: boolean = true;
|
|
|
|
@Input() assetsPath: string = 'assets/common-assets/';
|
|
|
|
@Input() menuItems: MenuItem [];
|
|
|
|
@Input() communityId;
|
|
|
|
showPage = {};
|
|
|
|
@Input() grantAdvance: boolean = true;
|
|
|
|
@Input() properties: EnvProperties = properties;
|
|
|
|
@Input() centered: boolean = false;
|
|
|
|
@Input() shortView: boolean = false;
|
|
|
|
@Input() background: string = "uk-tile-default";
|
|
|
|
subs: Subscription[] = [];
|
|
|
|
public divContents = null;
|
|
|
|
|
|
|
|
constructor(private config: ConfigurationService, private route: ActivatedRoute,
|
|
|
|
private helper: HelperService) {
|
2020-04-23 15:21:39 +02:00
|
|
|
}
|
2022-12-02 12:01:26 +01:00
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
if (!properties.footerGrantText) {
|
|
|
|
this.getDivContents();
|
|
|
|
}
|
|
|
|
this.subs.push(this.route.queryParams.subscribe(params => {
|
|
|
|
if (this.showMenuItems) {
|
|
|
|
if (this.properties.adminToolsAPIURL && this.communityId) {
|
|
|
|
//this.subs.push(this.config.getCommunityInformation(this.properties, this.communityId ).subscribe(data => {
|
2023-04-26 13:10:45 +02:00
|
|
|
this.subs.push(this.config.portalAsObservable.subscribe(data => {
|
2022-12-02 12:01:26 +01:00
|
|
|
if (data) {
|
|
|
|
for (var i = 0; i < data['pages'].length; i++) {
|
|
|
|
this.showPage[data['pages'][i]["route"]] = data['pages'][i]["isEnabled"];
|
|
|
|
|
|
|
|
}
|
|
|
|
// console.log(this.showPage)
|
2018-12-07 12:07:19 +01:00
|
|
|
}
|
2022-12-02 12:01:26 +01:00
|
|
|
}));
|
|
|
|
}
|
2018-05-23 15:15:56 +02:00
|
|
|
}
|
2022-12-02 12:01:26 +01:00
|
|
|
}));
|
2020-07-13 00:19:30 +02:00
|
|
|
}
|
2022-12-02 12:01:26 +01:00
|
|
|
|
2020-07-13 00:19:30 +02:00
|
|
|
public ngOnDestroy() {
|
|
|
|
for (let sub of this.subs) {
|
|
|
|
sub.unsubscribe();
|
|
|
|
}
|
2018-05-23 15:15:56 +02:00
|
|
|
}
|
2022-12-02 12:01:26 +01:00
|
|
|
|
|
|
|
isEnabled(required, enabled) {
|
|
|
|
|
|
|
|
if (!required) {
|
2018-05-23 15:15:56 +02:00
|
|
|
return true;
|
|
|
|
}
|
2022-12-02 12:01:26 +01:00
|
|
|
for (let requiredEntity of required) {
|
2018-12-07 12:07:19 +01:00
|
|
|
// console.log("R "+requiredEntity +" E " + enabled[requiredEntity])
|
2022-12-02 12:01:26 +01:00
|
|
|
if (typeof enabled[requiredEntity] === "undefined" || enabled[requiredEntity] == false) {
|
|
|
|
return false;
|
|
|
|
}
|
2018-05-23 15:15:56 +02:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
2022-12-02 12:01:26 +01:00
|
|
|
|
2021-05-25 00:15:50 +02:00
|
|
|
private getDivContents() {
|
2022-12-02 12:01:26 +01:00
|
|
|
let communityId = this.communityId;
|
|
|
|
if (!communityId) {
|
2021-06-04 11:42:23 +02:00
|
|
|
communityId = properties.adminToolsCommunity;
|
2021-05-25 00:15:50 +02:00
|
|
|
}
|
2021-06-04 11:42:23 +02:00
|
|
|
this.subs.push(this.helper.getDivHelpContents(this.properties, communityId, "/").subscribe(contents => {
|
|
|
|
this.divContents = contents;
|
|
|
|
}));
|
2021-05-25 00:15:50 +02:00
|
|
|
}
|
2017-12-19 13:53:46 +01:00
|
|
|
}
|