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,10 +1,12 @@
<div fxLayout="row" fxLayoutAlign="end" class="container m-b-20">
<button mat-raised-button color="primary" [routerLink]="['create']" *mifosxHasPermission="'CREATE_FINANCIALACTIVITYACCOUNT'">
<fa-icon icon="plus"></fa-icon>&nbsp;&nbsp;Define New Mapping
</button>
<div #buttonDefineMapping>
<button mat-raised-button color="primary" [routerLink]="['create']" *mifosxHasPermission="'CREATE_FINANCIALACTIVITYACCOUNT'">
<fa-icon icon="plus"></fa-icon>&nbsp;&nbsp;Define New Mapping
</button>
</div>
</div>
<div class="mat-elevation-z8 container">
<div #activitiesTable class="mat-elevation-z8 container">
<table mat-table [dataSource]="dataSource" matSort>
@@ -31,3 +33,22 @@
<mat-paginator [pageSizeOptions]="[10, 25]" showFirstLastButtons></mat-paginator>
</div>
<ng-template #templateButtonDefineMapping let-popover="popover">
<h2>Define New Mapping</h2>
<p class="mw300">To define new mapping.</p>
<div fxLayout="row" fxLayoutAlign="end" fxLayoutGap="2%" fxLayout.lt-md="column">
<button mat-raised-button color="warn" (click)="popover.close();configurationWizardService.closeConfigWizard()">Close</button>
<button mat-raised-button color="primary" (click)="popover.close();previousStep()">Back</button>
<button mat-raised-button color="primary" (click)="popover.close();showPopover(templateActivitiesTable, activitiesTable, 'top', true)">Next</button>
</div>
</ng-template>
<ng-template #templateActivitiesTable let-popover="popover">
<h4 class="mw300">List of accounts linked to different financial activities. To know more click: <a href="https://mifosforge.jira.com/wiki/spaces/docs/pages/106430472/Accounts+linked+to+Financial+Activities" target="_blank">Accounts linked to Financial Activities</a> </h4>
<div fxLayout="row" fxLayoutAlign="end" fxLayoutGap="2%" fxLayout.lt-md="column">
<button mat-raised-button color="warn" (click)="popover.close();configurationWizardService.closeConfigWizard()">Close</button>
<button mat-raised-button color="primary" (click)="popover.close();showPopover(templateButtonDefineMapping, buttonDefineMapping , 'bottom', true)">Back</button>
<button mat-raised-button color="primary" (click)="popover.close();nextStep()">Next</button>
</div>
</ng-template>
@@ -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']);
}
}