/** Angular Imports */ import { Component , OnInit , Input } from '@angular/core' ; import { Router , ActivatedRoute } from '@angular/router' ; import { MatDialog } from '@angular/material/dialog' ; /** Custom Components */ import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component' ; import { ClientFamilyMemberDialogComponent } from './client-family-member-dialog/client-family-member-dialog.component' ; /**
 * Client Family Members Step
 */ @ Component ( { selector : 'mifosx-client-family-members-step' , templateUrl : './client-family-members-step.component.html' , styleUrls : [ './client-family-members-step.component.scss' ] } ) export class ClientFamilyMembersStepComponent { /** Cient Template */ @ Input ( ) clientTemplate : any ; /** Client Family Members */ clientFamilyMembers : any [ ] = [ ] ; param { MatDialog } dialog constructor ( public dialog ) { } /**
     * Adds a family member.
     */ addFamilyMember ( ) { const addFamilyMemberDialogRef = this . dialog . open ( ClientFamilyMemberDialogComponent , { data : { context : 'Add' , options : this . clientTemplate . familyMemberOptions , } , width : '50rem' } ) ; addFamilyMemberDialogRef . afterClosed ( ) . subscribe ( ( response ) => { if ( response . member ) { this . clientFamilyMembers . push ( response . member ) ; } } ) ; } param { any } member param { any } index editFamilyMember ( member , index ) { const addFamilyMemberDialogRef = this . dialog . open ( ClientFamilyMemberDialogComponent , { data : { context : 'Edit' , member : member , options : this . clientTemplate . familyMemberOptions , } , width : '50rem' } ) ; addFamilyMemberDialogRef . afterClosed ( ) . subscribe ( ( response ) => { if ( response . member ) { this . clientFamilyMembers . splice ( index , 1 , response . member ) ; } } ) ; } /**
     * Deletes the family member
     */ deleteFamilyMember ( name , index ) { const deleteFamilyMemberDialogRef = this . dialog . open ( DeleteDialogComponent , { data : { deleteContext : `Family member name : ${ name } ${ index }` } } ) ; deleteFamilyMemberDialogRef . afterClosed ( ) . subscribe ( ( response ) => { if ( response . delete ) { this . clientFamilyMembers . splice ( index , 1 ) ; } } ) ; } /**
     * Returns the array of client family members.
     */ get familyMembers ( ) { return { familyMembers : this . clientFamilyMembers } ; } }