Skip to content

Commit 4c4c24c

Browse files
committed
Remove fixed
1 parent 4d7083d commit 4c4c24c

File tree

6 files changed

+21
-14
lines changed

6 files changed

+21
-14
lines changed

frontend/src/app/app.module.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ import { VideogameCardComponent } from './components/videogame/videogame-card.co
2020
import { VideogameCatalogComponent } from './components/videogame/videogame-catalog.component';
2121
import { VideogameEditFormComponent } from './components/videogame/videogame-edit-form.component';
2222
import { VideogamePurchaseComponent } from './components/videogame/videogame-purchase.component';
23+
import { VideogameDetailComponent } from './components/videogame/videogame-detail.component';
24+
2325
import { EditNewComponent } from './components/news/editNew.component';
2426
import { EditNewFormComponent } from './components/news/editNewForm.component';
25-
27+
import { CommonModule } from '@angular/common';
2628

2729

2830
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
@@ -33,8 +35,8 @@ import { AboutComponent } from './components/about/about.component';
3335

3436

3537
@NgModule({
36-
declarations: [EditNewFormComponent,EditNewComponent,AboutComponent,CarouselComponent,AppComponent,VideogamePurchaseComponent,VideogameEditFormComponent, LoginComponent, HeadComponent, NewsComponent, NavBarComponent, FooterComponent, NewsTemplateComponent,VideogameCatalogComponent, ShowNewsComponent, HomeComponent, UserProfile,VideogameCardComponent],
37-
imports: [BrowserModule,NgbModule, FormsModule, HttpClientModule, routing, FormsModule,RouterModule],
38+
declarations: [EditNewFormComponent,VideogameDetailComponent,EditNewComponent,AboutComponent,CarouselComponent,AppComponent,VideogamePurchaseComponent,VideogameEditFormComponent, LoginComponent, HeadComponent, NewsComponent, NavBarComponent, FooterComponent, NewsTemplateComponent,VideogameCatalogComponent, ShowNewsComponent, HomeComponent, UserProfile,VideogameCardComponent],
39+
imports: [BrowserModule,NgbModule, FormsModule, HttpClientModule, routing, FormsModule,RouterModule,CommonModule],
3840
bootstrap: [AppComponent]
3941
})
4042
export class AppModule { }

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ <h1 class="display-5 fw-bolder text-white mb-2">{{videogame.title}}</h1>
1212
<p class="lead fw-normal text-white-50 mb-4" style="color: aliceblue !important;">{{videogame.shortDescription}}</p>
1313
</div>
1414
</div>
15-
<div class="col-xl-3 col-xxl-3 d-none d-xl-block text-center">
15+
<div class="col-xl-3 col-xxl-3 d-none d-xl-block text-center" *ngIf="islogged()">
1616
<p class="lead fw-normal text-white-50 mb-4"
1717
style="color: aliceblue !important; font-size: 2em !important;"> Precio: {{videogame.price}}€</p>
1818
<!--Button to pay-->

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,19 @@ export class VideogameDetailComponent{
2626
const okResponse = window.confirm('Do you want to remove this videogame?');
2727
if (okResponse) {
2828
this.videogameService.deleteVideogame(this.videogame).subscribe(
29-
_ => this.router.navigate(['/videogame/']), //Cambiar a el catalogo de videojuegos
29+
_ => this.router.navigate(['/videogamecatalog']), //Cambiar a el catalogo de videojuegos
3030
error => console.error(error)
3131
);
3232
}
3333
}
3434

35-
//Forbidden error falta ser admin
3635
editVideogame() {
3736
this.router.navigate(['/videogame/edit/' + this.videogame.id]);
3837
}
3938

40-
gotovideogamescatalog() {
41-
this.router.navigate(['/videogame']);
42-
}
43-
44-
purchasevideogame(){ //falta meter user id
45-
this.router.navigate(['/videogame/' + this.videogame.id + '/purchase/' ]);
39+
purchasevideogame(){
40+
var id = this.loginService.currentUser();
41+
this.router.navigate(['/videogame/' + this.videogame.id + '/purchase/' + id?.id]);
4642
}
4743

4844
videogameImage(){
@@ -54,6 +50,11 @@ export class VideogameDetailComponent{
5450
return this.videogame.imageCompany? '/api/videogames/'+this.videogame.id+'/companyImage' : '/assets/images/no_image.png';
5551
}
5652

53+
islogged(){
54+
var user = this.loginService.currentUser();
55+
return user;
56+
}
57+
5758
isAdmin(){
5859
return this.loginService.isAdmin();
5960
}

frontend/src/app/components/videogame/videogame-edit-form.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export class VideogameEditFormComponent{
4545
}
4646

4747
uploadImage(videogame: Videogame): void {
48-
48+
4949
const image = this.file.nativeElement.files[0];
5050
if (image) {
5151
let formData = new FormData();

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ <h3>Producto Comprado<br></h3>
3434
<tbody>
3535
<tr>
3636
<td class="esd-block-image" align="center"><a target="_blank"><img class="adapt-img"
37-
src="/videogame/{{videogame.id}}/imageVg" width="50%"></a></td>
37+
[src]="videogameImage()" width="50%"></a></td>
3838
</tr>
3939
</tbody>
4040
</table>

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,8 @@ export class VideogamePurchaseComponent{
4040
this.videogameService.purchasegame(this.videogame.id,this.user.id)
4141
}
4242

43+
videogameImage(){
44+
return this.videogame.imageVg? '/api/videogames/'+this.videogame.id+'/image' : '/assets/images/no_image.png';
45+
}
46+
4347
}

0 commit comments

Comments
 (0)