diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 0b988ef1..fc537f9a 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -158,6 +158,11 @@ const routes: Routes = [ (m) => m.NotFoundPageModule ), }, + { + path: "member", + loadChildren: () => + import("./pages/member/member.module").then((m) => m.MemberPageModule), + }, ]; @NgModule({ diff --git a/src/app/pages/championship/championship-detail/championship-detail.page.html b/src/app/pages/championship/championship-detail/championship-detail.page.html index 03fae65a..a131f971 100644 --- a/src/app/pages/championship/championship-detail/championship-detail.page.html +++ b/src/app/pages/championship/championship-detail/championship-detail.page.html @@ -90,6 +90,10 @@

{{game.spectators}}

+ + Lineup + + {{"common.attendances__absences" | translate}} @@ -151,7 +155,9 @@

{{game.spectators}}

- {{member.firstName}} {{member.lastName}} + {{member.firstName}} {{member.lastName}}
@@ -173,7 +179,9 @@

{{game.spectators}}

- {{member.firstName}} {{member.lastName}} + {{member.firstName}} {{member.lastName}} diff --git a/src/app/pages/championship/championship-detail/championship-detail.page.ts b/src/app/pages/championship/championship-detail/championship-detail.page.ts index 0ce602e4..8d547d35 100644 --- a/src/app/pages/championship/championship-detail/championship-detail.page.ts +++ b/src/app/pages/championship/championship-detail/championship-detail.page.ts @@ -29,6 +29,9 @@ import { UserProfileService } from "src/app/services/firebase/user-profile.servi import { environment } from "src/environments/environment"; import { ActivatedRoute } from "@angular/router"; import { TranslateService } from "@ngx-translate/core"; +import { LineupPage } from "../lineup/lineup.page"; +import { Profile } from "src/app/models/user"; +import { MemberPage } from "../../member/member.page"; @Component({ selector: "app-championship-detail", @@ -280,6 +283,43 @@ export class ChampionshipDetailPage implements OnInit { console.log("no coordinates on map"); } } + async openMember(member: Profile) { + console.log("openMember"); + const modal = await this.modalCtrl.create({ + component: MemberPage, + presentingElement: await this.modalCtrl.getTop(), + canDismiss: true, + showBackdrop: true, + componentProps: { + data: member, + }, + }); + modal.present(); + + const { data, role } = await modal.onWillDismiss(); + + if (role === "confirm") { + } + } + + async openLineup(game: Game) { + // const presentingElement = await this.modalCtrl.getTop(); + const modal = await this.modalCtrl.create({ + component: LineupPage, + presentingElement: await this.modalCtrl.getTop(), + canDismiss: true, + showBackdrop: true, + componentProps: { + data: game, + }, + }); + modal.present(); + + const { data, role } = await modal.onWillDismiss(); + + if (role === "confirm") { + } + } openMaps(game: Game) { if (this.coordinates.coords.longitude && this.coordinates.coords.latitude) { diff --git a/src/app/pages/championship/lineup/lineup.module.ts b/src/app/pages/championship/lineup/lineup.module.ts index c8f36bf8..33a69247 100644 --- a/src/app/pages/championship/lineup/lineup.module.ts +++ b/src/app/pages/championship/lineup/lineup.module.ts @@ -7,9 +7,16 @@ import { IonicModule } from "@ionic/angular"; import { LineupPageRoutingModule } from "./lineup-routing.module"; import { LineupPage } from "./lineup.page"; +import { TranslateModule } from "@ngx-translate/core"; @NgModule({ - imports: [CommonModule, FormsModule, IonicModule, LineupPageRoutingModule], + imports: [ + CommonModule, + FormsModule, + IonicModule, + LineupPageRoutingModule, + TranslateModule, + ], declarations: [LineupPage], }) export class LineupPageModule {} diff --git a/src/app/pages/championship/lineup/lineup.page.html b/src/app/pages/championship/lineup/lineup.page.html index 5f5661c4..90998aa0 100644 --- a/src/app/pages/championship/lineup/lineup.page.html +++ b/src/app/pages/championship/lineup/lineup.page.html @@ -1,13 +1,112 @@ - - - lineup - - - - - + + - lineup + Lineup + + {{"common.close" | translate}} + - + + + + + Lineup + + + + + + {{"common.present" | translate}} + + + + + {{member.firstName}} {{member.lastName}} + + + + + + {{"common.present" | translate}} + + + + + {{member.firstName}} {{member.lastName}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/app/pages/championship/lineup/lineup.page.ts b/src/app/pages/championship/lineup/lineup.page.ts index 427958cb..813bdb97 100644 --- a/src/app/pages/championship/lineup/lineup.page.ts +++ b/src/app/pages/championship/lineup/lineup.page.ts @@ -1,4 +1,26 @@ -import { Component, OnInit } from "@angular/core"; +import { Component, OnInit, Input } from "@angular/core"; +import { + ItemReorderEventDetail, + ModalController, + NavParams, +} from "@ionic/angular"; +import { User } from "firebase/auth"; +import { + Observable, + catchError, + forkJoin, + map, + of, + switchMap, + take, + tap, +} from "rxjs"; +import { Game } from "src/app/models/game"; +import { Profile } from "src/app/models/user"; +import { AuthService } from "src/app/services/auth.service"; +import { ChampionshipService } from "src/app/services/firebase/championship.service"; +import { UserProfileService } from "src/app/services/firebase/user-profile.service"; +import { MemberPage } from "../../member/member.page"; @Component({ selector: "app-lineup", @@ -6,7 +28,144 @@ import { Component, OnInit } from "@angular/core"; styleUrls: ["./lineup.page.scss"], }) export class LineupPage implements OnInit { - constructor() {} + @Input("data") game: Game; - ngOnInit() {} + userProfile: Profile; + + skeleton = new Array(12); + blocks = [ + { + name: "block 1", + members: [], + }, + ]; + + game$: Observable; + user$: Observable; + user: User; + constructor( + private modalCtrl: ModalController, + private readonly userProfileService: UserProfileService, + private readonly authService: AuthService, + private navParams: NavParams, + private readonly championshipService: ChampionshipService + ) {} + + async ngOnInit() { + this.game = this.navParams.get("data"); + this.game.teamId = this.game.teamRef.id; + // console.log(this.game) + this.game$ = of(this.game); + this.game$ = this.getGame(this.game.teamRef.id, this.game.id); + } + getGame(teamId: string, gameId: string) { + return this.authService.getUser$().pipe( + take(1), + tap((user) => { + this.user = user; + if (!user) { + console.log("No user found"); + throw new Error("User not found"); + } + }), + switchMap(() => this.championshipService.getTeamGameRef(teamId, gameId)), + switchMap((game) => { + if (!game) return of(null); + return this.championshipService + .getTeamGameAttendeesRef(teamId, gameId) + .pipe( + switchMap((attendees) => { + if (attendees.length === 0) { + // If no attendees, return event data immediately + return of({ + ...game, + attendees: [], + attendeeListTrue: [], + attendeeListFalse: [], + status: null, + }); + } + const attendeeProfiles$ = attendees.map((attendee) => + this.userProfileService.getUserProfileById(attendee.id).pipe( + take(1), + map((profile) => ({ ...profile, ...attendee })), // Combine attendee object with profile + catchError(() => + of({ + ...attendee, + firstName: "Unknown", + lastName: "Unknown", + }) + ) + ) + ); + return forkJoin(attendeeProfiles$).pipe( + map((attendeesWithDetails) => ({ + ...game, + attendees: attendeesWithDetails, + attendeeListTrue: attendeesWithDetails.filter( + (e) => e.status == true + ), + attendeeListFalse: attendeesWithDetails.filter( + (e) => e.status == false + ), + status: attendeesWithDetails.find( + (att) => att.id == this.user.uid + )?.status, + })) + ); + }), + catchError(() => + of({ + ...game, + attendees: [], + status: null, + }) + ) + ); + }), + catchError((err) => { + console.error("Error in getTrainingWithAttendees:", err); + return of(null); + }) + ); + } + addMember(member: Profile) { + console.log("addmember"); + } + async openMember(member: Profile) { + console.log("openMember"); + const modal = await this.modalCtrl.create({ + component: MemberPage, + presentingElement: await this.modalCtrl.getTop(), + canDismiss: true, + showBackdrop: true, + componentProps: { + data: member, + }, + }); + modal.present(); + + const { data, role } = await modal.onWillDismiss(); + + if (role === "confirm") { + } + } + handleReorder(ev: CustomEvent) { + // The `from` and `to` properties contain the index of the item + // when the drag started and ended, respectively + console.log("Dragged from index", ev.detail.from, "to", ev.detail.to); + + // Finish the reorder and position the item in the DOM based on + // where the gesture ended. This method can also be called directly + // by the reorder group + ev.detail.complete(); + } + + async close() { + return await this.modalCtrl.dismiss(null, "close"); + } + + async confirm() { + return await this.modalCtrl.dismiss(null, "confirm"); + } } diff --git a/src/app/pages/club/club.page.html b/src/app/pages/club/club.page.html index aed676d0..4c468595 100644 --- a/src/app/pages/club/club.page.html +++ b/src/app/pages/club/club.page.html @@ -32,32 +32,38 @@ {{"common.requests" | translate}} - + - {{request?.firstName}} {{request?.lastName}} + {{request.firstName}} {{request.lastName}} {{request?.email}} {{"common.members" | translate}} - + - {{member?.firstName}} {{member?.lastName}} + {{member.firstName}} {{member.lastName}} {{"common.admins" | translate}} - + - {{admin?.firstName}} {{admin?.lastName}} + {{admin.firstName}} {{admin.lastName}} diff --git a/src/app/pages/club/club.page.ts b/src/app/pages/club/club.page.ts index e6e34538..06a915b1 100644 --- a/src/app/pages/club/club.page.ts +++ b/src/app/pages/club/club.page.ts @@ -40,6 +40,7 @@ import { Profile } from "src/app/models/user"; import { AuthService } from "src/app/services/auth.service"; import { FirebaseService } from "src/app/services/firebase.service"; import { UserProfileService } from "src/app/services/firebase/user-profile.service"; +import { MemberPage } from "../member/member.page"; @Component({ selector: "app-club", @@ -189,6 +190,24 @@ export class ClubPage implements OnInit { ); } + async openMember(member: Profile) { + console.log("openMember"); + const modal = await this.modalCtrl.create({ + component: MemberPage, + presentingElement: await this.modalCtrl.getTop(), + canDismiss: true, + showBackdrop: true, + componentProps: { + data: member, + }, + }); + modal.present(); + + const { data, role } = await modal.onWillDismiss(); + + if (role === "confirm") { + } + } async approveClubRequest(user) { console.log(user); const alert = await this.alertCtrl.create({ @@ -216,7 +235,9 @@ export class ClubPage implements OnInit { if (role == "confirm") { await this.fbService.approveUserClubRequest(user.clubId, user.id); const toast = await this.toastCtrl.create({ - message: await lastValueFrom(this.translate.get("club.success__user_added")), + message: await lastValueFrom( + this.translate.get("club.success__user_added") + ), color: "primary", duration: 1500, position: "bottom", diff --git a/src/app/pages/event/event-detail/event-detail.page.html b/src/app/pages/event/event-detail/event-detail.page.html index 48dd6100..e3a76a68 100644 --- a/src/app/pages/event/event-detail/event-detail.page.html +++ b/src/app/pages/event/event-detail/event-detail.page.html @@ -108,7 +108,9 @@

{{event.description}}

- {{member.firstName}} {{member.lastName}} + {{member.firstName}} {{member.lastName}} @@ -130,7 +132,9 @@

{{event.description}}

- {{member.firstName}} {{member.lastName}} + {{member.firstName}} {{member.lastName}} diff --git a/src/app/pages/event/event-detail/event-detail.page.ts b/src/app/pages/event/event-detail/event-detail.page.ts index 7e9ba9f5..d9f0aadf 100644 --- a/src/app/pages/event/event-detail/event-detail.page.ts +++ b/src/app/pages/event/event-detail/event-detail.page.ts @@ -15,9 +15,11 @@ import { tap, } from "rxjs"; import { Veranstaltung } from "src/app/models/event"; +import { Profile } from "src/app/models/user"; import { AuthService } from "src/app/services/auth.service"; import { EventService } from "src/app/services/firebase/event.service"; import { UserProfileService } from "src/app/services/firebase/user-profile.service"; +import { MemberPage } from "../../member/member.page"; @Component({ selector: "app-event-detail", @@ -113,7 +115,24 @@ export class EventDetailPage implements OnInit { }) ); } + async openMember(member: Profile) { + console.log("openMember"); + const modal = await this.modalCtrl.create({ + component: MemberPage, + presentingElement: await this.modalCtrl.getTop(), + canDismiss: true, + showBackdrop: true, + componentProps: { + data: member, + }, + }); + modal.present(); + + const { data, role } = await modal.onWillDismiss(); + if (role === "confirm") { + } + } async toggle(status: boolean, event: Veranstaltung) { console.log( `Set Status ${status} for user ${this.user.uid} and club ${this.event.clubId} and event ${event.id}` diff --git a/src/app/pages/helfer/helfer-detail/helfer-detail.page.html b/src/app/pages/helfer/helfer-detail/helfer-detail.page.html index d399ba8e..534f3117 100644 --- a/src/app/pages/helfer/helfer-detail/helfer-detail.page.html +++ b/src/app/pages/helfer/helfer-detail/helfer-detail.page.html @@ -112,7 +112,9 @@

{{event.description}}

- {{member.firstName}} {{member.lastName}} + {{member.firstName}} {{member.lastName}} @@ -134,7 +136,9 @@

{{event.description}}

- {{member.firstName}} {{member.lastName}} + {{member.firstName}} {{member.lastName}} diff --git a/src/app/pages/helfer/helfer-detail/helfer-detail.page.ts b/src/app/pages/helfer/helfer-detail/helfer-detail.page.ts index 4c7e12b9..6cc6deb4 100644 --- a/src/app/pages/helfer/helfer-detail/helfer-detail.page.ts +++ b/src/app/pages/helfer/helfer-detail/helfer-detail.page.ts @@ -14,9 +14,11 @@ import { tap, } from "rxjs"; import { HelferEvent } from "src/app/models/event"; +import { Profile } from "src/app/models/user"; import { AuthService } from "src/app/services/auth.service"; import { EventService } from "src/app/services/firebase/event.service"; import { UserProfileService } from "src/app/services/firebase/user-profile.service"; +import { MemberPage } from "../../member/member.page"; @Component({ selector: "app-helfer-detail", @@ -143,7 +145,24 @@ export class HelferDetailPage implements OnInit { }) ); } + async openMember(member: Profile) { + console.log("openMember"); + const modal = await this.modalCtrl.create({ + component: MemberPage, + presentingElement: await this.modalCtrl.getTop(), + canDismiss: true, + showBackdrop: true, + componentProps: { + data: member, + }, + }); + modal.present(); + const { data, role } = await modal.onWillDismiss(); + + if (role === "confirm") { + } + } async toggle(status: boolean, event: HelferEvent) { console.log( `Set Status ${status} for user ${this.user.uid} and team ${this.event.clubId} and event ${event.id}` diff --git a/src/app/pages/member/member-routing.module.ts b/src/app/pages/member/member-routing.module.ts new file mode 100644 index 00000000..72587af4 --- /dev/null +++ b/src/app/pages/member/member-routing.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from "@angular/core"; +import { Routes, RouterModule } from "@angular/router"; + +import { MemberPage } from "./member.page"; + +const routes: Routes = [ + { + path: "", + component: MemberPage, + }, +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule], +}) +export class MemberPageRoutingModule {} diff --git a/src/app/pages/member/member.module.ts b/src/app/pages/member/member.module.ts new file mode 100644 index 00000000..b12994ba --- /dev/null +++ b/src/app/pages/member/member.module.ts @@ -0,0 +1,22 @@ +import { NgModule } from "@angular/core"; +import { CommonModule } from "@angular/common"; +import { FormsModule } from "@angular/forms"; + +import { IonicModule } from "@ionic/angular"; + +import { MemberPageRoutingModule } from "./member-routing.module"; + +import { MemberPage } from "./member.page"; +import { TranslateModule } from "@ngx-translate/core"; + +@NgModule({ + imports: [ + CommonModule, + FormsModule, + IonicModule, + MemberPageRoutingModule, + TranslateModule, + ], + declarations: [MemberPage], +}) +export class MemberPageModule {} diff --git a/src/app/pages/member/member.page.html b/src/app/pages/member/member.page.html new file mode 100644 index 00000000..d89c71e7 --- /dev/null +++ b/src/app/pages/member/member.page.html @@ -0,0 +1,113 @@ + + + Member + + {{"common.close" | translate}} + + + + + + + + Member + + + + + + + {{"profile.generally" | translate}} + + + + + {{userProfile.firstName}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/app/pages/member/member.page.scss b/src/app/pages/member/member.page.scss new file mode 100644 index 00000000..e69de29b diff --git a/src/app/pages/member/member.page.spec.ts b/src/app/pages/member/member.page.spec.ts new file mode 100644 index 00000000..6b720f6b --- /dev/null +++ b/src/app/pages/member/member.page.spec.ts @@ -0,0 +1,17 @@ +import { ComponentFixture, TestBed } from "@angular/core/testing"; +import { MemberPage } from "./member.page"; + +describe("MemberPage", () => { + let component: MemberPage; + let fixture: ComponentFixture; + + beforeEach(async(() => { + fixture = TestBed.createComponent(MemberPage); + component = fixture.componentInstance; + fixture.detectChanges(); + })); + + it("should create", () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/pages/member/member.page.ts b/src/app/pages/member/member.page.ts new file mode 100644 index 00000000..721e88b6 --- /dev/null +++ b/src/app/pages/member/member.page.ts @@ -0,0 +1,46 @@ +import { Component, Input, OnInit } from "@angular/core"; +import { ModalController, NavParams } from "@ionic/angular"; +import { Observable, of } from "rxjs"; +import { Profile } from "src/app/models/user"; +import { UserProfileService } from "src/app/services/firebase/user-profile.service"; + +@Component({ + selector: "app-member", + templateUrl: "./member.page.html", + styleUrls: ["./member.page.scss"], +}) +export class MemberPage implements OnInit { + @Input("data") userProfile: Profile; + userProfile$: Observable; + skeleton = new Array(12); + constructor( + private readonly modalCtrl: ModalController, + private readonly profileService: UserProfileService, + private navParams: NavParams + ) {} + + ngOnInit() { + this.userProfile = this.navParams.get("data"); + this.userProfile$ = of(this.userProfile); + this.userProfile$ = this.getUserProfile(this.userProfile.id); + } + + getUserProfile(id) { + return this.profileService.getUserProfileById(id); + } + + async close() { + return await this.modalCtrl.dismiss(null, "close"); + // this.navController.pop(); + } + + async confirm() { + return await this.modalCtrl.dismiss(null, "confirm"); + /*this.navController.navigateBack("championship", { + state: { + role: "confirm", + data: this.game, + }, + });*/ + } +} diff --git a/src/app/pages/profile/profile.page.ts b/src/app/pages/profile/profile.page.ts index 79443d36..92f9f9df 100644 --- a/src/app/pages/profile/profile.page.ts +++ b/src/app/pages/profile/profile.page.ts @@ -13,7 +13,7 @@ import { } from "rxjs"; import { Device, DeviceId, DeviceInfo } from "@capacitor/device"; import { User } from "@angular/fire/auth"; -import { PushNotifications } from '@capacitor/push-notifications'; +import { PushNotifications } from "@capacitor/push-notifications"; // Services import { FirebaseService } from "src/app/services/firebase.service"; @@ -118,7 +118,7 @@ export class ProfilePage implements OnInit, AfterViewInit { // this.getClubList(); // this.getTeamList(); } - ngOnDestroy() { } + ngOnDestroy() {} getUserProfile(): Observable { // Replace 'any' with the actual type of the user profile @@ -137,9 +137,9 @@ export class ProfilePage implements OnInit, AfterViewInit { ); } - getClubRequestList() { } - getTeamRequestList() { } - getPushDeviceList() { } + getClubRequestList() {} + getTeamRequestList() {} + getPushDeviceList() {} async takePicture() { const loading = await this.loadingController.create({ @@ -238,9 +238,12 @@ export class ProfilePage implements OnInit, AfterViewInit { async togglePush(event) { // console.log(event); await this.profileService.changeSettingsPush(event.detail.checked); - + if (event.detail.checked) { - if (this.deviceInfo.platform == 'android' || this.deviceInfo.platform == 'ios') { + if ( + this.deviceInfo.platform == "android" || + this.deviceInfo.platform == "ios" + ) { this.registerPushDevice(); } else { console.log("implement web push"); @@ -252,7 +255,10 @@ export class ProfilePage implements OnInit, AfterViewInit { this.toastActionSaved(); } async togglePushModule(event, module) { - await this.profileService.changeSettingsPushModule(event.detail.checked, module); + await this.profileService.changeSettingsPushModule( + event.detail.checked, + module + ); this.toastActionSaved(); } @@ -270,17 +276,16 @@ export class ProfilePage implements OnInit, AfterViewInit { this.toastActionSaved(); } - async deletePushDevice(id) { await this.profileService.deletePushDevice(id); await this.toastActionSaved(); } registerPushDevice() { - PushNotifications.requestPermissions().then(result => { - if (result.receive === 'granted') { + PushNotifications.requestPermissions().then((result) => { + if (result.receive === "granted") { // Register with Apple / Google to receive push via APNS/FCM - PushNotifications.register(); + PushNotifications.register(); // --> this should trigger listener in app.component.ts to save token } else { // Show some error @@ -412,31 +417,35 @@ export class ProfilePage implements OnInit, AfterViewInit { label: "Old E-Mail", name: "oldEmail", type: "email", - value: oldEmail + value: oldEmail, }, { label: "New E-Mail", name: "newEmail", - type: "email" - } + type: "email", + }, + ], + buttons: [ + { + text: "Save", + role: "", + handler: async (data) => { + console.log(data); + await this.authService.updateEmail(data.newEmail); + await this.profileChange( + { detail: { value: data.newEmail } }, + "email" + ); + alert.dismiss(); + }, + }, + { + text: "Cancel", + handler: () => { + alert.dismiss(); + }, + }, ], - buttons: [{ - text: "Save", - role: "", - handler: async (data) => { - console.log(data); - await this.authService.updateEmail(data.newEmail); - await this.profileChange({ detail: { value: data.newEmail } }, "email") - alert.dismiss(); - } - }, - { - text: "Cancel", - handler: () => { - alert.dismiss(); - } - }] - }); alert.present(); // alert.onDidDismiss @@ -451,40 +460,40 @@ export class ProfilePage implements OnInit, AfterViewInit { label: "Street and Number", name: "streetAndNumber", type: "text", - value: profile.streetAndNumber + value: profile.streetAndNumber, }, { label: "Postalcode", name: "postalcode", type: "number", - value: profile.postalcode + value: profile.postalcode, }, { label: "City", name: "city", type: "text", - value: profile.city - } + value: profile.city, + }, + ], + buttons: [ + { + text: "Save", + role: "", + handler: () => { + alert.dismiss(); + }, + }, + { + text: "Cancel", + handler: () => { + alert.dismiss(); + }, + }, ], - buttons: [{ - text: "Save", - role: "", - handler: () => { - alert.dismiss(); - } - }, - { - text: "Cancel", - handler: () => { - alert.dismiss(); - } - }] - }); alert.present(); } - /* async languageChange(event) { console.log(event.target.value); diff --git a/src/app/pages/team/team-detail/team.page.html b/src/app/pages/team/team-detail/team.page.html index e59f7600..95fc45b6 100644 --- a/src/app/pages/team/team-detail/team.page.html +++ b/src/app/pages/team/team-detail/team.page.html @@ -36,32 +36,38 @@ {{"common.requests" | translate}} - + - {{request?.firstName}} {{request?.lastName}} + {{request.firstName}} {{request.lastName}} {{request?.email}} {{"common.members" | translate}} - + - {{member?.firstName}} {{member?.lastName}} + {{member.firstName}} {{member.lastName}} {{"commons.admins" | translate}} - + - {{admin?.firstName}} {{admin?.lastName}} + {{admin.firstName}} {{admin.lastName}} diff --git a/src/app/pages/team/team-detail/team.page.ts b/src/app/pages/team/team-detail/team.page.ts index 44b2c479..7a60f7d4 100644 --- a/src/app/pages/team/team-detail/team.page.ts +++ b/src/app/pages/team/team-detail/team.page.ts @@ -32,6 +32,7 @@ import { Profile } from "src/app/models/user"; import { AuthService } from "src/app/services/auth.service"; import { FirebaseService } from "src/app/services/firebase.service"; import { UserProfileService } from "src/app/services/firebase/user-profile.service"; +import { MemberPage } from "../../member/member.page"; @Component({ selector: "app-team", @@ -203,7 +204,24 @@ export class TeamPage implements OnInit { await this.fbService.approveUserTeamRequest(request.teamId, request.id); await this.toastActionSaved(); } + async openMember(member: Profile) { + console.log("openMember"); + const modal = await this.modalCtrl.create({ + component: MemberPage, + presentingElement: await this.modalCtrl.getTop(), + canDismiss: true, + showBackdrop: true, + componentProps: { + data: member, + }, + }); + modal.present(); + + const { data, role } = await modal.onWillDismiss(); + if (role === "confirm") { + } + } addTeamMember() { // this.fbService.getClubMemberRefs(this.team.) } diff --git a/src/app/pages/training/training-detail/training-detail.page.html b/src/app/pages/training/training-detail/training-detail.page.html index 0a148be2..6f724ebf 100644 --- a/src/app/pages/training/training-detail/training-detail.page.html +++ b/src/app/pages/training/training-detail/training-detail.page.html @@ -3,7 +3,9 @@ - {{"common.close" | translate}} + {{"common.close" | translate}} @@ -52,14 +54,12 @@

{{training.description}}

- Exercise - {{"common.attendances__absences" | translate}} @@ -121,7 +121,9 @@

{{training.description}}

- {{member.firstName}} {{member.lastName}} + {{member.firstName}} {{member.lastName}}
@@ -143,7 +145,9 @@

{{training.description}}

- {{member.firstName}} {{member.lastName}} + {{member.firstName}} {{member.lastName}} diff --git a/src/app/pages/training/training-detail/training-detail.page.ts b/src/app/pages/training/training-detail/training-detail.page.ts index 8547707f..e0b8e294 100644 --- a/src/app/pages/training/training-detail/training-detail.page.ts +++ b/src/app/pages/training/training-detail/training-detail.page.ts @@ -19,6 +19,8 @@ import { AuthService } from "src/app/services/auth.service"; import { TrainingService } from "src/app/services/firebase/training.service"; import { UserProfileService } from "src/app/services/firebase/user-profile.service"; import { TrainingExercisesPage } from "../training-exercises/training-exercises.page"; +import { MemberPage } from "../../member/member.page"; +import { Profile } from "src/app/models/user"; @Component({ selector: "app-training-detail", @@ -144,7 +146,24 @@ export class TrainingDetailPage implements OnInit { }); toast.present(); } + async openMember(member: Profile) { + console.log("openMember"); + const modal = await this.modalCtrl.create({ + component: MemberPage, + presentingElement: await this.modalCtrl.getTop(), + canDismiss: true, + showBackdrop: true, + componentProps: { + data: member, + }, + }); + modal.present(); + const { data, role } = await modal.onWillDismiss(); + + if (role === "confirm") { + } + } async openTrainingExerciseModal() { // const presentingElement = await this.modalCtrl.getTop(); const modal = await this.modalCtrl.create({