Skip to content

Commit 9246af5

Browse files
committed
a
1 parent 6862954 commit 9246af5

12 files changed

+470
-8
lines changed

backend/gamelink/src/main/resources/application.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ spring.mustache.suffix=.html
1010

1111
spring.datasource.url=jdbc:postgresql://localhost:5432/gamelink
1212
spring.datasource.username=postgres
13-
spring.datasource.password=Juanluis-123
13+
spring.datasource.password=password
1414
spring.jpa.hibernate.ddl-auto=create-drop
1515

1616
logging.level.org.springframework.security=DEBUG

backend/gamelink/target/classes/application.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ spring.mustache.suffix=.html
1010

1111
spring.datasource.url=jdbc:postgresql://localhost:5432/gamelink
1212
spring.datasource.username=postgres
13-
spring.datasource.password=Juanluis-123
13+
spring.datasource.password=password
1414
spring.jpa.hibernate.ddl-auto=create-drop
1515

1616
logging.level.org.springframework.security=DEBUG

frontend/src/app/app.module.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@ import { HomeComponent } from './components/home/home.component';
1717
import { UserProfile } from './components/user/userProfile.component';
1818
import { VideogameCardComponent } from './components/videogame/videogame-card.component';
1919
import { VideogameCatalogComponent } from './components/videogame/videogame-catalog.component';
20+
import { VideogameEditFormComponent } from './components/videogame/videogame-edit-form.component';
21+
import { VideogamePurchaseComponent } from './components/videogame/videogame-purchase.component';
2022

2123

2224

2325

2426

2527
@NgModule({
26-
declarations: [AppComponent, LoginComponent, HeadComponent, NewsComponent, NavBarComponent, FooterComponent, NewsTemplateComponent,VideogameCatalogComponent, ShowNewsComponent, HomeComponent, UserProfile,VideogameCardComponent],
28+
declarations: [AppComponent,VideogamePurchaseComponent,VideogameEditFormComponent, LoginComponent, HeadComponent, NewsComponent, NavBarComponent, FooterComponent, NewsTemplateComponent,VideogameCatalogComponent, ShowNewsComponent, HomeComponent, UserProfile,VideogameCardComponent],
2729
imports: [BrowserModule, FormsModule, HttpClientModule, routing, FormsModule,RouterModule],
2830
bootstrap: [AppComponent]
2931
})

frontend/src/app/app.routing.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { Routes, RouterModule } from '@angular/router';
22
import { VideogameDetailComponent } from './components/videogame/videogame-detail.component';
33
import { VideogameCatalogComponent } from './components/videogame/videogame-catalog.component';
4+
import { VideogameEditFormComponent } from './components/videogame/videogame-edit-form.component';
5+
import { VideogamePurchaseComponent } from './components/videogame/videogame-purchase.component';
46

57
import { HomeComponent } from './components/home/home.component';
68
import { NewsComponent } from './components/news/news.component';
@@ -17,7 +19,9 @@ const appRoutes = [
1719
{ path: 'userProfile', component: UserProfile},
1820
{ path: 'videogamecatalog', component: VideogameCatalogComponent },
1921
{ path: 'videogame/:id', component: VideogameDetailComponent },
20-
{ path: '', redirectTo: 'home', pathMatch: 'full' }
22+
{ path: 'videogame/edit/:id', component: VideogameEditFormComponent },
23+
{ path: 'videogame/:id/purchase/:id2', component: VideogamePurchaseComponent },
24+
{ path: '**', redirectTo: 'home', pathMatch: 'full' }
2125

2226
]
2327

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ <h2 class="fw-bolder fs-5 mb-4">Videojuegos</h2>
55
<div *ngIf="ready" id="moreImages" class="row gx-5">
66
<videogame-card class="col-lg-4 mb-5" *ngFor="let videogame of videogames;let i = index" [videogame]="videogame"></videogame-card>
77
</div>
8-
<div class="text-end mb-5 mb-xl-0">
8+
<div *ngIf="videogames.length == 9" class="text-end mb-5 mb-xl-0">
99
<a class="text-decoration-none">
1010
<button class="btn btn-secondary button" (click)="nextpage()" >
1111
<i class="fa fa-eye"></i> Pagina siguiente

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ <h1 class="display-5 fw-bolder text-white mb-2">{{videogame.title}}</h1>
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-->
19-
<a class="btn btn-primary btn-lg px-4 me-sm-3" id="payButton" href="/showVideogameUser/{{videogame.id}}">
19+
<button class="btn btn-primary btn-lg px-4 me-sm-3" id="payButton" (click)="purchasevideogame()">
2020
Comprar ya
2121
<span style="color: grey;">{{videogame.price}}€</span>
22-
</a>
22+
</button>
2323
</div>
2424
</div>
2525
</div>

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,17 @@ export class VideogameDetailComponent{
3232
}
3333
//Forbidden error falta ser admin
3434
editVideogame() {
35-
this.router.navigate(['/videogame/edit', this.videogame.id]);
35+
this.router.navigate(['/videogame/edit/' + this.videogame.id]);
3636
}
3737

3838
gotovideogamescatalog() {
3939
this.router.navigate(['/videogame']);
4040
}
4141

42+
purchasevideogame(){ //falta meter user id
43+
this.router.navigate(['/videogame/' + this.videogame.id + '/purchase/' ]);
44+
}
45+
4246
videogameImage(){
4347
return this.videogame.imageVg? '/api/videogames/'+this.videogame.id+'/image' : '/assets/images/no_image.png';
4448
}
Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
<main class="flex-shrink-0">
2+
<section>
3+
<form *ngIf="ready" action="/editVg/{{videogame.id}}" method="post" enctype="multipart/form-data">
4+
5+
<div class="container" style="background-color:#f5f5f5; margin-top: 5%; padding-bottom: 1%; ">
6+
7+
<div class="col-12" style="padding-bottom: 5%;">
8+
<h2 style="text-align: center; padding-top: 2%;">Edit Videogame Form</h2>
9+
</div>
10+
11+
<div class="row mt-2 d-flex justify-content-center">
12+
<div class="col-md-4 ">
13+
<div>
14+
<label>Title: </label>
15+
<p><textarea name="title" placeholder="title" style="width: 100%;">{{videogame.title}}</textarea></p>
16+
</div>
17+
</div>
18+
<div class="col-md-4 ">
19+
<div>
20+
<label>Price: </label>
21+
<p><input name="price" placeholder="price" type="number" value="{{videogame.price}}"
22+
style="width: 100%;"></p>
23+
</div>
24+
</div>
25+
</div>
26+
27+
<div class="row mt-2 d-flex justify-content-center">
28+
<div class="col-md-4 ">
29+
<div>
30+
<label>Company: </label>
31+
<p><textarea name="company" placeholder="company"
32+
style="width: 100%;">{{videogame.company}}</textarea></p>
33+
</div>
34+
</div>
35+
<div class="col-md-4 ">
36+
<div>
37+
<label>Continent: </label>
38+
<p><textarea name="continent" placeholder="continent"
39+
style="width: 100%;">{{videogame.continent}}</textarea></p>
40+
</div>
41+
</div>
42+
</div>
43+
44+
<div class="row mt-2 d-flex justify-content-center">
45+
46+
<div class="col-md-8 ">
47+
<div>
48+
<label>New Genre: </label>
49+
<select name="genre" placeholder="genre" style="width: 100%;">
50+
<option value="{{videogame.genre}}" selected>No cambiar</option>
51+
<option value="Estrategia">Estrategia</option>
52+
<option value="Shooter">Shooter</option>
53+
<option value="Accion">Accion</option>
54+
<option value="Supervivencia">Supervivencia</option>
55+
<option value="Aventura">Aventura</option>
56+
<option value="Rol">Rol</option>
57+
<option value="Deportes">Deportes</option>
58+
<option value="Construcción">Construcción</option>
59+
<option value="Carreras">Carreras</option>
60+
<option value="Simulacion">Simulacion</option>
61+
<option value="Terror">Terror</option>
62+
</select>
63+
</div>
64+
</div>
65+
</div>
66+
<div class="col-md-4 ">
67+
68+
</div>
69+
70+
<div class="row mt-3 d-flex justify-content-center">
71+
<div class="col-md-8">
72+
<div>
73+
<label style="text-align: left !important;">Game Content: </label>
74+
<p><textarea name="description" placeholder="description" rows="10"
75+
style="width: 100%;">{{videogame.description}}</textarea></p>
76+
</div>
77+
</div>
78+
</div>
79+
80+
<div class="row mt-3 d-flex justify-content-center">
81+
<div class="col-md-8">
82+
<div>
83+
<label style="text-align: left !important;">Game short description: </label>
84+
<p><textarea name="shortDescription" placeholder="shortDescription" rows="10"
85+
style="width: 100%;">{{videogame.shortDescription}}</textarea></p>
86+
</div>
87+
</div>
88+
</div>
89+
90+
<div class="row mt-3 d-flex justify-content-center">
91+
<div class="col-md-8">
92+
<div>
93+
<label style="text-align: left !important;">In game history: </label>
94+
<p><textarea name="history" placeholder="history" rows="10"
95+
style="width: 100%;">{{videogame.history}}</textarea></p>
96+
</div>
97+
</div>
98+
</div>
99+
100+
101+
102+
<div class="row mt-2 d-flex justify-content-center">
103+
<div class="col-md-4 ">
104+
<div>
105+
<label>Cpu recommended: </label>
106+
<p><textarea name="cpuR" placeholder="cpuR" style="width: 100%;">{{videogame.cpuR}}</textarea></p>
107+
</div>
108+
</div>
109+
<div class="col-md-4 ">
110+
<div>
111+
<label>Cpu min: </label>
112+
<p><textarea name="cpuM" placeholder="cpuM" style="width: 100%;">{{videogame.cpuM}}</textarea></p>
113+
</div>
114+
</div>
115+
</div>
116+
117+
<div class="row mt-2 d-flex justify-content-center">
118+
<div class="col-md-4 ">
119+
<div>
120+
<label>Ram recommended: </label>
121+
<p><textarea name="ramR" placeholder="ramR" style="width: 100%;">{{videogame.ramR}}</textarea></p>
122+
</div>
123+
</div>
124+
<div class="col-md-4 ">
125+
<div>
126+
<label>Ram min: </label>
127+
<p><textarea name="ramM" placeholder="ramM" style="width: 100%;">{{videogame.ramM}}</textarea></p>
128+
</div>
129+
</div>
130+
</div>
131+
132+
<div class="row mt-2 d-flex justify-content-center">
133+
<div class="col-md-4 ">
134+
<div>
135+
<label>Operativ system recommended: </label>
136+
<p><textarea name="ssooR" placeholder="ssooR" style="width: 100%;">{{videogame.ssooR}}</textarea></p>
137+
</div>
138+
</div>
139+
<div class="col-md-4 ">
140+
<div>
141+
<label>Operativ sistem min: </label>
142+
<p><textarea name="ssooM" placeholder="ssooM" style="width: 100%;">{{videogame.ssooM}}</textarea></p>
143+
</div>
144+
</div>
145+
</div>
146+
147+
<div class="row mt-2 d-flex justify-content-center">
148+
<div class="col-md-4 ">
149+
<div>
150+
<label>Gpu recommended: </label>
151+
<p><textarea name="gpuR" placeholder="gpuR" style="width: 100%;">{{videogame.gpuR}}</textarea></p>
152+
</div>
153+
</div>
154+
<div class="col-md-4 ">
155+
<div>
156+
<label>Gpu min: </label>
157+
<p><textarea name="gpuM" placeholder="gpuM" style="width: 100%;">{{videogame.gpuM}}</textarea></p>
158+
</div>
159+
</div>
160+
</div>
161+
162+
<div class="row mt-2 d-flex justify-content-center">
163+
<div class="col-md-4 ">
164+
<div>
165+
<label>Storage recommended: </label>
166+
<p><textarea name="storageR" placeholder="storageR"
167+
style="width: 100%;">{{videogame.storageR}}</textarea></p>
168+
</div>
169+
</div>
170+
<div class="col-md-4 ">
171+
<div>
172+
<label>Storage min: </label>
173+
<p><textarea name="storageM" placeholder="storageM"
174+
style="width: 100%;">{{videogame.storageM}}</textarea></p>
175+
</div>
176+
</div>
177+
</div>
178+
179+
<!-- <div class="row mt-3 d-flex justify-content-center">
180+
<div class="col-md-8">
181+
<p>Related News: </p>
182+
<select name="notices" multiple style="width: 100%;">
183+
{{#news}}
184+
<option value="{{ id }}">{{ title }}</option>
185+
{{/news}}
186+
</select>
187+
</div>
188+
</div> -->
189+
190+
191+
<div class="row mt-3 d-flex justify-content-center">
192+
<div class="col-4 ">
193+
<p>Videogame Image: </p>
194+
<p>
195+
<input type='file' name='imageField' accept=".jpg, .jpeg .png .svg" />
196+
</p>
197+
</div>
198+
199+
<div class="col-4 ">
200+
<p>Company Image: </p>
201+
<p>
202+
<input type='file' name='imageField1' accept=".jpg, .jpeg .png .svg" />
203+
</p>
204+
</div>
205+
</div>
206+
207+
<!-- <input type="hidden" name="_csrf" value="{{token}}" /> -->
208+
<p style="text-align: center;">
209+
<input class="btn btn-primary" type="submit" value="Save" />
210+
<!--Boton que ejecutara la función ajax-->
211+
<button class="btn btn-outline-light" style="color: black; border-color: black;"
212+
onclick="location.href='/'; return false;">Cancel</button>
213+
<!--Boton para cancelar la acción-->
214+
</p>
215+
</div>
216+
</form>
217+
</section>
218+
</main>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { Component, Input } from '@angular/core';
2+
import { Router,ActivatedRoute } from '@angular/router';
3+
import { Videogame } from 'src/app/models/videogame.model';
4+
import { VideogameService } from 'src/app/services/videogame.service';
5+
6+
@Component({
7+
selector: 'videogame-edit-form',
8+
templateUrl: './videogame-edit-form.component.html'
9+
})
10+
11+
export class VideogameEditFormComponent{
12+
13+
videogame!: Videogame;
14+
ready:boolean = false;
15+
16+
constructor(private router: Router, activatedroute:ActivatedRoute, public videogameService: VideogameService){
17+
const id = activatedroute.snapshot.params['id'];
18+
videogameService.getVideogame(id).subscribe(
19+
data => {console.log(data);this.videogame= data as Videogame},
20+
error => console.error(error)
21+
)
22+
23+
}
24+
25+
26+
ngOnInit(){
27+
this.ready = true;
28+
}
29+
30+
}

0 commit comments

Comments
 (0)