Skip to content
Merged

Kaka #71

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 29 additions & 7 deletions frontend/main/src/app/body/body.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ <h3 class="dropdown-item-title">
</h3>
<p class="text-sm">Parabéns:</p>
<p class="text-sm text-muted" *ngFor="let aniversariante of aniversariantes; let i = index;">
<i class="fas fa-birthday-cake mr-1" ></i>{{aniversariante.nome}}
<i class="fas fa-birthday-cake mr-1"></i>{{aniversariante.nome}}
</p>
</div>
</div>
Expand Down Expand Up @@ -63,15 +63,36 @@ <h3 class="dropdown-item-title">
<a href="#" class="dropdown-item dropdown-footer">See All Messages</a>
</div>
</li>
<li class="nav-item dropdown">
<a class="nav-link" data-toggle="dropdown" href="#">
<i class="far fa-bell"></i>
<span class="badge badge-warning navbar-badge" *ngIf="this.notificationCount != 0">{{this.notificationCount}}</span>
</a>
<div class="dropdown-menu dropdown-menu-lg dropdown-menu-right">
<div *ngFor="let notify of notificacoes;let i = index">
<div class="dropdown-divider"></div>
<a href="#" routerLink={{notify.route}} class="dropdown-item">
<div class="media">
<div class="media-body">
<h3 class="dropdown-item-title">
{{notify.title}}
<span class="float-right text-sm text-danger"><i class="fas fa-star"></i></span>
</h3>
<p class="text-sm">{{notify.text}}</p>
</div>
</div>
</a>
</div>
</div>
</li>



</ul>
</nav>

<aside class="main-sidebar sidebar-primary bg-light elevation-4">
<a routerLink="/" class="brand-link">
<img src="./../favicon.ico" alt="AdminLTE Logo" class="brand-image img-circle elevation-3"
style="opacity: 0.8" />
<img src="./../favicon.ico" alt="AdminLTE Logo" class="brand-image img-circle elevation-3" style="opacity: 0.8" />
<span class="brand-text font-weight-light">TMS Project</span>
</a>

Expand Down Expand Up @@ -157,7 +178,7 @@ <h3 class="dropdown-item-title">
</ul>
</li>
<li class="nav-item">
<a href="" routerLink="finance" class="nav-link" [hidden]="!loginService.adminEnter">
<a href="" routerLink="finance" class="nav-link">
<i class="nav-icon fas fa-dollar-sign"></i>
<p>Finance
</p>
Expand All @@ -184,6 +205,7 @@ <h3 class="dropdown-item-title">
</div>
<div style="padding-left: 20px;">
<div class="small">Logged in as:</div>
<span>{{loginService.nome}}<br><a routerLink="" (click)="sair()" class="small" style="color: red;">Sair</a>&nbsp;&nbsp;&nbsp;&nbsp;<a routerLink="edit" class="small">Edit</a> </span>
<span>{{loginService.nome}}<br><a routerLink="" (click)="sair()" class="small"
style="color: red;">Sair</a>&nbsp;&nbsp;&nbsp;&nbsp;<a routerLink="edit" class="small">Edit</a> </span>
</div>
</aside>
</aside>
16 changes: 15 additions & 1 deletion frontend/main/src/app/body/body.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { LoginserviceService } from '../loginservice.service';
import { HttpClient } from '@angular/common/http';
import { Router } from '@angular/router';
import { Observable } from 'rxjs';
import { NotificationService } from '../notification.service';

@Component({
selector: 'app-body',
Expand All @@ -20,18 +21,25 @@ export class BodyComponent implements OnInit {
birthmonth! : string
aniversariantes!: Array<any>
aniversariantesMes!: Array<any>
notificacoes!:Array<any>
notificationCount!:number
id!: number
nome!: string
email!: string
birth!: Date
document!: string

constructor(public loginService:LoginserviceService, private router:Router, private http:HttpClient) { }
constructor(public loginService:LoginserviceService, private router:Router, private http:HttpClient, private notify:NotificationService) { }

ngOnInit(): void {

this.aniversariantes = new Array()
this.aniversariantesMes = new Array()
this.notificacoes = new Array()

if(this.loginService.document == null || this.loginService.birth == null){
this.notificacoes.push({title:"Complete seu Cadastro!", text:"Clique aqui para concluir!", route:"edit"})
}

this.http.get(this.APIBirthNow)
.subscribe((resultado:any) => {
Expand All @@ -40,6 +48,10 @@ export class BodyComponent implements OnInit {

for(let i=0;i<count;i++){

if(resultado[i].id == this.loginService.pessoaID){
this.notificacoes.push({title:"Hoje é seu Aniversário!", text:"Parabéns! Para comemorar temos algumas ofertas para você. Confira!", route:"ship-quote"})
}

this.aniversariantes.push({id: resultado[i].id ,nome: resultado[i].nome, email: resultado[i].email, birth: resultado[i].birth, document: resultado[i].document})

}
Expand All @@ -59,6 +71,8 @@ export class BodyComponent implements OnInit {

});

this.notificationCount = this.notificacoes.length

}

sair(){
Expand Down
14 changes: 7 additions & 7 deletions frontend/main/src/app/finance/finance.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,14 @@ <h2>LUCRO</h2>
<tspan x="6.51322328" y="74.3333333">75</tspan>
</text>
<text id="1600">
<tspan x="6.51322328" y="11">100</tspan>
<tspan x="6.51322328" y="9">100</tspan>
</text>
</g>
<g id="GRAPHS" transform="translate(64.000000, 16.000000)" stroke-linecap="round" stroke-width="8"
stroke-linejoin="round">
<polyline id="Banks" stroke="#5BCAC1"></polyline>
<polyline id="Bridge" stroke="#81DEFF"></polyline>
<polyline id="PayPal" stroke="#F6F5A6"></polyline>
<polyline id="cost1" stroke="#5BCAC1"></polyline>
<polyline id="cost2" stroke="#81DEFF"></polyline>
<polyline id="cost3" stroke="#F6F5A6"></polyline>
</g>
<g id="x_axis" transform="translate(71.974046, 271.541667)" font-size="11.0833333"
font-family=".HelveticaNeueDeskInterface-Regular, .Helvetica Neue DeskInterface" fill="#FFFFFF"
Expand Down Expand Up @@ -179,8 +179,8 @@ <h2>LUCRO</h2>
</div>
</div>
<div class="row">
<div class="col-3"><h1>R$ {{this.mediumCostPerPack}}/pack</h1></div>
<div class="col-1"></div>
<div class="col-3"><h1>R$ {{this.mediumCostPerCubHeight}}/Cub Height</h1></div>
<div class="col-4"><h1>R$ {{this.mediumCostPack}}/Package</h1></div>
<div class="col-2"></div>
<div class="col-4"><h1>R$ {{this.mediumCostCubHeight}}/Cubical Height</h1></div>
</div>
</div>
139 changes: 85 additions & 54 deletions frontend/main/src/app/finance/finance.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<this.totalPacks;i++){
this.totalCost =+ response[i].price
this.totalCubHeight =+ response[i].cub_height
}
if (this.totalPacks > 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)

}

Expand Down
1 change: 1 addition & 0 deletions frontend/main/src/app/loginservice.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
11 changes: 9 additions & 2 deletions frontend/main/src/app/notification.service.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { LoginserviceService } from './loginservice.service';

Expand All @@ -6,8 +7,14 @@ import { LoginserviceService } from './loginservice.service';
})
export class NotificationService {

constructor(private login:LoginserviceService) { }
notificacoes!:Array<any>


constructor(private login:LoginserviceService, private http:HttpClient) { }

findNotification(){



}

}