[Monitor Dashboard | Trunk]: Change Topic, Category, Subcategory options be like Indicator's
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-monitor-portal/trunk/monitor_dashboard@57922 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
84501146e0
commit
e32274548f
|
@ -32,112 +32,31 @@
|
||||||
<div class="menu_title uk-width-expand">
|
<div class="menu_title uk-width-expand">
|
||||||
{{topic.name}}
|
{{topic.name}}
|
||||||
</div>
|
</div>
|
||||||
<span class="uk-width-1-6 onHover"
|
<div class="uk-width-1-6" (click)="$event.stopPropagation();$event.preventDefault()">
|
||||||
(click)="$event.stopPropagation();saveTopicOpen(editTopic, i); $event.preventDefault()">
|
<i class="material-icons onHover">more_vert</i>
|
||||||
<i class="material-icons">more_horiz</i>
|
<div uk-dropdown="mode: click; pos: bottom-right; offset: 5; delay-hide: 0; flip: false"
|
||||||
</span>
|
class="uk-padding-remove-horizontal">
|
||||||
|
<ul class="uk-nav uk-dropdown-nav">
|
||||||
|
<li><a (click)="editTopicOpen(i)">Edit</a></li>
|
||||||
|
<!--<li><a (click)="toggleIndicatorStatus(indicator)">
|
||||||
|
{{indicator.isActive ? 'Deactivate' : 'Activate'}}</a>
|
||||||
|
</li>
|
||||||
|
<li><a (click)="toggleIndicatorAccess(indicator)">
|
||||||
|
{{indicator.isPublic?'Unpublish':'Publish'}}</a>
|
||||||
|
</li>-->
|
||||||
|
<hr class="uk-nav-divider">
|
||||||
|
<li><a (click)="deleteTopicOpen(i)">Delete</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<div uk-drop="mode: none; offset: -2; delay-hide: 0; flip: false" #editTopic
|
|
||||||
class="uk-padding-large uk-padding-remove-vertical uk-padding-remove-right uk-drop">
|
|
||||||
<div *ngIf="topicFb">
|
|
||||||
<div class="md-card">
|
|
||||||
<div class="md-card-content uk-position-relative">
|
|
||||||
<a class="uk-position-top-right">
|
|
||||||
<i (click)="hide(editTopic)" class="material-icons">close</i>
|
|
||||||
</a>
|
|
||||||
<div class="uk-grid-small" uk-grid [formGroup]="topicFb">
|
|
||||||
<div class="uk-width-1-1">
|
|
||||||
<label class="uk-text-bold">Topic Settings</label>
|
|
||||||
<input class="uk-input uk-form-small" formControlName="name"
|
|
||||||
[class.uk-form-danger]="topicFb.get('name').dirty && topicFb.get('name').invalid"
|
|
||||||
type="text">
|
|
||||||
</div>
|
|
||||||
<div class="uk-width-1-1">
|
|
||||||
<label>Description</label>
|
|
||||||
<textarea class="uk-textarea" formControlName="description"
|
|
||||||
rows="3" type="text"></textarea>
|
|
||||||
</div>
|
|
||||||
<div dashboard-input [type]="'select'"
|
|
||||||
[formInput]="topicFb.get('isPublic')" [options]="indicatorUtils.isPublic"
|
|
||||||
label="Privacy" class="uk-width-1-2">
|
|
||||||
</div>
|
|
||||||
<div dashboard-input [type]="'select'"
|
|
||||||
[formInput]="topicFb.get('isActive')" [options]="indicatorUtils.isActive"
|
|
||||||
label="Status" class="uk-width-1-2">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<hr>
|
|
||||||
<div class="uk-grid-small uk-child-width-1-2" uk-grid>
|
|
||||||
<div>
|
|
||||||
<button class="md-btn md-btn-small"
|
|
||||||
(click)="deleteTopicOpen(this.topicFb.value.name, editTopic, i)">Delete</button>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<button class="md-btn md-btn-small md-btn-primary uk-float-right"
|
|
||||||
[class.md-btn-primary]="topicFb.valid && topicFb.dirty"
|
|
||||||
[class.disabled]="topicFb.invalid || !topicFb.dirty"
|
|
||||||
(click)="saveTopic(editTopic, i)">Save
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
</li>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
<li>
|
<li>
|
||||||
<a href="#" (click)="saveTopicOpen(newTopic); $event.preventDefault()">
|
<a href="#" (click)="editTopicOpen(); $event.preventDefault()">
|
||||||
<span class="menu_icon"><i class="material-icons">add</i></span>
|
<span class="menu_icon"><i class="material-icons">add</i></span>
|
||||||
<span class="menu_title">Create new Topic</span>
|
<span class="menu_title">Create new Topic</span>
|
||||||
</a>
|
</a>
|
||||||
<div uk-drop="mode: none; offset: -2; delay-hide: 0" #newTopic
|
|
||||||
class="uk-padding-large uk-padding-remove-vertical uk-padding-remove-right uk-drop">
|
|
||||||
<div *ngIf="topicFb">
|
|
||||||
<div class="md-card">
|
|
||||||
<div class="md-card-content uk-position-relative">
|
|
||||||
<a class="uk-position-top-right">
|
|
||||||
<i (click)="hide(newTopic)" class="material-icons">close</i>
|
|
||||||
</a>
|
|
||||||
<div class="uk-grid-small" uk-grid [formGroup]="topicFb">
|
|
||||||
<div class="uk-width-1-1">
|
|
||||||
<label class="uk-text-bold">New Topic</label>
|
|
||||||
<input class="uk-input uk-form-small" formControlName="name"
|
|
||||||
[class.uk-form-danger]="topicFb.get('name').dirty && topicFb.get('name').invalid"
|
|
||||||
type="text">
|
|
||||||
</div>
|
|
||||||
<div class="uk-width-1-1">
|
|
||||||
<label>Description</label>
|
|
||||||
<textarea class="uk-textarea" formControlName="description"
|
|
||||||
rows="3" type="text"></textarea>
|
|
||||||
</div>
|
|
||||||
<div dashboard-input [type]="'select'"
|
|
||||||
[formInput]="topicFb.get('isPublic')" [options]="indicatorUtils.isPublic"
|
|
||||||
label="Privacy" class="uk-width-1-2">
|
|
||||||
</div>
|
|
||||||
<div dashboard-input [type]="'select'"
|
|
||||||
[formInput]="topicFb.get('isActive')" [options]="indicatorUtils.isActive"
|
|
||||||
label="Status" class="uk-width-1-2">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<hr>
|
|
||||||
<div class="uk-grid-small uk-child-width-1-2" uk-grid>
|
|
||||||
<div>
|
|
||||||
<button class="md-btn md-btn-small" (click)="hide(newTopic)">Cancel</button>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<button class="md-btn md-btn-small uk-float-right"
|
|
||||||
[class.md-btn-primary]="topicFb.valid && topicFb.dirty"
|
|
||||||
[class.disabled]="topicFb.invalid || !topicFb.dirty"
|
|
||||||
(click)="saveTopic(newTopic)">
|
|
||||||
Create
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
@ -188,4 +107,23 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<modal-alert #deleteTopicModal (alertOutput)="deleteTopic()"></modal-alert>
|
<modal-alert #deleteModal (alertOutput)="deleteTopic()">
|
||||||
|
You are about to delete <span class="uk-text-bold" *ngIf="index !== -1">"{{stakeholder.topics[index].name}}"</span> topic permanently.
|
||||||
|
Are you sure you want to proceed?
|
||||||
|
</modal-alert>
|
||||||
|
<modal-alert #editModal (alertOutput)="saveTopic(index)">
|
||||||
|
<div *ngIf="form" class="uk-padding-small" [formGroup]="form">
|
||||||
|
<div dashboard-input class="uk-form-row" [formInput]="form.get('name')" label="Title"></div>
|
||||||
|
<div dashboard-input class="uk-form-row" [formInput]="form.get('description')"
|
||||||
|
label="Description" type="textarea">
|
||||||
|
</div>
|
||||||
|
<div class="uk-form-row uk-flex uk-flex-middle">
|
||||||
|
<div dashboard-input class="uk-width-small" [formInput]="form.get('isPublic')"
|
||||||
|
label="Accessibility" [options]="stakeholderUtils.isPublic" type="select">
|
||||||
|
</div>
|
||||||
|
<div dashboard-input class="uk-margin-small-left uk-width-small" [formInput]="form.get('isActive')"
|
||||||
|
label="Visibility" [options]="stakeholderUtils.isActive" type="select">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</modal-alert>
|
||||||
|
|
|
@ -12,7 +12,7 @@ import {AlertModal} from "../openaireLibrary/utils/modal/alert";
|
||||||
import {Subscriber} from "rxjs";
|
import {Subscriber} from "rxjs";
|
||||||
import {FormBuilder, FormGroup, Validators} from "@angular/forms";
|
import {FormBuilder, FormGroup, Validators} from "@angular/forms";
|
||||||
import {LayoutService} from "../library/sharedComponents/sidebar/layout.service";
|
import {LayoutService} from "../library/sharedComponents/sidebar/layout.service";
|
||||||
import {IndicatorUtils, StakeholderUtils} from "../utils/indicator-utils";
|
import {StakeholderUtils} from "../utils/indicator-utils";
|
||||||
|
|
||||||
declare var UIkit;
|
declare var UIkit;
|
||||||
|
|
||||||
|
@ -27,14 +27,13 @@ export class StakeholderComponent implements OnInit, OnDestroy {
|
||||||
public stakeholder: Stakeholder;
|
public stakeholder: Stakeholder;
|
||||||
public analysisOpen: boolean = true;
|
public analysisOpen: boolean = true;
|
||||||
private errorMessages: ErrorMessagesComponent;
|
private errorMessages: ErrorMessagesComponent;
|
||||||
public topicFb: FormGroup;
|
public form: FormGroup;
|
||||||
public indicatorUtils: IndicatorUtils = new IndicatorUtils();
|
|
||||||
public stakeholderUtils: StakeholderUtils = new StakeholderUtils();
|
public stakeholderUtils: StakeholderUtils = new StakeholderUtils();
|
||||||
public element: any;
|
public index: number = -1;
|
||||||
public index: number;
|
|
||||||
properties: EnvProperties;
|
properties: EnvProperties;
|
||||||
|
|
||||||
@ViewChild('deleteTopicModal') deleteTopicModal: AlertModal;
|
@ViewChild('deleteModal') deleteModal: AlertModal;
|
||||||
|
@ViewChild('editModal') editModal: AlertModal;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
|
@ -54,7 +53,7 @@ export class StakeholderComponent implements OnInit, OnDestroy {
|
||||||
this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
this.subscriptions.push(this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
|
||||||
if (stakeholder) {
|
if (stakeholder) {
|
||||||
this.stakeholder = HelperFunctions.copy(stakeholder);
|
this.stakeholder = HelperFunctions.copy(stakeholder);
|
||||||
this.topicFb = null;
|
this.form = null;
|
||||||
this.title.setTitle(stakeholder.index_name);
|
this.title.setTitle(stakeholder.index_name);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
@ -69,14 +68,6 @@ export class StakeholderComponent implements OnInit, OnDestroy {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public show(element) {
|
|
||||||
UIkit.drop(element).show();
|
|
||||||
}
|
|
||||||
|
|
||||||
public hide(element) {
|
|
||||||
UIkit.drop(element).hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
get open(): boolean {
|
get open(): boolean {
|
||||||
return this.layoutService.open;
|
return this.layoutService.open;
|
||||||
}
|
}
|
||||||
|
@ -91,7 +82,7 @@ export class StakeholderComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
private buildTopic(topic: Topic) {
|
private buildTopic(topic: Topic) {
|
||||||
let topics = this.stakeholder.topics.filter(element => element._id !== topic._id);
|
let topics = this.stakeholder.topics.filter(element => element._id !== topic._id);
|
||||||
this.topicFb = this.fb.group({
|
this.form = this.fb.group({
|
||||||
_id: this.fb.control(topic._id),
|
_id: this.fb.control(topic._id),
|
||||||
name: this.fb.control(topic.name, Validators.required),
|
name: this.fb.control(topic.name, Validators.required),
|
||||||
description: this.fb.control(topic.description),
|
description: this.fb.control(topic.description),
|
||||||
|
@ -105,53 +96,58 @@ export class StakeholderComponent implements OnInit, OnDestroy {
|
||||||
isDefault: this.fb.control(topic.isDefault),
|
isDefault: this.fb.control(topic.isDefault),
|
||||||
categories: this.fb.control(topic.categories)
|
categories: this.fb.control(topic.categories)
|
||||||
});
|
});
|
||||||
this.subscriptions.push(this.topicFb.get('name').valueChanges.subscribe(value => {
|
this.subscriptions.push(this.form.get('name').valueChanges.subscribe(value => {
|
||||||
let i = 1;
|
let i = 1;
|
||||||
value = this.stakeholderUtils.generateAlias(value);
|
value = this.stakeholderUtils.generateAlias(value);
|
||||||
this.topicFb.controls['alias'].setValue(value);
|
this.form.controls['alias'].setValue(value);
|
||||||
while (this.topicFb.get('alias').invalid) {
|
while (this.form.get('alias').invalid) {
|
||||||
this.topicFb.controls['alias'].setValue(value + i);
|
this.form.controls['alias'].setValue(value + i);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
public saveTopicOpen(element, index = -1) {
|
public editTopicOpen(index = -1) {
|
||||||
if (element.className.indexOf('uk-open') !== -1) {
|
this.index = index;
|
||||||
this.hide(element);
|
|
||||||
} else {
|
|
||||||
if (index === -1) {
|
if (index === -1) {
|
||||||
this.buildTopic(new Topic(null, null, null, true, true, false));
|
this.buildTopic(new Topic(null, null, null, true, true, false));
|
||||||
} else {
|
} else {
|
||||||
this.buildTopic(this.stakeholder.topics[index]);
|
this.buildTopic(this.stakeholder.topics[index]);
|
||||||
}
|
}
|
||||||
this.show(element);
|
this.editModal.cancelButtonText = 'Cancel';
|
||||||
}
|
this.editModal.okButtonLeft = false;
|
||||||
}
|
this.editModal.alertMessage = false;
|
||||||
|
|
||||||
public saveTopic(element, index = -1) {
|
|
||||||
if (!this.topicFb.invalid) {
|
|
||||||
if (index === -1) {
|
if (index === -1) {
|
||||||
this.save('Topic has been successfully created', element);
|
this.editModal.alertTitle = 'Create a new topic';
|
||||||
|
this.editModal.okButtonText = 'Create';
|
||||||
} else {
|
} else {
|
||||||
this.save('Topic has been successfully saved', element, index);
|
this.editModal.alertTitle = 'Edit topic\'s information ';
|
||||||
|
this.editModal.okButtonText = 'Save';
|
||||||
|
}
|
||||||
|
this.editModal.open();
|
||||||
|
}
|
||||||
|
|
||||||
|
public saveTopic(index = -1) {
|
||||||
|
if (!this.form.invalid) {
|
||||||
|
if (index === -1) {
|
||||||
|
this.save('Topic has been successfully created');
|
||||||
|
} else {
|
||||||
|
this.save('Topic has been successfully saved', index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public deleteTopicOpen(name: string, element, index: number) {
|
public deleteTopicOpen(index: number) {
|
||||||
this.element = element;
|
|
||||||
this.index = index;
|
this.index = index;
|
||||||
this.deleteTopicModal.alertTitle = 'Delete ' + name;
|
this.deleteModal.alertTitle = 'Delete topic';
|
||||||
this.deleteTopicModal.cancelButtonText = 'No';
|
this.deleteModal.cancelButtonText = 'No';
|
||||||
this.deleteTopicModal.okButtonText = 'Yes';
|
this.deleteModal.okButtonText = 'Yes';
|
||||||
this.deleteTopicModal.message = 'This topic will permanently be deleted. Are you sure you want to proceed?';
|
this.deleteModal.open();
|
||||||
this.deleteTopicModal.open();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private save(message: string, element, index: number = -1) {
|
private save(message: string, index: number = -1) {
|
||||||
let path = [this.stakeholder._id];
|
let path = [this.stakeholder._id];
|
||||||
this.stakeholderService.saveElement(this.properties.monitorServiceAPIURL, this.topicFb.value, path).subscribe(topic => {
|
this.stakeholderService.saveElement(this.properties.monitorServiceAPIURL, this.form.value, path).subscribe(topic => {
|
||||||
if (index === -1) {
|
if (index === -1) {
|
||||||
this.stakeholder.topics.push(topic);
|
this.stakeholder.topics.push(topic);
|
||||||
} else {
|
} else {
|
||||||
|
@ -163,14 +159,12 @@ export class StakeholderComponent implements OnInit, OnDestroy {
|
||||||
timeout: 3000,
|
timeout: 3000,
|
||||||
pos: 'top-left'
|
pos: 'top-left'
|
||||||
});
|
});
|
||||||
this.hide(element);
|
|
||||||
}, error => {
|
}, error => {
|
||||||
UIkit.notification(error.error.message, {
|
UIkit.notification(error.error.message, {
|
||||||
status: 'danger',
|
status: 'danger',
|
||||||
timeout: 3000,
|
timeout: 3000,
|
||||||
pos: 'top-left'
|
pos: 'top-left'
|
||||||
});
|
});
|
||||||
this.hide(element);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,14 +181,12 @@ export class StakeholderComponent implements OnInit, OnDestroy {
|
||||||
timeout: 3000,
|
timeout: 3000,
|
||||||
pos: 'top-left'
|
pos: 'top-left'
|
||||||
});
|
});
|
||||||
this.hide(this.element);
|
|
||||||
}, error => {
|
}, error => {
|
||||||
UIkit.notification(error.error.message, {
|
UIkit.notification(error.error.message, {
|
||||||
status: 'danger',
|
status: 'danger',
|
||||||
timeout: 3000,
|
timeout: 3000,
|
||||||
pos: 'top-left'
|
pos: 'top-left'
|
||||||
});
|
});
|
||||||
this.hide(this.element);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@
|
||||||
<li><a (click)="toggleIndicatorAccess(indicator)">
|
<li><a (click)="toggleIndicatorAccess(indicator)">
|
||||||
{{indicator.isPublic?'Unpublish':'Publish'}}</a>
|
{{indicator.isPublic?'Unpublish':'Publish'}}</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="uk-nav-divider"></li>
|
<hr class="uk-nav-divider">
|
||||||
<li><a (click)="deleteIndicatorOpen(indicator._id, 'number')">Delete</a>
|
<li><a (click)="deleteIndicatorOpen(indicator._id, 'number')">Delete</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -160,7 +160,7 @@
|
||||||
<li><a (click)="toggleIndicatorAccess(indicator)">
|
<li><a (click)="toggleIndicatorAccess(indicator)">
|
||||||
{{indicator.isPublic?'Unpublish':'Publish'}}</a>
|
{{indicator.isPublic?'Unpublish':'Publish'}}</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="uk-nav-divider"></li>
|
<hr class="uk-nav-divider">
|
||||||
<li><a (click)="deleteIndicatorOpen(indicator._id)">Delete</a></li>
|
<li><a (click)="deleteIndicatorOpen(indicator._id)">Delete</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -230,7 +230,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<modal-alert #editIndicatorModal
|
<modal-alert #editModal
|
||||||
[classBody]="'large-modal'"
|
[classBody]="'large-modal'"
|
||||||
(alertOutput)="saveIndicator()"
|
(alertOutput)="saveIndicator()"
|
||||||
[okDisabled]="indicatorFb && (indicatorFb.invalid || indicatorFb.pristine)">
|
[okDisabled]="indicatorFb && (indicatorFb.invalid || indicatorFb.pristine)">
|
||||||
|
@ -318,4 +318,8 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</modal-alert>
|
</modal-alert>
|
||||||
<modal-alert #deleteIndicatorModal (alertOutput)="deleteIndicator()"></modal-alert>
|
<modal-alert #deleteModal (alertOutput)="deleteIndicator()">
|
||||||
|
You are about to delete <span class="uk-text-bold" *ngIf="indicator && index !== -1">
|
||||||
|
"{{indicator.name?indicator.name:indicator.indicatorPaths[0].parameters.title}}"</span> indicator permanently.
|
||||||
|
Are you sure you want to proceed?
|
||||||
|
</modal-alert>
|
||||||
|
|
|
@ -35,7 +35,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
||||||
* Editable indicator
|
* Editable indicator
|
||||||
*/
|
*/
|
||||||
public indicator: Indicator;
|
public indicator: Indicator;
|
||||||
public index: number;
|
public index: number = -1;
|
||||||
/**
|
/**
|
||||||
* Displayed chart and numbers base on Top filters
|
* Displayed chart and numbers base on Top filters
|
||||||
*/
|
*/
|
||||||
|
@ -55,8 +55,8 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
||||||
public grid: boolean = true;
|
public grid: boolean = true;
|
||||||
private subscriptions: any[] = [];
|
private subscriptions: any[] = [];
|
||||||
private urlSubscriptions: any[] = [];
|
private urlSubscriptions: any[] = [];
|
||||||
@ViewChild('editIndicatorModal') editIndicatorModal: AlertModal;
|
@ViewChild('editModal') editModal: AlertModal;
|
||||||
@ViewChild('deleteIndicatorModal') deleteIndicatorModal: AlertModal;
|
@ViewChild('deleteModal') deleteModal: AlertModal;
|
||||||
|
|
||||||
constructor(private layoutService: LayoutService,
|
constructor(private layoutService: LayoutService,
|
||||||
private stakeholderService: StakeholderService,
|
private stakeholderService: StakeholderService,
|
||||||
|
@ -320,6 +320,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.index = (id) ? this.charts.findIndex(value => value._id === id) : -1;
|
this.index = (id) ? this.charts.findIndex(value => value._id === id) : -1;
|
||||||
|
console.log(this.index);
|
||||||
if (this.index !== -1) {
|
if (this.index !== -1) {
|
||||||
this.indicator = HelperFunctions.copy(this.charts[this.index]);
|
this.indicator = HelperFunctions.copy(this.charts[this.index]);
|
||||||
this.indicatorFb = this.fb.group({
|
this.indicatorFb = this.fb.group({
|
||||||
|
@ -348,16 +349,17 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
||||||
});
|
});
|
||||||
this.addIndicatorPath();
|
this.addIndicatorPath();
|
||||||
}
|
}
|
||||||
this.editIndicatorModal.cancelButtonText = 'Cancel';
|
this.editModal.cancelButtonText = 'Cancel';
|
||||||
this.editIndicatorModal.okButtonLeft = false;
|
this.editModal.okButtonLeft = false;
|
||||||
this.editIndicatorModal.alertMessage = false;
|
this.editModal.alertMessage = false;
|
||||||
if (this.index === -1) {
|
if (this.index === -1) {
|
||||||
this.editIndicatorModal.alertTitle = 'Create a new chart Indicator';
|
this.editModal.alertTitle = 'Create a new chart indicator';
|
||||||
this.editIndicatorModal.okButtonText = 'Save';
|
this.editModal.okButtonText = 'Save';
|
||||||
} else {
|
} else {
|
||||||
this.editIndicatorModal.okButtonText = 'Save Changes';
|
this.editModal.alertTitle = 'Edit chart indicator\'s information';
|
||||||
|
this.editModal.okButtonText = 'Save Changes';
|
||||||
}
|
}
|
||||||
this.editIndicatorModal.open();
|
this.editModal.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
saveIndicator() {
|
saveIndicator() {
|
||||||
|
@ -428,11 +430,10 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV
|
||||||
} else {
|
} else {
|
||||||
this.indicator = this.numbers.find(value => value._id == id);
|
this.indicator = this.numbers.find(value => value._id == id);
|
||||||
}
|
}
|
||||||
this.deleteIndicatorModal.alertTitle = 'Delete ' + this.indicator.name;
|
this.deleteModal.alertTitle = 'Delete indicator';
|
||||||
this.deleteIndicatorModal.cancelButtonText = 'No';
|
this.deleteModal.cancelButtonText = 'No';
|
||||||
this.deleteIndicatorModal.okButtonText = 'Yes';
|
this.deleteModal.okButtonText = 'Yes';
|
||||||
this.deleteIndicatorModal.message = 'This indicator will permanently be deleted. Are you sure you want to proceed?';
|
this.deleteModal.open();
|
||||||
this.deleteIndicatorModal.open();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteIndicator() {
|
deleteIndicator() {
|
||||||
|
|
|
@ -14,123 +14,56 @@
|
||||||
<div class="menu_title uk-width-expand">
|
<div class="menu_title uk-width-expand">
|
||||||
{{stakeholder.topics[topicIndex].name.toUpperCase()}}
|
{{stakeholder.topics[topicIndex].name.toUpperCase()}}
|
||||||
</div>
|
</div>
|
||||||
<span class="uk-width-1-6 onHover"
|
<div class="uk-width-1-6"
|
||||||
(click)="$event.stopPropagation();editTopicOpen(editTopic);$event.preventDefault()">
|
(click)="$event.stopPropagation();$event.preventDefault()">
|
||||||
<i class="material-icons md-color-white">more_horiz</i>
|
<i class="material-icons onHover md-color-white">more_vert</i>
|
||||||
</span>
|
<div uk-dropdown="mode: click; pos: bottom-right; offset: 5; delay-hide: 0; flip: false"
|
||||||
|
class="uk-padding-remove-horizontal">
|
||||||
|
<ul class="uk-nav uk-dropdown-nav">
|
||||||
|
<li><a (click)="editTopicOpen()">Edit</a></li>
|
||||||
|
<!--<li><a (click)="toggleIndicatorStatus(indicator)">
|
||||||
|
{{indicator.isActive ? 'Deactivate' : 'Activate'}}</a>
|
||||||
|
</li>
|
||||||
|
<li><a (click)="toggleIndicatorAccess(indicator)">
|
||||||
|
{{indicator.isPublic?'Unpublish':'Publish'}}</a>
|
||||||
|
</li>-->
|
||||||
|
<hr class="uk-nav-divider">
|
||||||
|
<li><a (click)="deleteTopicOpen()">Delete</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<div uk-drop="mode: none; offset: -2; delay-hide: 0;" #editTopic
|
|
||||||
class="uk-padding-large uk-padding-remove-vertical uk-padding-remove-right uk-drop">
|
|
||||||
<div *ngIf="topicFb">
|
|
||||||
<div class="md-card">
|
|
||||||
<div class="md-card-content uk-position-relative">
|
|
||||||
<a class="uk-position-top-right">
|
|
||||||
<i (click)="hide(editTopic)" class="material-icons">close</i>
|
|
||||||
</a>
|
|
||||||
<div class="uk-grid-small" uk-grid [formGroup]="topicFb">
|
|
||||||
<div class="uk-width-1-1">
|
|
||||||
<label class="uk-text-bold">Topic Settings</label>
|
|
||||||
<input class="uk-input uk-form-small" formControlName="name"
|
|
||||||
[class.uk-form-danger]="topicFb.get('name').dirty && topicFb.get('name').invalid"
|
|
||||||
type="text">
|
|
||||||
</div>
|
|
||||||
<div class="uk-width-1-1">
|
|
||||||
<label>Description</label>
|
|
||||||
<textarea class="uk-textarea" formControlName="description"
|
|
||||||
rows="3" type="text"></textarea>
|
|
||||||
</div>
|
|
||||||
<div dashboard-input [type]="'select'"
|
|
||||||
[formInput]="topicFb.get('isPublic')" [options]="indicatorUtils.isPublic"
|
|
||||||
label="Privacy" class="uk-width-1-2">
|
|
||||||
</div>
|
|
||||||
<div dashboard-input [type]="'select'"
|
|
||||||
[formInput]="topicFb.get('isActive')" [options]="indicatorUtils.isActive"
|
|
||||||
label="Status" class="uk-width-1-2">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<hr>
|
|
||||||
<div class="uk-grid-small uk-child-width-1-2" uk-grid>
|
|
||||||
<div>
|
|
||||||
<button class="md-btn md-btn-small"
|
|
||||||
(click)="deleteTopicOpen(topicFb.value.name, editTopic)">Delete</button>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<button class="md-btn md-btn-small md-btn-primary uk-float-right"
|
|
||||||
[class.md-btn-primary]="topicFb.valid && topicFb.dirty"
|
|
||||||
[class.disabled]="topicFb.invalid || !topicFb.dirty"
|
|
||||||
(click)="saveTopic(editTopic)">Save
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
</li>
|
||||||
<ng-template ngFor [ngForOf]="stakeholder.topics[topicIndex].categories" let-category let-i="index">
|
<ng-template ngFor [ngForOf]="stakeholder.topics[topicIndex].categories" let-category let-i="index">
|
||||||
<li [class.current_section]="categoryIndex === i"
|
<li [class.current_section]="categoryIndex === i"
|
||||||
[class.act_section]="selectedCategoryIndex === i && toggle"
|
[class.act_section]="selectedCategoryIndex === i && toggle"
|
||||||
[title]="category.name"
|
[title]="category.name"
|
||||||
class="submenu_trigger">
|
class="submenu_trigger">
|
||||||
<a href="#" (click)="toggleCategory(i);hide(editCategory);$event.preventDefault()">
|
<a href="#" (click)="toggleCategory(i);$event.preventDefault()">
|
||||||
<span *ngIf="category.icon" class="menu_icon"><i
|
<span *ngIf="category.icon" class="menu_icon"><i
|
||||||
class="material-icons">{{category.icon}}</i></span>
|
class="material-icons">{{category.icon}}</i></span>
|
||||||
<div class="menu_title uk-width-expand">
|
<div class="menu_title uk-width-expand">
|
||||||
{{category.name}}
|
{{category.name}}
|
||||||
</div>
|
</div>
|
||||||
<span class="uk-width-1-6 onHover"
|
<div class="uk-width-1-6"
|
||||||
(click)="$event.stopPropagation();editCategoryOpen(editCategory, i);$event.preventDefault()">
|
(click)="$event.stopPropagation();$event.preventDefault()">
|
||||||
<i class="material-icons">more_horiz</i>
|
<i class="material-icons onHover">more_vert</i>
|
||||||
</span>
|
<div uk-dropdown="mode: click; pos: bottom-right; offset: 5; delay-hide: 0; flip: false"
|
||||||
|
class="uk-padding-remove-horizontal">
|
||||||
|
<ul class="uk-nav uk-dropdown-nav">
|
||||||
|
<li><a (click)="editCategoryOpen(i)">Edit</a></li>
|
||||||
|
<!--<li><a (click)="toggleIndicatorStatus(indicator)">
|
||||||
|
{{indicator.isActive ? 'Deactivate' : 'Activate'}}</a>
|
||||||
|
</li>
|
||||||
|
<li><a (click)="toggleIndicatorAccess(indicator)">
|
||||||
|
{{indicator.isPublic?'Unpublish':'Publish'}}</a>
|
||||||
|
</li>-->
|
||||||
|
<hr class="uk-nav-divider">
|
||||||
|
<li><a (click)="deleteCategoryOpen(i)">Delete</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<div uk-drop="mode: none; offset: -2; delay-hide: 0;" #editCategory
|
|
||||||
class="uk-padding-large uk-padding-remove-vertical uk-padding-remove-right uk-drop">
|
|
||||||
<div *ngIf="categoryFb">
|
|
||||||
<div class="md-card">
|
|
||||||
<div class="md-card-content uk-position-relative">
|
|
||||||
<a class="uk-position-top-right">
|
|
||||||
<i (click)="hide(editCategory)" class="material-icons">close</i>
|
|
||||||
</a>
|
|
||||||
<div class="uk-grid-small" uk-grid [formGroup]="categoryFb">
|
|
||||||
<div class="uk-width-1-1">
|
|
||||||
<label class="uk-text-bold">Category Settings</label>
|
|
||||||
<input class="uk-input uk-form-small" formControlName="name"
|
|
||||||
[class.uk-form-danger]="categoryFb.get('name').dirty && categoryFb.get('name').invalid"
|
|
||||||
type="text">
|
|
||||||
</div>
|
|
||||||
<div class="uk-width-1-1">
|
|
||||||
<label>Description</label>
|
|
||||||
<textarea class="uk-textarea" formControlName="description"
|
|
||||||
rows="3" type="text"></textarea>
|
|
||||||
</div>
|
|
||||||
<div dashboard-input [type]="'select'"
|
|
||||||
[formInput]="categoryFb.get('isPublic')" [options]="indicatorUtils.isPublic"
|
|
||||||
label="Privacy" class="uk-width-1-2">
|
|
||||||
</div>
|
|
||||||
<div dashboard-input [type]="'select'"
|
|
||||||
[formInput]="categoryFb.get('isActive')" [options]="indicatorUtils.isActive"
|
|
||||||
label="Status" class="uk-width-1-2">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<hr>
|
|
||||||
<div class="uk-grid-small uk-child-width-1-2" uk-grid>
|
|
||||||
<div>
|
|
||||||
<button class="md-btn md-btn-small"
|
|
||||||
(click)="deleteCategoryOpen(categoryFb.value.name, editCategory, i)">Delete
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<button class="md-btn md-btn-small md-btn-primary uk-float-right"
|
|
||||||
[class.md-btn-primary]="categoryFb.valid && categoryFb.dirty"
|
|
||||||
[class.disabled]="categoryFb.invalid || !categoryFb.dirty"
|
|
||||||
(click)="saveCategory(editCategory, i)">Save
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<ul [style.display]="((selectedCategoryIndex === i && toggle)?'block':'none')">
|
<ul [style.display]="((selectedCategoryIndex === i && toggle)?'block':'none')">
|
||||||
<ng-template ngFor [ngForOf]="stakeholder.topics[topicIndex].categories[i].subCategories"
|
<ng-template ngFor [ngForOf]="stakeholder.topics[topicIndex].categories[i].subCategories"
|
||||||
let-subcategory let-j="index">
|
let-subcategory let-j="index">
|
||||||
|
@ -141,167 +74,41 @@
|
||||||
<div class="menu_title uk-width-expand">
|
<div class="menu_title uk-width-expand">
|
||||||
{{subcategory.name}}
|
{{subcategory.name}}
|
||||||
</div>
|
</div>
|
||||||
<span class="uk-width-1-6 onHover"
|
<div class="uk-width-1-6"
|
||||||
(click)="$event.stopPropagation();editSubCategoryOpen(editSubCategory, j);$event.preventDefault()">
|
(click)="$event.stopPropagation();$event.preventDefault()">
|
||||||
<i class="material-icons">more_horiz</i>
|
<i class="material-icons onHover">more_vert</i>
|
||||||
</span>
|
<div uk-dropdown="mode: click; pos: bottom-right; offset: 5; delay-hide: 0; flip: false"
|
||||||
|
class="uk-padding-remove-horizontal">
|
||||||
|
<ul class="uk-nav uk-dropdown-nav">
|
||||||
|
<li><a (click)="editSubCategoryOpen(j)">Edit</a></li>
|
||||||
|
<!--<li><a (click)="toggleIndicatorStatus(indicator)">
|
||||||
|
{{indicator.isActive ? 'Deactivate' : 'Activate'}}</a>
|
||||||
|
</li>
|
||||||
|
<li><a (click)="toggleIndicatorAccess(indicator)">
|
||||||
|
{{indicator.isPublic?'Unpublish':'Publish'}}</a>
|
||||||
|
</li>-->
|
||||||
|
<hr class="uk-nav-divider">
|
||||||
|
<li><a (click)="deleteSubcategoryOpen(j)">Delete</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<div uk-drop="mode: none; offset: -2; delay-hide: 0" #editSubCategory
|
|
||||||
class="uk-padding-large uk-padding-remove-vertical uk-padding-remove-right uk-drop">
|
|
||||||
<div *ngIf="subcategoryFb">
|
|
||||||
<div class="md-card">
|
|
||||||
<div class="md-card-content uk-position-relative">
|
|
||||||
<a class="uk-position-top-right">
|
|
||||||
<i (click)="hide(editSubCategory)" class="material-icons">close</i>
|
|
||||||
</a>
|
|
||||||
<div class="uk-grid-small" uk-grid [formGroup]="subcategoryFb">
|
|
||||||
<div class="uk-width-1-1">
|
|
||||||
<label class="uk-text-bold">Subcategory Settings</label>
|
|
||||||
<input class="uk-input uk-form-small" formControlName="name"
|
|
||||||
[class.uk-form-danger]="subcategoryFb.get('name').dirty && subcategoryFb.get('name').invalid"
|
|
||||||
type="text">
|
|
||||||
</div>
|
|
||||||
<div class="uk-width-1-1">
|
|
||||||
<label>Description</label>
|
|
||||||
<textarea class="uk-textarea" formControlName="description"
|
|
||||||
rows="3" type="text"></textarea>
|
|
||||||
</div>
|
|
||||||
<div dashboard-input [type]="'select'"
|
|
||||||
[formInput]="subcategoryFb.get('isPublic')" [options]="indicatorUtils.isPublic"
|
|
||||||
label="Privacy" class="uk-width-1-2">
|
|
||||||
</div>
|
|
||||||
<div dashboard-input [type]="'select'"
|
|
||||||
[formInput]="subcategoryFb.get('isActive')" [options]="indicatorUtils.isActive"
|
|
||||||
label="Status" class="uk-width-1-2">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<hr>
|
|
||||||
<div class="uk-grid-small uk-child-width-1-2" uk-grid>
|
|
||||||
<div>
|
|
||||||
<button class="md-btn md-btn-small"
|
|
||||||
(click)="deleteSubcategoryOpen(subcategoryFb.value.name, editSubCategory, j)">Delete
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<button class="md-btn md-btn-small md-btn-primary uk-float-right"
|
|
||||||
[class.md-btn-primary]="subcategoryFb.valid && subcategoryFb.dirty"
|
|
||||||
[class.disabled]="subcategoryFb.invalid || !subcategoryFb.dirty"
|
|
||||||
(click)="saveSubCategory(editSubCategory, j)">Save
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
</li>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
<li>
|
<li>
|
||||||
<a href="#" (click)="editSubCategoryOpen(newSubCategory);$event.preventDefault()">
|
<a href="#" (click)="editSubCategoryOpen();$event.preventDefault()">
|
||||||
<span class="menu_icon"><i class="material-icons">add</i></span>
|
<span class="menu_icon"><i class="material-icons">add</i></span>
|
||||||
<span class="menu_title">Create new Subcategory</span>
|
<span class="menu_title">Create new Subcategory</span>
|
||||||
</a>
|
</a>
|
||||||
<div uk-drop="mode: none; offset: -2; delay-hide: 0" #newSubCategory
|
|
||||||
class="uk-padding-large uk-padding-remove-vertical uk-padding-remove-right uk-drop">
|
|
||||||
<div *ngIf="subcategoryFb">
|
|
||||||
<div class="md-card">
|
|
||||||
<div class="md-card-content uk-position-relative">
|
|
||||||
<a class="uk-position-top-right">
|
|
||||||
<i (click)="hide(newSubCategory)" class="material-icons">close</i>
|
|
||||||
</a>
|
|
||||||
<div class="uk-grid-small" uk-grid [formGroup]="subcategoryFb">
|
|
||||||
<div class="uk-width-1-1">
|
|
||||||
<label class="uk-text-bold">New Subcategory</label>
|
|
||||||
<input class="uk-input uk-form-small" formControlName="name"
|
|
||||||
[class.uk-form-danger]="subcategoryFb.get('name').dirty && subcategoryFb.get('name').invalid"
|
|
||||||
type="text">
|
|
||||||
</div>
|
|
||||||
<div class="uk-width-1-1">
|
|
||||||
<label>Description</label>
|
|
||||||
<textarea class="uk-textarea" formControlName="description"
|
|
||||||
rows="3" type="text"></textarea>
|
|
||||||
</div>
|
|
||||||
<div dashboard-input [type]="'select'"
|
|
||||||
[formInput]="subcategoryFb.get('isPublic')" [options]="indicatorUtils.isPublic"
|
|
||||||
label="Privacy" class="uk-width-1-2">
|
|
||||||
</div>
|
|
||||||
<div dashboard-input [type]="'select'"
|
|
||||||
[formInput]="subcategoryFb.get('isActive')" [options]="indicatorUtils.isActive"
|
|
||||||
label="Status" class="uk-width-1-2">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<hr>
|
|
||||||
<div class="uk-grid-small uk-child-width-1-2" uk-grid>
|
|
||||||
<div>
|
|
||||||
<button class="md-btn md-btn-small" (click)="hide(newSubCategory)">Cancel</button>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<button class="md-btn md-btn-small md-btn-primary uk-float-right"
|
|
||||||
[class.md-btn-primary]="subcategoryFb.valid && subcategoryFb.dirty"
|
|
||||||
[class.disabled]="subcategoryFb.invalid || !subcategoryFb.dirty"
|
|
||||||
(click)="saveSubCategory(newSubCategory)">Create
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
<li>
|
<li>
|
||||||
<a href="#" (click)="editCategoryOpen(newCategory);$event.preventDefault()">
|
<a href="#" (click)="editCategoryOpen();$event.preventDefault()">
|
||||||
<span class="menu_icon"><i class="material-icons">add</i></span>
|
<span class="menu_icon"><i class="material-icons">add</i></span>
|
||||||
<span class="menu_title">Create new Category</span>
|
<span class="menu_title">Create new Category</span>
|
||||||
</a>
|
</a>
|
||||||
<div uk-drop="mode: none; offset: -2; delay-hide: 0" #newCategory
|
|
||||||
class="uk-padding-large uk-padding-remove-vertical uk-padding-remove-right uk-drop">
|
|
||||||
<div *ngIf="categoryFb">
|
|
||||||
<div class="md-card">
|
|
||||||
<div class="md-card-content uk-position-relative">
|
|
||||||
<a class="uk-position-top-right">
|
|
||||||
<i (click)="hide(newCategory)" class="material-icons">close</i>
|
|
||||||
</a>
|
|
||||||
<div class="uk-grid-small" uk-grid [formGroup]="categoryFb">
|
|
||||||
<div class="uk-width-1-1">
|
|
||||||
<label class="uk-text-bold">New Category</label>
|
|
||||||
<input class="uk-input uk-form-small" formControlName="name"
|
|
||||||
[class.uk-form-danger]="categoryFb.get('name').dirty && categoryFb.get('name').invalid"
|
|
||||||
type="text">
|
|
||||||
</div>
|
|
||||||
<div class="uk-width-1-1">
|
|
||||||
<label>Description</label>
|
|
||||||
<textarea class="uk-textarea" formControlName="description"
|
|
||||||
rows="3" type="text"></textarea>
|
|
||||||
</div>
|
|
||||||
<div dashboard-input [type]="'select'"
|
|
||||||
[formInput]="categoryFb.get('isPublic')" [options]="indicatorUtils.isPublic"
|
|
||||||
label="Privacy" class="uk-width-1-2">
|
|
||||||
</div>
|
|
||||||
<div dashboard-input [type]="'select'"
|
|
||||||
[formInput]="categoryFb.get('isActive')" [options]="indicatorUtils.isActive"
|
|
||||||
label="Status" class="uk-width-1-2">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<hr>
|
|
||||||
<div class="uk-grid-small uk-child-width-1-2" uk-grid>
|
|
||||||
<div>
|
|
||||||
<button class="md-btn md-btn-small" (click)="hide(newCategory)">Cancel</button>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<button class="md-btn md-btn-small md-btn-primary uk-float-right"
|
|
||||||
[class.md-btn-primary]="categoryFb.valid && categoryFb.dirty"
|
|
||||||
[class.disabled]="categoryFb.invalid || !categoryFb.dirty"
|
|
||||||
(click)="saveCategory(newCategory)">Create
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
@ -311,7 +118,24 @@
|
||||||
[topicIndex]="topicIndex"
|
[topicIndex]="topicIndex"
|
||||||
[categoryIndex]="categoryIndex"
|
[categoryIndex]="categoryIndex"
|
||||||
[subcategoryIndex]="subCategoryIndex"></indicators>
|
[subcategoryIndex]="subCategoryIndex"></indicators>
|
||||||
<modal-alert #deleteTopicModal (alertOutput)="deleteTopic()"></modal-alert>
|
<modal-alert #deleteModal (alertOutput)="deleteElement()">
|
||||||
<modal-alert #deleteCategoryModal (alertOutput)="deleteCategory()"></modal-alert>
|
You are about to delete <span class="uk-text-bold" *ngIf="element">"{{element.name}}"</span> {{type}} permanently.
|
||||||
<modal-alert #deleteSubcategoryModal (alertOutput)="deleteSubcategory()"></modal-alert>
|
Are you sure you want to proceed?
|
||||||
|
</modal-alert>
|
||||||
|
<modal-alert #editModal (alertOutput)="saveElement()">
|
||||||
|
<div *ngIf="form" class="uk-padding-small" [formGroup]="form">
|
||||||
|
<div dashboard-input class="uk-form-row" [formInput]="form.get('name')" label="Title"></div>
|
||||||
|
<div dashboard-input class="uk-form-row" [formInput]="form.get('description')"
|
||||||
|
label="Description" type="textarea">
|
||||||
|
</div>
|
||||||
|
<div class="uk-form-row uk-flex uk-flex-middle">
|
||||||
|
<div dashboard-input class="uk-width-small" [formInput]="form.get('isPublic')"
|
||||||
|
label="Accessibility" [options]="stakeholderUtils.isPublic" type="select">
|
||||||
|
</div>
|
||||||
|
<div dashboard-input class="uk-margin-small-left uk-width-small" [formInput]="form.get('isActive')"
|
||||||
|
label="Visibility" [options]="stakeholderUtils.isActive" type="select">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</modal-alert>
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import {HelperFunctions} from "../openaireLibrary/utils/HelperFunctions.class";
|
||||||
import {AlertModal} from "../openaireLibrary/utils/modal/alert";
|
import {AlertModal} from "../openaireLibrary/utils/modal/alert";
|
||||||
import {Subscriber, Subscription} from "rxjs";
|
import {Subscriber, Subscription} from "rxjs";
|
||||||
import {FormBuilder, FormGroup, Validators} from "@angular/forms";
|
import {FormBuilder, FormGroup, Validators} from "@angular/forms";
|
||||||
import {IndicatorUtils, StakeholderUtils} from "../utils/indicator-utils";
|
import {StakeholderUtils} from "../utils/indicator-utils";
|
||||||
|
|
||||||
declare var UIkit;
|
declare var UIkit;
|
||||||
|
|
||||||
|
@ -19,7 +19,6 @@ declare var UIkit;
|
||||||
export class TopicComponent implements OnInit, OnDestroy {
|
export class TopicComponent implements OnInit, OnDestroy {
|
||||||
public subscriptions: any[] = [];
|
public subscriptions: any[] = [];
|
||||||
public properties: EnvProperties;
|
public properties: EnvProperties;
|
||||||
public indicatorUtils: IndicatorUtils = new IndicatorUtils();
|
|
||||||
public stakeholderUtils: StakeholderUtils = new StakeholderUtils();
|
public stakeholderUtils: StakeholderUtils = new StakeholderUtils();
|
||||||
public loading: boolean = true;
|
public loading: boolean = true;
|
||||||
public stakeholder: Stakeholder;
|
public stakeholder: Stakeholder;
|
||||||
|
@ -27,32 +26,29 @@ export class TopicComponent implements OnInit, OnDestroy {
|
||||||
* Current topic
|
* Current topic
|
||||||
**/
|
**/
|
||||||
public topicIndex: number = 0;
|
public topicIndex: number = 0;
|
||||||
public topicFb: FormGroup;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* categoryIndex: Current category to be edited, selectedCategoryIndex: selected on menu(opened)
|
* categoryIndex: Current category to be edited, selectedCategoryIndex: selected on menu(opened)
|
||||||
*/
|
*/
|
||||||
public categoryIndex: number = 0;
|
public categoryIndex: number = 0;
|
||||||
public selectedCategoryIndex: number = 0;
|
public selectedCategoryIndex: number = 0;
|
||||||
public categoryFb: FormGroup;
|
|
||||||
/**
|
/**
|
||||||
* Current Subcategory to be edited
|
* Current Subcategory to be edited
|
||||||
*/
|
*/
|
||||||
public subCategoryIndex: number = 0;
|
public subCategoryIndex: number = 0;
|
||||||
public subcategoryFb: FormGroup;
|
|
||||||
/**
|
/**
|
||||||
* Current drop element and index of topic, category or subcategory to be deleted.
|
* Current element and index of topic, category or subcategory to be deleted.
|
||||||
*/
|
*/
|
||||||
public element: any;
|
public form: FormGroup;
|
||||||
public index: number;
|
public element: Topic | Category | SubCategory;
|
||||||
|
public type: 'topic' | 'category' | 'subcategory' = "topic";
|
||||||
|
public index: number = -1;
|
||||||
/**
|
/**
|
||||||
* Check form validity
|
* Check form validity
|
||||||
*/
|
*/
|
||||||
public toggle: boolean = false;
|
public toggle: boolean = false;
|
||||||
|
|
||||||
@ViewChild('deleteTopicModal') deleteTopicModal: AlertModal;
|
@ViewChild('deleteModal') deleteModal: AlertModal;
|
||||||
@ViewChild('deleteCategoryModal') deleteCategoryModal: AlertModal;
|
@ViewChild('editModal') editModal: AlertModal;
|
||||||
@ViewChild('deleteSubcategoryModal') deleteSubcategoryModal: AlertModal;
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
|
@ -96,17 +92,29 @@ export class TopicComponent implements OnInit, OnDestroy {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public hide(element) {
|
public saveElement() {
|
||||||
UIkit.drop(element).hide();
|
if(this.type === "topic") {
|
||||||
|
this.saveTopic();
|
||||||
|
} else if(this.type === "category") {
|
||||||
|
this.saveCategory();
|
||||||
|
} else {
|
||||||
|
this.saveSubCategory();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public show(element) {
|
public deleteElement() {
|
||||||
UIkit.drop(element).show();
|
if(this.type === "topic") {
|
||||||
|
this.deleteTopic();
|
||||||
|
} else if(this.type === "category") {
|
||||||
|
this.deleteCategory();
|
||||||
|
} else {
|
||||||
|
this.deleteSubcategory();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private buildTopic(topic: Topic) {
|
private buildTopic(topic: Topic) {
|
||||||
let topics = this.stakeholder.topics.filter(element => element._id !== topic._id);
|
let topics = this.stakeholder.topics.filter(element => element._id !== topic._id);
|
||||||
this.topicFb = this.fb.group({
|
this.form = this.fb.group({
|
||||||
_id: this.fb.control(topic._id),
|
_id: this.fb.control(topic._id),
|
||||||
name: this.fb.control(topic.name, Validators.required),
|
name: this.fb.control(topic.name, Validators.required),
|
||||||
description: this.fb.control(topic.description),
|
description: this.fb.control(topic.description),
|
||||||
|
@ -120,48 +128,49 @@ export class TopicComponent implements OnInit, OnDestroy {
|
||||||
isDefault: this.fb.control(topic.isDefault),
|
isDefault: this.fb.control(topic.isDefault),
|
||||||
categories: this.fb.control(topic.categories)
|
categories: this.fb.control(topic.categories)
|
||||||
});
|
});
|
||||||
this.subscriptions.push(this.topicFb.get('name').valueChanges.subscribe(value => {
|
this.subscriptions.push(this.form.get('name').valueChanges.subscribe(value => {
|
||||||
let i = 1;
|
let i = 1;
|
||||||
value = this.stakeholderUtils.generateAlias(value);
|
value = this.stakeholderUtils.generateAlias(value);
|
||||||
this.topicFb.controls['alias'].setValue(value);
|
this.form.controls['alias'].setValue(value);
|
||||||
while (this.topicFb.get('alias').invalid) {
|
while (this.form.get('alias').invalid) {
|
||||||
this.topicFb.controls['alias'].setValue(value + i);
|
this.form.controls['alias'].setValue(value + i);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
public editTopicOpen(element) {
|
public editTopicOpen() {
|
||||||
if (element.className.indexOf('uk-open') !== -1) {
|
this.index = this.topicIndex;
|
||||||
this.hide(element);
|
this.type = 'topic';
|
||||||
} else {
|
this.buildTopic(this.stakeholder.topics[this.index]);
|
||||||
this.buildTopic(this.stakeholder.topics[this.topicIndex]);
|
this.editOpen();
|
||||||
this.show(element);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public saveTopic(element) {
|
public saveTopic() {
|
||||||
if (!this.topicFb.invalid) {
|
if (!this.form.invalid) {
|
||||||
let path = [this.stakeholder._id];
|
let path = [this.stakeholder._id];
|
||||||
let callback = (topic: Topic): void => {
|
let callback = (topic: Topic): void => {
|
||||||
this.stakeholder.topics[this.topicIndex] = topic;
|
this.stakeholder.topics[this.index] = topic;
|
||||||
this.stakeholderService.setStakeholder(this.stakeholder);
|
this.stakeholderService.setStakeholder(this.stakeholder);
|
||||||
};
|
};
|
||||||
this.save('Topic has been successfully saved', element, path, this.topicFb.value, callback, true);
|
this.save('Topic has been successfully saved', path, this.form.value, callback, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public deleteTopicOpen(name: string, element) {
|
public deleteTopicOpen() {
|
||||||
this.deleteOpen(name, 'topic', this.deleteTopicModal, element, this.topicIndex);
|
this.type = 'topic';
|
||||||
|
this.index = this.topicIndex;
|
||||||
|
this.element = this.stakeholder.topics[this.index];
|
||||||
|
this.deleteOpen();
|
||||||
}
|
}
|
||||||
|
|
||||||
public deleteTopic() {
|
public deleteTopic() {
|
||||||
let path: string[] = [
|
let path: string[] = [
|
||||||
this.stakeholder._id,
|
this.stakeholder._id,
|
||||||
this.stakeholder.topics[this.topicIndex]._id
|
this.stakeholder.topics[this.index]._id
|
||||||
];
|
];
|
||||||
let callback = (): void => {
|
let callback = (): void => {
|
||||||
this.stakeholder.topics.splice(this.topicIndex, 1);
|
this.stakeholder.topics.splice(this.index, 1);
|
||||||
this.stakeholderService.setStakeholder(this.stakeholder);
|
this.stakeholderService.setStakeholder(this.stakeholder);
|
||||||
};
|
};
|
||||||
this.delete('Topic has been successfully be deleted', path, callback, true);
|
this.delete('Topic has been successfully be deleted', path, callback, true);
|
||||||
|
@ -178,7 +187,7 @@ export class TopicComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
private buildCategory(category: Category) {
|
private buildCategory(category: Category) {
|
||||||
let categories = this.stakeholder.topics[this.topicIndex].categories.filter(element => element._id !== category._id);
|
let categories = this.stakeholder.topics[this.topicIndex].categories.filter(element => element._id !== category._id);
|
||||||
this.categoryFb = this.fb.group({
|
this.form = this.fb.group({
|
||||||
_id: this.fb.control(category._id),
|
_id: this.fb.control(category._id),
|
||||||
name: this.fb.control(category.name, Validators.required),
|
name: this.fb.control(category.name, Validators.required),
|
||||||
description: this.fb.control(category.description),
|
description: this.fb.control(category.description),
|
||||||
|
@ -192,51 +201,52 @@ export class TopicComponent implements OnInit, OnDestroy {
|
||||||
isDefault: this.fb.control(category.isDefault),
|
isDefault: this.fb.control(category.isDefault),
|
||||||
subCategories: this.fb.control(category.subCategories)
|
subCategories: this.fb.control(category.subCategories)
|
||||||
});
|
});
|
||||||
this.subscriptions.push(this.categoryFb.get('name').valueChanges.subscribe(value => {
|
this.subscriptions.push(this.form.get('name').valueChanges.subscribe(value => {
|
||||||
let i = 1;
|
let i = 1;
|
||||||
value = this.stakeholderUtils.generateAlias(value);
|
value = this.stakeholderUtils.generateAlias(value);
|
||||||
this.categoryFb.controls['alias'].setValue(value);
|
this.form.controls['alias'].setValue(value);
|
||||||
while (this.categoryFb.get('alias').invalid) {
|
while (this.form.get('alias').invalid) {
|
||||||
this.categoryFb.controls['alias'].setValue(value + i);
|
this.form.controls['alias'].setValue(value + i);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
public editCategoryOpen(element, index: number = -1) {
|
public editCategoryOpen(index: number = -1) {
|
||||||
if (element.className.indexOf('uk-open') !== -1) {
|
this.index = index;
|
||||||
this.hide(element);
|
this.type = 'category';
|
||||||
} else {
|
|
||||||
if (index === -1) {
|
if (index === -1) {
|
||||||
this.buildCategory(new Category(null, null, null, true, true));
|
this.buildCategory(new Category(null, null, null, true, true));
|
||||||
} else {
|
} else {
|
||||||
this.buildCategory(this.stakeholder.topics[this.topicIndex].categories[index]);
|
this.buildCategory(this.stakeholder.topics[this.topicIndex].categories[index]);
|
||||||
}
|
}
|
||||||
this.show(element);
|
this.editOpen();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public saveCategory(element, index = -1) {
|
public saveCategory() {
|
||||||
if (!this.categoryFb.invalid) {
|
if (!this.form.invalid) {
|
||||||
let path = [this.stakeholder._id, this.stakeholder.topics[this.topicIndex]._id];
|
let path = [this.stakeholder._id, this.stakeholder.topics[this.topicIndex]._id];
|
||||||
let callback = (category: Category): void => {
|
let callback = (category: Category): void => {
|
||||||
if (index === -1) {
|
if (this.index === -1) {
|
||||||
this.stakeholder.topics[this.topicIndex].categories.push(category);
|
this.stakeholder.topics[this.topicIndex].categories.push(category);
|
||||||
} else {
|
} else {
|
||||||
this.stakeholder.topics[this.topicIndex].categories[index] = HelperFunctions.copy(category);
|
this.stakeholder.topics[this.topicIndex].categories[this.index] = HelperFunctions.copy(category);
|
||||||
}
|
}
|
||||||
this.stakeholderService.setStakeholder(this.stakeholder);
|
this.stakeholderService.setStakeholder(this.stakeholder);
|
||||||
};
|
};
|
||||||
if (index === -1) {
|
if (this.index === -1) {
|
||||||
this.save('Category has been successfully created', element, path, this.categoryFb.value, callback);
|
this.save('Category has been successfully created', path, this.form.value, callback);
|
||||||
} else {
|
} else {
|
||||||
this.save('Category has been successfully saved', element, path, this.categoryFb.value, callback);
|
this.save('Category has been successfully saved', path, this.form.value, callback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public deleteCategoryOpen(name: string, element, index) {
|
public deleteCategoryOpen(index: number) {
|
||||||
this.deleteOpen(name, 'category', this.deleteCategoryModal, element, index);
|
this.type = 'category';
|
||||||
|
this.index = index;
|
||||||
|
this.element = this.stakeholder.topics[this.topicIndex].categories[this.index];
|
||||||
|
this.deleteOpen();
|
||||||
}
|
}
|
||||||
|
|
||||||
public deleteCategory() {
|
public deleteCategory() {
|
||||||
|
@ -254,7 +264,7 @@ export class TopicComponent implements OnInit, OnDestroy {
|
||||||
|
|
||||||
private buildSubcategory(subCategory: SubCategory) {
|
private buildSubcategory(subCategory: SubCategory) {
|
||||||
let subCategories = this.stakeholder.topics[this.topicIndex].categories[this.selectedCategoryIndex].subCategories.filter(element => element._id !== subCategory._id);
|
let subCategories = this.stakeholder.topics[this.topicIndex].categories[this.selectedCategoryIndex].subCategories.filter(element => element._id !== subCategory._id);
|
||||||
this.subcategoryFb = this.fb.group({
|
this.form = this.fb.group({
|
||||||
_id: this.fb.control(subCategory._id),
|
_id: this.fb.control(subCategory._id),
|
||||||
name: this.fb.control(subCategory.name, Validators.required),
|
name: this.fb.control(subCategory.name, Validators.required),
|
||||||
description: this.fb.control(subCategory.description),
|
description: this.fb.control(subCategory.description),
|
||||||
|
@ -269,56 +279,56 @@ export class TopicComponent implements OnInit, OnDestroy {
|
||||||
charts: this.fb.control(subCategory.charts),
|
charts: this.fb.control(subCategory.charts),
|
||||||
numbers: this.fb.control(subCategory.numbers)
|
numbers: this.fb.control(subCategory.numbers)
|
||||||
});
|
});
|
||||||
this.subscriptions.push(this.subcategoryFb.get('name').valueChanges.subscribe(value => {
|
this.subscriptions.push(this.form.get('name').valueChanges.subscribe(value => {
|
||||||
let i = 1;
|
let i = 1;
|
||||||
value = this.stakeholderUtils.generateAlias(value);
|
value = this.stakeholderUtils.generateAlias(value);
|
||||||
this.subcategoryFb.controls['alias'].setValue(value);
|
this.form.controls['alias'].setValue(value);
|
||||||
while (this.subcategoryFb.get('alias').invalid) {
|
while (this.form.get('alias').invalid) {
|
||||||
this.subcategoryFb.controls['alias'].setValue(value + i);
|
this.form.controls['alias'].setValue(value + i);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
public editSubCategoryOpen(element, index: number = -1) {
|
public editSubCategoryOpen(index: number = -1) {
|
||||||
if (element.className.indexOf('uk-open') !== -1) {
|
this.index = index;
|
||||||
this.hide(element);
|
this.type = 'subcategory';
|
||||||
} else {
|
|
||||||
if (index === -1) {
|
if (index === -1) {
|
||||||
this.buildSubcategory(new SubCategory(null, null, null, true, true));
|
this.buildSubcategory(new SubCategory(null, null, null, true, true));
|
||||||
} else {
|
} else {
|
||||||
this.buildSubcategory(this.stakeholder.topics[this.topicIndex].categories[this.selectedCategoryIndex].subCategories[index]);
|
this.buildSubcategory(this.stakeholder.topics[this.topicIndex].categories[this.selectedCategoryIndex].subCategories[index]);
|
||||||
}
|
}
|
||||||
this.show(element);
|
this.editOpen();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public saveSubCategory(element, index = -1) {
|
public saveSubCategory() {
|
||||||
if (!this.subcategoryFb.invalid) {
|
if (!this.form.invalid) {
|
||||||
let path: string[] = [
|
let path: string[] = [
|
||||||
this.stakeholder._id,
|
this.stakeholder._id,
|
||||||
this.stakeholder.topics[this.topicIndex]._id,
|
this.stakeholder.topics[this.topicIndex]._id,
|
||||||
this.stakeholder.topics[this.topicIndex].categories[this.selectedCategoryIndex]._id,
|
this.stakeholder.topics[this.topicIndex].categories[this.selectedCategoryIndex]._id,
|
||||||
];
|
];
|
||||||
let callback = (subCategory: SubCategory): void => {
|
let callback = (subCategory: SubCategory): void => {
|
||||||
if (index === -1) {
|
if (this.index === -1) {
|
||||||
this.stakeholder.topics[this.topicIndex].categories[this.selectedCategoryIndex].subCategories.push(subCategory);
|
this.stakeholder.topics[this.topicIndex].categories[this.selectedCategoryIndex].subCategories.push(subCategory);
|
||||||
} else {
|
} else {
|
||||||
this.stakeholder.topics[this.topicIndex].categories[this.selectedCategoryIndex].subCategories[index] = subCategory;
|
this.stakeholder.topics[this.topicIndex].categories[this.selectedCategoryIndex].subCategories[this.index] = subCategory;
|
||||||
}
|
}
|
||||||
this.stakeholderService.setStakeholder(this.stakeholder);
|
this.stakeholderService.setStakeholder(this.stakeholder);
|
||||||
};
|
};
|
||||||
if (index === -1) {
|
if (this.index === -1) {
|
||||||
this.save('Subcategory has been successfully created', element, path, this.subcategoryFb.value, callback);
|
this.save('Subcategory has been successfully created', path, this.form.value, callback);
|
||||||
} else {
|
} else {
|
||||||
this.save('Subcategory has been successfully saved', element, path, this.subcategoryFb.value, callback);
|
this.save('Subcategory has been successfully saved', path, this.form.value, callback);
|
||||||
}
|
}
|
||||||
this.hide(element);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public deleteSubcategoryOpen(name: string, element, index) {
|
public deleteSubcategoryOpen(index) {
|
||||||
this.deleteOpen(name, 'subcategory', this.deleteSubcategoryModal, element, index);
|
this.type = 'subcategory';
|
||||||
|
this.index = index;
|
||||||
|
this.element = this.stakeholder.topics[this.topicIndex].categories[this.selectedCategoryIndex].subCategories[this.index];
|
||||||
|
this.deleteOpen();
|
||||||
}
|
}
|
||||||
|
|
||||||
public deleteSubcategory() {
|
public deleteSubcategory() {
|
||||||
|
@ -339,17 +349,28 @@ export class TopicComponent implements OnInit, OnDestroy {
|
||||||
this.router.navigate(['/error'], {queryParams: {'page': this.router.url}});
|
this.router.navigate(['/error'], {queryParams: {'page': this.router.url}});
|
||||||
}
|
}
|
||||||
|
|
||||||
private deleteOpen(name: string, type: string, modal: AlertModal, element, index) {
|
private editOpen() {
|
||||||
this.element = element;
|
this.editModal.cancelButtonText = 'Cancel';
|
||||||
this.index = index;
|
this.editModal.okButtonLeft = false;
|
||||||
modal.alertTitle = 'Delete ' + name;
|
this.editModal.alertMessage = false;
|
||||||
modal.cancelButtonText = 'No';
|
if (this.index === -1) {
|
||||||
modal.okButtonText = 'Yes';
|
this.editModal.alertTitle = 'Create a new ' + this.type;
|
||||||
modal.message = 'This ' + type + ' will permanently be deleted. Are you sure you want to proceed?';
|
this.editModal.okButtonText = 'Create';
|
||||||
modal.open();
|
} else {
|
||||||
|
this.editModal.alertTitle = 'Edit ' + this.type + '\'s information ';
|
||||||
|
this.editModal.okButtonText = 'Save';
|
||||||
|
}
|
||||||
|
this.editModal.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
private save(message: string, element, path: string[], saveElement: any, callback: Function, redirect = false) {
|
private deleteOpen() {
|
||||||
|
this.deleteModal.alertTitle = 'Delete ' + this.type;
|
||||||
|
this.deleteModal.cancelButtonText = 'No';
|
||||||
|
this.deleteModal.okButtonText = 'Yes';
|
||||||
|
this.deleteModal.open();
|
||||||
|
}
|
||||||
|
|
||||||
|
private save(message: string, path: string[], saveElement: any, callback: Function, redirect = false) {
|
||||||
this.stakeholderService.saveElement(this.properties.monitorServiceAPIURL, saveElement, path).subscribe(saveElement => {
|
this.stakeholderService.saveElement(this.properties.monitorServiceAPIURL, saveElement, path).subscribe(saveElement => {
|
||||||
callback(saveElement);
|
callback(saveElement);
|
||||||
UIkit.notification(message, {
|
UIkit.notification(message, {
|
||||||
|
@ -362,14 +383,12 @@ export class TopicComponent implements OnInit, OnDestroy {
|
||||||
relativeTo: this.route
|
relativeTo: this.route
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.hide(element);
|
|
||||||
}, error => {
|
}, error => {
|
||||||
UIkit.notification(error.error.message, {
|
UIkit.notification(error.error.message, {
|
||||||
status: 'danger',
|
status: 'danger',
|
||||||
timeout: 3000,
|
timeout: 3000,
|
||||||
pos: 'top-left'
|
pos: 'top-left'
|
||||||
});
|
});
|
||||||
this.hide(element);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -384,14 +403,12 @@ export class TopicComponent implements OnInit, OnDestroy {
|
||||||
if (redirect) {
|
if (redirect) {
|
||||||
this.back();
|
this.back();
|
||||||
}
|
}
|
||||||
this.hide(this.element);
|
|
||||||
}, error => {
|
}, error => {
|
||||||
UIkit.notification(error.error.message, {
|
UIkit.notification(error.error.message, {
|
||||||
status: 'danger',
|
status: 'danger',
|
||||||
timeout: 3000,
|
timeout: 3000,
|
||||||
pos: 'top-left'
|
pos: 'top-left'
|
||||||
});
|
});
|
||||||
this.hide(this.element);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,8 @@ html .dashboard {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dashboard li > a:hover .onHover {
|
.dashboard li > a:hover .onHover,
|
||||||
|
.dashboard li > a .onHover.uk-open {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,23 +47,49 @@ html .dashboard {
|
||||||
|
|
||||||
.dashboard #sidebar_main .menu_section > ul > li > a {
|
.dashboard #sidebar_main .menu_section > ul > li > a {
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
|
overflow: unset;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dashboard #sidebar_main .menu_section > ul > li:not([class*=md-bg-]) > a:hover {
|
||||||
|
background-color: #F0F0F0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dashboard #sidebar_main .menu_section > ul > li > a > .menu_icon {
|
.dashboard #sidebar_main .menu_section > ul > li > a > .menu_icon {
|
||||||
width: 30px;
|
width: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.dashboard #sidebar_main .menu_section > ul > li > ul > li > a:hover {
|
||||||
|
background-color: #F0F0F0;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
.dashboard #sidebar_main .menu_section > ul li > a {
|
.dashboard #sidebar_main .menu_section > ul li > a {
|
||||||
font-size: var(--sidebar-font-size);
|
font-size: var(--sidebar-font-size);
|
||||||
color: rgba(0, 0, 0, 0.7);
|
color: rgba(0, 0, 0, 0.7);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.dashboard #sidebar_main .menu_section .uk-dropdown {
|
||||||
|
min-width: 150px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dashboard #sidebar_main .menu_section .uk-dropdown > ul {
|
||||||
|
display: block;
|
||||||
|
margin: 0;
|
||||||
|
text-align: start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dashboard #sidebar_main .menu_section .uk-dropdown > ul > li > a {
|
||||||
|
padding: 5px 10px;
|
||||||
|
color: black !important;
|
||||||
|
}
|
||||||
|
|
||||||
.dashboard #sidebar_main .menu_section > ul ul > li > a {
|
.dashboard #sidebar_main .menu_section > ul ul > li > a {
|
||||||
line-height: 20px;
|
line-height: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dashboard #sidebar_main .menu_section > ul li > a {
|
.dashboard #sidebar_main .menu_section > ul li > a {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
body.dashboard {
|
body.dashboard {
|
||||||
|
|
Loading…
Reference in New Issue