feat: tour integration
Tour Integration
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
<mat-card>
|
||||
|
||||
<div>
|
||||
<div #fundFormRef>
|
||||
|
||||
<form #formRef="ngForm" [formGroup]="fundForm" fxLayout="row" fxLayoutAlign="start baseline" fxLayoutGap="20px"
|
||||
(ngSubmit)="addFund()" *mifosxHasPermission="'CREATE_FUND'">
|
||||
@@ -14,9 +14,11 @@
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<button mat-raised-button fxFlex color="primary" [disabled]="!fundForm.valid">
|
||||
<fa-icon icon="plus"></fa-icon>
|
||||
</button>
|
||||
<div #buttonAddFund fxFlex>
|
||||
<button mat-raised-button color="primary" [disabled]="!fundForm.valid">
|
||||
<fa-icon icon="plus"></fa-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
@@ -41,3 +43,15 @@
|
||||
</mat-card>
|
||||
|
||||
</div>
|
||||
|
||||
<ng-template #templateFundFormRef let-popover="popover">
|
||||
<h2>Manage Funds</h2>
|
||||
<p class="mw300">This form will be used to add fund. If you would like to add fund click on add funds button and fill the fund name then click on + button else click Next or Back. For more details click: <a href="https://mifosforge.jira.com/wiki/spaces/docs/pages/67141736/Manage+Funds" target="_blank">Manage Funds</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();">Add Funds</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>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** 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 { ActivatedRoute, Router } from '@angular/router';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { FormBuilder, Validators } from '@angular/forms';
|
||||
|
||||
@@ -13,6 +13,11 @@ import { InputBase } from 'app/shared/form-dialog/formfield/model/input-base';
|
||||
|
||||
/** Custom Services */
|
||||
import { OrganizationService } from '../organization.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';
|
||||
|
||||
/**
|
||||
* Manage Funds component.
|
||||
@@ -22,7 +27,7 @@ import { OrganizationService } from '../organization.service';
|
||||
templateUrl: './manage-funds.component.html',
|
||||
styleUrls: ['./manage-funds.component.scss']
|
||||
})
|
||||
export class ManageFundsComponent implements OnInit {
|
||||
export class ManageFundsComponent implements OnInit, AfterViewInit {
|
||||
|
||||
/** Manage Funds data. */
|
||||
fundsData: any;
|
||||
@@ -31,17 +36,28 @@ export class ManageFundsComponent implements OnInit {
|
||||
/** Funds form reference */
|
||||
@ViewChild('formRef') formRef: any;
|
||||
|
||||
/* Refernce of funds form */
|
||||
@ViewChild('fundFormRef') fundFormRef: ElementRef<any>;
|
||||
/* Template for popover on funds form */
|
||||
@ViewChild('templateFundFormRef') templateFundFormRef: TemplateRef<any>;
|
||||
|
||||
/**
|
||||
* Retrieves the manage funds data from `resolve`.
|
||||
* @param {ActivatedRoute} route Activated Route
|
||||
* @param {FormBuilder} formBuilder Form Builder
|
||||
* @param {OrganizationService} organizationservice Organization Service
|
||||
* @param {MatDialog} dialog Mat Dialog
|
||||
* @param {Router} router Router.
|
||||
* @param {ConfigurationWizardService} configurationWizardService ConfigurationWizard Service.
|
||||
* @param {PopoverService} popoverService PopoverService.
|
||||
*/
|
||||
constructor(private route: ActivatedRoute,
|
||||
private formBuilder: FormBuilder,
|
||||
private organizationservice: OrganizationService,
|
||||
public dialog: MatDialog) {
|
||||
public dialog: MatDialog,
|
||||
private router: Router,
|
||||
private configurationWizardService: ConfigurationWizardService,
|
||||
private popoverService: PopoverService) {
|
||||
this.route.data.subscribe(( data: { funds: any }) => {
|
||||
this.fundsData = data.funds;
|
||||
});
|
||||
@@ -71,6 +87,10 @@ export class ManageFundsComponent implements OnInit {
|
||||
name: newFund.name
|
||||
});
|
||||
this.formRef.resetForm();
|
||||
if (this.configurationWizardService.showManageFunds === true) {
|
||||
this.configurationWizardService.showManageFunds = false;
|
||||
this.openDialog();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -105,4 +125,67 @@ export class ManageFundsComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.showManageFunds === true) {
|
||||
setTimeout(() => {
|
||||
this.showPopover(this.templateFundFormRef, this.fundFormRef.nativeElement, 'bottom', true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Previous Step (Organization Page) Dialog Configuration Wizard.
|
||||
*/
|
||||
previousStep() {
|
||||
this.router.navigate(['/organization']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Next Step (Manage Reports) Dialog Configuration Wizard.
|
||||
*/
|
||||
nextStep() {
|
||||
this.configurationWizardService.showManageFunds = false;
|
||||
this.configurationWizardService.showManageReports = true;
|
||||
this.router.navigate(['/system']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens dialog if the user wants to edit more funds.
|
||||
*/
|
||||
openDialog() {
|
||||
const continueSetupDialogRef = this.dialog.open(ContinueSetupDialogComponent, {
|
||||
data: {
|
||||
stepName: 'fund'
|
||||
},
|
||||
});
|
||||
continueSetupDialogRef.afterClosed().subscribe((response: { step: number }) => {
|
||||
if (response.step === 1) {
|
||||
this.configurationWizardService.showManageFunds = false;
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
} else if (response.step === 2) {
|
||||
this.configurationWizardService.showManageFunds = true;
|
||||
this.router.routeReuseStrategy.shouldReuseRoute = () => false;
|
||||
this.router.onSameUrlNavigation = 'reload';
|
||||
this.router.navigate(['/organization/manage-funds']);
|
||||
} else if (response.step === 3) {
|
||||
this.configurationWizardService.showManageFunds = false;
|
||||
this.configurationWizardService.showManageReports = true;
|
||||
this.router.navigate(['/system']);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user