Skip to content

Commit

Permalink
Merge pull request #86 from myclubapp/feat/removeMembers
Browse files Browse the repository at this point in the history
Feat/remove members
  • Loading branch information
sansan88 authored Oct 4, 2023
2 parents 939eaa5 + d952fe4 commit b690be0
Show file tree
Hide file tree
Showing 8 changed files with 128 additions and 92 deletions.
103 changes: 26 additions & 77 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,87 +12,46 @@
<ion-label>myclub</ion-label>
</ion-item>

<ion-list slot="content">
<ion-list [inset]="true" slot="content">
<ion-note>{{ email }}</ion-note>

<ion-menu-toggle auto-hide="false">
<ion-item
routerDirection="root"
[routerLink]="['/t/news']"
lines="none"
detail="true"
routerLinkActive="selected"
>
<ion-item routerDirection="root" [routerLink]="['/t/news']" lines="none" detail="true"
routerLinkActive="selected">
<ion-icon slot="start" name="newspaper-outline"></ion-icon>
<ion-label>News</ion-label>
</ion-item>
<ion-item
routerDirection="root"
[routerLink]="['/t/training']"
lines="none"
detail="true"
routerLinkActive="selected"
>
<ion-item routerDirection="root" [routerLink]="['/t/training']" lines="none" detail="true"
routerLinkActive="selected">
<ion-icon slot="start" name="barbell-outline"></ion-icon>
<ion-label>Training</ion-label>
</ion-item>
<ion-item
routerDirection="root"
[routerLink]="['/t/championship']"
lines="none"
detail="true"
routerLinkActive="selected"
>
<ion-item routerDirection="root" [routerLink]="['/t/championship']" lines="none" detail="true"
routerLinkActive="selected">
<ion-icon slot="start" name="trophy-outline"></ion-icon>
<ion-label>Meisterschaft</ion-label>
</ion-item>
<ion-item
routerDirection="root"
[routerLink]="['/t/events']"
lines="none"
detail="true"
routerLinkActive="selected"
>
<ion-item routerDirection="root" [routerLink]="['/t/events']" lines="none" detail="true"
routerLinkActive="selected">
<ion-icon slot="start" name="calendar-outline"></ion-icon>
<ion-label>Events</ion-label>
</ion-item>
<ion-item
routerDirection="root"
[routerLink]="['/t/helfer']"
lines="none"
detail="true"
routerLinkActive="selected"
>
<ion-item routerDirection="root" [routerLink]="['/t/helfer']" lines="none" detail="true"
routerLinkActive="selected">
<ion-icon slot="start" name="help-buoy-outline"></ion-icon>
<ion-label>Helfer</ion-label>
</ion-item>

<ion-item
routerDirection="root"
[routerLink]="['/profile']"
lines="none"
detail="true"
routerLinkActive="selected"
>
<ion-icon
slot="start"
name="person-circle-outline"
></ion-icon>
<ion-item routerDirection="root" [routerLink]="['/profile']" lines="none" detail="true"
routerLinkActive="selected">
<ion-icon slot="start" name="person-circle-outline"></ion-icon>
<ion-label>Profil</ion-label>
</ion-item>
<ion-item
routerDirection="root"
[routerLink]="['/info']"
lines="none"
detail="true"
routerLinkActive="selected"
>
<ion-icon
slot="start"
name="information-circle-outline"
></ion-icon>
<ion-label>Infos & Hilfe</ion-label>
</ion-item>
<ion-item routerDirection="root" [routerLink]="['/info']" lines="none" detail="true"
routerLinkActive="selected">
<ion-icon slot="start" name="information-circle-outline"></ion-icon>
<ion-label>Infos & Hilfe</ion-label>
</ion-item>
</ion-menu-toggle>
</ion-list>
</ion-accordion>
Expand All @@ -101,32 +60,22 @@
<ion-label>Administration</ion-label>
</ion-item>

<ion-list slot="content">
<ion-list [inset]="true" slot="content">
<ion-menu-toggle auto-hide="false">
<ion-item
routerDirection="root"
[routerLink]="['/club-list']"
lines="none"
detail="true"
routerLinkActive="selected"
>
<ion-item routerDirection="root" [routerLink]="['/club-list']" lines="none" detail="true"
routerLinkActive="selected">
<ion-label>Mein Club</ion-label>
</ion-item>
<ion-item
routerDirection="root"
[routerLink]="['/team-list']"
lines="none"
detail="true"
routerLinkActive="selected"
>
<ion-item routerDirection="root" [routerLink]="['/team-list']" lines="none" detail="true"
routerLinkActive="selected">
<ion-label>Mein Team</ion-label>
</ion-item>
</ion-menu-toggle>
</ion-list>
</ion-accordion>
</ion-accordion-group>

<ion-list>
<ion-list [inset]="true">
<ion-item (click)="logout()">
<ion-icon slot="start" name="exit-outline"></ion-icon>
<ion-label>Logout</ion-label>
Expand Down Expand Up @@ -167,4 +116,4 @@
</ion-menu>
<ion-router-outlet id="main-content"></ion-router-outlet>
</ion-split-pane>
</ion-app>
</ion-app>
6 changes: 3 additions & 3 deletions src/app/pages/club/club.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
-->

<ng-container *ngIf="requestList$ | async as requests; else noRequests">
<ion-list *ngIf="requests.length > 0">
<ion-list [inset]="true" *ngIf="requests.length > 0">
<ion-list-header> Anfragen </ion-list-header>
<ion-item *ngFor="let request of requests">
<ion-avatar slot="start">
Expand All @@ -54,7 +54,7 @@
</ion-list>
</ng-container>

<ion-list >
<ion-list [inset]="true">
<ion-list-header> Mitglieder </ion-list-header>
<ion-item *ngFor="let member of memberList$ | async">
<ion-avatar slot="start">
Expand All @@ -64,7 +64,7 @@
</ion-item>
</ion-list>

<ion-list >
<ion-list [inset]="true">
<ion-list-header> Administratoren </ion-list-header>
<ion-item *ngFor="let admin of adminList$ | async">
<ion-avatar slot="start">
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/event/event-add/event-add.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export class EventAddPage implements OnInit {
const clubs$ = this.authService.getUser$().pipe(
take(1),
tap(user=>this.user = user),
switchMap(user => this.fbService.getAdminClubRefs(user).pipe(take(1))),
switchMap(user => this.fbService.getUserClubAdminRefs(user).pipe(take(1))),
concatMap(clubsArray => from(clubsArray)),
tap((club:Club)=>console.log(club.id)),
concatMap(club =>
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/helfer/helfer-add/helfer-add.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class HelferAddPage implements OnInit {
const clubs$ = this.authService.getUser$().pipe(
take(1),
tap(user=>this.user = user),
switchMap(user => this.fbService.getAdminClubRefs(user).pipe(take(1))),
switchMap(user => this.fbService.getUserClubAdminRefs(user).pipe(take(1))),
concatMap(clubsArray => from(clubsArray)),
tap((club:Club)=>console.log(club.id)),
concatMap(club =>
Expand Down
39 changes: 36 additions & 3 deletions src/app/pages/team/team.page.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<ion-header [translucent]="true">
<ion-toolbar>
<ion-buttons slot="secondary">
<ion-button *ngIf="!allowEdit" (click)="edit()">bearbeiten</ion-button>
<ion-button *ngIf="allowEdit" (click)="edit()">abbrechen</ion-button>
</ion-buttons>
<ion-title>{{team?.name}}</ion-title>
<ion-buttons slot="primary">
<ion-button (click)="close()">schliessen</ion-button>
Expand All @@ -14,8 +18,20 @@
</ion-toolbar>
</ion-header>

<ion-list [inset]="true">
<ion-item>
Anzahl Mitglieder:
</ion-item>
<ion-item>
Durchschnittsalter:
</ion-item>
<ion-item>
Trainingspräsenz:
</ion-item>
</ion-list>

<ng-container *ngIf="requestList$ | async as requests; else noRequests">
<ion-list *ngIf="requests.length > 0">
<ion-list [inset]="true" *ngIf="requests.length > 0">
<ion-list-header> Anfragen </ion-list-header>
<ion-item *ngFor="let request of requests">
<ion-avatar slot="start">
Expand All @@ -32,19 +48,36 @@
</ion-list>
</ng-container>

<ion-list >
<ion-list [inset]="true">
<ion-list-header> Mitglieder </ion-list-header>
<ion-item *ngFor="let member of memberList$ | async">

<ion-icon
*ngIf="allowEdit === true"
slot="icon-only"
color="danger"
slot="start"
(click)="removeMember(member)"
name="person-remove-outline"
></ion-icon>

<ion-avatar slot="start">
<img src="{{member?.profilePicture}}" />
</ion-avatar>
<ion-label> {{member?.firstName}} {{member?.lastName}} </ion-label>
</ion-item>
</ion-list>

<ion-list >
<ion-list [inset]="true">
<ion-list-header> Administratoren </ion-list-header>
<ion-item *ngFor="let admin of adminList$ | async">
<ion-icon
*ngIf="allowEdit === true"
slot="icon-only"
color="danger"
slot="start"
name="person-remove"
></ion-icon>
<ion-avatar slot="start">
<img src="{{admin?.profilePicture}}" />
</ion-avatar>
Expand Down
21 changes: 21 additions & 0 deletions src/app/pages/team/team.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import { UserProfileService } from "src/app/services/firebase/user-profile.servi
export class TeamPage implements OnInit {
@Input("data") team: Team;

allowEdit: boolean = false;

memberList$: Observable<Profile[]>;
adminList$: Observable<Profile[]>;
requestList$: Observable<Profile[]>;
Expand Down Expand Up @@ -148,6 +150,7 @@ export class TeamPage implements OnInit {

}


ngOnDestroy() {

if (this.subscriptionAdmin) {
Expand All @@ -162,6 +165,16 @@ export class TeamPage implements OnInit {

}

async removeAdmin(admin) {
await this.fbService.deleteTeamAdmin(this.team.id, admin.id);
await this.toastActionSaved();
}

async removeMember(member) {
await this.fbService.deleteTeamMember(this.team.id, member.id);
await this.toastActionSaved();
}

async deleteTeamRequest(request) {
await this.fbService.deleteUserTeamRequest(request.teamId, request.id);
await this.toastActionSaved();
Expand All @@ -184,6 +197,14 @@ export class TeamPage implements OnInit {
await toast.present();
}

edit() {
if (this.allowEdit){
this.allowEdit = false;
} else {
this.allowEdit = true;
}
}


async close() {
return await this.modalCtrl.dismiss(null, "close");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class TrainingCreatePage implements OnInit {
const teams$ = this.authService.getUser$().pipe(
take(1),
tap(user=>this.user = user),
switchMap(user => this.fbService.getAdminTeamRefs(user).pipe(take(1))),
switchMap(user => this.fbService.getUserTeamAdminRefs(user).pipe(take(1))),
concatMap(teamsArray => from(teamsArray)),
tap((team:Team)=>console.log(team.id)),
concatMap(team =>
Expand Down
Loading

0 comments on commit b690be0

Please sign in to comment.