feat: tour integration
Tour Integration
This commit is contained in:
+71
-4
@@ -1,9 +1,13 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { Component, OnInit, TemplateRef, ElementRef, ViewChild, AfterViewInit } from '@angular/core';
|
||||
import { MatPaginator } from '@angular/material/paginator';
|
||||
import { MatSort } from '@angular/material/sort';
|
||||
import { MatTableDataSource } from '@angular/material/table';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
/** Custom Services */
|
||||
import { PopoverService } from '../../configuration-wizard/popover/popover.service';
|
||||
import { ConfigurationWizardService } from '../../configuration-wizard/configuration-wizard.service';
|
||||
|
||||
/**
|
||||
* Financial activity mappings component.
|
||||
@@ -13,7 +17,7 @@ import { ActivatedRoute } from '@angular/router';
|
||||
templateUrl: './financial-activity-mappings.component.html',
|
||||
styleUrls: ['./financial-activity-mappings.component.scss']
|
||||
})
|
||||
export class FinancialActivityMappingsComponent implements OnInit {
|
||||
export class FinancialActivityMappingsComponent implements OnInit, AfterViewInit {
|
||||
|
||||
/** Financial activity account data. */
|
||||
financialActivityAccountData: any;
|
||||
@@ -27,11 +31,26 @@ export class FinancialActivityMappingsComponent implements OnInit {
|
||||
/** Sorter for financial activity mappings table. */
|
||||
@ViewChild(MatSort, { static: true }) sort: MatSort;
|
||||
|
||||
/* Reference of define mapping button */
|
||||
@ViewChild('buttonDefineMapping') buttonDefineMapping: ElementRef<any>;
|
||||
/* Template for popover on define mapping button */
|
||||
@ViewChild('templateButtonDefineMapping') templateButtonDefineMapping: TemplateRef<any>;
|
||||
/* Reference of Activities table */
|
||||
@ViewChild('activitiesTable') activitiesTable: ElementRef<any>;
|
||||
/* Template for popover on Activities table */
|
||||
@ViewChild('templateActivitiesTable') templateActivitiesTable: TemplateRef<any>;
|
||||
|
||||
/**
|
||||
* Retrieves the financial activity accounts data from `resolve`.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router.
|
||||
* @param {ConfigurationWizardService} configurationWizardService ConfigurationWizard Service.
|
||||
* @param {PopoverService} popoverService PopoverService.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute) {
|
||||
constructor(private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private configurationWizardService: ConfigurationWizardService,
|
||||
private popoverService: PopoverService) {
|
||||
this.route.data.subscribe(( data: { financialActivityAccounts: any }) => {
|
||||
this.financialActivityAccountData = data.financialActivityAccounts;
|
||||
});
|
||||
@@ -61,4 +80,52 @@ export class FinancialActivityMappingsComponent implements OnInit {
|
||||
this.dataSource.sort = this.sort;
|
||||
}
|
||||
|
||||
/**
|
||||
* Popover function
|
||||
* @param template TemplateRef<any>.
|
||||
* @param target HTMLElement | ElementRef<any>.
|
||||
* @param position String.
|
||||
* @param backdrop Boolean.
|
||||
*/
|
||||
showPopover(template: TemplateRef<any>, target: HTMLElement | ElementRef<any>, position: string, backdrop: boolean): void {
|
||||
setTimeout(() => this.popoverService.open(template, target, position, backdrop, {}), 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* To show popover.
|
||||
*/
|
||||
ngAfterViewInit() {
|
||||
if (this.configurationWizardService.showAccountsLinkedPage === true) {
|
||||
setTimeout(() => {
|
||||
this.showPopover(this.templateButtonDefineMapping, this.buttonDefineMapping.nativeElement, 'bottom', true);
|
||||
});
|
||||
}
|
||||
|
||||
if (this.configurationWizardService.showAccountsLinkedList === true) {
|
||||
setTimeout(() => {
|
||||
this.showPopover(this.templateActivitiesTable, this.activitiesTable.nativeElement, 'top', true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Next Step (Migrate Opening Balances Accounting Page) Configuration Wizard.
|
||||
*/
|
||||
nextStep() {
|
||||
this.configurationWizardService.showAccountsLinkedPage = false;
|
||||
this.configurationWizardService.showAccountsLinkedList = false;
|
||||
this.configurationWizardService.showMigrateOpeningBalances = true;
|
||||
this.router.navigate(['/accounting']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Previous Step (Accounts Linked Accounting Page) Configuration Wizard.
|
||||
*/
|
||||
previousStep() {
|
||||
this.configurationWizardService.showAccountsLinkedPage = false;
|
||||
this.configurationWizardService.showAccountsLinkedList = false;
|
||||
this.configurationWizardService.showAccountsLinked = true;
|
||||
this.router.navigate(['/accounting']);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user