feat: tour integration
Tour Integration
This commit is contained in:
@@ -1,30 +1,34 @@
|
||||
<div class="container m-b-20" fxLayout="row" fxLayoutAlign="end" fxLayoutGap="20px">
|
||||
<mat-button-toggle-group [formControl]="viewGroup">
|
||||
<mat-button-toggle value="listView">
|
||||
<fa-icon icon="list"></fa-icon>
|
||||
</mat-button-toggle>
|
||||
<mat-button-toggle value="treeView">
|
||||
<fa-icon icon="sitemap"></fa-icon>
|
||||
</mat-button-toggle>
|
||||
</mat-button-toggle-group>
|
||||
<button mat-raised-button color="primary" [routerLink]="['gl-accounts/create']" *mifosxHasPermission="'CREATE_GLACCOUNT'">
|
||||
<fa-icon icon="plus"></fa-icon>
|
||||
Add Account
|
||||
</button>
|
||||
<div #buttonTreeView>
|
||||
<mat-button-toggle-group [formControl]="viewGroup">
|
||||
<mat-button-toggle value="listView">
|
||||
<fa-icon icon="list"></fa-icon>
|
||||
</mat-button-toggle>
|
||||
<mat-button-toggle value="treeView">
|
||||
<fa-icon icon="sitemap"></fa-icon>
|
||||
</mat-button-toggle>
|
||||
</mat-button-toggle-group>
|
||||
</div>
|
||||
<div #buttonAddAccount>
|
||||
<button mat-raised-button color="primary" [routerLink]="['gl-accounts/create']" *mifosxHasPermission="'CREATE_GLACCOUNT'">
|
||||
<fa-icon icon="plus"></fa-icon>
|
||||
Add Account
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- List View -->
|
||||
|
||||
<div class="container" [hidden]="viewGroup.value !== 'listView'">
|
||||
|
||||
<div fxLayout="row" fxLayoutGap="20px">
|
||||
<div #filter fxLayout="row" fxLayoutGap="20px">
|
||||
<mat-form-field fxFlex>
|
||||
<mat-label>Filter</mat-label>
|
||||
<input matInput (keyup)="applyFilter($event.target.value)">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<div class="mat-elevation-z8">
|
||||
<div #accountsTable class="mat-elevation-z8">
|
||||
|
||||
<table mat-table [dataSource]="tableDataSource" matSort>
|
||||
|
||||
@@ -194,3 +198,41 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<ng-template #templateButtonTreeView let-popover="popover">
|
||||
<h2>Tree View</h2>
|
||||
<p class="mw300">There is an alternative way to view your accounts - using the Tree View.</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( templateButtonAddAccount, buttonAddAccount, 'bottom', true);">Next</button>
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
<ng-template #templateButtonAddAccount let-popover="popover">
|
||||
<h2>Add Account</h2>
|
||||
<p class="mw300">This option allows you to create new GL accounts.</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();showPopover(templateButtonTreeView, buttonTreeView , 'bottom', true);">Back</button>
|
||||
<button mat-raised-button color="primary" (click)="popover.close();showPopover(templateFilter, filter, 'bottom', true);">Next</button>
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
<ng-template #templateFilter let-popover="popover">
|
||||
<h4>Search bar to filter GL accounts.</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( templateButtonAddAccount, buttonAddAccount, 'bottom', true);">Back</button>
|
||||
<button mat-raised-button color="primary" (click)="popover.close();showPopover(templateAccountsTable, accountsTable, 'top', true);">Next</button>
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
<ng-template #templateAccountsTable let-popover="popover">
|
||||
<h4 class="mw300">List of chart of all the accounts being used by your organization.</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(templateFilter, filter, 'bottom', true);">Back</button>
|
||||
<button mat-raised-button color="primary" (click)="popover.close();nextStep()">Next</button>
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/** Angular Imports */
|
||||
import { Component, ViewChild, OnInit, AfterViewInit } 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 { MatTreeNestedDataSource } from '@angular/material/tree';
|
||||
import { NestedTreeControl } from '@angular/cdk/tree';
|
||||
import { FormControl } from '@angular/forms';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
/** rxjs Imports */
|
||||
import { of } from 'rxjs';
|
||||
@@ -16,6 +16,8 @@ import { GLAccountNode } from './gl-account-node.model';
|
||||
|
||||
/** Custom Services */
|
||||
import { GlAccountTreeService } from './gl-account-tree.service';
|
||||
import { PopoverService } from '../../configuration-wizard/popover/popover.service';
|
||||
import { ConfigurationWizardService } from '../../configuration-wizard/configuration-wizard.service';
|
||||
|
||||
/**
|
||||
* Chart of accounts component.
|
||||
@@ -47,13 +49,28 @@ export class ChartOfAccountsComponent implements AfterViewInit, OnInit {
|
||||
/** Sorter for chart of accounts table. */
|
||||
@ViewChild(MatSort, { static: true }) sort: MatSort;
|
||||
|
||||
/* Reference of Tree View Button */
|
||||
@ViewChild('buttonTreeView') buttonTreeView: ElementRef<any>;
|
||||
/* Template for popover on tree view button */
|
||||
@ViewChild('templateButtonTreeView') templateButtonTreeView: TemplateRef<any>;
|
||||
/* Reference of Accounts Table */
|
||||
@ViewChild('accountsTable') accountsTable: ElementRef<any>;
|
||||
/* Template for popover on accounts table */
|
||||
@ViewChild('templateAccountsTable') templateAccountsTable: TemplateRef<any>;
|
||||
|
||||
/**
|
||||
* Retrieves the gl accounts data from `resolve` and initializes(generates) gl accounts tree.
|
||||
* @param {GlAccountTreeService} glAccountTreeService GL Account tree service.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router.
|
||||
* @param {ConfigurationWizardService} configurationWizardService ConfigurationWizard Service.
|
||||
* @param {PopoverService} popoverService PopoverService.
|
||||
*/
|
||||
constructor(private glAccountTreeService: GlAccountTreeService,
|
||||
private route: ActivatedRoute) {
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private configurationWizardService: ConfigurationWizardService,
|
||||
private popoverService: PopoverService) {
|
||||
this.route.data.subscribe((data: { chartOfAccounts: any }) => {
|
||||
this.glAccountData = data.chartOfAccounts;
|
||||
glAccountTreeService.initialize(this.glAccountData);
|
||||
@@ -87,6 +104,17 @@ export class ChartOfAccountsComponent implements AfterViewInit, OnInit {
|
||||
}
|
||||
};
|
||||
this.tableDataSource.sort = this.sort;
|
||||
if (this.configurationWizardService.showChartofAccountsPage === true) {
|
||||
setTimeout(() => {
|
||||
this.showPopover(this.templateButtonTreeView, this.buttonTreeView.nativeElement, 'bottom', true);
|
||||
});
|
||||
}
|
||||
|
||||
if (this.configurationWizardService.showChartofAccountsList === true) {
|
||||
setTimeout(() => {
|
||||
this.showPopover(this.templateAccountsTable, this.accountsTable.nativeElement, 'top', true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -119,4 +147,34 @@ export class ChartOfAccountsComponent implements AfterViewInit, OnInit {
|
||||
*/
|
||||
private _getChildren = (node: GLAccountNode) => of(node.children);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Next Step (Create Charts of Accounts Page) Configuration Wizard.
|
||||
*/
|
||||
nextStep() {
|
||||
this.configurationWizardService.showChartofAccountsPage = false;
|
||||
this.configurationWizardService.showChartofAccountsList = false;
|
||||
this.configurationWizardService.showChartofAccountsForm = true;
|
||||
this.router.navigate(['/accounting/chart-of-accounts/gl-accounts/create']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Previous Step (Charts of Accounts Accounting Page) Configuration Wizard.
|
||||
*/
|
||||
previousStep() {
|
||||
this.configurationWizardService.showChartofAccountsPage = false;
|
||||
this.configurationWizardService.showChartofAccountsList = false;
|
||||
this.configurationWizardService.showChartofAccounts = true;
|
||||
this.router.navigate(['/accounting']);
|
||||
}
|
||||
}
|
||||
|
||||
+12
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
<mat-card>
|
||||
|
||||
<form [formGroup]="glAccountForm" (ngSubmit)="submit()">
|
||||
<form #accountFormRef [formGroup]="glAccountForm" (ngSubmit)="submit()">
|
||||
|
||||
<mat-card-content>
|
||||
|
||||
@@ -91,3 +91,14 @@
|
||||
</mat-card>
|
||||
|
||||
</div>
|
||||
|
||||
<ng-template #templateAccountFormRef let-popover="popover">
|
||||
<h2>Create GL account</h2>
|
||||
<p class="mw400">Click to start filling the details. * mark fields are neccessary. For more details click: <a href="https://mifosforge.jira.com/wiki/spaces/docs/pages/67141745/Chart+of+Accounts+-+General+Ledger+Setup" target="_blank">Chart of Accounts</a></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()">Create GL Account</button>
|
||||
<button mat-raised-button color="primary" (click)="popover.close();previousStep()">Back</button>
|
||||
<button mat-raised-button color="primary" (click)="popover.close();nextStep()">Next</button>
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
+91
-4
@@ -1,10 +1,16 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Component, OnInit, TemplateRef, ElementRef, ViewChild, AfterViewInit } from '@angular/core';
|
||||
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
|
||||
/** Custom Services */
|
||||
import { AccountingService } from '../../accounting.service';
|
||||
import { PopoverService } from '../../../configuration-wizard/popover/popover.service';
|
||||
import { ConfigurationWizardService } from '../../../configuration-wizard/configuration-wizard.service';
|
||||
|
||||
/** Custom Dialog Component */
|
||||
import { ContinueSetupDialogComponent } from '../../../configuration-wizard/continue-setup-dialog/continue-setup-dialog.component';
|
||||
|
||||
/**
|
||||
* Create gl account component.
|
||||
@@ -14,7 +20,7 @@ import { AccountingService } from '../../accounting.service';
|
||||
templateUrl: './create-gl-account.component.html',
|
||||
styleUrls: ['./create-gl-account.component.scss']
|
||||
})
|
||||
export class CreateGlAccountComponent implements OnInit {
|
||||
export class CreateGlAccountComponent implements OnInit, AfterViewInit {
|
||||
|
||||
/** GL account form. */
|
||||
glAccountForm: FormGroup;
|
||||
@@ -35,17 +41,28 @@ export class CreateGlAccountComponent implements OnInit {
|
||||
/** Cancel route. (depending on creation of gl account or sub-ledger account) */
|
||||
cancelRoute = '../../';
|
||||
|
||||
/* Reference of accounts form */
|
||||
@ViewChild('accountFormRef') accountFormRef: ElementRef<any>;
|
||||
/* Template for popover on accounts form */
|
||||
@ViewChild('templateAccountFormRef') templateAccountFormRef: TemplateRef<any>;
|
||||
|
||||
/**
|
||||
* Retrieves the chart of accounts data from `resolve`.
|
||||
* @param {FormBuilder} formBuilder Form Builder.
|
||||
* @param {AccountingService} accountingService Accounting Service.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
* @param {ConfigurationWizardService} configurationWizardService ConfigurationWizard Service.
|
||||
* @param {PopoverService} popoverService PopoverService.
|
||||
* @param {Matdialog} dialog Matdialog.
|
||||
*/
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
private accountingService: AccountingService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router) {
|
||||
private router: Router,
|
||||
private configurationWizardService: ConfigurationWizardService,
|
||||
private popoverService: PopoverService,
|
||||
public dialog: MatDialog) {
|
||||
this.route.queryParamMap.subscribe(params => {
|
||||
this.accountTypeId = Number(params.get('accountType'));
|
||||
this.parentId = Number(params.get('parent'));
|
||||
@@ -118,8 +135,78 @@ export class CreateGlAccountComponent implements OnInit {
|
||||
*/
|
||||
submit() {
|
||||
this.accountingService.createGlAccount(this.glAccountForm.value).subscribe((response: any) => {
|
||||
this.router.navigate(['../view', response.resourceId], { relativeTo: this.route });
|
||||
if (this.configurationWizardService.showChartofAccounts === true) {
|
||||
this.configurationWizardService.showChartofAccounts = false;
|
||||
this.openDialog();
|
||||
} else {
|
||||
this.router.navigate(['../view', response.resourceId], { relativeTo: this.route });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.showChartofAccountsForm === true) {
|
||||
setTimeout(() => {
|
||||
this.showPopover(this.templateAccountFormRef, this.accountFormRef.nativeElement, 'bottom', true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Next Step (Accounts Linked Accounting Page) Configuration Wizard.
|
||||
*/
|
||||
nextStep() {
|
||||
this.configurationWizardService.showChartofAccountsForm = false;
|
||||
this.configurationWizardService.showAccountsLinked = true;
|
||||
this.router.navigate(['/accounting']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Previous Step (Charts of Accounts Page) Configuration Wizard.
|
||||
*/
|
||||
previousStep() {
|
||||
this.configurationWizardService.showChartofAccountsForm = false;
|
||||
this.configurationWizardService.showChartofAccountsList = true;
|
||||
this.router.navigate(['/accounting/chart-of-accounts']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens dialog if the user wants to create more accounts.
|
||||
*/
|
||||
openDialog() {
|
||||
const continueSetupDialogRef = this.dialog.open(ContinueSetupDialogComponent, {
|
||||
data: {
|
||||
stepName: 'GL account'
|
||||
},
|
||||
});
|
||||
continueSetupDialogRef.afterClosed().subscribe((response: { step: number }) => {
|
||||
if (response.step === 1) {
|
||||
this.configurationWizardService.showChartofAccountsForm = false;
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
} else if (response.step === 2) {
|
||||
this.configurationWizardService.showChartofAccountsForm = true;
|
||||
this.router.routeReuseStrategy.shouldReuseRoute = () => false;
|
||||
this.router.onSameUrlNavigation = 'reload';
|
||||
this.router.navigate(['/accounting/chart-of-accounts/gl-accounts/create']);
|
||||
} else if (response.step === 3) {
|
||||
this.configurationWizardService.showChartofAccountsForm = false;
|
||||
this.configurationWizardService.showAccountsLinked = true;
|
||||
this.router.navigate(['/accounting']);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user