diff --git a/frontend/main/src/app/body/body.component.html b/frontend/main/src/app/body/body.component.html index 6192e04..3718070 100644 --- a/frontend/main/src/app/body/body.component.html +++ b/frontend/main/src/app/body/body.component.html @@ -24,7 +24,7 @@

Parabéns:

- {{aniversariante.nome}} + {{aniversariante.nome}}

@@ -63,15 +63,36 @@ 75 - 100 + 100 - - - + + + LUCRO
-

R$ {{this.mediumCostPerPack}}/pack

-
-

R$ {{this.mediumCostPerCubHeight}}/Cub Height

+

R$ {{this.mediumCostPack}}/Package

+
+

R$ {{this.mediumCostCubHeight}}/Cubical Height

diff --git a/frontend/main/src/app/finance/finance.component.ts b/frontend/main/src/app/finance/finance.component.ts index 55e92e8..51256b9 100644 --- a/frontend/main/src/app/finance/finance.component.ts +++ b/frontend/main/src/app/finance/finance.component.ts @@ -11,78 +11,109 @@ import { LoginserviceService } from '../loginservice.service'; }) export class FinanceComponent implements OnInit { - readonly packAPI:string = "http://localhost:8080/quote/packs/user/" - - totalCost!:number - recentCost!:number - mediumCostPerPack!:number - totalPacks!:number - mediumCostPerCubHeight!:number - totalCubHeight!:number - - poly_1_p1:number = -10 - poly_1_p2:number = -10 - poly_1_p3:number = -10 - poly_1_p4:number = -10 - poly_1_p5:number = -10 - poly_1_p6:number = -10 - poly_1_p7:number = -10 - - poly_2_p1:number = 115 - poly_2_p2:number = 115 - poly_2_p3:number = 115 - poly_2_p4:number = 115 - poly_2_p5:number = 115 - poly_2_p6:number = 115 - poly_2_p7:number = 115 - - poly_3_p1:number = 245 - poly_3_p2:number = 245 - poly_3_p3:number = 245 - poly_3_p4:number = 245 - poly_3_p5:number = 245 - poly_3_p6:number = 245 - poly_3_p7:number = 245 - - constructor(private login:LoginserviceService, private http:HttpClient) { } + readonly packAPI: string = "http://localhost:8080/quote/packs/user/" + + totalCost: number = 0 + recentCost: number = 0 + mediumCostPerPack: number = 0 + mediumCostPack!: string + totalPacks: number = 0 + mediumCostPerCubHeight: number = 0 + mediumCostCubHeight!: string + totalCubHeight: number = 0 + + poly_1_p1: number = -10 + poly_1_p2: number = -10 + poly_1_p3: number = -10 + poly_1_p4: number = -10 + poly_1_p5: number = -10 + poly_1_p6: number = -10 + poly_1_p7: number = -10 + + poly_2_p1: number = 115 + poly_2_p2: number = 115 + poly_2_p3: number = 115 + poly_2_p4: number = 115 + poly_2_p5: number = 115 + poly_2_p6: number = 115 + poly_2_p7: number = 115 + + poly_3_p1: number = 245 + poly_3_p2: number = 245 + poly_3_p3: number = 245 + poly_3_p4: number = 245 + poly_3_p5: number = 245 + poly_3_p6: number = 245 + poly_3_p7: number = 245 + + poly_4_p1: number = -10 + poly_4_p2: number = -10 + poly_4_p3: number = -10 + poly_4_p4: number = -10 + poly_4_p5: number = -10 + poly_4_p6: number = -10 + poly_4_p7: number = -10 + + poly_5_p1: number = 115 + poly_5_p2: number = 115 + poly_5_p3: number = 115 + poly_5_p4: number = 115 + poly_5_p5: number = 115 + poly_5_p6: number = 115 + poly_5_p7: number = 115 + + constructor(private login: LoginserviceService, private http: HttpClient) { } ngOnInit(): void { - this.http.get(this.packAPI+this.login.pessoaID) - .subscribe((response:any)=>{ - console.log(response); + this.http.get(this.packAPI + this.login.pessoaID) + .subscribe((response: any) => { + console.log(response); - this.totalPacks = Object.keys(response).length + this.totalPacks = Object.keys(response).length - for(let i=0;i 0) { - this.mediumCostPerPack = this.totalCost/this.totalPacks + for (let i = 0; i < this.totalPacks; i++) { + this.totalCost = + response[i].price + this.totalCubHeight = + response[i].cub_height + } - this.mediumCostPerCubHeight = this.totalCost/this.totalCubHeight + this.mediumCostPerPack = (this.totalCost / this.totalPacks) + this.mediumCostPerCubHeight = (this.totalCost / this.totalCubHeight) - console.log(this.totalCost); - console.log(this.totalCubHeight); + } + this.mediumCostPack = this.mediumCostPerPack + .toLocaleString('pt-BR', { + minimumFractionDigits: 2, + maximumFractionDigits: 2 + }) + this.mediumCostCubHeight = this.mediumCostPerCubHeight + .toLocaleString('pt-BR', { + minimumFractionDigits: 2, + maximumFractionDigits: 2 + }) + }) - }) + this.http.get(this.packAPI + 'recent/' + this.login.pessoaID) + .subscribe((response: any) => { + console.log(response); - this.http.get(this.packAPI+'recent/'+this.login.pessoaID) - .subscribe((response:any)=>{ - console.log(response); + }) - }) + document.getElementById('lucro3')?.setAttribute('points', '0.396183206 ' + this.poly_3_p1 + ' 73.40789833833333 ' + this.poly_3_p2 + ' 146.4196134706667 ' + this.poly_3_p3 + ' 219.431328603 ' + this.poly_3_p4 + ' 292.4430437353333 ' + this.poly_3_p5 + ' 365.4547588676667 ' + this.poly_3_p6 + ' 440 ' + this.poly_3_p7) - document.getElementById('lucro3')?.setAttribute('points','0.396183206 '+this.poly_3_p1 +' 73.40789833833333 '+ this.poly_3_p2 +' 146.4196134706667 '+ this.poly_3_p3 +' 219.431328603 '+ this.poly_3_p4 +' 292.4430437353333 '+ this.poly_3_p5 +' 365.4547588676667 '+ this.poly_3_p6 +' 440 '+ this.poly_3_p7) + document.getElementById('lucro2')?.setAttribute('points', '0.396183206 ' + this.poly_2_p1 + ' 73.40789833833333 ' + this.poly_2_p2 + ' 146.4196134706667 ' + this.poly_2_p3 + ' 219.431328603 ' + this.poly_2_p4 + ' 292.4430437353333 ' + this.poly_2_p5 + ' 365.4547588676667 ' + this.poly_2_p6 + ' 440 ' + this.poly_2_p7) - document.getElementById('lucro2')?.setAttribute('points','0.396183206 '+this.poly_2_p1 +' 73.40789833833333 '+ this.poly_2_p2 +' 146.4196134706667 '+ this.poly_2_p3 +' 219.431328603 '+ this.poly_2_p4 +' 292.4430437353333 '+ this.poly_2_p5 +' 365.4547588676667 '+ this.poly_2_p6 +' 440 '+ this.poly_2_p7) + document.getElementById('lucro1')?.setAttribute('points', '0.396183206 ' + this.poly_1_p1 + ' 73.40789833833333 ' + this.poly_1_p2 + ' 146.4196134706667 ' + this.poly_1_p3 + ' 219.431328603 ' + this.poly_1_p4 + ' 292.4430437353333 ' + this.poly_1_p5 + ' 365.4547588676667 ' + this.poly_1_p6 + ' 440 ' + this.poly_1_p7) - document.getElementById('lucro1')?.setAttribute('points', '0.396183206 '+this.poly_1_p1 +' 73.40789833833333 '+ this.poly_1_p2 +' 146.4196134706667 '+ this.poly_1_p3 +' 219.431328603 '+ this.poly_1_p4 +' 292.4430437353333 '+ this.poly_1_p5 +' 365.4547588676667 '+ this.poly_1_p6 +' 440 '+ this.poly_1_p7) + document.getElementById('cost1')?.setAttribute('points', '0.396183206 ' + this.poly_4_p1 + ' 73.40789833833333 ' + this.poly_4_p2 + ' 146.4196134706667 ' + this.poly_4_p3 + ' 219.431328603 ' + this.poly_4_p4 + ' 292.4430437353333 ' + this.poly_4_p5 + ' 365.4547588676667 ' + this.poly_4_p6 + ' 440 ' + this.poly_4_p7) + + document.getElementById('cost2')?.setAttribute('points', '0.396183206 ' + this.poly_5_p1 + ' 73.40789833833333 ' + this.poly_5_p2 + ' 146.4196134706667 ' + this.poly_5_p3 + ' 219.431328603 ' + this.poly_5_p4 + ' 292.4430437353333 ' + this.poly_5_p5 + ' 365.4547588676667 ' + this.poly_5_p6 + ' 440 ' + this.poly_5_p7) } diff --git a/frontend/main/src/app/loginservice.service.ts b/frontend/main/src/app/loginservice.service.ts index 656cd3c..e9a15f5 100644 --- a/frontend/main/src/app/loginservice.service.ts +++ b/frontend/main/src/app/loginservice.service.ts @@ -58,6 +58,7 @@ export class LoginserviceService implements CanActivate { this.admin = response[0].admin this.enterprise = response[0].enterprise + this.user = response[0].user if(this.admin == true){ this.adminEnter = true; diff --git a/frontend/main/src/app/notification.service.ts b/frontend/main/src/app/notification.service.ts index 21001b5..4790811 100644 --- a/frontend/main/src/app/notification.service.ts +++ b/frontend/main/src/app/notification.service.ts @@ -1,3 +1,4 @@ +import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { LoginserviceService } from './loginservice.service'; @@ -6,8 +7,14 @@ import { LoginserviceService } from './loginservice.service'; }) export class NotificationService { - constructor(private login:LoginserviceService) { } + notificacoes!:Array - + constructor(private login:LoginserviceService, private http:HttpClient) { } + + findNotification(){ + + + + } }