Skip to content

Commit fd64004

Browse files
authored
Merge pull request #137 from marc101101/bug/endpoint-setting
Bug/endpoint setting
2 parents 0cdb62c + 72a0d5b commit fd64004

25 files changed

Lines changed: 198 additions & 23 deletions

angular.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@
4040
"serviceWorker": true,
4141
"ngswConfigPath": "client/ngsw-config.json",
4242
"fileReplacements": [
43+
{
44+
"replace": "client/environments/environment.ts",
45+
"with": "client/environments/environment.prod.ts"
46+
}
4347
]
4448
}
4549
}

client/app/components/home/categories/categories.component.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
height: 100%;
1515
width: 100%;
1616
overflow: hidden;
17-
box-shadow: 0px 0px 13px #6E6E6E;
17+
1818
}
1919

2020
.card {
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<div class="container fullScreenBackground">
2+
<div class="circleBackground"></div>
3+
<div class="columns is-mobile">
4+
<div class="column is-12" style="z-index: 0; padding: 2rem; padding-left: 5rem; padding-bottom: 0rem;">
5+
<div style="font-size: 1.5rem; color:white;">
6+
Kontakt
7+
</div>
8+
</div>
9+
<div class="columns is-mobile">
10+
</div>
11+
</div>
12+
13+
<div style="padding:1rem">
14+
<textarea class="textarea" placeholder="Wir freuen uns über Ihr Feedback." [(ngModel)]="contactMessage.text" ></textarea>
15+
</div>
16+
<div class="colum is-12" style="text-align: center; font-size: 2rem;">
17+
<i *ngIf="contactMessage.bewertung<1" class="fa fa-star-o" aria-hidden="true" (click)="contactMessage.bewertung = 1"></i>
18+
<i *ngIf="contactMessage.bewertung>=1" class="fa fa-star" aria-hidden="true" (click)="contactMessage.bewertung = 1"></i>
19+
20+
<i *ngIf="contactMessage.bewertung<2" class="fa fa-star-o" aria-hidden="true" (click)="contactMessage.bewertung = 2"></i>
21+
<i *ngIf="contactMessage.bewertung>=2" class="fa fa-star" aria-hidden="true" (click)="contactMessage.bewertung = 2"></i>
22+
23+
<i *ngIf="contactMessage.bewertung<3" class="fa fa-star-o" aria-hidden="true" (click)="contactMessage.bewertung = 3"></i>
24+
<i *ngIf="contactMessage.bewertung>=3" class="fa fa-star" aria-hidden="true" (click)="contactMessage.bewertung = 3"></i>
25+
26+
<i *ngIf="contactMessage.bewertung<4" class="fa fa-star-o" aria-hidden="true" (click)="contactMessage.bewertung = 4"></i>
27+
<i *ngIf="contactMessage.bewertung>=4" class="fa fa-star" aria-hidden="true" (click)="contactMessage.bewertung = 4"></i>
28+
29+
<i *ngIf="contactMessage.bewertung<5" class="fa fa-star-o" aria-hidden="true" (click)="contactMessage.bewertung = 5"></i>
30+
<i *ngIf="contactMessage.bewertung>=5" class="fa fa-star" aria-hidden="true" (click)="contactMessage.bewertung = 5"></i>
31+
</div>
32+
<div class="column is-12" style="padding: 1rem; padding-top:0rem">
33+
<button #send class="button is-primary is-medium is-fullwidth" style="margin-top:1.5rem" [disabled]="contactMessage.text == ''" (click)="submit()">
34+
<div>{{button_text}}</div>
35+
</button>
36+
</div>
37+
</div>
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
.circleBackground {
2+
height: 30rem;
3+
width: 30rem;
4+
z-index: -1;
5+
background-color: #209cee;
6+
border-radius: 15rem;
7+
position: absolute;
8+
margin-top: -13rem;
9+
margin-left: -7rem;
10+
}
11+
12+
.fullScreenBackground {
13+
position: absolute;
14+
width: 100%;
15+
overflow: hidden;
16+
17+
}
18+
19+
.card {
20+
margin-top: 1rem;
21+
border-radius: 0.5rem;
22+
}
23+
24+
.title {
25+
font-size: 1.25rem !important;
26+
padding-left: 1rem;
27+
}
28+
29+
.subtitle {
30+
font-size: 0.9rem;
31+
padding-left: 1rem;
32+
}
33+
34+
.color-marker {
35+
float: right;
36+
height: 100%;
37+
position: absolute;
38+
width: 10px;
39+
border-top-left-radius: 0.8rem;
40+
border-bottom-left-radius: 0.8rem;
41+
}
42+
43+
.textarea:not([rows]) {
44+
max-height: 605px;
45+
min-height: 20rem;
46+
}
47+
48+
.fa-star-o {
49+
padding: 0.5rem;
50+
}
51+
52+
.fa-star {
53+
padding: 0.5rem;
54+
}
55+
56+
.is-primary-save {
57+
background-color: #209cee !important;
58+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { Component, OnInit, ViewChild, Renderer2, ElementRef } from '@angular/core';
2+
import { Router } from '@angular/router';
3+
import { ContactService } from '../shared/contact.service';
4+
5+
@Component({
6+
selector: 'contact',
7+
templateUrl: './contact.component.html',
8+
styleUrls: ['./contact.component.scss']
9+
})
10+
export class ContactComponent {
11+
public dataIsAvailable: boolean = false;
12+
public button_text: string = "Feedback senden"
13+
public contactMessage: any = {
14+
text: "",
15+
bewertung: null,
16+
};
17+
18+
@ViewChild('send') sendButton: ElementRef;
19+
20+
constructor(
21+
private router: Router,
22+
private renderer: Renderer2,
23+
private contactService: ContactService) { }
24+
25+
submit():void{
26+
this.contactService.postContactFeedback(this.contactMessage).subscribe(response => {
27+
if(response.name != "HttpResponseError"){
28+
this.renderer.addClass(this.sendButton.nativeElement, 'is-primary-save');
29+
this.button_text = 'Senden erfolgreich';
30+
}
31+
});
32+
}
33+
}

client/app/components/home/courses/courses.component.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
height: 100%;
1515
width: 100%;
1616
overflow: hidden;
17-
box-shadow: 0px 0px 13px #6E6E6E;
17+
1818
}
1919

2020
.card {

client/app/components/home/home-routing.module.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { CategoriesComponent } from './categories/categories.component';
66
import { ProfilComponent } from './profil/profil.component';
77
import { CoursesComponent } from './courses/courses.component';
88
import { SingleCourseComponent } from './singlecourse/singlecourse.component';
9+
import { ContactComponent } from './contact/contact.component';
910

1011
const routes: Routes = [
1112
{
@@ -35,7 +36,7 @@ const routes: Routes = [
3536
},
3637
{
3738
path: 'kontakt',
38-
component: CategoriesComponent
39+
component: ContactComponent
3940
},
4041
{
4142
path: 'profil',

client/app/components/home/home.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@ import { CategoryService } from '../../services/category.service';
1616
import { CoursesComponent } from './courses/courses.component';
1717
import { CoursesService } from './shared/courses.service';
1818
import { SingleCourseComponent } from './singlecourse/singlecourse.component';
19+
import { ContactComponent } from './contact/contact.component';
1920

2021
@NgModule({
2122
declarations: [
2223
CategoriesComponent,
2324
ProfilComponent,
2425
CoursesComponent,
2526
SingleCourseComponent,
27+
ContactComponent,
2628
MenuComponent,
2729
HomeComponent
2830
],

client/app/components/home/profil/profil.component.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
height: 100%;
1515
width: 100%;
1616
overflow: hidden;
17-
box-shadow: 0px 0px 13px #6E6E6E;
17+
1818
}
1919

2020
.active{
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { Injectable } from '@angular/core';
2+
import { map, catchError } from 'rxjs/operators';
3+
import { Observable } from 'rxjs';
4+
import { environment } from '../../../../environments/environment';
5+
import { HttpHeaders, HttpClient, HttpErrorResponse } from '@angular/common/http';
6+
import { AlertService } from '../../../services/alert.service';
7+
import { of } from 'rxjs';
8+
9+
@Injectable({
10+
providedIn: 'root'
11+
})
12+
13+
export class ContactService {
14+
15+
private url: string = environment.apiUrl;
16+
17+
private httpOptions = {
18+
headers: new HttpHeaders({
19+
'Content-Type': 'application/json',
20+
'Authorization': localStorage.getItem('token')
21+
})
22+
};
23+
24+
constructor(public http: HttpClient, public alertService: AlertService) { }
25+
26+
postContactFeedback(feedback: any): Observable<any>{
27+
return this.http.post(this.url + "/contact/", feedback ,this.httpOptions).pipe(
28+
map((res: Response) => {
29+
return res;
30+
}),
31+
catchError((err: HttpErrorResponse) => {
32+
this.alertService.push(err);
33+
return of(err);
34+
})
35+
)
36+
}
37+
38+
}

0 commit comments

Comments
 (0)