diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 768b60a..4042922 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -23,6 +23,11 @@ const routes: Routes = [ resolve: {envSpecific: EnvironmentSpecificResolver}, data: {hasSidebar: false} }, + { + path: 'admin', + loadChildren: './home/home.module#HomeModule', + resolve: {envSpecific: EnvironmentSpecificResolver} + }, { path: 'admin/:stakeholder', loadChildren: './stakeholder/stakeholder.module#StakeholderModule', diff --git a/src/app/services/stakeholder.service.ts b/src/app/services/stakeholder.service.ts index 4136714..9e792e6 100644 --- a/src/app/services/stakeholder.service.ts +++ b/src/app/services/stakeholder.service.ts @@ -29,19 +29,19 @@ export class StakeholderService { } getAllStakeholders(url: string, type: string = null): Observable { - return this.http.get(url + '/stakeholder/all' + (type)?('?type=' + type):'').pipe(map(stakeholders => { + return this.http.get(url + '/stakeholder/all' + ((type)?('?type=' + type):'')).pipe(map(stakeholders => { return this.formalize(stakeholders); })); } getStakeholders(url: string, type: string = null): Observable { - return this.http.get(url + '/stakeholder' + (type)?('?type=' + type):'').pipe(map(stakeholders => { + return this.http.get(url + '/stakeholder' + ((type)?('?type=' + type):'')).pipe(map(stakeholders => { return this.formalize(stakeholders); })); } getDefaultStakeholders(url: string, type: string = null): Observable { - return this.http.get(url + '/stakeholder/default' + (type)?('?type=' + type):'').pipe(map(stakeholders => { + return this.http.get(url + '/stakeholder/default' + ((type)?('?type=' + type):'')).pipe(map(stakeholders => { return this.formalize(stakeholders); })); } diff --git a/src/app/topic/indicators.component.html b/src/app/topic/indicators.component.html index e6c8a33..ceb4fec 100644 --- a/src/app/topic/indicators.component.html +++ b/src/app/topic/indicators.component.html @@ -54,7 +54,7 @@
@@ -76,8 +76,8 @@ more_vert
@@ -108,7 +108,7 @@
@@ -143,8 +143,8 @@ more_vert
diff --git a/src/app/topic/indicators.component.ts b/src/app/topic/indicators.component.ts index 5c8a3ac..2b8c81f 100644 --- a/src/app/topic/indicators.component.ts +++ b/src/app/topic/indicators.component.ts @@ -97,7 +97,9 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV ngOnChanges(changes: SimpleChanges): void { if (this.canEdit) { - this.buildFilters(); + if(changes.topicIndex || changes.categoryIndex || changes.subcategoryIndex) { + this.buildFilters(); + } this.filterCharts(); this.filterNumbers(); } @@ -157,7 +159,6 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV } onPrivacyChange(value) { - console.log(value); this.displayCharts = this.filterPrivacy(this.charts, value); this.displayNumbers = this.filterPrivacy(this.numbers, value); } @@ -308,10 +309,10 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV this.editIndicatorOpen(); } - public editIndicatorOpen(index: number = -1) { - this.index = index; + public editIndicatorOpen(id = null) { + this.index = this.charts.findIndex(value => value._id === id); if (this.index !== -1) { - this.indicator = HelperFunctions.copy(this.charts[index]); + this.indicator = HelperFunctions.copy(this.charts[this.index]); } let indicatorPaths = this.fb.array([]); this.indicator.indicatorPaths.forEach(indicatorPath => { @@ -346,7 +347,7 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV indicatorPaths: indicatorPaths, width: this.fb.control(this.indicator.width, Validators.required), }); - if(index === -1) { + if(this.index === -1) { this.editIndicatorModal.okButtonText = 'Save'; this.editIndicatorModal.stayOpen = false; } else { @@ -414,12 +415,11 @@ export class IndicatorsComponent implements OnInit, OnDestroy, OnChanges, AfterV this.indicatorPaths.at(index).markAsPristine({onlySelf: true}); } - deleteIndicatorOpen(index: number, type: string = 'chart') { - this.index = index; + deleteIndicatorOpen(id: string, type: string = 'chart') { if(type === 'chart') { - this.indicator = this.charts[index]; + this.indicator = this.charts.find(value => value._id == id); } else { - this.indicator = this.numbers[index]; + this.indicator = this.numbers.find(value => value._id == id); } this.deleteIndicatorModal.alertTitle = 'Delete ' + this.indicator.name; this.deleteIndicatorModal.cancelButtonText = 'No'; diff --git a/src/assets/theme-assets/dashboard-custom.css b/src/assets/theme-assets/dashboard-custom.css index 9cbe04e..df2145f 100644 --- a/src/assets/theme-assets/dashboard-custom.css +++ b/src/assets/theme-assets/dashboard-custom.css @@ -99,7 +99,7 @@ body.dashboard { float: none; } -.dashboard .list { +.dashboard .max-width-large { max-width: 1220px; }