feat: tour integration

Tour Integration
This commit is contained in:
Ramveer
2022-09-02 17:03:13 +05:30
committed by GitHub
parent 52b7a3274e
commit f1be9ab5b1
119 changed files with 6360 additions and 456 deletions
@@ -1,14 +1,18 @@
/** 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 { FormControl } from '@angular/forms';
import { ActivatedRoute } from '@angular/router';
import { ActivatedRoute, Router } from '@angular/router';
/** rxjs Imports */
import { startWith, map } from 'rxjs/operators';
/** Custom Services */
import { PopoverService } from '../../configuration-wizard/popover/popover.service';
import { ConfigurationWizardService } from '../../configuration-wizard/configuration-wizard.service';
/**
* Closing entries component.
*/
@@ -17,7 +21,7 @@ import { startWith, map } from 'rxjs/operators';
templateUrl: './closing-entries.component.html',
styleUrls: ['./closing-entries.component.scss']
})
export class ClosingEntriesComponent implements OnInit {
export class ClosingEntriesComponent implements OnInit, AfterViewInit {
/** Columns to be displayed in closing entries table. */
displayedColumns: string[] = ['officeName', 'closingDate', 'comments', 'createdByUsername'];
@@ -37,11 +41,26 @@ export class ClosingEntriesComponent implements OnInit {
/** Sorter for closing entries table. */
@ViewChild(MatSort, { static: true }) sort: MatSort;
/* Reference of create closure button */
@ViewChild('buttonCreateClosure') buttonCreateClosure: ElementRef<any>;
/* Template for popover on create closure button */
@ViewChild('templateButtonCreateClosure') templateButtonCreateClosure: TemplateRef<any>;
/* Reference of closures table */
@ViewChild('closuresTable') closuresTable: ElementRef<any>;
/* Template for popover on closures table */
@ViewChild('templateClosuresTable') templateClosuresTable: TemplateRef<any>;
/**
* Retrieves the offices and gl account closures 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: {
offices: any,
glAccountClosures: any
@@ -99,4 +118,51 @@ export class ClosingEntriesComponent implements OnInit {
return this.officeData.filter((office: any) => office.name.toLowerCase().includes(officeName.toLowerCase()));
}
/**
* 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.showClosingEntriesPage === true) {
setTimeout(() => {
this.showPopover(this.templateButtonCreateClosure, this.buttonCreateClosure.nativeElement, 'bottom', true);
});
}
if (this.configurationWizardService.showClosingEntriesList === true) {
setTimeout(() => {
this.showPopover(this.templateClosuresTable, this.closuresTable.nativeElement, 'top', true);
});
}
}
/**
* Next Step (Create journal Entry Accounting Page) Configuration Wizard.
*/
nextStep() {
this.configurationWizardService.showClosingEntriesPage = false;
this.configurationWizardService.showClosingEntriesList = false;
this.configurationWizardService.showCreateJournalEntries = true;
this.router.navigate(['/accounting']);
}
/**
* Previous Step (Closing Entries Accounting Page) Configuration Wizard.
*/
previousStep() {
this.configurationWizardService.showClosingEntriesPage = false;
this.configurationWizardService.showClosingEntriesList = false;
this.configurationWizardService.showClosingEntries = true;
this.router.navigate(['/accounting']);
}
}