feat: tour integration
Tour Integration
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
|
||||
<mat-card-content>
|
||||
|
||||
<div fxLayout="column">
|
||||
<div #workingDaysFormRef fxLayout="column">
|
||||
|
||||
<div fxLayout="row" fxLayout.lt-md="column">
|
||||
<mat-label fxFlex="50%" class="mat-h4">Working Days</mat-label>
|
||||
@@ -46,3 +46,14 @@
|
||||
</mat-card>
|
||||
|
||||
</div>
|
||||
|
||||
<ng-template #templateWorkingDaysFormRef let-data let-popover="popover">
|
||||
<h2>Working Days</h2>
|
||||
<p class="mw400">Click (Define Working Days) to define working days. For more details click: <a href="https://mifosforge.jira.com/wiki/spaces/docs/pages/90243212/Working+Days" target="_blank">Working Days</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()">Define Working Days</button>
|
||||
<button mat-raised-button color="primary" (click)="popover.close();previousStep()">Back</button>
|
||||
<button mat-raised-button color="primary" (click)="popover.close();nextStep()">Next Step</button>
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Component, OnInit, TemplateRef, ElementRef, ViewChild, AfterViewInit } from '@angular/core';
|
||||
import { FormGroup, FormBuilder, FormArray, FormControl } from '@angular/forms';
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
|
||||
/** Custom Services */
|
||||
import { OrganizationService } from '../organization.service';
|
||||
import { SettingsService } from 'app/settings/settings.service';
|
||||
import { PopoverService } from '../../configuration-wizard/popover/popover.service';
|
||||
import { ConfigurationWizardService } from '../../configuration-wizard/configuration-wizard.service';
|
||||
|
||||
/** Custom Dialog Components */
|
||||
import { NextStepDialogComponent } from '../../configuration-wizard/next-step-dialog/next-step-dialog.component';
|
||||
|
||||
/** Recurrence default value. */
|
||||
const recurrenceDefaultValue = 'FREQ=WEEKLY;INTERVAL=1;BYDAY=';
|
||||
@@ -18,7 +24,7 @@ const recurrenceDefaultValue = 'FREQ=WEEKLY;INTERVAL=1;BYDAY=';
|
||||
templateUrl: './working-days.component.html',
|
||||
styleUrls: ['./working-days.component.scss']
|
||||
})
|
||||
export class WorkingDaysComponent implements OnInit {
|
||||
export class WorkingDaysComponent implements OnInit, AfterViewInit {
|
||||
|
||||
/** Working days form. */
|
||||
workingDaysForm: FormGroup;
|
||||
@@ -37,6 +43,11 @@ export class WorkingDaysComponent implements OnInit {
|
||||
/** Repayment schedule type data. */
|
||||
repaymentRescheduleTypeData: any;
|
||||
|
||||
/* Reference of define working days form */
|
||||
@ViewChild('workingDaysFormRef') workingDaysFormRef: ElementRef<any>;
|
||||
/* Template for popover on define working days form */
|
||||
@ViewChild('templateWorkingDaysFormRef') templateWorkingDaysFormRef: TemplateRef<any>;
|
||||
|
||||
/**
|
||||
* Retrieves the working days data from `resolve`.
|
||||
* @param {FormBuilder} formBuilder Form Builder.
|
||||
@@ -44,12 +55,18 @@ export class WorkingDaysComponent implements OnInit {
|
||||
* @param {OrganizationService} organizationService Organization Service.
|
||||
* @param {SettingsService} settingsService Settings Service.
|
||||
* @param {Router} router Router for navigation.
|
||||
* @param {MatDialog} dialog MatDialog.
|
||||
* @param {ConfigurationWizardService} configurationWizardService ConfigurationWizard Service.
|
||||
* @param {PopoverService} popoverService PopoverService.
|
||||
*/
|
||||
constructor(private formBuilder: FormBuilder,
|
||||
private route: ActivatedRoute,
|
||||
private organizationService: OrganizationService,
|
||||
private settingsService: SettingsService,
|
||||
private router: Router) {
|
||||
private router: Router,
|
||||
private dialog: MatDialog,
|
||||
private configurationWizardService: ConfigurationWizardService,
|
||||
private popoverService: PopoverService) {
|
||||
this.route.data.subscribe((data: { workingDays: any }) => {
|
||||
this.workingDaysData = data.workingDays;
|
||||
});
|
||||
@@ -115,8 +132,73 @@ export class WorkingDaysComponent implements OnInit {
|
||||
}
|
||||
workingDays.recurrence = recurrence;
|
||||
this.organizationService.updateWorkingDays(workingDays).subscribe(response => {
|
||||
this.router.navigate(['../'], { relativeTo: this.route });
|
||||
if (this.configurationWizardService.showDefineWorkingDays === true) {
|
||||
this.configurationWizardService.showDefineWorkingDays = false;
|
||||
this.openNextStepDialog();
|
||||
} else {
|
||||
this.router.navigate(['../'], { 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.showDefineWorkingDays === true) {
|
||||
setTimeout(() => {
|
||||
this.showPopover(this.templateWorkingDaysFormRef, this.workingDaysFormRef.nativeElement, 'right', true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Open Dialog for next step.
|
||||
* Next Step (System) Configuration Wizard.
|
||||
*/
|
||||
nextStep() {
|
||||
this.configurationWizardService.showDefineWorkingDays = false;
|
||||
this.openNextStepDialog();
|
||||
}
|
||||
|
||||
/**
|
||||
* Previous Step (Organization Page) Configuration Wizard.
|
||||
*/
|
||||
previousStep() {
|
||||
this.router.navigate(['/organization']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Next Step (System) Dialog Configuration Wizard.
|
||||
*/
|
||||
openNextStepDialog() {
|
||||
const nextStepDialogRef = this.dialog.open( NextStepDialogComponent, {
|
||||
data: {
|
||||
nextStepName: 'Setup System',
|
||||
previousStepName: 'Organization',
|
||||
stepPercentage: 30
|
||||
},
|
||||
});
|
||||
nextStepDialogRef.afterClosed().subscribe((response: { nextStep: boolean }) => {
|
||||
if (response.nextStep) {
|
||||
this.configurationWizardService.showDefineWorkingDays = false;
|
||||
this.configurationWizardService.showDatatables = true;
|
||||
this.router.navigate(['/system']);
|
||||
} else {
|
||||
this.configurationWizardService.showDefineWorkingDays = false;
|
||||
this.router.navigate(['/home']);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user