import { Component , ChangeDetectorRef , Input } from '@angular/core' ; import { NavController } from '@ionic/angular' ; import { DeviceComponent } from 'src/app/core/model/device.model' ; @ Component ( { selector : 'page-own-airdetector-dashboard' , templateUrl : 'own-airdetector-dashboard.html' , styleUrls : [ 'own-airdetector-dashboard.scss' ] } ) export class OwnAirdetectorDashboard implements DeviceComponent { @ Input ( ) device ; showus : boolean = false ; ico = "fal fa-meh-blank" ; showChart = false ; constructor ( public navCtrl , public changeDetectorRef ) { } ngOnInit ( ) { if ( typeof this . device . data == 'undefined' ) { } if ( typeof this . device . data [ "AQICN" ] == 'undefined' ) { this . device . data [ "AQICN" ] = 0 ; this . device . data [ "AQIUS" ] = 0 ; this . device . data [ "temp" ] = 0 ; this . device . data [ "humi" ] = 0 ; this . device . data [ "hcho" ] = 0 ; this . device . data [ "pm1.0" ] = 0 ; this . device . data [ "pm2.5" ] = 0 ; this . device . data [ "pm10" ] = 0 ; } } changeMode ( ) { this . showChart = ! this . showChart ; } subscribe ( ) { } processData ( ) { if ( this . device . data . AQICN <= 20 ) { this . ico = "fal fa-smile-wink" ; } else if ( this . device . data . AQICN > 20 && this . device . data . AQICN <= 50 ) { this . ico = "fal fa-smile" ; } else if ( this . device . data . AQICN > 50 && this . device . data . AQICN <= 100 ) { this . ico = "fal fa-meh" ; } else if ( this . device . data . AQICN > 100 && this . device . data . AQICN <= 150 ) { this . ico = "fal fa-frown" ; } else if ( this . device . data . AQICN > 150 && this . device . data . AQICN <= 200 ) { this . ico = "fal fa-tired" ; } else if ( this . device . data . AQICN > 200 && this . device . data . AQICN <= 300 ) { this . ico = "fal fa-dizzy" ; } else if ( this . device . data . AQICN > 300 ) { this . ico = "fal fa-skull" ; } } unsubscribe ( ) { } gotoSettings ( ) { } gotoHelp ( ) { } gotoChart ( ) { } gotoRealTime ( ) { } }