/** Angular Imports */ import { Component , OnInit } from '@angular/core' ; /** Custom Service */ import { SettingsService } from './settings.service' ; import { FormControl } from '@angular/forms' ; /**
 * Settings component.
 */ @ Component ( { selector : 'mifosx-settings' , templateUrl : './settings.component.html' , styleUrls : [ './settings.component.scss' ] } ) export class SettingsComponent implements OnInit { /** Placeholder for languages. update once translations are set up */ languages : any [ ] = [ { name : 'English' , code : 'en' } ] ; /** Date formats. */ dateFormats : string [ ] = [ 'dd MMMM yyyy' , 'dd/MMMM/yyyy' , 'dd-MMMM-yyyy' , 'dd-MM-yy' , 'MMMM-dd-yyyy' , 'MMMM dd yyyy' , 'MMMM/dd/yyyy' , 'MM-dd-yy' , 'yyyy-MM-dd' ] ; /** Placeholder for fonts. */ fonts : any ; /** Language Setting */ language = new FormControl ( '' ) ; /** Date Format Setting */ dateFormat = new FormControl ( '' ) ; param { SettingsService } settingsService constructor ( private settingsService ) { } ngOnInit ( ) { this . language . patchValue ( this . settingsService . language ) ; this . dateFormat . patchValue ( this . settingsService . dateFormat ) ; this . buildDependencies ( ) ; } /**
     * Subscribe to value changes.
     */ buildDependencies ( ) { this . language . valueChanges . subscribe ( ( language ) => { this . settingsService . setLanguage ( language ) ; } ) ; this . dateFormat . valueChanges . subscribe ( ( dateFormat ) => { this . settingsService . setDateFormat ( dateFormat ) ; } ) ; } param { any } option1 param { any } option2 compareOptions ( option1 , option2 ) { return option1 && option2 && option1 . code === option2 . code ; } }