From 3b6498cb2eb938f0ae1f60d9d9551ba1f4ba984d Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Wed, 13 Jul 2022 20:25:19 +0300 Subject: [PATCH] Dropdown Filter: Add overflow-auto. Fix all forms with disabled fields. Change all dashboard pages in order to apply sticky in actions instead of header. --- claims/claim-utils/claimHelper.class.ts | 2 +- .../displayClaims.component.html | 178 +++++++++--------- .../displayClaims/displayClaims.component.ts | 12 +- claims/claimsAdmin/claimsAdmin.component.ts | 6 +- dashboard/divId/divIds.component.html | 52 +++-- dashboard/divId/divIds.component.ts | 58 ++---- .../class-help-content-form.component.html | 15 +- .../class-help-content-form.component.ts | 18 +- .../class-help-contents.component.html | 29 +-- .../class-help-contents.component.ts | 41 ++-- dashboard/entity/entities.component.html | 56 +++--- dashboard/entity/entities.component.ts | 50 ++--- .../page-help-content-form.component.html | 15 +- .../page-help-content-form.component.ts | 40 ++-- .../page-help-contents.component.html | 29 +-- .../helpTexts/page-help-contents.component.ts | 44 ++--- dashboard/page/pages.component.html | 54 +++--- dashboard/page/pages.component.ts | 53 ++---- dashboard/portal/portals.component.html | 54 +++--- dashboard/portal/portals.component.ts | 58 ++---- .../admin-tabs/admin-tabs.component.ts | 8 +- .../page-content/page-content.component.ts | 51 ++--- .../role-users/role-users.component.html | 72 +++---- .../users/role-users/role-users.component.ts | 66 ++----- .../subscribers/subscribers.component.html | 41 ++-- .../subscribers/subscribers.component.ts | 2 - .../subscriber-invite.component.ts | 25 +-- utils/HelperFunctions.class.ts | 3 +- .../dropdown-filter.component.ts | 6 +- 29 files changed, 458 insertions(+), 680 deletions(-) diff --git a/claims/claim-utils/claimHelper.class.ts b/claims/claim-utils/claimHelper.class.ts index 8ee3fe6a..c6dc154c 100644 --- a/claims/claim-utils/claimHelper.class.ts +++ b/claims/claim-utils/claimHelper.class.ts @@ -106,7 +106,7 @@ export class ClaimDBRecord { targetType: string; semantics: string; approved: string; - source: ClaimDBResult | ClaimProject | ClaimContext; + source: ClaimDBResult | ClaimDBProject | ClaimDBContext; target: ClaimDBResult; indexed:boolean; } diff --git a/claims/claim-utils/displayClaims/displayClaims.component.html b/claims/claim-utils/displayClaims/displayClaims.component.html index 990101a4..ee8b01d7 100644 --- a/claims/claim-utils/displayClaims/displayClaims.component.html +++ b/claims/claim-utils/displayClaims/displayClaims.component.html @@ -1,108 +1,112 @@
-
- -
-
+ +
+
+
+
-
- -
-
-
- -
Type of Entity
- -
-
-
-
-
-
-
- -
-
-
- +
+
+
-
-
-
No links found
+
+
+ +
Type of Entity
+ +
-
    -
  • -
    -
    -
    -
    - -
    -
    - available - - pending - -
    -
    -
    - Claimed by: - {{claim.userMail}} +
    +
    +
    +
    +
    + +
    +
    +
    +
    + +
    +
    +
    +
    No links found
    +
    +
      +
    • +
      +
      +
      +
      +
      -
      - Claimed date: - {{claim.date}} +
      + available + + pending + +
      +
      +
      + Claimed by: + {{claim.userMail}} +
      +
      + Claimed date: + {{claim.date}} +
      -
      -
      -
      - +
      +
      + +
      +
      +
      +
      -
      -
      -
      -
      - -
    • -
    -
    - + +
  • +
+
+ +
diff --git a/claims/claim-utils/displayClaims/displayClaims.component.ts b/claims/claim-utils/displayClaims/displayClaims.component.ts index bba6a2bd..556d1076 100644 --- a/claims/claim-utils/displayClaims/displayClaims.component.ts +++ b/claims/claim-utils/displayClaims/displayClaims.component.ts @@ -1,4 +1,4 @@ -import {Component, Input, ViewChild} from '@angular/core'; +import {Component, Input, OnDestroy, OnInit, ViewChild} from '@angular/core'; import {Location} from '@angular/common'; import {ActivatedRoute, Router} from '@angular/router'; import {Subject, Subscriber} from 'rxjs'; @@ -26,7 +26,7 @@ import {DropdownFilterComponent} from "../../../utils/dropdown-filter/dropdown-f templateUrl: 'displayClaims.component.html', styleUrls: ['displayClaims.component.less'] }) -export class DisplayClaimsComponent { +export class DisplayClaimsComponent implements OnInit, OnDestroy { @Input() piwikSiteId = null; @Input() pageTitle: string = ""; properties: EnvProperties; @@ -79,12 +79,20 @@ export class DisplayClaimsComponent { url = null; public pageContents = null; + /* Sticky actions */ + @Input() + public actions: boolean = false; + public offset: number; + constructor(private _claimService: ClaimsService, private route: ActivatedRoute, private _router: Router, private location: Location, private _meta: Meta, private _title: Title, private _piwikService: PiwikService, private seoService: SEOService, private indexInfoService: IndexInfoService, private helper: HelperService, private _fb: FormBuilder) { } ngOnInit() { + if (typeof document !== "undefined" && this.actions) { + this.offset = Number.parseInt(getComputedStyle(document.documentElement).getPropertyValue('--structure-header-height')); + } this.entities = []; this.filterForm = this._fb.group({ keyword: [''], diff --git a/claims/claimsAdmin/claimsAdmin.component.ts b/claims/claimsAdmin/claimsAdmin.component.ts index 6654ff02..8b142399 100644 --- a/claims/claimsAdmin/claimsAdmin.component.ts +++ b/claims/claimsAdmin/claimsAdmin.component.ts @@ -10,9 +10,9 @@ import {Subscriber} from "rxjs"; @Component({ selector: 'claims-admin', template: ` -
+
-
+

Manage links @@ -20,7 +20,7 @@ import {Subscriber} from "rxjs";
diff --git a/dashboard/divId/divIds.component.html b/dashboard/divId/divIds.component.html index 1d493dfb..97c902fb 100644 --- a/dashboard/divId/divIds.component.html +++ b/dashboard/divId/divIds.component.html @@ -1,42 +1,38 @@ -
+
-
+
Admin Dashboard - Manage Classes

Super Admin

-
- -
+ +
-
-
- -
-
-
-
- -
+
+
+
+
+
+
+
+
diff --git a/dashboard/divId/divIds.component.ts b/dashboard/divId/divIds.component.ts index 75afe664..62b1383c 100644 --- a/dashboard/divId/divIds.component.ts +++ b/dashboard/divId/divIds.component.ts @@ -11,17 +11,14 @@ import {properties} from "../../../../environments/environment"; import {PortalUtils} from "../portal/portalHelper"; import {AlertModal} from "../../utils/modal/alert"; import {Option} from "../../sharedComponents/input/input.component"; -import {SearchInputComponent} from "../../sharedComponents/search-input/search-input.component"; import {Title} from "@angular/platform-browser"; import {ClearCacheService} from "../../services/clear-cache.service"; - -declare var UIkit; +import {NotificationHandler} from "../../utils/notification-handler"; @Component({ selector: 'divIds', templateUrl: './divIds.component.html', }) - export class DivIdsComponent implements OnInit { @ViewChild('editModal') editModal: AlertModal; @ViewChild('deleteModal') deleteModal: AlertModal; @@ -42,7 +39,6 @@ export class DivIdsComponent implements OnInit { selectedCommunityPid = null; public portalUtils: PortalUtils = new PortalUtils(); private index: number; - public stickyPageHeader: boolean = false; constructor(private element: ElementRef, private route: ActivatedRoute, private _router: Router, private title: Title, @@ -145,11 +141,7 @@ export class DivIdsComponent implements OnInit { this.subscriptions.push(this._helpContentService.deleteDivIds(this.selectedDivIds, this.properties.adminToolsAPIURL).subscribe( _ => { this.deleteDivIdsFromArray(this.selectedDivIds); - UIkit.notification('Classes have been successfully deleted', { - status: 'success', - timeout: 6000, - pos: 'bottom-right' - }); + NotificationHandler.rise('Classes have been successfully deleted'); this.showLoading = false; this._clearCacheService.clearCache("Class ids deleted"); }, @@ -198,29 +190,20 @@ export class DivIdsComponent implements OnInit { public divIdSaveConfirmed(data: any) { this.showLoading = true; - if (!this.classForm.value._id) { - this.subscriptions.push(this._helpContentService.saveDivId(this.classForm.value, this.properties.adminToolsAPIURL).subscribe( + if (!this.classForm.getRawValue()._id) { + this.subscriptions.push(this._helpContentService.saveDivId(this.classForm.getRawValue(), this.properties.adminToolsAPIURL).subscribe( divId => { this.divIdSavedSuccessfully(divId); - UIkit.notification('Class ' + divId.name + ' has been successfully created', { - status: 'success', - timeout: 6000, - pos: 'bottom-right' - }); + NotificationHandler.rise('Class ' + divId.name + ' has been successfully created'); this._clearCacheService.clearCache("Class id saved"); }, error => this.handleUpdateError("System error creating class", error) )); } else { - this.classForm.get('portalType').enable(); - this.subscriptions.push(this._helpContentService.updateDivId(this.classForm.value, this.properties.adminToolsAPIURL).subscribe( + this.subscriptions.push(this._helpContentService.updateDivId(this.classForm.getRawValue(), this.properties.adminToolsAPIURL).subscribe( divId => { this.divIdUpdatedSuccessfully(divId); - UIkit.notification('Class ' + divId.name + ' has been successfully updated', { - status: 'success', - timeout: 6000, - pos: 'bottom-right' - }); + NotificationHandler.rise('Class ' + divId.name + ' has been successfully updated'); this._clearCacheService.clearCache("Class id updated"); }, error => this.handleUpdateError("System error updating class", error) @@ -257,31 +240,22 @@ export class DivIdsComponent implements OnInit { } public filterDivIds(divId: DivId): boolean { - let textFlag = this.searchText.toString() == '' || (divId.name + ' ' + divId.portalType).match(this.searchText) != null; - return textFlag; + return this.searchText.toString() == '' || (divId.name + ' ' + divId.portalType).match(this.searchText) != null; } - handleUpdateError(message: string, error) { - if (error == null) { - // this.formComponent.reset(); - } else { - UIkit.notification(message, { - status: 'danger', - timeout: 6000, - pos: 'bottom-right' - }); + handleUpdateError(message: string, error = null) { + if (error) { console.log('Server responded: ' + error); } + NotificationHandler.rise(message,'danger'); this.showLoading = false; } - handleError(message: string, error) { - UIkit.notification(message, { - status: 'danger', - timeout: 6000, - pos: 'bottom-right' - }); - console.log('Server responded: ' + error); + handleError(message: string, error = null) { + if (error) { + console.log('Server responded: ' + error); + } + NotificationHandler.rise(message,'danger'); this.showLoading = false; } diff --git a/dashboard/divhelpcontent/class-help-content-form.component.html b/dashboard/divhelpcontent/class-help-content-form.component.html index e26aecbe..91a04021 100644 --- a/dashboard/divhelpcontent/class-help-content-form.component.html +++ b/dashboard/divhelpcontent/class-help-content-form.component.html @@ -1,7 +1,6 @@ -
+
-
+
@@ -13,9 +12,9 @@
-
-
-
+
+
+
+
+
+
+
diff --git a/dashboard/divhelpcontent/class-help-content-form.component.ts b/dashboard/divhelpcontent/class-help-content-form.component.ts index 52cb44d5..0b75bca4 100644 --- a/dashboard/divhelpcontent/class-help-content-form.component.ts +++ b/dashboard/divhelpcontent/class-help-content-form.component.ts @@ -1,21 +1,15 @@ -import {Component, Input, OnInit} from '@angular/core'; +import {Component, 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 {Subscriber, Subscription, zip} from 'rxjs'; -import {HelperFunctions} from '../../utils/HelperFunctions.class'; import {DivHelpContent} from '../../utils/entities/adminTool/div-help-content'; import {NotificationHandler} from "../../utils/notification-handler"; import {ClearCacheService} from "../../services/clear-cache.service"; -declare var UIkit; - @Component({ selector: 'class-content-form', templateUrl: './class-help-content-form.component.html', @@ -32,7 +26,6 @@ export class ClassContentFormComponent implements OnInit { public showLoading: boolean = true; private subs: Subscription[] = []; public pageHelpContent: DivHelpContent; - public stickyPageHeader: boolean = false; constructor(private route: ActivatedRoute, private _router: Router, private _fb: FormBuilder, private _helpContentService: HelpContentService, private _clearCacheService: ClearCacheService) { @@ -145,16 +138,11 @@ export class ClassContentFormComponent implements OnInit { public saveCustom() { if (this.myForm.valid) { this.showLoading = true; - this.myForm.get('divId').enable(); - let pageHelpContent: DivHelpContent = this.myForm.value; + let pageHelpContent: DivHelpContent = this.myForm.getRawValue(); 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' - }); + NotificationHandler.rise('Page content has been successfully updated'); this.showLoading = false; this._clearCacheService.clearCache("Class help text saved or updated"); }, diff --git a/dashboard/divhelpcontent/class-help-contents.component.html b/dashboard/divhelpcontent/class-help-contents.component.html index e1b90e91..7883ea8a 100644 --- a/dashboard/divhelpcontent/class-help-contents.component.html +++ b/dashboard/divhelpcontent/class-help-contents.component.html @@ -1,7 +1,6 @@ -
+
-
+
@@ -13,18 +12,22 @@
-
-
-
-
-
- +
+
+
+
+
+
+ +
+
+
diff --git a/dashboard/divhelpcontent/class-help-contents.component.ts b/dashboard/divhelpcontent/class-help-contents.component.ts index b730ccd5..49df2efa 100644 --- a/dashboard/divhelpcontent/class-help-contents.component.ts +++ b/dashboard/divhelpcontent/class-help-contents.component.ts @@ -15,9 +15,7 @@ import {DomSanitizer} from '@angular/platform-browser'; import {SearchInputComponent} from '../../sharedComponents/search-input/search-input.component'; import {CheckDivHelpContent, DivHelpContent} from '../../utils/entities/adminTool/div-help-content'; import {ClearCacheService} from "../../services/clear-cache.service"; - -declare var UIkit; - +import {NotificationHandler} from "../../utils/notification-handler"; @Component({ selector: 'class-help-contents', @@ -43,7 +41,6 @@ export class ClassHelpContentsComponent implements OnInit { public showLoading: boolean = true; public filterForm: FormControl; private subscriptions: any[] = []; - public stickyPageHeader: boolean = false; constructor(private element: ElementRef, private route: ActivatedRoute, private router: Router, private _helpService: HelpContentService, private _fb: FormBuilder, private sanitizer: DomSanitizer, @@ -156,11 +153,7 @@ export class ClassHelpContentsComponent implements OnInit { 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' - }); + NotificationHandler.rise('Page content(s) has been successfully deleted'); this.showLoading = false; this._clearCacheService.clearCache("Class text texts deleted"); }, @@ -204,11 +197,7 @@ export class ClassHelpContentsComponent implements OnInit { } this.countClassHelpContents(); this.applyCheck(false); - UIkit.notification('Page content(s) has been successfully updated', { - status: 'success', - timeout: 6000, - pos: 'bottom-right' - }); + NotificationHandler.rise('Page content(s) has been successfully updated'); this._clearCacheService.clearCache("class help text's status changed"); }, error => this.handleUpdateError('System error changing the status of the selected page content(s)', error) @@ -237,23 +226,19 @@ export class ClassHelpContentsComponent implements OnInit { this.applyFilter(); } - handleError(message: string, error) { - UIkit.notification(message, { - status: 'danger', - timeout: 6000, - pos: 'bottom-right' - }); - console.log('Server responded: ' + error); + handleError(message: string, error = null) { + if(error) { + console.log('Server responded: ' + error); + } + NotificationHandler.rise(message, 'danger'); this.showLoading = false; } - handleUpdateError(message: string, error) { - UIkit.notification(message, { - status: 'danger', - timeout: 6000, - pos: 'bottom-right' - }); - console.log('Server responded: ' + error); + handleUpdateError(message: string, error = null) { + if(error) { + console.log('Server responded: ' + error); + } + NotificationHandler.rise(message, 'danger'); this.showLoading = false; } diff --git a/dashboard/entity/entities.component.html b/dashboard/entity/entities.component.html index cda470a8..2308954b 100644 --- a/dashboard/entity/entities.component.html +++ b/dashboard/entity/entities.component.html @@ -1,6 +1,6 @@ -
+
-
+
@@ -9,37 +9,33 @@

{{name?name:'Super Admin'}}

-
- -
-
-
-
- -
-
-
-
- -
+ + +
+
+
+
+
+
+
+
+
diff --git a/dashboard/entity/entities.component.ts b/dashboard/entity/entities.component.ts index 77649727..9bbac496 100644 --- a/dashboard/entity/entities.component.ts +++ b/dashboard/entity/entities.component.ts @@ -19,8 +19,7 @@ import {CommunityService} from "../../connect/community/community.service"; import {CommunityInfo} from "../../connect/community/communityInfo"; import {Stakeholder, StakeholderInfo} from "../../monitor/entities/stakeholder"; import {ClearCacheService} from "../../services/clear-cache.service"; - -declare var UIkit; +import {NotificationHandler} from "../../utils/notification-handler"; @Component({ selector: 'entities', @@ -57,7 +56,6 @@ export class EntitiesComponent implements OnInit { public filterForm: FormGroup; private subscriptions: any[] = []; private index: number; - public stickyPageHeader: boolean = false; constructor(private element: ElementRef, private route: ActivatedRoute, private _router: Router, private title: Title, @@ -202,11 +200,7 @@ export class EntitiesComponent implements OnInit { this._helpContentService.deleteEntities(this.selectedEntities, this.properties.adminToolsAPIURL).subscribe( _ => { this.deleteEntitiesFromArray(this.selectedEntities); - UIkit.notification('Entities have been successfully deleted', { - status: 'success', - timeout: 6000, - pos: 'bottom-right' - }); + NotificationHandler.rise('Entities have been successfully deleted'); this.showLoading = false; this._clearCacheService.clearCache("entities deleted"); }, @@ -243,29 +237,21 @@ export class EntitiesComponent implements OnInit { public entitySaveConfirmed(data: any) { this.showLoading = true; - if (this.entityForm.value._id) { + if (this.entityForm.getRawValue()._id) { this._helpContentService.updateEntity( - this.entityForm.value, this.properties.adminToolsAPIURL).subscribe( + this.entityForm.getRawValue(), this.properties.adminToolsAPIURL).subscribe( entity => { this.entityUpdatedSuccessfully(entity); - UIkit.notification('Entity ' + entity.name + ' has been successfully updated', { - status: 'success', - timeout: 6000, - pos: 'bottom-right' - }); + NotificationHandler.rise('Entity ' + entity.name + ' has been successfully updated'); this._clearCacheService.clearCache("entity updated"); }, error => this.handleUpdateError('System error updating entity', error) ); } else { - this._helpContentService.saveEntity(this.entityForm.value, this.properties.adminToolsAPIURL).subscribe( + this._helpContentService.saveEntity(this.entityForm.getRawValue(), this.properties.adminToolsAPIURL).subscribe( entity => { this.entitySavedSuccessfully(entity); - UIkit.notification('Entity ' + entity.name + ' has been successfully created', { - status: 'success', - timeout: 6000, - pos: 'bottom-right' - }); + NotificationHandler.rise('Entity ' + entity.name + ' has been successfully created'); this._clearCacheService.clearCache("entity saved"); }, error => this.handleUpdateError('System error creating entity', error) @@ -306,18 +292,16 @@ export class EntitiesComponent implements OnInit { return status == "all" || (status == "disabled" && !entity.isEnabled) || (status == "enabled" && entity.isEnabled); } - handleError(message: string, error) { - UIkit.notification(message, { - status: 'danger', - timeout: 6000, - pos: 'bottom-right' - }); - console.log('Server responded: ' + error); + handleError(message: string, error = null) { + if(error) { + console.log('Server responded: ' + error); + } + NotificationHandler.rise(message, 'danger'); this.showLoading = false; } - handleUpdateError(message: string, error) { - if (error == null) { + handleUpdateError(message: string, error = null) { + if (!error) { this.entityForm = this._fb.group({ pid: ['', Validators.required], name: ['', Validators.required], @@ -325,13 +309,9 @@ export class EntitiesComponent implements OnInit { _id: '' }); } else { - UIkit.notification(message, { - status: 'danger', - timeout: 6000, - pos: 'bottom-right' - }); console.log('Server responded: ' + error); } + NotificationHandler.rise(message, 'danger'); this.showLoading = false; } diff --git a/dashboard/helpTexts/page-help-content-form.component.html b/dashboard/helpTexts/page-help-content-form.component.html index f36815cc..aed98fbf 100644 --- a/dashboard/helpTexts/page-help-content-form.component.html +++ b/dashboard/helpTexts/page-help-content-form.component.html @@ -1,7 +1,6 @@ -
+
-
+
@@ -13,9 +12,9 @@
-
-
-
+
+
+
+
+
+
+
diff --git a/dashboard/helpTexts/page-help-content-form.component.ts b/dashboard/helpTexts/page-help-content-form.component.ts index 2a74d1b0..e3b0cea4 100644 --- a/dashboard/helpTexts/page-help-content-form.component.ts +++ b/dashboard/helpTexts/page-help-content-form.component.ts @@ -9,8 +9,7 @@ import {Subscriber, Subscription, zip} from 'rxjs'; import {HelperFunctions} from '../../utils/HelperFunctions.class'; import {PageHelpContent} from '../../utils/entities/adminTool/page-help-content'; import {ClearCacheService} from "../../services/clear-cache.service"; - -declare var UIkit; +import {NotificationHandler} from "../../utils/notification-handler"; @Component({ selector: 'page-content-form', @@ -29,7 +28,6 @@ export class PageContentFormComponent implements OnInit { public showLoading: boolean = true; private subs: Subscription[] = []; public pageHelpContent: PageHelpContent; - public stickyPageHeader: boolean = false; constructor(private route: ActivatedRoute, private _router: Router, private _fb: FormBuilder, private _helpContentService: HelpContentService, private _clearCacheService: ClearCacheService) { @@ -204,30 +202,21 @@ export class PageContentFormComponent implements OnInit { this.myForm.markAsPristine(); } - handleError(message: string, error) { - UIkit.notification(message, { - status: 'danger', - timeout: 6000, - pos: 'bottom-right' - }); - console.error('Server responded: ' + error); - + handleError(message: string, error = null) { + if(error) { + console.error('Server responded: ' + error); + } + NotificationHandler.rise(message, 'danger'); this.showLoading = false; } public saveCustom() { if (this.myForm.valid) { this.showLoading = true; - this.myForm.get('order').enable(); - this.myForm.get('placement').enable(); - let pageHelpContent: PageHelpContent = this.myForm.value; + let pageHelpContent: PageHelpContent = this.myForm.getRawValue(); this.subs.push(this._helpContentService.savePageHelpContent(pageHelpContent, this.properties.adminToolsAPIURL, this.portal).subscribe( _ => { - UIkit.notification('Page content has been successfully ' + (this.pageContentId ? 'updated' : 'created') + '', { - status: 'success', - timeout: 6000, - pos: 'bottom-right' - }); + NotificationHandler.rise('Page content has been successfully ' + (this.pageContentId ? 'updated' : 'created') + ''); this._router.navigate(['../'], {queryParams: {"pageId": this.pageId}, relativeTo: this.route}); this.showLoading = false; this._clearCacheService.clearCache("page help content saved"); @@ -249,14 +238,11 @@ export class PageContentFormComponent implements OnInit { this.showLoading = false; } - handleUpdateError(message: string, error) { - UIkit.notification(message, { - status: 'danger', - timeout: 6000, - pos: 'bottom-right' - }); - console.error('Server responded: ' + error); - + handleUpdateError(message: string, error = null) { + if(error) { + console.error('Server responded: ' + error); + } + NotificationHandler.rise(message, 'danger'); this.showLoading = false; } diff --git a/dashboard/helpTexts/page-help-contents.component.html b/dashboard/helpTexts/page-help-contents.component.html index 93f30941..b908df95 100644 --- a/dashboard/helpTexts/page-help-contents.component.html +++ b/dashboard/helpTexts/page-help-contents.component.html @@ -1,7 +1,6 @@ -
+
-
+
@@ -13,18 +12,22 @@
-
-
-
-
-
- +
+
+
+
+
+
+ +
+
+
diff --git a/dashboard/helpTexts/page-help-contents.component.ts b/dashboard/helpTexts/page-help-contents.component.ts index dcf7c11c..832087a9 100644 --- a/dashboard/helpTexts/page-help-contents.component.ts +++ b/dashboard/helpTexts/page-help-contents.component.ts @@ -7,19 +7,16 @@ import { PageHelpContent, PageHelpContentFilterOptions } from '../../utils/entities/adminTool/page-help-content'; -import {CheckPage, Page} from '../../utils/entities/adminTool/page'; +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 {ClearCacheService} from "../../services/clear-cache.service"; - -declare var UIkit; +import {NotificationHandler} from "../../utils/notification-handler"; @Component({ selector: 'page-help-contents', @@ -46,7 +43,6 @@ export class PageHelpContentsComponent implements OnInit { public filterForm: FormControl; private subscriptions: any[] = []; public selectedKeyword: string; - public stickyPageHeader: boolean = false; @ViewChild('searchInputComponent') searchInputComponent: SearchInputComponent; constructor(private element: ElementRef, private route: ActivatedRoute, private router: Router, @@ -167,11 +163,7 @@ export class PageHelpContentsComponent implements OnInit { this.subscriptions.push(this._helpService.deletePageHelpContents(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' - }); + NotificationHandler.rise('Page content(s) has been successfully deleted'); this.showLoading = false; this._clearCacheService.clearCache("Help texts deleted"); }, @@ -215,11 +207,7 @@ export class PageHelpContentsComponent implements OnInit { let i = this.checkboxes.findIndex(_ => _.pageHelpContent._id == id); this.checkboxes[i].pageHelpContent.isActive = status; } - UIkit.notification('Page content(s) has been successfully updated', { - status: 'success', - timeout: 6000, - pos: 'bottom-right' - }); + NotificationHandler.rise('Page content(s) has been successfully updated'); this.countPageHelpContents(); this.applyCheck(false); this._clearCacheService.clearCache("Help text's status changed"); @@ -252,23 +240,19 @@ export class PageHelpContentsComponent implements OnInit { this.applyFilter(); } - handleError(message: string, error) { - UIkit.notification(message, { - status: 'danger', - timeout: 6000, - pos: 'bottom-right' - }); - console.log('Server responded: ' + error); + handleError(message: string, error = null) { + if(error) { + console.log('Server responded: ' + error); + } + NotificationHandler.rise(message, 'danger'); this.showLoading = false; } - handleUpdateError(message: string, error) { - UIkit.notification(message, { - status: 'danger', - timeout: 6000, - pos: 'bottom-right' - }); - console.log('Server responded: ' + error); + handleUpdateError(message: string, error = null) { + if(error) { + console.log('Server responded: ' + error); + } + NotificationHandler.rise(message, 'danger'); this.showLoading = false; } diff --git a/dashboard/page/pages.component.html b/dashboard/page/pages.component.html index 150d324a..f485080f 100644 --- a/dashboard/page/pages.component.html +++ b/dashboard/page/pages.component.html @@ -1,6 +1,6 @@ -
+
-
+
@@ -9,36 +9,32 @@

{{name ? name : 'Super Admin'}}

-
- + + +
+
+
+
+
+
+ +
+
-
- -
-
-
-
- -
-
-
-
diff --git a/dashboard/page/pages.component.ts b/dashboard/page/pages.component.ts index c7170f4b..4fb6cd33 100644 --- a/dashboard/page/pages.component.ts +++ b/dashboard/page/pages.component.ts @@ -21,8 +21,7 @@ import {CommunityInfo} from "../../connect/community/communityInfo"; import {Stakeholder} from "../../monitor/entities/stakeholder"; import {CommunityService} from "../../connect/community/community.service"; import {ClearCacheService} from "../../services/clear-cache.service"; - -declare var UIkit; +import {NotificationHandler} from "../../utils/notification-handler"; @Component({ selector: 'pages', @@ -70,7 +69,6 @@ export class PagesComponent implements OnInit { private index: number; pageHelpContentsCount = {}; pageClassContentsCount = {}; - public stickyPageHeader: boolean = false; constructor(private element: ElementRef, private route: ActivatedRoute, private title: Title, @@ -249,11 +247,7 @@ export class PagesComponent implements OnInit { this.subscriptions.push(this._helpContentService.deletePages(this.selectedPages, this.properties.adminToolsAPIURL).subscribe( _ => { this.deletePagesFromArray(this.selectedPages); - UIkit.notification('Pages have been successfully deleted', { - status: 'success', - timeout: 6000, - pos: 'bottom-right' - }); + NotificationHandler.rise('Pages have been successfully deleted'); this.showLoading = false; this._clearCacheService.clearCache("Pages deleted"); }, @@ -317,29 +311,20 @@ export class PagesComponent implements OnInit { public pageSaveConfirmed(data: any) { this.showLoading = true; - if (!this.pageForm.value._id) { - this.subscriptions.push(this._helpContentService.savePage(this.pageForm.value, this.properties.adminToolsAPIURL).subscribe( + if (!this.pageForm.getRawValue()._id) { + this.subscriptions.push(this._helpContentService.savePage(this.pageForm.getRawValue(), this.properties.adminToolsAPIURL).subscribe( page => { this.pageSavedSuccessfully(page, true); - UIkit.notification('Page ' + page.name + ' has been successfully created', { - status: 'success', - timeout: 6000, - pos: 'bottom-right' - }); + NotificationHandler.rise('Page ' + page.name + ' has been successfully created'); this._clearCacheService.clearCache("Page saved"); }, error => this.handleUpdateError('System error creating page', error) )); } else { - this.pageForm.get('portalType').enable(); - this.subscriptions.push(this._helpContentService.updatePage(this.pageForm.value, this.properties.adminToolsAPIURL).subscribe( + this.subscriptions.push(this._helpContentService.updatePage(this.pageForm.getRawValue(), this.properties.adminToolsAPIURL).subscribe( page => { this.pageSavedSuccessfully(page, false); - UIkit.notification('Page ' + page.name + ' has been successfully updated', { - status: 'success', - timeout: 6000, - pos: 'bottom-right' - }); + NotificationHandler.rise('Page ' + page.name + ' has been successfully updated'); this._clearCacheService.clearCache("Page updated"); }, error => this.handleUpdateError('System error updating page', error) @@ -375,19 +360,16 @@ export class PagesComponent implements OnInit { return this.searchText.toString() == '' || (page.route + ' ' + page.name + ' ' + page.portalType).match(this.searchText) != null; } - handleError(message: string, error) { - UIkit.notification(message, { - status: 'danger', - timeout: 6000, - pos: 'bottom-right' - }); - console.log('Server responded: ' + error); + handleError(message: string, error = null) { + if(error) { + console.error('Server responded: ' + error); + } + NotificationHandler.rise(message, 'danger'); this.showLoading = false; } - handleUpdateError(message: string, error) { - if (error == null) { - // this.formComponent.reset(); + handleUpdateError(message: string, error = null) { + if (!error) { this.pageForm = this._fb.group({ route: this._fb.control('', Validators.required), name: this._fb.control('', Validators.required), @@ -402,12 +384,9 @@ export class PagesComponent implements OnInit { _id: this._fb.control(''), }); } else { - UIkit.notification(message, { - status: 'danger', - timeout: 6000, - pos: 'bottom-right' - }); + console.error('Server responded: ' + error); } + NotificationHandler.rise(message, 'danger'); this.showLoading = false; } diff --git a/dashboard/portal/portals.component.html b/dashboard/portal/portals.component.html index 4a175407..36a6b718 100644 --- a/dashboard/portal/portals.component.html +++ b/dashboard/portal/portals.component.html @@ -1,43 +1,39 @@ -
+
-
+
Admin Dashboard - Manage Portals

Super Admin

-
- -
+ +
-
-
- -
-
-
-
- -
+
+
+
+
+
+
+
+
diff --git a/dashboard/portal/portals.component.ts b/dashboard/portal/portals.component.ts index b24d46eb..355f4712 100644 --- a/dashboard/portal/portals.component.ts +++ b/dashboard/portal/portals.component.ts @@ -3,20 +3,15 @@ import {ActivatedRoute, Router} from '@angular/router'; import {HelpContentService} from '../../services/help-content.service'; import {FormBuilder, FormGroup, Validators} from '@angular/forms'; 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 {CheckPortal, Portal} from "../../utils/entities/adminTool/portal"; import {PortalUtils} from "./portalHelper"; import {properties} from "../../../../environments/environment"; import {AlertModal} from "../../utils/modal/alert"; -import {SearchInputComponent} from "../../sharedComponents/search-input/search-input.component"; import {Title} from "@angular/platform-browser"; import {ClearCacheService} from "../../services/clear-cache.service"; - -declare var UIkit; +import {NotificationHandler} from "../../utils/notification-handler"; @Component({ selector: 'portals', @@ -44,7 +39,6 @@ export class PortalsComponent implements OnInit { public showLoading = true; public portalUtils: PortalUtils = new PortalUtils(); private index: number; - public stickyPageHeader: boolean = false; constructor(private element: ElementRef, private route: ActivatedRoute, private title: Title, @@ -141,11 +135,7 @@ export class PortalsComponent implements OnInit { this.subscriptions.push(this._helpContentService.deleteCommunities(this.selectedPortals, this.properties.adminToolsAPIURL).subscribe( _ => { this.deletePortalsFromArray(this.selectedPortals); - UIkit.notification('Portals have been successfully deleted', { - status: 'success', - timeout: 6000, - pos: 'bottom-right' - }); + NotificationHandler.rise('Portals have been successfully deleted'); this.showLoading = false; this._clearCacheService.clearCache("Portals deleted"); }, @@ -192,31 +182,22 @@ export class PortalsComponent implements OnInit { public portalSaveConfirmed(data: any) { this.showLoading = true; - if (this.portalForm.value._id) { - this.portalForm.get('type').enable(); - this.subscriptions.push(this._helpContentService.updateCommunity(this.portalForm.value, + if (this.portalForm.getRawValue()._id) { + this.subscriptions.push(this._helpContentService.updateCommunity(this.portalForm.getRawValue(), this.properties.adminToolsAPIURL).subscribe( portal => { this.portalUpdatedSuccessfully(portal); - UIkit.notification('Portal ' + portal.name + ' has been successfully updated', { - status: 'success', - timeout: 6000, - pos: 'bottom-right' - }); + NotificationHandler.rise('Portal ' + portal.name + ' has been successfully updated'); this._clearCacheService.clearCache("Portal updated"); }, error => this.handleUpdateError('System error updating portal', error) )); } else { - this.subscriptions.push(this._helpContentService.saveCommunity(this.portalForm.value, + this.subscriptions.push(this._helpContentService.saveCommunity(this.portalForm.getRawValue(), this.properties.adminToolsAPIURL).subscribe( portal => { this.portalSavedSuccessfully(portal); - UIkit.notification('Portal ' + portal.name + ' has been successfully created', { - status: 'success', - timeout: 6000, - pos: 'bottom-right' - }); + NotificationHandler.rise('Portal ' + portal.name + ' has been successfully created'); this._clearCacheService.clearCache("Portal saved"); }, error => this.handleUpdateError('System error creating portal', error) @@ -252,12 +233,11 @@ export class PortalsComponent implements OnInit { } public filterPortals(portal: Portal): boolean { - const textFlag = this.searchText.toString() === '' || (portal.name || portal.type).match(this.searchText) != null; - return textFlag; + return this.searchText.toString() === '' || (portal.name || portal.type).match(this.searchText) != null; } - handleUpdateError(message: string, error) { - if (error == null) { + handleUpdateError(message: string, error = null) { + if (!error) { this.portalForm = this._fb.group({ name: '', _id: '', @@ -266,23 +246,17 @@ export class PortalsComponent implements OnInit { type: '' }); } else { - UIkit.notification(message, { - status: 'danger', - timeout: 6000, - pos: 'bottom-right' - }); console.log('Server responded: ' + error); } + NotificationHandler.rise(message, 'danger'); this.showLoading = false; } - handleError(message: string, error) { - UIkit.notification(message, { - status: 'danger', - timeout: 6000, - pos: 'bottom-right' - }); - console.log('Server responded: ' + error); + handleError(message: string, error = null) { + if(error) { + console.log('Server responded: ' + error); + } + NotificationHandler.rise(message, 'danger'); this.showLoading = false; } } diff --git a/dashboard/sharedComponents/admin-tabs/admin-tabs.component.ts b/dashboard/sharedComponents/admin-tabs/admin-tabs.component.ts index 63c9339f..ac3a5a09 100644 --- a/dashboard/sharedComponents/admin-tabs/admin-tabs.component.ts +++ b/dashboard/sharedComponents/admin-tabs/admin-tabs.component.ts @@ -8,7 +8,7 @@ import { properties } from 'src/environments/environment'; @Component({ selector: 'admin-tabs', template: ` -
    +
    • Portals
    • Pages
    • Entities
    • @@ -20,7 +20,6 @@ import { properties } from 'src/environments/environment'; ` }) export class AdminTabsComponent implements OnInit { - @Input() public type: string; @Input() @@ -29,10 +28,9 @@ export class AdminTabsComponent implements OnInit { public user: User; @Input() public tab: "portal" | "page" | "entity" | "menu" | "class" = 'page'; - public env = properties.environment; - private subscriptions: any[] = []; + constructor(private route: ActivatedRoute, private userManagementService: UserManagementService) { } @@ -41,6 +39,7 @@ export class AdminTabsComponent implements OnInit { this.user = user; })); } + ngOnDestroy(): void { this.subscriptions.forEach(value => { if (value instanceof Subscriber) { @@ -51,7 +50,6 @@ export class AdminTabsComponent implements OnInit { }); } - public get isPortalAdmin() { return Session.isPortalAdministrator(this.user) || Session.isCurator(this.type, this.user); } diff --git a/dashboard/sharedComponents/page-content/page-content.component.ts b/dashboard/sharedComponents/page-content/page-content.component.ts index 897a917b..511ab521 100644 --- a/dashboard/sharedComponents/page-content/page-content.component.ts +++ b/dashboard/sharedComponents/page-content/page-content.component.ts @@ -1,21 +1,25 @@ -import {AfterViewInit, Component, EventEmitter, OnDestroy, OnInit, Output} from "@angular/core"; -import {Subscription} from "rxjs"; - -declare var UIkit; +import {AfterViewInit, Component, Input, OnDestroy, OnInit} from "@angular/core"; @Component({ selector: '[page-content]', template: `
      -
      -
      +
      +
      +
      +
      +
      + +
      +
      +
      -
      +
      @@ -23,13 +27,11 @@ declare var UIkit; `, }) export class PageContentComponent implements OnInit, AfterViewInit, OnDestroy { + @Input() + public headerSticky: boolean = false; public offset: number; - public sticky: boolean = false; public shouldSticky: boolean = true; - @Output() - public stickyEmitter: EventEmitter = new EventEmitter(); private observer: IntersectionObserver; - private subscriptions: any[] = []; constructor() { } @@ -37,7 +39,6 @@ export class PageContentComponent implements OnInit, AfterViewInit, OnDestroy { ngOnInit() { if (typeof document !== "undefined") { this.offset = Number.parseInt(getComputedStyle(document.documentElement).getPropertyValue('--structure-header-height')); - this.initSticky(); } } @@ -48,7 +49,6 @@ export class PageContentComponent implements OnInit, AfterViewInit, OnDestroy { this.observer = new IntersectionObserver(entries => { entries.forEach(entry => { this.shouldSticky = !entry.isIntersecting; - this.initSticky(); }) }); this.observer.observe(bottom); @@ -56,32 +56,7 @@ export class PageContentComponent implements OnInit, AfterViewInit, OnDestroy { } } - initSticky() { - this.clear(); - if(this.shouldSticky) { - this.subscriptions.push(UIkit.util.on(document, 'active', '#page_content_header', () => { - this.sticky = true; - this.stickyEmitter.emit(this.sticky); - })); - this.subscriptions.push(UIkit.util.on(document, 'inactive', '#page_content_header', () => { - this.sticky = false; - this.stickyEmitter.emit(this.sticky); - })); - } - } - - clear() { - this.subscriptions.forEach(subscription => { - if (subscription instanceof Subscription) { - subscription.unsubscribe(); - } else if (subscription instanceof Function) { - subscription(); - } - }); - } - ngOnDestroy() { - this.clear(); if(this.observer) { this.observer.disconnect(); } diff --git a/dashboard/users/role-users/role-users.component.html b/dashboard/users/role-users/role-users.component.html index adacea8b..97818e69 100644 --- a/dashboard/users/role-users/role-users.component.html +++ b/dashboard/users/role-users/role-users.component.html @@ -1,41 +1,43 @@ -
      +
      -
      -
      -
      -
      - -
      -
      -
      -
      -
      -
      -
      - - -
      -
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      +
      + + +
      +
      +
      +
      +
      diff --git a/dashboard/users/role-users/role-users.component.ts b/dashboard/users/role-users/role-users.component.ts index 437d20cf..6ce7517b 100644 --- a/dashboard/users/role-users/role-users.component.ts +++ b/dashboard/users/role-users/role-users.component.ts @@ -10,8 +10,7 @@ import {Router} from "@angular/router"; import {StringUtils} from "../../../utils/string-utils.class"; import {NotificationService} from "../../../notifications/notification.service"; import {Subscription} from "rxjs"; - -declare var UIkit; +import {NotificationHandler} from "../../../utils/notification-handler"; @Component({ selector: 'role-users', @@ -37,8 +36,6 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges { public notificationFn: Function; @Input() public inviteDisableMessage: string; - @Output() - public stickyEmitter: EventEmitter = new EventEmitter(); public user: User = null; public active: any[] = []; public showActive: any[] = []; @@ -199,18 +196,10 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges { } this.filterActiveBySearch(this.filterForm.value.active); this.userManagementService.updateUserInfo(); - UIkit.notification(this.selectedUser + ' is no longer ' + this.role + ' of ' + this.name + ' Dashboard', { - status: 'success', - timeout: 6000, - pos: 'bottom-right' - }); + NotificationHandler.rise(this.selectedUser + ' is no longer ' + this.role + ' of ' + this.name + ' Dashboard'); this.loadActive = false; }, error => { - UIkit.notification('An error has occurred. Please try again later', { - status: 'danger', - timeout: 6000, - pos: 'bottom-right' - }); + NotificationHandler.rise('An error has occurred. Please try again later', 'danger'); this.loadActive = false; })); } @@ -223,18 +212,10 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges { if (this.currentPendingPage.length === 0) { this.pendingPage = 1; } - UIkit.notification(StringUtils.capitalize(this.role) + ' invitation to ' + this.selectedUser + ' has been canceled', { - status: 'success', - timeout: 6000, - pos: 'bottom-right' - }); + NotificationHandler.rise(StringUtils.capitalize(this.role) + ' invitation to ' + this.selectedUser + ' has been canceled'); this.loadPending = false; }, error => { - UIkit.notification('An error has occurred. Please try again later', { - status: 'danger', - timeout: 6000, - pos: 'bottom-right' - }); + NotificationHandler.rise('An error has occurred. Please try again later', 'danger'); this.loadPending = false; })); } @@ -255,31 +236,15 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges { } if (this.notificationFn) { this.subs.push(this.notificationService.sendNotification(this.notificationFn(this.name, this.invited.value, this.role, invitation)).subscribe(notification => { - UIkit.notification('A notification has been sent successfully', { - status: 'success', - timeout: 6000, - pos: 'bottom-right' - }); + NotificationHandler.rise('A notification has been sent successfully'); }, error => { - UIkit.notification('An error has occurred. Please try again later', { - status: 'danger', - timeout: 6000, - pos: 'bottom-right' - }); + NotificationHandler.rise('An error has occurred. Please try again later', 'danger'); })); } - UIkit.notification(StringUtils.capitalize(this.role) + ' invitation to ' + this.selectedUser + ' has been sent', { - status: 'success', - timeout: 6000, - pos: 'bottom-right' - }); + NotificationHandler.rise(StringUtils.capitalize(this.role) + ' invitation to ' + this.selectedUser + ' has been sent'); this.loadPending = false; }, error => { - UIkit.notification('An error has occurred. Please try again later', { - status: 'danger', - timeout: 6000, - pos: 'bottom-right' - }); + NotificationHandler.rise('An error has occurred. Please try again later', 'danger'); this.loadPending = false; })); } @@ -287,20 +252,11 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges { createGroup() { this.loadActive = true; this.loadPending = true; - this.roleFb.get('name').enable(); this.userRegistryService.createRole(this.type, this.id).subscribe(() => { - UIkit.notification('Group has been successfully created', { - status: 'success', - timeout: 6000, - pos: 'bottom-right' - }); + NotificationHandler.rise('Group has been successfully created'); this.updateLists(); }, error => { - UIkit.notification('An error has occurred. Please try again later', { - status: 'danger', - timeout: 6000, - pos: 'bottom-right' - }); + NotificationHandler.rise('An error has occurred. Please try again later', 'danger'); this.loadActive = false; this.loadPending = false; }); diff --git a/dashboard/users/subscribers/subscribers.component.html b/dashboard/users/subscribers/subscribers.component.html index 8eae26fc..c78773e6 100644 --- a/dashboard/users/subscribers/subscribers.component.html +++ b/dashboard/users/subscribers/subscribers.component.html @@ -1,27 +1,30 @@ -
      +
      -
      -
      -
      -
      -
      - - +
      +
      +
      +
      +
      +
      + + +
      +
      +
      diff --git a/dashboard/users/subscribers/subscribers.component.ts b/dashboard/users/subscribers/subscribers.component.ts index 6729709c..d579fd12 100644 --- a/dashboard/users/subscribers/subscribers.component.ts +++ b/dashboard/users/subscribers/subscribers.component.ts @@ -39,8 +39,6 @@ export class SubscribersComponent implements OnInit, OnDestroy, OnChanges { public message: string = null; @Input() public inviteDisableMessage: string; - @Output() - public stickyEmitter: EventEmitter = new EventEmitter(); public user: User = null; public subscribers: any[]; public showSubscribers: any[]; diff --git a/sharedComponents/subscriber-invite/subscriber-invite.component.ts b/sharedComponents/subscriber-invite/subscriber-invite.component.ts index 661c823b..8f022c34 100644 --- a/sharedComponents/subscriber-invite/subscriber-invite.component.ts +++ b/sharedComponents/subscriber-invite/subscriber-invite.component.ts @@ -10,8 +10,7 @@ import {Session, User} from "../../login/utils/helper.class"; import {EmailService} from "../../utils/email/email.service"; import {properties} from "../../../../environments/environment"; import {CommunityInfo} from "../../connect/community/communityInfo"; - -declare var UIkit; +import {NotificationHandler} from "../../utils/notification-handler"; @Component({ selector: 'subscriber-invite', @@ -94,9 +93,7 @@ export class SubscriberInviteComponent implements OnInit, OnDestroy { this.subscriptions.push(this.communityService.getCommunityAsObservable().subscribe(community => { this.community = community; if(this.community) { - this.inviteForm.get('name').enable(); this.inviteForm.get('name').setValue(this.user.fullname); - this.inviteForm.get('name').disable(); this.body = Composer.initializeInvitationsBody(community.communityId, community.title, this.user.fullname); this.email = Composer.initializeInvitationsEmail(community.title); this.inviteForm.get('message').setValue(this.body.paragraphs); @@ -109,31 +106,19 @@ export class SubscriberInviteComponent implements OnInit, OnDestroy { invite() { this.loading = true; - this.body.paragraphs = this.inviteForm.value.message; + this.body.paragraphs = this.inviteForm.getRawValue().message; this.email.body = Composer.formatEmailBodyForInvitation(this.body); this.email.recipients = this.inviteForm.get('recipients').value; this.subscriptions.push(this.emailService.sendEmail(properties, this.email).subscribe(res => { if(res['success']) { - UIkit.notification('Invitation to subscribe has been sent', { - status: 'success', - timeout: 6000, - pos: 'bottom-right' - }); + NotificationHandler.rise('Invitation to subscribe has been sent'); } else { - UIkit.notification('An error has occurred. Please try again later', { - status: 'danger', - timeout: 6000, - pos: 'bottom-right' - }); + NotificationHandler.rise('An error has occurred. Please try again later', 'danger'); } this.reset(); this.loading = false; },error => { - UIkit.notification('An error has occurred. Please try again later', { - status: 'danger', - timeout: 6000, - pos: 'bottom-right' - }); + NotificationHandler.rise('An error has occurred. Please try again later', 'danger'); this.reset(); this.loading = false; })); diff --git a/utils/HelperFunctions.class.ts b/utils/HelperFunctions.class.ts index 492364a3..2db62165 100644 --- a/utils/HelperFunctions.class.ts +++ b/utils/HelperFunctions.class.ts @@ -1,8 +1,9 @@ export class HelperFunctions { public static scroll() { - HelperFunctions.scrollTo(0,0); + HelperFunctions.scrollTo(0,0); } + public static scrollTo(x,y) { if (typeof document !== 'undefined') { window.scrollTo(x,y); diff --git a/utils/dropdown-filter/dropdown-filter.component.ts b/utils/dropdown-filter/dropdown-filter.component.ts index 5a276133..62598217 100644 --- a/utils/dropdown-filter/dropdown-filter.component.ts +++ b/utils/dropdown-filter/dropdown-filter.component.ts @@ -10,8 +10,10 @@ declare var UIkit; {{name}}({{count}}) -
      - +
      +
      + +
      ` })