Skip to content
This repository has been archived by the owner on Oct 2, 2024. It is now read-only.

Commit

Permalink
fix bewerten funktion im frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcel Kaiser committed Mar 17, 2024
1 parent 40a8465 commit 459a192
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion frontend/mycargonaut/src/app/chat/chat.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,5 @@

</div>

<app-rating [userWhoWasEvaluated]="this.userToRateId" [bookingId]="this.bookingToRateId" *ngIf="isOwner"></app-rating>
<app-rating [userWhoWasEvaluated]="this.userToRateId" [bookingId]="this.bookingToRateId" [userIsDriver]="this.isDriver" *ngIf="isOwner"></app-rating>

8 changes: 7 additions & 1 deletion frontend/mycargonaut/src/app/chat/chat.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export class ChatComponent implements OnInit {
notEnoughCoins = false;
userToRateId = 0;
bookingToRateId = 0;
isDriver = false;

constructor(
private api: ApiService,
Expand Down Expand Up @@ -169,6 +170,11 @@ export class ChatComponent implements OnInit {
setRateInfos(booking: any) {
this.userToRateId = booking.userId;
this.bookingToRateId = booking.bookingId;
}

this.api.getRequest('ad/' + this.adId + '/type').subscribe((res: any) => {
if (res.data == 'offer') {
this.isDriver = true;
}
});
}
}
2 changes: 1 addition & 1 deletion frontend/mycargonaut/src/app/main/ad/ad.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -288,4 +288,4 @@ <h5 class="card-title adCardTitle p-1">{{writeTitle(ad)}}</h5>
</div>
</div>

<app-rating [userWhoWasEvaluated]="this.ad.userId" [bookingId]="this.adUserBooking.bookingId" *ngIf="this.adUserBooking"></app-rating>
<app-rating [userWhoWasEvaluated]="this.ad.userId" [bookingId]="this.adUserBooking.bookingId" [userIsDriver]="this.isDriver" *ngIf="this.adUserBooking"></app-rating>
5 changes: 5 additions & 0 deletions frontend/mycargonaut/src/app/main/ad/ad.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export class AdComponent implements OnInit{
stars: number[] = [1, 2, 3, 4, 5];
adUserBooking:any;
bookingDone = false;
isDriver= false;

constructor(
private route: ActivatedRoute,
Expand All @@ -66,6 +67,9 @@ export class AdComponent implements OnInit{
this.api.getRequest('ad/' + res.data.adId + '/type').subscribe((res2: any) => {
this.ad.type = res2.data;
this.type = res2.data;
if (this.type == 'wanted'){
this.isDriver = true;
}
this.api.getRequest(res2.data + '/' + res.data.adId).subscribe((typeSpecRes:any) => {
this.typeSpecificContent = typeSpecRes.data;
})
Expand All @@ -75,6 +79,7 @@ export class AdComponent implements OnInit{
})
if (this.isLogin) this.getState();
})

}

getState(){
Expand Down
2 changes: 1 addition & 1 deletion frontend/mycargonaut/src/app/rating/rating.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class RatingComponent {
@Input() userWhoIsEvaluating: any;
@Input() bookingId: any;
@Input() userWhoWasEvaluated: any;
userIsDriver = false;
@Input() userIsDriver: any;

constructor(private api: ApiService) {}

Expand Down

0 comments on commit 459a192

Please sign in to comment.