Skip to content

Commit

Permalink
feat changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sansan88 committed Mar 5, 2024
1 parent 183476e commit 212d6f3
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 14 deletions.
1 change: 1 addition & 0 deletions src/app/models/training.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@ export interface Training {
status: boolean;
countAttendees: number;
attendees: any;
exercises: any;
}
6 changes: 3 additions & 3 deletions src/app/pages/team/team-exercises/team-exercises.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@

<ng-container *ngIf="teamExerciseList$ | async as teamExerciseList; else loading">
<ion-list *ngIf="teamExerciseList.length > 0" lines="full">
<ion-list class="ion-padding" *ngIf="teamExerciseList.length > 0">

<ion-list-header>
<ion-label>Team Favoriten</ion-label>
<ion-label>Favoriten</ion-label>
</ion-list-header>
</ion-list>

<ion-item-sliding #item *ngFor="let exercise of teamExerciseList">
<ion-item type="button" detail="true">
<ion-icon slot="icon-only" color="success" slot="start" name="add-circle-outline"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export class TrainingCreatePage implements OnInit {

status: true,
attendees: [],
exercises: [],
countAttendees: 0,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,13 @@ <h3>{{exercise.description}}</h3>
<ion-label>
Training vom:
</ion-label>

<ion-button *ngIf="allowEdit" (click)="openTeamTrainingExercise()">
hinzufügen
</ion-button>
</ion-list-header>
<ion-item>
<ion-note>
Keine Übungen
Keine Übungen vorhanden
</ion-note>
</ion-item>
</ion-list>
Expand Down
5 changes: 2 additions & 3 deletions src/app/pages/training/trainings/trainings.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,8 @@ <h3>
<ion-icon slot="icon-only" name="trophy-outline"></ion-icon>
{{training.liga}} {{training.teamName}}
</h3>
<h3>
<ion-icon slot="icon-only" name="barbell-outline"></ion-icon>
exercises available
<h3 *ngIf="training.exercises.length > 0">
<ion-badge color="light">{{training.exercises.length}} Übungen vorhanden</ion-badge>
</h3>
</ion-label>
<ion-note slot="end" (click)="openTrainingDetailModal(training,true)">
Expand Down
20 changes: 14 additions & 6 deletions src/app/pages/training/trainings/trainings.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { TranslateService } from "@ngx-translate/core";
import { Team } from "src/app/models/team";
import { FilterService } from "src/app/services/filter.service";
import { ActivatedRoute, Router } from "@angular/router";
import { ExerciseService } from "src/app/services/firebase/exercise.service";

@Component({
selector: "app-trainings",
Expand Down Expand Up @@ -72,7 +73,8 @@ export class TrainingsPage implements OnInit {
private translate: TranslateService,
private filterService: FilterService,
private router: Router,
private activatedRoute: ActivatedRoute
private activatedRoute: ActivatedRoute,
private exerciseService: ExerciseService
) {
this.menuCtrl.enable(true, "menu");

Expand All @@ -99,7 +101,8 @@ export class TrainingsPage implements OnInit {
liga: "",
status: false,
countAttendees: 0,
attendees: undefined
attendees: undefined,
exercises: undefined,
};
this.openTrainingDetailModal(training, true);
} else {
Expand Down Expand Up @@ -195,10 +198,12 @@ export class TrainingsPage implements OnInit {
if (teamTrainings.length === 0) return of([]);
return combineLatest(
teamTrainings.map((training) =>
this.trainingService
.getTeamTrainingsAttendeesRef(team.id, training.id)
.pipe(
map((attendees) => {
combineLatest([
this.trainingService.getTeamTrainingsAttendeesRef(team.id, training.id),
this.exerciseService.getTeamTrainingExerciseRefs(team.id, training.id),
]).pipe(

map(([attendees, exercises]) => {
const userAttendee = attendees.find(
(att) => att.id == this.user.uid
);
Expand All @@ -208,6 +213,7 @@ export class TrainingsPage implements OnInit {
return {
...training,
attendees,
exercises,
status: status,
countAttendees: attendees.filter(
(att) => att.status == true
Expand All @@ -219,6 +225,7 @@ export class TrainingsPage implements OnInit {
of({
...training,
attendees: [],
exercises: [],
status: null,
countAttendees: 0,
teamId: team.id,
Expand Down Expand Up @@ -333,6 +340,7 @@ export class TrainingsPage implements OnInit {
);
}


async openTrainingDetailModal(training: Training, isFuture: boolean) {
// const presentingElement = await this.modalCtrl.getTop();
const modal = await this.modalController.create({
Expand Down

0 comments on commit 212d6f3

Please sign in to comment.