Skip to content
Snippets Groups Projects
Commit 5b72df65 authored by Lauryn Lorna Monthe Djomeni's avatar Lauryn Lorna Monthe Djomeni
Browse files

Add checkbox button on session administration

parent e52c1bd4
No related merge requests found
......@@ -55,13 +55,17 @@
</mat-tab>
</mat-tab-group>
<div fxLayoutAlign="center center">
<button mat-flat-button
type="button"
<label for="myCheck" style="background: darkgreen; font-size: larger;">{{ 'room-page.block' | translate }} </label>
<input type="checkbox" id= "myCheck" [(ngModel)]= "check" >
<!-- <button mat-raised-button
type="delete"
style="background-color: teal;"
(click)="blockQuestions()"
(click)="blockedQuestions()"
aria-labelledby="block">
<mat-icon>block</mat-icon>
{{ 'room-page.block' | translate }}</button>
{{ 'room-page.block' | translate }}</button> -->
<button mat-raised-button
class="delete"
......
......@@ -19,6 +19,7 @@ import { RoomDeleted } from '../../../../models/events/room-deleted';
})
export class RoomEditComponent implements OnInit {
editRoom: Room;
check: boolean = false;
roomNameFormControl = new FormControl('', [Validators.required, Validators.minLength(3), Validators.maxLength(30)]);
......@@ -69,6 +70,9 @@ export class RoomEditComponent implements OnInit {
}
save(): void {
this.editRoom.closed = this.check;
console.log(this.check);
this.roomService.updateRoom(this.editRoom).subscribe(r => this.editRoom = r);
if (!this.roomNameFormControl.hasError('required')
&& !this.roomNameFormControl.hasError('minlength')
&& !this.roomNameFormControl.hasError('maxlength')) {
......@@ -91,5 +95,17 @@ export class RoomEditComponent implements OnInit {
buildSaveActionCallback(): () => void {
return () => this.save();
}
public blockedQuestions() {
var checkBox = <HTMLInputElement> document.getElementById("myCheck");
var save = document.getElementById("save");
if(checkBox.checked){
console.log(checkBox.checked);
// flip state if clicked
this.editRoom.closed = !this.editRoom.closed;
this.roomService.updateRoom(this.editRoom).subscribe(r => this.editRoom = r);
}
console.log(checkBox.checked);
}
}
......@@ -9,6 +9,7 @@
*ngIf="confirmButtonClickAction !== undefined"
type="button"
mat-flat-button
id="save"
class="mat-flat-button {{ confirmButtonType }}-confirm-button"
attr.aria-labelledby="{{ ariaPrefix + 'confirm' | translate }}"
(click)="performConfirmButtonClickAction()"
......
import { Component, OnInit, Input, Output } from '@angular/core';
import { Room } from '../../../../models/room';
import { RoomService } from '../../../../services/http/room.service';
/**
* Available confirm button types.
......@@ -90,4 +92,5 @@ export class DialogActionButtonsComponent implements OnInit {
this.cancelButtonClickAction();
}
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment