diff --git a/connect/community/CustomizationOptions.ts b/connect/community/CustomizationOptions.ts
index 74903608..93535151 100644
--- a/connect/community/CustomizationOptions.ts
+++ b/connect/community/CustomizationOptions.ts
@@ -114,14 +114,14 @@ export class CustomizationOptions {
constructor() {
- this.mainColor = '#4C9CD5';
- this.secondaryColor = '#24857F';
+ this.mainColor = '#4687E6';
+ this.secondaryColor = '#2D72D6';
this.panel = {
onDarkBackground: true,
background: {
- color: '#4C9CD5',
+ color: '#4687E6',
borderStyle: 'solid',
- borderColor: "#4C9CD5",
+ borderColor: "#4687E6",
borderWidth: 0
}, fonts: {
color: '#ffffff',
@@ -160,9 +160,9 @@ export class CustomizationOptions {
},
},
lightBackground: {
- color: '#4C9CD5',
+ color: '#4687E6',
onHover: {
- color: '#24857F'
+ color: '#2D72D6'
},
}
};
@@ -170,28 +170,28 @@ export class CustomizationOptions {
this.buttons = {
darkBackground: {
backgroundColor: "#ffffff",
- color:"#4C9CD5",
+ color:"#000000",
borderStyle:"solid",
borderColor: "#ffffff",
borderWidth: 1,
- borderRadius: 4,
+ borderRadius: 500,
onHover: {
backgroundColor: "#eeeeee",
- color: "#4C9CD5",
+ color: "#000000",
borderColor: "#eeeeee",
}
},
lightBackground: {
- backgroundColor: '#003052',
+ backgroundColor: '#4687E6',
color: '#ffffff',
borderStyle: "solid",
- borderColor: "#003052",
+ borderColor: "#4687E6",
borderWidth: 1,
- borderRadius: 4,
+ borderRadius: 500,
onHover: {
- backgroundColor: '#154B71',
+ backgroundColor: '#2D72D6',
color: '#ffffff',
- borderColor: "#154B71",
+ borderColor: "#2D72D6",
}
}
diff --git a/dashboard/divhelpcontent/class-help-content-form-routing.module.ts b/dashboard/divhelpcontent/class-help-content-form-routing.module.ts
new file mode 100644
index 00000000..888aca84
--- /dev/null
+++ b/dashboard/divhelpcontent/class-help-content-form-routing.module.ts
@@ -0,0 +1,13 @@
+import {NgModule} from '@angular/core';
+import {RouterModule} from '@angular/router';
+import {ClassContentFormComponent} from './class-help-content-form.component';
+
+
+@NgModule({
+ imports: [
+ RouterModule.forChild([
+ { path: '', component: ClassContentFormComponent}
+ ])
+ ]
+})
+export class ClassHelpContentFormRoutingModule { }
diff --git a/dashboard/divhelpcontent/class-help-content-form.component.html b/dashboard/divhelpcontent/class-help-content-form.component.html
new file mode 100644
index 00000000..e511880c
--- /dev/null
+++ b/dashboard/divhelpcontent/class-help-content-form.component.html
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+
+
{{errorMessage}}
+
+
{{updateErrorMessage}}
+
+
+
+
+
+
+
+
+
+
diff --git a/dashboard/divhelpcontent/class-help-content-form.component.ts b/dashboard/divhelpcontent/class-help-content-form.component.ts
new file mode 100644
index 00000000..e88ece9b
--- /dev/null
+++ b/dashboard/divhelpcontent/class-help-content-form.component.ts
@@ -0,0 +1,220 @@
+import {Component, Input, OnInit} from '@angular/core';
+import {ActivatedRoute, Router} from '@angular/router';
+import {FormBuilder, FormGroup, Validators} from '@angular/forms';
+import {Page} from '../../utils/entities/adminTool/page';
+import {HelpContentService} from '../../services/help-content.service';
+import {EnvProperties} from '../../utils/properties/env-properties';
+
+import {Session} from '../../login/utils/helper.class';
+import {LoginErrorCodes} from '../../login/utils/guardHelper.class';
+import {properties} from '../../../../environments/environment';
+import {Observable, Subscriber, Subscription} from 'rxjs';
+import {HelperFunctions} from '../../utils/HelperFunctions.class';
+import {ConnectHelper} from '../../connect/connectHelper';
+import {DivHelpContent} from '../../utils/entities/adminTool/div-help-content';
+declare var UIkit;
+
+@Component({
+ selector: 'class-content-form',
+ templateUrl: './class-help-content-form.component.html',
+})
+export class ClassContentFormComponent implements OnInit {
+
+ myForm: FormGroup;
+ portal: string;
+ pageId: string;
+ pageContentId: string;
+ page: Page;
+ classOptions = [];
+
+ public properties: EnvProperties = null;
+
+ public showLoading: boolean = true;
+ public errorMessage: string = '';
+ @Input() updateErrorMessage: string = '';
+ private subs: Subscription[] = [];
+ public pageHelpContent: DivHelpContent;
+
+ constructor(private route: ActivatedRoute, private _router: Router, private _fb: FormBuilder, private _helpContentService: HelpContentService) {
+ }
+
+ ngOnInit() {
+
+ this.properties = properties;
+ this.subs.push(this.route.params.subscribe(params => {
+ this.portal = (this.route.snapshot.data.portal) ? this.route.snapshot.data.portal : this.route.snapshot.params[this.route.snapshot.data.param];
+ ConnectHelper.setPortalTypeFromPid(this.portal);
+ this.subs.push(this.route.queryParams.subscribe(params => {
+ HelperFunctions.scroll();
+ this.pageId = params['pageId'];
+ this.myForm = this.form;
+ this.pageContentId = params['pageContentId'];
+ if (!this.pageId) {
+ this._router.navigate(['../'], {relativeTo: this.route});
+ }
+ this.getInfo(this.pageId);
+ if (!Session.isLoggedIn()) {
+ this._router.navigate(['/user-info'], {
+ queryParams: {
+ "errorCode": LoginErrorCodes.NOT_VALID,
+ "redirectUrl": this._router.url
+ }
+ });
+ }
+ }));
+ }));
+ }
+
+ ngOnDestroy() {
+ this.subs.forEach(value => {
+ if (value instanceof Subscriber) {
+ value.unsubscribe();
+ }
+ });
+ }
+
+ getInfo(pageId: string) {
+ this.showLoading = true;
+ let obs = Observable.zip(this._helpContentService.getPageByPortal(pageId, this.properties.adminToolsAPIURL, this.portal),
+ this._helpContentService.getDivIdsFullByPortal(pageId, this.properties.adminToolsAPIURL, this.portal));
+ this.subs.push(obs.subscribe(
+ results => {
+ this.page = results[0];
+ if (this.properties.adminToolsPortalType != this.page.portalType) {
+ this._router.navigate(['../'], {relativeTo: this.route});
+ }
+ this.setOptions(results[1]);
+ if (!this.pageContentId) {
+ this.updateForm(null);
+ this.showLoading = false;
+ } else {
+ this.subs.push(this._helpContentService.getDivHelpContent( this.pageContentId, this.properties.adminToolsAPIURL, this.portal).subscribe(pageHelpContent=>{
+ this.pageHelpContent = pageHelpContent;
+ if (this.properties.adminToolsPortalType != this.page.portalType) {
+ this._router.navigate(['../'], {relativeTo: this.route});
+ }
+ this.updateForm(this.pageHelpContent);
+ this.showLoading = false;
+ },
+ error => {
+ this.handleError('System error retrieving content by id '+ this.pageContentId, error)
+ }));
+ }
+ }));
+
+ }
+
+ private updateForm(pageHelpContent: DivHelpContent) {
+ this.pageHelpContent = pageHelpContent;
+ this.myForm = this.form;
+ if (this.pageHelpContent) {
+ this.myForm.patchValue((pageHelpContent));
+ this.myForm.get('divId').disable();
+ }
+ this.myForm.markAsPristine();
+
+ }
+
+
+ public setOptions(divIds) {
+ this.classOptions = [];
+ for(let divid of divIds){
+ this.classOptions.push({label:divid.name, value:divid._id});
+ }
+
+ }
+
+ public get form() {
+ return this._fb.group({
+ divId: ['', Validators.required],
+ content: ['', Validators.required],
+ isActive: true,
+ portal: this.portal,
+ _id : '',
+ });
+
+ }
+
+ public reset() {
+ this.myForm.patchValue({
+ divId: ['', Validators.required],
+ content: ['', Validators.required],
+ isActive: true,
+ portal: '',
+ _id : '',
+ });
+ this.myForm.markAsPristine();
+ }
+
+ handleError(message: string, error) {
+ this.errorMessage = message;
+ console.error('Server responded: ' + error);
+
+ this.showLoading = false;
+ }
+
+ public saveCustom() {
+ if (!Session.isLoggedIn()) {
+ this._router.navigate(['/user-info'], {
+ queryParams: {
+ "errorCode": LoginErrorCodes.NOT_VALID,
+ "redirectUrl": this._router.url
+ }
+ });
+ } else {
+
+ if (this.myForm.valid) {
+ this.showLoading = true;
+ this.updateErrorMessage = "";
+ this.myForm.get('divId').enable();
+ let pageHelpContent: DivHelpContent = this.myForm.value;
+ this.subs.push(this._helpContentService.insertOrUpdateDivHelpContent(pageHelpContent, this.properties.adminToolsAPIURL, this.portal).subscribe(
+ _ => {
+ this._router.navigate(['../'], {queryParams: {"pageId": this.pageId}, relativeTo: this.route});
+ UIkit.notification('Page content has been successfully updated', {
+ status: 'success',
+ timeout: 6000,
+ pos: 'bottom-right'
+ });
+ this.showLoading = false;
+ },
+ err => this.handleUpdateError('System error saving page content', err)
+ ));
+ } else {
+ this.showLoading = false;
+ this.errorMessage = "Please fill all required fields";
+ }
+ }
+ }
+
+ public resetCustom() {
+ this.showLoading = true;
+ this.updateForm(this.pageHelpContent);
+ this.showLoading = false;
+ }
+
+ handleUpdateError(message: string, error) {
+
+ this.updateErrorMessage = message;
+ console.error('Server responded: ' + error);
+
+ this.showLoading = false;
+ }
+
+ changeStatus() {
+ this.myForm.get('isActive').setValue(!this.myForm.get('isActive').value);
+ if (this.pageHelpContent && this.myForm.get('isActive').value != this.pageHelpContent.isActive || !this.pageHelpContent && !this.myForm.get('isActive').value) {
+ this.myForm.get('isActive').markAsDirty();
+ } else {
+ this.myForm.get('isActive').markAsPristine()
+ }
+ }
+
+ contentChanged() {
+ if (this.pageHelpContent && this.myForm.get('content').value != this.pageHelpContent.content || !this.pageHelpContent && this.myForm.get('content').value != '') {
+ this.myForm.get('content').markAsDirty();
+ } else {
+ this.myForm.get('content').markAsPristine()
+ }
+ }
+}
diff --git a/dashboard/divhelpcontent/class-help-content-form.module.ts b/dashboard/divhelpcontent/class-help-content-form.module.ts
new file mode 100644
index 00000000..a0f718e4
--- /dev/null
+++ b/dashboard/divhelpcontent/class-help-content-form.module.ts
@@ -0,0 +1,34 @@
+import {NgModule} from '@angular/core';
+import {CommonModule} from '@angular/common';
+import {FormsModule, ReactiveFormsModule} from '@angular/forms';
+import {AlertModalModule} from '../../utils/modal/alertModal.module';
+import {SafeHtmlPipeModule} from '../../utils/pipes/safeHTMLPipe.module';
+import {CKEditorModule} from 'ng2-ckeditor';
+import {AdminToolServiceModule} from '../../services/adminToolService.module';
+import {InputModule} from '../../sharedComponents/input/input.module';
+import {MatSlideToggleModule} from '@angular/material';
+import {IconsModule} from '../../utils/icons/icons.module';
+import {RouterModule} from '@angular/router';
+import {LoadingModule} from '../../utils/loading/loading.module';
+import {IconsService} from '../../utils/icons/icons.service';
+import {arrow_left} from '../../utils/icons/icons';
+import {ClassContentFormComponent} from './class-help-content-form.component';
+import {ClassHelpContentFormRoutingModule} from './class-help-content-form-routing.module';
+import {PageContentModule} from '../sharedComponents/page-content/page-content.module';
+
+@NgModule({
+ imports: [
+ CommonModule, FormsModule, RouterModule,
+ SafeHtmlPipeModule, CKEditorModule,
+ AlertModalModule, ReactiveFormsModule, ClassHelpContentFormRoutingModule, AdminToolServiceModule, InputModule, MatSlideToggleModule, IconsModule, LoadingModule, PageContentModule
+ ],
+ declarations: [
+ ClassContentFormComponent
+ ],
+ exports: [ClassContentFormComponent]
+})
+export class ClassHelpContentFormModule {
+ constructor(private iconsService: IconsService) {
+ this.iconsService.registerIcons([arrow_left]);
+ }
+}
diff --git a/dashboard/divhelpcontent/class-help-contents-routing.module.ts b/dashboard/divhelpcontent/class-help-contents-routing.module.ts
new file mode 100644
index 00000000..9de7fce8
--- /dev/null
+++ b/dashboard/divhelpcontent/class-help-contents-routing.module.ts
@@ -0,0 +1,12 @@
+import { NgModule } from '@angular/core';
+import {RouterModule} from '@angular/router';
+import {ClassHelpContentsComponent} from './class-help-contents.component';
+
+@NgModule({
+ imports: [
+ RouterModule.forChild([
+ { path: '', component: ClassHelpContentsComponent}
+ ])
+ ]
+})
+export class ClassHelpContentsRoutingModule { }
diff --git a/dashboard/divhelpcontent/class-help-contents.component.html b/dashboard/divhelpcontent/class-help-contents.component.html
new file mode 100644
index 00000000..ce267ecf
--- /dev/null
+++ b/dashboard/divhelpcontent/class-help-contents.component.html
@@ -0,0 +1,143 @@
+
+
+
+
+ {{updateErrorMessage}}
+
+
+ {{page.name}}
+
+
+
+
0"
+ class="uk-padding uk-padding-remove-bottom uk-padding-remove-top uk-margin-remove-top uk-margin-small-bottom"
+ [attr.uk-tooltip]="getSelectedPageHelpContents().length == 0 ? 'pos:left; cls: uk-active' : 'cls: uk-invisible'"
+ title="Select at least one help text">
+
0" class="uk-margin-left uk-text-muted">
+ {{getSelectedPageHelpContents().length}} pages selected
+
Actions
+
+
+
+
+
+
+
+
+
+
{{errorMessage}}
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
{{check.divHelpContent.content|htmlToString}}
+
+
+
+ Class: {{check.divHelpContent.divId.name?check.divHelpContent.divId.name:check.divHelpContent.divId}}
+
+
+ Enable/disable:
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Edit
+
+
+
+
+
+ Delete
+
+
+
+
+
+
+
+
+
+
+
No page contents found
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dashboard/divhelpcontent/class-help-contents.component.ts b/dashboard/divhelpcontent/class-help-contents.component.ts
new file mode 100644
index 00000000..09a0927c
--- /dev/null
+++ b/dashboard/divhelpcontent/class-help-contents.component.ts
@@ -0,0 +1,364 @@
+import {Component, ViewChild, OnInit, ElementRef} from '@angular/core';
+import {FormBuilder, FormControl, FormGroup} from "@angular/forms";
+import {ActivatedRoute, Router} from "@angular/router";
+import {HelpContentService} from "../../services/help-content.service";
+import {PageHelpContentFilterOptions} from '../../utils/entities/adminTool/page-help-content';
+import {Page} from "../../utils/entities/adminTool/page";
+import {Portal} from "../../utils/entities/adminTool/portal";
+import {EnvProperties} from '../../utils/properties/env-properties';
+import {Session} from '../../login/utils/helper.class';
+import {LoginErrorCodes} from '../../login/utils/guardHelper.class';
+import {HelperFunctions} from "../../utils/HelperFunctions.class";
+import {Subscriber} from "rxjs";
+import {properties} from "../../../../environments/environment";
+import {DomSanitizer} from '@angular/platform-browser';
+import {SearchInputComponent} from '../../sharedComponents/search-input/search-input.component';
+import {ConnectHelper} from '../../connect/connectHelper';
+import {CheckDivHelpContent, DivHelpContent} from '../../utils/entities/adminTool/div-help-content';
+declare var UIkit;
+
+
+@Component({
+ selector: 'class-help-contents',
+ templateUrl: './class-help-contents.component.html',
+})
+export class ClassHelpContentsComponent implements OnInit {
+
+ @ViewChild('AlertModalDeletePageHelpContents') alertModalDeletePageHelpContents;
+ private selectedPageContents: string[] = [];
+
+ public checkboxes: CheckDivHelpContent[] = [];
+
+ public pageHelpContents: DivHelpContent[] = [];
+
+ public formGroup: FormGroup;
+
+ public pages: Page[];
+
+ public checkboxAll: boolean = false;
+
+ public filters: PageHelpContentFilterOptions = {id: '', active: null, text: new RegExp('')};
+ public keyword: string = "";
+
+ public counter = {all: 0, active: 0, inactive: 0};
+
+ public communities: Portal[] = [];
+
+ public portal: string;
+
+ public selectedPageId: string;
+
+ public community: Portal;
+
+ public page: Page;
+ public properties: EnvProperties = null;
+
+ public showLoading: boolean = true;
+ public errorMessage: string = '';
+ public updateErrorMessage: string = '';
+ public filterForm: FormControl;
+ public selectForm: FormControl;
+ private subscriptions: any[] = [];
+ public selectedKeyword: string;
+ @ViewChild('searchInputComponent') searchInputComponent: SearchInputComponent;
+
+ ngOnInit() {
+ this.filterForm = this._fb.control('');
+ this.selectForm = this._fb.control('');
+ this.subscriptions.push(this.filterForm.valueChanges.subscribe(value => {
+ this.filterBySearch(value);
+ }));
+ this.subscriptions.push(this.selectForm.valueChanges.subscribe(value => {
+ this.filterByPage(value);
+ }));
+
+ this.properties = properties;
+ this.subscriptions.push(this.route.params.subscribe(params => {
+ this.portal = (this.route.snapshot.data.portal) ? this.route.snapshot.data.portal : this.route.snapshot.params[this.route.snapshot.data.param];
+ ConnectHelper.setPortalTypeFromPid(this.portal);
+ this.subscriptions.push(this.route.queryParams.subscribe(params => {
+ HelperFunctions.scroll();
+ this.selectedPageId = params['pageId'];
+ if (this.portal && this.selectedPageId) {
+ this.getPage(this.selectedPageId);
+ }
+ if(!this.selectedPageId) {
+ this.router.navigate(['../pages'], {relativeTo: this.route });
+ }
+ }));
+ }));
+ }
+
+ constructor(private element: ElementRef, private route: ActivatedRoute, private router: Router, private _helpService: HelpContentService, private _fb: FormBuilder, private sanitizer: DomSanitizer) {
+ }
+ ngOnDestroy(): void {
+ this.subscriptions.forEach(value => {
+ if (value instanceof Subscriber) {
+ value.unsubscribe();
+ } else if (value instanceof Function) {
+ value();
+ }
+ });
+ }
+ init(){
+
+ }
+ getPage(pageId: string) {
+ if (!Session.isLoggedIn()) {
+ this.router.navigate(['/user-info'], {
+ queryParams: {
+ "errorCode": LoginErrorCodes.NOT_VALID,
+ "redirectUrl": this.router.url
+ }
+ });
+ } else {
+ this.showLoading = true;
+ this.updateErrorMessage = "";
+ this.errorMessage = "";
+ this.subscriptions.push(this._helpService.getPageByPortal(pageId, this.properties.adminToolsAPIURL, this.portal).subscribe(
+ page => {
+ if (this.properties.adminToolsPortalType != page.portalType) {
+ this.router.navigate(['./pageContents'], {queryParams: {"communityId": this.portal}});
+ } else {
+ this.page = page;
+ this.getPageHelpContents(this.portal);
+ }
+ },
+ error => this.handleError('System error retrieving page', error)));
+ }
+ }
+
+
+ public countPageHelpContents() {
+ this.counter = {all: 0, active: 0, inactive: 0};
+ let filter = Object.assign({}, this.filters);
+ filter.active = null;
+ this.pageHelpContents.forEach(_ => {
+ if (this.filterPageHelpContent(_, filter)) {
+ if (_.isActive == true) this.counter.active++;
+ else this.counter.inactive++
+ }
+ });
+ this.counter.all = this.counter.active + this.counter.inactive;
+ }
+
+ getPageHelpContents(community_pid: string) {
+ if (!Session.isLoggedIn()) {
+ this.router.navigate(['/user-info'], {
+ queryParams: {
+ "errorCode": LoginErrorCodes.NOT_VALID,
+ "redirectUrl": this.router.url
+ }
+ });
+ } else {
+ this.subscriptions.push(this._helpService.getCommunityDivHelpContents(community_pid, this.properties.adminToolsAPIURL, this.selectedPageId).subscribe(
+ pageHelpContents => {
+ this.pageHelpContents = pageHelpContents as Array;
+ this.counter.all = this.pageHelpContents.length;
+ this.checkboxes = [];
+
+ for (let i = this.pageHelpContents.length - 1; i >= 0; i -= 1) {
+ this.checkboxes.unshift({divHelpContent: this.pageHelpContents[i], checked: false});
+ }
+
+ this.countPageHelpContents();
+
+ this.showLoading = false;
+ },
+ error => this.handleError('System error retrieving page contents', error)));
+ }
+ }
+
+ public toggleCheckBoxes(event) {
+ this.checkboxes.forEach(_ => _.checked = event.target.checked);
+ this.checkboxAll = event.target.checked;
+ }
+
+ public applyCheck(flag: boolean) {
+ this.checkboxes.forEach(_ => _.checked = flag);
+ this.checkboxAll = false;
+ }
+
+ public getSelectedPageHelpContents(): string[] {
+ return this.checkboxes.filter(pageHelpContent => pageHelpContent.checked == true)
+ .map(checkedPageHelpContent => checkedPageHelpContent.divHelpContent).map(res => res._id);
+ }
+
+ public confirmDeletePageHelpContent(id: string) {
+ this.selectedPageContents = [id];
+ this.confirmModalOpen();
+ }
+
+ public confirmDeleteSelectedPageHelpContents() {
+
+ this.selectedPageContents = this.getSelectedPageHelpContents();
+ this.confirmModalOpen();
+ }
+
+ private confirmModalOpen() {
+ if (!Session.isLoggedIn()) {
+ this.router.navigate(['/user-info'], {
+ queryParams: {
+ "errorCode": LoginErrorCodes.NOT_VALID,
+ "redirectUrl": this.router.url
+ }
+ });
+ } else {
+ this.alertModalDeletePageHelpContents.cancelButton = true;
+ this.alertModalDeletePageHelpContents.okButton = true;
+ this.alertModalDeletePageHelpContents.alertTitle = "Delete Confirmation";
+ this.alertModalDeletePageHelpContents.message = "Are you sure you want to delete the selected page content(s)?";
+ this.alertModalDeletePageHelpContents.okButtonText = "Yes";
+ this.alertModalDeletePageHelpContents.open();
+ }
+ }
+
+ public confirmedDeletePageHelpContents(data: any) {
+ if (!Session.isLoggedIn()) {
+ this.router.navigate(['/user-info'], {
+ queryParams: {
+ "errorCode": LoginErrorCodes.NOT_VALID,
+ "redirectUrl": this.router.url
+ }
+ });
+ } else {
+ this.showLoading = true;
+ this.updateErrorMessage = "";
+
+ this.subscriptions.push(this._helpService.deleteDivHelpContents(this.selectedPageContents, this.properties.adminToolsAPIURL, this.portal).subscribe(
+ _ => {
+ this.deletePageHelpContentsFromArray(this.selectedPageContents);
+ UIkit.notification('Page content(s) has been successfully deleted', {
+ status: 'success',
+ timeout: 6000,
+ pos: 'bottom-right'
+ });
+ this.showLoading = false;
+ },
+ error => this.handleUpdateError('System error deleting the selected page content(s)', error)
+ ));
+ }
+ }
+
+ private deletePageHelpContentsFromArray(ids: string[]): void {
+ for (let id of ids) {
+ let iqc = this.checkboxes.findIndex(_ => _.divHelpContent._id == id);
+ let iq = this.pageHelpContents.findIndex(_ => _._id == id);
+ this.checkboxes.splice(iqc, 1);
+ this.pageHelpContents.splice(iqc, 1);
+ }
+ this.countPageHelpContents();
+ }
+
+ public editPageHelpContent(id: string) {
+ if (this.selectedPageId) {
+ this.router.navigate(['edit/'], {
+ queryParams: {
+ "pageContentId": id,
+ "pageId": this.selectedPageId
+ }, relativeTo: this.route
+ });
+ } else {
+ this.router.navigate(['edit/'], {
+ queryParams: {
+ "pageContentId": id,
+ }, relativeTo: this.route
+ });
+ }
+ }
+
+ public togglePageHelpContents(status: boolean, ids: string[]) {
+ if (!Session.isLoggedIn()) {
+ this.router.navigate(['/user-info'], {
+ queryParams: {
+ "errorCode": LoginErrorCodes.NOT_VALID,
+ "redirectUrl": this.router.url
+ }
+ });
+ } else {
+ this.updateErrorMessage = "";
+
+ this.subscriptions.push(this._helpService.toggleDivHelpContents(ids, status, this.properties.adminToolsAPIURL, this.portal).subscribe(
+ () => {
+ for (let id of ids) {
+ let i = this.checkboxes.findIndex(_ => _.divHelpContent._id == id);
+ this.checkboxes[i].divHelpContent.isActive = status;
+ }
+ this.countPageHelpContents();
+ this.applyCheck(false);
+ UIkit.notification('Page content(s) has been successfully updated', {
+ status: 'success',
+ timeout: 6000,
+ pos: 'bottom-right'
+ });
+ },
+ error => this.handleUpdateError('System error changing the status of the selected page content(s)', error)
+ ));
+ }
+ }
+
+
+ public filterPageHelpContent(pageHelpContent: DivHelpContent, filters: PageHelpContentFilterOptions): boolean {
+ let activeFlag = filters.active == null || pageHelpContent.isActive == filters.active;
+ let textFlag = filters.text.toString() == '' || (pageHelpContent.content).match(filters.text) != null;
+ return activeFlag && textFlag;
+ }
+
+
+ public applyFilter() {
+ this.checkboxes = [];
+ this.pageHelpContents.filter(item => this.filterPageHelpContent(item, this.filters)).forEach(
+ _ => {
+ this.checkboxes.push({divHelpContent: _, checked: false})
+ }
+ );
+ }
+
+ public filterByPage(event: any) {
+ if(event.target && event.target.value) {
+ this.filters.id = event.target.value;
+ this.applyFilter();
+ }
+ }
+ public filterBySearch(text: string) {
+ this.filters.text = new RegExp(text, "i");
+ this.applyFilter();
+ }
+
+ handleError(message: string, error) {
+ this.errorMessage = message;
+ console.log('Server responded: ' + error);
+
+ this.showLoading = false;
+ }
+
+ handleUpdateError(message: string, error) {
+ this.updateErrorMessage = message;
+ console.log('Server responded: ' + error);
+
+ this.showLoading = false;
+ }
+
+ public newPageContent() {
+ this.router.navigate(['edit'], {
+ queryParams: {
+ pageId: this.selectedPageId
+ }, relativeTo: this.route
+ });
+ }
+
+ public onSearchClose() {
+ this.selectedKeyword = this.filterForm.value;
+ }
+
+ public reset() {
+ this.selectedKeyword = null;
+ this.searchInputComponent.reset()
+ }
+ selectAll(){
+ let checked = !!(this.getSelectedPageHelpContents().length != this.checkboxes.length);
+ for (let check of this.checkboxes) {
+ check.checked = checked;
+ }
+ }
+}
diff --git a/dashboard/divhelpcontent/class-help-contents.module.ts b/dashboard/divhelpcontent/class-help-contents.module.ts
new file mode 100644
index 00000000..c7548b46
--- /dev/null
+++ b/dashboard/divhelpcontent/class-help-contents.module.ts
@@ -0,0 +1,38 @@
+import {NgModule} from '@angular/core';
+import {RouterModule} from '@angular/router';
+import {CommonModule} from '@angular/common';
+import {IsCommunity} from '../../connect/communityGuard/isCommunity.guard';
+import {ConnectAdminLoginGuard} from '../../connect/communityGuard/connectAdminLoginGuard.guard';
+import {FormsModule, ReactiveFormsModule} from '@angular/forms';
+import {AlertModalModule} from '../../utils/modal/alertModal.module';
+import {SafeHtmlPipeModule} from '../../utils/pipes/safeHTMLPipe.module';
+import {MatSlideToggleModule} from '@angular/material';
+import {AdminToolServiceModule} from '../../services/adminToolService.module';
+import {InputModule} from '../../sharedComponents/input/input.module';
+import {SearchInputModule} from '../../sharedComponents/search-input/search-input.module';
+import {IconsModule} from '../../utils/icons/icons.module';
+import {IconsService} from '../../utils/icons/icons.service';
+import {add, arrow_left} from '../../utils/icons/icons';
+import {LoadingModule} from '../../utils/loading/loading.module';
+import {HTMLToStringPipeModule} from '../../utils/pipes/HTMLToStringPipe.module';
+import {ClassHelpContentsRoutingModule} from './class-help-contents-routing.module';
+import {ClassHelpContentsComponent} from './class-help-contents.component';
+import {PageContentModule} from '../sharedComponents/page-content/page-content.module';
+
+@NgModule({
+ imports: [
+ CommonModule, RouterModule, FormsModule, SafeHtmlPipeModule,
+ AlertModalModule, ReactiveFormsModule, MatSlideToggleModule, AdminToolServiceModule, InputModule, ClassHelpContentsRoutingModule,
+ SearchInputModule, IconsModule, LoadingModule, HTMLToStringPipeModule, PageContentModule
+ ],
+ declarations: [
+ ClassHelpContentsComponent
+ ],
+ providers: [IsCommunity, ConnectAdminLoginGuard],
+ exports: [ClassHelpContentsComponent]
+})
+export class ClassHelpContentsModule {
+ constructor(private iconsService: IconsService) {
+ this.iconsService.registerIcons([add, arrow_left])
+ }
+}
diff --git a/dashboard/divhelpcontent/div-help-content-form.component.html b/dashboard/divhelpcontent/div-help-content-form.component.html
deleted file mode 100644
index 618a90e2..00000000
--- a/dashboard/divhelpcontent/div-help-content-form.component.html
+++ /dev/null
@@ -1,56 +0,0 @@
-{{updateErrorMessage}}
-{{errorMessage}}
-
-
-
- Create or edit help text
-
- Select the class to be displayed, add the content and click active to make it visible to dashboard
-
-
-
-
-
diff --git a/dashboard/divhelpcontent/div-help-content-form.component.ts b/dashboard/divhelpcontent/div-help-content-form.component.ts
deleted file mode 100644
index f398e623..00000000
--- a/dashboard/divhelpcontent/div-help-content-form.component.ts
+++ /dev/null
@@ -1,161 +0,0 @@
-import { Component, OnInit, Input } from '@angular/core';
-import { ActivatedRoute, Router } from "@angular/router";
-import { FormGroup, FormBuilder, Validators } from "@angular/forms";
-import { Page } from "../../utils/entities/adminTool/page";
-import { DivId } from "../../utils/entities/adminTool/divId";
-import { HelpContentService } from "../../services/help-content.service";
-import { EnvProperties } from '../../utils/properties/env-properties';
-
-import {Session} from '../../login/utils/helper.class';
-import {LoginErrorCodes} from '../../login/utils/guardHelper.class';
-
-@Component({
- selector: 'div-content-form',
- templateUrl: './div-help-content-form.component.html',
-})
-
-export class DivContentFormComponent implements OnInit{
-
- @Input('group')
- myForm: FormGroup;
- @Input('communityPid')
- communityPid: string;
- @Input('pageId')
- pageId: string;
- @Input('editMode')
- editMode: boolean = false;
-
- //public divIdName: string = '';
-
- private communityId: string = '';
-
- showPageSelect: boolean = true;
- selectedDiv: DivId;
-
- private availablePages : Page[] = [];
- private availableDivs : DivId[] = [];
-
- private ckeditorContent : string;
-
- public properties:EnvProperties = null;
-
- public showLoading: boolean = true;
- public errorMessage: string = '';
- @Input() updateErrorMessage: string = '';
-
- constructor(private route: ActivatedRoute, private _router: Router, private _fb: FormBuilder, private _helpContentService: HelpContentService){}
-
- ngOnInit() {
- this.myForm = this.form;
- this.route.data
- .subscribe((data: { envSpecific: EnvProperties }) => {
- this.properties = data.envSpecific;
- this.route.queryParams.subscribe(params => {
-
- if(!Session.isLoggedIn()){
- this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
- } else {
- if(this.pageId) {
- this.showPageSelect = false;
- this.getDivs(this.pageId);
- } else {
- if(!this.editMode) {
- this._helpContentService.getCommunityPagesWithDivId(this.communityPid, this.properties.adminToolsAPIURL).subscribe(
- pages => {
- this.availablePages = pages;
- this.showLoading = false;
- },
- error => this.handleError('System error retrieving pages', error));
- }
- }
-
- this.getCommunity(this.communityPid);
- }
- });
- });
-
- }
-
- public pageSelected(event) {
- if(!Session.isLoggedIn()){
- this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
- } else {
- this.getDivs(event.target.value);
- }
- }
-
- public divIdSelected(div: DivId) {
- this.selectedDiv = div;
- }
-
- public getCommunity(communityPid: string) {
- if(!Session.isLoggedIn()){
- this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
- } else {
- this.showLoading = true;
- this.errorMessage = '';
-
- this._helpContentService.getCommunity(this.communityPid, this.properties.adminToolsAPIURL).subscribe(
- community => {
- this.communityId = community._id;
-
- this.myForm.patchValue({
- community: this.communityId
- });
- this.showLoading = false;
- },
- error => this.handleError('System error retrieving community', error)
- );
- }
- }
-
- public getDivs(pageId: string) {
- if(!Session.isLoggedIn()){
- this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
- } else {
- //this.showLoading = true;
- this.errorMessage = '';
-
- this._helpContentService.getDivIdsFullByPortal(pageId, this.properties.adminToolsAPIURL, this.communityPid).subscribe(
- divs => {
- this.availableDivs = divs;
- this.pageId = pageId;
-
- this.showLoading = false;
- },
- error => this.handleError('System error retrieving pages', error));
- }
- }
-
- // public selectedDiv(event) {
- // console.info(event.target.value);
- // }
-
- public get form() {
- return this._fb.group({
- divId: ['', Validators.required],
- content: ['', Validators.required],
- isActive: true,
- portal: '',
- _id : '',
- });
- }
-
- public reset() {
- this.myForm.patchValue({
- divId: '',
- content: '',
- isActive: true,
- portal: '',
- _id : ''
- });
- this.myForm.markAsPristine();
- }
-
- handleError(message: string, error) {
- this.errorMessage = message;
- console.log('Server responded: ' + error);
-
- this.showLoading = false;
- }
-}
diff --git a/dashboard/divhelpcontent/div-help-content-form.module.ts b/dashboard/divhelpcontent/div-help-content-form.module.ts
deleted file mode 100644
index 421788a3..00000000
--- a/dashboard/divhelpcontent/div-help-content-form.module.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-import { NgModule } from '@angular/core';
-import {CommonModule} from '@angular/common';
-import {FormsModule, ReactiveFormsModule} from '@angular/forms';
-import {AlertModalModule} from '../../utils/modal/alertModal.module';
-import {SafeHtmlPipeModule} from '../../utils/pipes/safeHTMLPipe.module';
-import {DivContentFormComponent} from './div-help-content-form.component';
-import {CKEditorModule} from 'ng2-ckeditor';
-
-@NgModule({
- imports: [
- CommonModule, FormsModule,
- SafeHtmlPipeModule, CKEditorModule,
- AlertModalModule, ReactiveFormsModule
- ],
- declarations: [
- DivContentFormComponent
- ],
- exports: [DivContentFormComponent]
-})
-export class DivHelpContentFormModule { }
diff --git a/dashboard/divhelpcontent/div-help-contents-routing.module.ts b/dashboard/divhelpcontent/div-help-contents-routing.module.ts
deleted file mode 100644
index b38b8c69..00000000
--- a/dashboard/divhelpcontent/div-help-contents-routing.module.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-import { NgModule } from '@angular/core';
-import {RouterModule} from '@angular/router';
-import {DivHelpContentsComponent} from "./div-help-contents.component";
-
-@NgModule({
- imports: [
- RouterModule.forChild([
- { path: '', component: DivHelpContentsComponent}
- ])
- ]
-})
-export class DivHelpContentsRoutingModule { }
diff --git a/dashboard/divhelpcontent/div-help-contents.component.html b/dashboard/divhelpcontent/div-help-contents.component.html
deleted file mode 100644
index 3d7bd389..00000000
--- a/dashboard/divhelpcontent/div-help-contents.component.html
+++ /dev/null
@@ -1,152 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
{{errorMessage}}
-
-
-
-
-
-
- Enable or disable help text to show or hide it from the dashboard
-
-
-
-
-
-
-
-
-
-
-
No class help texts found
-
-
-
-
-
-
Go back to {{page.type}} pages
-
-
-
-
-
-
-
diff --git a/dashboard/divhelpcontent/div-help-contents.component.ts b/dashboard/divhelpcontent/div-help-contents.component.ts
deleted file mode 100644
index 964e9424..00000000
--- a/dashboard/divhelpcontent/div-help-contents.component.ts
+++ /dev/null
@@ -1,436 +0,0 @@
-import {Component, ViewChild, OnInit, ElementRef} from '@angular/core';
-import {Router, ActivatedRoute} from "@angular/router";
-import {FormBuilder, FormControl, FormGroup} from "@angular/forms";
-import {HelpContentService} from "../../services/help-content.service";
-import {
- DivHelpContent,
- CheckDivHelpContent,
- DivHelpContentFilterOptions
-} from "../../utils/entities/adminTool/div-help-content";
-import {Page} from "../../utils/entities/adminTool/page";
-import {Portal} from "../../utils/entities/adminTool/portal";
-import {DivId} from "../../utils/entities/adminTool/divId";
-import {EnvProperties} from '../../utils/properties/env-properties';
-
-import {Session} from '../../login/utils/helper.class';
-import {LoginErrorCodes} from '../../login/utils/guardHelper.class';
-import {HelperFunctions} from "../../utils/HelperFunctions.class";
-import {Subscriber} from "rxjs";
-import {properties} from "../../../../environments/environment";
-import {StringUtils} from '../../utils/string-utils.class';
-
-@Component({
- selector: 'div-help-contents',
- templateUrl: './div-help-contents.component.html',
-})
-
-export class DivHelpContentsComponent implements OnInit {
- // @ViewChild('deleteConfirmationModal')
- // public deleteConfirmationModal : DeleteConfirmationDialogComponent;
- @ViewChild('AlertModalDeleteDivHelpContents') alertModalDeleteDivHelpContents;
- private selectedDivContents: string[] = [];
-
- public checkboxes: CheckDivHelpContent[] = [];
-
- public divHelpContents: DivHelpContent[] = [];
-
- //public errorMessage: string;
-
- public formGroup: FormGroup;
-
- public pages: Page[];
-
- public checkboxAll: boolean = false;
-
- public filters: DivHelpContentFilterOptions = {id: '', active: null, text: new RegExp('')};
- public keyword: string = "";
-
- public counter = {all: 0, active: 0, inactive: 0};
-
- public communities: Portal[] = [];
-
- public selectedCommunityPid: string;
-
- public selectedPageId: string;
-
- public community: Portal;
-
- public page: Page;
- public properties: EnvProperties = null;
-
- public showLoading: boolean = true;
- public errorMessage: string = '';
- public updateErrorMessage: string = '';
- public filterForm: FormControl;
- public selectForm: FormControl;
- public selectOptions = [];
- private subscriptions: any[] = [];
-
- ngOnInit() {
- this.filterForm = this._fb.control('');
- this.selectForm = this._fb.control('');
- this.subscriptions.push(this.filterForm.valueChanges.subscribe(value => {
- this.filterBySearch(value);
- }));
- this.subscriptions.push(this.selectForm.valueChanges.subscribe(value => {
- this.filterByPage(value);
- }));
-
- this.properties = properties;
-
- this.subscriptions.push(this.route.queryParams.subscribe(params => {
- HelperFunctions.scroll();
-
- this.selectedCommunityPid = params['communityId'];
- this.selectedPageId = params['pageId'];
-
- if (this.selectedCommunityPid && this.selectedPageId) {
- this.getPage(this.selectedPageId);
- } else if (this.selectedCommunityPid) {
- this.selectedPageId = "";
- this.getPages(this.selectedCommunityPid);
- }
- }));
-
- }
-
- constructor(private element: ElementRef, private route: ActivatedRoute, private _helpService: HelpContentService, private router: Router, private _fb: FormBuilder) {
- }
-
- ngOnDestroy(): void {
- this.subscriptions.forEach(value => {
- if (value instanceof Subscriber) {
- value.unsubscribe();
- } else if (value instanceof Function) {
- value();
- }
- });
- }
-
- getPage(pageId: string) {
- if (!Session.isLoggedIn()) {
- this.router.navigate(['/user-info'], {
- queryParams: {
- "errorCode": LoginErrorCodes.NOT_VALID,
- "redirectUrl": this.router.url
- }
- });
- } else {
- this.showLoading = true;
- this.updateErrorMessage = "";
- this.errorMessage = "";
-
- this._helpService.getPageByPortal(pageId, this.properties.adminToolsAPIURL, this.selectedCommunityPid).subscribe(
- page => {
- if (this.properties.adminToolsPortalType != page.portalType) {
- this.router.navigate(['../../classContents'], {queryParams: {"communityId": this.selectedCommunityPid}});
- } else {
- this.page = page;
- this.getDivHelpContents(this.selectedCommunityPid);
- }
- },
- error => this.handleError('System error retrieving page', error));
- }
- }
-
- getPages(community_pid: string) {
- if (!Session.isLoggedIn()) {
- this.router.navigate(['/user-info'], {
- queryParams: {
- "errorCode": LoginErrorCodes.NOT_VALID,
- "redirectUrl": this.router.url
- }
- });
- } else {
- this.showLoading = true;
- this.updateErrorMessage = "";
- this.errorMessage = "";
-
- this._helpService.getCommunityPagesWithDivId(community_pid, this.properties.adminToolsAPIURL).subscribe(
- //this._helpService.getPagesWithDivIds(community_pid, this.properties.adminToolsAPIURL).subscribe(
- pages => {
- this.pages = pages;
- this.getDivHelpContents(this.selectedCommunityPid);
- this.selectOptions = [{label:'All pages', value: ''}];
- for (let page of this.pages) {
- this.selectOptions.push({label:page.name, value: page._id})
- }
- },
- error => this.handleError('System error retrieving pages', error));
- }
- }
-
- public countDivHelpContents() {
- this.counter = {all: 0, active: 0, inactive: 0};
- let filter = Object.assign({}, this.filters);
- filter.active = null;
- this.divHelpContents.forEach(_ => {
- if (this.filterDivHelpContent(_, filter)) {
- if (_.isActive == true) this.counter.active++;
- else this.counter.inactive++
- }
- });
- this.counter.all = this.counter.active + this.counter.inactive;
- }
-
- getDivHelpContents(community_pid: string) {
- if (!Session.isLoggedIn()) {
- this.router.navigate(['/user-info'], {
- queryParams: {
- "errorCode": LoginErrorCodes.NOT_VALID,
- "redirectUrl": this.router.url
- }
- });
- } else {
- this._helpService.getCommunityDivHelpContents(community_pid, this.properties.adminToolsAPIURL).subscribe(
- divHelpContents => {
- this.divHelpContents = divHelpContents as Array;
- this.counter.all = this.divHelpContents.length;
- this.checkboxes = [];
-
- for (let i = this.divHelpContents.length - 1; i >= 0; i -= 1) {
- //for (let i = 0; i < this.divHelpContents.length; i++) {
- let divId: DivId = this.divHelpContents[i].divId as DivId;
- let pages: Page[] = divId.pages as Page[];
- const pageIds = pages.map(x => x._id);
-
- if (!this.selectedPageId || pageIds.includes(this.selectedPageId)) {
- this.cutContent(this.divHelpContents[i]);
- this.checkboxes.unshift({divHelpContent: this.divHelpContents[i], checked: false});
- } else {
- this.divHelpContents.splice(i, 1);
- }
- }
-
- this.countDivHelpContents();
-
- this.showLoading = false;
- },
- error => this.handleError('System error retrieving page contents', error));
- }
- }
-
- public toggleCheckBoxes(event) {
- this.checkboxes.forEach(_ => _.checked = event.target.checked);
- this.checkboxAll = event.target.checked;
- }
-
- public applyCheck(flag: boolean) {
- this.checkboxes.forEach(_ => _.checked = flag);
- this.checkboxAll = false;
- }
-
- public getSelectedDivHelpContents(): string[] {
- return this.checkboxes.filter(divHelpContent => divHelpContent.checked == true)
- .map(checkedDivHelpContent => checkedDivHelpContent.divHelpContent).map(res => res._id);
- }
-
- public confirmDeleteDivHelpContent(id: string) {
- //this.deleteConfirmationModal.ids = [id];
- //this.deleteConfirmationModal.showModal();
- this.selectedDivContents = [id];
- this.confirmModalOpen();
- }
-
- public confirmDeleteSelectedDivHelpContents() {
- //this.deleteConfirmationModal.ids = this.getSelectedDivHelpContents();
- //this.deleteConfirmationModal.showModal();
- this.selectedDivContents = this.getSelectedDivHelpContents();
- this.confirmModalOpen();
- }
-
- private confirmModalOpen() {
- if (!Session.isLoggedIn()) {
- this.router.navigate(['/user-info'], {
- queryParams: {
- "errorCode": LoginErrorCodes.NOT_VALID,
- "redirectUrl": this.router.url
- }
- });
- } else {
- this.alertModalDeleteDivHelpContents.cancelButton = true;
- this.alertModalDeleteDivHelpContents.okButton = true;
- this.alertModalDeleteDivHelpContents.alertTitle = "Delete Confirmation";
- this.alertModalDeleteDivHelpContents.message = "Are you sure you want to delete the help text(s)?";
- this.alertModalDeleteDivHelpContents.okButtonText = "Yes";
- this.alertModalDeleteDivHelpContents.open();
- }
- }
-
- public confirmedDeleteDivHelpContents(data: any) {
- if (!Session.isLoggedIn()) {
- this.router.navigate(['/user-info'], {
- queryParams: {
- "errorCode": LoginErrorCodes.NOT_VALID,
- "redirectUrl": this.router.url
- }
- });
- } else {
- this.showLoading = true;
- this.updateErrorMessage = "";
-
- this._helpService.deleteDivHelpContents(this.selectedDivContents, this.properties.adminToolsAPIURL, this.selectedCommunityPid).subscribe(
- _ => {
- this.deleteDivHelpContentsFromArray(this.selectedDivContents);
- this.showLoading = false;
- },
- error => this.handleUpdateError('System error deleting the selected class content(s)', error)
- );
- }
- }
-
- private deleteDivHelpContentsFromArray(ids: string[]): void {
- for (let id of ids) {
- let iqc = this.checkboxes.findIndex(_ => _.divHelpContent._id == id);
- let iq = this.divHelpContents.findIndex(_ => _._id == id);
- this.checkboxes.splice(iqc, 1);
- this.divHelpContents.splice(iqc, 1);
- }
- this.countDivHelpContents();
- }
-
- public editDivHelpContent(id: string) {
- //this.router.navigate(['/pageContents/edit/', _id]);
- if (this.selectedPageId) {
- this.router.navigate(['../../classContents/edit/'], {
- queryParams: {
- "classContentId": id,
- "communityId": this.selectedCommunityPid,
- "pageId": this.selectedPageId
- }
- });
- } else {
- this.router.navigate(['../../classContents/edit/'], {
- queryParams: {
- "classContentId": id,
- "communityId": this.selectedCommunityPid
- }
- });
- }
- }
-
- public toggleDivHelpContents(status: boolean, ids: string[]) {
- if (!Session.isLoggedIn()) {
- this.router.navigate(['/user-info'], {
- queryParams: {
- "errorCode": LoginErrorCodes.NOT_VALID,
- "redirectUrl": this.router.url
- }
- });
- } else {
- this.updateErrorMessage = "";
-
- this._helpService.toggleDivHelpContents(ids, status, this.properties.adminToolsAPIURL,this.selectedCommunityPid).subscribe(
- () => {
- for (let id of ids) {
- let i = this.checkboxes.findIndex(_ => _.divHelpContent._id == id);
- this.checkboxes[i].divHelpContent.isActive = status;
- }
- this.countDivHelpContents();
- this.applyCheck(false);
- },
- error => this.handleUpdateError('System error changing the status of the selected page content(s)', error)
- );
- }
- }
-
- public divHelpContentSavedSuccessfully(divHelpContent: DivHelpContent) {
- this.cutContent(divHelpContent);
- this.checkboxes.push({divHelpContent: divHelpContent, checked: false});
- this.divHelpContents.push(divHelpContent);
- this.applyCheck(false);
- this.countDivHelpContents();
- }
-
- public divHelpContentUpdatedSuccessfully(divHelpContent: DivHelpContent) {
- this.checkboxes.find(checkItem => checkItem.divHelpContent._id == divHelpContent._id).divHelpContent = divHelpContent;
- let index = this.divHelpContents.findIndex(checkItem => checkItem._id == divHelpContent._id);
- this.divHelpContents[index] = divHelpContent;
- this.applyCheck(false);
- this.countDivHelpContents();
- }
-
-
- public filterDivHelpContent(divHelpContent: DivHelpContent, filters: DivHelpContentFilterOptions): boolean {
- let divId: DivId = divHelpContent.divId as DivId;
- let pages: Page[] = divId.pages;
- let pageIds: string[] = pages.map(x => x._id);
-
- let idFlag = filters.id == '' || /*(divId.pages)._id == filters.id*/ pageIds.includes(filters.id);
- let activeFlag = filters.active == null || divHelpContent.isActive == filters.active;
- let textFlag = filters.text.toString() == '' || (divHelpContent.content).match(filters.text) != null
- || ((divHelpContent.divId).name).match(filters.text) != null;
- return idFlag && activeFlag && textFlag;
- }
-
- public cutContent(divHelpContent: DivHelpContent) {
- divHelpContent.content = StringUtils.HTMLToString(divHelpContent.content);
- if (divHelpContent.content.length > 200) {
- divHelpContent.content = divHelpContent.content.substr(0, 200) + "...";
- }
- }
-
- public applyFilter() {
- this.checkboxes = [];
- this.divHelpContents.filter(item => this.filterDivHelpContent(item, this.filters)).forEach(
- _ => {
- this.cutContent(_);
- this.checkboxes.push({divHelpContent: _, checked: false})
- }
- );
- this.countDivHelpContents();
- }
-
- public filterByPage(value: any) {
- this.filters.id = value;
- this.applyFilter();
- }
-
- public displayAllDivHelpContents() {
- this.filters.active = null;
- this.applyFilter();
- }
-
- public displayActiveDivHelpContents() {
- this.filters.active = true;
- this.applyFilter();
- }
-
- public filterBySearch(text: string) {
- this.filters.text = new RegExp(text, "i");
- this.applyFilter();
- }
-
- public displayInactiveDivHelpContents() {
- this.filters.active = false;
- this.applyFilter();
- }
-
- handleError(message: string, error) {
- this.errorMessage = message;
- console.log('Server responded: ' + error);
-
- this.showLoading = false;
- }
-
- handleUpdateError(message: string, error) {
- this.updateErrorMessage = message;
- console.log('Server responded: ' + error);
-
- this.showLoading = false;
- }
-
- public newClassContent() {
- console.log("AAA")
- if (this.selectedPageId) {
- this.router.navigate(['../../classContents/new'], {
- queryParams: {
- communityId: this.selectedCommunityPid,
- pageId: this.selectedPageId
- }, relativeTo: this.route
- });
- } else {
- this.router.navigate(['../../classContents/new'], {queryParams: {communityId: this.selectedCommunityPid}, relativeTo: this.route});
- }
- }
-}
diff --git a/dashboard/divhelpcontent/div-help-contents.module.ts b/dashboard/divhelpcontent/div-help-contents.module.ts
deleted file mode 100644
index ce65330c..00000000
--- a/dashboard/divhelpcontent/div-help-contents.module.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import {NgModule} from '@angular/core';
-import {RouterModule} from '@angular/router';
-import {CommonModule} from '@angular/common';
-import {FormsModule, ReactiveFormsModule} from '@angular/forms';
-import {AlertModalModule} from '../../utils/modal/alertModal.module';
-import {SafeHtmlPipeModule} from '../../utils/pipes/safeHTMLPipe.module';
-import {DivHelpContentsComponent} from './div-help-contents.component';
-import {MatSlideToggleModule} from '@angular/material';
-import {AdminToolServiceModule} from "../../services/adminToolService.module";
-import {InputModule} from "../../sharedComponents/input/input.module";
-import {DivHelpContentsRoutingModule} from "./div-help-contents-routing.module";
-
-@NgModule({
- imports: [
- CommonModule, RouterModule, FormsModule, SafeHtmlPipeModule,
- AlertModalModule, ReactiveFormsModule, MatSlideToggleModule, AdminToolServiceModule, InputModule, DivHelpContentsRoutingModule
- ],
- declarations: [
- DivHelpContentsComponent
- ],
- exports: [DivHelpContentsComponent]
-})
-export class DivHelpContentsModule { }
diff --git a/dashboard/divhelpcontent/edit-div-help-content-routing.module.ts b/dashboard/divhelpcontent/edit-div-help-content-routing.module.ts
deleted file mode 100644
index a7b85f6b..00000000
--- a/dashboard/divhelpcontent/edit-div-help-content-routing.module.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-import { NgModule } from '@angular/core';
-import {RouterModule} from '@angular/router';
-import {EditDivHelpContentComponent} from "./edit-div-help-content.component";
-
-
-@NgModule({
- imports: [
- RouterModule.forChild([
- { path: '', component: EditDivHelpContentComponent}
- ])
- ]
-})
-export class EditDivHelpContentRoutingModule { }
diff --git a/dashboard/divhelpcontent/edit-div-help-content.component.html b/dashboard/divhelpcontent/edit-div-help-content.component.html
deleted file mode 100644
index e2fde7c4..00000000
--- a/dashboard/divhelpcontent/edit-div-help-content.component.html
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
-
-
-
-
{{errorMessage}}
-
-
-
-
-
-
-
-
-
diff --git a/dashboard/divhelpcontent/edit-div-help-content.component.ts b/dashboard/divhelpcontent/edit-div-help-content.component.ts
deleted file mode 100644
index 33861d3b..00000000
--- a/dashboard/divhelpcontent/edit-div-help-content.component.ts
+++ /dev/null
@@ -1,180 +0,0 @@
-import { Component, ViewChild, OnInit, OnDestroy, ElementRef } from '@angular/core';
-import { DivContentFormComponent } from "./div-help-content-form.component";
-import { Subscription } from "rxjs";
-import { HelpContentService } from "../../services/help-content.service";
-import { DivHelpContent } from "../../utils/entities/adminTool/div-help-content";
-import { ActivatedRoute, Router } from "@angular/router";
-import { EnvProperties } from '../../utils/properties/env-properties';
-
-import {Session} from '../../login/utils/helper.class';
-import {LoginErrorCodes} from '../../login/utils/guardHelper.class';
-import {HelperFunctions} from "../../utils/HelperFunctions.class";
-import {Page} from "../../utils/entities/adminTool/page";
-
-@Component({
- selector: 'edit-div-help-content',
- templateUrl: 'edit-div-help-content.component.html',
-})
-
-export class EditDivHelpContentComponent implements OnInit, OnDestroy{
-
- @ViewChild(DivContentFormComponent)
- public formComponent : DivContentFormComponent;
-
- public communityPid: string;
- public pageId: string;
- public page: Page;
-
- private sub: Subscription;
-
- private divHelpContent: DivHelpContent;
-
- public properties:EnvProperties = null;
-
- public showLoading: boolean = true;
- public errorMessage: string = '';
- public updateErrorMessage: string = '';
-
- constructor(
- private element: ElementRef,
- private route: ActivatedRoute,
- private router: Router,
- private _helpContentService: HelpContentService) {}
-
- ngOnInit() {
- this.route.data
- .subscribe((data: { envSpecific: EnvProperties }) => {
- this.properties = data.envSpecific;
- this.sub = this.route.queryParams.subscribe(params => {
- HelperFunctions.scroll();
-
- //let id = params['id'];
- let divContentId = params['classContentId'];
- this.communityPid = params['communityId'];
- this.pageId = params['pageId'];
-
- if(!divContentId) {
- this.router.navigate(['../../'], { queryParams: { "communityId": this.communityPid} });
- }
-
- this.getDivHelpContent(divContentId);
- });
- });
- }
- ngOnDestroy() {
- this.sub.unsubscribe();
- }
-
- handleError(message: string, error) {
- this.errorMessage = message;
- console.log('Server responded: ' + error);
- this.showLoading = false;
- }
-
- handleUpdateError(message: string, error) {
- this.updateErrorMessage = message;
- console.log('Server responded: ' + error);
- this.showLoading = false;
- }
-
- private getPage(pageId: string) {
- this._helpContentService.getPageByPortal(pageId,this.properties.adminToolsAPIURL, this.communityPid).subscribe(
- page => {
- if(this.properties.adminToolsPortalType != page.portalType) {
- this.router.navigate(['../../'], { queryParams: { "communityId": this.communityPid} });
- } else {
- this.page = page;
- this.showLoading = false;
- }
- },
- error => this.handleError('System error retrieving page with id: '+pageId, error)
- );
- }
-
- private getDivHelpContent(divContentId: string) {
- if(!Session.isLoggedIn()){
- this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} });
- } else {
- this.showLoading = true;
- this.errorMessage = "";
- this.updateErrorMessage = "";
-
- this._helpContentService.getDivHelpContent(divContentId, this.properties.adminToolsAPIURL, this.communityPid).subscribe(
- divHelpContent => {
- if(this.pageId) {
- this.getPage(this.pageId);
- }
- this.updateForm(divHelpContent);
- this.showLoading = false;
- },
- error => this.handleError('System error retrieving class help content', error));
- }
- }
-
- getDivId(divId: string) {
- if(!Session.isLoggedIn()){
- this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} });
- } else {
- this.showLoading = true;
-
- this._helpContentService.getDivIdFull(divId, this.properties.adminToolsAPIURL, this.communityPid).subscribe(
- div => {
- this.formComponent.selectedDiv = div;
-
- if(!this.pageId) {
- this.formComponent.getDivs("");
- }
-
- this.showLoading = false;
- },
- error => this.handleError('System error retrieving class', error)
- );
- }
- }
-
- private updateForm(divHelpContent : DivHelpContent) {
- this.divHelpContent = divHelpContent;
-
- this.getDivId(divHelpContent.divId as string);
-
- this.formComponent.myForm.patchValue((divHelpContent));
- }
-
- public saveCustom() {
- if(!Session.isLoggedIn()){
- this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} });
- } else {
- if(this.formComponent.myForm.valid) {
- this.showLoading = true;
- this.updateErrorMessage = "";
-
- let divHelpContent : DivHelpContent = this.formComponent.myForm.value;
-
- this._helpContentService.insertOrUpdateDivHelpContent(divHelpContent, this.properties.adminToolsAPIURL, this.communityPid).subscribe(
- _ => {
- if(this.pageId) {
- this.router.navigate( ['../../'], { queryParams: { "communityId": this.communityPid, "pageId": this.pageId } } );
- } else {
- this.router.navigate(['../../'], { queryParams: { "communityId": this.communityPid } } );
- }
- this.showLoading = false;
- },
- err => this.handleUpdateError('System error updating class content', err)
- );
- } else {
- this.errorMessage = "Please fill all required fields";
- }
- }
- }
-
- public cancelCustom() {
- this.errorMessage = "";
- this.updateErrorMessage = "";
-
- if(this.pageId) {
- this.router.navigate( ['../../'], { queryParams: { "communityId": this.communityPid, "pageId": this.pageId } } );
- } else {
- this.router.navigate(['../../'], { queryParams: { "communityId": this.communityPid } } );
- }
- }
-}
diff --git a/dashboard/divhelpcontent/edit-div-help-content.module.ts b/dashboard/divhelpcontent/edit-div-help-content.module.ts
deleted file mode 100644
index 8ae5d0ca..00000000
--- a/dashboard/divhelpcontent/edit-div-help-content.module.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import {NgModule} from '@angular/core';
-import {RouterModule} from '@angular/router';
-import {CommonModule} from '@angular/common';
-import {EditDivHelpContentComponent} from './edit-div-help-content.component';
-import {DivHelpContentFormModule} from './div-help-content-form.module';
-import {AdminToolServiceModule} from "../../services/adminToolService.module";
-import {EditDivHelpContentRoutingModule} from "./edit-div-help-content-routing.module";
-
-@NgModule({
- imports: [
- CommonModule, RouterModule,
- DivHelpContentFormModule, AdminToolServiceModule, EditDivHelpContentRoutingModule
- ],
- declarations: [
- EditDivHelpContentComponent
- ],
- exports: [EditDivHelpContentComponent]
-})
-export class EditDivHelpContentModule { }
diff --git a/dashboard/divhelpcontent/new-div-help-content-routing.module.ts b/dashboard/divhelpcontent/new-div-help-content-routing.module.ts
deleted file mode 100644
index 7045c2a5..00000000
--- a/dashboard/divhelpcontent/new-div-help-content-routing.module.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-import { NgModule } from '@angular/core';
-import {RouterModule} from '@angular/router';
-import {NewDivHelpContentComponent} from "./new-div-help-content.component";
-
-@NgModule({
- imports: [
- RouterModule.forChild([
- { path: '', component: NewDivHelpContentComponent}
- ])
- ]
-})
-export class NewDivHelpContentRoutingModule { }
diff --git a/dashboard/divhelpcontent/new-div-help-content.component.html b/dashboard/divhelpcontent/new-div-help-content.component.html
deleted file mode 100644
index 23e25058..00000000
--- a/dashboard/divhelpcontent/new-div-help-content.component.html
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
{{errorMessage}}
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/dashboard/divhelpcontent/new-div-help-content.component.ts b/dashboard/divhelpcontent/new-div-help-content.component.ts
deleted file mode 100644
index 0741e5e0..00000000
--- a/dashboard/divhelpcontent/new-div-help-content.component.ts
+++ /dev/null
@@ -1,123 +0,0 @@
-import { Component, ViewChild, ElementRef } from '@angular/core';
-import { ActivatedRoute, Router } from "@angular/router";
-import { DivContentFormComponent } from "./div-help-content-form.component";
-import { DivHelpContent } from "../../utils/entities/adminTool/div-help-content";
-import { HelpContentService } from "../../services/help-content.service";
-import { EnvProperties } from '../../utils/properties/env-properties';
-
-import {Session} from '../../login/utils/helper.class';
-import {LoginErrorCodes} from '../../login/utils/guardHelper.class';
-import {HelperFunctions} from "../../utils/HelperFunctions.class";
-import {Page} from "../../utils/entities/adminTool/page";
-
-@Component({
- selector: 'new-div-help-content',
- templateUrl: 'new-div-help-content.component.html',
-})
-
-export class NewDivHelpContentComponent {
-
- @ViewChild(DivContentFormComponent)
- public formComponent : DivContentFormComponent;
-
- //private errorMessage : string = null;
-
- public communityPid: string;
-
- public pageId: string;
- public page: Page;
-
- public properties:EnvProperties = null;
-
- public showLoading: boolean = true;
- public errorMessage: string = '';
- public updateErrorMessage: string = '';
-
- constructor(
- private element: ElementRef,
- private route: ActivatedRoute,
- private router: Router,
- private _helpContentService: HelpContentService) {}
-
- ngOnInit() {
- this.route.data
- .subscribe((data: { envSpecific: EnvProperties }) => {
- this.properties = data.envSpecific;
- this.route.queryParams.subscribe(params => {
- HelperFunctions.scroll();
-
- this.communityPid = params['communityId'];
- this.pageId = params['pageId'];
-
-
- if(this.pageId) {
- this.getPage(this.pageId);
- } else {
- this.showLoading = false;
- }
- });
- });
- }
-
- private getPage(pageId: string) {
- this._helpContentService.getPageByPortal(pageId,this.properties.adminToolsAPIURL, this.communityPid).subscribe(
- page => {
- if(this.properties.adminToolsPortalType != page.portalType) {
- this.router.navigate(['../../'], { queryParams: { "communityId": this.communityPid}, relativeTo: this.route });
- } else {
- this.page = page;
- this.showLoading = false;
- console.info(this.page);
- }
- },
- error => this.handleError('System error retrieving page with id: '+pageId, error)
- );
- }
-
- public saveCustom() {
- if(!Session.isLoggedIn()){
- this.router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this.router.url} });
- } else {
- if(this.formComponent.myForm.valid) {
- this.showLoading = true;
- this.updateErrorMessage = "";
-
- let divHelpContent : DivHelpContent = this.formComponent.myForm.value;
-
- this._helpContentService.insertOrUpdateDivHelpContent(divHelpContent, this.properties.adminToolsAPIURL, this.communityPid).subscribe(
- _ => {
- if(this.pageId) {
- this.router.navigate( ['../../'], { queryParams: { "communityId": this.communityPid, "pageId": this.pageId } , relativeTo: this.route} );
- } else {
- this.router.navigate(['../../'], { queryParams: { "communityId": this.communityPid } , relativeTo: this.route} );
- }
- this.showLoading = false;
- },
- err => this.handleUpdateError('System error saving page content', err)
- );
- } else {
- this.errorMessage = "Please fill all required fields";
- }
- }
- }
-
- public cancelCustom() {
- if(this.pageId) {
- this.router.navigate( ['../../'], { queryParams: { "communityId": this.communityPid, "pageId": this.pageId }, relativeTo: this.route } );
- } else {
- this.router.navigate(['../../'], { queryParams: { "communityId": this.communityPid }, relativeTo: this.route } );
- }
- }
-
- handleUpdateError(message: string, error) {
- this.errorMessage = message;
- console.log('Server responded: ' + error);
- this.showLoading = false;
- }
-
- handleError(message: string, error) {
- this.errorMessage = message;
- console.log('Server responded: ' + error);
- this.showLoading = false;
- }
-}
diff --git a/dashboard/divhelpcontent/new-div-help-content.module.ts b/dashboard/divhelpcontent/new-div-help-content.module.ts
deleted file mode 100644
index 38439247..00000000
--- a/dashboard/divhelpcontent/new-div-help-content.module.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import {NgModule} from '@angular/core';
-import {RouterModule} from '@angular/router';
-import {CommonModule} from '@angular/common';
-import {NewDivHelpContentComponent} from './new-div-help-content.component';
-import {DivHelpContentFormModule} from './div-help-content-form.module';
-import {AdminToolServiceModule} from "../../services/adminToolService.module";
-import {NewDivHelpContentRoutingModule} from "./new-div-help-content-routing.module";
-
-@NgModule({
- imports: [
- CommonModule, RouterModule,
- DivHelpContentFormModule, AdminToolServiceModule, NewDivHelpContentRoutingModule
- ],
- declarations: [
- NewDivHelpContentComponent
- ],
- exports: [NewDivHelpContentComponent]
-})
-export class NewDivHelpContentModule { }
diff --git a/dashboard/helpTexts/page-help-contents.component.ts b/dashboard/helpTexts/page-help-contents.component.ts
index 1b3feb12..7939168e 100644
--- a/dashboard/helpTexts/page-help-contents.component.ts
+++ b/dashboard/helpTexts/page-help-contents.component.ts
@@ -45,7 +45,6 @@ export class PageHelpContentsComponent implements OnInit {
public showLoading: boolean = true;
public filterForm: FormControl;
public selectForm: FormControl;
- public selectOptions = [];
private subscriptions: any[] = [];
public selectedKeyword: string;
@ViewChild('searchInputComponent') searchInputComponent: SearchInputComponent;
@@ -110,31 +109,7 @@ export class PageHelpContentsComponent implements OnInit {
error => this.handleError('System error retrieving page', error)));
}
}
-
- getPages(community_pid: string) {
- if (!Session.isLoggedIn()) {
- this.router.navigate(['/user-info'], {
- queryParams: {
- "errorCode": LoginErrorCodes.NOT_VALID,
- "redirectUrl": this.router.url
- }
- });
- } else {
- this.showLoading = true;
- //this._helpService.getCommunityPages(community_pid, "", this.properties.adminToolsAPIURL).subscribe(
- this.subscriptions.push(this._helpService.getCommunityPagesWithPositions(community_pid, this.properties.adminToolsAPIURL).subscribe(
- pages => {
- this.pages = pages;
- this.getPageHelpContents(this.portal);
- this.selectOptions = [{label: 'All pages', value: ''}];
- for (let page of this.pages) {
- this.selectOptions.push({label: page.name, value: page._id})
- }
- },
- error => this.handleError('System error retrieving pages', error)));
- }
- }
-
+
public countPageHelpContents() {
this.counter = {all: 0, active: 0, inactive: 0};
let filter = Object.assign({}, this.filters);
@@ -194,15 +169,11 @@ export class PageHelpContentsComponent implements OnInit {
}
public confirmDeletePageHelpContent(id: string) {
- //this.deleteConfirmationModal.ids = [id];
- //this.deleteConfirmationModal.showModal();
this.selectedPageContents = [id];
this.confirmModalOpen();
}
public confirmDeleteSelectedPageHelpContents() {
- //this.deleteConfirmationModal.ids = this.getSelectedPageHelpContents();
- //this.deleteConfirmationModal.showModal();
this.selectedPageContents = this.getSelectedPageHelpContents();
this.confirmModalOpen();
}
@@ -306,22 +277,7 @@ export class PageHelpContentsComponent implements OnInit {
}
}
- public pageHelpContentSavedSuccessfully(pageHelpContent: PageHelpContent) {
- this.checkboxes.push({pageHelpContent: pageHelpContent, checked: false});
- this.pageHelpContents.push(pageHelpContent);
- this.applyCheck(false);
- this.countPageHelpContents();
- }
-
- public pageHelpContentUpdatedSuccessfully(pageHelpContent: PageHelpContent) {
- this.checkboxes.find(checkItem => checkItem.pageHelpContent._id == pageHelpContent._id).pageHelpContent = pageHelpContent;
- let index = this.pageHelpContents.findIndex(checkItem => checkItem._id == pageHelpContent._id);
- this.pageHelpContents[index] = pageHelpContent;
- this.applyCheck(false);
- this.countPageHelpContents();
- }
-
-
+
public filterPageHelpContent(pageHelpContent: PageHelpContent, filters: PageHelpContentFilterOptions): boolean {
let idFlag = filters.id == '' || (pageHelpContent.page)._id == filters.id;
let activeFlag = filters.active == null || pageHelpContent.isActive == filters.active;
@@ -338,7 +294,6 @@ export class PageHelpContentsComponent implements OnInit {
this.checkboxes.push({pageHelpContent: _, checked: false})
}
);
- // this.countPageHelpContents();
}
public filterByPage(event: any) {
@@ -347,27 +302,12 @@ export class PageHelpContentsComponent implements OnInit {
this.applyFilter();
}
}
-
- public displayAllPageHelpContents() {
- this.filters.active = null;
- this.applyFilter();
- }
-
- public displayActivePageHelpContents() {
- this.filters.active = true;
- this.applyFilter();
- }
-
+
public filterBySearch(text: string) {
this.filters.text = new RegExp(text, "i");
this.applyFilter();
}
- public displayInactivePageHelpContents() {
- this.filters.active = false;
- this.applyFilter();
- }
-
handleError(message: string, error) {
UIkit.notification(message, {
status: 'danger',
diff --git a/dashboard/page/pages.component.html b/dashboard/page/pages.component.html
index 63b204f5..385f2e40 100644
--- a/dashboard/page/pages.component.html
+++ b/dashboard/page/pages.component.html
@@ -97,13 +97,15 @@
[queryParams]="{pageId: check.page._id}"
routerLink="../helptexts">
Manage page contents
- ({{pageHelpContents[check.page._id]}})
+ ({{pageHelpContentsCount[check.page._id]}})
Manage class contents
+ routerLink="../classContents">Manage class contents
+
({{pageClassContentsCount[check.page._id]}})
+
diff --git a/dashboard/page/pages.component.ts b/dashboard/page/pages.component.ts
index f286fe72..d51cba96 100644
--- a/dashboard/page/pages.component.ts
+++ b/dashboard/page/pages.component.ts
@@ -15,7 +15,6 @@ import {ConnectHelper} from "../../connect/connectHelper";
import {Option} from "../../sharedComponents/input/input.component";
import {AlertModal} from "../../utils/modal/alert";
import {SearchInputComponent} from "../../sharedComponents/search-input/search-input.component";
-import {CheckPageHelpContent, PageHelpContent} from '../../utils/entities/adminTool/page-help-content';
import {Title} from "@angular/platform-browser";
import {StringUtils} from "../../utils/string-utils.class";
@@ -65,7 +64,8 @@ export class PagesComponent implements OnInit {
private index: number;
public selectedKeyword: string;
@ViewChild('searchInputComponent') searchInputComponent: SearchInputComponent;
- pageHelpContents = {};
+ pageHelpContentsCount = {};
+ pageClassContentsCount = {};
constructor(private element: ElementRef, private route: ActivatedRoute,
private title: Title,
@@ -118,7 +118,7 @@ export class PagesComponent implements OnInit {
},
error => this.handleError('System error retrieving pages', error)));
if (this.portal) {
- this.getPageHelpContents(this.portal);
+ this.getPageHelpContentsCounts(this.portal);
}
}
@@ -445,10 +445,15 @@ export class PagesComponent implements OnInit {
}
}
- getPageHelpContents(community_pid: string) {
- this.subscriptions.push(this._helpContentService.countCommunityPageHelpContents(community_pid, this.properties.adminToolsAPIURL).subscribe(
+ getPageHelpContentsCounts(community_pid: string) {
+ this.subscriptions.push(this._helpContentService.countCommunityPageHelpContents(community_pid, this.properties.adminToolsAPIURL, false).subscribe(
pageHelpContentsCount => {
- this.pageHelpContents = pageHelpContentsCount;
+ this.pageHelpContentsCount = pageHelpContentsCount;
+ },
+ error => this.handleError('System error retrieving page contents', error)));
+ this.subscriptions.push(this._helpContentService.countCommunityPageHelpContents(community_pid, this.properties.adminToolsAPIURL, true).subscribe(
+ pageClassContentsCount => {
+ this.pageClassContentsCount = pageClassContentsCount;
},
error => this.handleError('System error retrieving page contents', error)));
}
diff --git a/services/help-content.service.ts b/services/help-content.service.ts
index 9976ea98..7c5cc075 100644
--- a/services/help-content.service.ts
+++ b/services/help-content.service.ts
@@ -31,7 +31,6 @@ export class HelpContentService {
getEntities(helpContentUrl:string) {
return this.http.get
>(helpContentUrl + 'entity')
- //.map(res => > res.json())
.pipe(catchError(this.handleError));
}
@@ -39,7 +38,6 @@ export class HelpContentService {
HelpContentService.removeNulls(entity);
return this.http.post(helpContentUrl + 'entity/save', JSON.stringify(entity), CustomOptions.getAuthOptionsWithBody())
- //.map(res => res.json())
.pipe(catchError(this.handleError));
}
@@ -47,7 +45,6 @@ export class HelpContentService {
HelpContentService.removeNulls(entity);
return this.http.post(helpContentUrl + 'entity/update', JSON.stringify(entity), CustomOptions.getAuthOptionsWithBody())
- //.map(res => res.json())
.pipe(catchError(this.handleError));
}
@@ -66,7 +63,6 @@ export class HelpContentService {
getCommunityEntities(pid: string, helpContentUrl:string) {
return this.http.get>(helpContentUrl + properties.adminToolsPortalType + '/'+pid+'/entities')
- //.map(res => > res.json())
.pipe(catchError(this.handleError));
}
@@ -74,7 +70,6 @@ export class HelpContentService {
return this.http.post(helpContentUrl + properties.adminToolsPortalType + '/'+pid+ '/entity/toggle?status='+ status.toString(),
JSON.stringify(ids), CustomOptions.getAuthOptionsWithBody())
- //.map( res => res.json())
.pipe(catchError(this.handleError));
}
@@ -120,13 +115,11 @@ export class HelpContentService {
// unused
getDivId(divId: string, helpContentUrl:string) {
return this.http.get(helpContentUrl + 'div/'+divId)
- //.map(res => res.json())
.pipe(catchError(this.handleError));
}
getDivIdFull(divId: string, helpContentUrl:string, pid: string) {
return this.http.get(helpContentUrl + properties.adminToolsPortalType + "/" + pid + '/div/'+divId+"/full")
- //.map(res => res.json())
.pipe(catchError(this.handleError));
}
@@ -134,7 +127,6 @@ export class HelpContentService {
HelpContentService.removeNulls(divId);
return this.http.post(helpContentUrl + 'div/update', JSON.stringify(divId), CustomOptions.getAuthOptionsWithBody())
- //.map(res => res.json())
.pipe(catchError(this.handleError));
}
@@ -142,7 +134,6 @@ export class HelpContentService {
HelpContentService.removeNulls(divId);
return this.http.post(helpContentUrl + 'div/save', JSON.stringify(divId), CustomOptions.getAuthOptionsWithBody())
- //.map(res => res.json())
.pipe(catchError(this.handleError));
}
@@ -152,57 +143,27 @@ export class HelpContentService {
}
getPageIdsFromDivIds(pid: string, helpContentUrl:string) {
- //let parameters = (pid ? "?portal="+pid : "");
return this.http.get>(helpContentUrl + properties.adminToolsPortalType + "/" + pid + '/div/pages')
- //.map(res =>