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,11 +1,13 @@
<div class="container m-b-20" fxLayout="row" fxLayoutAlign="end" fxLayoutGap="20px">
<button mat-raised-button color="primary" [routerLink]="['create']" *mifosxHasPermission="'CREATE_GLCLOSURE'">
<fa-icon icon="plus"></fa-icon>&nbsp;&nbsp;
Create Closure
</button>
<div #buttonCreateClosure>
<button mat-raised-button color="primary" [routerLink]="['create']" *mifosxHasPermission="'CREATE_GLCLOSURE'">
<fa-icon icon="plus"></fa-icon>&nbsp;&nbsp;
Create Closure
</button>
</div>
</div>
<div class="container" fxLayout="row">
<div #filter class="container" fxLayout="row">
<mat-form-field fxFlex>
<mat-label>Office Name</mat-label>
<input matInput [formControl]="officeName" [matAutocomplete]="officeNameAutocomplete">
@@ -21,7 +23,7 @@
<div class="container">
<div class="mat-elevation-z8">
<div #closuresTable class="mat-elevation-z8">
<table mat-table [dataSource]="dataSource" matSort>
@@ -55,3 +57,31 @@
</div>
</div>
<ng-template #templateButtonCreateClosure let-popover="popover">
<h2>Create Closure</h2>
<p class="mw300">This option allows you to create new closure.</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(templateFilter,filter, 'bottom', true);">Next</button>
</div>
</ng-template>
<ng-template #templateFilter let-popover="popover">
<h4>Search bar to filter closures by office.</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(templateButtonCreateClosure, buttonCreateClosure, 'bottom', true);">Back</button>
<button mat-raised-button color="primary" (click)="popover.close();showPopover(templateClosuresTable,closuresTable, 'top', true);">Next</button>
</div>
</ng-template>
<ng-template #templateClosuresTable let-popover="popover">
<h4>List of closures. To know more click: <a href="https://mifosforge.jira.com/wiki/spaces/docs/pages/67895316/Closing+Entries" target="_blank">Closing Entries</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(templateFilter,filter, 'bottom', true);">Back</button>
<button mat-raised-button color="primary" (click)="popover.close();nextStep()">Next</button>
</div>
</ng-template>
@@ -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']);
}
}