directly add song to show
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
<div [formGroup]="filterFormGroup">
|
<div [formGroup]="filterFormGroup">
|
||||||
|
|
||||||
|
|
||||||
<div class="third">
|
<div class="third">
|
||||||
<mat-form-field appearance="outline">
|
<mat-form-field appearance="outline">
|
||||||
<mat-label>Zeitraum</mat-label>
|
<mat-label>Zeitraum</mat-label>
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
<div>
|
<div>
|
||||||
<!-- <app-list-header *appRole="['leader']"></app-list-header>-->
|
<!-- <app-list-header *appRole="['leader']"></app-list-header>-->
|
||||||
<app-list-header *appRole="['leader']">
|
<app-list-header *appRole="['leader']">
|
||||||
<app-filter *ngIf="shows$ | async as shows" [shows]="shows"></app-filter>
|
<app-filter *ngIf="shows$ | async as shows" [shows]="publicShows$ | async"></app-filter>
|
||||||
</app-list-header>
|
</app-list-header>
|
||||||
|
|
||||||
<ng-container *appRole="['leader']">
|
<ng-container *appRole="['leader']">
|
||||||
<ng-container *ngIf="shows$ | async as shows">
|
<ng-container *ngIf="privateShows$ | async as shows">
|
||||||
<app-card
|
<app-card
|
||||||
*ngIf="getPrivateSongs(shows).length > 0"
|
*ngIf="shows.length > 0"
|
||||||
[padding]="false"
|
[padding]="false"
|
||||||
heading="meine Veranstaltungen"
|
heading="meine Veranstaltungen"
|
||||||
>
|
>
|
||||||
<app-list-item
|
<app-list-item
|
||||||
*ngFor="let show of getPrivateSongs(shows) | sortBy: 'desc':'date'"
|
*ngFor="let show of shows | sortBy: 'desc':'date'"
|
||||||
[routerLink]="show.id"
|
[routerLink]="show.id"
|
||||||
[show]="show"
|
[show]="show"
|
||||||
></app-list-item>
|
></app-list-item>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import {Component} from '@angular/core';
|
import {Component} from '@angular/core';
|
||||||
import {combineLatest, Observable} from 'rxjs';
|
import {combineLatest} from 'rxjs';
|
||||||
import {Show} from '../services/show';
|
import {Show} from '../services/show';
|
||||||
import {fade} from '../../../animations';
|
import {fade} from '../../../animations';
|
||||||
import {ShowService} from '../services/show.service';
|
import {ShowService} from '../services/show.service';
|
||||||
@@ -14,21 +14,17 @@ import {map} from 'rxjs/operators';
|
|||||||
animations: [fade],
|
animations: [fade],
|
||||||
})
|
})
|
||||||
export class ListComponent {
|
export class ListComponent {
|
||||||
public shows$: Observable<Show[]>;
|
public shows$ = this.showService.list$();
|
||||||
public publicShows$: Observable<Show[]>;
|
public privateShows$ = this.showService.list$().pipe(map(show => show.filter(_ => !_.published)));
|
||||||
public lastMonths$: Observable<number>;
|
public lastMonths$ = this.activatedRoute.queryParams.pipe(
|
||||||
|
|
||||||
public constructor(showService: ShowService, activatedRoute: ActivatedRoute) {
|
|
||||||
this.shows$ = showService.list$();
|
|
||||||
this.lastMonths$ = activatedRoute.queryParams.pipe(
|
|
||||||
map(params => {
|
map(params => {
|
||||||
const filterValues = params as FilterValues;
|
const filterValues = params as FilterValues;
|
||||||
if (!filterValues?.time) return 3;
|
if (!filterValues?.time) return 1;
|
||||||
return +filterValues.time;
|
return +filterValues.time;
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
this.publicShows$ = combineLatest([this.shows$, this.lastMonths$]).pipe(
|
public publicShows$ = combineLatest([this.shows$, this.lastMonths$]).pipe(
|
||||||
map(_ =>
|
map(_ =>
|
||||||
_[0].filter(f => {
|
_[0].filter(f => {
|
||||||
const d = new Date();
|
const d = new Date();
|
||||||
@@ -37,11 +33,8 @@ export class ListComponent {
|
|||||||
})
|
})
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
public getPrivateSongs(songs: Show[]): Show[] {
|
public constructor(private showService: ShowService, private activatedRoute: ActivatedRoute) {}
|
||||||
return songs.filter(_ => !_.published);
|
|
||||||
}
|
|
||||||
|
|
||||||
public trackBy = (index: number, show: unknown) => (show as Show).id;
|
public trackBy = (index: number, show: unknown) => (show as Show).id;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,6 +64,16 @@
|
|||||||
<app-button *appRole="['contributor']" [icon]="faEdit" routerLink="edit"
|
<app-button *appRole="['contributor']" [icon]="faEdit" routerLink="edit"
|
||||||
>Bearbeiten
|
>Bearbeiten
|
||||||
</app-button>
|
</app-button>
|
||||||
|
<ng-container *appRole="['leader']">
|
||||||
|
<app-button [icon]="faFileCirclePlus" [matMenuTriggerFor]="menu">
|
||||||
|
Zu Veranstaltung hinzufügen
|
||||||
|
</app-button>
|
||||||
|
<mat-menu #menu="matMenu">
|
||||||
|
<app-button (click)="addSongToShow(show, song)" *ngFor="let show of privateShows$|async">
|
||||||
|
{{ show.date.toDate() | date: "dd.MM.yyyy" }} {{ show.showType | showType }}
|
||||||
|
</app-button>
|
||||||
|
</mat-menu>
|
||||||
|
</ng-container>
|
||||||
</app-button-row>
|
</app-button-row>
|
||||||
</app-card>
|
</app-card>
|
||||||
<ng-container *ngIf="files$ | async as files">
|
<ng-container *ngIf="files$ | async as files">
|
||||||
|
|||||||
@@ -8,7 +8,10 @@ import {FileDataService} from '../services/file-data.service';
|
|||||||
import {File} from '../services/file';
|
import {File} from '../services/file';
|
||||||
import {UserService} from '../../../services/user/user.service';
|
import {UserService} from '../../../services/user/user.service';
|
||||||
import {User} from '../../../services/user/user';
|
import {User} from '../../../services/user/user';
|
||||||
import {faEdit, faTrash} from '@fortawesome/free-solid-svg-icons';
|
import {faEdit, faFileCirclePlus, faTrash} from '@fortawesome/free-solid-svg-icons';
|
||||||
|
import {ShowService} from '../../shows/services/show.service';
|
||||||
|
import {Show} from '../../shows/services/show';
|
||||||
|
import {ShowSongService} from '../../shows/services/show-song.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-song',
|
selector: 'app-song',
|
||||||
@@ -21,13 +24,17 @@ export class SongComponent implements OnInit {
|
|||||||
public user$: Observable<User | null> | null = null;
|
public user$: Observable<User | null> | null = null;
|
||||||
public faEdit = faEdit;
|
public faEdit = faEdit;
|
||||||
public faDelete = faTrash;
|
public faDelete = faTrash;
|
||||||
|
public faFileCirclePlus = faFileCirclePlus;
|
||||||
|
public privateShows$ = this.showService.list$().pipe(map(show => show.filter(_ => !_.published)));
|
||||||
|
|
||||||
public constructor(
|
public constructor(
|
||||||
private activatedRoute: ActivatedRoute,
|
private activatedRoute: ActivatedRoute,
|
||||||
private songService: SongService,
|
private songService: SongService,
|
||||||
private fileService: FileDataService,
|
private fileService: FileDataService,
|
||||||
private userService: UserService,
|
private userService: UserService,
|
||||||
private router: Router
|
private router: Router,
|
||||||
|
private showService: ShowService,
|
||||||
|
private showSongService: ShowSongService
|
||||||
) {
|
) {
|
||||||
this.user$ = userService.user$;
|
this.user$ = userService.user$;
|
||||||
}
|
}
|
||||||
@@ -57,4 +64,11 @@ export class SongComponent implements OnInit {
|
|||||||
await this.songService.delete(songId);
|
await this.songService.delete(songId);
|
||||||
await this.router.navigateByUrl('/songs');
|
await this.router.navigateByUrl('/songs');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async addSongToShow(show: Show, song: Song) {
|
||||||
|
if (!show) return;
|
||||||
|
const newId = await this.showSongService.new$(show?.id, song.id, false);
|
||||||
|
await this.showService.update$(show?.id, {order: [...show.order, newId ?? '']});
|
||||||
|
await this.router.navigateByUrl('/shows/' + show.id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ import {RoleModule} from '../../../services/user/role.module';
|
|||||||
import {StatusTranslaterModule} from '../../../widget-modules/pipes/status-translater/status-translater.module';
|
import {StatusTranslaterModule} from '../../../widget-modules/pipes/status-translater/status-translater.module';
|
||||||
import {ButtonModule} from '../../../widget-modules/components/button/button.module';
|
import {ButtonModule} from '../../../widget-modules/components/button/button.module';
|
||||||
import {FileComponent} from './file/file.component';
|
import {FileComponent} from './file/file.component';
|
||||||
|
import {MatMenuModule} from '@angular/material/menu';
|
||||||
|
import {ShowTypeTranslaterModule} from '../../../widget-modules/pipes/show-type-translater/show-type-translater.module';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [SongComponent, FileComponent],
|
declarations: [SongComponent, FileComponent],
|
||||||
@@ -31,6 +33,8 @@ import {FileComponent} from './file/file.component';
|
|||||||
RoleModule,
|
RoleModule,
|
||||||
StatusTranslaterModule,
|
StatusTranslaterModule,
|
||||||
ButtonModule,
|
ButtonModule,
|
||||||
|
MatMenuModule,
|
||||||
|
ShowTypeTranslaterModule,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class SongModule {}
|
export class SongModule {}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import {Component, Input} from '@angular/core';
|
import {Component, Input} from '@angular/core';
|
||||||
import {IconProp} from '@fortawesome/fontawesome-svg-core';
|
import {IconProp} from '@fortawesome/fontawesome-svg-core';
|
||||||
import {faCross} from '@fortawesome/free-solid-svg-icons';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-button',
|
selector: 'app-button',
|
||||||
@@ -8,5 +7,5 @@ import {faCross} from '@fortawesome/free-solid-svg-icons';
|
|||||||
styleUrls: ['./button.component.less'],
|
styleUrls: ['./button.component.less'],
|
||||||
})
|
})
|
||||||
export class ButtonComponent {
|
export class ButtonComponent {
|
||||||
@Input() public icon: IconProp = faCross;
|
@Input() public icon: IconProp | null = null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user