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
@@ -40,7 +40,7 @@
<mat-label>Repayment Scheduling Type</mat-label>
<mat-select required formControlName="reschedulingType">
<mat-option *ngFor="let repayments of holidayData.repaymentSchedulingTypes" [value]="repayments.id">
{{ repayments.value }}
{{ repayments.value }}
</mat-option>
</mat-select>
<mat-error *ngIf="holidayForm.controls.reschedulingType.hasError('required')">
@@ -1,15 +1,17 @@
<div class="container m-b-20" fxLayout="row" fxLayoutAlign="end" fxLayoutGap="20px">
<div #buttonCreateHoliday class="in-block">
<button mat-raised-button color="primary" [routerLink]="['create']" *mifosxHasPermission="'CREATE_HOLIDAY'">
<fa-icon icon="plus"></fa-icon>&nbsp;&nbsp;
Create Holiday
</button>
</div>
</div>
<div class="container">
<div fxLayout="row" fxLayoutGap="20px">
<div #filterRef fxLayout="row" fxLayoutGap="20px">
<mat-form-field fxFlex>
<mat-label>Filter</mat-label>
@@ -65,3 +67,22 @@
</div>
</div>
<ng-template #templateButtonCreateHoliday let-popover="popover">
<h2>Create Holiday</h2>
<p class="mw300">This option allows you to create holidays for different offices in your organization.</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(templateFilterRef,filterRef,'bottom', true);">Next</button>
</div>
</ng-template>
<ng-template #templateFilterRef let-popover="popover">
<h4>Search bar to filter holidays based on different offices.</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(templateButtonCreateHoliday,buttonCreateHoliday,'bottom', true);">Back</button>
<button mat-raised-button color="primary" (click)="popover.close();nextStep();">Next</button>
</div>
</ng-template>
@@ -1,9 +1,9 @@
/** 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 { ActivatedRoute } from '@angular/router';
import { ActivatedRoute, Router } from '@angular/router';
import { FormControl } from '@angular/forms';
/** rxjs Imports */
@@ -11,6 +11,8 @@ import { of } from 'rxjs';
/** Custom Services */
import { OrganizationService } from '../organization.service';
import { PopoverService } from '../../configuration-wizard/popover/popover.service';
import { ConfigurationWizardService } from '../../configuration-wizard/configuration-wizard.service';
/**
* Holidays component.
@@ -20,7 +22,7 @@ import { OrganizationService } from '../organization.service';
templateUrl: './holidays.component.html',
styleUrls: ['./holidays.component.scss']
})
export class HolidaysComponent implements OnInit {
export class HolidaysComponent implements OnInit, AfterViewInit {
/** Office selector. */
officeSelector = new FormControl();
@@ -38,14 +40,29 @@ export class HolidaysComponent implements OnInit {
/** Sorter for holidays table. */
@ViewChild(MatSort, { static: true }) sort: MatSort;
/* Reference of create holiday button */
@ViewChild('buttonCreateHoliday') buttonCreateHoliday: ElementRef<any>;
/* Template for popover on create holiday button */
@ViewChild('templateButtonCreateHoliday') templateButtonCreateHoliday: TemplateRef<any>;
/* Reference of filter */
@ViewChild('filterRef') filterRef: ElementRef<any>;
/* Template to show popover on filter */
@ViewChild('templateFilterRef') templateFilterRef: TemplateRef<any>;
/**
* Retrieves the offices data from `resolve`.
* @param {OrganizationService} organizationService Organization Service.
* @param {ActivatedRoute} route Activated Route.
* @param {FormBuilder} formBuilder Form Builder.
* @param {Router} router Router.
* @param {ConfigurationWizardService} configurationWizardService ConfigurationWizard Service.
* @param {PopoverService} popoverService PopoverService.
*/
constructor(private organizationService: OrganizationService,
private route: ActivatedRoute) {
private route: ActivatedRoute,
private router: Router,
private configurationWizardService: ConfigurationWizardService,
private popoverService: PopoverService) {
this.route.data.subscribe(( data: { offices: any }) => {
this.officeData = data.offices;
});
@@ -88,4 +105,51 @@ export class HolidaysComponent implements OnInit {
this.dataSource.sort = this.sort;
}
/**
* 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.showHolidayPage === true) {
setTimeout(() => {
this.showPopover(this.templateButtonCreateHoliday, this.buttonCreateHoliday.nativeElement, 'bottom', true);
});
}
if (this.configurationWizardService.showHolidayFilter === true) {
setTimeout(() => {
this.showPopover(this.templateFilterRef, this.filterRef.nativeElement, 'bottom', true);
});
}
}
/**
* Next Step (Create Employee) Configuration Wizard.
*/
nextStep() {
this.configurationWizardService.showHolidayPage = false;
this.configurationWizardService.showHolidayFilter = false;
this.configurationWizardService.showCreateEmployee = true;
this.router.navigate(['/organization']);
}
/**
* Previous Step (Manage Holidays) Configuration Wizard.
*/
previousStep() {
this.configurationWizardService.showHolidayPage = false;
this.configurationWizardService.showHolidayFilter = false;
this.configurationWizardService.showCreateHoliday = true;
this.router.navigate(['/organization']);
}
}