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
|
cellRenderer: this.customCellRendererFunc
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
timetest: number;
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute, private groupService: GroupsService, private router: Router,
|
constructor(private route: ActivatedRoute, private groupService: GroupsService, private router: Router,
|
||||||
public snackBar: MatSnackBar) { }
|
public snackBar: MatSnackBar) { }
|
||||||
@ -120,8 +121,14 @@ export class GroupDetailsComponent implements OnInit, OnDestroy {
|
|||||||
public onRowClicked(e) {
|
public onRowClicked(e) {
|
||||||
if (e.event.target !== undefined) {
|
if (e.event.target !== undefined) {
|
||||||
const data = e.data;
|
const data = e.data;
|
||||||
|
const now1 = new Date();
|
||||||
|
const now = now1.getTime();
|
||||||
const actionType = e.event.target.getAttribute('data-action-type');
|
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) {
|
switch (actionType) {
|
||||||
case 'remove':
|
case 'remove':
|
||||||
return this.onActionRemoveClick(e);
|
return this.onActionRemoveClick(e);
|
||||||
@ -130,9 +137,25 @@ export class GroupDetailsComponent implements OnInit, OnDestroy {
|
|||||||
default:
|
default:
|
||||||
this.goTo(e);
|
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) {
|
goTo(event: RowDoubleClickedEvent) {
|
||||||
if (this.dataToDisplay === 'fiszek') {
|
if (this.dataToDisplay === 'fiszek') {
|
||||||
this.router.navigate(['flashcards/sets', event.data.id]);
|
this.router.navigate(['flashcards/sets', event.data.id]);
|
||||||
@ -283,6 +306,7 @@ export class GroupDetailsComponent implements OnInit, OnDestroy {
|
|||||||
this.data = data;
|
this.data = data;
|
||||||
data.forEach(x => {
|
data.forEach(x => {
|
||||||
const temp = new Date(x['dateFrom']);
|
const temp = new Date(x['dateFrom']);
|
||||||
|
const tempstop = new Date(x['dateTo']);
|
||||||
x['startDate'] = '';
|
x['startDate'] = '';
|
||||||
const hours = temp.getHours();
|
const hours = temp.getHours();
|
||||||
const minutes = temp.getMinutes();
|
const minutes = temp.getMinutes();
|
||||||
|
Loading…
Reference in New Issue
Block a user