diff --git a/src/app/topic/indicators.component.html b/src/app/topic/indicators.component.html index 177f20b..4ba7b57 100644 --- a/src/app/topic/indicators.component.html +++ b/src/app/topic/indicators.component.html @@ -70,9 +70,9 @@ uk-sortable="group: number" uk-grid>
- + -
@@ -82,7 +82,7 @@
- @@ -117,16 +117,16 @@
@@ -202,9 +202,9 @@ uk-sortable="group: chart" uk-grid>
- + -
@@ -214,7 +214,7 @@
@@ -349,7 +349,7 @@
- Create a new section diff --git a/src/app/topic/indicators.component.ts b/src/app/topic/indicators.component.ts index 3724efd..895f91b 100644 --- a/src/app/topic/indicators.component.ts +++ b/src/app/topic/indicators.component.ts @@ -73,7 +73,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV * Toggles */ public grid: boolean = true; - private reordering: boolean = false; + private editing: boolean = false; /** Safe Urls*/ public safeUrls: Map = new Map([]); @@ -150,7 +150,6 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV reordered.push(items.item(i).id); } } - this.reordering = true; this.reorderIndicators(list.current.id.toString().split('-')[1], type, reordered); }; this.numbers.forEach((section) => { @@ -351,7 +350,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV get canReorder(): boolean { return this.filters.value.chartType === 'all' && this.filters.value.privacy === 'all' && - this.filters.value.status === 'all' && this.filters.value.keyword === '' && this.grid && !this.reordering; + this.filters.value.status === 'all' && this.filters.value.keyword === '' && this.grid && !this.editing; } get canEdit() { @@ -607,6 +606,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV } saveIndicator() { + this.editing = true; if (this.indicator.type === 'chart') { this.indicator = this.indicatorUtils.generateIndicatorByForm(this.chartIndicatorFb.value, this.indicator.indicatorPaths); this.section = this.charts.find(section => section._id === this.section._id); @@ -633,6 +633,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV timeout: 3000, pos: 'top-left' }); + this.editing = false; }, error => { this.chartIndicatorFb = null; UIkit.notification(error.error.message, { @@ -640,10 +641,12 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV timeout: 3000, pos: 'top-left' }); + this.editing = false; }); } reorderIndicators(sectionId: string, type: IndicatorType, indicatorIds: string[]) { + this.editing = true; let path = [ this.stakeholder._id, this.stakeholder.topics[this.topicIndex]._id, @@ -659,7 +662,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV this.numbers.find(section => section._id === sectionId).indicators = indicators; this.filterNumbers(); } - this.reordering = false; + this.editing = false; }); } @@ -702,6 +705,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV } deleteIndicator() { + this.editing = true; let path = [ this.stakeholder._id, this.stakeholder.topics[this.topicIndex]._id, @@ -723,16 +727,19 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV timeout: 3000, pos: 'top-left' }); + this.editing = false; }, error => { UIkit.notification(error.error.message, { status: 'danger', timeout: 3000, pos: 'top-left' }); + this.editing = false; }); } toggleIndicatorStatus(sectionId: string, indicator: Indicator) { + this.editing = true; let path = [ this.stakeholder._id, this.stakeholder.topics[this.topicIndex]._id, @@ -748,16 +755,19 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV timeout: 3000, pos: 'top-left' }); + this.editing = false; }, error => { UIkit.notification(error.error.message, { status: 'danger', timeout: 3000, pos: 'top-left' }); + this.editing = false; }); } toggleIndicatorAccess(sectionId: string, indicator: Indicator) { + this.editing = true; let path = [ this.stakeholder._id, this.stakeholder.topics[this.topicIndex]._id, @@ -773,16 +783,19 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV timeout: 3000, pos: 'top-left' }); + this.editing = false; }, error => { UIkit.notification(error.error.message, { status: 'danger', timeout: 3000, pos: 'top-left' }); + this.editing = false; }); } saveSection(section: Section, index: number, type: IndicatorType = "chart") { + this.editing = true; let path = [ this.stakeholder._id, this.stakeholder.topics[this.topicIndex]._id, @@ -803,16 +816,19 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV timeout: 3000, pos: 'top-left' }); + this.editing = false; }, error => { UIkit.notification(error.error.message, { status: 'danger', timeout: 3000, pos: 'top-left' }); + this.editing = false; }); } createSection(index = -1, type: IndicatorType = 'chart') { + this.editing = true; this.section = new Section(type, null, null, this.stakeholder.alias); let path = [ this.stakeholder._id, @@ -842,12 +858,14 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV timeout: 3000, pos: 'top-left' }); + this.editing = false; }, error => { UIkit.notification(error.error.message, { status: 'danger', timeout: 3000, pos: 'top-left' }); + this.editing = false; }); } @@ -870,6 +888,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV } deleteSection(type: IndicatorType = 'chart') { + this.editing = true; let path = [ this.stakeholder._id, this.stakeholder.topics[this.topicIndex]._id, @@ -891,12 +910,14 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV timeout: 3000, pos: 'top-left' }); + this.editing = false; }, error => { UIkit.notification(error.error.message, { status: 'danger', timeout: 3000, pos: 'top-left' }); + this.editing = false; }); } }