Skip to content

Commit

Permalink
feat update
Browse files Browse the repository at this point in the history
  • Loading branch information
sansan88 committed Jan 13, 2024
1 parent 3ac02e8 commit 03c964f
Show file tree
Hide file tree
Showing 2 changed files with 137 additions and 17 deletions.
75 changes: 73 additions & 2 deletions src/app/pages/club/club.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
>{{"common.cancel" | translate}}</ion-button
>
</ion-buttons>
<ion-title>{{club?.name}}</ion-title>
<ion-title>Club Details</ion-title>
<ion-buttons slot="primary">
<ion-button (click)="close()"
>{{"common.close" | translate}}</ion-button
Expand All @@ -21,11 +21,29 @@
<ion-content [fullscreen]="true">
<ion-header collapse="condense">
<ion-toolbar>
<ion-title size="large">{{club.name}}</ion-title>
<ion-title size="large">Club Details</ion-title>
</ion-toolbar>
</ion-header>

<ion-list [inset]="true">

<ion-item>
<ion-thumbnail slot="start">
<img alt="{{club.name}}" src="{{club.logo}}" />
</ion-thumbnail>
<ion-label>{{club.name}}</ion-label>
</ion-item>
<ion-item>
<ion-label>type</ion-label>
<ion-badge slot="end">{{club.type}}</ion-badge>
</ion-item>
<ion-item>
<ion-label> {{club.website}} </ion-label>
</ion-item>
<ion-item>
<ion-label> {{club.wordpress}} </ion-label>
</ion-item>

<ion-item>
<ion-label> {{"common.no_of__members" | translate}}: </ion-label>
<ion-label slot="end"> {{club['clubMembers'].length}} </ion-label>
Expand All @@ -40,6 +58,57 @@
</ion-item>
-->
</ion-list>

<ion-list lines="full" [inset]="true">
<ion-list-header>
<ion-label> {{ "common.members" | translate}} </ion-label>
</ion-list-header>

<ion-item detail="true" (click)="openMemberList()">
<ion-icon name="people-circle-outline" slot="start"></ion-icon>
<ion-label> Mitglieder </ion-label>
<ion-badge>10</ion-badge>
</ion-item>

<ion-item detail="true" (click)="openAdminList()">
<ion-icon name="shield-half-outline" slot="start"></ion-icon>
<ion-label> Administratoren </ion-label>
<ion-badge>3</ion-badge>
</ion-item>


</ion-list>


<ion-list lines="full" [inset]="true">
<ion-list-header>
<ion-label> {{ "common.others" | translate}} </ion-label>
</ion-list-header>

<ion-item detail="true" (click)="openAdminList()">
<ion-icon name="help-buoy-outline" slot="start"></ion-icon>
<ion-label> Helferpunkte </ion-label>
<ion-badge>3</ion-badge>
</ion-item>
</ion-list>


<ion-list lines="full" [inset]="true">
<ion-list-header>
<ion-label> {{ "common.settings" | translate}} </ion-label>
</ion-list-header>

<ion-item >
<ion-icon name="hammer-outline" slot="start"></ion-icon>
<ion-label> API KEY </ion-label>

</ion-item>
</ion-list>



<!--
<ion-list [inset]="true" *ngIf="club['clubRequests'].length > 0">
<ion-list-header>
<ion-label> {{"common.requests" | translate}} </ion-label>
Expand Down Expand Up @@ -87,6 +156,8 @@
</ion-item>
</ion-list>
-->

<!--
<ion-list *ngIf="requestList.length > 0">
Expand Down
79 changes: 64 additions & 15 deletions src/app/pages/club/club.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class ClubPage implements OnInit {

alertTeamSelection = [];

allowEdit: boolean = false;
allowEdit: boolean = false;


constructor(
Expand Down Expand Up @@ -100,10 +100,13 @@ export class ClubPage implements OnInit {
if (!club) return of(null);
return combineLatest({
clubMembers: this.fbService.getClubMemberRefs(clubId),
clubAdmins: this.fbService.getClubAdminRefs(clubId),
clubRequests: this.fbService.getClubRequestRefs(clubId),
//clubAdmins: this.fbService.getClubAdminRefs(clubId),
//clubRequests: this.fbService.getClubRequestRefs(clubId),
}).pipe(
switchMap(({ clubMembers, clubAdmins, clubRequests }) => {
switchMap(({ clubMembers,
// clubAdmins,
// clubRequests
}) => {
const memberProfiles$ = clubMembers.map((member) =>
this.userProfileService.getUserProfileById(member.id).pipe(
take(1),
Expand All @@ -112,7 +115,7 @@ export class ClubPage implements OnInit {
)
)
);
const adminProfiles$ = clubAdmins.map((admin) =>
/* const adminProfiles$ = clubAdmins.map((admin) =>
this.userProfileService.getUserProfileById(admin.id).pipe(
take(1),
catchError(() =>
Expand All @@ -127,24 +130,31 @@ export class ClubPage implements OnInit {
of({ ...request, firstName: "Unknown", lastName: "Unknown" })
)
)
);
);*/
return forkJoin({
clubMembers: forkJoin(memberProfiles$).pipe(startWith([])),
clubAdmins: forkJoin(adminProfiles$).pipe(startWith([])),
clubRequests: forkJoin(clubRequests$).pipe(startWith([])),
// clubAdmins: forkJoin(adminProfiles$).pipe(startWith([])),
// clubRequests: forkJoin(clubRequests$).pipe(startWith([])),
}).pipe(
map(({ clubMembers, clubAdmins, clubRequests }) => ({
map(({ clubMembers,
// clubAdmins,
// clubRequests
}) => ({
clubMembers: clubMembers.filter(
(member) => member !== undefined
), // Filter out undefined
clubAdmins: clubAdmins.filter((admin) => admin !== undefined), // Filter out undefined
clubRequests: clubRequests.filter(
// clubAdmins: clubAdmins.filter((admin) => admin !== undefined), // Filter out undefined
/*clubRequests: clubRequests.filter(
(request) => request !== undefined
), // Filter out undefined
), // Filter out undefined*/
}))
);
}),
map(({ clubMembers, clubAdmins, clubRequests }) => {
map(({ clubMembers,
// clubAdmins,
// clubRequests
}) => {

const ages = clubMembers
.map((member) =>
member.hasOwnProperty("dateOfBirth")
Expand All @@ -163,8 +173,8 @@ export class ClubPage implements OnInit {
...club,
averageAge: averageAge.toFixed(1), // Keep two decimal places
clubMembers,
clubAdmins,
clubRequests,
// clubAdmins,
// clubRequests,
};
})
);
Expand Down Expand Up @@ -278,6 +288,45 @@ export class ClubPage implements OnInit {
}
}

async openMemberList() {
console.log("open Request Member");
const modal = await this.modalCtrl.create({
component: MemberPage,
presentingElement: await this.modalCtrl.getTop(),
canDismiss: true,
showBackdrop: true,
componentProps: {

},
});
modal.present();

const { data, role } = await modal.onWillDismiss();

if (role === "confirm") {
}
}


async openAdminList(){
console.log("open Request Member");
const modal = await this.modalCtrl.create({
component: MemberPage,
presentingElement: await this.modalCtrl.getTop(),
canDismiss: true,
showBackdrop: true,
componentProps: {

},
});
modal.present();

const { data, role } = await modal.onWillDismiss();

if (role === "confirm") {
}
}

async openRequestMember(member: Profile) {
console.log("open Request Member");
const modal = await this.modalCtrl.create({
Expand Down

0 comments on commit 03c964f

Please sign in to comment.