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
+70 -4
View File
@@ -1,16 +1,20 @@
/** 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';
@Component({
selector: 'mifosx-codes',
templateUrl: './codes.component.html',
styleUrls: ['./codes.component.scss']
})
export class CodesComponent implements OnInit {
export class CodesComponent implements OnInit, AfterViewInit {
/** Codes data. */
codesData: any;
@@ -24,11 +28,26 @@ export class CodesComponent implements OnInit {
/** Sorter for codes table. */
@ViewChild(MatSort, { static: true }) sort: MatSort;
/* Reference of create code button */
@ViewChild('buttonCreateCode') buttonCreateCode: ElementRef<any>;
/* Template for popover on create code button */
@ViewChild('templateButtonCreateCode') templateButtonCreateCode: TemplateRef<any>;
/* Reference of codes table */
@ViewChild('tableCodes') tableCodes: ElementRef<any>;
/* Template for popover on codes table */
@ViewChild('templateTableCodes') templateTableCodes: TemplateRef<any>;
/**
* Retrieves the codes 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: { codes: any }) => {
this.codesData = data.codes;
});
@@ -58,4 +77,51 @@ export class CodesComponent implements OnInit {
this.dataSource.filter = filterValue.trim().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.showSystemCodesPage === true) {
setTimeout(() => {
this.showPopover(this.templateButtonCreateCode, this.buttonCreateCode.nativeElement, 'bottom', true);
});
}
if (this.configurationWizardService.showSystemCodesList === true) {
setTimeout(() => {
this.showPopover(this.templateTableCodes, this.tableCodes.nativeElement, 'top', true);
});
}
}
/**
* Next Step (Create Codes Page) Configuration Wizard.
*/
nextStep() {
this.configurationWizardService.showSystemCodesPage = false;
this.configurationWizardService.showSystemCodesList = false;
this.configurationWizardService.showSystemCodesForm = true;
this.router.navigate(['/system/codes/create']);
}
/**
* Previous Step (manage Codes System Page) Configuration Wizard.
*/
previousStep() {
this.configurationWizardService.showSystemCodesPage = false;
this.configurationWizardService.showSystemCodesList = false;
this.configurationWizardService.showSystemCodes = true;
this.router.navigate(['/system']);
}
}