Dostępność testu w grupie o określonym czasie
This commit is contained in:
parent
cd33d8d7a9
commit
0dfe602ac7
@ -47,6 +47,7 @@ export class GroupDetailsComponent implements OnInit, OnDestroy {
|
||||
cellRenderer: this.customCellRendererFunc
|
||||
}
|
||||
];
|
||||
timetest: number;
|
||||
|
||||
constructor(private route: ActivatedRoute, private groupService: GroupsService, private router: Router,
|
||||
public snackBar: MatSnackBar) { }
|
||||
@ -120,8 +121,14 @@ export class GroupDetailsComponent implements OnInit, OnDestroy {
|
||||
public onRowClicked(e) {
|
||||
if (e.event.target !== undefined) {
|
||||
const data = e.data;
|
||||
const now1 = new Date();
|
||||
const now = now1.getTime();
|
||||
const actionType = e.event.target.getAttribute('data-action-type');
|
||||
|
||||
const temp = new Date(data['dateFrom']);
|
||||
const timetest = temp.getTime();
|
||||
const tempstop = new Date(data['dateTo']);
|
||||
const timeteststop = tempstop.getTime();
|
||||
if (timetest < now && now < timeteststop ) {
|
||||
switch (actionType) {
|
||||
case 'remove':
|
||||
return this.onActionRemoveClick(e);
|
||||
@ -130,7 +137,23 @@ export class GroupDetailsComponent implements OnInit, OnDestroy {
|
||||
default:
|
||||
this.goTo(e);
|
||||
}
|
||||
} else {
|
||||
switch (actionType) {
|
||||
case 'remove':
|
||||
return this.onActionRemoveClick(e);
|
||||
case 'edit':
|
||||
return this.showAvailabilityDialog(e.data);
|
||||
default:
|
||||
this.noTime();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
noTime() {
|
||||
this.snackBar.open('Test jest jeszcze nieaktywny.', null,
|
||||
{ duration: 3000, verticalPosition: 'top', panelClass: ['snackbar-error'] });
|
||||
}
|
||||
|
||||
goTo(event: RowDoubleClickedEvent) {
|
||||
@ -283,6 +306,7 @@ export class GroupDetailsComponent implements OnInit, OnDestroy {
|
||||
this.data = data;
|
||||
data.forEach(x => {
|
||||
const temp = new Date(x['dateFrom']);
|
||||
const tempstop = new Date(x['dateTo']);
|
||||
x['startDate'] = '';
|
||||
const hours = temp.getHours();
|
||||
const minutes = temp.getMinutes();
|
||||
|
Loading…
Reference in New Issue
Block a user