feat: tour integration
Tour Integration
This commit is contained in:
@@ -1,20 +1,22 @@
|
||||
<div class="container m-b-20" fxLayout="row" fxLayoutAlign="end" fxLayoutGap="20px">
|
||||
<div #buttonCreateReport class="in-block">
|
||||
<button mat-raised-button color="primary" [routerLink]="['create']" *mifosxHasPermission="'CREATE_REPORT'">
|
||||
<fa-icon icon="plus"></fa-icon>
|
||||
Create Report
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
|
||||
<div fxLayout="row">
|
||||
<div #filter fxLayout="row">
|
||||
<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 #reportsTable class="mat-elevation-z8">
|
||||
|
||||
<table mat-table [dataSource]="dataSource" matSort>
|
||||
|
||||
@@ -67,3 +69,31 @@
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ng-template #templateButtonCreateReport let-popover="popover">
|
||||
<h2>Create Report</h2>
|
||||
<p class="mw300">This option allows you to create new report.</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 reports by name.</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(templateButtonCreateReport, buttonCreateReport, 'bottom', true)">Back</button>
|
||||
<button mat-raised-button color="primary" (click)="popover.close();showPopover(templateReportsTable,reportsTable, 'top', true)">Next</button>
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
<ng-template #templateReportsTable let-popover="popover">
|
||||
<h4 class="mw300">List of all currently available reports. For more details click: <a href="https://mifosforge.jira.com/wiki/spaces/docs/pages/67895354/Manage+Reports" target="_blank">Manage Reports</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,9 +1,17 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit, ViewChild } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
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, Router } from '@angular/router';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
|
||||
/* Custom Services */
|
||||
import { PopoverService } from '../../configuration-wizard/popover/popover.service';
|
||||
import { ConfigurationWizardService } from '../../configuration-wizard/configuration-wizard.service';
|
||||
|
||||
/** Custom Dialog Component */
|
||||
import { CompletionDialogComponent } from '../../configuration-wizard/completion-dialog/completion-dialog.component';
|
||||
|
||||
/**
|
||||
* Manage Reports Component.
|
||||
@@ -13,7 +21,7 @@ import { MatTableDataSource } from '@angular/material/table';
|
||||
templateUrl: './manage-reports.component.html',
|
||||
styleUrls: ['./manage-reports.component.scss']
|
||||
})
|
||||
export class ManageReportsComponent implements OnInit {
|
||||
export class ManageReportsComponent implements OnInit, AfterViewInit {
|
||||
|
||||
/** Reports Data. */
|
||||
reportsData: any;
|
||||
@@ -27,11 +35,24 @@ export class ManageReportsComponent implements OnInit {
|
||||
/** Sorter for reports table. */
|
||||
@ViewChild(MatSort, { static: true }) sort: MatSort;
|
||||
|
||||
/* Reference of Create Report Button */
|
||||
@ViewChild('buttonCreateReport') buttonCreateReport: ElementRef<any>;
|
||||
/* Template for popover on Create Report Button */
|
||||
@ViewChild('templateButtonCreateReport') templateButtonCreateReport: TemplateRef<any>;
|
||||
|
||||
/**
|
||||
* Retrieves the reports data from `resolve`.
|
||||
* @param {ActivatedRoute} route Activated Route.
|
||||
* @param {Router} router Router for navigation.
|
||||
* @param {ConfigurationWizardService} configurationWizardService ConfigurationWizard Service.
|
||||
* @param {PopoverService} popoverService PopoverService.
|
||||
* @param {Matdialog} matdialog Matdialog.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute) {
|
||||
constructor(private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private configurationWizardService: ConfigurationWizardService,
|
||||
private popoverService: PopoverService,
|
||||
private dialog: MatDialog) {
|
||||
this.route.data.subscribe((data: { reports: any }) => {
|
||||
this.reportsData = data.reports;
|
||||
});
|
||||
@@ -61,4 +82,50 @@ export class ManageReportsComponent implements OnInit {
|
||||
this.dataSource.filter = filterValue.trim().toLowerCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* To show popover.
|
||||
*/
|
||||
ngAfterViewInit() {
|
||||
if (this.configurationWizardService.showManageReports === true) {
|
||||
setTimeout(() => {
|
||||
this.showPopover(this.templateButtonCreateReport, this.buttonCreateReport.nativeElement, 'bottom', true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 (Home) Configuration Wizard Tour Complete.
|
||||
*/
|
||||
nextStep() {
|
||||
this.configurationWizardService.showManageReports = false;
|
||||
this.openNextStepDialog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Previous Step (Manage Reports System Page) Configuration Wizard.
|
||||
*/
|
||||
previousStep() {
|
||||
this.router.navigate(['/system']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Completed Configuration Wizard Tour Dialog.
|
||||
*/
|
||||
openNextStepDialog() {
|
||||
const completionDialogRef = this.dialog.open( CompletionDialogComponent );
|
||||
completionDialogRef.afterClosed().subscribe(() => {
|
||||
this.router.navigate(['/home']);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user