From 6c77a60a3c470ccd6744cc05187c505828ffa0dd Mon Sep 17 00:00:00 2001 From: rayb0y <104730143+rayb0y@users.noreply.github.com> Date: Mon, 2 May 2022 15:48:32 +0530 Subject: [PATCH] Add files via upload --- teams-page.component.html | 36 +++++++++++++++++++++++++++ teams-page.component.ts | 52 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 teams-page.component.html create mode 100644 teams-page.component.ts diff --git a/teams-page.component.html b/teams-page.component.html new file mode 100644 index 0000000..998180b --- /dev/null +++ b/teams-page.component.html @@ -0,0 +1,36 @@ +
+ + + + +
+ +
+ +

Score = {{ score }} xP = {{xp}}/100

+

Please add pokemons to teams

+ +
+
#{{id}}
+
{{pokemons[id].name}}
+
+ poke-teams-img +
+ +
+ +
+
+ + +
+ +
+ + + + + + +
\ No newline at end of file diff --git a/teams-page.component.ts b/teams-page.component.ts new file mode 100644 index 0000000..a5c3d93 --- /dev/null +++ b/teams-page.component.ts @@ -0,0 +1,52 @@ +import { Component, OnInit } from '@angular/core'; +import { TeamsService } from '../teams.service'; +import { XpService } from '../xp.service'; +import { ScoreService } from 'src/app/score.service'; +import { GlobalvarService } from 'src/app/globalvar.service'; +import { Router } from '@angular/router'; + +@Component({ + selector: 'app-teams-page', + templateUrl: './teams-page.component.html', + styleUrls: ['./teams-page.component.css'] +}) +export class TeamsPageComponent implements OnInit { + pokemons = this.teamServ.pokeArray; + + teamsArr = this.teamServ.getTeam(); + score = this.teamServ.getScore(); //Added the score in team service. + xp = this.xpServ.xp; + onClick(pokemonId: number) { + this.teamServ.removeFromTeam(pokemonId); + this.teamServ.removeScore(this.pokemons[pokemonId].base_experience); + } + + constructor(private teamServ: TeamsService, + private update: ScoreService, + private global: GlobalvarService, + private router: Router, + private xpServ: XpService) { } + + ngOnInit(): void { + console.log(this.teamServ.pokeArray); + console.log(this.teamServ.getTeam()); + } + + result: string; + email = this.global.receivedEmail; + onDone() { + + console.log(this.email, this.score); + this.update.updateScore(this.email, this.score).subscribe( + (response: any) => { + this.result = response; + } + ); + this.teamServ.score = 0; + this.xpServ.xp = 100; + this.teamServ.team = []; + this.router.navigate(['home']); + + } + +}