fix actions for other timeslots

This commit is contained in:
_Bastler 2021-08-12 20:31:52 +02:00
parent a11c74b91b
commit ffbcd7fe1a
2 changed files with 72 additions and 60 deletions

View File

@ -68,16 +68,18 @@
<th mat-header-cell *matHeaderCellDef mat-sort-header="stream"> {{'partey.timeslots.stream' | i18n}}
</th>
<td mat-cell *matCellDef="let timeslot">
<div *ngIf="timeslot.owner == userId">
<button *ngIf="timeslot.type == 'AUDIO'" mat-raised-button
(click)="copySecretToClipboard(timeslot.secret)">{{'partey.timeslots.secret.copy' | i18n}}</button>
<span *ngIf="timeslot.type == 'VIDEO'"> {{ timeslot.stream }} </span>
</div>
</td>
</ng-container>
<ng-container matColumnDef="edit">
<th mat-header-cell *matHeaderCellDef> {{'partey.timeslots.edit' | i18n}} </th>
<td mat-cell *matCellDef="let timeslot" class="text-right">
<a mat-icon-button>
<a *ngIf="timeslot.owner == userId" mat-icon-button>
<mat-icon (click)="openEdit(timeslot)">edit</mat-icon>
</a>
</td>
@ -86,7 +88,7 @@
<ng-container matColumnDef="delete">
<th mat-header-cell *matHeaderCellDef class="align-right"> {{'partey.timeslots.delete' | i18n}} </th>
<td mat-cell *matCellDef="let timeslot" class="text-right">
<a mat-icon-button>
<a *ngIf="timeslot.owner == userId" mat-icon-button>
<mat-icon (click)="confirmDelete(timeslot)">delete</mat-icon>
</a>
</td>

View File

@ -11,6 +11,7 @@ import {PageEvent} from '@angular/material/paginator';
import { ParteyTimeslotsService } from '../../../services/partey.timeslots.service';
import { ConfirmDialog } from '../../../ui/confirm/confirm.component';
import { I18nService } from './../../../services/i18n.service';
import { AuthService } from './../../../services/auth.service';
@Component({
selector: 'app-partey-timeslots',
@ -32,6 +33,7 @@ export class ParteyTimeslotsComponent implements OnInit {
pageSizeOptions: number[] = [ 5, 10, 25, 50 ];
visibilities = [ "PRIVATE", "PROTECTED", "PUBLIC" ];
types = [ "VIDEO", "AUDIO" ];
userId: any;
timeslotsColumns = [ "type", "starts", "ends", "title", "description", "stream", "edit", "delete" ];
@ -43,12 +45,20 @@ export class ParteyTimeslotsComponent implements OnInit {
constructor(
private formBuilder: FormBuilder,
private parteyTimeslotsService: ParteyTimeslotsService,
private authService: AuthService,
private i18n: I18nService,
private datePipe: DatePipe,
private snackBar: MatSnackBar,
public dialog: MatDialog) { }
ngOnInit(): void {
this.authService.auth.subscribe((auth: any) => {
if (auth.principal && auth.principal.userId) {
this.userId = auth.principal.userId;
}
});
this.datetimeformat = this.i18n.get('format.datetime', []);
this.form = this.formBuilder.group({