/** Angular Imports. */ import { Component } from '@angular/core' ; import { ActivatedRoute , Router } from '@angular/router' ; import { MatDialog } from '@angular/material/dialog' ; /** Custom Services. */ import { OrganizationService } from 'app/organization/organization.service' ; /** Custom Components. */ import { ConfirmationDialogComponent } from '../../../shared/confirmation-dialog/confirmation-dialog.component' ; import { DeleteDialogComponent } from '../../../shared/delete-dialog/delete-dialog.component' ; /**
 * View Holidays component.
 */ @ Component ( { selector : 'mifosx-view-holidays' , templateUrl : './view-holidays.component.html' , styleUrls : [ './view-holidays.component.scss' ] } ) export class ViewHolidaysComponent { /** Holiday data. */ holidayData : any ; param { ActivatedRoute } route constructor ( private route , private router , private dialog , private organizationService ) { this . route . data . subscribe ( ( data ) => { this . holidayData = data . holidays ; } ) ; } /**
     * Deletes the holiday.
     */ deleteHoliday ( ) { const deleteHolidayDialogRef = this . dialog . open ( DeleteDialogComponent , { data : { deleteContext : `holiday ${ this . holidayData . id }` } } ) ; deleteHolidayDialogRef . afterClosed ( ) . subscribe ( ( response ) => { if ( response . delete ) { this . organizationService . deleteHoliday ( this . holidayData . id ) . subscribe ( ( ) => { this . router . navigate ( [ '../' ] , { relativeTo : this . route } ) ; } ) ; } } ) ; } /**
     * Activate holiday.
     */ activateHoliday ( ) { const unAssignStaffDialogRef = this . dialog . open ( ConfirmationDialogComponent , { data : { heading : 'Holiday' , dialogContext : `Are you sure you want to activate ${ this . holidayData . name } holiday` } } ) ; unAssignStaffDialogRef . afterClosed ( ) . subscribe ( ( response ) => { if ( response . confirm ) { this . organizationService . activateHoliday ( this . holidayData . id ) . subscribe ( ( ) => { this . router . navigate ( [ '/organization/holidays' ] ) ; } ) ; } } ) ; } }