diff --git a/src/app/tips/tips.component.html b/src/app/tips/tips.component.html index 60dc08f..677760d 100644 --- a/src/app/tips/tips.component.html +++ b/src/app/tips/tips.component.html @@ -1,17 +1,17 @@ - Enter tip: + {{ vE.tipsEnterTip }}:
- + - + - + @@ -31,10 +31,10 @@ diff --git a/src/app/tips/tips.component.ts b/src/app/tips/tips.component.ts index 15800d4..a458b3c 100644 --- a/src/app/tips/tips.component.ts +++ b/src/app/tips/tips.component.ts @@ -1,6 +1,9 @@ import { Inject, Component, OnInit } from '@angular/core'; import { MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog'; +import { LanguageService } from '../language.service'; +import { LanguageData } from '../language.model'; + @Component({ selector: 'app-tips', templateUrl: './tips.component.html', @@ -12,7 +15,21 @@ export class TipsComponent implements OnInit{ value:number = 0.15; flag:boolean = true; + // ------------------------------------- + // + // Language Support + // + vE = { + tipsEnterTip : '', + tipsSubtotal : '', + tipsTip : '', + tipsTotal : '', + tipsNoTipBtn : '', + tipsDoneBtn : '' + } + constructor( + private languageService : LanguageService, private dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) public data: {amt: number, flag: boolean}) { this.orderTotal = data.amt; @@ -26,6 +43,7 @@ export class TipsComponent implements OnInit{ if(!this.flag){ this.dialogRef.close(0); } + this.chgUILanguage(); } formatPercent(v: number) { @@ -39,4 +57,25 @@ export class TipsComponent implements OnInit{ confirm() { this.dialogRef.close(this.orderTotal * this.value); } + + chgUILanguage(){ + console.log('TIPS.chgUILanguage Called '); + this.languageService.getViewElements('tips').subscribe( + response => { + console.log('Received >> ', response ); + console.log('Language Code : ', response.language); + console.log('Component Name : ',response.component); + console.log('Language data : ',response.data); + + this.vE.tipsEnterTip = response.data.tips_enter_tip; + this.vE.tipsSubtotal = response.data.tips_subtotal; + this.vE.tipsTip = response.data.tips_tip; + this.vE.tipsTotal = response.data.tips_total; + this.vE.tipsNoTipBtn = response.data.tips_notip_btn; + this.vE.tipsDoneBtn = response.data.tips_done_btn; + }, + error => { console.log('Error >> ',error); } + ); + } + }
Subtotal {{ vE.tipsSubtotal }} Tip{{ vE.tipsTip }} Total{{ vE.tipsTotal }}
{{orderTotal | currency}}