diff --git a/src/app/modules/shows/dialog/archive-dialog/archive-dialog.component.html b/src/app/modules/shows/dialog/archive-dialog/archive-dialog.component.html
new file mode 100644
index 0000000..69dab3c
--- /dev/null
+++ b/src/app/modules/shows/dialog/archive-dialog/archive-dialog.component.html
@@ -0,0 +1,9 @@
+
+
Die Veranstaltung wird archiviert und ist danach nichtmehr verfügbar.
+
+
+
+
+
diff --git a/src/app/modules/shows/dialog/archive-dialog/archive-dialog.component.less b/src/app/modules/shows/dialog/archive-dialog/archive-dialog.component.less
new file mode 100644
index 0000000..e69de29
diff --git a/src/app/modules/shows/dialog/archive-dialog/archive-dialog.component.spec.ts b/src/app/modules/shows/dialog/archive-dialog/archive-dialog.component.spec.ts
new file mode 100644
index 0000000..760bc5f
--- /dev/null
+++ b/src/app/modules/shows/dialog/archive-dialog/archive-dialog.component.spec.ts
@@ -0,0 +1,22 @@
+import {ComponentFixture, TestBed} from '@angular/core/testing';
+
+import {ArchiveDialogComponent} from './archive-dialog.component';
+
+describe('ArchiveDialogComponent', () => {
+ let component: ArchiveDialogComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async () => {
+ await TestBed.configureTestingModule({
+ declarations: [ArchiveDialogComponent],
+ }).compileComponents();
+
+ fixture = TestBed.createComponent(ArchiveDialogComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/modules/shows/dialog/archive-dialog/archive-dialog.component.ts b/src/app/modules/shows/dialog/archive-dialog/archive-dialog.component.ts
new file mode 100644
index 0000000..00a0b82
--- /dev/null
+++ b/src/app/modules/shows/dialog/archive-dialog/archive-dialog.component.ts
@@ -0,0 +1,8 @@
+import {Component} from '@angular/core';
+
+@Component({
+ selector: 'app-archive-dialog',
+ templateUrl: './archive-dialog.component.html',
+ styleUrls: ['./archive-dialog.component.less'],
+})
+export class ArchiveDialogComponent {}
diff --git a/src/app/modules/shows/services/show.service.ts b/src/app/modules/shows/services/show.service.ts
index 57c96d0..200bef8 100644
--- a/src/app/modules/shows/services/show.service.ts
+++ b/src/app/modules/shows/services/show.service.ts
@@ -27,7 +27,16 @@ export class ShowService {
() => this.showDataService.list$,
(user: User | null, shows: Show[]) => ({user, shows})
),
- map(s => s.shows.filter(_ => !_.archived).filter(show => show.published || (show.owner === s.user?.id && !publishedOnly)))
+ map(s =>
+ s.shows
+ .sort((a, b) => a.date.toMillis() - b.date.toMillis())
+ .map(_ => {
+ console.log(_);
+ return _;
+ })
+ .filter(_ => !_.archived)
+ .filter(show => show.published || (show.owner === s.user?.id && !publishedOnly))
+ )
);
}
diff --git a/src/app/modules/shows/show/show.component.ts b/src/app/modules/shows/show/show.component.ts
index 7c3a4c9..000a682 100644
--- a/src/app/modules/shows/show/show.component.ts
+++ b/src/app/modules/shows/show/show.component.ts
@@ -23,6 +23,8 @@ import {
} from '@fortawesome/free-solid-svg-icons';
import {CdkDragDrop, moveItemInArray} from '@angular/cdk/drag-drop';
import {fade} from '../../../animations';
+import {MatDialog} from '@angular/material/dialog';
+import {ArchiveDialogComponent} from '../dialog/archive-dialog/archive-dialog.component';
@Component({
selector: 'app-show',
@@ -56,7 +58,8 @@ export class ShowComponent implements OnInit, OnDestroy {
private showSongService: ShowSongService,
private docxService: DocxService,
private router: Router,
- private cRef: ChangeDetectorRef
+ private cRef: ChangeDetectorRef,
+ public dialog: MatDialog
) {}
public ngOnInit(): void {
@@ -102,8 +105,17 @@ export class ShowComponent implements OnInit, OnDestroy {
this.textSize -= 0.1;
}
- public async onArchive(archived: boolean): Promise {
- if (this.showId != null) await this.showService.update$(this.showId, {archived});
+ public onArchive(archived: boolean): void {
+ if (!archived && this.showId != null) void this.showService.update$(this.showId, {archived});
+ else {
+ const dialogRef = this.dialog.open(ArchiveDialogComponent, {
+ width: '350px',
+ });
+
+ dialogRef.afterClosed().subscribe((archive: boolean) => {
+ if (archive && this.showId != null) void this.showService.update$(this.showId, {archived});
+ });
+ }
}
public async onPublish(published: boolean): Promise {
diff --git a/src/app/modules/shows/shows.module.ts b/src/app/modules/shows/shows.module.ts
index d8a0849..eadba1a 100644
--- a/src/app/modules/shows/shows.module.ts
+++ b/src/app/modules/shows/shows.module.ts
@@ -34,9 +34,11 @@ import {SortByModule} from '../../widget-modules/pipes/sort-by/sort-by.module';
import {MatTooltipModule} from '@angular/material/tooltip';
import {FilterComponent} from './list/filter/filter.component';
import {EditComponent} from './edit/edit.component';
+import {ArchiveDialogComponent} from './dialog/archive-dialog/archive-dialog.component';
+import {MatDialogModule} from '@angular/material/dialog';
@NgModule({
- declarations: [NewComponent, ListComponent, ListItemComponent, ShowComponent, SongComponent, FilterComponent, EditComponent],
+ declarations: [NewComponent, ListComponent, ListItemComponent, ShowComponent, SongComponent, FilterComponent, EditComponent, ArchiveDialogComponent],
imports: [
CommonModule,
ShowsRoutingModule,
@@ -66,6 +68,7 @@ import {EditComponent} from './edit/edit.component';
RoleModule,
SortByModule,
MatTooltipModule,
+ MatDialogModule,
],
})
export class ShowsModule {}