Skip to content

Commit e214152

Browse files
committed
Fixes
1 parent 2d5fc21 commit e214152

File tree

3 files changed

+23
-13
lines changed

3 files changed

+23
-13
lines changed

frontend/src/app/components/videogame/videogame-purchase.component.html

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
<table class="es-content-body" width="600" align="center">
2+
<table *ngIf="ready" class="es-content-body" width="600" align="center">
33
<tbody>
44
<tr>
55
<td class="container px-5" id="confirmPaymentBox1">
@@ -106,7 +106,7 @@ <h3>Producto Comprado<br></h3>
106106
</td>
107107
</tr>
108108
<tr>
109-
<td class="container px-5" id="confirmPaymentBox4y5">
109+
<td class="container px-5" id="confirmPaymentBox2y3">
110110
<table width="100%">
111111
<tbody>
112112
<tr>
@@ -127,7 +127,7 @@ <h3>Informacion y Confirmacion de Compra</h3>
127127
</td>
128128
</tr>
129129
<tr>
130-
<td class="container px-5" id="confirmPaymentBox4y5" align="center">
130+
<td class="container px-5" id="confirmPaymentBox2y3" align="center">
131131
<table width="100%">
132132
<tbody>
133133
<tr>
@@ -141,13 +141,14 @@ <h3>Informacion y Confirmacion de Compra</h3>
141141
</tbody>
142142
</table>
143143
</td>
144-
</tr>
145-
<tr>
146-
<td align="center" id="confirmPaymentFinalBox">
147-
<button onclick="location.href='/'; return false;">Cancelar</button>
148-
<button (onclick)="buygame()">COMPRAR</button>
149-
<button id="generatePDF">Descargar</button>
150-
</td>
151-
</tr>
144+
</tr>
145+
146+
152147
</tbody>
153148
</table>
149+
<p style="align-self: center; text-align: center;">
150+
<button class="btn btn-primary btn-lg px-4 me-sm-3 " type="button" (click)="buygame()">COMPRAR</button>
151+
<button class="btn btn-primary btn-lg px-4 me-sm-3" type="button" id="generatePDF">Descargar</button>
152+
<button class="btn btn-primary btn-lg px-4 me-sm-3" type="button" (click)="cancel()">Cancelar</button>
153+
</p>
154+

frontend/src/app/components/videogame/videogame-purchase.component.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@ export class VideogamePurchaseComponent{
1515
videogame!: Videogame;
1616
user!: Usero;
1717
date!: Date;
18+
ready:boolean = false;
1819
constructor(private router: Router, activatedroute:ActivatedRoute, public videogameService: VideogameService, useroService: UseroService){
1920
const id = activatedroute.snapshot.params['id'];
2021
const id2 = activatedroute.snapshot.params['id2'];
2122

2223
useroService.getUser(id2).subscribe(
23-
data => {this.user= data as Usero},
24+
data => {console.log(data);this.user= data as Usero},
2425
error => console.error(error)
2526
)
2627

@@ -34,14 +35,22 @@ export class VideogamePurchaseComponent{
3435
ngOnInit(){
3536
const now = new Date();
3637
this.date = now;
38+
this.ready = true;
39+
3740
}
3841

3942
buygame(){
4043
this.videogameService.purchasegame(this.videogame.id,this.user.id)
44+
this.router.navigate(['/videogamecatalog']);
45+
4146
}
4247

4348
videogameImage(){
4449
return this.videogame.imageVg? '/api/videogames/'+this.videogame.id+'/image' : '/assets/images/no_image.png';
4550
}
4651

52+
cancel(){
53+
this.router.navigate(['/videogame/' + this.videogame.id]);
54+
}
55+
4756
}

frontend/src/app/services/videogame.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export class VideogameService {
6969
if (id == undefined || idus == undefined){
7070
return alert("Error al comprar el videojuego, intentelo más tarde.")
7171
}
72-
return this.httpClient.delete(URL + id + '/purchase/' + idus)
72+
return this.httpClient.put(URL + id + '/purchase/' + idus, null)
7373
}
7474
/*
7575
addRelatedNew(videogame: Videogame) {

0 commit comments

Comments
 (0)